@wandox/sdk 0.1.37 → 0.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{V1Workbench-UL6m_GSU.cjs → V1Workbench-BL9TCe-h.cjs} +3 -3
- package/dist/{V1Workbench-CqWNz8eg.js → V1Workbench-GjmMHW_z.js} +5 -6
- package/dist/V2Workbench-C0Ak3rdn.cjs +2 -0
- package/dist/V2Workbench-C4uOgIer.js +2694 -0
- package/dist/{WorkbenchRuntime-kI4h_Boi.js → WorkbenchRuntime-ButbDrvB.js} +4 -4
- package/dist/{WorkbenchRuntime-BPjLWyHy.cjs → WorkbenchRuntime-jXXGAqkE.cjs} +2 -2
- package/dist/{arc-B5N4v9Jv.cjs → arc-BK_aujia.cjs} +1 -1
- package/dist/{arc-BRgfV2vT.js → arc-CE1S54RP.js} +1 -1
- package/dist/{architectureDiagram-3BPJPVTR-DjM6oFEx.cjs → architectureDiagram-3BPJPVTR-CCe2Qwas.cjs} +1 -1
- package/dist/{architectureDiagram-3BPJPVTR-DUgD63Rt.js → architectureDiagram-3BPJPVTR-mquQ4A04.js} +3 -3
- package/dist/{blockDiagram-GPEHLZMM-6EI7pONG.js → blockDiagram-GPEHLZMM-DnZ4oEXt.js} +3 -3
- package/dist/{blockDiagram-GPEHLZMM-Bbk0DebD.cjs → blockDiagram-GPEHLZMM-Dr9swVG2.cjs} +1 -1
- package/dist/{c4Diagram-AAUBKEIU-CPATCWpo.js → c4Diagram-AAUBKEIU-DTz0ipr3.js} +2 -2
- package/dist/{c4Diagram-AAUBKEIU-UW4tUuYO.cjs → c4Diagram-AAUBKEIU-DtaJYesx.cjs} +1 -1
- package/dist/{channel-BOuHczM9.js → channel-BeVy-ZIF.js} +1 -1
- package/dist/{channel-BPVKsQR4.cjs → channel-CDc0Yn2X.cjs} +1 -1
- package/dist/{chunk-2J33WTMH-JkZNZ2FQ.cjs → chunk-2J33WTMH-2Z5D00s4.cjs} +1 -1
- package/dist/{chunk-2J33WTMH-BMA-WoY7.js → chunk-2J33WTMH-lCahilst.js} +1 -1
- package/dist/{chunk-4BX2VUAB-CoubCo12.js → chunk-4BX2VUAB-BfG82Y4D.js} +1 -1
- package/dist/{chunk-4BX2VUAB-DJjQ2iym.cjs → chunk-4BX2VUAB-C9W5QDsy.cjs} +1 -1
- package/dist/{chunk-55IACEB6-B8_bbLHJ.js → chunk-55IACEB6-DDuaa7-s.js} +1 -1
- package/dist/{chunk-55IACEB6-k8m2Tb0O.cjs → chunk-55IACEB6-F1nM7WdQ.cjs} +1 -1
- package/dist/{chunk-727SXJPM-Dk4Qx6Cj.cjs → chunk-727SXJPM-D9vGz_R5.cjs} +1 -1
- package/dist/{chunk-727SXJPM-w5uqNLUJ.js → chunk-727SXJPM-DCpsumhn.js} +5 -5
- package/dist/{chunk-AQP2D5EJ-BC_iX9X6.js → chunk-AQP2D5EJ-BiJG2fDP.js} +3 -3
- package/dist/{chunk-AQP2D5EJ-rJ3mY-t4.cjs → chunk-AQP2D5EJ-DBFNgb2V.cjs} +1 -1
- package/dist/{chunk-FMBD7UC4-C_CgBQVs.cjs → chunk-FMBD7UC4-BhyGm-GT.cjs} +1 -1
- package/dist/{chunk-FMBD7UC4-DZlFTSR3.js → chunk-FMBD7UC4-cWskSZrE.js} +1 -1
- package/dist/{chunk-ND2GUHAM-SOVIggp_.js → chunk-ND2GUHAM-DGIC-ZW-.js} +1 -1
- package/dist/{chunk-ND2GUHAM-rYKw1ewI.cjs → chunk-ND2GUHAM-DRY6nzyy.cjs} +1 -1
- package/dist/{chunk-QZHKN3VN-D_n03X4c.cjs → chunk-QZHKN3VN-C7JxoAX-.cjs} +1 -1
- package/dist/{chunk-QZHKN3VN-BzYA6_MS.js → chunk-QZHKN3VN-HwaVssHs.js} +1 -1
- package/dist/{classDiagram-4FO5ZUOK-Cus7V0-B.cjs → classDiagram-4FO5ZUOK-CygibmXb.cjs} +1 -1
- package/dist/{classDiagram-4FO5ZUOK-yY-LWEE5.js → classDiagram-4FO5ZUOK-mzJYvOZu.js} +2 -2
- package/dist/{classDiagram-v2-Q7XG4LA2-D_2oVIAG.js → classDiagram-v2-Q7XG4LA2-B1YHuxBu.js} +2 -2
- package/dist/{classDiagram-v2-Q7XG4LA2-Cus7V0-B.cjs → classDiagram-v2-Q7XG4LA2-CygibmXb.cjs} +1 -1
- package/dist/{cose-bilkent-S5V4N54A-DtK_d2nt.js → cose-bilkent-S5V4N54A-D8IZat0h.js} +2 -2
- package/dist/{cose-bilkent-S5V4N54A-C8A50UJc.cjs → cose-bilkent-S5V4N54A-Rhluulxd.cjs} +1 -1
- package/dist/{dagre-BM42HDAG-CctSzO0L.cjs → dagre-BM42HDAG-Bvc4ohUU.cjs} +1 -1
- package/dist/{dagre-BM42HDAG-B9o52kSq.js → dagre-BM42HDAG-C9fviEf-.js} +1 -1
- package/dist/{diagram-2AECGRRQ-DeefcALf.cjs → diagram-2AECGRRQ-CkQq6ZGh.cjs} +1 -1
- package/dist/{diagram-2AECGRRQ-DEOJdLIi.js → diagram-2AECGRRQ-paI55ZVp.js} +2 -2
- package/dist/{diagram-5GNKFQAL-DyxjjnMI.js → diagram-5GNKFQAL-CDMHctmr.js} +3 -3
- package/dist/{diagram-5GNKFQAL-C9cD2jn6.cjs → diagram-5GNKFQAL-DWCFHwPd.cjs} +1 -1
- package/dist/{diagram-KO2AKTUF-4juRrpvB.js → diagram-KO2AKTUF-BWWzWP62.js} +2 -2
- package/dist/{diagram-KO2AKTUF-Mo7XhFrv.cjs → diagram-KO2AKTUF-spfSwB_X.cjs} +1 -1
- package/dist/{diagram-LMA3HP47-CxL8EBEI.js → diagram-LMA3HP47-BT-BShmi.js} +2 -2
- package/dist/{diagram-LMA3HP47-BFs_xRRv.cjs → diagram-LMA3HP47-RAfpkFKr.cjs} +1 -1
- package/dist/{diagram-OG6HWLK6-BX-585Ye.js → diagram-OG6HWLK6-CIN-4ftA.js} +3 -3
- package/dist/{diagram-OG6HWLK6-CB1fsChK.cjs → diagram-OG6HWLK6-CqDudF-0.cjs} +1 -1
- package/dist/{erDiagram-TEJ5UH35-DC0Ho0nI.js → erDiagram-TEJ5UH35-D0fhsTuc.js} +4 -4
- package/dist/{erDiagram-TEJ5UH35-vPdDZRYq.cjs → erDiagram-TEJ5UH35-TOCz7Y2q.cjs} +1 -1
- package/dist/{flowDiagram-I6XJVG4X-7BW5uO8c.js → flowDiagram-I6XJVG4X-4f3A04iK.js} +6 -6
- package/dist/{flowDiagram-I6XJVG4X-BiRLUlz2.cjs → flowDiagram-I6XJVG4X-BInalcH7.cjs} +1 -1
- package/dist/{ganttDiagram-6RSMTGT7-Bhohg83R.js → ganttDiagram-6RSMTGT7-C8ScPSHu.js} +3 -3
- package/dist/{ganttDiagram-6RSMTGT7-BMrijLIp.cjs → ganttDiagram-6RSMTGT7-DEF_FmRR.cjs} +1 -1
- package/dist/{gitGraphDiagram-PVQCEYII-CwSJFsFx.js → gitGraphDiagram-PVQCEYII-CnKH0PHp.js} +3 -3
- package/dist/{gitGraphDiagram-PVQCEYII-Bq_8mOSi.cjs → gitGraphDiagram-PVQCEYII-DBwXskFh.cjs} +1 -1
- package/dist/index-DGyUqlaQ.cjs +1 -0
- package/dist/{index-dISfYziG.cjs → index-DeLd859U.cjs} +24 -24
- package/dist/{index-Dhd78ysx.js → index-NXlUEMwG.js} +1464 -1440
- package/dist/index-pGTHB93u.js +2820 -0
- package/dist/{infoDiagram-5YYISTIA-BNytnCXI.js → infoDiagram-5YYISTIA-D79y7lhu.js} +1 -1
- package/dist/{infoDiagram-5YYISTIA-B-PYR74F.cjs → infoDiagram-5YYISTIA-DOOxpQu0.cjs} +1 -1
- package/dist/{ishikawaDiagram-YF4QCWOH-4OKBUv_s.cjs → ishikawaDiagram-YF4QCWOH-3amMX1JK.cjs} +1 -1
- package/dist/{ishikawaDiagram-YF4QCWOH-BG80wXBr.js → ishikawaDiagram-YF4QCWOH-D7ka4Dej.js} +1 -1
- package/dist/{journeyDiagram-JHISSGLW-yt60VGMo.cjs → journeyDiagram-JHISSGLW-BARqx_B3.cjs} +1 -1
- package/dist/{journeyDiagram-JHISSGLW-g82mk2Fe.js → journeyDiagram-JHISSGLW-EBn4X8-a.js} +4 -4
- package/dist/{kanban-definition-UN3LZRKU-BmK56MSs.js → kanban-definition-UN3LZRKU-CBAKDyvM.js} +2 -2
- package/dist/{kanban-definition-UN3LZRKU-BFH_hAyY.cjs → kanban-definition-UN3LZRKU-D8iz27bT.cjs} +1 -1
- package/dist/{linear-BpsU0HcQ.js → linear-B2QSw8ao.js} +1 -1
- package/dist/{linear-zILWiTVq.cjs → linear-Fv7CLeZq.cjs} +1 -1
- package/dist/{mermaid.core-NivSZeQG.js → mermaid.core-ChK_QlLI.js} +35 -35
- package/dist/{mermaid.core-BvN-J_AM.cjs → mermaid.core-HBdKo8dE.cjs} +3 -3
- package/dist/{mindmap-definition-RKZ34NQL-BXoEIZmG.js → mindmap-definition-RKZ34NQL-C3uHES2i.js} +3 -3
- package/dist/{mindmap-definition-RKZ34NQL-C3LWrNPx.cjs → mindmap-definition-RKZ34NQL-PqVfSh0o.cjs} +1 -1
- package/dist/{pieDiagram-4H26LBE5-y5XnB67r.js → pieDiagram-4H26LBE5-aJvbTpKH.js} +3 -3
- package/dist/{pieDiagram-4H26LBE5-CN01uXEU.cjs → pieDiagram-4H26LBE5-slbguXAu.cjs} +1 -1
- package/dist/{quadrantDiagram-W4KKPZXB-DoHOsDDM.js → quadrantDiagram-W4KKPZXB-B1BYMfPp.js} +2 -2
- package/dist/{quadrantDiagram-W4KKPZXB-BdWRtxg8.cjs → quadrantDiagram-W4KKPZXB-Cqvftrp-.cjs} +1 -1
- package/dist/{requirementDiagram-4Y6WPE33-B6ltwG99.cjs → requirementDiagram-4Y6WPE33-CgVm8oUv.cjs} +1 -1
- package/dist/{requirementDiagram-4Y6WPE33-BUqcv09v.js → requirementDiagram-4Y6WPE33-Cn7GQxPf.js} +3 -3
- package/dist/{sankeyDiagram-5OEKKPKP-Dw_I3L5w.cjs → sankeyDiagram-5OEKKPKP-D7Lkmywe.cjs} +1 -1
- package/dist/{sankeyDiagram-5OEKKPKP-D3yaTkog.js → sankeyDiagram-5OEKKPKP-aWGj-ZP4.js} +1 -1
- package/dist/{sequenceDiagram-3UESZ5HK-Dlw7AYVR.js → sequenceDiagram-3UESZ5HK-CLsU-4UM.js} +3 -3
- package/dist/{sequenceDiagram-3UESZ5HK-Dw-Oo3gQ.cjs → sequenceDiagram-3UESZ5HK-PwX7e0rY.cjs} +1 -1
- package/dist/{stateDiagram-AJRCARHV-G5aGpm4h.js → stateDiagram-AJRCARHV-CqgrATuU.js} +2 -2
- package/dist/{stateDiagram-AJRCARHV-RlkILcfR.cjs → stateDiagram-AJRCARHV-vGqcl-KV.cjs} +1 -1
- package/dist/{stateDiagram-v2-BHNVJYJU-B5MqneJj.cjs → stateDiagram-v2-BHNVJYJU-HtcVKaju.cjs} +1 -1
- package/dist/{stateDiagram-v2-BHNVJYJU-U7btkN-c.js → stateDiagram-v2-BHNVJYJU-i2ltnCUr.js} +2 -2
- package/dist/{timeline-definition-PNZ67QCA-DZWO25QG.cjs → timeline-definition-PNZ67QCA-BK6Um61-.cjs} +1 -1
- package/dist/{timeline-definition-PNZ67QCA-I1bAZF32.js → timeline-definition-PNZ67QCA-CcAR4rsb.js} +2 -2
- package/dist/{vennDiagram-CIIHVFJN-OMVDPAYS.cjs → vennDiagram-CIIHVFJN-Cm13ds7X.cjs} +1 -1
- package/dist/{vennDiagram-CIIHVFJN-GqC6bKPW.js → vennDiagram-CIIHVFJN-Cp8snzHu.js} +1 -1
- package/dist/wandox.cjs +1 -1
- package/dist/wandox.css +1 -1
- package/dist/wandox.js +1 -1
- package/dist/wandox.umd.js +637 -637
- package/dist/{wardleyDiagram-YWT4CUSO-B_ri0S8_.js → wardleyDiagram-YWT4CUSO-CSbrbJrc.js} +2 -2
- package/dist/{wardleyDiagram-YWT4CUSO-BS6EQ76K.cjs → wardleyDiagram-YWT4CUSO-D9nb2LzZ.cjs} +1 -1
- package/dist/{xychartDiagram-2RQKCTM6-BIi1O5Px.cjs → xychartDiagram-2RQKCTM6-6BlgLg2e.cjs} +1 -1
- package/dist/{xychartDiagram-2RQKCTM6-VaspgPkc.js → xychartDiagram-2RQKCTM6-DpAMV2MM.js} +2 -2
- package/package.json +1 -1
- package/dist/V2Workbench-a7fIKHSI.js +0 -2352
- package/dist/V2Workbench-tUL0KmKo.cjs +0 -2
- package/dist/index-Bl0cgfIz.cjs +0 -1
- package/dist/index-BygO8jcH.cjs +0 -1
- package/dist/index-CQYJcpLn.js +0 -2520
- package/dist/index-RmIugmM4.js +0 -307
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DeLd859U.cjs"),h=require("./WorkbenchRuntime-jXXGAqkE.cjs"),Bt=require("./index-DGyUqlaQ.cjs");var ks={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 144H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm0 400H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zM464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm0 400H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16z"}}]},name:"appstore",theme:"filled"};function lt(){return lt=Object.assign?Object.assign.bind():function(o){for(var c=1;c<arguments.length;c++){var u=arguments[c];for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(o[d]=u[d])}return o},lt.apply(this,arguments)}const vs=(o,c)=>e.reactExports.createElement(e.Icon,lt({},o,{ref:c,icon:ks})),Ns=e.reactExports.forwardRef(vs);var Cs={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M320 224h-66v-56c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v56h-66c-4.4 0-8 3.6-8 8v560c0 4.4 3.6 8 8 8h66v56c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8v-56h66c4.4 0 8-3.6 8-8V232c0-4.4-3.6-8-8-8zm-60 508h-80V292h80v440zm644-436h-66v-96c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v96h-66c-4.4 0-8 3.6-8 8v416c0 4.4 3.6 8 8 8h66v96c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8v-96h66c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8zm-60 364h-80V364h80v296zM612 404h-66V232c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v172h-66c-4.4 0-8 3.6-8 8v200c0 4.4 3.6 8 8 8h66v172c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8V620h66c4.4 0 8-3.6 8-8V412c0-4.4-3.6-8-8-8zm-60 145a3 3 0 01-3 3h-74a3 3 0 01-3-3v-74a3 3 0 013-3h74a3 3 0 013 3v74z"}}]},name:"sliders",theme:"outlined"};function xt(){return xt=Object.assign?Object.assign.bind():function(o){for(var c=1;c<arguments.length;c++){var u=arguments[c];for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(o[d]=u[d])}return o},xt.apply(this,arguments)}const Ss=(o,c)=>e.reactExports.createElement(e.Icon,xt({},o,{ref:c,icon:Cs})),zt=e.reactExports.forwardRef(Ss);var Is={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"unordered-list",theme:"outlined"};function dt(){return dt=Object.assign?Object.assign.bind():function(o){for(var c=1;c<arguments.length;c++){var u=arguments[c];for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(o[d]=u[d])}return o},dt.apply(this,arguments)}const $s=(o,c)=>e.reactExports.createElement(e.Icon,dt({},o,{ref:c,icon:Is})),As=e.reactExports.forwardRef($s);function qt(o){return{category:null,description:o.desc,domain:"",id:0,name:o.title,playbook_id:o.playbook_id,scope:"",status:"",sub_category:null,tags:null,type:"",version:"",video_url:o.video_url,video_duration:o.video_duration,view_count:o.view_count}}function Wt(o){if(!o||o<=0)return"0:00";const c=Math.floor(o/60),u=String(Math.floor(o%60)).padStart(2,"0");return`${c}:${u}`}const ct="__all__",Ft="__my__",it="__library_all__",Ms="__library__:",Ps=[{key:"all",label:"全部场景"},{key:"my",label:"我的场景"},{key:"map",label:"使用地图"}];function Ts(o){return o==="map"?"搜索当前地图下的场景":o==="my"?"搜索我的场景":"搜索全部场景"}function Ds({open:o,source:c,categories:u,categoryKey:d,search:m,cards:w,executing:$,loadingPlaybookId:j,onClose:v,onSourceChange:D,onCategoryChange:se,onSearchChange:Y,onSelectScene:re}){const[N,W]=e.reactExports.useState(null),A=e.reactExports.useMemo(()=>N?qt(N):null,[N]),k=e.reactExports.useCallback((x,F)=>{x.stopPropagation(),W(F)},[]);return e.jsxRuntimeExports.jsxs(Bt.Drawer,{open:o,onClose:v,placement:"bottom",height:"min(82vh, 780px)",destroyOnClose:!1,styles:{body:{padding:0,background:"var(--wc-bg)"},header:{display:"none"}},getContainer:!1,title:null,closeIcon:null,push:!1,children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-chat__drawer",children:[e.jsxRuntimeExports.jsxs("header",{className:"wandox-console-chat__drawer-top",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__drawer-title",children:e.jsxRuntimeExports.jsx("nav",{className:"wandox-console-chat__drawer-tabs","aria-label":"场景来源",children:Ps.map(x=>e.jsxRuntimeExports.jsx("button",{type:"button",className:c===x.key?"is-active":"",onClick:()=>D(x.key),children:x.label},x.key))})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-console-chat__drawer-close",onClick:v,"aria-label":"关闭",children:e.jsxRuntimeExports.jsx(e.RefIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-chat__drawer-middle",children:[c!=="my"&&e.jsxRuntimeExports.jsxs("aside",{className:"wandox-console-chat__drawer-cats",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__drawer-catslabel",children:"场景分类"}),u.map(x=>{const F=x.key===d;return e.jsxRuntimeExports.jsxs("button",{type:"button",className:`wandox-console-chat__drawer-cat${F?" wandox-console-chat__drawer-cat--active":""}`,onClick:()=>se(x.key),children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-console-chat__drawer-cat-name",children:x.name}),e.jsxRuntimeExports.jsx("span",{className:"wandox-console-chat__drawer-cat-count",children:x.count})]},x.key)})]}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-chat__drawer-body",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__drawer-toolbar",children:e.jsxRuntimeExports.jsx(e.Input,{allowClear:!0,prefix:e.jsxRuntimeExports.jsx(e.RefIcon$1,{}),placeholder:Ts(c),value:m,onChange:x=>Y(x.target.value)})}),w.length===0?e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__drawer-empty",children:m?"没有匹配的场景":"暂无可用场景"}):e.jsxRuntimeExports.jsx("div",{className:"wandox-console-scenes",children:w.map(x=>{const F=j===x.playbook_id;return e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-scene-wrap",children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-console-scene",disabled:$||!!j,"aria-busy":F,onClick:()=>void re(x),children:e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-scene__body",children:[e.jsxRuntimeExports.jsx("strong",{title:x.title,children:x.title}),x.desc&&e.jsxRuntimeExports.jsx("span",{className:"wandox-console-scene__desc",title:x.desc,children:x.desc}),F&&e.jsxRuntimeExports.jsx("span",{className:"wandox-console-scene__loading",children:"正在读取场景..."})]})}),x.video_url&&e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-console-scene__video","aria-label":`播放${x.title}演示视频`,onClick:ce=>k(ce,x),children:["▶ ",Wt(x.video_duration)," 演示"]})]},x.key)})})]})]})]}),e.jsxRuntimeExports.jsx(e.PlaybookVideoModal,{playbook:A,onClose:()=>W(null)})]})}const Fs=o=>{const{onError:c}=o;c==null||c(new Error("该场景暂不支持文件上传"))};function Ht({field:o,value:c,uploading:u,fileNameMap:d,getOptionState:m,onChange:w,onUpload:$}){const j=h.isMultiValueType(o.type),v=$??((D,se)=>Fs);return e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-field",children:[e.jsxRuntimeExports.jsxs("label",{htmlFor:`wc-param-${o.name}`,children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-console-field__label-text",children:o.label||o.name}),o.description||o.hint?e.jsxRuntimeExports.jsx(e.Tooltip,{title:o.description||o.hint,children:e.jsxRuntimeExports.jsx(e.RefIcon$2,{"aria-label":`${o.label||o.name}说明`})}):null,o.required&&e.jsxRuntimeExports.jsx("span",{className:"wandox-console-field__required",children:"必填"}),j&&e.jsxRuntimeExports.jsx("span",{className:"wandox-console-field__required",children:"多值"})]}),e.jsxRuntimeExports.jsx(h.AgentInputFieldControl,{field:o,value:c,uploading:u,fileNameMap:d,getOptionState:m,onChange:w,onUpload:v,onDownloadTemplate:D=>window.open(D.path,"_blank","noopener,noreferrer")})]})}function Ls(o){if(Array.isArray(o))return o;const c=o;return Array.isArray(c==null?void 0:c.user_playbooks)?c.user_playbooks:[]}function Vs({agentId:o,agentName:c,playbookId:u,playbookParams:d,initialMessage:m,initialAttachments:w,useMapCards:$=[],useMapCategories:j=[],playbooks:v=[],userPlaybooks:D=[],agents:se=[],onChangeAgent:Y,onBack:re,onSelectScene:N,onReady:W}){const A=localStorage.getItem("sso_token")||"",k=localStorage.getItem("sso_domain")||"maiduo",x=localStorage.getItem("sso_company")||"",F=e.reactExports.useRef(null),ce=e.reactExports.useRef(!1),[L,S]=e.reactExports.useState(!1),[H,oe]=e.reactExports.useState(""),[ne,U]=e.reactExports.useState(""),[V,K]=e.reactExports.useState("map"),[Q,ie]=e.reactExports.useState(ct),[C,O]=e.reactExports.useState(null),fe=e.reactExports.useRef(null),pe=e.reactExports.useRef(null),[le,Ee]=e.reactExports.useState(!1),[me,Ne]=e.reactExports.useState([]),[X,Re]=e.reactExports.useState("");e.reactExports.useEffect(()=>{if(!C||L)return;const t=setTimeout(()=>{var s;(s=fe.current)==null||s.focus()},120);return()=>clearTimeout(t)},[C,L]),e.reactExports.useEffect(()=>{if(!C||L)return;const t=s=>{const a=pe.current,r=s.target;!a||!(r instanceof Node)||a.contains(r)||r instanceof Element&&r.closest(".ant-select-dropdown, .ant-picker-dropdown, .ant-tooltip, .ant-dropdown, .ant-popover, .ant-modal-wrap, .ant-drawer-content-wrapper, .ant-message, .ant-notification")||(O(null),ae([]),z({}))};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[C,L]);const[Z,ae]=e.reactExports.useState([]),[M,z]=e.reactExports.useState({}),I=e.useDynamicFieldOptions(Z,M,z),we=e.reactExports.useMemo(()=>h.getVisibleInputFields(Z,M).filter(t=>t.required&&h.isMissingFieldValue(M[t.name])),[Z,M]),[ee,p]=e.reactExports.useState("chat"),[y,be]=e.reactExports.useState([]),[B,ye]=e.reactExports.useState(null),[xe,$e]=e.reactExports.useState("results"),[Ze,Ce]=e.reactExports.useState(!1),[J,n]=e.reactExports.useState([]),[E,f]=e.reactExports.useState(!1),[_,g]=e.reactExports.useState([]),[de,ge]=e.reactExports.useState([]),[q,G]=e.reactExports.useState({}),[Se,ke]=e.reactExports.useState(!1),[P,Ae]=e.reactExports.useState(null),[Ve,Ie]=e.reactExports.useState(void 0),[Oe,Be]=e.reactExports.useState(!1),[Ut,ut]=e.reactExports.useState(!1);e.reactExports.useEffect(()=>{W==null||W({showInspectionResults:t=>{p("robot"),$e("results"),ye(t||null)}})},[W]);const[Me,Kt]=e.reactExports.useState([]),[Pe,ve]=e.reactExports.useState(!1),[ze,Gt]=e.reactExports.useState(void 0),[pt,mt]=e.reactExports.useState([]),[Je,ht]=e.reactExports.useState(""),[et,Yt]=e.reactExports.useState("map"),[Qt,Te]=e.reactExports.useState(void 0),qe=e.reactExports.useRef(0),De=e.reactExports.useRef(0),[We,jt]=e.reactExports.useState(e.EMPTY_SCHEDULE_DIALOG),[tt,_t]=e.reactExports.useState({}),[He,Et]=e.reactExports.useState(()=>new Set),st=e.reactExports.useCallback((t,s,a)=>({key:`${s}-${t.playbook_id}`,title:t.name||"未命名场景",desc:t.description||"",reason:a,tags:[],playbook_id:t.playbook_id,input_fields:t.input_fields||[],categoryKey:s,video_url:t.video_url,video_duration:t.video_duration,view_count:t.view_count}),[]),Fe=e.reactExports.useMemo(()=>{const t=D.map(l=>st(l,Ft,"我的场景")),s=new Map;for(const l of v){const R=l.category_name||l.category||l.type||"默认场景",b=`${Ms}${R}`,_e=s.get(b)||[];_e.push(st(l,b,R)),s.set(b,_e)}const a=Array.from(s.values()).flat(),r=[{key:it,name:"全部场景",count:a.length,cards:a},...Array.from(s,([l,R])=>{var b;return{key:l,name:((b=R[0])==null?void 0:b.reason)||"默认场景",count:R.length,cards:R}})],i=[{key:ct,name:"全部场景",count:$.length,cards:$},...j.map(l=>({key:l.key,name:l.name,count:l.count,cards:$.filter(R=>R.categoryKey===l.key)}))];return{allCategories:r,mapCategories:i,myCards:t}},[c,v,st,$,j,D]),ot=e.reactExports.useMemo(()=>V==="all"?Fe.allCategories:V==="map"?Fe.mapCategories:[],[Fe,V]),Ue=e.reactExports.useMemo(()=>$.map(t=>({category:null,category_name:t.reason,description:t.desc,domain:"",id:0,name:t.title,playbook_id:t.playbook_id,scope:"usemap",status:"available",sub_category:null,tags:t.tags.map(s=>s.name),input_fields:t.input_fields,video_url:t.video_url,video_duration:t.video_duration,view_count:t.view_count,type:"",version:""})),[$]),Xt=e.reactExports.useMemo(()=>{const t=new Map;for(const s of[...v,...D,...Ue])s.playbook_id&&t.set(s.playbook_id,s);return Array.from(t.values())},[v,D,Ue]),Zt=e.reactExports.useMemo(()=>{const t=new Map;for(const s of v){const a=s.category_name||s.category||s.type||"默认场景",r=t.get(a)||[];r.push(s),t.set(a,r)}return[{key:"__my__",label:"我的场景",playbooks:[]},...Array.from(t,([s,a])=>({key:`all:${s}`,label:s,playbooks:a}))]},[v]),Jt=e.reactExports.useMemo(()=>{const t=new Map(Ue.map(s=>[s.playbook_id,s]));return j.map(s=>({key:`map:${s.key}`,label:s.name,playbooks:$.filter(a=>a.categoryKey===s.key).map(a=>t.get(a.playbook_id)).filter(a=>!!a)}))},[$,j,Ue]),es=et==="map"?Jt:Zt,ts=e.reactExports.useMemo(()=>{var a;const t=ne.trim().toLowerCase(),s=V==="my"?Fe.myCards:((a=ot.find(r=>r.key===Q))==null?void 0:a.cards)||[];return t?s.filter(r=>r.title.toLowerCase().includes(t)||r.desc.toLowerCase().includes(t)):s},[ot,Q,Fe.myCards,V,ne]),ss=e.reactExports.useCallback(t=>{const s=Array.isArray(t)?t:[];Kt(s),ve(s.length>0)},[]),ue=e.reactExports.useMemo(()=>se.find(t=>t.id===o),[se,o]),{messageData:os,executing:T,stopping:ns,actions:as}=h.useWorkbenchSession({activeAgent:o,ssoToken:A,ssoDomain:k,ssoCompany:x,onRecommendationsUpdate:ss}),{sendMessage:Ke,executePlaybook:bt,respondToProposal:ft,stopCurrent:rs,retrigger:Rt}=as,{messages:he,messagesTotal:wt,loading:yt,loadMessages:gt,loadMoreMessages:kt}=os,Ge=e.reactExports.useMemo(()=>{for(let t=he.length-1;t>=0;t--)if(he[t].role==="assistant")return he[t].id},[he]),Ye=e.reactExports.useCallback(async()=>{if(!o||!A){mt([]);return}try{const t=await e.GET_Api_V1_Playbooks_RecentExecuted({agent_id:o,limit:8});mt(Array.isArray(t.data)?t.data:[])}catch{}},[o,A]);e.reactExports.useEffect(()=>{Ye()},[Ye]);const te=e.reactExports.useCallback(async t=>{await bt(t),Ye()},[bt,Ye]),vt=e.reactExports.useCallback(async t=>{const s=String(t.playbook_id||"").trim();if(!s)throw new Error("场景缺少 playbook_id");const{data:a}=await e.GET_Api_V1_Playbooks_Detail({playbook_id:s});return e.mergePlaybookDetail(t,a)},[]);e.reactExports.useEffect(()=>{ce.current||(ce.current=!0,(async()=>{if(await gt(),u){const t=(m==null?void 0:m.trim())||"执行场景";te({message:t,playbook_id:u,playbook_params:d||{}})}else m!=null&&m.trim()&&Ke(m.trim(),void 0,w)})())},[u,m,w,d,te,gt,Ke]),e.reactExports.useEffect(()=>{if(!o)return;let t=!1;return(async()=>{try{const{data:s}=await e.GET_Api_V1_Agents_Detail({agent_id:o});if(t)return;const a=(s==null?void 0:s.children)||[];be(a),ye(null)}catch{be([])}})(),()=>{t=!0}},[o]),e.reactExports.useEffect(()=>{Ge&&Ge!==ze&&Gt(Ge)},[Ge,ze]),e.reactExports.useEffect(()=>{if(ee!=="robot"||xe!=="history"||!B){n([]);return}const t=y.find(a=>a.name===B);if(!t)return;let s=!1;return Ce(!0),(async()=>{try{const a=await e.GET_Api_V1_Agents_ActionExecutes({agent_id:t.agent_id,limit:50});if(s)return;const i=(Array.isArray(a==null?void 0:a.data)?a.data:[]).map((l,R)=>({id:l.id||l.execute_id||`record_${R}`,action_name:l.action_name||l.display_name||"未知动作",status:l.status||"pending",created_at:l.created_at||"",completed_at:l.completed_at,output_data:l.output_data,error:l.error}));n(i)}catch{n([])}finally{s||Ce(!1)}})(),()=>{s=!0}},[ee,xe,B,y]);const Nt=e.reactExports.useCallback(async()=>{try{const t=await e.GET_Api_V1_Notification_Webhooks({});Array.isArray(t==null?void 0:t.data)&&ge(t.data.map(s=>({webhook_id:s.webhook_id||"",name:s.name||"未命名渠道",platform:s.platform||""})))}catch{}},[]),Qe=e.reactExports.useCallback(async()=>{try{const t={};await Promise.all(y.map(async s=>{var a;try{const r=await e.GET_Api_V1_Notification_Agents_Webhook_ByAgentId(s.agent_id,{}),i=(a=r==null?void 0:r.data)==null?void 0:a.webhook_id;i&&(t[s.agent_id]=i)}catch{}})),G(t)}catch{}},[y]),Ct=e.reactExports.useCallback(async()=>{if(o){f(!0);try{const t=await e.GET_Api_V1_Agents_Workspaces({agent_id:o,limit:20,use_cache:!1}),a=(Array.isArray(t==null?void 0:t.data)?t.data:[]).map(r=>{const i=r.ui_payload||r.outputs||void 0;return{id:r.inbox_id||r.id||"",title:r.title||"巡检结果",summary:r.summary||"",priority:r.priority||"medium",timestamp:r.created_at||"",ui_payload:i,agent_name:r.agent_name||r.agent_id||""}}).sort((r,i)=>new Date(i.timestamp||0).getTime()-new Date(r.timestamp||0).getTime());g(a)}catch{g([])}finally{f(!1)}}},[o]);e.reactExports.useEffect(()=>{Nt(),y.length>0&&Qe()},[y,Nt,Qe]),e.reactExports.useEffect(()=>{ee==="robot"&&xe==="results"&&Ct()},[ee,xe,Ct]);const cs=t=>{Ae(t),Ie(q[t.agent_id]),ke(!0)},is=async()=>{if(!P||!Ve){e.staticMethods.warning("请选择通知渠道");return}try{Be(!0),await e.POST_Api_V1_Notification_Agents_Webhook({},{agent_id:P.agent_id,webhook_id:Ve}),e.staticMethods.success("绑定成功"),ke(!1),await Qe()}catch(t){e.staticMethods.error((t==null?void 0:t.message)||"绑定失败")}finally{Be(!1)}},ls=async()=>{if(P)try{Be(!0),await e.DELETE_Api_V1_Notification_Agents_Webhook_Delete_ByAgentId(P.agent_id,{}),e.staticMethods.success("解绑成功"),ke(!1),Ie(void 0),await Qe()}catch(t){e.staticMethods.error((t==null?void 0:t.message)||"解绑失败")}finally{Be(!1)}},nt=e.reactExports.useMemo(()=>B?_.filter(t=>{var r;const s=(r=t.title)==null?void 0:r.match(/^(.+?)\s*巡检结果$/);return(s?s[1]:t.agent_name)===B}):_,[_,B]),xs=t=>{if(!t)return"";try{return new Date(t).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return t}},at=e.reactExports.useCallback((t,s,a)=>{if(ve(!1),s){te({message:t,playbook_id:s});return}Ke(t,void 0,a)},[te,Ke]),ds=e.reactExports.useCallback(t=>{K(t),ie(t==="all"?it:t==="map"?ct:Ft),U(""),O(null),ae([]),z({})},[]),us=e.reactExports.useCallback(()=>{K("all"),ie(it),U(""),O(null),ae([]),z({}),S(!0)},[]),ps=e.reactExports.useCallback(()=>{S(!1),O(null),ae([]),z({})},[]),je=e.reactExports.useCallback((t,s={})=>{O({key:t.playbook_id,playbook_id:t.playbook_id,title:t.name,desc:t.description??"",reason:"",tags:[],categoryKey:"",input_fields:t.input_fields||[]});const a=e.normalizeAgentInputFields(t.input_fields||[]);ae(a),z(h.buildDefaultInputValues(a,s))},[]),ms=e.reactExports.useCallback(async t=>{var a;if(T||H)return;const s=String(t.playbook_id||"").trim();if(!s){e.staticMethods.error("场景缺少 playbook_id");return}oe(s);try{const r={category:null,category_name:t.reason||void 0,description:t.desc,domain:"",id:0,name:t.title,playbook_id:s,scope:"",status:"available",sub_category:null,tags:t.tags.map(R=>R.name),type:"",version:"",input_fields:t.input_fields,video_url:t.video_url,video_duration:t.video_duration,view_count:t.view_count},{data:i}=await e.GET_Api_V1_Playbooks_Detail({playbook_id:s});if(!i||typeof i!="object"||Array.isArray(i))throw new Error("场景详情为空");const l=e.mergePlaybookDetail(r,i);if(S(!1),(a=l.input_fields)!=null&&a.length){je(l);return}at(l.name,l.playbook_id),N==null||N(t)}catch(r){const i=r instanceof Error?r.message:"场景加载失败";e.staticMethods.error(i)}finally{oe("")}},[T,je,at,N,H]),St=e.reactExports.useCallback(async t=>{if(!T){if(ve(!1),t.input_fields&&t.input_fields.length>0){je(t);return}try{await te({message:t.name,playbook_id:t.playbook_id})}catch(s){const a=s instanceof Error?s.message:"执行失败";e.staticMethods.error(a)}}},[T,te,je]),hs=e.reactExports.useCallback(async t=>{var a;if(T||Je)return;const s=String(t.playbook_id||"").trim();if(s){ht(s),ve(!1);try{const r=e.extractRecentPlaybookValues(t),i=await vt(t);if((a=i.input_fields)!=null&&a.length){je(i,r);return}await te({message:i.name,playbook_id:i.playbook_id})}catch(r){const i=r instanceof Error?r.message:"场景参数加载失败";e.staticMethods.error(i)}finally{ht("")}}},[T,te,je,vt,Je]),js=e.reactExports.useCallback(async()=>{if(!C||T)return;const s=h.getVisibleInputFields(Z,M).filter(i=>i.required&&h.isMissingFieldValue(M[i.name]));if(s.length>0){e.staticMethods.warning(`请先填写 ${s.length} 项必填参数`);return}S(!1),ve(!1);const a=C,r=M;O(null),ae([]),z({});try{const i=a.title||(m==null?void 0:m.trim())||"执行场景";await te({message:i,playbook_id:a.playbook_id,playbook_params:r}),N==null||N(a)}catch(i){const l=i instanceof Error?i.message:"执行失败";e.staticMethods.error(l)}},[C,Z,M,T,te,m,N]),_s=e.reactExports.useCallback(t=>{De.current+=1,Te({requestId:++qe.current,playbooks:t})},[]),Es=e.reactExports.useCallback(()=>{const t=++De.current;Te({requestId:++qe.current,playbooks:[],loading:!0}),(async()=>{await new Promise(s=>{window.requestAnimationFrame(()=>s())});try{const{data:s}=await e.GET_Api_V1_Agents_UserPlaybooks({agent_id:o});if(t!==De.current)return;Te({requestId:++qe.current,playbooks:Ls(s)})}catch{if(t!==De.current)return;e.staticMethods.error("我的场景加载失败"),Te({requestId:++qe.current,playbooks:[]})}})()},[o]),bs=e.reactExports.useCallback(t=>{Te(s=>(s==null?void 0:s.requestId)===t?void 0:s)},[]),fs=e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-chat__scene-quick",children:[e.jsxRuntimeExports.jsx(e.Dropdown,{menu:{selectedKeys:[et],items:[{key:"all",label:"全部场景"},{key:"map",label:"使用地图"}],onClick:({key:t})=>{De.current+=1,Yt(t)}},trigger:["click"],placement:"topLeft",children:e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-console-chat__scene-source",disabled:T,children:[e.jsxRuntimeExports.jsx("span",{children:et==="map"?"使用地图":"全部场景"}),e.jsxRuntimeExports.jsx("svg",{className:"wandox-console-chat__scene-source-arrow",width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",focusable:"false",children:e.jsxRuntimeExports.jsx("path",{d:"M8.413 0.963a2 2 0 0 1 2.738.712l4.872 8.301a4 4 0 0 1 0 4.049l-4.872 8.3a2 2 0 1 1-3.45-2.025L12.574 12 7.701 3.7A2 2 0 0 1 8.413.963Z"})})]})}),e.jsxRuntimeExports.jsx("span",{className:"wandox-console-chat__scene-separator","aria-hidden":!0,children:"|"}),e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__scene-categories",children:es.map(t=>e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-console-chat__choose-scene",disabled:T,onClick:()=>t.key==="__my__"?Es():_s(t.playbooks),children:t.label},t.key))})]}),It=e.reactExports.useCallback(async t=>{var l;const s=(l=t.meta_content)!=null&&l.playbook_id?"数据报表":"对话内容",a=new Date().toISOString().slice(0,10);if(e.isTableMessage(t)){const R=e.getTableExportData(t);if(!R){e.staticMethods.warning("没有可导出的表格数据");return}const b=R.fields.map(rt=>rt.label).join(","),_e=R.rows.map(rt=>R.fields.map(gs=>e.toCsvCell(rt[gs.name])).join(",")),ys=`\uFEFF${[b,..._e].join(`
|
|
2
|
+
`)}`;e.downloadBlob(new Blob([ys],{type:"text/csv;charset=utf-8;"}),`${s}_${a}.csv`);return}const r=document.querySelector(`[data-message-id="${t.message_id||t.id}"] .wandox-message-content`);if(!r){e.staticMethods.warning("无法定位消息内容");return}const i=window.open("","_blank");if(!i){e.staticMethods.warning("请允许弹出窗口");return}i.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8"><title>${s}_${a}</title><style>body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;padding:20px;color:#333}table{border-collapse:collapse;width:100%}th,td{border:1px solid #d9d9d9;padding:6px 8px;font-size:13px;text-align:left}th{background:#fafafa}img{max-width:100%}pre{white-space:pre-wrap;word-break:break-all;font-size:12px;background:#f5f5f5;padding:12px;border-radius:4px}button,.ant-btn,.ant-tooltip-open{display:none!important}</style></head><body>${r.innerHTML}</body></html>`),i.document.close(),i.onload=()=>{i.print(),i.close()}},[]),$t=e.reactExports.useCallback(t=>{var i,l,R;const s=he.find(b=>b.message_id===t||b.id===t),a=e.getMessagePlaybookId(s);if(!a){e.staticMethods.warning("缺少场景 ID,无法配置定时触发");return}const r=((l=(i=s==null?void 0:s.actions)==null?void 0:i.find(b=>b.playbook_id===a))==null?void 0:l.display_name)||((R=s==null?void 0:s.meta_content)==null?void 0:R.playbook_name)||a;jt({visible:!0,messageId:t,agentId:o,playbookId:a,playbookName:r})},[o,he]),Rs=e.reactExports.useCallback(()=>{jt(e.EMPTY_SCHEDULE_DIALOG)},[]),Xe=e.reactExports.useCallback(t=>{const s=t.message_id;return s&&Object.prototype.hasOwnProperty.call(tt,s)?tt[s]:e.getMessageFeedbackRating(t)},[tt]),At=e.reactExports.useCallback(async(t,s,a)=>{var R;const r=t.message_id;if(!r||He.has(r))return!1;const i=Xe(t),l=e.getNextMessageFeedbackRating(i,s);_t(b=>({...b,[r]:l})),Et(b=>new Set(b).add(r));try{const b=await e.POST_Api_V1_Agents_Messages_Feedback({domain:k},{message_id:r,rating:l,tags:(R=a==null?void 0:a.tags)!=null&&R.length?a.tags:void 0,text:(a==null?void 0:a.text)||void 0});if((b==null?void 0:b.success)===!1)throw new Error(b.message||"反馈提交失败");return!0}catch(b){return _t(_e=>({..._e,[r]:i})),e.staticMethods.error(b instanceof Error?b.message:"反馈提交失败,请稍后重试"),!1}finally{Et(b=>{const _e=new Set(b);return _e.delete(r),_e})}},[He,Xe,k]),Mt=e.reactExports.useCallback(async t=>{ve(!1);try{await Rt(t)}catch(s){const a=s instanceof Error?s.message:"重新生成失败";e.staticMethods.error(a)}},[Rt]),Pt=e.reactExports.useCallback(()=>{ve(t=>!t)},[]),Tt=e.reactExports.useCallback((t,s)=>{if(t.role!=="assistant"||t.execution_status==="executing")return null;const r=s&&t.id===ze&&Me.length>0,i=Pe?"隐藏推荐":r?`显示推荐(${Me.length})`:"推荐";return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.MessageToolbar,{msg:t,domain:k,onExportMessage:It,exportIcon:"copy",showSolidify:!1,onOpenScheduleDialog:$t,onRetrigger:Mt,feedbackRating:Xe(t),feedbackPending:!!t.message_id&&He.has(t.message_id),onFeedback:At,extraActions:r?e.jsxRuntimeExports.jsx(e.Tooltip,{title:i,children:e.jsxRuntimeExports.jsxs("button",{type:"button",className:`wandox-console-chat__toolbar-toggle${Pe?" is-active":""}`,"aria-label":i,"aria-expanded":Pe,onClick:Pt,children:[e.jsxRuntimeExports.jsx(As,{}),e.jsxRuntimeExports.jsx("span",{className:"wandox-console-chat__toolbar-toggle-count",children:Me.length})]})}):null}),r&&Pe&&e.jsxRuntimeExports.jsx("ul",{className:"wandox-console-chat__recommendations","aria-label":"推荐场景",children:Me.map((l,R)=>e.jsxRuntimeExports.jsx("li",{className:"wandox-console-chat__recommendations-item",children:e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-console-chat__recommendations-pill",disabled:T,onClick:()=>{St(l)},title:l.description||l.name,children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-console-chat__recommendations-pill-label",children:l.name}),e.jsxRuntimeExports.jsx("span",{className:"wandox-console-chat__recommendations-pill-arrow",children:e.jsxRuntimeExports.jsx(h.RefIcon,{})})]})},`${l.playbook_id||l.name}-${R}`))})]})},[T,He,Xe,St,It,At,$t,Mt,Me,ze,Pe,k,Pt]),Dt=e.reactExports.useCallback((t,s)=>{Re(t),Ne(s),Ee(!0)},[]),ws=e.reactExports.useMemo(()=>e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-chat__body",children:[e.jsxRuntimeExports.jsx(e.ChatMessageList,{messages:he,executing:T,ssoToken:A,ssoDomain:k,ssoCompany:x,onExecutePlaybook:te,onFillPlaybookParams:t=>je({category:null,domain:"",id:0,name:t.playbookName,playbook_id:t.playbookId,scope:"",status:"available",sub_category:null,tags:null,type:"",version:"",input_fields:t.inputFields,playbook_type:t.playbookType},t.initialParams??{}),onRespondToProposal:ft,containerRef:F,messagesTotal:wt,loadMoreMessages:kt,loading:yt,initialLoadingContent:e.jsxRuntimeExports.jsx(e.ChatHistoryLoading,{}),conversationKey:o,messageToolbar:Tt,onOpenActionDrawer:Dt}),e.jsxRuntimeExports.jsx(e.ConversationOutline,{messages:he,scrollContainerRef:F,mode:"deepseek"})]}),[o,te,T,je,kt,he,yt,wt,Dt,Tt,ft,x,k,A]);return e.jsxRuntimeExports.jsxs("div",{className:"wandox-root wandox-console-chat",children:[e.jsxRuntimeExports.jsxs("header",{className:"wandox-console-chat__top",children:[e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-console-chat__back",onClick:re,children:[e.jsxRuntimeExports.jsx(h.RefIcon$1,{}),e.jsxRuntimeExports.jsx("span",{children:"返回"})]}),e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__agent-selector",children:e.jsxRuntimeExports.jsx(e.Dropdown,{menu:{items:se.map(t=>({key:t.id,disabled:t.id===o,label:e.jsxRuntimeExports.jsxs("span",{className:"wandox-console-agent-menu-item",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-console-agent-menu-item__icon",children:t.icon}),e.jsxRuntimeExports.jsx("span",{className:"wandox-console-agent-menu-item__name",children:t.name}),t.id===o&&e.jsxRuntimeExports.jsx(e.RefIcon$4,{className:"wandox-console-agent-menu-item__check"})]})})),onClick:({key:t})=>Y==null?void 0:Y(t)},trigger:["click"],placement:"bottomLeft",children:e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-console-chat__title","aria-label":"切换智能体",title:"切换智能体",children:[(ue==null?void 0:ue.icon)&&e.jsxRuntimeExports.jsx("span",{className:"wandox-console-chat__title-icon",children:ue.icon}),e.jsxRuntimeExports.jsx("span",{className:"wandox-console-chat__title-name",children:c||(ue==null?void 0:ue.name)||"智能体"}),e.jsxRuntimeExports.jsx(e.RefIcon$3,{className:"wandox-console-chat__title-arrow"})]})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-console-chat__all-scenes",disabled:T,onClick:us,children:[e.jsxRuntimeExports.jsx(Ns,{}),e.jsxRuntimeExports.jsx("span",{children:"全部场景"})]}),e.jsxRuntimeExports.jsx(h.AgentPackageTag,{benefit:ue==null?void 0:ue.packageBenefit})]}),e.jsxRuntimeExports.jsxs("nav",{className:"wandox-console-chat__topbar",children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:`wandox-console-chat__topbar-tab ${ee==="chat"?"active":""}`,onClick:()=>p("chat"),children:"智能体会话"}),e.jsxRuntimeExports.jsx("button",{type:"button",className:`wandox-console-chat__topbar-tab ${ee==="robot"?"active":""}`,onClick:()=>{p("robot"),ye(null)},children:e.jsxRuntimeExports.jsx("span",{children:"巡检机器人"})})]}),ee==="chat"?ws:e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-chat__robot",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__robot-chips",children:y.length===0?e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__robot-empty",children:"该智能体暂无巡检机器人"}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[y.length>0&&e.jsxRuntimeExports.jsx("button",{type:"button",className:`wandox-console-chat__robot-chip ${B===null?"active":""}`,onClick:()=>ye(null),children:"全部"}),y.map(t=>{const s=!!q[t.agent_id];return e.jsxRuntimeExports.jsxs("div",{className:`wandox-console-chat__robot-chip-compound ${B===t.name?"active":""}`,children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-console-chat__robot-chip-name",onClick:()=>ye(t.name),children:t.name}),e.jsxRuntimeExports.jsx("button",{type:"button",className:`wandox-console-chat__robot-chip-bind ${s?"bound":""}`,onClick:()=>cs(t),title:s?"已绑定通知渠道,点击修改":"绑定通知渠道",children:s?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-console-chat__robot-chip-bind-dot","aria-hidden":"true"}),e.jsxRuntimeExports.jsx("span",{children:"已通知"})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(h.RefIcon$2,{}),e.jsxRuntimeExports.jsx("span",{children:"通知"})]})})]},t.agent_id)})]})}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-chat__robot-tabs",children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:`wandox-console-chat__robot-tab ${xe==="results"?"active":""}`,onClick:()=>$e("results"),children:"巡检结果"}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:`wandox-console-chat__robot-tab ${xe==="history"?"active":""}`,onClick:()=>$e("history"),children:["执行记录",xe==="history"&&B&&J.length>0&&e.jsxRuntimeExports.jsx("span",{className:"wandox-console-chat__robot-tab-badge",children:J.length})]})]}),e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__robot-content",children:xe==="results"?E?e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-chat__robot-loading",children:[e.jsxRuntimeExports.jsx(e.Spin,{size:"small"}),e.jsxRuntimeExports.jsx("span",{children:"加载中..."})]}):nt.length===0?e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-chat__robot-empty",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__robot-empty-icon",children:e.jsxRuntimeExports.jsx(h.RefIcon$3,{})}),e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__robot-empty-title",children:B?`${B} 暂无巡检结果`:"暂无巡检结果"}),e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__robot-empty-desc",children:"巡检结果会在机器人执行后展示在这里"})]}):e.jsxRuntimeExports.jsx("ul",{className:"wandox-console-chat__robot-timeline",children:nt.map((t,s)=>{const a={high:"#ff4d4f",medium:"#faad14",low:"#52c41a"},r=s===nt.length-1;return e.jsxRuntimeExports.jsxs("li",{className:"wandox-console-chat__robot-timeline-item",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-chat__robot-timeline-axis",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-console-chat__robot-timeline-time",children:xs(t.timestamp)}),e.jsxRuntimeExports.jsx("span",{className:"wandox-console-chat__robot-timeline-dot",style:{background:a[t.priority]}}),!r&&e.jsxRuntimeExports.jsx("span",{className:"wandox-console-chat__robot-timeline-line"})]}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-chat__robot-timeline-card",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__robot-timeline-title",children:t.title}),t.summary&&e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__robot-timeline-summary",children:t.summary}),t.ui_payload&&e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__robot-timeline-content wandox-markdown-content",children:e.jsxRuntimeExports.jsx(e.PayloadRenderer,{payload:t.ui_payload})})]})]},t.id||`result_${s}`)})}):B?Ze?e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-chat__robot-loading",children:[e.jsxRuntimeExports.jsx(e.Spin,{size:"small"}),e.jsxRuntimeExports.jsx("span",{children:"加载中..."})]}):J.length===0?e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__robot-empty",children:e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__robot-empty-title",children:"暂无执行记录"})}):e.jsxRuntimeExports.jsx("ul",{className:"wandox-console-chat__robot-history",children:J.map(t=>e.jsxRuntimeExports.jsxs("li",{className:`wandox-console-chat__robot-history-item wandox-console-chat__robot-history-item--${t.status}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-chat__robot-history-info",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-console-chat__robot-history-name",children:t.action_name}),e.jsxRuntimeExports.jsx("span",{className:"wandox-console-chat__robot-history-time",children:t.created_at?new Date(t.created_at).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):""})]}),e.jsxRuntimeExports.jsx("span",{className:`wandox-console-chat__robot-history-status wandox-console-chat__robot-history-status--${t.status}`,children:{pending:"等待中",running:"执行中",success:"成功",failed:"失败"}[t.status]||t.status})]},t.id))}):e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-chat__robot-empty",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__robot-empty-icon",children:e.jsxRuntimeExports.jsx(h.RefIcon$3,{})}),e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__robot-empty-title",children:"请先选择机器人"}),e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__robot-empty-desc",children:"在上方选择机器人以查看其执行记录"})]})})]}),ee==="chat"&&pt.length>0&&!(C&&!L)&&e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__recent",children:e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__recent-bar",children:pt.map((t,s)=>e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-console-chat__recent-chip",disabled:T||!!Je,title:t.description||t.name,onClick:()=>{hs(t)},children:t.name},`${t.playbook_id||t.name}-${s}`))})}),ee==="chat"&&e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chat__input",children:C&&!L?e.jsxRuntimeExports.jsxs("div",{ref:pe,className:"wandox-console-input-playbook wandox-console-prompt",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-prompt__head",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-scenechoice",children:[e.jsxRuntimeExports.jsx("span",{children:"已选择场景"}),e.jsxRuntimeExports.jsx("strong",{children:C.title})]}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-console-changescene",onClick:()=>{O(null),ae([]),z({})},children:"重新选择"})]}),e.jsxRuntimeExports.jsx("div",{ref:fe,tabIndex:-1,className:"wandox-console-taskarea wandox-console-taskarea--static",children:C.desc||C.title}),Z.length>0&&e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-paramarea",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-paramhead",children:[e.jsxRuntimeExports.jsx(zt,{}),e.jsxRuntimeExports.jsx("strong",{children:"确认分析范围"}),e.jsxRuntimeExports.jsxs("span",{className:"wandox-console-paramhead__status",children:[e.jsxRuntimeExports.jsx(e.RefIcon$5,{})," ",we.length>0?`待填 ${we.length} 项必填参数`:"参数已就绪"]})]}),e.jsxRuntimeExports.jsx("div",{className:"wandox-console-params",children:h.getVisibleInputFields(Z,M).map(t=>e.jsxRuntimeExports.jsx(Ht,{field:t,value:M[t.name],uploading:!1,fileNameMap:{},getOptionState:I.getFieldState,onChange:(s,a)=>z(r=>({...r,[s]:a}))},t.name))})]}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-prompt__foot",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-console-input-playbook__tip",children:"· 已继承当前上下文"}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-console-start",disabled:!C||T||we.length>0,onClick:js,children:["开始执行",e.jsxRuntimeExports.jsx(h.RefIcon,{})]})]})]}):e.jsxRuntimeExports.jsx(e.ChatInput,{onSend:at,executing:T,stopping:ns,onStop:rs,placeholder:" / 快速调用场景",ssoToken:A,ssoDomain:k,ssoCompany:x,leadingActions:fs,uploadButtonAsLeading:!0,uploadButtonLabel:"添加文件",mentionTriggerChar:"/",mentionListRequest:Qt,onMentionListRequestHandled:bs,autoFocusInput:!C,playbooks:Xt,onRequestPlaybookParams:je})}),e.jsxRuntimeExports.jsx(Ds,{open:L,source:V,categories:ot,categoryKey:Q,search:ne,cards:ts,executing:T,loadingPlaybookId:H,onClose:ps,onSourceChange:ds,onCategoryChange:ie,onSearchChange:U,onSelectScene:ms}),e.jsxRuntimeExports.jsx(e.NotificationScheduleModal,{open:We.visible,agentId:We.agentId,playbookId:We.playbookId,playbookName:We.playbookName,onClose:Rs}),A&&k&&x&&e.jsxRuntimeExports.jsx(e.ActionDetailDrawer,{open:le,title:X,actions:me,ssoToken:A,ssoDomain:k,ssoCompany:x,onClose:()=>Ee(!1)}),e.jsxRuntimeExports.jsx(e.Modal,{title:"配置通知渠道",open:Se,onCancel:()=>{ke(!1),Ae(null),Ie(void 0)},width:520,centered:!0,footer:[q[(P==null?void 0:P.agent_id)||""]?e.jsxRuntimeExports.jsx(e.Button,{danger:!0,loading:Oe,style:{marginRight:"auto"},onClick:ls,children:"解除绑定"},"unbind"):null,e.jsxRuntimeExports.jsx(e.Button,{disabled:Oe,onClick:()=>{ke(!1),Ae(null),Ie(void 0)},children:"取消"},"cancel"),e.jsxRuntimeExports.jsx(e.Button,{type:"primary",loading:Oe,disabled:!Ve,onClick:is,children:"保存"},"ok")],children:e.jsxRuntimeExports.jsxs("div",{style:{padding:"8px 0"},children:[e.jsxRuntimeExports.jsxs("div",{style:{marginBottom:16,padding:"12px 16px",background:"#f5f7fa",borderRadius:8,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxRuntimeExports.jsx("div",{style:{fontSize:13,color:"#666"},children:"巡检机器人"}),e.jsxRuntimeExports.jsx("div",{style:{fontSize:15,color:"#1a1a1a",fontWeight:500},children:P==null?void 0:P.name})]}),e.jsxRuntimeExports.jsx("div",{style:{marginBottom:8,fontSize:14,color:"#333",fontWeight:500},children:"选择通知渠道"}),e.jsxRuntimeExports.jsx(e.Select,{style:{width:"100%"},placeholder:"请选择通知渠道",value:Ve,onChange:Ie,disabled:Oe,options:de.map(t=>({label:`${t.name}(${t.platform==="dingtalk"?"钉钉":t.platform==="feishu"?"飞书":"企业微信"})`,value:t.webhook_id})),popupRender:t=>e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[t,e.jsxRuntimeExports.jsx(Bt.Divider,{style:{margin:"8px 0"}}),e.jsxRuntimeExports.jsx(e.Space,{style:{padding:"0 8px 4px"},children:e.jsxRuntimeExports.jsx(e.Button,{type:"text",icon:e.jsxRuntimeExports.jsx("span",{children:"+"}),onClick:()=>ut(!0),children:"添加新的通知渠道"})})]})}),de.length===0&&e.jsxRuntimeExports.jsx("div",{style:{marginTop:8,padding:"8px 12px",background:"#fff7e6",border:"1px solid #ffd591",borderRadius:4,fontSize:13,color:"#d46b08"},children:"暂无可用的通知渠道,请先在「通知配置」中创建"})]})}),e.jsxRuntimeExports.jsx(h.QuickAddWebhook,{open:Ut,onClose:()=>ut(!1),onSuccess:t=>{ge(s=>[...s,t]),Ie(t.webhook_id)}})]})}const{TextArea:Os}=e.Input;function Bs({useMapCards:o,useMapCategories:c,playbooks:u=[],selectedCategoryKey:d,onCategorySelect:m,loading:w,useMapError:$,onRetry:j,onStartAnalysis:v,agents:D,selectedAgentId:se,onAgentSelect:Y,onOpenAgentChat:re}){const[N,W]=e.reactExports.useState(""),[A,k]=e.reactExports.useState(""),[x,F]=e.reactExports.useState(null),ce=e.reactExports.useRef(null),[L,S]=e.reactExports.useState([]),[H,oe]=e.reactExports.useState(!1),[ne,U]=e.reactExports.useState(""),V=e.reactExports.useRef(0),[K,Q]=e.reactExports.useState({}),[ie,C]=e.reactExports.useState({}),[O,fe]=e.reactExports.useState({}),[pe,le]=e.reactExports.useState([]),[Ee,me]=e.reactExports.useState(!1),Ne=e.reactExports.useRef(null),X=e.reactExports.useMemo(()=>o.length>0?o:h.buildDefaultSceneCards(u),[o,u]),Re=e.reactExports.useMemo(()=>d?X.filter(n=>n.categoryKey===d):X,[X,d]),Z=e.reactExports.useMemo(()=>{const n=A.trim().toLowerCase();return n?Re.filter(E=>E.title.toLowerCase().includes(n)||E.desc.toLowerCase().includes(n)):Re},[Re,A]),ae=w||$&&X.length===0||Z.length>0,[M,z]=e.reactExports.useState("");e.reactExports.useEffect(()=>{V.current+=1,z(""),W(""),S([]),Q({}),oe(!1),U("")},[d]),e.reactExports.useEffect(()=>{M&&!X.some(n=>n.playbook_id===M)&&(V.current+=1,z(""),W(""),S([]),Q({}),oe(!1),U(""))},[M,X]);const I=e.reactExports.useMemo(()=>X.find(n=>n.playbook_id===M)??null,[X,M]),we=e.reactExports.useMemo(()=>x?qt(x):null,[x]),ee=e.reactExports.useCallback((n,E)=>{n.stopPropagation(),F(E)},[]);e.reactExports.useEffect(()=>{if(w||I)return;const n=window.setTimeout(()=>{var f,_;const E=(_=(f=ce.current)==null?void 0:f.resizableTextArea)==null?void 0:_.textArea;E==null||E.focus()},0);return()=>window.clearTimeout(n)},[w,I]);const p=e.reactExports.useCallback(async n=>{const E=String(n.playbook_id||"").trim();if(!E){e.staticMethods.error("场景缺少 playbook_id");return}const f=++V.current;z(E),S([]),Q({}),C({}),fe({}),oe(!0),U("");try{const{data:_}=await e.GET_Api_V1_Playbooks_Detail({playbook_id:E});if(f!==V.current)return;if(!_||typeof _!="object"||Array.isArray(_))throw new Error("场景详情为空");const g=e.normalizeAgentInputFields(e.getPlaybookDetailFields(_));S(g),Q(h.buildDefaultInputValues(g))}catch(_){if(f!==V.current)return;const g=_ instanceof Error?_.message:"场景参数加载失败";U(g),e.staticMethods.error("场景参数加载失败,请稍后重试")}finally{f===V.current&&oe(!1)}},[]),y=()=>{V.current+=1,z(""),W(""),S([]),Q({}),oe(!1),U("")},be=e.useDynamicFieldOptions(L,K,Q),B=e.reactExports.useMemo(()=>h.getVisibleInputFields(L,K),[L,K]),ye=e.reactExports.useCallback((n,E)=>{Q(f=>({...f,[n]:E}))},[]),xe=e.reactExports.useCallback((n,E)=>async({file:f,onSuccess:_,onError:g})=>{var de,ge;C(q=>({...q,[n]:!0}));try{const q=f,G=await e.POST_Api_V1_Oss_Upload2(q),Se=(de=G==null?void 0:G.data)==null?void 0:de.url,ke=((ge=G==null?void 0:G.data)==null?void 0:ge.name)||q.name;if(!Se)throw new Error("上传结果缺少文件地址");fe(P=>({...P,[Se]:ke})),Q(P=>{if(E<=1)return{...P,[n]:Se};const Ae=Array.isArray(P[n])?P[n]:P[n]?[P[n]]:[];return{...P,[n]:[...Ae,Se]}}),_==null||_(G),e.staticMethods.success("上传成功")}catch(q){const G=q instanceof Error?q:new Error("上传失败");g==null||g(G),e.staticMethods.error(G.message)}finally{C(q=>({...q,[n]:!1}))}},[]),$e=e.reactExports.useCallback(async n=>{const E=Array.from(n.target.files??[]);if(n.target.value="",E.length!==0){me(!0);try{const f=await Promise.all(E.map(async _=>{var q,G;const g=await e.POST_Api_V1_Oss_Upload2(_),de=(q=g==null?void 0:g.data)==null?void 0:q.url,ge=((G=g==null?void 0:g.data)==null?void 0:G.name)||_.name;if(!de)throw new Error("上传结果缺少文件地址");return{type:_.type.startsWith("image/")?"image":"file",url:de,name:ge,mime_type:_.type}}));le(_=>[..._,...f]),e.staticMethods.success(`已添加 ${f.length} 个附件`)}catch(f){e.staticMethods.error(f instanceof Error?f.message:"上传失败")}finally{me(!1)}}},[]),Ze=e.reactExports.useCallback(n=>{le(E=>E.filter(f=>f.url!==n))},[]),Ce=e.reactExports.useMemo(()=>B.filter(n=>n.required&&h.isMissingFieldValue(K[n.name])),[B,K]),J=e.reactExports.useMemo(()=>D.find(n=>n.id===se)??D.find(n=>n.current)??D[0],[D,se]);return e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-view",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-homecenter",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-homecenter-hero",children:[J&&e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-home-header",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-home-header__agent",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-console-home-header__avatar",children:J.icon}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-home-header__identity",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-home-header__selector-row",children:[e.jsxRuntimeExports.jsx(e.Dropdown,{menu:{items:D.map(n=>({key:n.id,disabled:n.id===J.id,label:e.jsxRuntimeExports.jsxs("span",{className:"wandox-console-agent-menu-item",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-console-agent-menu-item__icon",children:n.icon}),e.jsxRuntimeExports.jsx("span",{className:"wandox-console-agent-menu-item__name",children:n.name}),n.id===J.id&&e.jsxRuntimeExports.jsx(e.RefIcon$5,{className:"wandox-console-agent-menu-item__check"})]})})),onClick:({key:n})=>Y==null?void 0:Y(n)},trigger:["click"],placement:"bottomLeft",children:e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-console-home-header__selector","aria-label":"切换智能体",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-console-home-header__name",children:J.name}),e.jsxRuntimeExports.jsx(e.RefIcon$3,{className:"wandox-console-home-header__arrow"})]})}),e.jsxRuntimeExports.jsx(h.AgentPackageTag,{benefit:J.packageBenefit})]}),J.desc&&e.jsxRuntimeExports.jsx("p",{className:"wandox-console-home-header__description",title:J.desc,children:J.desc})]})]}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-console-home-header__history",onClick:()=>re==null?void 0:re(),children:[e.jsxRuntimeExports.jsx("span",{children:"会话记录"}),e.jsxRuntimeExports.jsx(e.RefIcon$6,{className:"wandox-console-home-header__history-arrow"})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-prompt",children:[I&&e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-prompt__head",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-scenechoice",children:[e.jsxRuntimeExports.jsx("span",{children:"已选择场景"}),e.jsxRuntimeExports.jsx("strong",{children:I.title})]}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-console-changescene",onClick:y,children:"重新选择"})]}),I?e.jsxRuntimeExports.jsx("div",{className:"wandox-console-taskarea wandox-console-taskarea--static",children:I.desc||I.title}):e.jsxRuntimeExports.jsx("div",{className:"wandox-console-taskarea",children:e.jsxRuntimeExports.jsx(Os,{ref:ce,value:N,onChange:n=>W(n.target.value),autoSize:{minRows:2},variant:"borderless",placeholder:"直接描述你的问题,或选择一个场景开始"})}),I&&H&&e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-paramarea wandox-console-paramarea--state",children:[e.jsxRuntimeExports.jsx(e.RecommendationLoader,{}),e.jsxRuntimeExports.jsx("span",{children:"正在读取场景参数..."})]}),I&&!H&&ne&&e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-paramarea wandox-console-paramarea--state",children:[e.jsxRuntimeExports.jsx("span",{children:"场景参数加载失败"}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-console-paramarea__retry",onClick:()=>void p(I),children:[e.jsxRuntimeExports.jsx(e.RefIcon$7,{}),"重试"]})]}),I&&!H&&!ne&&B.length>0&&e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-paramarea",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-paramhead",children:[e.jsxRuntimeExports.jsx(zt,{}),e.jsxRuntimeExports.jsx("strong",{children:"确认分析范围"}),e.jsxRuntimeExports.jsxs("span",{className:"wandox-console-paramhead__status",children:[e.jsxRuntimeExports.jsx(e.RefIcon$5,{})," ",Ce.length>0?`待填 ${Ce.length} 项必填参数`:"参数已就绪"]})]}),e.jsxRuntimeExports.jsx("div",{className:"wandox-console-params",children:B.map(n=>e.jsxRuntimeExports.jsx(Ht,{field:n,value:K[n.name],uploading:!!ie[n.name],fileNameMap:O,getOptionState:be.getFieldState,onChange:ye,onUpload:xe},n.name))})]}),e.jsxRuntimeExports.jsxs("div",{className:`wandox-console-prompt__foot${I?" wandox-console-prompt__foot--scene":""}`,children:[!I&&e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-console-attach",onClick:()=>{var n;return(n=Ne.current)==null?void 0:n.click()},disabled:Ee,title:Ee?"上传中…":"附件",children:e.jsxRuntimeExports.jsx(e.RefIcon$8,{})}),e.jsxRuntimeExports.jsx("input",{ref:Ne,type:"file",multiple:!0,accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.csv,.zip",hidden:!0,onChange:$e}),I?e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-console-start",disabled:H||!!ne||Ce.length>0,onClick:()=>{v==null||v({playbookId:I.playbook_id,playbookParams:K,message:I.title,attachments:pe})},children:["开始执行",e.jsxRuntimeExports.jsx(h.RefIcon,{})]}):e.jsxRuntimeExports.jsx("div",{className:"wandox-console-prompt__foot-right",children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-console-prompt__send",disabled:!N.trim(),onClick:()=>{v==null||v({playbookParams:{},message:N.trim(),attachments:pe})},"aria-label":"发送",children:e.jsxRuntimeExports.jsx(e.RefIcon$9,{})})})]})]}),pe.length>0&&e.jsxRuntimeExports.jsx("div",{className:"wandox-console-attachments",children:pe.map(n=>e.jsxRuntimeExports.jsxs("span",{className:"wandox-console-attach-item",children:[n.type==="image"?e.jsxRuntimeExports.jsx("img",{src:n.url,alt:n.name,className:"wandox-console-attach-item__thumb"}):e.jsxRuntimeExports.jsx(e.RefIcon$10,{className:"wandox-console-attach-item__icon"}),e.jsxRuntimeExports.jsx("span",{className:"wandox-console-attach-item__name",title:n.name,children:n.name}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-console-attach-item__remove","aria-label":"移除附件",onClick:()=>Ze(n.url),children:e.jsxRuntimeExports.jsx(e.RefIcon,{})})]},n.url))}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-scenehead",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-console-chips",role:"tablist","aria-label":"场景分类",children:c.slice(0,5).map(n=>e.jsxRuntimeExports.jsx("button",{type:"button",role:"tab","aria-selected":d===n.key,className:`wandox-console-chip${d===n.key?" wandox-console-chip--active":""}`,onClick:()=>m==null?void 0:m(n.key),children:e.jsxRuntimeExports.jsx("span",{children:n.name})},n.key))}),e.jsxRuntimeExports.jsx("div",{className:"wandox-console-scenesearch",children:e.jsxRuntimeExports.jsx(e.Input,{allowClear:!0,prefix:e.jsxRuntimeExports.jsx(e.RefIcon$1,{}),placeholder:"搜索当前地图下的场景",value:A,onChange:n=>k(n.target.value)})})]})]}),ae&&e.jsxRuntimeExports.jsxs("section",{className:"wandox-console-scene-section","aria-label":"个性化场景",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-console-scene-section__header",children:e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("h2",{children:"为你推荐"})})}),w?e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-agents__loading",style:{justifyContent:"center",padding:"40px 0"},children:[e.jsxRuntimeExports.jsx(e.Spin,{size:"small"}),e.jsxRuntimeExports.jsx("span",{children:"正在加载场景..."})]}):$&&X.length===0?e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-agents__error",style:{alignItems:"center",padding:"32px 0"},children:[e.jsxRuntimeExports.jsx("span",{children:$}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:j,children:[e.jsxRuntimeExports.jsx(e.RefIcon$7,{}),"重试"]})]}):Z.length===0?e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-scene-section__empty",children:[e.jsxRuntimeExports.jsx(e.RefIcon$1,{}),e.jsxRuntimeExports.jsx("span",{children:A?"没有匹配的场景":"当前分类暂无场景"})]}):e.jsxRuntimeExports.jsx("div",{className:"wandox-console-scenes-wrap",children:e.jsxRuntimeExports.jsx("div",{className:"wandox-console-scenes",children:Z.map(n=>{const E=qs(n),f=zs(n),_=Ws(n.tags);return e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-scene-wrap",children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:`wandox-console-scene${f?" wandox-console-scene--featured":""}${M===n.playbook_id?" wandox-console-scene--selected":""}`,onClick:()=>p(n),children:e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-scene__body",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-scene__head",children:[e.jsxRuntimeExports.jsx("strong",{title:n.title,children:n.title}),E&&e.jsxRuntimeExports.jsx("span",{className:`wandox-console-scene__badge wandox-console-scene__badge--${E.kind}`,children:E.text})]}),n.desc&&e.jsxRuntimeExports.jsx("span",{className:"wandox-console-scene__desc",title:n.desc,children:n.desc}),(f||_.length>0)&&e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-scene__tags",children:[f&&e.jsxRuntimeExports.jsx("span",{className:"wandox-console-scene__tag wandox-console-scene__tag--featured",children:"精品"}),_.map((g,de)=>e.jsxRuntimeExports.jsx("span",{className:"wandox-console-scene__tag",style:Hs(g),children:g.name},`${g.name}-${de}`))]})]})}),n.video_url&&e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-console-scene__video","aria-label":`播放${n.title}演示视频`,onClick:g=>ee(g,n),children:["▶ ",Wt(n.video_duration)," 演示"]})]},n.key)})})})]})]}),e.jsxRuntimeExports.jsx(e.PlaybookVideoModal,{playbook:we,onClose:()=>F(null)})]})}function zs(o){return o.is_featured===!0||o.badge==="featured"}function qs(o){return o.badge==="recommend"?{text:"推荐",kind:"recommend"}:o.badge==="new"?{text:"New",kind:"new"}:null}function Ws(o){return Array.isArray(o)?o.filter(c=>typeof(c==null?void 0:c.name)=="string"&&c.name.trim()!==""):[]}function Hs(o){if(!(o.variant!=="soft"||!o.color))return{color:o.color,borderColor:Lt(o.color,.28),backgroundColor:Lt(o.color,.08)}}function Lt(o,c){const u=o.trim().replace("#","");if(!/^[0-9a-fA-F]{6}$/.test(u))return o;const d=Number.parseInt(u.slice(0,2),16),m=Number.parseInt(u.slice(2,4),16),w=Number.parseInt(u.slice(4,6),16);return`rgba(${d}, ${m}, ${w}, ${c})`}const Us=[{id:"conversation",title:"智能体",desc:"与智能体自由对话或选择场景执行任务",icon:e.jsxRuntimeExports.jsx(h.RefIcon$4,{}),accent:"#4f46e5"},{id:"automation",title:"自动化",desc:"管理与执行自动化流程、定时任务与驾驶舱",icon:e.jsxRuntimeExports.jsx(e.RefIcon$11,{}),accent:"#4f46e5"}],Le={id:"notification",title:"通知配置",icon:e.jsxRuntimeExports.jsx(h.RefIcon$2,{}),accent:"#e0730c"};function Ks({features:o,onOpenFeature:c,activeId:u}){return e.jsxRuntimeExports.jsxs("header",{className:"wandox-console-topnav","aria-label":"控制台顶部导航",children:[e.jsxRuntimeExports.jsx("nav",{className:"wandox-console-topnav__pill","aria-label":"工作台",children:o.map(d=>{const m=u===d.id;return e.jsxRuntimeExports.jsxs("button",{type:"button",className:`wandox-console-topnav__pill-btn${m?" wandox-console-topnav__pill-btn--active":""}`,title:d.title,"aria-label":d.title,"aria-current":m?"page":void 0,onClick:()=>c(d.id),children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-console-topnav__pill-icon",children:d.icon}),e.jsxRuntimeExports.jsx("span",{className:"wandox-console-topnav__pill-text",children:d.title})]},d.id)})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-console-topnav__notify",style:{"--notify-accent":Le.accent},title:Le.title,"aria-label":Le.title,onClick:()=>c(Le.id),children:e.jsxRuntimeExports.jsx("span",{className:"wandox-console-topnav__notify-icon",children:Le.icon})})]})}function Gs({className:o="",state:c="idle"}){return e.jsxRuntimeExports.jsx("img",{className:`wandox-console-companion${o?` ${o}`:""}`,"data-state":c,src:e.wandoxMarkUrl,alt:"","aria-hidden":"true"})}function Vt({fading:o}){return e.jsxRuntimeExports.jsxs("div",{className:`wandox-console-init${o?" wandox-console-init--fading":""}`,"aria-hidden":!0,children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-console-init__halo wandox-console-init__halo--a"}),e.jsxRuntimeExports.jsx("div",{className:"wandox-console-init__halo wandox-console-init__halo--b"}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-init__inner",children:[e.jsxRuntimeExports.jsx(Gs,{className:"wandox-console-init__companion",state:"thinking"}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-console-init__title",children:"正在准备你的控制台"}),e.jsxRuntimeExports.jsx("div",{className:"wandox-console-init__subtitle",children:"正在加载智能体与场景数据…"})]}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-init__dots","aria-hidden":!0,children:[e.jsxRuntimeExports.jsx("span",{}),e.jsxRuntimeExports.jsx("span",{}),e.jsxRuntimeExports.jsx("span",{}),e.jsxRuntimeExports.jsx("span",{}),e.jsxRuntimeExports.jsx("span",{})]})]}),e.jsxRuntimeExports.jsx("div",{className:"wandox-console-init__footnote",children:"由 Wandox AI 提供动力"})]})}function Ot({title:o,onBack:c,hideHeader:u=!1,className:d,children:m}){return e.jsxRuntimeExports.jsxs("div",{className:`wandox-console-featureview${d?` ${d}`:""}`,children:[!u&&e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-featureview__bar",children:[e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-console-featureview__back",onClick:c,children:[e.jsxRuntimeExports.jsx(h.RefIcon$1,{}),"返回控制台"]}),e.jsxRuntimeExports.jsx("span",{className:"wandox-console-featureview__title",children:o})]}),e.jsxRuntimeExports.jsx("div",{className:"wandox-console-featureview__body",children:m})]})}function Ys({agents:o,initialAgentId:c,initialPlaybookId:u,initialPlaybookParams:d,onReady:m}={}){const{agents:w,agentLoading:$,selectedAgentId:j,selectedAgent:v,selectAgent:D,...se}=h.useWorkbenchRuntime({presetAgents:o,initialAgentId:c}),[Y,re]=e.reactExports.useState(null),N=e.reactExports.useRef(null),W=e.reactExports.useRef(!1),[A,k]=e.reactExports.useState("home"),[x,F]=e.reactExports.useState(null),[ce,L]=e.reactExports.useState(!1),[S,H]=e.reactExports.useState(null),[oe,ne]=e.reactExports.useState(""),U=v==null?void 0:v.name,V=e.reactExports.useCallback(p=>{if(N.current){N.current.showInspectionResults(p);return}re({robotName:p})},[]);e.reactExports.useEffect(()=>{m==null||m({showInspectionResults:V})},[V,m]),e.reactExports.useEffect(()=>{!Y||N.current||!j||A==="chat"||(H({agentId:j,agentName:U,playbookParams:{},message:""}),k("chat"))},[A,Y,j,U]),e.reactExports.useEffect(()=>{ne("")},[j]);const{playbooks:K,userPlaybooks:Q,useMapCategories:ie,useMapCards:C,sceneLoading:O,useMapError:fe,reload:pe}=se,le=e.reactExports.useMemo(()=>ie.length>0?ie:h.buildDefaultSceneCategories(K),[ie,K]);e.reactExports.useEffect(()=>{if(le.length===0)return;le.some(y=>y.key===oe)||ne(le[0].key)},[le]);const Ee=e.reactExports.useRef(!1);e.reactExports.useEffect(()=>{if(Ee.current||!u||!j||O)return;const p=w.find(y=>y.id===j&&h.matchesWorkbenchAgent(y,c));p&&(Ee.current=!0,H({agentId:j,agentName:p.name,playbookId:u,playbookParams:d||{},message:""}),k("chat"))},[O,w,c,u,d,j,U]),e.reactExports.useEffect(()=>{if(W.current||!c||u||!j||O)return;const p=w.find(y=>y.id===j&&h.matchesWorkbenchAgent(y,c));p&&(W.current=!0,H({agentId:p.id,agentName:p.name,playbookParams:{},message:""}),k("chat"))},[w,O,c,u,j]);const[me,Ne]=e.reactExports.useState(!0),[X,Re]=e.reactExports.useState(!1);e.reactExports.useEffect(()=>{if(!me||!(!$&&w.length>0&&!!j&&!O))return;Re(!0);const be=setTimeout(()=>Ne(!1),280);return()=>clearTimeout(be)},[$,w.length,j,O,me]);const Z=e.reactExports.useCallback(()=>{k("home"),F(null),L(!1)},[]),ae=e.reactExports.useCallback(p=>{if(p==="conversation"){Z();return}L(!1),F(p)},[Z]),M=p=>{D(p),k("home")},z=p=>{if(p===j)return;const y=w.find(be=>be.id===p);D(p),H({agentId:p,agentName:y==null?void 0:y.name,playbookParams:{},message:""})},I=()=>{j&&(H({agentId:j,agentName:U,playbookParams:{},message:""}),k("chat"))},we=p=>{H({agentId:j,agentName:U,playbookId:p.playbookId,playbookParams:p.playbookParams,message:p.message,attachments:p.attachments}),k("chat")};return A==="chat"&&S?e.jsxRuntimeExports.jsxs("div",{className:"wandox-console-chat-shell",children:[e.jsxRuntimeExports.jsx(Vs,{agentId:S.agentId,agentName:S.agentName,playbookId:S.playbookId,playbookParams:S.playbookParams,initialMessage:S.message,initialAttachments:S.attachments,useMapCards:C,useMapCategories:ie,playbooks:K,userPlaybooks:Q,agents:w,onReady:p=>{N.current=p,Y&&(p.showInspectionResults(Y.robotName),re(null))},onChangeAgent:z,onBack:()=>{N.current=null,k("home")},onSelectScene:()=>{}},`${S.agentId}:${S.playbookId||"free-chat"}`),me&&e.jsxRuntimeExports.jsx(Vt,{fading:X})]}):e.jsxRuntimeExports.jsxs("div",{className:`wandox-console${ce?" wandox-console--secondary":""}`,children:[me&&e.jsxRuntimeExports.jsx(Vt,{fading:X}),!ce&&e.jsxRuntimeExports.jsx(Ks,{features:Us,activeId:x??"conversation",onOpenFeature:ae}),e.jsxRuntimeExports.jsxs("main",{className:"wandox-console-main",children:[x==="automation"&&e.jsxRuntimeExports.jsx(Ot,{title:"自动化",onBack:()=>F(null),hideHeader:!0,className:"wandox-console-featureview--automation",children:e.jsxRuntimeExports.jsx(h.AutomationPage,{onCockpitEnter:()=>L(!0),onCockpitExit:()=>L(!1),onInboxEnter:()=>L(!0)})}),x==="notification"&&e.jsxRuntimeExports.jsx(Ot,{title:"通知配置",onBack:()=>F(null),hideHeader:!0,children:e.jsxRuntimeExports.jsx(h.SettingsWithTabs,{})}),!x&&e.jsxRuntimeExports.jsx(Bs,{useMapCards:C,useMapCategories:le,playbooks:K,selectedCategoryKey:oe,onCategorySelect:ne,loading:O,useMapError:fe,onRetry:pe,onStartAnalysis:we,agents:w,selectedAgentId:j,onAgentSelect:M,onOpenAgentChat:I})]})]})}exports.default=Ys;
|