agentstudio 0.2.8 → 0.3.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.
Files changed (121) hide show
  1. package/index.d.ts.map +1 -1
  2. package/index.js +2 -0
  3. package/index.js.map +1 -1
  4. package/package.json +1 -1
  5. package/public/assets/{AgentsPage-DpXjvy0I.js → AgentsPage-Cl2yOPj5.js} +1 -1
  6. package/public/assets/{Button-u4yI-WsV.js → Button-DPVn3zDJ.js} +1 -1
  7. package/public/assets/{ChatPage-Boj_N_ec.js → ChatPage-BAslLt2l.js} +125 -125
  8. package/public/assets/{CommandsPage-DJyOtqIu.js → CommandsPage-DakxsAcv.js} +1 -1
  9. package/public/assets/{DashboardPage-CPyJ0iPo.js → DashboardPage-Dz5tihOs.js} +1 -1
  10. package/public/assets/{FileBrowser-CXd_LcTz.js → FileBrowser-BXtVLz8h.js} +1 -1
  11. package/public/assets/{GeneralSettingsPage-BIcZ0Tod.js → GeneralSettingsPage-CWWgquA9.js} +1 -1
  12. package/public/assets/{LandingPage-BlWek-wg.js → LandingPage-BDKkpXK0.js} +1 -1
  13. package/public/assets/{LoginPage-j9c0QS1W.js → LoginPage-1PbdWrXW.js} +1 -1
  14. package/public/assets/{McpAdminSettingsPage-Djm1tHK_.js → McpAdminSettingsPage-BlTO82W3.js} +1 -1
  15. package/public/assets/{McpPage-DjN_N6XO.js → McpPage-Bix7CnMS.js} +1 -1
  16. package/public/assets/{MemorySettingsPage-C06mG8J-.js → MemorySettingsPage-Dzq3vCns.js} +1 -1
  17. package/public/assets/{PluginsPage-C8H1LJqV.js → PluginsPage-oYSGDv3z.js} +1 -1
  18. package/public/assets/{ProjectSelector-l8LQCZCe.js → ProjectSelector-Bp1q7dra.js} +1 -1
  19. package/public/assets/ProjectsPage-BKpI8KE2.js +21 -0
  20. package/public/assets/{ScheduledTasksPage-C9bAZ-8o.js → ScheduledTasksPage-D2rYw_Qf.js} +1 -1
  21. package/public/assets/{SettingsLayout-Bv4IpkB5.js → SettingsLayout-CfmsuehF.js} +1 -1
  22. package/public/assets/{SkillsPage-DD-bktLO.js → SkillsPage-D01PYcoW.js} +1 -1
  23. package/public/assets/{SubagentsPage-BAXwEpQK.js → SubagentsPage-CDaYnbfn.js} +1 -1
  24. package/public/assets/{SystemInfoPage-41rDcUwB.js → SystemInfoPage-DAeYkq91.js} +1 -1
  25. package/public/assets/{TelemetrySettingsPage-CyXkNXJH.js → TelemetrySettingsPage-BPuPqJPR.js} +1 -1
  26. package/public/assets/{ToastTestPage-CtcmP941.js → ToastTestPage-DkZ9D943.js} +1 -1
  27. package/public/assets/{VersionSettingsPage-BLkrL0Ek.js → VersionSettingsPage-DHUbqInQ.js} +1 -1
  28. package/public/assets/{WebSocketTunnelPage-McDRE6Ff.js → WebSocketTunnelPage-BGeVdEp8.js} +1 -1
  29. package/public/assets/{_basePickBy-DDGafuFd.js → _basePickBy-BFNUdIR5.js} +1 -1
  30. package/public/assets/{_baseUniq-OZ7OoecG.js → _baseUniq-DP62Yq8R.js} +1 -1
  31. package/public/assets/{arc-C2QxosH7.js → arc-CkNwuwWZ.js} +1 -1
  32. package/public/assets/{architectureDiagram-VXUJARFQ-gBoRl0vw.js → architectureDiagram-VXUJARFQ-7Ky7pc6T.js} +1 -1
  33. package/public/assets/{blockDiagram-VD42YOAC-DDJh2Okf.js → blockDiagram-VD42YOAC-Ax8FYBYm.js} +1 -1
  34. package/public/assets/{c4Diagram-YG6GDRKO-C4b85nLT.js → c4Diagram-YG6GDRKO-CyNR39OO.js} +1 -1
  35. package/public/assets/channel-BKv1iINC.js +1 -0
  36. package/public/assets/{chunk-4BX2VUAB--YHjBv7U.js → chunk-4BX2VUAB-zM0Al_rU.js} +1 -1
  37. package/public/assets/{chunk-55IACEB6-B2-h5gVj.js → chunk-55IACEB6-CCDkr_yY.js} +1 -1
  38. package/public/assets/{chunk-B4BG7PRW-DRi5viyb.js → chunk-B4BG7PRW-yOb-P7Po.js} +1 -1
  39. package/public/assets/{chunk-DI55MBZ5-Xk-YhQRJ.js → chunk-DI55MBZ5-zGH8m4eb.js} +1 -1
  40. package/public/assets/{chunk-FMBD7UC4-DDcnlWsh.js → chunk-FMBD7UC4-DI1MjWfw.js} +1 -1
  41. package/public/assets/{chunk-QN33PNHL-OXq0iw2q.js → chunk-QN33PNHL-C_FDNT8n.js} +1 -1
  42. package/public/assets/{chunk-QZHKN3VN-D7P0oOa9.js → chunk-QZHKN3VN-V_K-gce9.js} +1 -1
  43. package/public/assets/{chunk-TZMSLE5B-Cts6I75U.js → chunk-TZMSLE5B-BnNBbkNq.js} +1 -1
  44. package/public/assets/{classDiagram-2ON5EDUG-BLM7y3rH.js → classDiagram-2ON5EDUG-DWylXt6j.js} +1 -1
  45. package/public/assets/{classDiagram-v2-WZHVMYZB-BLM7y3rH.js → classDiagram-v2-WZHVMYZB-DWylXt6j.js} +1 -1
  46. package/public/assets/clone-BnTQiQb4.js +1 -0
  47. package/public/assets/{cose-bilkent-S5V4N54A-6uP92_NU.js → cose-bilkent-S5V4N54A-DrNb0vKp.js} +1 -1
  48. package/public/assets/{dagre-6UL2VRFP-CK2VJLzv.js → dagre-6UL2VRFP-CtKFNLmb.js} +1 -1
  49. package/public/assets/{diagram-PSM6KHXK-C-ZaY5UR.js → diagram-PSM6KHXK-DpQfOKt-.js} +1 -1
  50. package/public/assets/{diagram-QEK2KX5R-KM9LoLux.js → diagram-QEK2KX5R-DscZmfZJ.js} +1 -1
  51. package/public/assets/{diagram-S2PKOQOG-C8uziTLV.js → diagram-S2PKOQOG-UbEZAQ1u.js} +1 -1
  52. package/public/assets/{erDiagram-Q2GNP2WA-DHFQ6rZ5.js → erDiagram-Q2GNP2WA-mmTcLBrY.js} +1 -1
  53. package/public/assets/{flowDiagram-NV44I4VS-CzNBOu8h.js → flowDiagram-NV44I4VS-BsIXhV1w.js} +1 -1
  54. package/public/assets/{ganttDiagram-LVOFAZNH-vqd0zpgi.js → ganttDiagram-LVOFAZNH-CaHkiTYy.js} +1 -1
  55. package/public/assets/{gitGraphDiagram-NY62KEGX-BOW5S00P.js → gitGraphDiagram-NY62KEGX-B-ctMH3l.js} +1 -1
  56. package/public/assets/{graph-BP_Rwsef.js → graph-CtuWuGCI.js} +1 -1
  57. package/public/assets/{index-h5dd40hU.js → index-D9bAK8SN.js} +4 -4
  58. package/public/assets/{infoDiagram-F6ZHWCRC-LVLvTvsq.js → infoDiagram-F6ZHWCRC-DMsG_8YD.js} +1 -1
  59. package/public/assets/{journeyDiagram-XKPGCS4Q-Cf_fvy7_.js → journeyDiagram-XKPGCS4Q-XnBAE0k9.js} +1 -1
  60. package/public/assets/{kanban-definition-3W4ZIXB7-u6UccFfM.js → kanban-definition-3W4ZIXB7-DY1J_CQA.js} +1 -1
  61. package/public/assets/{layout-sH_TKNrG.js → layout-BBAqRBns.js} +1 -1
  62. package/public/assets/{linear-BdE0kKFb.js → linear-DXGOqRyX.js} +1 -1
  63. package/public/assets/{mindmap-definition-VGOIOE7T-9d-rVW5A.js → mindmap-definition-VGOIOE7T-D8LYlQnr.js} +1 -1
  64. package/public/assets/{pieDiagram-ADFJNKIX-U_y5PbGf.js → pieDiagram-ADFJNKIX-DqZw-HeQ.js} +1 -1
  65. package/public/assets/{quadrantDiagram-AYHSOK5B-DGb0hrEb.js → quadrantDiagram-AYHSOK5B-CfjEkg6d.js} +1 -1
  66. package/public/assets/{requirementDiagram-UZGBJVZJ-DNTHnK1t.js → requirementDiagram-UZGBJVZJ-CEbDefgn.js} +1 -1
  67. package/public/assets/{sankeyDiagram-TZEHDZUN-5uBZF1V2.js → sankeyDiagram-TZEHDZUN-DOU4OJks.js} +1 -1
  68. package/public/assets/{sequenceDiagram-WL72ISMW-AeCHCuPt.js → sequenceDiagram-WL72ISMW-BmjWQ4oi.js} +1 -1
  69. package/public/assets/{stateDiagram-FKZM4ZOC-CXM0ycgk.js → stateDiagram-FKZM4ZOC-C7lI7uz2.js} +1 -1
  70. package/public/assets/{stateDiagram-v2-4FDKWEC3-FWopaxaM.js → stateDiagram-v2-4FDKWEC3-C8Eo5YFb.js} +1 -1
  71. package/public/assets/{table-CUyJSNAf.js → table-F592JIUY.js} +1 -1
  72. package/public/assets/{timeline-definition-IT6M3QCI-BXZLvFn7.js → timeline-definition-IT6M3QCI-BltidY3A.js} +1 -1
  73. package/public/assets/{treemap-KMMF4GRG-BcB7MUc4.js → treemap-KMMF4GRG-CXskbtZo.js} +1 -1
  74. package/public/assets/{xychartDiagram-PRI3JC2R-BsE7x9kD.js → xychartDiagram-PRI3JC2R-Bk3p1DGz.js} +1 -1
  75. package/public/index.html +1 -1
  76. package/routes/a2a.d.ts.map +1 -1
  77. package/routes/a2a.js +15 -4
  78. package/routes/a2a.js.map +1 -1
  79. package/routes/agents.d.ts.map +1 -1
  80. package/routes/agents.js +15 -3
  81. package/routes/agents.js.map +1 -1
  82. package/routes/network.d.ts +9 -0
  83. package/routes/network.d.ts.map +1 -0
  84. package/routes/network.js +60 -0
  85. package/routes/network.js.map +1 -0
  86. package/services/a2a/__tests__/a2aClientTool.test.js +174 -0
  87. package/services/a2a/__tests__/a2aClientTool.test.js.map +1 -1
  88. package/services/a2a/a2aClientTool.js +28 -7
  89. package/services/a2a/a2aClientTool.js.map +1 -1
  90. package/services/projectMetadataStorage.d.ts.map +1 -1
  91. package/services/projectMetadataStorage.js +2 -0
  92. package/services/projectMetadataStorage.js.map +1 -1
  93. package/services/sessionManager.d.ts +32 -2
  94. package/services/sessionManager.d.ts.map +1 -1
  95. package/services/sessionManager.js +88 -2
  96. package/services/sessionManager.js.map +1 -1
  97. package/services/slackAIService.d.ts.map +1 -1
  98. package/services/slackAIService.js +27 -6
  99. package/services/slackAIService.js.map +1 -1
  100. package/services/taskExecutor/taskWorker.js +4 -3
  101. package/services/taskExecutor/taskWorker.js.map +1 -1
  102. package/services/tunnelService.d.ts +15 -0
  103. package/services/tunnelService.d.ts.map +1 -1
  104. package/services/tunnelService.js +81 -0
  105. package/services/tunnelService.js.map +1 -1
  106. package/types/projects.d.ts +2 -0
  107. package/types/projects.d.ts.map +1 -1
  108. package/utils/claudeUtils.d.ts.map +1 -1
  109. package/utils/claudeUtils.js +2 -1
  110. package/utils/claudeUtils.js.map +1 -1
  111. package/utils/networkUtils.d.ts +25 -0
  112. package/utils/networkUtils.d.ts.map +1 -0
  113. package/utils/networkUtils.js +65 -0
  114. package/utils/networkUtils.js.map +1 -0
  115. package/utils/sessionUtils.d.ts +5 -2
  116. package/utils/sessionUtils.d.ts.map +1 -1
  117. package/utils/sessionUtils.js +34 -9
  118. package/utils/sessionUtils.js.map +1 -1
  119. package/public/assets/ProjectsPage-DVGpii1H.js +0 -21
  120. package/public/assets/channel-4mgiaMWd.js +0 -1
  121. package/public/assets/clone-BHGNnQ0D.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as e}from"./data-structures-C0h9Oap1.js";import{r as c}from"./monaco-editor-DHKm5-VF.js";import{T as pe,a as be,b as Z,c as q,d as fe,e as O}from"./table-CUyJSNAf.js";import{g as ye,a as f,b as te,u as X,c as J,A as _}from"./agents-DG431Wop.js";import{U as ke}from"./UnifiedToolSelector-CKjY_qjS.js";import{u as V}from"./tools-C0JOzoE_.js";import{r as we,e as je,aH as ve,X as Q,v as ae,g as Ne,E as Se,f as Te,J as Ce,y as Fe}from"./ui-components-CRCmgMKc.js";import{B as z}from"./Button-u4yI-WsV.js";import{F as $e}from"./FileExplorer-DFQ7ynXa.js";import{T as Ee}from"./ToolsList-Ci2lqPin.js";import"./syntax-highlighting-CnREyncB.js";import"./index-h5dd40hU.js";class De{baseURL=`${ye()}/skills`;async getAllSkills(r){const s=new URLSearchParams;r?.scope&&s.append("scope",r.scope),r?.includeDisabled&&s.append("includeDisabled","true");const l=await f(`${this.baseURL}?${s.toString()}`);if(!l.ok)throw new Error(`Failed to fetch skills: ${l.statusText}`);const o=await l.json();return this.transformToSkillListItems(o.skills)}async getSkill(r,s){const l=s?`?scope=${s}`:"",o=await f(`${this.baseURL}/${r}${l}`);if(o.status===404)return null;if(!o.ok)throw new Error(`Failed to fetch skill: ${o.statusText}`);return(await o.json()).skill}async createSkill(r){const s=await f(`${this.baseURL}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok){const o=await s.json();throw new Error(o.error||"Failed to create skill")}return(await s.json()).skill}async updateSkill(r,s){const l=await f(`${this.baseURL}/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!l.ok){const x=await l.json();throw new Error(x.error||"Failed to update skill")}return(await l.json()).skill}async deleteSkill(r,s){const l=s?`?scope=${s}`:"",o=await f(`${this.baseURL}/${r}${l}`,{method:"DELETE"});if(o.status===404)return!1;if(!o.ok)throw new Error(`Failed to delete skill: ${o.statusText}`);return!0}async getSkillDirectoryInfo(r){const s=await f(`${this.baseURL}/${r}/directory`);if(s.status===404)return null;if(!s.ok)throw new Error(`Failed to fetch skill directory info: ${s.statusText}`);return(await s.json()).directoryInfo}async validateSkillManifest(r){const s=await f(`${this.baseURL}/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:r})});if(!s.ok)throw new Error(`Failed to validate skill manifest: ${s.statusText}`);return await s.json()}async getSkillFile(r,s){const l=await f(`${this.baseURL}/${r}/files/${s}`);if(!l.ok)throw new Error(`Failed to fetch skill file: ${l.statusText}`);return(await l.json()).content}async updateSkillFile(r,s,l){const o=await f(`${this.baseURL}/${r}/files/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})});if(!o.ok)throw new Error(`Failed to update skill file: ${o.statusText}`)}transformToSkillListItems(r){return r.map(s=>({id:s.id,name:s.name,description:s.description,scope:s.scope,projectName:s.scope==="project"?"Current Project":void 0,source:s.source,enabled:s.enabled,createdAt:s.createdAt,updatedAt:s.updatedAt,allowedTools:s.allowedTools,toolCount:s.allowedTools?.length||0,usageCount:0,lastUsed:void 0}))}}const A=new De,y={all:["skills"],lists:()=>[...y.all,"list"],list:a=>[...y.lists(),a],details:()=>[...y.all,"detail"],detail:a=>[...y.details(),a],directory:a=>[...y.all,"directory",a]},Le=a=>te({queryKey:y.list(a||{}),queryFn:()=>A.getAllSkills(a),staleTime:300*1e3}),Me=(a,r)=>te({queryKey:y.detail(a),queryFn:()=>A.getSkill(a,r),enabled:!!a,staleTime:300*1e3}),Pe=()=>{const a=X();return J({mutationFn:r=>A.createSkill(r),onSuccess:r=>{a.invalidateQueries({queryKey:y.lists()}),a.setQueryData(y.detail(r.id),r)},onError:r=>{console.error("Failed to create skill:",r)}})},Ae=()=>{const a=X();return J({mutationFn:({skillId:r,updates:s})=>A.updateSkill(r,s),onSuccess:r=>{a.setQueryData(y.detail(r.id),r),a.invalidateQueries({queryKey:y.lists()})},onError:r=>{console.error("Failed to update skill:",r)}})},Ie=()=>{const a=X();return J({mutationFn:({skillId:r,scope:s})=>A.deleteSkill(r,s),onSuccess:(r,{skillId:s})=>{a.removeQueries({queryKey:y.detail(s)}),a.invalidateQueries({queryKey:y.lists()})},onError:r=>{console.error("Failed to delete skill:",r)}})},Re=()=>J({mutationFn:a=>A.validateSkillManifest(a),onError:a=>{console.error("Failed to validate skill manifest:",a)}}),Ue=({onClose:a,onSuccess:r,editSkill:s})=>{const{t:l}=V(["skills","common"]),o=!!s,[x,g]=c.useState("basic"),[n,h]=c.useState({name:"",description:"",allowedTools:[],content:"",additionalFiles:[]}),[m,j]=c.useState([]),[k,F]=c.useState(""),[$,M]=c.useState(!1),[S,E]=c.useState([]),[p,v]=c.useState([]),[T,I]=c.useState(!1),P=Pe(),R=Ae(),U=Re(),B=Me(s?.id||"",s?.scope||"user"),C=o?B.data:null,K=o?B.isLoading:!1,[d,N]=c.useState(0),[H,D]=c.useState(0),[L,Y]=c.useState(!1);c.useEffect(()=>{if(!L){const t=[...S];T&&t.push(...p),h(i=>({...i,allowedTools:t})),N(Date.now())}},[S,p,T,L]),c.useEffect(()=>{!L&&(n.name||n.description)&&N(Date.now())},[n.name,n.description,L]),c.useEffect(()=>{!L&&n.content&&D(Date.now())},[n.content,L]),c.useEffect(()=>{if(o&&C){h({name:C.name,description:C.description,allowedTools:C.allowedTools||[],content:"",additionalFiles:(C.files||[]).filter(u=>!u.path.endsWith("SKILL.md")).map(u=>({id:Math.random().toString(36).substr(2,9),name:u.name,path:u.path,type:u.type,content:""}))});const t=C.allowedTools||[],i=t.filter(u=>!u.startsWith("mcp__")),b=t.filter(u=>u.startsWith("mcp__"));E(i),v(b),I(b.length>0),(async()=>{try{const u=await fetch(`/api/skills/${s.id}/files/SKILL.md`);if(u.ok){const he=await u.json();h(ge=>({...ge,content:he.content})),D(Date.now())}}catch(u){console.error("Failed to load skill manifest:",u)}})()}},[o,C,s]),c.useEffect(()=>{if(n.content){const i=setTimeout(async()=>{try{const b=await U.mutateAsync(n.content);j(b.errors.map(w=>w.message)||[])}catch{j(["Validation failed"])}},500);return()=>clearTimeout(i)}},[n.content,U]);const se=async()=>{try{if(o){const t={name:n.name,description:n.description,allowedTools:n.allowedTools,content:n.content,additionalFiles:n.additionalFiles.map(i=>({name:i.name,path:i.path,type:i.type,content:i.content}))};await R.mutateAsync({skillId:s.id,updates:t})}else{const t={name:n.name,description:n.description,scope:"user",allowedTools:n.allowedTools,content:n.content,additionalFiles:n.additionalFiles.map(i=>({name:i.name,path:i.path,type:i.type,content:i.content}))};await P.mutateAsync(t)}r()}catch(t){console.error(o?"Failed to update skill:":"Failed to create skill:",t),alert(l(o?"errors.updateFailed":"errors.createFailed"))}},re=()=>{const t={id:Math.random().toString(36).substr(2,9),name:"New File",path:"new-file.md",type:"markdown",content:""};h(i=>({...i,additionalFiles:[...i.additionalFiles,t]}))},le=t=>{h(i=>({...i,additionalFiles:i.additionalFiles.filter(b=>b.id!==t)}))},W=(t,i)=>{h(b=>({...b,additionalFiles:b.additionalFiles.map(w=>w.id===t?{...w,...i}:w)}))},ne=n.name.trim()!==""&&!k&&n.description.trim()!==""&&n.content.trim()!==""&&m.length===0,oe=()=>{switch(x){case"basic":return n.name.trim()!==""&&!k&&n.description.trim()!=="";case"manifest":return n.content.trim()!==""&&m.length===0;case"files":return!0;default:return!1}},G=()=>{if(!L){if(Y(!0),d>H){if(n.name&&n.description){const t=ee(n.name,n.description,n.allowedTools);h(i=>({...i,content:t})),D(Date.now())}}else if(H>d){const t=Be(n.content);if(t&&(t.name&&t.name!==n.name||t.description&&t.description!==n.description||t.allowedTools&&JSON.stringify(t.allowedTools)!==JSON.stringify(n.allowedTools))){h(u=>({...u,name:t.name||u.name,description:t.description||u.description,allowedTools:t.allowedTools||u.allowedTools}));const b=(t.allowedTools||[]).filter(u=>!u.startsWith("mcp__")),w=(t.allowedTools||[]).filter(u=>u.startsWith("mcp__"));E(b),v(w),I(w.length>0),N(Date.now())}}else if(!n.content&&n.name&&n.description){const t=ee(n.name,n.description,n.allowedTools);h(i=>({...i,content:t})),D(Date.now())}setTimeout(()=>Y(!1),100)}},ie=()=>{G(),x==="basic"?g("manifest"):x==="manifest"&&g("files")},de=t=>{G(),g(t)},ce=[{id:"basic",label:l("create.tabs.basic"),icon:we},{id:"manifest",label:l("create.tabs.manifest"),icon:je},{id:"files",label:l("create.tabs.files"),icon:ve}],xe=t=>t?t.length>64?"技能名称不能超过64个字符":/^[a-z0-9-]+$/.test(t)?t.startsWith("-")||t.endsWith("-")?"不能以连字符开始或结束":t.includes("--")?"不能包含连续的连字符":"":"只能使用小写字母、数字和连字符":"",ue=t=>{h(i=>({...i,name:t})),F(xe(t))},me=t=>{t.key==="Escape"&&a()};return o&&K?e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsx("div",{className:"bg-white rounded-lg p-6 w-full max-w-md",children:e.jsx("div",{className:"flex items-center justify-center h-32",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})})})}):e.jsxs("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",onKeyDown:me,children:[e.jsxs("div",{className:"bg-white rounded-lg w-full max-w-3xl max-h-[90vh] overflow-hidden flex flex-col dark:bg-gray-800 dark:text-white",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:o?`编辑技能 - ${s?.name}`:l("create.title")}),e.jsx("p",{className:"text-sm text-gray-600 mt-1 dark:text-gray-300",children:o?"修改现有技能的配置和功能":l("create.subtitle")})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[x!=="files"?e.jsx("button",{onClick:ie,disabled:!oe(),className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors dark:bg-blue-500 dark:hover:bg-blue-600",children:l("common:actions.next")}):e.jsx("button",{onClick:se,disabled:!ne||P.isPending||R.isPending,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors dark:bg-blue-500 dark:hover:bg-blue-600",children:P.isPending||R.isPending?l("common:status.saving"):l(o?"common:actions.save":"common:actions.create")}),e.jsx("button",{onClick:a,className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded-lg transition-colors dark:text-gray-400 dark:hover:text-gray-200 dark:hover:bg-gray-700",children:e.jsx(Q,{className:"w-5 h-5"})})]})]}),e.jsx("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:ce.map(t=>{const i=t.icon,b=x===t.id,w=t.id==="basic"&&n.name.trim()!==""&&n.description.trim()!==""||t.id==="manifest"&&n.content.trim()!==""&&m.length===0||t.id==="files";return e.jsxs("button",{onClick:()=>de(t.id),className:`flex items-center gap-2 px-6 py-3 font-medium text-sm transition-colors ${b?"text-blue-600 border-b-2 border-blue-600 dark:text-blue-400 dark:border-blue-400":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,children:[e.jsx(i,{className:"w-4 h-4"}),t.label,w&&e.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500"})]},t.id)})}),e.jsxs("div",{className:"flex-1 overflow-auto p-6",children:[x==="basic"&&e.jsxs("div",{className:"space-y-6 max-w-2xl",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2 dark:text-gray-300",children:"技能名称 (Slug)"}),e.jsx("input",{type:"text",value:n.name,onChange:t=>ue(t.target.value),disabled:o,className:`w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-400 dark:focus:border-blue-400 font-mono ${o?"bg-gray-100 text-gray-500 cursor-not-allowed dark:bg-gray-600 dark:text-gray-400":k?"border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300"}`,placeholder:"my-awesome-skill"}),k?e.jsx("p",{className:"text-xs text-red-500 mt-1 dark:text-red-400",children:k}):e.jsx("p",{className:"text-xs text-gray-500 mt-1 dark:text-gray-400",children:o?"技能名称在编辑模式下不能修改":"只能使用小写字母、数字和连字符,最多64个字符"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2 dark:text-gray-300",children:l("create.basic.description")}),e.jsx("textarea",{value:n.description,onChange:t=>{h(i=>({...i,description:t.target.value}))},rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none resize-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-400 dark:focus:border-blue-400",placeholder:l("create.basic.descriptionPlaceholder")}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 dark:text-gray-400",children:l("create.basic.descriptionHint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2 dark:text-gray-300",children:l("create.basic.allowedTools")}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{type:"button",onClick:()=>M(!$),className:"px-3 py-2 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 rounded-lg transition-colors text-sm",children:l("create.basic.selectTools")}),(S.length>0||p.length>0)&&e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:["常规工具 ",S.length," 个",p.length>0&&`, MCP工具 ${p.length} 个`]})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 dark:text-gray-400",children:l("create.basic.allowedToolsHint")})]})]}),x==="manifest"&&e.jsx("div",{className:"space-y-6 max-w-2xl",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2 dark:text-gray-300",children:l("create.content.skillManifest")}),e.jsx("textarea",{value:n.content,onChange:t=>h(i=>({...i,content:t.target.value})),rows:15,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none font-mono text-sm resize-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:focus:ring-blue-400 dark:focus:border-blue-400"}),m.length>0&&e.jsxs("div",{className:"mt-2 p-3 bg-red-50 border border-red-200 rounded-lg dark:bg-red-900/20 dark:border-red-800",children:[e.jsxs("h4",{className:"text-sm font-medium text-red-800 mb-1 dark:text-red-400",children:[l("editor.errors.validationErrors"),":"]}),e.jsx("ul",{className:"text-sm text-red-700 space-y-1 dark:text-red-300",children:m.map((t,i)=>e.jsxs("li",{children:["• ",t]},i))})]})]})}),x==="files"&&e.jsxs("div",{className:"space-y-6 max-w-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:l("create.content.additionalFiles")}),e.jsxs("button",{onClick:re,className:"flex items-center gap-2 px-3 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors dark:bg-green-500 dark:hover:bg-green-600",children:[e.jsx(ae,{className:"w-4 h-4"}),l("create.content.addFile")]})]}),n.additionalFiles.length===0?e.jsxs("div",{className:"text-center py-8 border-2 border-dashed border-gray-300 rounded-lg",children:[e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:l("create.content.noFiles")}),e.jsx("p",{className:"text-sm text-gray-500 mt-1 dark:text-gray-400",children:l("create.content.noFilesHint")})]}):e.jsx("div",{className:"space-y-4",children:n.additionalFiles.map(t=>e.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("input",{type:"text",value:t.name,onChange:i=>W(t.id,{name:i.target.value}),className:"flex-1 px-2 py-1 border border-gray-300 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:focus:ring-blue-400 dark:focus:border-blue-400",placeholder:l("create.content.fileName")}),e.jsx("input",{type:"text",value:t.path,onChange:i=>W(t.id,{path:i.target.value}),className:"flex-1 px-2 py-1 border border-gray-300 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none font-mono text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:focus:ring-blue-400 dark:focus:border-blue-400",placeholder:l("create.content.filePath")}),e.jsxs("select",{value:t.type,onChange:i=>W(t.id,{type:i.target.value}),className:"px-2 py-1 border border-gray-300 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:focus:ring-blue-400 dark:focus:border-blue-400",children:[e.jsx("option",{value:"markdown",children:l("create.content.fileType.markdown")}),e.jsx("option",{value:"text",children:l("create.content.fileType.text")}),e.jsx("option",{value:"script",children:l("create.content.fileType.script")}),e.jsx("option",{value:"template",children:l("create.content.fileType.template")}),e.jsx("option",{value:"other",children:l("create.content.fileType.other")})]})]}),e.jsx("button",{onClick:()=>le(t.id),className:"p-1 text-red-500 hover:text-red-700 hover:bg-red-50 rounded transition-colors dark:text-red-400 dark:hover:text-red-300 dark:hover:bg-red-900/20",children:e.jsx(Q,{className:"w-4 h-4"})})]}),e.jsx("textarea",{value:t.content,onChange:i=>W(t.id,{content:i.target.value}),rows:6,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none font-mono text-sm resize-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-400 dark:focus:border-blue-400",placeholder:l("create.content.fileContent")})]},t.id))})]})]})]}),e.jsx(ke,{isOpen:$,onClose:()=>M(!1),selectedRegularTools:S,onRegularToolsChange:E,selectedMcpTools:p,onMcpToolsChange:v,mcpToolsEnabled:T,onMcpEnabledChange:I})]})};function Be(a){try{const r=a.match(/^---\s*\n(.*?)\n---/s);if(!r)return null;const l=r[1].split(`
1
+ import{j as e}from"./data-structures-C0h9Oap1.js";import{r as c}from"./monaco-editor-DHKm5-VF.js";import{T as pe,a as be,b as Z,c as q,d as fe,e as O}from"./table-F592JIUY.js";import{g as ye,a as f,b as te,u as X,c as J,A as _}from"./agents-DG431Wop.js";import{U as ke}from"./UnifiedToolSelector-CKjY_qjS.js";import{u as V}from"./tools-C0JOzoE_.js";import{r as we,e as je,aH as ve,X as Q,v as ae,g as Ne,E as Se,f as Te,J as Ce,y as Fe}from"./ui-components-CRCmgMKc.js";import{B as z}from"./Button-DPVn3zDJ.js";import{F as $e}from"./FileExplorer-DFQ7ynXa.js";import{T as Ee}from"./ToolsList-Ci2lqPin.js";import"./syntax-highlighting-CnREyncB.js";import"./index-D9bAK8SN.js";class De{baseURL=`${ye()}/skills`;async getAllSkills(r){const s=new URLSearchParams;r?.scope&&s.append("scope",r.scope),r?.includeDisabled&&s.append("includeDisabled","true");const l=await f(`${this.baseURL}?${s.toString()}`);if(!l.ok)throw new Error(`Failed to fetch skills: ${l.statusText}`);const o=await l.json();return this.transformToSkillListItems(o.skills)}async getSkill(r,s){const l=s?`?scope=${s}`:"",o=await f(`${this.baseURL}/${r}${l}`);if(o.status===404)return null;if(!o.ok)throw new Error(`Failed to fetch skill: ${o.statusText}`);return(await o.json()).skill}async createSkill(r){const s=await f(`${this.baseURL}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok){const o=await s.json();throw new Error(o.error||"Failed to create skill")}return(await s.json()).skill}async updateSkill(r,s){const l=await f(`${this.baseURL}/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!l.ok){const x=await l.json();throw new Error(x.error||"Failed to update skill")}return(await l.json()).skill}async deleteSkill(r,s){const l=s?`?scope=${s}`:"",o=await f(`${this.baseURL}/${r}${l}`,{method:"DELETE"});if(o.status===404)return!1;if(!o.ok)throw new Error(`Failed to delete skill: ${o.statusText}`);return!0}async getSkillDirectoryInfo(r){const s=await f(`${this.baseURL}/${r}/directory`);if(s.status===404)return null;if(!s.ok)throw new Error(`Failed to fetch skill directory info: ${s.statusText}`);return(await s.json()).directoryInfo}async validateSkillManifest(r){const s=await f(`${this.baseURL}/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:r})});if(!s.ok)throw new Error(`Failed to validate skill manifest: ${s.statusText}`);return await s.json()}async getSkillFile(r,s){const l=await f(`${this.baseURL}/${r}/files/${s}`);if(!l.ok)throw new Error(`Failed to fetch skill file: ${l.statusText}`);return(await l.json()).content}async updateSkillFile(r,s,l){const o=await f(`${this.baseURL}/${r}/files/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})});if(!o.ok)throw new Error(`Failed to update skill file: ${o.statusText}`)}transformToSkillListItems(r){return r.map(s=>({id:s.id,name:s.name,description:s.description,scope:s.scope,projectName:s.scope==="project"?"Current Project":void 0,source:s.source,enabled:s.enabled,createdAt:s.createdAt,updatedAt:s.updatedAt,allowedTools:s.allowedTools,toolCount:s.allowedTools?.length||0,usageCount:0,lastUsed:void 0}))}}const A=new De,y={all:["skills"],lists:()=>[...y.all,"list"],list:a=>[...y.lists(),a],details:()=>[...y.all,"detail"],detail:a=>[...y.details(),a],directory:a=>[...y.all,"directory",a]},Le=a=>te({queryKey:y.list(a||{}),queryFn:()=>A.getAllSkills(a),staleTime:300*1e3}),Me=(a,r)=>te({queryKey:y.detail(a),queryFn:()=>A.getSkill(a,r),enabled:!!a,staleTime:300*1e3}),Pe=()=>{const a=X();return J({mutationFn:r=>A.createSkill(r),onSuccess:r=>{a.invalidateQueries({queryKey:y.lists()}),a.setQueryData(y.detail(r.id),r)},onError:r=>{console.error("Failed to create skill:",r)}})},Ae=()=>{const a=X();return J({mutationFn:({skillId:r,updates:s})=>A.updateSkill(r,s),onSuccess:r=>{a.setQueryData(y.detail(r.id),r),a.invalidateQueries({queryKey:y.lists()})},onError:r=>{console.error("Failed to update skill:",r)}})},Ie=()=>{const a=X();return J({mutationFn:({skillId:r,scope:s})=>A.deleteSkill(r,s),onSuccess:(r,{skillId:s})=>{a.removeQueries({queryKey:y.detail(s)}),a.invalidateQueries({queryKey:y.lists()})},onError:r=>{console.error("Failed to delete skill:",r)}})},Re=()=>J({mutationFn:a=>A.validateSkillManifest(a),onError:a=>{console.error("Failed to validate skill manifest:",a)}}),Ue=({onClose:a,onSuccess:r,editSkill:s})=>{const{t:l}=V(["skills","common"]),o=!!s,[x,g]=c.useState("basic"),[n,h]=c.useState({name:"",description:"",allowedTools:[],content:"",additionalFiles:[]}),[m,j]=c.useState([]),[k,F]=c.useState(""),[$,M]=c.useState(!1),[S,E]=c.useState([]),[p,v]=c.useState([]),[T,I]=c.useState(!1),P=Pe(),R=Ae(),U=Re(),B=Me(s?.id||"",s?.scope||"user"),C=o?B.data:null,K=o?B.isLoading:!1,[d,N]=c.useState(0),[H,D]=c.useState(0),[L,Y]=c.useState(!1);c.useEffect(()=>{if(!L){const t=[...S];T&&t.push(...p),h(i=>({...i,allowedTools:t})),N(Date.now())}},[S,p,T,L]),c.useEffect(()=>{!L&&(n.name||n.description)&&N(Date.now())},[n.name,n.description,L]),c.useEffect(()=>{!L&&n.content&&D(Date.now())},[n.content,L]),c.useEffect(()=>{if(o&&C){h({name:C.name,description:C.description,allowedTools:C.allowedTools||[],content:"",additionalFiles:(C.files||[]).filter(u=>!u.path.endsWith("SKILL.md")).map(u=>({id:Math.random().toString(36).substr(2,9),name:u.name,path:u.path,type:u.type,content:""}))});const t=C.allowedTools||[],i=t.filter(u=>!u.startsWith("mcp__")),b=t.filter(u=>u.startsWith("mcp__"));E(i),v(b),I(b.length>0),(async()=>{try{const u=await fetch(`/api/skills/${s.id}/files/SKILL.md`);if(u.ok){const he=await u.json();h(ge=>({...ge,content:he.content})),D(Date.now())}}catch(u){console.error("Failed to load skill manifest:",u)}})()}},[o,C,s]),c.useEffect(()=>{if(n.content){const i=setTimeout(async()=>{try{const b=await U.mutateAsync(n.content);j(b.errors.map(w=>w.message)||[])}catch{j(["Validation failed"])}},500);return()=>clearTimeout(i)}},[n.content,U]);const se=async()=>{try{if(o){const t={name:n.name,description:n.description,allowedTools:n.allowedTools,content:n.content,additionalFiles:n.additionalFiles.map(i=>({name:i.name,path:i.path,type:i.type,content:i.content}))};await R.mutateAsync({skillId:s.id,updates:t})}else{const t={name:n.name,description:n.description,scope:"user",allowedTools:n.allowedTools,content:n.content,additionalFiles:n.additionalFiles.map(i=>({name:i.name,path:i.path,type:i.type,content:i.content}))};await P.mutateAsync(t)}r()}catch(t){console.error(o?"Failed to update skill:":"Failed to create skill:",t),alert(l(o?"errors.updateFailed":"errors.createFailed"))}},re=()=>{const t={id:Math.random().toString(36).substr(2,9),name:"New File",path:"new-file.md",type:"markdown",content:""};h(i=>({...i,additionalFiles:[...i.additionalFiles,t]}))},le=t=>{h(i=>({...i,additionalFiles:i.additionalFiles.filter(b=>b.id!==t)}))},W=(t,i)=>{h(b=>({...b,additionalFiles:b.additionalFiles.map(w=>w.id===t?{...w,...i}:w)}))},ne=n.name.trim()!==""&&!k&&n.description.trim()!==""&&n.content.trim()!==""&&m.length===0,oe=()=>{switch(x){case"basic":return n.name.trim()!==""&&!k&&n.description.trim()!=="";case"manifest":return n.content.trim()!==""&&m.length===0;case"files":return!0;default:return!1}},G=()=>{if(!L){if(Y(!0),d>H){if(n.name&&n.description){const t=ee(n.name,n.description,n.allowedTools);h(i=>({...i,content:t})),D(Date.now())}}else if(H>d){const t=Be(n.content);if(t&&(t.name&&t.name!==n.name||t.description&&t.description!==n.description||t.allowedTools&&JSON.stringify(t.allowedTools)!==JSON.stringify(n.allowedTools))){h(u=>({...u,name:t.name||u.name,description:t.description||u.description,allowedTools:t.allowedTools||u.allowedTools}));const b=(t.allowedTools||[]).filter(u=>!u.startsWith("mcp__")),w=(t.allowedTools||[]).filter(u=>u.startsWith("mcp__"));E(b),v(w),I(w.length>0),N(Date.now())}}else if(!n.content&&n.name&&n.description){const t=ee(n.name,n.description,n.allowedTools);h(i=>({...i,content:t})),D(Date.now())}setTimeout(()=>Y(!1),100)}},ie=()=>{G(),x==="basic"?g("manifest"):x==="manifest"&&g("files")},de=t=>{G(),g(t)},ce=[{id:"basic",label:l("create.tabs.basic"),icon:we},{id:"manifest",label:l("create.tabs.manifest"),icon:je},{id:"files",label:l("create.tabs.files"),icon:ve}],xe=t=>t?t.length>64?"技能名称不能超过64个字符":/^[a-z0-9-]+$/.test(t)?t.startsWith("-")||t.endsWith("-")?"不能以连字符开始或结束":t.includes("--")?"不能包含连续的连字符":"":"只能使用小写字母、数字和连字符":"",ue=t=>{h(i=>({...i,name:t})),F(xe(t))},me=t=>{t.key==="Escape"&&a()};return o&&K?e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsx("div",{className:"bg-white rounded-lg p-6 w-full max-w-md",children:e.jsx("div",{className:"flex items-center justify-center h-32",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})})})}):e.jsxs("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",onKeyDown:me,children:[e.jsxs("div",{className:"bg-white rounded-lg w-full max-w-3xl max-h-[90vh] overflow-hidden flex flex-col dark:bg-gray-800 dark:text-white",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:o?`编辑技能 - ${s?.name}`:l("create.title")}),e.jsx("p",{className:"text-sm text-gray-600 mt-1 dark:text-gray-300",children:o?"修改现有技能的配置和功能":l("create.subtitle")})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[x!=="files"?e.jsx("button",{onClick:ie,disabled:!oe(),className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors dark:bg-blue-500 dark:hover:bg-blue-600",children:l("common:actions.next")}):e.jsx("button",{onClick:se,disabled:!ne||P.isPending||R.isPending,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors dark:bg-blue-500 dark:hover:bg-blue-600",children:P.isPending||R.isPending?l("common:status.saving"):l(o?"common:actions.save":"common:actions.create")}),e.jsx("button",{onClick:a,className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded-lg transition-colors dark:text-gray-400 dark:hover:text-gray-200 dark:hover:bg-gray-700",children:e.jsx(Q,{className:"w-5 h-5"})})]})]}),e.jsx("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:ce.map(t=>{const i=t.icon,b=x===t.id,w=t.id==="basic"&&n.name.trim()!==""&&n.description.trim()!==""||t.id==="manifest"&&n.content.trim()!==""&&m.length===0||t.id==="files";return e.jsxs("button",{onClick:()=>de(t.id),className:`flex items-center gap-2 px-6 py-3 font-medium text-sm transition-colors ${b?"text-blue-600 border-b-2 border-blue-600 dark:text-blue-400 dark:border-blue-400":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,children:[e.jsx(i,{className:"w-4 h-4"}),t.label,w&&e.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500"})]},t.id)})}),e.jsxs("div",{className:"flex-1 overflow-auto p-6",children:[x==="basic"&&e.jsxs("div",{className:"space-y-6 max-w-2xl",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2 dark:text-gray-300",children:"技能名称 (Slug)"}),e.jsx("input",{type:"text",value:n.name,onChange:t=>ue(t.target.value),disabled:o,className:`w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-400 dark:focus:border-blue-400 font-mono ${o?"bg-gray-100 text-gray-500 cursor-not-allowed dark:bg-gray-600 dark:text-gray-400":k?"border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300"}`,placeholder:"my-awesome-skill"}),k?e.jsx("p",{className:"text-xs text-red-500 mt-1 dark:text-red-400",children:k}):e.jsx("p",{className:"text-xs text-gray-500 mt-1 dark:text-gray-400",children:o?"技能名称在编辑模式下不能修改":"只能使用小写字母、数字和连字符,最多64个字符"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2 dark:text-gray-300",children:l("create.basic.description")}),e.jsx("textarea",{value:n.description,onChange:t=>{h(i=>({...i,description:t.target.value}))},rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none resize-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-400 dark:focus:border-blue-400",placeholder:l("create.basic.descriptionPlaceholder")}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 dark:text-gray-400",children:l("create.basic.descriptionHint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2 dark:text-gray-300",children:l("create.basic.allowedTools")}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{type:"button",onClick:()=>M(!$),className:"px-3 py-2 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 rounded-lg transition-colors text-sm",children:l("create.basic.selectTools")}),(S.length>0||p.length>0)&&e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:["常规工具 ",S.length," 个",p.length>0&&`, MCP工具 ${p.length} 个`]})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 dark:text-gray-400",children:l("create.basic.allowedToolsHint")})]})]}),x==="manifest"&&e.jsx("div",{className:"space-y-6 max-w-2xl",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2 dark:text-gray-300",children:l("create.content.skillManifest")}),e.jsx("textarea",{value:n.content,onChange:t=>h(i=>({...i,content:t.target.value})),rows:15,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none font-mono text-sm resize-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:focus:ring-blue-400 dark:focus:border-blue-400"}),m.length>0&&e.jsxs("div",{className:"mt-2 p-3 bg-red-50 border border-red-200 rounded-lg dark:bg-red-900/20 dark:border-red-800",children:[e.jsxs("h4",{className:"text-sm font-medium text-red-800 mb-1 dark:text-red-400",children:[l("editor.errors.validationErrors"),":"]}),e.jsx("ul",{className:"text-sm text-red-700 space-y-1 dark:text-red-300",children:m.map((t,i)=>e.jsxs("li",{children:["• ",t]},i))})]})]})}),x==="files"&&e.jsxs("div",{className:"space-y-6 max-w-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:l("create.content.additionalFiles")}),e.jsxs("button",{onClick:re,className:"flex items-center gap-2 px-3 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors dark:bg-green-500 dark:hover:bg-green-600",children:[e.jsx(ae,{className:"w-4 h-4"}),l("create.content.addFile")]})]}),n.additionalFiles.length===0?e.jsxs("div",{className:"text-center py-8 border-2 border-dashed border-gray-300 rounded-lg",children:[e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:l("create.content.noFiles")}),e.jsx("p",{className:"text-sm text-gray-500 mt-1 dark:text-gray-400",children:l("create.content.noFilesHint")})]}):e.jsx("div",{className:"space-y-4",children:n.additionalFiles.map(t=>e.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("input",{type:"text",value:t.name,onChange:i=>W(t.id,{name:i.target.value}),className:"flex-1 px-2 py-1 border border-gray-300 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:focus:ring-blue-400 dark:focus:border-blue-400",placeholder:l("create.content.fileName")}),e.jsx("input",{type:"text",value:t.path,onChange:i=>W(t.id,{path:i.target.value}),className:"flex-1 px-2 py-1 border border-gray-300 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none font-mono text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:focus:ring-blue-400 dark:focus:border-blue-400",placeholder:l("create.content.filePath")}),e.jsxs("select",{value:t.type,onChange:i=>W(t.id,{type:i.target.value}),className:"px-2 py-1 border border-gray-300 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:focus:ring-blue-400 dark:focus:border-blue-400",children:[e.jsx("option",{value:"markdown",children:l("create.content.fileType.markdown")}),e.jsx("option",{value:"text",children:l("create.content.fileType.text")}),e.jsx("option",{value:"script",children:l("create.content.fileType.script")}),e.jsx("option",{value:"template",children:l("create.content.fileType.template")}),e.jsx("option",{value:"other",children:l("create.content.fileType.other")})]})]}),e.jsx("button",{onClick:()=>le(t.id),className:"p-1 text-red-500 hover:text-red-700 hover:bg-red-50 rounded transition-colors dark:text-red-400 dark:hover:text-red-300 dark:hover:bg-red-900/20",children:e.jsx(Q,{className:"w-4 h-4"})})]}),e.jsx("textarea",{value:t.content,onChange:i=>W(t.id,{content:i.target.value}),rows:6,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none font-mono text-sm resize-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-400 dark:focus:border-blue-400",placeholder:l("create.content.fileContent")})]},t.id))})]})]})]}),e.jsx(ke,{isOpen:$,onClose:()=>M(!1),selectedRegularTools:S,onRegularToolsChange:E,selectedMcpTools:p,onMcpToolsChange:v,mcpToolsEnabled:T,onMcpEnabledChange:I})]})};function Be(a){try{const r=a.match(/^---\s*\n(.*?)\n---/s);if(!r)return null;const l=r[1].split(`
2
2
  `),o={};for(const x of l){const g=x.trim();if(g.startsWith("name:"))o.name=g.replace("name:","").trim();else if(g.startsWith("description:"))o.description=g.replace("description:","").trim();else if(g.startsWith("allowed-tools:")){const n=g.replace("allowed-tools:","").trim();if(n.startsWith("[")&&n.endsWith("]")){const h=n.slice(1,-1).split(",").map(m=>m.trim().replace(/^"(.*)"$/,"$1")).filter(m=>m.length>0);o.allowedTools=h}}}return o}catch(r){return console.error("Failed to parse skill content:",r),null}}function ee(a,r,s){const l=s.length>0?`
3
3
  allowed-tools: [${s.map(x=>`"${x}"`).join(", ")}]`:"",o=a.split("-").map(x=>x.charAt(0).toUpperCase()+x.slice(1)).join(" ");return`---
4
4
  name: ${a}
@@ -1 +1 @@
1
- import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i}from"./monaco-editor-DHKm5-VF.js";import{T as D,a as B,b as f,c as o,d as R,e as m}from"./table-CUyJSNAf.js";import{u as H,a as L,S as q}from"./SubagentForm-CSRBsxUE.js";import{f as N}from"./dateFormat-CXa8VnEC.js";import{b as z}from"./index-h5dd40hU.js";import{T as k}from"./ToolsList-Ci2lqPin.js";import{u as J}from"./tools-C0JOzoE_.js";import{j as G,g as I,v as K,a5 as v,E as w,J as $,y as h}from"./ui-components-CRCmgMKc.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DG431Wop.js";import"./UnifiedToolSelector-CKjY_qjS.js";const re=()=>{const{t:s}=J("pages"),{isMobile:t}=z(),[a,S]=i.useState(""),[C,n]=i.useState(!1),[T,d]=i.useState(null),[g,c]=i.useState(null),[p,y]=i.useState({}),{data:b=[],isLoading:F,error:E,refetch:j}=H({search:a.trim()||void 0}),u=L(),M=async r=>{try{await u.mutateAsync(r.id),c(null)}catch(l){console.error("Failed to delete subagent:",l)}},x=r=>{d(r),n(!0)},A=()=>{n(!1),d(null)},P=()=>{j()};return F?e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`animate-spin rounded-full ${t?"h-8 w-8":"h-12 w-12"} border-b-2 border-blue-600 mx-auto ${t?"mb-3":"mb-4"}`}),e.jsx("div",{className:`text-gray-600 dark:text-gray-400 ${t?"text-sm":""}`,children:s("settings.subagents.loading")})]})}):E?e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(G,{className:`${t?"h-8 w-8":"h-12 w-12"} text-red-500 mx-auto ${t?"mb-3":"mb-4"}`}),e.jsx("h3",{className:`${t?"text-base":"text-lg"} font-medium text-gray-900 dark:text-white mb-2`,children:s("settings.subagents.loadFailed")}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${t?"mb-4 text-sm":"mb-4"}`,children:s("settings.subagents.loadFailedMessage")}),e.jsx("button",{onClick:()=>j(),className:`${t?"px-4 py-2.5 text-sm":"px-4 py-2"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:s("settings.subagents.retry")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:t?"mb-4":"flex items-center justify-between mb-6",children:e.jsxs("div",{children:[e.jsx("h1",{className:`${t?"text-2xl":"text-3xl"} font-bold text-gray-900 dark:text-white`,children:s("settings.subagents.title")}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${t?"mt-1":"mt-2"}`,children:s("settings.subagents.subtitle")})]})}),e.jsxs("div",{className:t?"space-y-3":"flex items-center space-x-4",children:[e.jsxs("div",{className:`${t?"":"flex-1"} relative`,children:[e.jsx(I,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 ${t?"w-4 h-4":"w-5 h-5"}`}),e.jsx("input",{type:"text",placeholder:s("settings.subagents.searchPlaceholder"),value:a,onChange:r=>S(r.target.value),className:`pl-10 pr-4 ${t?"py-2":"py-3"} w-full border border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent ${t?"text-sm":""}`})]}),e.jsxs("button",{onClick:()=>{d(null),n(!0)},className:`${t?"w-full py-2.5 px-4 flex items-center justify-center space-x-2":"flex items-center space-x-2 px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors ${t?"text-sm":"whitespace-nowrap"}`,children:[e.jsx(K,{className:t?"w-4 h-4":"w-5 h-5"}),e.jsx("span",{children:s("settings.subagents.createButton")})]})]})]}),b.length===0?e.jsxs("div",{className:"text-center py-16 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:`${t?"text-4xl":"text-6xl"} mb-4`,children:"🤖"}),e.jsx("h3",{className:`${t?"text-lg":"text-xl"} font-medium text-gray-900 dark:text-white mb-2`,children:s(a?"settings.subagents.noSubagentsSearch":"settings.subagents.noSubagents")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:s(a?"settings.subagents.adjustSearch":"settings.subagents.createFirst")}),!a&&e.jsx("button",{onClick:()=>{d(null),n(!0)},className:`${t?"w-full py-3 px-4":"px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:s("settings.subagents.createButton")})]}):e.jsx(e.Fragment,{children:t?e.jsx("div",{className:"space-y-4",children:b.map((r,l)=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-4",children:[e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`${t?"text-lg":"text-xl"} mr-3`,children:"🤖"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:`${t?"text-sm":"text-base"} font-medium text-gray-900 dark:text-white`,children:r.name}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${r.source==="plugin"?"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300":"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300"}`,children:r.source==="plugin"?s("settings.subagents.source.plugin"):s("settings.subagents.source.local")})]}),r.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:r.description})]})]})}),e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsx("div",{className:"mb-3",children:e.jsxs("div",{className:"flex items-start text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2 mt-1",children:[s("settings.subagents.table.tools"),":"]}),e.jsx("div",{className:"flex-1",children:e.jsx(k,{tools:r.tools||[],id:r.id,expandedTools:p,setExpandedTools:y,isMobile:!0,emptyMessage:s("settings.subagents.table.inheritSettings")})})]})}),e.jsxs("div",{className:"flex items-center text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2",children:[s("settings.subagents.table.createdAt"),":"]}),e.jsxs("div",{className:"flex items-center text-gray-500 dark:text-gray-400",children:[e.jsx(v,{className:"w-4 h-4 mr-1"}),e.jsx("span",{children:N(r.createdAt)})]})]})]}),e.jsx("div",{className:"flex items-center justify-end space-x-2 pt-3 border-t border-gray-200 dark:border-gray-700",children:r.source==="plugin"?e.jsxs("button",{onClick:()=>x(r),className:"inline-flex items-center px-3 py-2 text-sm font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",children:[e.jsx(w,{className:"w-3 h-3 mr-1"}),s("settings.subagents.actions.view")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>x(r),className:"inline-flex items-center px-3 py-2 text-sm font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",children:[e.jsx($,{className:"w-3 h-3 mr-1"}),s("settings.subagents.actions.edit")]}),e.jsx("button",{onClick:()=>c(r),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:s("settings.subagents.actions.deleteTitle"),children:e.jsx(h,{className:"w-4 h-4"})})]})})]},r.id+"-"+l))}):e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsxs(D,{children:[e.jsx(B,{children:e.jsxs(f,{children:[e.jsx(o,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("settings.subagents.table.subagent")}),e.jsx(o,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("settings.subagents.table.tools")}),e.jsx(o,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("settings.subagents.table.createdAt")}),e.jsx(o,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("settings.subagents.table.actions")})]})}),e.jsx(R,{children:b.map((r,l)=>e.jsxs(f,{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx(m,{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"text-xl mr-3",children:"🤖"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:r.name}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${r.source==="plugin"?"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300":"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300"}`,children:r.source==="plugin"?s("settings.subagents.source.plugin"):s("settings.subagents.source.local")})]}),r.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 truncate max-w-xs",children:r.description})]})]})}),e.jsx(m,{className:"px-6 py-4",children:e.jsx(k,{tools:r.tools||[],id:r.id,expandedTools:p,setExpandedTools:y,isMobile:!1,emptyMessage:s("settings.subagents.table.inheritSettings")})}),e.jsx(m,{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(v,{className:"w-4 h-4"}),e.jsx("span",{children:N(r.createdAt)})]})}),e.jsx(m,{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsx("div",{className:"flex items-center justify-end space-x-2",children:r.source==="plugin"?e.jsxs("button",{onClick:()=>x(r),className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:s("settings.subagents.actions.viewTitle"),children:[e.jsx(w,{className:"w-3 h-3 mr-1"}),s("settings.subagents.actions.view")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>x(r),className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:s("settings.subagents.actions.editTitle"),children:[e.jsx($,{className:"w-3 h-3 mr-1"}),s("settings.subagents.actions.edit")]}),e.jsx("button",{onClick:()=>c(r),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:s("settings.subagents.actions.deleteTitle"),children:e.jsx(h,{className:"w-4 h-4"})})]})})})]},r.id+"-"+l))})]})})}),C&&e.jsx(q,{subagent:T,onClose:A,onSuccess:P}),g&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:`bg-white dark:bg-gray-800 rounded-lg shadow-xl ${t?"w-full max-w-sm":"max-w-md w-full"}`,children:[e.jsx("div",{className:`${t?"px-4 py-3":"px-6 py-4"} border-b border-gray-200 dark:border-gray-700`,children:e.jsx("h3",{className:`${t?"text-base":"text-lg"} font-semibold text-gray-900 dark:text-white`,children:s("settings.subagents.deleteConfirm.title")})}),e.jsxs("div",{className:`${t?"px-4 py-3":"px-6 py-4"}`,children:[e.jsx("p",{className:`${t?"text-sm":""} text-gray-600 dark:text-gray-400`,children:s("settings.subagents.deleteConfirm.message",{name:g.name})}),e.jsx("p",{className:`text-gray-500 dark:text-gray-400 ${t?"mt-1 text-xs":"mt-2"}`,children:s("settings.subagents.deleteConfirm.warning")})]}),e.jsxs("div",{className:`${t?"grid grid-cols-2 gap-2 px-4 py-3":"flex items-center justify-end space-x-3 px-6 py-4"} border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-700/50`,children:[e.jsx("button",{onClick:()=>c(null),className:`${t?"px-3 py-2.5 text-sm":"px-4 py-2"} text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors`,children:s("settings.subagents.deleteConfirm.cancel")}),e.jsxs("button",{onClick:()=>M(g),disabled:u.isPending,className:`${t?"flex items-center justify-center space-x-1 px-3 py-2.5 text-sm":"flex items-center space-x-2 px-4 py-2"} bg-red-600 hover:bg-red-700 disabled:bg-red-400 text-white rounded-lg transition-colors`,children:[u.isPending?e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-white border-t-transparent"}):e.jsx(h,{className:`${t?"h-3 w-3":"h-4 w-4"}`}),e.jsx("span",{children:s("settings.subagents.deleteConfirm.delete")})]})]})]})})]})};export{re as SubagentsPage};
1
+ import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i}from"./monaco-editor-DHKm5-VF.js";import{T as D,a as B,b as f,c as o,d as R,e as m}from"./table-F592JIUY.js";import{u as H,a as L,S as q}from"./SubagentForm-CSRBsxUE.js";import{f as N}from"./dateFormat-CXa8VnEC.js";import{b as z}from"./index-D9bAK8SN.js";import{T as k}from"./ToolsList-Ci2lqPin.js";import{u as J}from"./tools-C0JOzoE_.js";import{j as G,g as I,v as K,a5 as v,E as w,J as $,y as h}from"./ui-components-CRCmgMKc.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DG431Wop.js";import"./UnifiedToolSelector-CKjY_qjS.js";const re=()=>{const{t:s}=J("pages"),{isMobile:t}=z(),[a,S]=i.useState(""),[C,n]=i.useState(!1),[T,d]=i.useState(null),[g,c]=i.useState(null),[p,y]=i.useState({}),{data:b=[],isLoading:F,error:E,refetch:j}=H({search:a.trim()||void 0}),u=L(),M=async r=>{try{await u.mutateAsync(r.id),c(null)}catch(l){console.error("Failed to delete subagent:",l)}},x=r=>{d(r),n(!0)},A=()=>{n(!1),d(null)},P=()=>{j()};return F?e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`animate-spin rounded-full ${t?"h-8 w-8":"h-12 w-12"} border-b-2 border-blue-600 mx-auto ${t?"mb-3":"mb-4"}`}),e.jsx("div",{className:`text-gray-600 dark:text-gray-400 ${t?"text-sm":""}`,children:s("settings.subagents.loading")})]})}):E?e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(G,{className:`${t?"h-8 w-8":"h-12 w-12"} text-red-500 mx-auto ${t?"mb-3":"mb-4"}`}),e.jsx("h3",{className:`${t?"text-base":"text-lg"} font-medium text-gray-900 dark:text-white mb-2`,children:s("settings.subagents.loadFailed")}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${t?"mb-4 text-sm":"mb-4"}`,children:s("settings.subagents.loadFailedMessage")}),e.jsx("button",{onClick:()=>j(),className:`${t?"px-4 py-2.5 text-sm":"px-4 py-2"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:s("settings.subagents.retry")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:t?"mb-4":"flex items-center justify-between mb-6",children:e.jsxs("div",{children:[e.jsx("h1",{className:`${t?"text-2xl":"text-3xl"} font-bold text-gray-900 dark:text-white`,children:s("settings.subagents.title")}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${t?"mt-1":"mt-2"}`,children:s("settings.subagents.subtitle")})]})}),e.jsxs("div",{className:t?"space-y-3":"flex items-center space-x-4",children:[e.jsxs("div",{className:`${t?"":"flex-1"} relative`,children:[e.jsx(I,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 ${t?"w-4 h-4":"w-5 h-5"}`}),e.jsx("input",{type:"text",placeholder:s("settings.subagents.searchPlaceholder"),value:a,onChange:r=>S(r.target.value),className:`pl-10 pr-4 ${t?"py-2":"py-3"} w-full border border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent ${t?"text-sm":""}`})]}),e.jsxs("button",{onClick:()=>{d(null),n(!0)},className:`${t?"w-full py-2.5 px-4 flex items-center justify-center space-x-2":"flex items-center space-x-2 px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors ${t?"text-sm":"whitespace-nowrap"}`,children:[e.jsx(K,{className:t?"w-4 h-4":"w-5 h-5"}),e.jsx("span",{children:s("settings.subagents.createButton")})]})]})]}),b.length===0?e.jsxs("div",{className:"text-center py-16 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:`${t?"text-4xl":"text-6xl"} mb-4`,children:"🤖"}),e.jsx("h3",{className:`${t?"text-lg":"text-xl"} font-medium text-gray-900 dark:text-white mb-2`,children:s(a?"settings.subagents.noSubagentsSearch":"settings.subagents.noSubagents")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:s(a?"settings.subagents.adjustSearch":"settings.subagents.createFirst")}),!a&&e.jsx("button",{onClick:()=>{d(null),n(!0)},className:`${t?"w-full py-3 px-4":"px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:s("settings.subagents.createButton")})]}):e.jsx(e.Fragment,{children:t?e.jsx("div",{className:"space-y-4",children:b.map((r,l)=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-4",children:[e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`${t?"text-lg":"text-xl"} mr-3`,children:"🤖"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:`${t?"text-sm":"text-base"} font-medium text-gray-900 dark:text-white`,children:r.name}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${r.source==="plugin"?"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300":"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300"}`,children:r.source==="plugin"?s("settings.subagents.source.plugin"):s("settings.subagents.source.local")})]}),r.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:r.description})]})]})}),e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsx("div",{className:"mb-3",children:e.jsxs("div",{className:"flex items-start text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2 mt-1",children:[s("settings.subagents.table.tools"),":"]}),e.jsx("div",{className:"flex-1",children:e.jsx(k,{tools:r.tools||[],id:r.id,expandedTools:p,setExpandedTools:y,isMobile:!0,emptyMessage:s("settings.subagents.table.inheritSettings")})})]})}),e.jsxs("div",{className:"flex items-center text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2",children:[s("settings.subagents.table.createdAt"),":"]}),e.jsxs("div",{className:"flex items-center text-gray-500 dark:text-gray-400",children:[e.jsx(v,{className:"w-4 h-4 mr-1"}),e.jsx("span",{children:N(r.createdAt)})]})]})]}),e.jsx("div",{className:"flex items-center justify-end space-x-2 pt-3 border-t border-gray-200 dark:border-gray-700",children:r.source==="plugin"?e.jsxs("button",{onClick:()=>x(r),className:"inline-flex items-center px-3 py-2 text-sm font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",children:[e.jsx(w,{className:"w-3 h-3 mr-1"}),s("settings.subagents.actions.view")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>x(r),className:"inline-flex items-center px-3 py-2 text-sm font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",children:[e.jsx($,{className:"w-3 h-3 mr-1"}),s("settings.subagents.actions.edit")]}),e.jsx("button",{onClick:()=>c(r),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:s("settings.subagents.actions.deleteTitle"),children:e.jsx(h,{className:"w-4 h-4"})})]})})]},r.id+"-"+l))}):e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsxs(D,{children:[e.jsx(B,{children:e.jsxs(f,{children:[e.jsx(o,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("settings.subagents.table.subagent")}),e.jsx(o,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("settings.subagents.table.tools")}),e.jsx(o,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("settings.subagents.table.createdAt")}),e.jsx(o,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("settings.subagents.table.actions")})]})}),e.jsx(R,{children:b.map((r,l)=>e.jsxs(f,{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx(m,{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"text-xl mr-3",children:"🤖"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:r.name}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${r.source==="plugin"?"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300":"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300"}`,children:r.source==="plugin"?s("settings.subagents.source.plugin"):s("settings.subagents.source.local")})]}),r.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 truncate max-w-xs",children:r.description})]})]})}),e.jsx(m,{className:"px-6 py-4",children:e.jsx(k,{tools:r.tools||[],id:r.id,expandedTools:p,setExpandedTools:y,isMobile:!1,emptyMessage:s("settings.subagents.table.inheritSettings")})}),e.jsx(m,{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(v,{className:"w-4 h-4"}),e.jsx("span",{children:N(r.createdAt)})]})}),e.jsx(m,{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsx("div",{className:"flex items-center justify-end space-x-2",children:r.source==="plugin"?e.jsxs("button",{onClick:()=>x(r),className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:s("settings.subagents.actions.viewTitle"),children:[e.jsx(w,{className:"w-3 h-3 mr-1"}),s("settings.subagents.actions.view")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>x(r),className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:s("settings.subagents.actions.editTitle"),children:[e.jsx($,{className:"w-3 h-3 mr-1"}),s("settings.subagents.actions.edit")]}),e.jsx("button",{onClick:()=>c(r),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:s("settings.subagents.actions.deleteTitle"),children:e.jsx(h,{className:"w-4 h-4"})})]})})})]},r.id+"-"+l))})]})})}),C&&e.jsx(q,{subagent:T,onClose:A,onSuccess:P}),g&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:`bg-white dark:bg-gray-800 rounded-lg shadow-xl ${t?"w-full max-w-sm":"max-w-md w-full"}`,children:[e.jsx("div",{className:`${t?"px-4 py-3":"px-6 py-4"} border-b border-gray-200 dark:border-gray-700`,children:e.jsx("h3",{className:`${t?"text-base":"text-lg"} font-semibold text-gray-900 dark:text-white`,children:s("settings.subagents.deleteConfirm.title")})}),e.jsxs("div",{className:`${t?"px-4 py-3":"px-6 py-4"}`,children:[e.jsx("p",{className:`${t?"text-sm":""} text-gray-600 dark:text-gray-400`,children:s("settings.subagents.deleteConfirm.message",{name:g.name})}),e.jsx("p",{className:`text-gray-500 dark:text-gray-400 ${t?"mt-1 text-xs":"mt-2"}`,children:s("settings.subagents.deleteConfirm.warning")})]}),e.jsxs("div",{className:`${t?"grid grid-cols-2 gap-2 px-4 py-3":"flex items-center justify-end space-x-3 px-6 py-4"} border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-700/50`,children:[e.jsx("button",{onClick:()=>c(null),className:`${t?"px-3 py-2.5 text-sm":"px-4 py-2"} text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors`,children:s("settings.subagents.deleteConfirm.cancel")}),e.jsxs("button",{onClick:()=>M(g),disabled:u.isPending,className:`${t?"flex items-center justify-center space-x-1 px-3 py-2.5 text-sm":"flex items-center space-x-2 px-4 py-2"} bg-red-600 hover:bg-red-700 disabled:bg-red-400 text-white rounded-lg transition-colors`,children:[u.isPending?e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-white border-t-transparent"}):e.jsx(h,{className:`${t?"h-3 w-3":"h-4 w-4"}`}),e.jsx("span",{children:s("settings.subagents.deleteConfirm.delete")})]})]})]})})]})};export{re as SubagentsPage};
@@ -1 +1 @@
1
- import{j as e}from"./data-structures-C0h9Oap1.js";import{d as h,e as y}from"./index-h5dd40hU.js";import{u as b}from"./tools-C0JOzoE_.js";import{R as p,U as j,K as u,M as r,V as l,Y as f,_ as k,$ as N,e as v}from"./ui-components-CRCmgMKc.js";import"./monaco-editor-DHKm5-VF.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DG431Wop.js";const A=()=>{const{t:s}=b("pages"),{currentVersion:d,latestVersion:a,hasUpdate:n,forceCheck:o,isChecking:i,dismissUpdate:m,showUpdateNotification:x}=h(),{systemInfo:t,refetch:c}=y(),g=()=>{o(),c()};return e.jsxs("div",{className:"max-w-4xl mx-auto p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white flex items-center",children:[e.jsx(p,{className:"w-6 h-6 mr-2"}),s("settings.systemInfo.title")]}),e.jsx("p",{className:"mt-1 text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.subtitle")})]}),e.jsxs("button",{onClick:g,disabled:i,className:"inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(j,{className:`w-4 h-4 mr-2 ${i?"animate-spin":""}`}),s("settings.systemInfo.checkUpdate")]})]}),x&&a&&e.jsx("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-900/30 dark:to-indigo-900/30 border border-blue-200 dark:border-blue-800 rounded-xl p-6",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-start space-x-4",children:[e.jsx("div",{className:"p-3 bg-blue-100 dark:bg-blue-800 rounded-full",children:e.jsx(u,{className:"w-8 h-8 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-blue-900 dark:text-blue-100",children:s("settings.systemInfo.updateAvailable")}),e.jsx("p",{className:"mt-1 text-blue-700 dark:text-blue-300",children:s("version.newVersionAvailable",{version:a})}),e.jsxs("div",{className:"mt-4 flex space-x-3",children:[e.jsxs("a",{href:"https://github.com/okguitar/agentstudio/releases",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[e.jsx(r,{className:"w-4 h-4 mr-2"}),s("settings.systemInfo.viewReleases")]}),e.jsx("button",{onClick:m,className:"inline-flex items-center px-4 py-2 text-blue-700 dark:text-blue-300 bg-blue-100 dark:bg-blue-800 hover:bg-blue-200 dark:hover:bg-blue-700 rounded-lg transition-colors",children:s("version.dismiss")})]})]})]})})}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsx("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[e.jsx(l,{className:"w-5 h-5 mr-2"}),s("settings.systemInfo.versionInfo")]})}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.appName")}),e.jsx("p",{className:"mt-1 text-lg font-semibold text-gray-900 dark:text-white",children:t?.app.name||"AgentStudio"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.currentVersion")}),e.jsxs("div",{className:"mt-1 flex items-center",children:[e.jsxs("span",{className:"text-lg font-mono text-gray-900 dark:text-white",children:["v",d||t?.app.version||"-"]}),!n&&e.jsxs("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:[e.jsx(f,{className:"w-3 h-3 mr-1"}),s("settings.systemInfo.upToDate")]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.latestVersion")}),e.jsx("p",{className:"mt-1 text-lg font-mono text-gray-900 dark:text-white",children:a?`v${a}`:"-"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:["Node.js ",s("settings.systemInfo.version")]}),e.jsx("p",{className:"mt-1 font-mono text-gray-900 dark:text-white",children:t?.runtime.nodeVersion||"-"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.platform")}),e.jsxs("p",{className:"mt-1 text-gray-900 dark:text-white capitalize",children:[t?.runtime.platform||"-"," (",t?.runtime.arch||"-",")"]})]})]})]})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsx("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[e.jsx(k,{className:"w-5 h-5 mr-2"}),s("settings.systemInfo.runtimeInfo")]})}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Node.js"}),e.jsx("p",{className:"mt-1 font-mono text-gray-900 dark:text-white",children:t?.runtime.nodeVersion||"-"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.platform")}),e.jsx("p",{className:"mt-1 text-gray-900 dark:text-white capitalize",children:t?.runtime.platform||"-"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.architecture")}),e.jsx("p",{className:"mt-1 text-gray-900 dark:text-white",children:t?.runtime.arch||"-"})]})]})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsx("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[e.jsx(r,{className:"w-5 h-5 mr-2"}),s("settings.systemInfo.links")]})}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("a",{href:t?.links.github||"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"flex items-center p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[e.jsx(N,{className:"w-6 h-6 text-gray-700 dark:text-gray-300 mr-3"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"GitHub"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.viewSource")})]}),e.jsx(r,{className:"w-4 h-4 text-gray-400 ml-auto"})]}),e.jsxs("a",{href:t?.links.releases||"https://github.com/okguitar/agentstudio/releases",target:"_blank",rel:"noopener noreferrer",className:"flex items-center p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[e.jsx(l,{className:"w-6 h-6 text-gray-700 dark:text-gray-300 mr-3"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"Releases"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.viewReleases")})]}),e.jsx(r,{className:"w-4 h-4 text-gray-400 ml-auto"})]}),e.jsxs("a",{href:t?.links.changelog||"https://github.com/okguitar/agentstudio/blob/main/CHANGELOG.md",target:"_blank",rel:"noopener noreferrer",className:"flex items-center p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[e.jsx(v,{className:"w-6 h-6 text-gray-700 dark:text-gray-300 mr-3"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"Changelog"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.viewChangelog")})]}),e.jsx(r,{className:"w-4 h-4 text-gray-400 ml-auto"})]}),e.jsxs("a",{href:t?.links.npm||"https://www.npmjs.com/package/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"flex items-center p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[e.jsx(l,{className:"w-6 h-6 text-red-600 dark:text-red-400 mr-3"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"npm"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.viewNpm")})]}),e.jsx(r,{className:"w-4 h-4 text-gray-400 ml-auto"})]})]})})]})]})};export{A as SystemInfoPage};
1
+ import{j as e}from"./data-structures-C0h9Oap1.js";import{d as h,e as y}from"./index-D9bAK8SN.js";import{u as b}from"./tools-C0JOzoE_.js";import{R as p,U as j,K as u,M as r,V as l,Y as f,_ as k,$ as N,e as v}from"./ui-components-CRCmgMKc.js";import"./monaco-editor-DHKm5-VF.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DG431Wop.js";const A=()=>{const{t:s}=b("pages"),{currentVersion:d,latestVersion:a,hasUpdate:n,forceCheck:o,isChecking:i,dismissUpdate:m,showUpdateNotification:x}=h(),{systemInfo:t,refetch:c}=y(),g=()=>{o(),c()};return e.jsxs("div",{className:"max-w-4xl mx-auto p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white flex items-center",children:[e.jsx(p,{className:"w-6 h-6 mr-2"}),s("settings.systemInfo.title")]}),e.jsx("p",{className:"mt-1 text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.subtitle")})]}),e.jsxs("button",{onClick:g,disabled:i,className:"inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(j,{className:`w-4 h-4 mr-2 ${i?"animate-spin":""}`}),s("settings.systemInfo.checkUpdate")]})]}),x&&a&&e.jsx("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-900/30 dark:to-indigo-900/30 border border-blue-200 dark:border-blue-800 rounded-xl p-6",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-start space-x-4",children:[e.jsx("div",{className:"p-3 bg-blue-100 dark:bg-blue-800 rounded-full",children:e.jsx(u,{className:"w-8 h-8 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-blue-900 dark:text-blue-100",children:s("settings.systemInfo.updateAvailable")}),e.jsx("p",{className:"mt-1 text-blue-700 dark:text-blue-300",children:s("version.newVersionAvailable",{version:a})}),e.jsxs("div",{className:"mt-4 flex space-x-3",children:[e.jsxs("a",{href:"https://github.com/okguitar/agentstudio/releases",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[e.jsx(r,{className:"w-4 h-4 mr-2"}),s("settings.systemInfo.viewReleases")]}),e.jsx("button",{onClick:m,className:"inline-flex items-center px-4 py-2 text-blue-700 dark:text-blue-300 bg-blue-100 dark:bg-blue-800 hover:bg-blue-200 dark:hover:bg-blue-700 rounded-lg transition-colors",children:s("version.dismiss")})]})]})]})})}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsx("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[e.jsx(l,{className:"w-5 h-5 mr-2"}),s("settings.systemInfo.versionInfo")]})}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.appName")}),e.jsx("p",{className:"mt-1 text-lg font-semibold text-gray-900 dark:text-white",children:t?.app.name||"AgentStudio"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.currentVersion")}),e.jsxs("div",{className:"mt-1 flex items-center",children:[e.jsxs("span",{className:"text-lg font-mono text-gray-900 dark:text-white",children:["v",d||t?.app.version||"-"]}),!n&&e.jsxs("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:[e.jsx(f,{className:"w-3 h-3 mr-1"}),s("settings.systemInfo.upToDate")]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.latestVersion")}),e.jsx("p",{className:"mt-1 text-lg font-mono text-gray-900 dark:text-white",children:a?`v${a}`:"-"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:["Node.js ",s("settings.systemInfo.version")]}),e.jsx("p",{className:"mt-1 font-mono text-gray-900 dark:text-white",children:t?.runtime.nodeVersion||"-"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.platform")}),e.jsxs("p",{className:"mt-1 text-gray-900 dark:text-white capitalize",children:[t?.runtime.platform||"-"," (",t?.runtime.arch||"-",")"]})]})]})]})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsx("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[e.jsx(k,{className:"w-5 h-5 mr-2"}),s("settings.systemInfo.runtimeInfo")]})}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Node.js"}),e.jsx("p",{className:"mt-1 font-mono text-gray-900 dark:text-white",children:t?.runtime.nodeVersion||"-"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.platform")}),e.jsx("p",{className:"mt-1 text-gray-900 dark:text-white capitalize",children:t?.runtime.platform||"-"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.architecture")}),e.jsx("p",{className:"mt-1 text-gray-900 dark:text-white",children:t?.runtime.arch||"-"})]})]})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsx("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[e.jsx(r,{className:"w-5 h-5 mr-2"}),s("settings.systemInfo.links")]})}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("a",{href:t?.links.github||"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"flex items-center p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[e.jsx(N,{className:"w-6 h-6 text-gray-700 dark:text-gray-300 mr-3"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"GitHub"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.viewSource")})]}),e.jsx(r,{className:"w-4 h-4 text-gray-400 ml-auto"})]}),e.jsxs("a",{href:t?.links.releases||"https://github.com/okguitar/agentstudio/releases",target:"_blank",rel:"noopener noreferrer",className:"flex items-center p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[e.jsx(l,{className:"w-6 h-6 text-gray-700 dark:text-gray-300 mr-3"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"Releases"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.viewReleases")})]}),e.jsx(r,{className:"w-4 h-4 text-gray-400 ml-auto"})]}),e.jsxs("a",{href:t?.links.changelog||"https://github.com/okguitar/agentstudio/blob/main/CHANGELOG.md",target:"_blank",rel:"noopener noreferrer",className:"flex items-center p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[e.jsx(v,{className:"w-6 h-6 text-gray-700 dark:text-gray-300 mr-3"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"Changelog"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.viewChangelog")})]}),e.jsx(r,{className:"w-4 h-4 text-gray-400 ml-auto"})]}),e.jsxs("a",{href:t?.links.npm||"https://www.npmjs.com/package/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"flex items-center p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[e.jsx(l,{className:"w-6 h-6 text-red-600 dark:text-red-400 mr-3"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"npm"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.viewNpm")})]}),e.jsx(r,{className:"w-4 h-4 text-gray-400 ml-auto"})]})]})})]})]})};export{A as SystemInfoPage};
@@ -1 +1 @@
1
- import{j as e}from"./data-structures-C0h9Oap1.js";import{W as i}from"./monaco-editor-DHKm5-VF.js";import{i as d,f as c}from"./index-h5dd40hU.js";import{u as m}from"./tools-C0JOzoE_.js";import{a0 as o,a1 as a,a2 as x,j as g}from"./ui-components-CRCmgMKc.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DG431Wop.js";const f=()=>{const{t:s}=m("pages"),[t,l]=i.useState(d()),n=()=>{const r=!t;c(r),l(r)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:s("settings.telemetry.title","Telemetry & Analytics")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:s("settings.telemetry.description","Manage anonymous usage data collection")})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`p-3 rounded-xl ${t?"bg-blue-100 dark:bg-blue-900/30":"bg-gray-100 dark:bg-gray-700"}`,children:e.jsx(o,{className:`w-6 h-6 ${t?"text-blue-600 dark:text-blue-400":"text-gray-500"}`})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white",children:s("settings.telemetry.enableTelemetry","Enable Anonymous Telemetry")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:s("settings.telemetry.enableDescription","Help improve AgentStudio by sharing anonymous usage data")})]})]}),e.jsx("button",{onClick:n,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${t?"bg-blue-600":"bg-gray-300 dark:bg-gray-600"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${t?"translate-x-6":"translate-x-1"}`})})]})}),e.jsx("div",{className:`px-6 py-3 border-t ${t?"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800":"bg-gray-50 dark:bg-gray-700/50 border-gray-200 dark:border-gray-700"}`,children:e.jsx("div",{className:"flex items-center gap-2 text-sm",children:t?e.jsxs(e.Fragment,{children:[e.jsx(a,{className:"w-4 h-4 text-green-600 dark:text-green-400"}),e.jsx("span",{className:"text-green-700 dark:text-green-400",children:s("settings.telemetry.statusEnabled","Telemetry is enabled. Thank you for helping improve AgentStudio!")})]}):e.jsxs(e.Fragment,{children:[e.jsx(x,{className:"w-4 h-4 text-gray-500"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("settings.telemetry.statusDisabled","Telemetry is disabled. No data is being collected.")})]})})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2",children:[e.jsx(a,{className:"w-5 h-5 text-green-500"}),s("settings.telemetry.whatWeCollect","What We Collect")]}),e.jsxs("ul",{className:"space-y-3 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-green-500 mt-0.5",children:"✓"}),e.jsxs("div",{children:[e.jsx("strong",{children:s("settings.telemetry.collect.installId","Anonymous Installation ID")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mt-0.5",children:s("settings.telemetry.collect.installIdDesc","A random UUID to distinguish installations, not linked to your identity")})]})]}),e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-green-500 mt-0.5",children:"✓"}),e.jsxs("div",{children:[e.jsx("strong",{children:s("settings.telemetry.collect.version","App Version & OS")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mt-0.5",children:s("settings.telemetry.collect.versionDesc","Helps us understand which versions and platforms are most used")})]})]}),e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-green-500 mt-0.5",children:"✓"}),e.jsxs("div",{children:[e.jsx("strong",{children:s("settings.telemetry.collect.features","Feature Usage")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mt-0.5",children:s("settings.telemetry.collect.featuresDesc","Which features are used (without content or personal data)")})]})]}),e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-green-500 mt-0.5",children:"✓"}),e.jsxs("div",{children:[e.jsx("strong",{children:s("settings.telemetry.collect.errors","Error Reports")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mt-0.5",children:s("settings.telemetry.collect.errorsDesc","Sanitized error messages and stack traces (file paths removed)")})]})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2",children:[e.jsx(g,{className:"w-5 h-5 text-red-500"}),s("settings.telemetry.whatWeNeverCollect","What We Never Collect")]}),e.jsxs("ul",{className:"space-y-3 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-red-500 mt-0.5",children:"✗"}),e.jsx("span",{children:s("settings.telemetry.neverCollect.files","File contents, code, or project data")})]}),e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-red-500 mt-0.5",children:"✗"}),e.jsx("span",{children:s("settings.telemetry.neverCollect.keys","API keys, passwords, or credentials")})]}),e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-red-500 mt-0.5",children:"✗"}),e.jsx("span",{children:s("settings.telemetry.neverCollect.pii","Personal identifying information (name, email, IP)")})]}),e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-red-500 mt-0.5",children:"✗"}),e.jsx("span",{children:s("settings.telemetry.neverCollect.conversations","Chat conversations or AI responses")})]})]})]}),e.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-xl border border-blue-200 dark:border-blue-800 p-4",children:e.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:[e.jsxs("strong",{children:[s("settings.telemetry.privacyNote","Privacy First"),":"]})," ",s("settings.telemetry.privacyNoteDesc","All telemetry data is anonymized and aggregated. We cannot identify individual users. You can disable telemetry at any time.")]})})]})};export{f as TelemetrySettingsPage,f as default};
1
+ import{j as e}from"./data-structures-C0h9Oap1.js";import{W as i}from"./monaco-editor-DHKm5-VF.js";import{i as d,f as c}from"./index-D9bAK8SN.js";import{u as m}from"./tools-C0JOzoE_.js";import{a0 as o,a1 as a,a2 as x,j as g}from"./ui-components-CRCmgMKc.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DG431Wop.js";const f=()=>{const{t:s}=m("pages"),[t,l]=i.useState(d()),n=()=>{const r=!t;c(r),l(r)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:s("settings.telemetry.title","Telemetry & Analytics")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:s("settings.telemetry.description","Manage anonymous usage data collection")})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`p-3 rounded-xl ${t?"bg-blue-100 dark:bg-blue-900/30":"bg-gray-100 dark:bg-gray-700"}`,children:e.jsx(o,{className:`w-6 h-6 ${t?"text-blue-600 dark:text-blue-400":"text-gray-500"}`})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white",children:s("settings.telemetry.enableTelemetry","Enable Anonymous Telemetry")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:s("settings.telemetry.enableDescription","Help improve AgentStudio by sharing anonymous usage data")})]})]}),e.jsx("button",{onClick:n,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${t?"bg-blue-600":"bg-gray-300 dark:bg-gray-600"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${t?"translate-x-6":"translate-x-1"}`})})]})}),e.jsx("div",{className:`px-6 py-3 border-t ${t?"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800":"bg-gray-50 dark:bg-gray-700/50 border-gray-200 dark:border-gray-700"}`,children:e.jsx("div",{className:"flex items-center gap-2 text-sm",children:t?e.jsxs(e.Fragment,{children:[e.jsx(a,{className:"w-4 h-4 text-green-600 dark:text-green-400"}),e.jsx("span",{className:"text-green-700 dark:text-green-400",children:s("settings.telemetry.statusEnabled","Telemetry is enabled. Thank you for helping improve AgentStudio!")})]}):e.jsxs(e.Fragment,{children:[e.jsx(x,{className:"w-4 h-4 text-gray-500"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("settings.telemetry.statusDisabled","Telemetry is disabled. No data is being collected.")})]})})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2",children:[e.jsx(a,{className:"w-5 h-5 text-green-500"}),s("settings.telemetry.whatWeCollect","What We Collect")]}),e.jsxs("ul",{className:"space-y-3 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-green-500 mt-0.5",children:"✓"}),e.jsxs("div",{children:[e.jsx("strong",{children:s("settings.telemetry.collect.installId","Anonymous Installation ID")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mt-0.5",children:s("settings.telemetry.collect.installIdDesc","A random UUID to distinguish installations, not linked to your identity")})]})]}),e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-green-500 mt-0.5",children:"✓"}),e.jsxs("div",{children:[e.jsx("strong",{children:s("settings.telemetry.collect.version","App Version & OS")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mt-0.5",children:s("settings.telemetry.collect.versionDesc","Helps us understand which versions and platforms are most used")})]})]}),e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-green-500 mt-0.5",children:"✓"}),e.jsxs("div",{children:[e.jsx("strong",{children:s("settings.telemetry.collect.features","Feature Usage")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mt-0.5",children:s("settings.telemetry.collect.featuresDesc","Which features are used (without content or personal data)")})]})]}),e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-green-500 mt-0.5",children:"✓"}),e.jsxs("div",{children:[e.jsx("strong",{children:s("settings.telemetry.collect.errors","Error Reports")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mt-0.5",children:s("settings.telemetry.collect.errorsDesc","Sanitized error messages and stack traces (file paths removed)")})]})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2",children:[e.jsx(g,{className:"w-5 h-5 text-red-500"}),s("settings.telemetry.whatWeNeverCollect","What We Never Collect")]}),e.jsxs("ul",{className:"space-y-3 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-red-500 mt-0.5",children:"✗"}),e.jsx("span",{children:s("settings.telemetry.neverCollect.files","File contents, code, or project data")})]}),e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-red-500 mt-0.5",children:"✗"}),e.jsx("span",{children:s("settings.telemetry.neverCollect.keys","API keys, passwords, or credentials")})]}),e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-red-500 mt-0.5",children:"✗"}),e.jsx("span",{children:s("settings.telemetry.neverCollect.pii","Personal identifying information (name, email, IP)")})]}),e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-red-500 mt-0.5",children:"✗"}),e.jsx("span",{children:s("settings.telemetry.neverCollect.conversations","Chat conversations or AI responses")})]})]})]}),e.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-xl border border-blue-200 dark:border-blue-800 p-4",children:e.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:[e.jsxs("strong",{children:[s("settings.telemetry.privacyNote","Privacy First"),":"]})," ",s("settings.telemetry.privacyNoteDesc","All telemetry data is anonymized and aggregated. We cannot identify individual users. You can disable telemetry at any time.")]})})]})};export{f as TelemetrySettingsPage,f as default};
@@ -1 +1 @@
1
- import{j as s}from"./data-structures-C0h9Oap1.js";import{s as e,a as o,c as r}from"./index-h5dd40hU.js";import"./monaco-editor-DHKm5-VF.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DG431Wop.js";import"./tools-C0JOzoE_.js";import"./ui-components-CRCmgMKc.js";const l=()=>s.jsxs("div",{className:"p-8 space-y-4",children:[s.jsx("h1",{className:"text-2xl font-bold mb-6",children:"Toast Test Page"}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("button",{onClick:()=>e("Success!","This is a success message"),className:"px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700",children:"Show Success Toast"}),s.jsx("button",{onClick:()=>o("Error!","This is an error message"),className:"px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 ml-4",children:"Show Error Toast"}),s.jsx("button",{onClick:()=>r("Info","This is an info message"),className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 ml-4",children:"Show Info Toast"})]})]});export{l as ToastTestPage};
1
+ import{j as s}from"./data-structures-C0h9Oap1.js";import{s as e,a as o,c as r}from"./index-D9bAK8SN.js";import"./monaco-editor-DHKm5-VF.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DG431Wop.js";import"./tools-C0JOzoE_.js";import"./ui-components-CRCmgMKc.js";const l=()=>s.jsxs("div",{className:"p-8 space-y-4",children:[s.jsx("h1",{className:"text-2xl font-bold mb-6",children:"Toast Test Page"}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("button",{onClick:()=>e("Success!","This is a success message"),className:"px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700",children:"Show Success Toast"}),s.jsx("button",{onClick:()=>o("Error!","This is an error message"),className:"px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 ml-4",children:"Show Error Toast"}),s.jsx("button",{onClick:()=>r("Info","This is an info message"),className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 ml-4",children:"Show Info Toast"})]})]});export{l as ToastTestPage};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./data-structures-C0h9Oap1.js";import{W as L,r as j}from"./monaco-editor-DHKm5-VF.js";import{a as w,s as M}from"./index-h5dd40hU.js";import{u as ie,a as le,b as ne,c as oe,d as de,f as ce}from"./useClaudeVersions-DYM2HCGW.js";import{F as pe}from"./FileBrowser-CXd_LcTz.js";import{u as C}from"./tools-C0JOzoE_.js";import{v as R,aO as F,E as U,I as ue,J as xe,y as me,r as q,X as K,a8 as ge,M as he,S as be,f as ye,a3 as fe}from"./ui-components-CRCmgMKc.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DG431Wop.js";async function ke(s){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(s),!0;{const t=document.createElement("textarea");t.value=s,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t),t.focus(),t.select();const p=document.execCommand("copy");return document.body.removeChild(t),p}}catch(t){return console.error("Failed to copy to clipboard:",t),!1}}const G=[{id:"glm",name:"GLM (智谱AI)",alias:"glm",description:"使用智谱AI的GLM模型服务,兼容Anthropic API",versionDescription:"智谱AI GLM模型 - Anthropic兼容版本",apiTokenUrl:"https://www.bigmodel.cn/claude-code?ic=IHK4TGHUDI",logoUrl:"https://chatglm.cn/img/icons/favicon-32x32.png",envVars:[{key:"ANTHROPIC_BASE_URL",value:"https://open.bigmodel.cn/api/anthropic",isRequired:!0,description:"智谱AI的Anthropic兼容端点"},{key:"ANTHROPIC_AUTH_TOKEN",value:"",isRequired:!0,placeholder:"YOUR_API_KEY",description:"您的智谱AI API密钥(必填)"}],models:[{id:"glm-4.7",name:"GLM-4.7",isVision:!1,description:"智谱AI GLM-4.7 最新版本"},{id:"glm-4.6",name:"GLM-4.6",isVision:!1,description:"智谱AI GLM-4.6 模型"},{id:"glm-4.5",name:"GLM-4.5",isVision:!1,description:"智谱AI GLM-4.5 模型"},{id:"glm-4.5v",name:"GLM-4.5V",isVision:!0,description:"智谱AI GLM-4.5V 视觉模型"},{id:"glm-4.5-flash",name:"GLM-4.5-Flash",isVision:!1,description:"智谱AI GLM-4.5-Flash 快速模型"},{id:"glm-4.5-air",name:"GLM-4.5-Air",isVision:!1,description:"智谱AI GLM-4.5-Air 轻量级模型"}]},{id:"deepseek",name:"DeepSeek",alias:"deepseek",description:"使用DeepSeek的高性能模型服务",versionDescription:"DeepSeek高性能模型 - Anthropic兼容版本",apiTokenUrl:"https://platform.deepseek.com/api_keys",logoUrl:"https://chat.deepseek.com/favicon.svg",envVars:[{key:"ANTHROPIC_BASE_URL",value:"https://api.deepseek.com/anthropic",isRequired:!0,description:"DeepSeek的Anthropic兼容端点"},{key:"ANTHROPIC_AUTH_TOKEN",value:"",isRequired:!0,placeholder:"YOUR_DEEPSEEK_API_KEY",description:"您的DeepSeek API密钥(必填)"},{key:"API_TIMEOUT_MS",value:"600000",isRequired:!1,description:"API请求超时时间(毫秒)"},{key:"ANTHROPIC_MODEL",value:"deepseek-chat",isRequired:!1,description:"使用的DeepSeek模型名称"},{key:"ANTHROPIC_SMALL_FAST_MODEL",value:"deepseek-chat",isRequired:!1,description:"快速轻量级模型名称"},{key:"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC",value:"1",isRequired:!1,description:"禁用非必要流量(1=启用,0=禁用)"}],models:[{id:"deepseek-chat",name:"DeepSeek Chat",isVision:!1,description:"DeepSeek Chat 最新对话模型"},{id:"deepseek-reasoner",name:"DeepSeek Reasoner",isVision:!1,description:"DeepSeek Reasoner 推理模型"}]},{id:"kimi",name:"Kimi K2 (月之暗面)",alias:"kimi-k2",description:"使用Kimi K2模型服务,支持Anthropic API兼容",versionDescription:"Kimi K2模型 - Anthropic兼容版本",apiTokenUrl:"https://platform.moonshot.cn/console/api-keys",logoUrl:"https://statics.moonshot.cn/kimi-web-seo/favicon.ico",envVars:[{key:"ANTHROPIC_BASE_URL",value:"https://api.moonshot.cn/anthropic",isRequired:!0,description:"Kimi的Anthropic兼容端点"},{key:"ANTHROPIC_AUTH_TOKEN",value:"",isRequired:!0,placeholder:"sk-YOURKEY",description:"您的Kimi API密钥(必填,以sk-开头)"}],models:[{id:"kimi-k2-0905-preview",name:"Kimi K2 0905 Preview",isVision:!1,description:"Kimi K2 2024年9月5日预览版"},{id:"kimi-k2-0711-preview",name:"Kimi K2 0711 Preview",isVision:!1,description:"Kimi K2 2024年7月11日预览版"},{id:"kimi-k2-turbo-preview",name:"Kimi K2 Turbo Preview",isVision:!1,description:"Kimi K2 Turbo 预览版"},{id:"kimi-latest",name:"Kimi Latest",isVision:!0,description:"Kimi 最新版本视觉模型"}]},{id:"minimax",name:"MiniMax",alias:"minimax",description:"使用MiniMax的高性能模型服务,支持Anthropic API兼容",versionDescription:"MiniMax模型 - Anthropic兼容版本",apiTokenUrl:"https://platform.minimaxi.com/user-center/basic-information/interface-key",logoUrl:"https://agent.minimaxi.com/assets/logo/favicon.png?v=4",envVars:[{key:"ANTHROPIC_BASE_URL",value:"https://api.minimaxi.com/anthropic",isRequired:!0,description:"MiniMax的Anthropic兼容端点"},{key:"ANTHROPIC_AUTH_TOKEN",value:"",isRequired:!0,placeholder:"<MINIMAX_API_KEY>",description:"您的MiniMax API密钥(必填)"},{key:"API_TIMEOUT_MS",value:"3000000",isRequired:!1,description:"API请求超时时间(毫秒)"},{key:"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC",value:"1",isRequired:!1,description:"禁用非必要流量(1=启用,0=禁用)"},{key:"ANTHROPIC_MODEL",value:"MiniMax-M2",isRequired:!1,description:"使用的MiniMax模型名称"},{key:"ANTHROPIC_SMALL_FAST_MODEL",value:"MiniMax-M2",isRequired:!1,description:"快速轻量级模型名称"},{key:"ANTHROPIC_DEFAULT_SONNET_MODEL",value:"MiniMax-M2",isRequired:!1,description:"默认Sonnet模型名称"},{key:"ANTHROPIC_DEFAULT_OPUS_MODEL",value:"MiniMax-M2",isRequired:!1,description:"默认Opus模型名称"},{key:"ANTHROPIC_DEFAULT_HAIKU_MODEL",value:"MiniMax-M2",isRequired:!1,description:"默认Haiku模型名称"}],models:[{id:"MiniMax-M2",name:"MiniMax M2",isVision:!1,description:"MiniMax M2 最新模型"}]}],ve=({onQuickCreateWithTemplate:s,onAddVersion:t})=>{const{t:p}=C("pages");return e.jsxs("div",{className:"flex items-center space-x-3",children:[G.map(a=>e.jsxs("button",{onClick:()=>s(a),className:`flex items-center space-x-2 px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600
1
+ import{j as e}from"./data-structures-C0h9Oap1.js";import{W as L,r as j}from"./monaco-editor-DHKm5-VF.js";import{a as w,s as M}from"./index-D9bAK8SN.js";import{u as ie,a as le,b as ne,c as oe,d as de,f as ce}from"./useClaudeVersions-DYM2HCGW.js";import{F as pe}from"./FileBrowser-BXtVLz8h.js";import{u as C}from"./tools-C0JOzoE_.js";import{v as R,aO as F,E as U,I as ue,J as xe,y as me,r as q,X as K,a8 as ge,M as he,S as be,f as ye,a3 as fe}from"./ui-components-CRCmgMKc.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DG431Wop.js";async function ke(s){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(s),!0;{const t=document.createElement("textarea");t.value=s,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t),t.focus(),t.select();const p=document.execCommand("copy");return document.body.removeChild(t),p}}catch(t){return console.error("Failed to copy to clipboard:",t),!1}}const G=[{id:"glm",name:"GLM (智谱AI)",alias:"glm",description:"使用智谱AI的GLM模型服务,兼容Anthropic API",versionDescription:"智谱AI GLM模型 - Anthropic兼容版本",apiTokenUrl:"https://www.bigmodel.cn/claude-code?ic=IHK4TGHUDI",logoUrl:"https://chatglm.cn/img/icons/favicon-32x32.png",envVars:[{key:"ANTHROPIC_BASE_URL",value:"https://open.bigmodel.cn/api/anthropic",isRequired:!0,description:"智谱AI的Anthropic兼容端点"},{key:"ANTHROPIC_AUTH_TOKEN",value:"",isRequired:!0,placeholder:"YOUR_API_KEY",description:"您的智谱AI API密钥(必填)"}],models:[{id:"glm-4.7",name:"GLM-4.7",isVision:!1,description:"智谱AI GLM-4.7 最新版本"},{id:"glm-4.6",name:"GLM-4.6",isVision:!1,description:"智谱AI GLM-4.6 模型"},{id:"glm-4.5",name:"GLM-4.5",isVision:!1,description:"智谱AI GLM-4.5 模型"},{id:"glm-4.5v",name:"GLM-4.5V",isVision:!0,description:"智谱AI GLM-4.5V 视觉模型"},{id:"glm-4.5-flash",name:"GLM-4.5-Flash",isVision:!1,description:"智谱AI GLM-4.5-Flash 快速模型"},{id:"glm-4.5-air",name:"GLM-4.5-Air",isVision:!1,description:"智谱AI GLM-4.5-Air 轻量级模型"}]},{id:"deepseek",name:"DeepSeek",alias:"deepseek",description:"使用DeepSeek的高性能模型服务",versionDescription:"DeepSeek高性能模型 - Anthropic兼容版本",apiTokenUrl:"https://platform.deepseek.com/api_keys",logoUrl:"https://chat.deepseek.com/favicon.svg",envVars:[{key:"ANTHROPIC_BASE_URL",value:"https://api.deepseek.com/anthropic",isRequired:!0,description:"DeepSeek的Anthropic兼容端点"},{key:"ANTHROPIC_AUTH_TOKEN",value:"",isRequired:!0,placeholder:"YOUR_DEEPSEEK_API_KEY",description:"您的DeepSeek API密钥(必填)"},{key:"API_TIMEOUT_MS",value:"600000",isRequired:!1,description:"API请求超时时间(毫秒)"},{key:"ANTHROPIC_MODEL",value:"deepseek-chat",isRequired:!1,description:"使用的DeepSeek模型名称"},{key:"ANTHROPIC_SMALL_FAST_MODEL",value:"deepseek-chat",isRequired:!1,description:"快速轻量级模型名称"},{key:"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC",value:"1",isRequired:!1,description:"禁用非必要流量(1=启用,0=禁用)"}],models:[{id:"deepseek-chat",name:"DeepSeek Chat",isVision:!1,description:"DeepSeek Chat 最新对话模型"},{id:"deepseek-reasoner",name:"DeepSeek Reasoner",isVision:!1,description:"DeepSeek Reasoner 推理模型"}]},{id:"kimi",name:"Kimi K2 (月之暗面)",alias:"kimi-k2",description:"使用Kimi K2模型服务,支持Anthropic API兼容",versionDescription:"Kimi K2模型 - Anthropic兼容版本",apiTokenUrl:"https://platform.moonshot.cn/console/api-keys",logoUrl:"https://statics.moonshot.cn/kimi-web-seo/favicon.ico",envVars:[{key:"ANTHROPIC_BASE_URL",value:"https://api.moonshot.cn/anthropic",isRequired:!0,description:"Kimi的Anthropic兼容端点"},{key:"ANTHROPIC_AUTH_TOKEN",value:"",isRequired:!0,placeholder:"sk-YOURKEY",description:"您的Kimi API密钥(必填,以sk-开头)"}],models:[{id:"kimi-k2-0905-preview",name:"Kimi K2 0905 Preview",isVision:!1,description:"Kimi K2 2024年9月5日预览版"},{id:"kimi-k2-0711-preview",name:"Kimi K2 0711 Preview",isVision:!1,description:"Kimi K2 2024年7月11日预览版"},{id:"kimi-k2-turbo-preview",name:"Kimi K2 Turbo Preview",isVision:!1,description:"Kimi K2 Turbo 预览版"},{id:"kimi-latest",name:"Kimi Latest",isVision:!0,description:"Kimi 最新版本视觉模型"}]},{id:"minimax",name:"MiniMax",alias:"minimax",description:"使用MiniMax的高性能模型服务,支持Anthropic API兼容",versionDescription:"MiniMax模型 - Anthropic兼容版本",apiTokenUrl:"https://platform.minimaxi.com/user-center/basic-information/interface-key",logoUrl:"https://agent.minimaxi.com/assets/logo/favicon.png?v=4",envVars:[{key:"ANTHROPIC_BASE_URL",value:"https://api.minimaxi.com/anthropic",isRequired:!0,description:"MiniMax的Anthropic兼容端点"},{key:"ANTHROPIC_AUTH_TOKEN",value:"",isRequired:!0,placeholder:"<MINIMAX_API_KEY>",description:"您的MiniMax API密钥(必填)"},{key:"API_TIMEOUT_MS",value:"3000000",isRequired:!1,description:"API请求超时时间(毫秒)"},{key:"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC",value:"1",isRequired:!1,description:"禁用非必要流量(1=启用,0=禁用)"},{key:"ANTHROPIC_MODEL",value:"MiniMax-M2",isRequired:!1,description:"使用的MiniMax模型名称"},{key:"ANTHROPIC_SMALL_FAST_MODEL",value:"MiniMax-M2",isRequired:!1,description:"快速轻量级模型名称"},{key:"ANTHROPIC_DEFAULT_SONNET_MODEL",value:"MiniMax-M2",isRequired:!1,description:"默认Sonnet模型名称"},{key:"ANTHROPIC_DEFAULT_OPUS_MODEL",value:"MiniMax-M2",isRequired:!1,description:"默认Opus模型名称"},{key:"ANTHROPIC_DEFAULT_HAIKU_MODEL",value:"MiniMax-M2",isRequired:!1,description:"默认Haiku模型名称"}],models:[{id:"MiniMax-M2",name:"MiniMax M2",isVision:!1,description:"MiniMax M2 最新模型"}]}],ve=({onQuickCreateWithTemplate:s,onAddVersion:t})=>{const{t:p}=C("pages");return e.jsxs("div",{className:"flex items-center space-x-3",children:[G.map(a=>e.jsxs("button",{onClick:()=>s(a),className:`flex items-center space-x-2 px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600
2
2
  text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700
3
3
  hover:border-purple-400 dark:hover:border-purple-500 transition-all duration-200 group`,title:p(`settings.supplier.templates.providers.${a.id}.description`),children:[a.logoUrl&&e.jsx("img",{src:a.logoUrl,alt:a.name,className:"w-5 h-5 flex-shrink-0",onError:x=>{x.currentTarget.style.display="none"}}),e.jsx("span",{className:"text-sm font-medium group-hover:text-purple-600 dark:group-hover:text-purple-400",children:p(`settings.supplier.templates.providers.${a.id}.name`)})]},a.id)),e.jsxs("button",{onClick:t,className:"flex items-center space-x-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[e.jsx(R,{className:"w-4 h-4"}),e.jsx("span",{children:p("settings.supplier.addSupplier")})]})]})},Ne=({version:s,isDefault:t,onCopyCommand:p,onSetDefault:a,onEdit:x,onDelete:h})=>{const{t:n}=C("pages");return e.jsx("div",{className:`p-4 border rounded-lg ${t?"border-blue-200 bg-blue-50 dark:border-blue-700 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-700/50"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"flex items-center space-x-3",children:e.jsxs("h4",{className:"font-medium text-gray-900 dark:text-white flex items-center space-x-2",children:[e.jsx("span",{children:s.name}),e.jsxs("span",{className:"text-sm font-normal text-gray-500 dark:text-gray-400",children:["(",s.alias,")"]}),s.isSystem&&e.jsx("span",{className:"px-2 py-1 text-xs bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-300 rounded",children:n("settings.supplier.systemLabel")}),t&&e.jsxs("span",{className:"px-2 py-1 text-xs bg-blue-200 dark:bg-blue-700 text-blue-700 dark:text-blue-200 rounded flex items-center space-x-1",children:[e.jsx(F,{className:"w-3 h-3"}),e.jsx("span",{children:n("settings.supplier.defaultLabel")})]})]})}),s.description&&e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:s.description}),e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:[e.jsxs("span",{className:"font-medium",children:[n("settings.supplier.pathLabel"),":"]})," ",s.executablePath]}),s.environmentVariables&&Object.keys(s.environmentVariables).length>0&&e.jsxs("div",{className:"mt-2",children:[e.jsxs("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[n("settings.supplier.envVarsLabel"),":"]}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:Object.entries(s.environmentVariables).map(([i,l])=>e.jsxs("span",{className:"px-2 py-1 text-xs bg-gray-100 dark:bg-gray-600 text-gray-700 dark:text-gray-300 rounded",children:[i,"=",l]},i))})]}),s.models&&s.models.length>0&&e.jsxs("div",{className:"mt-2",children:[e.jsxs("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[n("settings.supplier.modelsLabel"),":"]}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:s.models.map(i=>e.jsxs("span",{className:"px-2 py-1 text-xs bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded flex items-center space-x-1",children:[e.jsx("span",{children:i.name}),i.isVision&&e.jsx(U,{className:"w-3 h-3"})]},i.id))})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>p(s),className:"p-2 text-gray-500 dark:text-gray-400 hover:text-green-600 rounded-lg hover:bg-green-50 dark:hover:bg-green-900/20 transition-colors",title:n("settings.supplier.copyCommand"),children:e.jsx(ue,{className:"w-4 h-4"})}),!t&&e.jsx("button",{onClick:()=>a(s),className:"p-2 text-gray-500 dark:text-gray-400 hover:text-yellow-600 rounded-lg hover:bg-yellow-50 dark:hover:bg-yellow-900/20 transition-colors",title:n("settings.supplier.setAsDefault"),children:e.jsx(F,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>x(s),className:"p-2 text-gray-500 dark:text-gray-400 hover:text-blue-600 rounded-lg hover:bg-blue-50 dark:hover:bg-blue-900/20 transition-colors",title:n("settings.supplier.edit"),children:e.jsx(xe,{className:"w-4 h-4"})}),!s.isSystem&&e.jsx("button",{onClick:()=>h(s),className:"p-2 text-gray-500 dark:text-gray-400 hover:text-red-600 rounded-lg hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors",title:n("settings.supplier.delete"),children:e.jsx(me,{className:"w-4 h-4"})})]})]})})},je=({versions:s,defaultVersionId:t,isLoading:p,onCopyCommand:a,onSetDefault:x,onEdit:h,onDelete:n})=>{const{t:i}=C("pages");return p?e.jsx("div",{className:"flex items-center justify-center h-32",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})}):s.length===0?e.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:[e.jsx(q,{className:"w-12 h-12 mx-auto mb-3 text-gray-300 dark:text-gray-600"}),e.jsx("p",{children:i("settings.supplier.noSuppliers")}),e.jsx("p",{className:"text-sm",children:i("settings.supplier.clickToAddFirst")})]}):e.jsx("div",{className:"space-y-3",children:s.map(l=>e.jsx(Ne,{version:l,isDefault:l.id===t,onCopyCommand:a,onSetDefault:x,onEdit:h,onDelete:n},l.id))})},Ae=({models:s,modelInput:t,onAddModel:p,onUpdateModel:a,onRemoveModel:x,onModelInputChange:h})=>{const{t:n}=C("pages");return e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:n("settings.supplier.form.models")}),e.jsxs("div",{className:"space-y-3",children:[s.length>0&&e.jsx("div",{className:"space-y-2",children:s.map((i,l)=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 bg-blue-50 dark:bg-blue-900/20 rounded",children:[e.jsxs("div",{className:"flex-1 grid grid-cols-3 gap-2",children:[e.jsx("input",{type:"text",value:i.id,onChange:u=>{const b=s[l].id;a(b,{id:u.target.value})},className:"px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-white rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:n("settings.supplier.form.modelId")}),e.jsx("input",{type:"text",value:i.name,onChange:u=>{const b=s[l].id;a(b,{name:u.target.value})},className:"px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-white rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:n("settings.supplier.form.modelName")}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("label",{className:"flex items-center space-x-1 text-sm text-gray-700 dark:text-gray-300",children:[e.jsx("input",{type:"checkbox",checked:i.isVision,onChange:u=>{const b=s[l].id;a(b,{isVision:u.target.checked})},className:"rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),e.jsx("span",{children:n("settings.supplier.form.visionModel")})]}),i.isVision&&e.jsx(U,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})]})]}),e.jsx("button",{onClick:()=>{const u=s[l].id;x(u)},className:"p-1 text-red-500 hover:text-red-700 rounded flex-shrink-0",children:e.jsx(K,{className:"w-4 h-4"})})]},`model-${l}`))}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsx("input",{type:"text",value:t.id,onChange:i=>h({...t,id:i.target.value}),className:"px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:n("settings.supplier.form.modelId")}),e.jsx("input",{type:"text",value:t.name,onChange:i=>h({...t,name:i.target.value}),className:"px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:n("settings.supplier.form.modelName")}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("label",{className:"flex items-center space-x-1 text-sm text-gray-700 dark:text-gray-300",children:[e.jsx("input",{type:"checkbox",checked:t.isVision,onChange:i=>h({...t,isVision:i.target.checked}),className:"rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),e.jsx("span",{children:n("settings.supplier.form.visionModel")})]}),e.jsxs("button",{onClick:p,disabled:!t.id||!t.name,className:"px-3 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:bg-gray-300 disabled:cursor-not-allowed transition-colors flex items-center space-x-1",children:[e.jsx(R,{className:"w-4 h-4"}),e.jsx("span",{children:n("settings.supplier.form.addModel")})]})]})]})]})]})},we=({environmentVariables:s,envVarInput:t,currentTemplateTokenUrl:p,onAddEnvironmentVariable:a,onUpdateEnvironmentVariable:x,onRemoveEnvironmentVariable:h,onEnvVarInputChange:n,onAuthTokenChange:i})=>{const{t:l}=C("pages"),[u,b]=L.useState(!1),[k,y]=L.useState(""),v=d=>/^[a-zA-Z0-9]{4}\*\*\*[a-zA-Z0-9]{4}$/.test(d)||d==="***";L.useEffect(()=>{const d=s.ANTHROPIC_AUTH_TOKEN||"";v(d)?y(""):y(d)},[s]);const A=d=>{y(d);const f=s.ANTHROPIC_AUTH_TOKEN||"",T=v(f)?d.length>0:d!==f;i&&i(T),x("ANTHROPIC_AUTH_TOKEN",d)},S=()=>{b(!u)};return e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:l("settings.supplier.form.envVars")}),e.jsxs("div",{className:"space-y-3",children:[Object.keys(s).length>0&&e.jsx("div",{className:"space-y-2",children:Object.entries(s).map(([d,f])=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 bg-gray-50 dark:bg-gray-700 rounded",children:[e.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[e.jsxs("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 whitespace-nowrap",children:[d," ="]}),d==="ANTHROPIC_AUTH_TOKEN"?e.jsxs("div",{className:"flex-1 relative flex items-center",children:[e.jsx("input",{type:u?"text":"password",value:k,onChange:N=>A(N.target.value),placeholder:v(f)?"点击输入新的API密钥":l("settings.supplier.form.emptyValue"),className:"flex-1 px-2 py-1 pr-20 text-sm border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-white rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),e.jsxs("div",{className:"absolute right-2 flex items-center space-x-1",children:[v(f)&&e.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 bg-gray-200 dark:bg-gray-600 px-2 py-0.5 rounded",children:"已隐藏"}),e.jsx("button",{type:"button",onClick:S,className:"p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",title:u?"隐藏":"显示",children:u?e.jsx(ge,{className:"w-3 h-3"}):e.jsx(U,{className:"w-3 h-3"})})]}),p&&(v(f)||!f)&&e.jsxs("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"ml-2 inline-flex items-center space-x-1 text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 whitespace-nowrap",children:[e.jsx(he,{className:"w-3 h-3"}),e.jsx("span",{children:l("settings.supplier.form.getApiKey")})]})]}):e.jsx("input",{type:"text",value:f,onChange:N=>x(d,N.target.value),placeholder:l("settings.supplier.form.emptyValue"),className:"flex-1 px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-white rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),e.jsx("button",{onClick:()=>h(d),className:"p-1 text-red-500 hover:text-red-700 rounded flex-shrink-0",children:e.jsx(K,{className:"w-4 h-4"})})]},d))}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx("input",{type:"text",value:t.key,onChange:d=>n({...t,key:d.target.value}),className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:l("settings.supplier.form.varName")}),e.jsx("input",{type:"text",value:t.value,onChange:d=>n({...t,value:d.target.value}),className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:l("settings.supplier.form.varValue")}),e.jsx("button",{onClick:a,disabled:!t.key||!t.value,className:"px-3 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 disabled:bg-gray-300 disabled:cursor-not-allowed transition-colors",children:e.jsx(R,{className:"w-4 h-4"})})]})]})]})},Ce=({editingVersion:s,isCreating:t,isFromTemplate:p,formData:a,envVarInput:x,modelInput:h,currentTemplateTokenUrl:n,isSaving:i,onApplyTemplate:l,onCancel:u,onSave:b,onSelectExecutablePath:k,onFormDataChange:y,onEnvVarInputChange:v,onModelInputChange:A,onAddEnvironmentVariable:S,onUpdateEnvironmentVariable:d,onRemoveEnvironmentVariable:f,onAddModel:N,onUpdateModel:T,onRemoveModel:_,onAuthTokenChange:V})=>{const{t:c}=C("pages");return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg w-full max-w-2xl max-h-[90vh] mx-4 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:c(s?"settings.supplier.form.editTitle":"settings.supplier.form.createTitle")}),s?.isSystem&&e.jsx("span",{className:"px-2 py-1 text-xs bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-300 rounded",children:c("settings.supplier.systemLabel")})]}),e.jsx("button",{onClick:u,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:e.jsx(K,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:e.jsxs("div",{className:"space-y-4",children:[s?.isSystem&&e.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(q,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"}),e.jsx("h4",{className:"text-sm font-medium text-blue-800 dark:text-blue-300",children:"系统版本编辑"})]}),e.jsx("p",{className:"text-xs text-blue-700 dark:text-blue-400 mt-2",children:"系统版本是自动检测的 Claude Code 版本,某些字段(如可执行路径)无法修改,但您可以配置支持的模型。"})]}),t&&!p&&e.jsxs("div",{className:"p-4 bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg",children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-3",children:[e.jsx(be,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"}),e.jsx("h4",{className:"text-sm font-medium text-purple-800 dark:text-purple-300",children:c("settings.supplier.templates.title")})]}),e.jsx("p",{className:"text-xs text-purple-700 dark:text-purple-400 mb-3",children:c("settings.supplier.templates.description")}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:G.map(m=>e.jsx("button",{onClick:()=>l(m),className:`p-3 bg-white dark:bg-gray-800 border border-purple-200 dark:border-purple-700
4
4
  hover:border-purple-400 dark:hover:border-purple-500 rounded-md text-left
@@ -1 +1 @@
1
- import{j as e}from"./data-structures-C0h9Oap1.js";import{r as a}from"./monaco-editor-DHKm5-VF.js";import{s as y,a as f,c as _}from"./index-h5dd40hU.js";import{G as ge,j as K,ac as Q,r as $,U as N,l as me,ad as V,R as X,Y as R,ae as ue,I as he,M as fe,i as be,af as pe}from"./ui-components-CRCmgMKc.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DG431Wop.js";import"./tools-C0JOzoE_.js";const Xe=()=>{const[A,Z]=a.useState("tunely"),[i,S]=a.useState(null),[d,j]=a.useState(null),[m,F]=a.useState("https://agentstudio.woa.com"),[g,z]=a.useState(""),[k,U]=a.useState("https"),[u,P]=a.useState(!1),[w,b]=a.useState(!1),[D,C]=a.useState(!1),[W,H]=a.useState(!1),[E,p]=a.useState(null),[ee,J]=a.useState(!1),[T,x]=a.useState("server"),[o,B]=a.useState(null),[G,q]=a.useState(!1),[ye,te]=a.useState(null),[je,ke]=a.useState(""),[we,ve]=a.useState(""),[Ne,Se]=a.useState(""),[Ce,Ee]=a.useState("4936"),[Te,M]=a.useState(!1),[Ie,$e]=a.useState(!1),[Ae,Fe]=a.useState(!1),[ze,Ue]=a.useState(null),[Pe,De]=a.useState(null),[Be,Le]=a.useState(!1),[Oe,Re]=a.useState(!1),[We,He]=a.useState(null),[Je,L]=a.useState("intro"),[Ge,re]=a.useState(!0);a.useEffect(()=>{ae(),v(),ie()},[]),a.useEffect(()=>{if(!d?.connected)return;const t=setInterval(v,5e3);return()=>clearInterval(t)},[d?.connected]);const ae=async()=>{try{const t=await fetch("/api/tunnel/config",{headers:{Authorization:`Bearer ${localStorage.getItem("jwt")}`}});if(!t.ok)throw new Error("Failed to load configuration");const r=await t.json();S(r),F(r.serverUrl||"https://agentstudio.woa.com"),z(r.tunnelName||""),U(r.protocol||"https"),P(r.enabled||!1),r.token&&r.tunnelName?(x("connected"),r.serverUrl&&Y(r.serverUrl,!1)):x("server")}catch(t){console.error("Error loading config:",t)}},Y=async(t,r=!0)=>{q(!0);try{const n=await fetch("/api/tunnel/server-info",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("jwt")}`},body:JSON.stringify({serverUrl:t})}),h=await n.json();if(!n.ok||!h.success)throw new Error(h.error||`服务器返回错误: HTTP ${n.status}`);const c=h.data,s={name:c.name||"Tunely Server",version:c.version||"1.0.0",domain:{pattern:c.domain?.pattern||"{subdomain}.tunnel",customizable:c.domain?.customizable||"subdomain",suffix:c.domain?.suffix||".tunnel"},websocket:{url:c.websocket?.url||t.replace(/\/+$/,"").replace("https://","wss://").replace("http://","ws://")+"/ws/tunnel"},protocols:c.protocols||["https","http"],instruction:c.instruction};B(s),r&&(y(`已连接到 ${s.name} v${s.version}`),x("domain"))}catch(n){console.error("Error fetching server info:",n),r&&f(n instanceof Error?n.message:"获取服务器信息失败")}finally{q(!1)}},v=a.useCallback(async()=>{try{const t=await fetch("/api/tunnel/status",{headers:{Authorization:`Bearer ${localStorage.getItem("jwt")}`}});if(!t.ok)throw new Error("Failed to load status");const r=await t.json();j(r)}catch(t){console.error("Error loading status:",t)}},[]),se=async()=>{if(!g.trim()){p({available:!1,reason:"请输入隧道名称"});return}H(!0),p(null);try{const r=await(await fetch(`/api/tunnel/check-name?name=${encodeURIComponent(g.trim())}&serverUrl=${encodeURIComponent(m)}`,{headers:{Authorization:`Bearer ${localStorage.getItem("jwt")}`}})).json();p(r)}catch{p({available:!1,reason:"检查失败,请重试"})}finally{H(!1)}},ne=async()=>{if(!g.trim()){f("请输入隧道名称");return}b(!0);try{const t=await fetch("/api/tunnel/create-tunnel",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("jwt")}`},body:JSON.stringify({name:g.trim(),serverUrl:m,autoConnect:u,protocol:k,websocketUrl:o?.websocket?.url,domainSuffix:o?.domain?.suffix})}),r=await t.json();if(!t.ok||!r.success)throw new Error(r.error||"Failed to create tunnel");if(S(r.config),j(r.status),p(null),x("connected"),y(`隧道 "${g}" 创建成功!域名: ${r.domain}`),u){_("正在连接隧道...");let n=0;const h=15,c=setInterval(async()=>{n++,await v(),(await(await fetch("/api/tunnel/status",{headers:{Authorization:`Bearer ${localStorage.getItem("jwt")}`}})).json())?.connected?(y("隧道已连接!"),clearInterval(c)):n>=h&&clearInterval(c)},1e3)}}catch(t){f(t instanceof Error?t.message:"Failed to create tunnel")}finally{b(!1)}},oe=async()=>{C(!0);try{const t=await fetch("/api/tunnel/connect",{method:"POST",headers:{Authorization:`Bearer ${localStorage.getItem("jwt")}`}});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to connect")}const r=await t.json();j(r.status),_("隧道连接中..."),setTimeout(v,2e3)}catch(t){f(t instanceof Error?t.message:"Failed to connect")}finally{C(!1)}},le=async()=>{C(!0);try{const t=await fetch("/api/tunnel/disconnect",{method:"POST",headers:{Authorization:`Bearer ${localStorage.getItem("jwt")}`}});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to disconnect")}const r=await t.json();j(r.status),y("已断开隧道连接")}catch(t){f(t instanceof Error?t.message:"Failed to disconnect")}finally{C(!1)}},I=()=>{if(!i?.tunnelName)return null;const t=i.domainSuffix||o?.domain?.suffix||".agentstudio.woa.com";return`${i.tunnelName}${t}`},ce=()=>{const t=I();t&&(navigator.clipboard.writeText(`${i?.protocol||"https"}://${t}`),J(!0),setTimeout(()=>J(!1),2e3))},ie=async()=>{M(!0);try{const t=await fetch("/api/cloudflare-tunnel/config",{headers:{Authorization:`Bearer ${localStorage.getItem("jwt")}`}});if(!t.ok)throw new Error("Failed to load Cloudflare configuration");const r=await t.json();te(r),r.activeTunnel?(L("done"),re(!1)):r.hasApiToken&&r.hasAccountId?L("create"):L("credentials")}catch(t){console.error("Error loading Cloudflare config:",t)}finally{M(!1)}},de=()=>{const t=()=>e.jsx(e.Fragment,{children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2 mb-4",children:[e.jsx($,{className:"w-5 h-5"}),"配置隧道服务"]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"隧道服务器地址"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:m,onChange:s=>F(s.target.value),placeholder:"https://agentstudio.woa.com",className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),e.jsxs("button",{onClick:()=>Y(m),disabled:G||!m.trim(),className:"flex items-center gap-2 px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg disabled:opacity-50",children:[G?e.jsx(N,{className:"w-4 h-4 animate-spin"}):e.jsx(me,{className:"w-4 h-4"}),"连接"]})]}),e.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:'输入隧道服务的地址,点击"连接"获取服务信息'})]})})]})}),r=()=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx($,{className:"w-5 h-5"}),"配置隧道域名"]}),e.jsx("button",{onClick:()=>{B(null),x("server")},className:"text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300",children:"更换服务器"})]}),o&&e.jsx("div",{className:"mb-4 p-3 rounded-lg bg-blue-50 border border-blue-200 dark:bg-blue-900/20 dark:border-blue-800",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-blue-700 dark:text-blue-300",children:[e.jsx(V,{className:"w-4 h-4"}),e.jsxs("span",{children:["已连接到 ",e.jsx("strong",{children:o.name})," v",o.version]})]})}),o?.instruction&&e.jsx("div",{className:"mb-4 p-4 rounded-lg bg-blue-50 border border-blue-200 dark:bg-blue-900/20 dark:border-blue-800",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(X,{className:"w-5 h-5 text-blue-600 dark:text-blue-400 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-blue-800 dark:text-blue-200",children:[e.jsx("p",{className:"font-medium mb-1",children:"服务器说明"}),e.jsx("p",{className:"whitespace-pre-wrap",children:o.instruction})]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"隧道域名"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 flex items-center",children:[e.jsx("select",{value:k,onChange:s=>U(s.target.value),className:"px-3 py-2 bg-gray-100 dark:bg-gray-700 border border-r-0 border-gray-300 dark:border-gray-600 rounded-l-lg text-gray-700 dark:text-gray-300 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent cursor-pointer",children:(o?.protocols||["https","http"]).map(s=>e.jsxs("option",{value:s,children:[s,"://"]},s))}),e.jsx("input",{type:"text",value:g,onChange:s=>{z(s.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),p(null)},placeholder:"my-agent",className:"flex-1 px-3 py-2 border-y border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),e.jsx("span",{className:"px-3 py-2 bg-gray-100 dark:bg-gray-700 border border-l-0 border-gray-300 dark:border-gray-600 rounded-r-lg text-gray-500 dark:text-gray-400 text-sm whitespace-nowrap",children:o?.domain.suffix||".agentstudio.woa.com"})]}),e.jsxs("button",{onClick:se,disabled:W||!g.trim(),className:"flex items-center gap-2 px-4 py-2 bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 rounded-lg disabled:opacity-50 transition-colors",children:[W?e.jsx(N,{className:"w-4 h-4 animate-spin"}):e.jsx(R,{className:"w-4 h-4"}),"检测"]})]}),E&&e.jsx("div",{className:`mt-2 text-sm flex items-center gap-1 ${E.available?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:E.available?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-4 h-4"}),e.jsxs("span",{children:["名称可用!完整域名: ",k,"://",g,o?.domain.suffix]})]}):e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"w-4 h-4"}),e.jsx("span",{children:E.reason||"名称不可用"})]})})]}),e.jsxs("div",{className:"flex items-center justify-between py-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"启动时自动连接"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Agent Studio 启动时自动建立隧道连接"})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:u,onChange:s=>P(s.target.checked),className:"sr-only peer"}),e.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"})]})]}),e.jsx("div",{className:"pt-4 border-t border-gray-200 dark:border-gray-700",children:e.jsxs("button",{onClick:ne,disabled:w||!g.trim(),className:"flex items-center gap-2 px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg disabled:opacity-50",children:[w?e.jsx(N,{className:"w-4 h-4 animate-spin"}):e.jsx(R,{className:"w-4 h-4"}),"创建隧道"]})})]})]}),n=async()=>{if(window.confirm("确定要删除隧道配置吗?删除后需要重新配置隧道。")){b(!0);try{const s=await fetch("/api/tunnel/config",{method:"DELETE",headers:{Authorization:`Bearer ${localStorage.getItem("jwt")}`}});if(!s.ok){const O=await s.json();throw new Error(O.error||"Failed to delete tunnel")}const l=await s.json();S(l.config),j(l.status),z(""),B(null),x("server"),y("隧道配置已删除")}catch(s){f(s instanceof Error?s.message:"Failed to delete tunnel")}finally{b(!1)}}},h=()=>e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`rounded-lg border p-4 ${d?.connected?"bg-green-50 border-green-200 dark:bg-green-900/20 dark:border-green-800":"bg-gray-50 border-gray-200 dark:bg-gray-800/50 dark:border-gray-700"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[d?.connected?e.jsx(Q,{className:"w-6 h-6 text-green-500 flex-shrink-0"}):e.jsx(ue,{className:"w-6 h-6 text-gray-400 flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:d?.connected?"已连接":"未连接"}),d?.connected&&I()&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:[i?.protocol||"https","://",I()]}),e.jsx("button",{onClick:ce,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",title:"复制",children:ee?e.jsx(R,{className:"w-4 h-4 text-green-500"}):e.jsx(he,{className:"w-4 h-4"})}),e.jsx("a",{href:`${i?.protocol||"https"}://${I()}`,target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",title:"在新窗口打开",children:e.jsx(fe,{className:"w-4 h-4"})})]}),d.connectedAt&&e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["连接时间: ",new Date(d.connectedAt).toLocaleString()]})]}),d?.lastError&&e.jsx("div",{className:"text-sm text-red-500",children:d.lastError})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx("button",{onClick:v,className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700",title:"刷新状态",children:e.jsx(N,{className:"w-4 h-4"})}),d?.connected?e.jsxs("button",{onClick:le,disabled:D,className:"flex items-center gap-2 px-4 py-2 bg-red-500 hover:bg-red-600 text-white rounded-lg disabled:opacity-50",children:[e.jsx(be,{className:"w-4 h-4"}),"断开"]}):e.jsxs("button",{onClick:oe,disabled:D,className:"flex items-center gap-2 px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg disabled:opacity-50",children:[e.jsx(pe,{className:"w-4 h-4"}),D?"连接中...":"连接"]})]})]})}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx($,{className:"w-5 h-5"}),"隧道配置"]}),e.jsx("button",{onClick:()=>{x("edit")},className:"text-sm text-blue-500 hover:text-blue-600",children:"编辑配置"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"隧道名称"}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:i?.tunnelName})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"协议"}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:i?.protocol?.toUpperCase()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"服务器"}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:i?.serverUrl})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"自动连接"}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:i?.enabled?"是":"否"})]})]}),o?.instruction&&e.jsx("div",{className:"mt-4 p-3 rounded-lg bg-blue-50 border border-blue-200 dark:bg-blue-900/20 dark:border-blue-800",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(X,{className:"w-4 h-4 text-blue-600 dark:text-blue-400 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-xs text-blue-800 dark:text-blue-200",children:[e.jsx("p",{className:"font-medium mb-1",children:"服务器说明"}),e.jsx("p",{className:"whitespace-pre-wrap",children:o.instruction})]})]})}),e.jsx("div",{className:"mt-6 pt-4 border-t border-gray-200 dark:border-gray-700",children:e.jsx("button",{onClick:n,disabled:w,className:"text-sm text-red-500 hover:text-red-600 dark:text-red-400 dark:hover:text-red-300",children:"删除隧道配置"})})]})]}),c=()=>{const s=async()=>{b(!0);try{const l=await fetch("/api/tunnel/config",{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("jwt")}`},body:JSON.stringify({enabled:u,serverUrl:m,protocol:k})});if(!l.ok){const xe=await l.json();throw new Error(xe.error||"Failed to save config")}const O=await l.json();S(O.config),y("配置已保存"),x("connected")}catch(l){f(l instanceof Error?l.message:"Failed to save config")}finally{b(!1)}};return e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx($,{className:"w-5 h-5"}),"编辑隧道配置"]}),e.jsx("button",{onClick:()=>x("connected"),className:"text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",children:"取消"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:["隧道名称 ",e.jsx("span",{className:"text-gray-400",children:"(不可修改)"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:i?.tunnelName||"",disabled:!0,className:"flex-1 px-3 py-2 border border-gray-200 dark:border-gray-600 rounded-lg bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400 cursor-not-allowed"}),e.jsx("span",{className:"px-3 py-2 bg-gray-100 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-500 dark:text-gray-400 text-sm",children:i?.domainSuffix||o?.domain?.suffix||".agentstudio.woa.com"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"服务器地址"}),e.jsx("input",{type:"text",value:m,onChange:l=>F(l.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"https://agentstudio.woa.com"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"访问协议"}),e.jsxs("select",{value:k,onChange:l=>U(l.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[e.jsx("option",{value:"https",children:"HTTPS"}),e.jsx("option",{value:"http",children:"HTTP"})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"自动连接"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"启动时自动连接隧道"})]}),e.jsx("button",{onClick:()=>P(!u),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${u?"bg-blue-500":"bg-gray-300 dark:bg-gray-600"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${u?"translate-x-6":"translate-x-1"}`})})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx("button",{onClick:()=>x("connected"),className:"flex-1 px-4 py-2 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700",children:"取消"}),e.jsx("button",{onClick:s,disabled:w,className:"flex-1 px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg disabled:opacity-50 flex items-center justify-center gap-2",children:w?e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"w-4 h-4 animate-spin"}),"保存中..."]}):"保存配置"})]})]})]})};return e.jsxs("div",{className:"space-y-6",children:[T==="server"&&t(),T==="domain"&&r(),T==="connected"&&h(),T==="edit"&&c()]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(ge,{className:"w-7 h-7"}),"隧道接入"]}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"通过隧道让外部网络可以访问本地 Agent Studio"})]}),e.jsx("div",{className:"bg-amber-50 dark:bg-amber-900/20 rounded-lg border border-amber-200 dark:border-amber-800 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(K,{className:"w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-amber-700 dark:text-amber-300",children:[e.jsx("p",{className:"font-medium mb-1",children:"安全提示"}),e.jsx("p",{children:"隧道接入会将本地 Agent Studio 服务暴露到公网,存在一定的安全风险。请确保您了解相关风险后再进行配置。"})]})]})}),e.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700",children:e.jsxs("nav",{className:"-mb-px flex space-x-8",children:[e.jsxs("button",{onClick:()=>Z("tunely"),className:`py-4 px-1 border-b-2 font-medium text-sm flex items-center gap-2 ${A==="tunely"?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:[e.jsx(Q,{className:"w-4 h-4"}),"Tunely (WebSocket)"]}),!1]})}),A==="tunely"&&de(),A==="cloudflare"&&!1]})};export{Xe as WebSocketTunnelPage,Xe as default};
1
+ import{j as e}from"./data-structures-C0h9Oap1.js";import{r as a}from"./monaco-editor-DHKm5-VF.js";import{s as y,a as f,c as _}from"./index-D9bAK8SN.js";import{G as ge,j as K,ac as Q,r as $,U as N,l as me,ad as V,R as X,Y as R,ae as ue,I as he,M as fe,i as be,af as pe}from"./ui-components-CRCmgMKc.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DG431Wop.js";import"./tools-C0JOzoE_.js";const Xe=()=>{const[A,Z]=a.useState("tunely"),[i,S]=a.useState(null),[d,j]=a.useState(null),[m,F]=a.useState("https://agentstudio.woa.com"),[g,z]=a.useState(""),[k,U]=a.useState("https"),[u,P]=a.useState(!1),[w,b]=a.useState(!1),[D,C]=a.useState(!1),[W,H]=a.useState(!1),[E,p]=a.useState(null),[ee,J]=a.useState(!1),[T,x]=a.useState("server"),[o,B]=a.useState(null),[G,q]=a.useState(!1),[ye,te]=a.useState(null),[je,ke]=a.useState(""),[we,ve]=a.useState(""),[Ne,Se]=a.useState(""),[Ce,Ee]=a.useState("4936"),[Te,M]=a.useState(!1),[Ie,$e]=a.useState(!1),[Ae,Fe]=a.useState(!1),[ze,Ue]=a.useState(null),[Pe,De]=a.useState(null),[Be,Le]=a.useState(!1),[Oe,Re]=a.useState(!1),[We,He]=a.useState(null),[Je,L]=a.useState("intro"),[Ge,re]=a.useState(!0);a.useEffect(()=>{ae(),v(),ie()},[]),a.useEffect(()=>{if(!d?.connected)return;const t=setInterval(v,5e3);return()=>clearInterval(t)},[d?.connected]);const ae=async()=>{try{const t=await fetch("/api/tunnel/config",{headers:{Authorization:`Bearer ${localStorage.getItem("jwt")}`}});if(!t.ok)throw new Error("Failed to load configuration");const r=await t.json();S(r),F(r.serverUrl||"https://agentstudio.woa.com"),z(r.tunnelName||""),U(r.protocol||"https"),P(r.enabled||!1),r.token&&r.tunnelName?(x("connected"),r.serverUrl&&Y(r.serverUrl,!1)):x("server")}catch(t){console.error("Error loading config:",t)}},Y=async(t,r=!0)=>{q(!0);try{const n=await fetch("/api/tunnel/server-info",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("jwt")}`},body:JSON.stringify({serverUrl:t})}),h=await n.json();if(!n.ok||!h.success)throw new Error(h.error||`服务器返回错误: HTTP ${n.status}`);const c=h.data,s={name:c.name||"Tunely Server",version:c.version||"1.0.0",domain:{pattern:c.domain?.pattern||"{subdomain}.tunnel",customizable:c.domain?.customizable||"subdomain",suffix:c.domain?.suffix||".tunnel"},websocket:{url:c.websocket?.url||t.replace(/\/+$/,"").replace("https://","wss://").replace("http://","ws://")+"/ws/tunnel"},protocols:c.protocols||["https","http"],instruction:c.instruction};B(s),r&&(y(`已连接到 ${s.name} v${s.version}`),x("domain"))}catch(n){console.error("Error fetching server info:",n),r&&f(n instanceof Error?n.message:"获取服务器信息失败")}finally{q(!1)}},v=a.useCallback(async()=>{try{const t=await fetch("/api/tunnel/status",{headers:{Authorization:`Bearer ${localStorage.getItem("jwt")}`}});if(!t.ok)throw new Error("Failed to load status");const r=await t.json();j(r)}catch(t){console.error("Error loading status:",t)}},[]),se=async()=>{if(!g.trim()){p({available:!1,reason:"请输入隧道名称"});return}H(!0),p(null);try{const r=await(await fetch(`/api/tunnel/check-name?name=${encodeURIComponent(g.trim())}&serverUrl=${encodeURIComponent(m)}`,{headers:{Authorization:`Bearer ${localStorage.getItem("jwt")}`}})).json();p(r)}catch{p({available:!1,reason:"检查失败,请重试"})}finally{H(!1)}},ne=async()=>{if(!g.trim()){f("请输入隧道名称");return}b(!0);try{const t=await fetch("/api/tunnel/create-tunnel",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("jwt")}`},body:JSON.stringify({name:g.trim(),serverUrl:m,autoConnect:u,protocol:k,websocketUrl:o?.websocket?.url,domainSuffix:o?.domain?.suffix})}),r=await t.json();if(!t.ok||!r.success)throw new Error(r.error||"Failed to create tunnel");if(S(r.config),j(r.status),p(null),x("connected"),y(`隧道 "${g}" 创建成功!域名: ${r.domain}`),u){_("正在连接隧道...");let n=0;const h=15,c=setInterval(async()=>{n++,await v(),(await(await fetch("/api/tunnel/status",{headers:{Authorization:`Bearer ${localStorage.getItem("jwt")}`}})).json())?.connected?(y("隧道已连接!"),clearInterval(c)):n>=h&&clearInterval(c)},1e3)}}catch(t){f(t instanceof Error?t.message:"Failed to create tunnel")}finally{b(!1)}},oe=async()=>{C(!0);try{const t=await fetch("/api/tunnel/connect",{method:"POST",headers:{Authorization:`Bearer ${localStorage.getItem("jwt")}`}});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to connect")}const r=await t.json();j(r.status),_("隧道连接中..."),setTimeout(v,2e3)}catch(t){f(t instanceof Error?t.message:"Failed to connect")}finally{C(!1)}},le=async()=>{C(!0);try{const t=await fetch("/api/tunnel/disconnect",{method:"POST",headers:{Authorization:`Bearer ${localStorage.getItem("jwt")}`}});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to disconnect")}const r=await t.json();j(r.status),y("已断开隧道连接")}catch(t){f(t instanceof Error?t.message:"Failed to disconnect")}finally{C(!1)}},I=()=>{if(!i?.tunnelName)return null;const t=i.domainSuffix||o?.domain?.suffix||".agentstudio.woa.com";return`${i.tunnelName}${t}`},ce=()=>{const t=I();t&&(navigator.clipboard.writeText(`${i?.protocol||"https"}://${t}`),J(!0),setTimeout(()=>J(!1),2e3))},ie=async()=>{M(!0);try{const t=await fetch("/api/cloudflare-tunnel/config",{headers:{Authorization:`Bearer ${localStorage.getItem("jwt")}`}});if(!t.ok)throw new Error("Failed to load Cloudflare configuration");const r=await t.json();te(r),r.activeTunnel?(L("done"),re(!1)):r.hasApiToken&&r.hasAccountId?L("create"):L("credentials")}catch(t){console.error("Error loading Cloudflare config:",t)}finally{M(!1)}},de=()=>{const t=()=>e.jsx(e.Fragment,{children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2 mb-4",children:[e.jsx($,{className:"w-5 h-5"}),"配置隧道服务"]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"隧道服务器地址"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:m,onChange:s=>F(s.target.value),placeholder:"https://agentstudio.woa.com",className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),e.jsxs("button",{onClick:()=>Y(m),disabled:G||!m.trim(),className:"flex items-center gap-2 px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg disabled:opacity-50",children:[G?e.jsx(N,{className:"w-4 h-4 animate-spin"}):e.jsx(me,{className:"w-4 h-4"}),"连接"]})]}),e.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:'输入隧道服务的地址,点击"连接"获取服务信息'})]})})]})}),r=()=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx($,{className:"w-5 h-5"}),"配置隧道域名"]}),e.jsx("button",{onClick:()=>{B(null),x("server")},className:"text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300",children:"更换服务器"})]}),o&&e.jsx("div",{className:"mb-4 p-3 rounded-lg bg-blue-50 border border-blue-200 dark:bg-blue-900/20 dark:border-blue-800",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-blue-700 dark:text-blue-300",children:[e.jsx(V,{className:"w-4 h-4"}),e.jsxs("span",{children:["已连接到 ",e.jsx("strong",{children:o.name})," v",o.version]})]})}),o?.instruction&&e.jsx("div",{className:"mb-4 p-4 rounded-lg bg-blue-50 border border-blue-200 dark:bg-blue-900/20 dark:border-blue-800",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(X,{className:"w-5 h-5 text-blue-600 dark:text-blue-400 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-blue-800 dark:text-blue-200",children:[e.jsx("p",{className:"font-medium mb-1",children:"服务器说明"}),e.jsx("p",{className:"whitespace-pre-wrap",children:o.instruction})]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"隧道域名"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 flex items-center",children:[e.jsx("select",{value:k,onChange:s=>U(s.target.value),className:"px-3 py-2 bg-gray-100 dark:bg-gray-700 border border-r-0 border-gray-300 dark:border-gray-600 rounded-l-lg text-gray-700 dark:text-gray-300 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent cursor-pointer",children:(o?.protocols||["https","http"]).map(s=>e.jsxs("option",{value:s,children:[s,"://"]},s))}),e.jsx("input",{type:"text",value:g,onChange:s=>{z(s.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),p(null)},placeholder:"my-agent",className:"flex-1 px-3 py-2 border-y border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),e.jsx("span",{className:"px-3 py-2 bg-gray-100 dark:bg-gray-700 border border-l-0 border-gray-300 dark:border-gray-600 rounded-r-lg text-gray-500 dark:text-gray-400 text-sm whitespace-nowrap",children:o?.domain.suffix||".agentstudio.woa.com"})]}),e.jsxs("button",{onClick:se,disabled:W||!g.trim(),className:"flex items-center gap-2 px-4 py-2 bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 rounded-lg disabled:opacity-50 transition-colors",children:[W?e.jsx(N,{className:"w-4 h-4 animate-spin"}):e.jsx(R,{className:"w-4 h-4"}),"检测"]})]}),E&&e.jsx("div",{className:`mt-2 text-sm flex items-center gap-1 ${E.available?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:E.available?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-4 h-4"}),e.jsxs("span",{children:["名称可用!完整域名: ",k,"://",g,o?.domain.suffix]})]}):e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"w-4 h-4"}),e.jsx("span",{children:E.reason||"名称不可用"})]})})]}),e.jsxs("div",{className:"flex items-center justify-between py-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"启动时自动连接"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Agent Studio 启动时自动建立隧道连接"})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:u,onChange:s=>P(s.target.checked),className:"sr-only peer"}),e.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"})]})]}),e.jsx("div",{className:"pt-4 border-t border-gray-200 dark:border-gray-700",children:e.jsxs("button",{onClick:ne,disabled:w||!g.trim(),className:"flex items-center gap-2 px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg disabled:opacity-50",children:[w?e.jsx(N,{className:"w-4 h-4 animate-spin"}):e.jsx(R,{className:"w-4 h-4"}),"创建隧道"]})})]})]}),n=async()=>{if(window.confirm("确定要删除隧道配置吗?删除后需要重新配置隧道。")){b(!0);try{const s=await fetch("/api/tunnel/config",{method:"DELETE",headers:{Authorization:`Bearer ${localStorage.getItem("jwt")}`}});if(!s.ok){const O=await s.json();throw new Error(O.error||"Failed to delete tunnel")}const l=await s.json();S(l.config),j(l.status),z(""),B(null),x("server"),y("隧道配置已删除")}catch(s){f(s instanceof Error?s.message:"Failed to delete tunnel")}finally{b(!1)}}},h=()=>e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`rounded-lg border p-4 ${d?.connected?"bg-green-50 border-green-200 dark:bg-green-900/20 dark:border-green-800":"bg-gray-50 border-gray-200 dark:bg-gray-800/50 dark:border-gray-700"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[d?.connected?e.jsx(Q,{className:"w-6 h-6 text-green-500 flex-shrink-0"}):e.jsx(ue,{className:"w-6 h-6 text-gray-400 flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:d?.connected?"已连接":"未连接"}),d?.connected&&I()&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:[i?.protocol||"https","://",I()]}),e.jsx("button",{onClick:ce,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",title:"复制",children:ee?e.jsx(R,{className:"w-4 h-4 text-green-500"}):e.jsx(he,{className:"w-4 h-4"})}),e.jsx("a",{href:`${i?.protocol||"https"}://${I()}`,target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",title:"在新窗口打开",children:e.jsx(fe,{className:"w-4 h-4"})})]}),d.connectedAt&&e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["连接时间: ",new Date(d.connectedAt).toLocaleString()]})]}),d?.lastError&&e.jsx("div",{className:"text-sm text-red-500",children:d.lastError})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx("button",{onClick:v,className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700",title:"刷新状态",children:e.jsx(N,{className:"w-4 h-4"})}),d?.connected?e.jsxs("button",{onClick:le,disabled:D,className:"flex items-center gap-2 px-4 py-2 bg-red-500 hover:bg-red-600 text-white rounded-lg disabled:opacity-50",children:[e.jsx(be,{className:"w-4 h-4"}),"断开"]}):e.jsxs("button",{onClick:oe,disabled:D,className:"flex items-center gap-2 px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg disabled:opacity-50",children:[e.jsx(pe,{className:"w-4 h-4"}),D?"连接中...":"连接"]})]})]})}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx($,{className:"w-5 h-5"}),"隧道配置"]}),e.jsx("button",{onClick:()=>{x("edit")},className:"text-sm text-blue-500 hover:text-blue-600",children:"编辑配置"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"隧道名称"}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:i?.tunnelName})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"协议"}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:i?.protocol?.toUpperCase()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"服务器"}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:i?.serverUrl})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"自动连接"}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:i?.enabled?"是":"否"})]})]}),o?.instruction&&e.jsx("div",{className:"mt-4 p-3 rounded-lg bg-blue-50 border border-blue-200 dark:bg-blue-900/20 dark:border-blue-800",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(X,{className:"w-4 h-4 text-blue-600 dark:text-blue-400 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-xs text-blue-800 dark:text-blue-200",children:[e.jsx("p",{className:"font-medium mb-1",children:"服务器说明"}),e.jsx("p",{className:"whitespace-pre-wrap",children:o.instruction})]})]})}),e.jsx("div",{className:"mt-6 pt-4 border-t border-gray-200 dark:border-gray-700",children:e.jsx("button",{onClick:n,disabled:w,className:"text-sm text-red-500 hover:text-red-600 dark:text-red-400 dark:hover:text-red-300",children:"删除隧道配置"})})]})]}),c=()=>{const s=async()=>{b(!0);try{const l=await fetch("/api/tunnel/config",{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("jwt")}`},body:JSON.stringify({enabled:u,serverUrl:m,protocol:k})});if(!l.ok){const xe=await l.json();throw new Error(xe.error||"Failed to save config")}const O=await l.json();S(O.config),y("配置已保存"),x("connected")}catch(l){f(l instanceof Error?l.message:"Failed to save config")}finally{b(!1)}};return e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx($,{className:"w-5 h-5"}),"编辑隧道配置"]}),e.jsx("button",{onClick:()=>x("connected"),className:"text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",children:"取消"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:["隧道名称 ",e.jsx("span",{className:"text-gray-400",children:"(不可修改)"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:i?.tunnelName||"",disabled:!0,className:"flex-1 px-3 py-2 border border-gray-200 dark:border-gray-600 rounded-lg bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400 cursor-not-allowed"}),e.jsx("span",{className:"px-3 py-2 bg-gray-100 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-500 dark:text-gray-400 text-sm",children:i?.domainSuffix||o?.domain?.suffix||".agentstudio.woa.com"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"服务器地址"}),e.jsx("input",{type:"text",value:m,onChange:l=>F(l.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"https://agentstudio.woa.com"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"访问协议"}),e.jsxs("select",{value:k,onChange:l=>U(l.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[e.jsx("option",{value:"https",children:"HTTPS"}),e.jsx("option",{value:"http",children:"HTTP"})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"自动连接"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"启动时自动连接隧道"})]}),e.jsx("button",{onClick:()=>P(!u),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${u?"bg-blue-500":"bg-gray-300 dark:bg-gray-600"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${u?"translate-x-6":"translate-x-1"}`})})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx("button",{onClick:()=>x("connected"),className:"flex-1 px-4 py-2 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700",children:"取消"}),e.jsx("button",{onClick:s,disabled:w,className:"flex-1 px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg disabled:opacity-50 flex items-center justify-center gap-2",children:w?e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"w-4 h-4 animate-spin"}),"保存中..."]}):"保存配置"})]})]})]})};return e.jsxs("div",{className:"space-y-6",children:[T==="server"&&t(),T==="domain"&&r(),T==="connected"&&h(),T==="edit"&&c()]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(ge,{className:"w-7 h-7"}),"隧道接入"]}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"通过隧道让外部网络可以访问本地 Agent Studio"})]}),e.jsx("div",{className:"bg-amber-50 dark:bg-amber-900/20 rounded-lg border border-amber-200 dark:border-amber-800 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(K,{className:"w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-amber-700 dark:text-amber-300",children:[e.jsx("p",{className:"font-medium mb-1",children:"安全提示"}),e.jsx("p",{children:"隧道接入会将本地 Agent Studio 服务暴露到公网,存在一定的安全风险。请确保您了解相关风险后再进行配置。"})]})]})}),e.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700",children:e.jsxs("nav",{className:"-mb-px flex space-x-8",children:[e.jsxs("button",{onClick:()=>Z("tunely"),className:`py-4 px-1 border-b-2 font-medium text-sm flex items-center gap-2 ${A==="tunely"?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:[e.jsx(Q,{className:"w-4 h-4"}),"Tunely (WebSocket)"]}),!1]})}),A==="tunely"&&de(),A==="cloudflare"&&!1]})};export{Xe as WebSocketTunnelPage,Xe as default};
@@ -1 +1 @@
1
- import{e as x,c as O,g as m,k as P,h as p,j as w,l as c,m as A,n as I,t as N,o as E}from"./_baseUniq-OZ7OoecG.js";import{aQ as g,ar as F,aR as M,aS as T,aT as _,aU as l,aV as $,aW as B,aX as S,aY as y}from"./ChatPage-Boj_N_ec.js";var R=/\s/;function G(n){for(var r=n.length;r--&&R.test(n.charAt(r)););return r}var H=/^\s+/;function L(n){return n&&n.slice(0,G(n)+1).replace(H,"")}var o=NaN,W=/^[-+]0x[0-9a-f]+$/i,X=/^0b[01]+$/i,Y=/^0o[0-7]+$/i,q=parseInt;function z(n){if(typeof n=="number")return n;if(x(n))return o;if(g(n)){var r=typeof n.valueOf=="function"?n.valueOf():n;n=g(r)?r+"":r}if(typeof n!="string")return n===0?n:+n;n=L(n);var t=X.test(n);return t||Y.test(n)?q(n.slice(2),t?2:8):W.test(n)?o:+n}var v=1/0,C=17976931348623157e292;function K(n){if(!n)return n===0?n:0;if(n=z(n),n===v||n===-v){var r=n<0?-1:1;return r*C}return n===n?n:0}function Q(n){var r=K(n),t=r%1;return r===r?t?r-t:r:0}function fn(n){var r=n==null?0:n.length;return r?O(n):[]}var b=Object.prototype,U=b.hasOwnProperty,dn=F(function(n,r){n=Object(n);var t=-1,i=r.length,a=i>2?r[2]:void 0;for(a&&M(r[0],r[1],a)&&(i=1);++t<i;)for(var f=r[t],e=T(f),s=-1,d=e.length;++s<d;){var u=e[s],h=n[u];(h===void 0||_(h,b[u])&&!U.call(n,u))&&(n[u]=f[u])}return n});function un(n){var r=n==null?0:n.length;return r?n[r-1]:void 0}function D(n){return function(r,t,i){var a=Object(r);if(!l(r)){var f=m(t);r=P(r),t=function(s){return f(a[s],s,a)}}var e=n(r,t,i);return e>-1?a[f?r[e]:e]:void 0}}var J=Math.max;function Z(n,r,t){var i=n==null?0:n.length;if(!i)return-1;var a=t==null?0:Q(t);return a<0&&(a=J(i+a,0)),p(n,m(r),a)}var hn=D(Z);function V(n,r){var t=-1,i=l(n)?Array(n.length):[];return w(n,function(a,f,e){i[++t]=r(a,f,e)}),i}function gn(n,r){var t=$(n)?c:V;return t(n,m(r))}var j=Object.prototype,k=j.hasOwnProperty;function nn(n,r){return n!=null&&k.call(n,r)}function mn(n,r){return n!=null&&A(n,r,nn)}function rn(n,r){return n<r}function tn(n,r,t){for(var i=-1,a=n.length;++i<a;){var f=n[i],e=r(f);if(e!=null&&(s===void 0?e===e&&!x(e):t(e,s)))var s=e,d=f}return d}function on(n){return n&&n.length?tn(n,B,rn):void 0}function an(n,r,t,i){if(!g(n))return n;r=I(r,n);for(var a=-1,f=r.length,e=f-1,s=n;s!=null&&++a<f;){var d=N(r[a]),u=t;if(d==="__proto__"||d==="constructor"||d==="prototype")return n;if(a!=e){var h=s[d];u=void 0,u===void 0&&(u=g(h)?h:S(r[a+1])?[]:{})}y(s,d,u),s=s[d]}return n}function vn(n,r,t){for(var i=-1,a=r.length,f={};++i<a;){var e=r[i],s=E(n,e);t(s,e)&&an(f,I(e,n),s)}return f}export{rn as a,tn as b,V as c,vn as d,on as e,fn as f,hn as g,mn as h,dn as i,Q as j,un as l,gn as m,K as t};
1
+ import{e as x,c as O,g as m,k as P,h as p,j as w,l as c,m as A,n as I,t as N,o as E}from"./_baseUniq-DP62Yq8R.js";import{aQ as g,ar as F,aR as M,aS as T,aT as _,aU as l,aV as $,aW as B,aX as S,aY as y}from"./ChatPage-BAslLt2l.js";var R=/\s/;function G(n){for(var r=n.length;r--&&R.test(n.charAt(r)););return r}var H=/^\s+/;function L(n){return n&&n.slice(0,G(n)+1).replace(H,"")}var o=NaN,W=/^[-+]0x[0-9a-f]+$/i,X=/^0b[01]+$/i,Y=/^0o[0-7]+$/i,q=parseInt;function z(n){if(typeof n=="number")return n;if(x(n))return o;if(g(n)){var r=typeof n.valueOf=="function"?n.valueOf():n;n=g(r)?r+"":r}if(typeof n!="string")return n===0?n:+n;n=L(n);var t=X.test(n);return t||Y.test(n)?q(n.slice(2),t?2:8):W.test(n)?o:+n}var v=1/0,C=17976931348623157e292;function K(n){if(!n)return n===0?n:0;if(n=z(n),n===v||n===-v){var r=n<0?-1:1;return r*C}return n===n?n:0}function Q(n){var r=K(n),t=r%1;return r===r?t?r-t:r:0}function fn(n){var r=n==null?0:n.length;return r?O(n):[]}var b=Object.prototype,U=b.hasOwnProperty,dn=F(function(n,r){n=Object(n);var t=-1,i=r.length,a=i>2?r[2]:void 0;for(a&&M(r[0],r[1],a)&&(i=1);++t<i;)for(var f=r[t],e=T(f),s=-1,d=e.length;++s<d;){var u=e[s],h=n[u];(h===void 0||_(h,b[u])&&!U.call(n,u))&&(n[u]=f[u])}return n});function un(n){var r=n==null?0:n.length;return r?n[r-1]:void 0}function D(n){return function(r,t,i){var a=Object(r);if(!l(r)){var f=m(t);r=P(r),t=function(s){return f(a[s],s,a)}}var e=n(r,t,i);return e>-1?a[f?r[e]:e]:void 0}}var J=Math.max;function Z(n,r,t){var i=n==null?0:n.length;if(!i)return-1;var a=t==null?0:Q(t);return a<0&&(a=J(i+a,0)),p(n,m(r),a)}var hn=D(Z);function V(n,r){var t=-1,i=l(n)?Array(n.length):[];return w(n,function(a,f,e){i[++t]=r(a,f,e)}),i}function gn(n,r){var t=$(n)?c:V;return t(n,m(r))}var j=Object.prototype,k=j.hasOwnProperty;function nn(n,r){return n!=null&&k.call(n,r)}function mn(n,r){return n!=null&&A(n,r,nn)}function rn(n,r){return n<r}function tn(n,r,t){for(var i=-1,a=n.length;++i<a;){var f=n[i],e=r(f);if(e!=null&&(s===void 0?e===e&&!x(e):t(e,s)))var s=e,d=f}return d}function on(n){return n&&n.length?tn(n,B,rn):void 0}function an(n,r,t,i){if(!g(n))return n;r=I(r,n);for(var a=-1,f=r.length,e=f-1,s=n;s!=null&&++a<f;){var d=N(r[a]),u=t;if(d==="__proto__"||d==="constructor"||d==="prototype")return n;if(a!=e){var h=s[d];u=void 0,u===void 0&&(u=g(h)?h:S(r[a+1])?[]:{})}y(s,d,u),s=s[d]}return n}function vn(n,r,t){for(var i=-1,a=r.length,f={};++i<a;){var e=r[i],s=E(n,e);t(s,e)&&an(f,I(e,n),s)}return f}export{rn as a,tn as b,V as c,vn as d,on as e,fn as f,hn as g,mn as h,dn as i,Q as j,un as l,gn as m,K as t};
@@ -1 +1 @@
1
- import{bd as S,be as Rn,aV as T,bf as w,bg as xn,bh as mn,aU as sn,bi as Mn,bj as un,bk as x,aS as U,bl as Cn,bm as on,bn as Fn,bo as E,bb as gn,bp as R,aQ as ln,bq as Dn,br as D,bs as Gn,bt as Un,bu as _,aY as Bn,bv as Nn,aT as Kn,bw as X,bx as jn,by as Hn,aX as qn,aW as cn,b9 as Yn,bz as M}from"./ChatPage-Boj_N_ec.js";var Zn="[object Symbol]";function B(n){return typeof n=="symbol"||S(n)&&Rn(n)==Zn}function bn(n,r){for(var e=-1,t=n==null?0:n.length,f=Array(t);++e<t;)f[e]=r(n[e],e,n);return f}var Q=w?w.prototype:void 0,J=Q?Q.toString:void 0;function dn(n){if(typeof n=="string")return n;if(T(n))return bn(n,dn)+"";if(B(n))return J?J.call(n):"";var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function Xn(){}function pn(n,r){for(var e=-1,t=n==null?0:n.length;++e<t&&r(n[e],e,n)!==!1;);return n}function Qn(n,r,e,t){for(var f=n.length,i=e+-1;++i<f;)if(r(n[i],i,n))return i;return-1}function Jn(n){return n!==n}function Wn(n,r,e){for(var t=e-1,f=n.length;++t<f;)if(n[t]===r)return t;return-1}function zn(n,r,e){return r===r?Wn(n,r,e):Qn(n,Jn,e)}function Vn(n,r){var e=n==null?0:n.length;return!!e&&zn(n,r,0)>-1}function $(n){return sn(n)?xn(n):mn(n)}var kn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nr=/^\w*$/;function N(n,r){if(T(n))return!1;var e=typeof n;return e=="number"||e=="symbol"||e=="boolean"||n==null||B(n)?!0:nr.test(n)||!kn.test(n)||r!=null&&n in Object(r)}var rr=500;function er(n){var r=Mn(n,function(t){return e.size===rr&&e.clear(),t}),e=r.cache;return r}var tr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ir=/\\(\\)?/g,fr=er(function(n){var r=[];return n.charCodeAt(0)===46&&r.push(""),n.replace(tr,function(e,t,f,i){r.push(f?i.replace(ir,"$1"):t||e)}),r});function ar(n){return n==null?"":dn(n)}function An(n,r){return T(n)?n:N(n,r)?[n]:fr(ar(n))}function m(n){if(typeof n=="string"||B(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function yn(n,r){r=An(r,n);for(var e=0,t=r.length;n!=null&&e<t;)n=n[m(r[e++])];return e&&e==t?n:void 0}function sr(n,r,e){var t=n==null?void 0:yn(n,r);return t===void 0?e:t}function K(n,r){for(var e=-1,t=r.length,f=n.length;++e<t;)n[f+e]=r[e];return n}var W=w?w.isConcatSpreadable:void 0;function ur(n){return T(n)||un(n)||!!(W&&n&&n[W])}function Ot(n,r,e,t,f){var i=-1,a=n.length;for(e||(e=ur),f||(f=[]);++i<a;){var s=n[i];e(s)?K(f,s):t||(f[f.length]=s)}return f}function or(n,r,e,t){var f=-1,i=n==null?0:n.length;for(t&&i&&(e=n[++f]);++f<i;)e=r(e,n[f],f,n);return e}function gr(n,r){return n&&x(r,$(r),n)}function lr(n,r){return n&&x(r,U(r),n)}function Tn(n,r){for(var e=-1,t=n==null?0:n.length,f=0,i=[];++e<t;){var a=n[e];r(a,e,n)&&(i[f++]=a)}return i}function hn(){return[]}var cr=Object.prototype,br=cr.propertyIsEnumerable,z=Object.getOwnPropertySymbols,j=z?function(n){return n==null?[]:(n=Object(n),Tn(z(n),function(r){return br.call(n,r)}))}:hn;function dr(n,r){return x(n,j(n),r)}var pr=Object.getOwnPropertySymbols,wn=pr?function(n){for(var r=[];n;)K(r,j(n)),n=Cn(n);return r}:hn;function Ar(n,r){return x(n,wn(n),r)}function On(n,r,e){var t=r(n);return T(n)?t:K(t,e(n))}function G(n){return On(n,$,j)}function yr(n){return On(n,U,wn)}var Tr=Object.prototype,hr=Tr.hasOwnProperty;function wr(n){var r=n.length,e=new n.constructor(r);return r&&typeof n[0]=="string"&&hr.call(n,"index")&&(e.index=n.index,e.input=n.input),e}function Or(n,r){var e=r?on(n.buffer):n.buffer;return new n.constructor(e,n.byteOffset,n.byteLength)}var $r=/\w*$/;function _r(n){var r=new n.constructor(n.source,$r.exec(n));return r.lastIndex=n.lastIndex,r}var V=w?w.prototype:void 0,k=V?V.valueOf:void 0;function Sr(n){return k?Object(k.call(n)):{}}var Er="[object Boolean]",Ir="[object Date]",Pr="[object Map]",vr="[object Number]",Lr="[object RegExp]",Rr="[object Set]",xr="[object String]",mr="[object Symbol]",Mr="[object ArrayBuffer]",Cr="[object DataView]",Fr="[object Float32Array]",Dr="[object Float64Array]",Gr="[object Int8Array]",Ur="[object Int16Array]",Br="[object Int32Array]",Nr="[object Uint8Array]",Kr="[object Uint8ClampedArray]",jr="[object Uint16Array]",Hr="[object Uint32Array]";function qr(n,r,e){var t=n.constructor;switch(r){case Mr:return on(n);case Er:case Ir:return new t(+n);case Cr:return Or(n,e);case Fr:case Dr:case Gr:case Ur:case Br:case Nr:case Kr:case jr:case Hr:return Fn(n,e);case Pr:return new t;case vr:case xr:return new t(n);case Lr:return _r(n);case Rr:return new t;case mr:return Sr(n)}}var Yr="[object Map]";function Zr(n){return S(n)&&E(n)==Yr}var nn=R&&R.isMap,Xr=nn?gn(nn):Zr,Qr="[object Set]";function Jr(n){return S(n)&&E(n)==Qr}var rn=R&&R.isSet,Wr=rn?gn(rn):Jr,zr=1,Vr=2,kr=4,$n="[object Arguments]",ne="[object Array]",re="[object Boolean]",ee="[object Date]",te="[object Error]",_n="[object Function]",ie="[object GeneratorFunction]",fe="[object Map]",ae="[object Number]",Sn="[object Object]",se="[object RegExp]",ue="[object Set]",oe="[object String]",ge="[object Symbol]",le="[object WeakMap]",ce="[object ArrayBuffer]",be="[object DataView]",de="[object Float32Array]",pe="[object Float64Array]",Ae="[object Int8Array]",ye="[object Int16Array]",Te="[object Int32Array]",he="[object Uint8Array]",we="[object Uint8ClampedArray]",Oe="[object Uint16Array]",$e="[object Uint32Array]",g={};g[$n]=g[ne]=g[ce]=g[be]=g[re]=g[ee]=g[de]=g[pe]=g[Ae]=g[ye]=g[Te]=g[fe]=g[ae]=g[Sn]=g[se]=g[ue]=g[oe]=g[ge]=g[he]=g[we]=g[Oe]=g[$e]=!0;g[te]=g[_n]=g[le]=!1;function C(n,r,e,t,f,i){var a,s=r&zr,u=r&Vr,b=r&kr;if(a!==void 0)return a;if(!ln(n))return n;var l=T(n);if(l){if(a=wr(n),!s)return Dn(n,a)}else{var o=E(n),c=o==_n||o==ie;if(D(n))return Gn(n,s);if(o==Sn||o==$n||c&&!f){if(a=u||c?{}:Un(n),!s)return u?Ar(n,lr(a,n)):dr(n,gr(a,n))}else{if(!g[o])return f?n:{};a=qr(n,o,s)}}i||(i=new _);var h=i.get(n);if(h)return h;i.set(n,a),Wr(n)?n.forEach(function(d){a.add(C(d,r,e,d,n,i))}):Xr(n)&&n.forEach(function(d,p){a.set(p,C(d,r,e,p,n,i))});var A=b?u?yr:G:u?U:$,y=l?void 0:A(n);return pn(y||n,function(d,p){y&&(p=d,d=n[p]),Bn(a,p,C(d,r,e,p,n,i))}),a}var _e="__lodash_hash_undefined__";function Se(n){return this.__data__.set(n,_e),this}function Ee(n){return this.__data__.has(n)}function I(n){var r=-1,e=n==null?0:n.length;for(this.__data__=new Nn;++r<e;)this.add(n[r])}I.prototype.add=I.prototype.push=Se;I.prototype.has=Ee;function Ie(n,r){for(var e=-1,t=n==null?0:n.length;++e<t;)if(r(n[e],e,n))return!0;return!1}function En(n,r){return n.has(r)}var Pe=1,ve=2;function In(n,r,e,t,f,i){var a=e&Pe,s=n.length,u=r.length;if(s!=u&&!(a&&u>s))return!1;var b=i.get(n),l=i.get(r);if(b&&l)return b==r&&l==n;var o=-1,c=!0,h=e&ve?new I:void 0;for(i.set(n,r),i.set(r,n);++o<s;){var A=n[o],y=r[o];if(t)var d=a?t(y,A,o,r,n,i):t(A,y,o,n,r,i);if(d!==void 0){if(d)continue;c=!1;break}if(h){if(!Ie(r,function(p,O){if(!En(h,O)&&(A===p||f(A,p,e,t,i)))return h.push(O)})){c=!1;break}}else if(!(A===y||f(A,y,e,t,i))){c=!1;break}}return i.delete(n),i.delete(r),c}function Le(n){var r=-1,e=Array(n.size);return n.forEach(function(t,f){e[++r]=[f,t]}),e}function H(n){var r=-1,e=Array(n.size);return n.forEach(function(t){e[++r]=t}),e}var Re=1,xe=2,me="[object Boolean]",Me="[object Date]",Ce="[object Error]",Fe="[object Map]",De="[object Number]",Ge="[object RegExp]",Ue="[object Set]",Be="[object String]",Ne="[object Symbol]",Ke="[object ArrayBuffer]",je="[object DataView]",en=w?w.prototype:void 0,F=en?en.valueOf:void 0;function He(n,r,e,t,f,i,a){switch(e){case je:if(n.byteLength!=r.byteLength||n.byteOffset!=r.byteOffset)return!1;n=n.buffer,r=r.buffer;case Ke:return!(n.byteLength!=r.byteLength||!i(new X(n),new X(r)));case me:case Me:case De:return Kn(+n,+r);case Ce:return n.name==r.name&&n.message==r.message;case Ge:case Be:return n==r+"";case Fe:var s=Le;case Ue:var u=t&Re;if(s||(s=H),n.size!=r.size&&!u)return!1;var b=a.get(n);if(b)return b==r;t|=xe,a.set(n,r);var l=In(s(n),s(r),t,f,i,a);return a.delete(n),l;case Ne:if(F)return F.call(n)==F.call(r)}return!1}var qe=1,Ye=Object.prototype,Ze=Ye.hasOwnProperty;function Xe(n,r,e,t,f,i){var a=e&qe,s=G(n),u=s.length,b=G(r),l=b.length;if(u!=l&&!a)return!1;for(var o=u;o--;){var c=s[o];if(!(a?c in r:Ze.call(r,c)))return!1}var h=i.get(n),A=i.get(r);if(h&&A)return h==r&&A==n;var y=!0;i.set(n,r),i.set(r,n);for(var d=a;++o<u;){c=s[o];var p=n[c],O=r[c];if(t)var Z=a?t(O,p,c,r,n,i):t(p,O,c,n,r,i);if(!(Z===void 0?p===O||f(p,O,e,t,i):Z)){y=!1;break}d||(d=c=="constructor")}if(y&&!d){var P=n.constructor,v=r.constructor;P!=v&&"constructor"in n&&"constructor"in r&&!(typeof P=="function"&&P instanceof P&&typeof v=="function"&&v instanceof v)&&(y=!1)}return i.delete(n),i.delete(r),y}var Qe=1,tn="[object Arguments]",fn="[object Array]",L="[object Object]",Je=Object.prototype,an=Je.hasOwnProperty;function We(n,r,e,t,f,i){var a=T(n),s=T(r),u=a?fn:E(n),b=s?fn:E(r);u=u==tn?L:u,b=b==tn?L:b;var l=u==L,o=b==L,c=u==b;if(c&&D(n)){if(!D(r))return!1;a=!0,l=!1}if(c&&!l)return i||(i=new _),a||jn(n)?In(n,r,e,t,f,i):He(n,r,u,e,t,f,i);if(!(e&Qe)){var h=l&&an.call(n,"__wrapped__"),A=o&&an.call(r,"__wrapped__");if(h||A){var y=h?n.value():n,d=A?r.value():r;return i||(i=new _),f(y,d,e,t,i)}}return c?(i||(i=new _),Xe(n,r,e,t,f,i)):!1}function q(n,r,e,t,f){return n===r?!0:n==null||r==null||!S(n)&&!S(r)?n!==n&&r!==r:We(n,r,e,t,q,f)}var ze=1,Ve=2;function ke(n,r,e,t){var f=e.length,i=f;if(n==null)return!i;for(n=Object(n);f--;){var a=e[f];if(a[2]?a[1]!==n[a[0]]:!(a[0]in n))return!1}for(;++f<i;){a=e[f];var s=a[0],u=n[s],b=a[1];if(a[2]){if(u===void 0&&!(s in n))return!1}else{var l=new _,o;if(!(o===void 0?q(b,u,ze|Ve,t,l):o))return!1}}return!0}function Pn(n){return n===n&&!ln(n)}function nt(n){for(var r=$(n),e=r.length;e--;){var t=r[e],f=n[t];r[e]=[t,f,Pn(f)]}return r}function vn(n,r){return function(e){return e==null?!1:e[n]===r&&(r!==void 0||n in Object(e))}}function rt(n){var r=nt(n);return r.length==1&&r[0][2]?vn(r[0][0],r[0][1]):function(e){return e===n||ke(e,n,r)}}function et(n,r){return n!=null&&r in Object(n)}function tt(n,r,e){r=An(r,n);for(var t=-1,f=r.length,i=!1;++t<f;){var a=m(r[t]);if(!(i=n!=null&&e(n,a)))break;n=n[a]}return i||++t!=f?i:(f=n==null?0:n.length,!!f&&Hn(f)&&qn(a,f)&&(T(n)||un(n)))}function it(n,r){return n!=null&&tt(n,r,et)}var ft=1,at=2;function st(n,r){return N(n)&&Pn(r)?vn(m(n),r):function(e){var t=sr(e,n);return t===void 0&&t===r?it(e,n):q(r,t,ft|at)}}function ut(n){return function(r){return r?.[n]}}function ot(n){return function(r){return yn(r,n)}}function gt(n){return N(n)?ut(m(n)):ot(n)}function Ln(n){return typeof n=="function"?n:n==null?cn:typeof n=="object"?T(n)?st(n[0],n[1]):rt(n):gt(n)}function lt(n,r){return n&&Yn(n,r,$)}function ct(n,r){return function(e,t){if(e==null)return e;if(!sn(e))return n(e,t);for(var f=e.length,i=-1,a=Object(e);++i<f&&t(a[i],i,a)!==!1;);return e}}var Y=ct(lt);function bt(n){return typeof n=="function"?n:cn}function $t(n,r){var e=T(n)?pn:Y;return e(n,bt(r))}function dt(n,r){var e=[];return Y(n,function(t,f,i){r(t,f,i)&&e.push(t)}),e}function _t(n,r){var e=T(n)?Tn:dt;return e(n,Ln(r))}function pt(n,r){return bn(r,function(e){return n[e]})}function St(n){return n==null?[]:pt(n,$(n))}function Et(n){return n===void 0}function At(n,r,e,t,f){return f(n,function(i,a,s){e=t?(t=!1,i):r(e,i,a,s)}),e}function It(n,r,e){var t=T(n)?or:At,f=arguments.length<3;return t(n,Ln(r),e,f,Y)}var yt=1/0,Tt=M&&1/H(new M([,-0]))[1]==yt?function(n){return new M(n)}:Xn,ht=200;function Pt(n,r,e){var t=-1,f=Vn,i=n.length,a=!0,s=[],u=s;if(i>=ht){var b=r?null:Tt(n);if(b)return H(b);a=!1,f=En,u=new I}else u=r?[]:s;n:for(;++t<i;){var l=n[t],o=r?r(l):l;if(l=l!==0?l:0,a&&o===o){for(var c=u.length;c--;)if(u[c]===o)continue n;r&&u.push(o),s.push(l)}else f(u,o,e)||(u!==s&&u.push(o),s.push(l))}return s}export{Tn as A,dt as B,Ie as C,Xn as D,I as S,Pt as a,C as b,Ot as c,$t as d,B as e,_t as f,Ln as g,Qn as h,Et as i,Y as j,$ as k,bn as l,tt as m,An as n,yn as o,bt as p,lt as q,It as r,it as s,m as t,ar as u,St as v,Vn as w,En as x,zn as y,yr as z};
1
+ import{bd as S,be as Rn,aV as T,bf as w,bg as xn,bh as mn,aU as sn,bi as Mn,bj as un,bk as x,aS as U,bl as Cn,bm as on,bn as Fn,bo as E,bb as gn,bp as R,aQ as ln,bq as Dn,br as D,bs as Gn,bt as Un,bu as _,aY as Bn,bv as Nn,aT as Kn,bw as X,bx as jn,by as Hn,aX as qn,aW as cn,b9 as Yn,bz as M}from"./ChatPage-BAslLt2l.js";var Zn="[object Symbol]";function B(n){return typeof n=="symbol"||S(n)&&Rn(n)==Zn}function bn(n,r){for(var e=-1,t=n==null?0:n.length,f=Array(t);++e<t;)f[e]=r(n[e],e,n);return f}var Q=w?w.prototype:void 0,J=Q?Q.toString:void 0;function dn(n){if(typeof n=="string")return n;if(T(n))return bn(n,dn)+"";if(B(n))return J?J.call(n):"";var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function Xn(){}function pn(n,r){for(var e=-1,t=n==null?0:n.length;++e<t&&r(n[e],e,n)!==!1;);return n}function Qn(n,r,e,t){for(var f=n.length,i=e+-1;++i<f;)if(r(n[i],i,n))return i;return-1}function Jn(n){return n!==n}function Wn(n,r,e){for(var t=e-1,f=n.length;++t<f;)if(n[t]===r)return t;return-1}function zn(n,r,e){return r===r?Wn(n,r,e):Qn(n,Jn,e)}function Vn(n,r){var e=n==null?0:n.length;return!!e&&zn(n,r,0)>-1}function $(n){return sn(n)?xn(n):mn(n)}var kn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nr=/^\w*$/;function N(n,r){if(T(n))return!1;var e=typeof n;return e=="number"||e=="symbol"||e=="boolean"||n==null||B(n)?!0:nr.test(n)||!kn.test(n)||r!=null&&n in Object(r)}var rr=500;function er(n){var r=Mn(n,function(t){return e.size===rr&&e.clear(),t}),e=r.cache;return r}var tr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ir=/\\(\\)?/g,fr=er(function(n){var r=[];return n.charCodeAt(0)===46&&r.push(""),n.replace(tr,function(e,t,f,i){r.push(f?i.replace(ir,"$1"):t||e)}),r});function ar(n){return n==null?"":dn(n)}function An(n,r){return T(n)?n:N(n,r)?[n]:fr(ar(n))}function m(n){if(typeof n=="string"||B(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function yn(n,r){r=An(r,n);for(var e=0,t=r.length;n!=null&&e<t;)n=n[m(r[e++])];return e&&e==t?n:void 0}function sr(n,r,e){var t=n==null?void 0:yn(n,r);return t===void 0?e:t}function K(n,r){for(var e=-1,t=r.length,f=n.length;++e<t;)n[f+e]=r[e];return n}var W=w?w.isConcatSpreadable:void 0;function ur(n){return T(n)||un(n)||!!(W&&n&&n[W])}function Ot(n,r,e,t,f){var i=-1,a=n.length;for(e||(e=ur),f||(f=[]);++i<a;){var s=n[i];e(s)?K(f,s):t||(f[f.length]=s)}return f}function or(n,r,e,t){var f=-1,i=n==null?0:n.length;for(t&&i&&(e=n[++f]);++f<i;)e=r(e,n[f],f,n);return e}function gr(n,r){return n&&x(r,$(r),n)}function lr(n,r){return n&&x(r,U(r),n)}function Tn(n,r){for(var e=-1,t=n==null?0:n.length,f=0,i=[];++e<t;){var a=n[e];r(a,e,n)&&(i[f++]=a)}return i}function hn(){return[]}var cr=Object.prototype,br=cr.propertyIsEnumerable,z=Object.getOwnPropertySymbols,j=z?function(n){return n==null?[]:(n=Object(n),Tn(z(n),function(r){return br.call(n,r)}))}:hn;function dr(n,r){return x(n,j(n),r)}var pr=Object.getOwnPropertySymbols,wn=pr?function(n){for(var r=[];n;)K(r,j(n)),n=Cn(n);return r}:hn;function Ar(n,r){return x(n,wn(n),r)}function On(n,r,e){var t=r(n);return T(n)?t:K(t,e(n))}function G(n){return On(n,$,j)}function yr(n){return On(n,U,wn)}var Tr=Object.prototype,hr=Tr.hasOwnProperty;function wr(n){var r=n.length,e=new n.constructor(r);return r&&typeof n[0]=="string"&&hr.call(n,"index")&&(e.index=n.index,e.input=n.input),e}function Or(n,r){var e=r?on(n.buffer):n.buffer;return new n.constructor(e,n.byteOffset,n.byteLength)}var $r=/\w*$/;function _r(n){var r=new n.constructor(n.source,$r.exec(n));return r.lastIndex=n.lastIndex,r}var V=w?w.prototype:void 0,k=V?V.valueOf:void 0;function Sr(n){return k?Object(k.call(n)):{}}var Er="[object Boolean]",Ir="[object Date]",Pr="[object Map]",vr="[object Number]",Lr="[object RegExp]",Rr="[object Set]",xr="[object String]",mr="[object Symbol]",Mr="[object ArrayBuffer]",Cr="[object DataView]",Fr="[object Float32Array]",Dr="[object Float64Array]",Gr="[object Int8Array]",Ur="[object Int16Array]",Br="[object Int32Array]",Nr="[object Uint8Array]",Kr="[object Uint8ClampedArray]",jr="[object Uint16Array]",Hr="[object Uint32Array]";function qr(n,r,e){var t=n.constructor;switch(r){case Mr:return on(n);case Er:case Ir:return new t(+n);case Cr:return Or(n,e);case Fr:case Dr:case Gr:case Ur:case Br:case Nr:case Kr:case jr:case Hr:return Fn(n,e);case Pr:return new t;case vr:case xr:return new t(n);case Lr:return _r(n);case Rr:return new t;case mr:return Sr(n)}}var Yr="[object Map]";function Zr(n){return S(n)&&E(n)==Yr}var nn=R&&R.isMap,Xr=nn?gn(nn):Zr,Qr="[object Set]";function Jr(n){return S(n)&&E(n)==Qr}var rn=R&&R.isSet,Wr=rn?gn(rn):Jr,zr=1,Vr=2,kr=4,$n="[object Arguments]",ne="[object Array]",re="[object Boolean]",ee="[object Date]",te="[object Error]",_n="[object Function]",ie="[object GeneratorFunction]",fe="[object Map]",ae="[object Number]",Sn="[object Object]",se="[object RegExp]",ue="[object Set]",oe="[object String]",ge="[object Symbol]",le="[object WeakMap]",ce="[object ArrayBuffer]",be="[object DataView]",de="[object Float32Array]",pe="[object Float64Array]",Ae="[object Int8Array]",ye="[object Int16Array]",Te="[object Int32Array]",he="[object Uint8Array]",we="[object Uint8ClampedArray]",Oe="[object Uint16Array]",$e="[object Uint32Array]",g={};g[$n]=g[ne]=g[ce]=g[be]=g[re]=g[ee]=g[de]=g[pe]=g[Ae]=g[ye]=g[Te]=g[fe]=g[ae]=g[Sn]=g[se]=g[ue]=g[oe]=g[ge]=g[he]=g[we]=g[Oe]=g[$e]=!0;g[te]=g[_n]=g[le]=!1;function C(n,r,e,t,f,i){var a,s=r&zr,u=r&Vr,b=r&kr;if(a!==void 0)return a;if(!ln(n))return n;var l=T(n);if(l){if(a=wr(n),!s)return Dn(n,a)}else{var o=E(n),c=o==_n||o==ie;if(D(n))return Gn(n,s);if(o==Sn||o==$n||c&&!f){if(a=u||c?{}:Un(n),!s)return u?Ar(n,lr(a,n)):dr(n,gr(a,n))}else{if(!g[o])return f?n:{};a=qr(n,o,s)}}i||(i=new _);var h=i.get(n);if(h)return h;i.set(n,a),Wr(n)?n.forEach(function(d){a.add(C(d,r,e,d,n,i))}):Xr(n)&&n.forEach(function(d,p){a.set(p,C(d,r,e,p,n,i))});var A=b?u?yr:G:u?U:$,y=l?void 0:A(n);return pn(y||n,function(d,p){y&&(p=d,d=n[p]),Bn(a,p,C(d,r,e,p,n,i))}),a}var _e="__lodash_hash_undefined__";function Se(n){return this.__data__.set(n,_e),this}function Ee(n){return this.__data__.has(n)}function I(n){var r=-1,e=n==null?0:n.length;for(this.__data__=new Nn;++r<e;)this.add(n[r])}I.prototype.add=I.prototype.push=Se;I.prototype.has=Ee;function Ie(n,r){for(var e=-1,t=n==null?0:n.length;++e<t;)if(r(n[e],e,n))return!0;return!1}function En(n,r){return n.has(r)}var Pe=1,ve=2;function In(n,r,e,t,f,i){var a=e&Pe,s=n.length,u=r.length;if(s!=u&&!(a&&u>s))return!1;var b=i.get(n),l=i.get(r);if(b&&l)return b==r&&l==n;var o=-1,c=!0,h=e&ve?new I:void 0;for(i.set(n,r),i.set(r,n);++o<s;){var A=n[o],y=r[o];if(t)var d=a?t(y,A,o,r,n,i):t(A,y,o,n,r,i);if(d!==void 0){if(d)continue;c=!1;break}if(h){if(!Ie(r,function(p,O){if(!En(h,O)&&(A===p||f(A,p,e,t,i)))return h.push(O)})){c=!1;break}}else if(!(A===y||f(A,y,e,t,i))){c=!1;break}}return i.delete(n),i.delete(r),c}function Le(n){var r=-1,e=Array(n.size);return n.forEach(function(t,f){e[++r]=[f,t]}),e}function H(n){var r=-1,e=Array(n.size);return n.forEach(function(t){e[++r]=t}),e}var Re=1,xe=2,me="[object Boolean]",Me="[object Date]",Ce="[object Error]",Fe="[object Map]",De="[object Number]",Ge="[object RegExp]",Ue="[object Set]",Be="[object String]",Ne="[object Symbol]",Ke="[object ArrayBuffer]",je="[object DataView]",en=w?w.prototype:void 0,F=en?en.valueOf:void 0;function He(n,r,e,t,f,i,a){switch(e){case je:if(n.byteLength!=r.byteLength||n.byteOffset!=r.byteOffset)return!1;n=n.buffer,r=r.buffer;case Ke:return!(n.byteLength!=r.byteLength||!i(new X(n),new X(r)));case me:case Me:case De:return Kn(+n,+r);case Ce:return n.name==r.name&&n.message==r.message;case Ge:case Be:return n==r+"";case Fe:var s=Le;case Ue:var u=t&Re;if(s||(s=H),n.size!=r.size&&!u)return!1;var b=a.get(n);if(b)return b==r;t|=xe,a.set(n,r);var l=In(s(n),s(r),t,f,i,a);return a.delete(n),l;case Ne:if(F)return F.call(n)==F.call(r)}return!1}var qe=1,Ye=Object.prototype,Ze=Ye.hasOwnProperty;function Xe(n,r,e,t,f,i){var a=e&qe,s=G(n),u=s.length,b=G(r),l=b.length;if(u!=l&&!a)return!1;for(var o=u;o--;){var c=s[o];if(!(a?c in r:Ze.call(r,c)))return!1}var h=i.get(n),A=i.get(r);if(h&&A)return h==r&&A==n;var y=!0;i.set(n,r),i.set(r,n);for(var d=a;++o<u;){c=s[o];var p=n[c],O=r[c];if(t)var Z=a?t(O,p,c,r,n,i):t(p,O,c,n,r,i);if(!(Z===void 0?p===O||f(p,O,e,t,i):Z)){y=!1;break}d||(d=c=="constructor")}if(y&&!d){var P=n.constructor,v=r.constructor;P!=v&&"constructor"in n&&"constructor"in r&&!(typeof P=="function"&&P instanceof P&&typeof v=="function"&&v instanceof v)&&(y=!1)}return i.delete(n),i.delete(r),y}var Qe=1,tn="[object Arguments]",fn="[object Array]",L="[object Object]",Je=Object.prototype,an=Je.hasOwnProperty;function We(n,r,e,t,f,i){var a=T(n),s=T(r),u=a?fn:E(n),b=s?fn:E(r);u=u==tn?L:u,b=b==tn?L:b;var l=u==L,o=b==L,c=u==b;if(c&&D(n)){if(!D(r))return!1;a=!0,l=!1}if(c&&!l)return i||(i=new _),a||jn(n)?In(n,r,e,t,f,i):He(n,r,u,e,t,f,i);if(!(e&Qe)){var h=l&&an.call(n,"__wrapped__"),A=o&&an.call(r,"__wrapped__");if(h||A){var y=h?n.value():n,d=A?r.value():r;return i||(i=new _),f(y,d,e,t,i)}}return c?(i||(i=new _),Xe(n,r,e,t,f,i)):!1}function q(n,r,e,t,f){return n===r?!0:n==null||r==null||!S(n)&&!S(r)?n!==n&&r!==r:We(n,r,e,t,q,f)}var ze=1,Ve=2;function ke(n,r,e,t){var f=e.length,i=f;if(n==null)return!i;for(n=Object(n);f--;){var a=e[f];if(a[2]?a[1]!==n[a[0]]:!(a[0]in n))return!1}for(;++f<i;){a=e[f];var s=a[0],u=n[s],b=a[1];if(a[2]){if(u===void 0&&!(s in n))return!1}else{var l=new _,o;if(!(o===void 0?q(b,u,ze|Ve,t,l):o))return!1}}return!0}function Pn(n){return n===n&&!ln(n)}function nt(n){for(var r=$(n),e=r.length;e--;){var t=r[e],f=n[t];r[e]=[t,f,Pn(f)]}return r}function vn(n,r){return function(e){return e==null?!1:e[n]===r&&(r!==void 0||n in Object(e))}}function rt(n){var r=nt(n);return r.length==1&&r[0][2]?vn(r[0][0],r[0][1]):function(e){return e===n||ke(e,n,r)}}function et(n,r){return n!=null&&r in Object(n)}function tt(n,r,e){r=An(r,n);for(var t=-1,f=r.length,i=!1;++t<f;){var a=m(r[t]);if(!(i=n!=null&&e(n,a)))break;n=n[a]}return i||++t!=f?i:(f=n==null?0:n.length,!!f&&Hn(f)&&qn(a,f)&&(T(n)||un(n)))}function it(n,r){return n!=null&&tt(n,r,et)}var ft=1,at=2;function st(n,r){return N(n)&&Pn(r)?vn(m(n),r):function(e){var t=sr(e,n);return t===void 0&&t===r?it(e,n):q(r,t,ft|at)}}function ut(n){return function(r){return r?.[n]}}function ot(n){return function(r){return yn(r,n)}}function gt(n){return N(n)?ut(m(n)):ot(n)}function Ln(n){return typeof n=="function"?n:n==null?cn:typeof n=="object"?T(n)?st(n[0],n[1]):rt(n):gt(n)}function lt(n,r){return n&&Yn(n,r,$)}function ct(n,r){return function(e,t){if(e==null)return e;if(!sn(e))return n(e,t);for(var f=e.length,i=-1,a=Object(e);++i<f&&t(a[i],i,a)!==!1;);return e}}var Y=ct(lt);function bt(n){return typeof n=="function"?n:cn}function $t(n,r){var e=T(n)?pn:Y;return e(n,bt(r))}function dt(n,r){var e=[];return Y(n,function(t,f,i){r(t,f,i)&&e.push(t)}),e}function _t(n,r){var e=T(n)?Tn:dt;return e(n,Ln(r))}function pt(n,r){return bn(r,function(e){return n[e]})}function St(n){return n==null?[]:pt(n,$(n))}function Et(n){return n===void 0}function At(n,r,e,t,f){return f(n,function(i,a,s){e=t?(t=!1,i):r(e,i,a,s)}),e}function It(n,r,e){var t=T(n)?or:At,f=arguments.length<3;return t(n,Ln(r),e,f,Y)}var yt=1/0,Tt=M&&1/H(new M([,-0]))[1]==yt?function(n){return new M(n)}:Xn,ht=200;function Pt(n,r,e){var t=-1,f=Vn,i=n.length,a=!0,s=[],u=s;if(i>=ht){var b=r?null:Tt(n);if(b)return H(b);a=!1,f=En,u=new I}else u=r?[]:s;n:for(;++t<i;){var l=n[t],o=r?r(l):l;if(l=l!==0?l:0,a&&o===o){for(var c=u.length;c--;)if(u[c]===o)continue n;r&&u.push(o),s.push(l)}else f(u,o,e)||(u!==s&&u.push(o),s.push(l))}return s}export{Tn as A,dt as B,Ie as C,Xn as D,I as S,Pt as a,C as b,Ot as c,$t as d,B as e,_t as f,Ln as g,Qn as h,Et as i,Y as j,$ as k,bn as l,tt as m,An as n,yn as o,bt as p,lt as q,It as r,it as s,m as t,ar as u,St as v,Vn as w,En as x,zn as y,yr as z};