@wandox/sdk 0.1.33 → 0.1.35
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/README.md +6 -2
- package/dist/{index-BPN_Dxyz.js → V1Workbench-Duh15otc.js} +1418 -1739
- package/dist/V1Workbench-OnGicnM-.cjs +3 -0
- package/dist/V2Workbench-ChqSBXHY.cjs +2 -0
- package/dist/V2Workbench-Cwx-XP5u.js +2170 -0
- package/dist/{useWorkbenchSession-Dbc6INAR.js → WorkbenchRuntime-B2C8SbrZ.js} +4623 -3816
- package/dist/WorkbenchRuntime-QRXyaZ5I.cjs +7 -0
- package/dist/{arc-CFGoWkTY.js → arc-C3McnqVx.js} +1 -1
- package/dist/{arc-BQRtQJ9k.cjs → arc-CfnbUnJa.cjs} +1 -1
- package/dist/{architectureDiagram-3BPJPVTR-DVqKFMFi.js → architectureDiagram-3BPJPVTR-DKV9z5FO.js} +3 -3
- package/dist/{architectureDiagram-3BPJPVTR-DYS3PxLb.cjs → architectureDiagram-3BPJPVTR-EmeNsmhR.cjs} +1 -1
- package/dist/{blockDiagram-GPEHLZMM-CmcyVP4f.cjs → blockDiagram-GPEHLZMM-B3PO97gR.cjs} +1 -1
- package/dist/{blockDiagram-GPEHLZMM-C6c9vDdQ.js → blockDiagram-GPEHLZMM-CwMlZLrY.js} +3 -3
- package/dist/{c4Diagram-AAUBKEIU-DqNQ_NW1.cjs → c4Diagram-AAUBKEIU-CIJm8DIv.cjs} +1 -1
- package/dist/{c4Diagram-AAUBKEIU-DV7H6QUX.js → c4Diagram-AAUBKEIU-DDvw0p9i.js} +2 -2
- package/dist/{channel-DW5wvDcX.cjs → channel-B6D2dt-a.cjs} +1 -1
- package/dist/{channel-dcNu0MRz.js → channel-BW_f3mZ1.js} +1 -1
- package/dist/{chunk-2J33WTMH-y7kx7TkN.js → chunk-2J33WTMH-B9LmfIjP.js} +1 -1
- package/dist/{chunk-2J33WTMH-CrG9dNxx.cjs → chunk-2J33WTMH-CAtXTwyr.cjs} +1 -1
- package/dist/{chunk-4BX2VUAB-BELskQ2J.js → chunk-4BX2VUAB-C_E82st1.js} +1 -1
- package/dist/{chunk-4BX2VUAB-DDqIA4kO.cjs → chunk-4BX2VUAB-TTJvrk_8.cjs} +1 -1
- package/dist/{chunk-55IACEB6-DK4ucJ-7.cjs → chunk-55IACEB6-Co8MIdgs.cjs} +1 -1
- package/dist/{chunk-55IACEB6-iTS2TPhB.js → chunk-55IACEB6-CuKoQ8P-.js} +1 -1
- package/dist/{chunk-727SXJPM-DuWYu930.js → chunk-727SXJPM-Cs8uS9SJ.js} +5 -5
- package/dist/{chunk-727SXJPM-BxBO8q2U.cjs → chunk-727SXJPM-Cup_K8Hg.cjs} +1 -1
- package/dist/{chunk-AQP2D5EJ-DOTlmgEY.cjs → chunk-AQP2D5EJ-BJ2GPeyZ.cjs} +1 -1
- package/dist/{chunk-AQP2D5EJ-DoNLkwqN.js → chunk-AQP2D5EJ-Ck3VZgwQ.js} +3 -3
- package/dist/{chunk-FMBD7UC4-SOCUK_t9.cjs → chunk-FMBD7UC4-ClCmPgT2.cjs} +1 -1
- package/dist/{chunk-FMBD7UC4-BwQebnrj.js → chunk-FMBD7UC4-_xpDdMNi.js} +1 -1
- package/dist/{chunk-ND2GUHAM-CtGpWUtB.cjs → chunk-ND2GUHAM-5_kT1SOB.cjs} +1 -1
- package/dist/{chunk-ND2GUHAM-BQL2-tUF.js → chunk-ND2GUHAM-BahupltG.js} +1 -1
- package/dist/{chunk-QZHKN3VN-UX2tk2uK.cjs → chunk-QZHKN3VN-Ca5tmmHx.cjs} +1 -1
- package/dist/{chunk-QZHKN3VN-LiCsWEKP.js → chunk-QZHKN3VN-CdL_F3Vv.js} +1 -1
- package/dist/{classDiagram-4FO5ZUOK-lDXGgv9d.js → classDiagram-4FO5ZUOK-CnMvmQcX.js} +2 -2
- package/dist/{classDiagram-4FO5ZUOK-PkrYP623.cjs → classDiagram-4FO5ZUOK-DZ87tNdh.cjs} +1 -1
- package/dist/{classDiagram-v2-Q7XG4LA2-Ce74jKyI.js → classDiagram-v2-Q7XG4LA2-90g5yMq9.js} +2 -2
- package/dist/{classDiagram-v2-Q7XG4LA2-PkrYP623.cjs → classDiagram-v2-Q7XG4LA2-DZ87tNdh.cjs} +1 -1
- package/dist/{cose-bilkent-S5V4N54A-C8VzTXo7.cjs → cose-bilkent-S5V4N54A-D9USBZBY.cjs} +1 -1
- package/dist/{cose-bilkent-S5V4N54A-D54kr34O.js → cose-bilkent-S5V4N54A-DOMJ8Dw0.js} +6 -6
- package/dist/{dagre-BM42HDAG-BiqOYJto.js → dagre-BM42HDAG-BruKrkrz.js} +1 -1
- package/dist/{dagre-BM42HDAG-BtY2vW9S.cjs → dagre-BM42HDAG-D9xkOYd1.cjs} +1 -1
- package/dist/{diagram-2AECGRRQ-C-rSMhIx.js → diagram-2AECGRRQ-B7fBRPEm.js} +2 -2
- package/dist/{diagram-2AECGRRQ-BNB5vGzX.cjs → diagram-2AECGRRQ-CHwHxLjN.cjs} +1 -1
- package/dist/{diagram-5GNKFQAL-bpxQdo2C.cjs → diagram-5GNKFQAL-B3sIjwSe.cjs} +1 -1
- package/dist/{diagram-5GNKFQAL-S_Grx6ir.js → diagram-5GNKFQAL-C68LRU93.js} +3 -3
- package/dist/{diagram-KO2AKTUF-ELGk3l-i.cjs → diagram-KO2AKTUF-CZkt3wwK.cjs} +1 -1
- package/dist/{diagram-KO2AKTUF-eKQOgy6O.js → diagram-KO2AKTUF-Decii5jM.js} +2 -2
- package/dist/{diagram-LMA3HP47-B-uG3_N0.js → diagram-LMA3HP47-BRJpaLnd.js} +2 -2
- package/dist/{diagram-LMA3HP47-CpE4LthG.cjs → diagram-LMA3HP47-D7hixvGx.cjs} +1 -1
- package/dist/{diagram-OG6HWLK6-DG4_vxgJ.js → diagram-OG6HWLK6-DwSOhl1j.js} +3 -3
- package/dist/{diagram-OG6HWLK6-DDdJj07Q.cjs → diagram-OG6HWLK6-dSSwZ9rN.cjs} +1 -1
- package/dist/{erDiagram-TEJ5UH35-BzyXZihW.cjs → erDiagram-TEJ5UH35-CCZ0q594.cjs} +1 -1
- package/dist/{erDiagram-TEJ5UH35-Bm2L-KYC.js → erDiagram-TEJ5UH35-ClUTkoiL.js} +4 -4
- package/dist/{flowDiagram-I6XJVG4X-SC3NWHnp.cjs → flowDiagram-I6XJVG4X-BN-jwNXL.cjs} +1 -1
- package/dist/{flowDiagram-I6XJVG4X-DWja3wPy.js → flowDiagram-I6XJVG4X-CfhSJE55.js} +6 -6
- package/dist/{ganttDiagram-6RSMTGT7-BtlwMR2X.cjs → ganttDiagram-6RSMTGT7-CF1liYk-.cjs} +1 -1
- package/dist/{ganttDiagram-6RSMTGT7-Bdl8lJE0.js → ganttDiagram-6RSMTGT7-Dq7VvM2M.js} +3 -3
- package/dist/{gitGraphDiagram-PVQCEYII-BD9WXXIJ.cjs → gitGraphDiagram-PVQCEYII-P9t07gif.cjs} +1 -1
- package/dist/{gitGraphDiagram-PVQCEYII-D0R22NvI.js → gitGraphDiagram-PVQCEYII-odnoukk4.js} +3 -3
- package/dist/{index-CSUSaYAT.js → index-4FmQg3Zk.js} +38304 -38446
- package/dist/{index-LAVofA4F.cjs → index-BQMJ9VDu.cjs} +1 -1
- package/dist/{index-GDchGS5n.js → index-CFEgQrfn.js} +12 -12
- package/dist/{index-BcUHp4mm.cjs → index-CLCe0Dgz.cjs} +1 -1
- package/dist/index-CQgUKSVP.cjs +785 -0
- package/dist/{index-BB2w2-0P.js → index-Cq6GT084.js} +34 -34
- package/dist/{infoDiagram-5YYISTIA-DH4XoRzl.js → infoDiagram-5YYISTIA-CzWTUV3i.js} +1 -1
- package/dist/{infoDiagram-5YYISTIA-B1kTBhIl.cjs → infoDiagram-5YYISTIA-vIftEDKa.cjs} +1 -1
- package/dist/{ishikawaDiagram-YF4QCWOH-BoCLf4So.js → ishikawaDiagram-YF4QCWOH-5oQSrlLN.js} +1 -1
- package/dist/{ishikawaDiagram-YF4QCWOH-D-J5HMF1.cjs → ishikawaDiagram-YF4QCWOH-DoFATknv.cjs} +1 -1
- package/dist/{journeyDiagram-JHISSGLW-DD35iknc.js → journeyDiagram-JHISSGLW-BHsXT1p8.js} +4 -4
- package/dist/{journeyDiagram-JHISSGLW-Cpb1JHik.cjs → journeyDiagram-JHISSGLW-DUspfQIx.cjs} +1 -1
- package/dist/{kanban-definition-UN3LZRKU-D4WsAGZu.cjs → kanban-definition-UN3LZRKU-BqKlDwWt.cjs} +1 -1
- package/dist/{kanban-definition-UN3LZRKU-D0BAvjQJ.js → kanban-definition-UN3LZRKU-CbizhZ4A.js} +2 -2
- package/dist/{linear-D_U8-iL2.cjs → linear-BeJA81Is.cjs} +1 -1
- package/dist/{linear-DW_xObTJ.js → linear-O3WIbS9A.js} +1 -1
- package/dist/{mermaid.core-BzQN-pNf.js → mermaid.core-C-YWP2jz.js} +35 -35
- package/dist/{mermaid.core-DU9zhKw6.cjs → mermaid.core-EIMF3BAo.cjs} +3 -3
- package/dist/{mindmap-definition-RKZ34NQL-CBIITNoj.cjs → mindmap-definition-RKZ34NQL-DcaDYCfJ.cjs} +1 -1
- package/dist/{mindmap-definition-RKZ34NQL-DPbXZpjF.js → mindmap-definition-RKZ34NQL-yQ9g46ph.js} +3 -3
- package/dist/{pieDiagram-4H26LBE5-Cp3kzOe6.js → pieDiagram-4H26LBE5-BPAmrvlh.js} +3 -3
- package/dist/{pieDiagram-4H26LBE5-DMGXOR3V.cjs → pieDiagram-4H26LBE5-DDbOWta5.cjs} +1 -1
- package/dist/{quadrantDiagram-W4KKPZXB-Bt7BK_oi.cjs → quadrantDiagram-W4KKPZXB-7EOeN28t.cjs} +1 -1
- package/dist/{quadrantDiagram-W4KKPZXB-D7ZN6s12.js → quadrantDiagram-W4KKPZXB-CBFKlxRx.js} +2 -2
- package/dist/{requirementDiagram-4Y6WPE33-DpNgpxNI.cjs → requirementDiagram-4Y6WPE33-BAkakkMp.cjs} +1 -1
- package/dist/{requirementDiagram-4Y6WPE33-CP_w0jZl.js → requirementDiagram-4Y6WPE33-BZk_3wFB.js} +3 -3
- package/dist/{sankeyDiagram-5OEKKPKP-DbdIXU2h.js → sankeyDiagram-5OEKKPKP-CrbL-5cr.js} +1 -1
- package/dist/{sankeyDiagram-5OEKKPKP-WgmNsD-c.cjs → sankeyDiagram-5OEKKPKP-DYEggaLM.cjs} +1 -1
- package/dist/{sequenceDiagram-3UESZ5HK-CH8lWLXQ.js → sequenceDiagram-3UESZ5HK-B2Yk8NuE.js} +3 -3
- package/dist/{sequenceDiagram-3UESZ5HK-bf29016q.cjs → sequenceDiagram-3UESZ5HK-cky8-ajI.cjs} +1 -1
- package/dist/{stateDiagram-AJRCARHV-DfMkU1La.cjs → stateDiagram-AJRCARHV-4peSgT8x.cjs} +1 -1
- package/dist/{stateDiagram-AJRCARHV-CjIyqaSL.js → stateDiagram-AJRCARHV-DKppy5jM.js} +2 -2
- package/dist/{stateDiagram-v2-BHNVJYJU-B7W7zjFO.cjs → stateDiagram-v2-BHNVJYJU-CefiWaGq.cjs} +1 -1
- package/dist/{stateDiagram-v2-BHNVJYJU-Cs9XaSC7.js → stateDiagram-v2-BHNVJYJU-DsQP1CsR.js} +2 -2
- package/dist/{timeline-definition-PNZ67QCA-NG3L5V_r.cjs → timeline-definition-PNZ67QCA-CFJYzYQn.cjs} +1 -1
- package/dist/{timeline-definition-PNZ67QCA-DWReytgS.js → timeline-definition-PNZ67QCA-snDcaYSq.js} +2 -2
- package/dist/types.d.ts +7 -7
- package/dist/{vennDiagram-CIIHVFJN-DnDoiRcO.js → vennDiagram-CIIHVFJN-BniEMR4w.js} +1 -1
- package/dist/{vennDiagram-CIIHVFJN-CAu-sX41.cjs → vennDiagram-CIIHVFJN-RPKP_Mb2.cjs} +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 +689 -689
- package/dist/{wardleyDiagram-YWT4CUSO-CvMmwHBR.js → wardleyDiagram-YWT4CUSO-DvDYViI5.js} +2 -2
- package/dist/{wardleyDiagram-YWT4CUSO--9yZJSOx.cjs → wardleyDiagram-YWT4CUSO-msArC69-.cjs} +1 -1
- package/dist/{xychartDiagram-2RQKCTM6-VgyxuaQ4.cjs → xychartDiagram-2RQKCTM6-B4nZMXk5.cjs} +1 -1
- package/dist/{xychartDiagram-2RQKCTM6-Bk_dhxt2.js → xychartDiagram-2RQKCTM6-CEcIgPon.js} +2 -2
- package/package.json +1 -1
- package/dist/index-DB9V7zre.cjs +0 -3
- package/dist/index-DcttmVuU.cjs +0 -2
- package/dist/index-DxL6VLOT.cjs +0 -785
- package/dist/index-XkdJshqO.js +0 -2379
- package/dist/useWorkbenchSession-CYrFzUN8.cjs +0 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a$ as zt, $ as Lt, a3 as Tt, b2 as At, a0 as Xt, b0 as Et, b as y, ac as Yt, a1 as It, s as Q, aB as et, a_ as Bt, E as Ft, t as Rt, a2 as V } from "./mermaid.core-
|
|
2
|
-
import { p as Ot } from "./chunk-4BX2VUAB-
|
|
1
|
+
import { a$ as zt, $ as Lt, a3 as Tt, b2 as At, a0 as Xt, b0 as Et, b as y, ac as Yt, a1 as It, s as Q, aB as et, a_ as Bt, E as Ft, t as Rt, a2 as V } from "./mermaid.core-C-YWP2jz.js";
|
|
2
|
+
import { p as Ot } from "./chunk-4BX2VUAB-C_E82st1.js";
|
|
3
3
|
import { p as Wt } from "./wardley-L42UT6IY-DUnkyH_z.js";
|
|
4
4
|
var G = /* @__PURE__ */ y((a, o) => {
|
|
5
5
|
const e = a <= 1 ? a * 100 : a;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./mermaid.core-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./mermaid.core-EIMF3BAo.cjs"),_t=require("./chunk-4BX2VUAB-TTJvrk_8.cjs"),Mt=require("./wardley-L42UT6IY-tDp0NbFW.cjs");var W=x.__name((a,o)=>{const e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${o} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),X=x.__name((a,o,e)=>({x:W(o,`${e} evolution`),y:W(a,`${e} visibility`)}),"toCoordinates"),K=x.__name(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),Nt=x.__name(a=>{if(!(a!=null&&a.startsWith("+")))return{};const o=/^\+'([^']*)'/.exec(a),e=o==null?void 0:o[1];return a.includes("<>")?{flow:"bidirectional",label:e}:a.includes("<")?{flow:"backward",label:e}:a.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Ct=x.__name((a,o)=>{if(_t.populateCommonDb(a,o),a.size&&o.setSize(a.size.width,a.size.height),a.evolution){const e=a.evolution.stages.map(r=>r.secondName?`${r.name.trim()} / ${r.secondName.trim()}`:r.name.trim()),p=a.evolution.stages.filter(r=>r.boundary!==void 0).map(r=>r.boundary);o.updateAxes({stages:e,stageBoundaries:p})}if(a.anchors.forEach(e=>{const p=X(e.visibility,e.evolution,`Anchor "${e.name}"`);o.addNode(e.name,e.name,p.x,p.y,"anchor")}),a.components.forEach(e=>{var v;const p=X(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;o.addNode(e.name,e.name,p.x,p.y,"component",r,d,e.inertia,m)}),a.notes.forEach(e=>{const p=X(e.visibility,e.evolution,`Note "${e.text}"`);o.addNote(e.text,p.x,p.y)}),a.pipelines.forEach(e=>{const p=o.getNode(e.parent);if(!p||typeof p.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const r=p.y;o.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,v=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,u=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,T=W(d.evolution,`Pipeline component "${d.name}" evolution`);o.addNode(m,d.name,T,r,"pipeline-component",v,u),o.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{const p=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let r=K(e.fromPort)??K(e.toPort);const{flow:d,label:m}=Nt(e.arrow);!r&&d&&(r=d);const v=e.linkLabel,u=m??v;o.addLink(o.resolveNodeId(e.from),o.resolveNodeId(e.to),p,u,r)}),a.evolves.forEach(e=>{const p=o.getNode(e.component);if((p==null?void 0:p.y)!==void 0){const r=W(e.target,`Evolve target for "${e.component}"`);o.addTrend(e.component,r,p.y)}}),a.annotations.length>0){const e=a.annotations[0],p=X(e.x,e.y,"Annotations box");o.setAnnotationsBox(p.x,p.y)}a.annotation.forEach(e=>{const p=X(e.x,e.y,`Annotation ${e.number}`);o.addAnnotation(e.number,[{x:p.x,y:p.y}],e.text)}),a.accelerators.forEach(e=>{const p=X(e.x,e.y,`Accelerator "${e.name}"`);o.addAccelerator(e.name,p.x,p.y)}),a.deaccelerators.forEach(e=>{const p=X(e.x,e.y,`Deaccelerator "${e.name}"`);o.addDeaccelerator(e.name,p.x,p.y)})},"populateDb"),Q={parser:{yy:void 0},parse:x.__name(async a=>{var p;const o=await Mt.parse("wardley",a);x.log.debug(o);const e=(p=Q.parser)==null?void 0:p.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Ct(o,e)},"parse")},Y,Tt=(Y=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(o){const e=this.nodes.get(o.id)??{id:o.id,label:o.label},p={...e,...o,className:o.className??e.className,labelOffsetX:o.labelOffsetX??e.labelOffsetX,labelOffsetY:o.labelOffsetY??e.labelOffsetY};this.nodes.set(o.id,p)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});const e=this.nodes.get(o);e&&(e.isPipelineParent=!0)}addPipelineComponent(o,e){const p=this.pipelines.get(o);p&&p.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,e){this.annotationsBox={x:o,y:e}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,e){this.size={width:o,height:e}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(const[e,p]of this.nodes)if(p.label===o)return e;return o}build(){const o=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);o.push(e)}return{nodes:o,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},x.__name(Y,"WardleyBuilder"),Y),b=new Tt;function tt(){return x.getConfig2()["wardley-beta"]}x.__name(tt,"getConfig");function et(a,o,e,p,r,d,m,v,u){b.addNode({id:a,label:o,x:e,y:p,className:r,labelOffsetX:d,labelOffsetY:m,inertia:v,sourceStrategy:u})}x.__name(et,"addNode");function at(a,o,e=!1,p,r){b.addLink({source:a,target:o,dashed:e,label:p,flow:r})}x.__name(at,"addLink");function rt(a,o,e){b.addTrend({nodeId:a,targetX:o,targetY:e})}x.__name(rt,"addTrend");function ot(a,o,e){b.addAnnotation({number:a,coordinates:o,text:e})}x.__name(ot,"addAnnotation");function nt(a,o,e){b.addNote({text:a,x:o,y:e})}x.__name(nt,"addNote");function st(a,o,e){b.addAccelerator({name:a,x:o,y:e})}x.__name(st,"addAccelerator");function it(a,o,e){b.addDeaccelerator({name:a,x:o,y:e})}x.__name(it,"addDeaccelerator");function dt(a,o){b.setAnnotationsBox(a,o)}x.__name(dt,"setAnnotationsBox");function lt(a,o){b.setSize(a,o)}x.__name(lt,"setSize");function ct(a){b.startPipeline(a)}x.__name(ct,"startPipeline");function pt(a,o){b.addPipelineComponent(a,o)}x.__name(pt,"addPipelineComponent");function ht(a){b.setAxes(a)}x.__name(ht,"updateAxes");function xt(a){return b.getNode(a)}x.__name(xt,"getNode");function ft(a){return b.resolveNodeId(a)}x.__name(ft,"resolveNodeId");function gt(){return b.build()}x.__name(gt,"getWardleyData");function ut(){b.clear(),x.clear()}x.__name(ut,"clear");var At={getConfig:tt,addNode:et,addLink:at,addTrend:rt,addAnnotation:ot,addNote:nt,addAccelerator:st,addDeaccelerator:it,setAnnotationsBox:dt,setSize:lt,startPipeline:ct,addPipelineComponent:pt,updateAxes:ht,getNode:xt,resolveNodeId:ft,getWardleyData:gt,clear:ut,setAccTitle:x.setAccTitle,getAccTitle:x.getAccTitle,setDiagramTitle:x.setDiagramTitle,getDiagramTitle:x.getDiagramTitle,getAccDescription:x.getAccDescription,setAccDescription:x.setAccDescription},Lt=["Genesis","Custom Built","Product","Commodity"],zt=x.__name(()=>{var o,e,p,r,d,m,v,u,T,_,k,M;const{themeVariables:a}=x.getConfig2();return{backgroundColor:((o=a.wardley)==null?void 0:o.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((p=a.wardley)==null?void 0:p.axisTextColor)??a.primaryTextColor??"#222",gridColor:((r=a.wardley)==null?void 0:r.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((d=a.wardley)==null?void 0:d.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((u=a.wardley)==null?void 0:u.linkStroke)??"#000",evolutionStroke:((T=a.wardley)==null?void 0:T.evolutionStroke)??"#dc3545",annotationStroke:((_=a.wardley)==null?void 0:_.annotationStroke)??"#000",annotationTextColor:((k=a.wardley)==null?void 0:k.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((M=a.wardley)==null?void 0:M.annotationFill)??a.background??"#fff"}},"getTheme"),Xt=x.__name(()=>{const a=x.getConfig2()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),Et=x.__name((a,o,e,p)=>{var Z,J;x.log.debug(`Rendering Wardley map
|
|
2
2
|
`+a);const r=Xt(),d=zt(),m=r.nodeRadius*1.6,v=p.db,u=v.getWardleyData(),T=v.getDiagramTitle(),_=((Z=u.size)==null?void 0:Z.width)??r.width,k=((J=u.size)==null?void 0:J.height)??r.height,M=x.selectSvgElement(o);M.selectAll("*").remove(),x.configureSvgSize(M,k,_,r.useMaxWidth),M.attr("viewBox",`0 0 ${_} ${k}`);const P=M.append("g").attr("class","wardley-map"),G=M.append("defs");G.append("marker").attr("id",`arrow-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.evolutionStroke).attr("stroke","none"),G.append("marker").attr("id",`link-arrow-end-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.linkStroke).attr("stroke","none"),G.append("marker").attr("id",`link-arrow-start-${o}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",d.linkStroke).attr("stroke","none"),P.append("rect").attr("class","wardley-background").attr("width",_).attr("height",k).attr("fill",d.backgroundColor);const I=_-r.padding*2,B=k-r.padding*2;T&&P.append("text").attr("class","wardley-title").attr("x",_/2).attr("y",r.padding/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(T);const A=x.__name(t=>r.padding+t/100*I,"projectX"),L=x.__name(t=>k-r.padding-t/100*B,"projectY"),O=P.append("g").attr("class","wardley-axes");O.append("line").attr("x1",r.padding).attr("x2",_-r.padding).attr("y1",k-r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1),O.append("line").attr("x1",r.padding).attr("x2",r.padding).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1);const yt=u.axes.xLabel??"Evolution",mt=u.axes.yLabel??"Visibility";O.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",r.padding+I/2).attr("y",k-r.padding/4).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(yt),O.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",r.padding/3).attr("y",r.padding+B/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${r.padding/3} ${r.padding+B/2})`).text(mt);const F=u.axes.stages&&u.axes.stages.length>0?u.axes.stages:Lt;if(F.length>0){const t=P.append("g").attr("class","wardley-stages"),s=u.axes.stageBoundaries,n=[];if(s&&s.length===F.length){let i=0;s.forEach(h=>{n.push({start:i,end:h}),i=h})}else{const i=1/F.length;F.forEach((h,l)=>{n.push({start:l*i,end:(l+1)*i})})}F.forEach((i,h)=>{const l=n[h],f=r.padding+l.start*I,g=r.padding+l.end*I,y=(f+g)/2;h>0&&t.append("line").attr("x1",f).attr("x2",f).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",y).attr("y",k-r.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(r.showGrid){const t=P.append("g").attr("class","wardley-grid");for(let s=1;s<4;s++){const n=s/4,i=r.padding+I*n;t.append("line").attr("x1",i).attr("x2",i).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",r.padding).attr("x2",_-r.padding).attr("y1",k-r.padding-B*n).attr("y2",k-r.padding-B*n).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}const c=new Map;if(u.nodes.forEach(t=>{c.set(t.id,{x:A(t.x),y:L(t.y),node:t})}),u.pipelines.length>0){const t=P.append("g").attr("class","wardley-pipelines"),s=P.append("g").attr("class","wardley-pipeline-links");u.pipelines.forEach(n=>{if(n.componentIds.length===0)return;const i=n.componentIds.map(g=>({id:g,pos:c.get(g),node:u.nodes.find(y=>y.id===g)})).filter(g=>g.pos&&g.node).sort((g,y)=>g.node.x-y.node.x);for(let g=0;g<i.length-1;g++){const y=i[g],w=i[g+1];s.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",y.pos.x).attr("y1",y.pos.y).attr("x2",w.pos.x).attr("y2",w.pos.y).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let h=1/0,l=-1/0,f=0;if(n.componentIds.forEach(g=>{const y=c.get(g);y&&(h=Math.min(h,y.x),l=Math.max(l,y.x),f=y.y)}),h!==1/0&&l!==-1/0){const y=r.nodeRadius*4,w=f-y/2,S=c.get(n.nodeId);if(S){const C=(h+l)/2;S.x=C,S.y=w-m/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",h-15).attr("y",w).attr("width",l-h+15*2).attr("height",y).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const j=P.append("g").attr("class","wardley-links"),V=new Map;u.pipelines.forEach(t=>{V.set(t.nodeId,new Set(t.componentIds))});const U=u.links.filter(t=>{if(!c.has(t.source)||!c.has(t.target))return!1;const s=V.get(t.target);return!(s!=null&&s.has(t.source))});j.selectAll("line").data(U).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{const s=c.get(t.source),n=c.get(t.target),h=u.nodes.find(y=>y.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,f=n.y-s.y,g=Math.sqrt(l*l+f*f);return s.x+l/g*h}).attr("y1",t=>{const s=c.get(t.source),n=c.get(t.target),h=u.nodes.find(y=>y.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,f=n.y-s.y,g=Math.sqrt(l*l+f*f);return s.y+f/g*h}).attr("x2",t=>{const s=c.get(t.source),n=c.get(t.target),h=u.nodes.find(y=>y.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,f=s.y-n.y,g=Math.sqrt(l*l+f*f);return n.x+l/g*h}).attr("y2",t=>{const s=c.get(t.source),n=c.get(t.target),h=u.nodes.find(y=>y.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,f=s.y-n.y,g=Math.sqrt(l*l+f*f);return n.y+f/g*h}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${o})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${o})`:null),j.selectAll("text").data(U.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.x+n.x)/2,h=n.y-s.y,l=n.x-s.x,f=Math.sqrt(l*l+h*h),g=8,y=h/f;return i+y*g}).attr("y",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.y+n.y)/2,h=n.x-s.x,l=n.y-s.y,f=Math.sqrt(h*h+l*l),g=8,y=-h/f;return i+y*g}).attr("fill",d.axisTextColor).attr("font-size",r.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.x+n.x)/2,h=(s.y+n.y)/2,l=n.x-s.x,f=n.y-s.y,g=Math.sqrt(l*l+f*f),y=8,w=f/g,S=-l/g,C=i+w*y,R=h+S*y;let E=Math.atan2(f,l)*180/Math.PI;return(E>90||E<-90)&&(E+=180),`rotate(${E} ${C} ${R})`}).text(t=>t.label);const wt=P.append("g").attr("class","wardley-trends"),kt=u.trends.map(t=>{const s=c.get(t.nodeId);if(!s)return null;const n=A(t.targetX),i=L(t.targetY),h=n-s.x,l=i-s.y,f=Math.sqrt(h*h+l*l),g=r.nodeRadius+2,y=f>g?n-h/f*g:n,w=f>g?i-l/f*g:i;return{origin:s,targetX:n,targetY:i,adjustedX2:y,adjustedY2:w}}).filter(t=>t!==null);wt.selectAll("line").data(kt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${o})`);const N=P.append("g").attr("class","wardley-nodes").selectAll("g").data(u.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));N.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),N.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),N.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const z=N.filter(t=>t.sourceStrategy==="market");z.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),N.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);const q=r.nodeRadius*.7,$=r.nodeRadius*1.2;if(z.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-$).attr("x2",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),z.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),z.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-$).attr("stroke",d.componentStroke).attr("stroke-width",1),z.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-$).attr("r",q).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),z.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",q).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),z.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",q).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),N.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-m/2).attr("y",t=>c.get(t.id).y-m/2).attr("width",m).attr("height",m).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),N.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{const s=c.get(t.id);let n=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(n+=r.nodeRadius+10),s.x+n}).attr("y1",t=>{const s=c.get(t.id),n=t.isPipelineParent?m:r.nodeRadius*2;return s.y-n/2}).attr("x2",t=>{const s=c.get(t.id);let n=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(n+=r.nodeRadius+10),s.x+n}).attr("y2",t=>{const s=c.get(t.id),n=t.isPipelineParent?m:r.nodeRadius*2;return s.y+n/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),N.append("text").attr("x",t=>{const s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?s.x+t.labelOffsetX:s.x;let n=r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(n+=10);const i=t.labelOffsetX??n;return s.x+i}).attr("y",t=>{const s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?s.y+t.labelOffsetY:s.y-3;let n=-r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(n-=10);const i=t.labelOffsetY??n;return s.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",r.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),u.annotations.length>0){const t=P.append("g").attr("class","wardley-annotations");if(u.annotations.forEach(s=>{const n=s.coordinates.map(i=>({x:A(i.x),y:L(i.y)}));if(n.length>1)for(let i=0;i<n.length-1;i++)t.append("line").attr("class","wardley-annotation-line").attr("x1",n[i].x).attr("y1",n[i].y).attr("x2",n[i+1].x).attr("y2",n[i+1].y).attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");n.forEach(i=>{const h=t.append("g").attr("class","wardley-annotation");h.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),h.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.number)})}),u.annotationsBox){let s=A(u.annotationsBox.x),n=L(u.annotationsBox.y);const i=10,h=16,l=11,f=t.append("g").attr("class","wardley-annotations-box"),g=[...u.annotations].filter(w=>w.text).sort((w,S)=>w.number-S.number),y=[];if(g.forEach((w,S)=>{const C=f.append("text").attr("x",s+i).attr("y",n+i+(S+1)*h).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${w.number}. ${w.text}`);y.push(C)}),y.length>0){let w=0,S=0;y.forEach(H=>{const D=H.node(),Pt=D.getComputedTextLength();w=Math.max(w,Pt);const St=D.getBBox();S=Math.max(S,St.height)});const C=w+i*2+105,R=g.length*h+i*2+S/2,E=r.padding,bt=_-r.padding-C,$t=r.padding,vt=k-r.padding-R;s=Math.max(E,Math.min(s,bt)),n=Math.max($t,Math.min(n,vt)),y.forEach((H,D)=>{H.attr("x",s+i).attr("y",n+i+(D+1)*h)}),f.insert("rect","text").attr("x",s).attr("y",n).attr("width",C).attr("height",R).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(u.notes.length>0){const t=P.append("g").attr("class","wardley-notes");u.notes.forEach(s=>{const n=A(s.x),i=L(s.y);t.append("text").attr("x",n).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.text)})}if(u.accelerators.length>0){const t=P.append("g").attr("class","wardley-accelerators");u.accelerators.forEach(s=>{const n=A(s.x),i=L(s.y),h=60,l=30,f=20,g=`
|
|
3
3
|
M ${n} ${i-l/2}
|
|
4
4
|
L ${n+h-f} ${i-l/2}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./mermaid.core-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./mermaid.core-EIMF3BAo.cjs"),oe=require("./init-CHZsXQcr.cjs"),he=require("./ordinal-CagbB1m8.cjs"),Bt=require("./linear-BeJA81Is.cjs");function le(i,t,e){i=+i,t=+t,e=(a=arguments.length)<2?(t=i,i=0,1):a<3?1:+e;for(var s=-1,a=Math.max(0,Math.ceil((t-i)/e))|0,o=new Array(a);++s<a;)o[s]=i+s*e;return o}function _t(){var i=he.ordinal().unknown(void 0),t=i.domain,e=i.range,s=0,a=1,o,u,p=!1,f=0,R=0,P=.5;delete i.unknown;function S(){var y=t().length,E=a<s,v=E?a:s,L=E?s:a;o=(L-v)/Math.max(1,y-f+R*2),p&&(o=Math.floor(o)),v+=(L-v-o*(y-f))*P,u=o*(1-f),p&&(v=Math.round(v),u=Math.round(u));var M=le(y).map(function(m){return v+o*m});return e(E?M.reverse():M)}return i.domain=function(y){return arguments.length?(t(y),S()):t()},i.range=function(y){return arguments.length?([s,a]=y,s=+s,a=+a,S()):[s,a]},i.rangeRound=function(y){return[s,a]=y,s=+s,a=+a,p=!0,S()},i.bandwidth=function(){return u},i.step=function(){return o},i.round=function(y){return arguments.length?(p=!!y,S()):p},i.padding=function(y){return arguments.length?(f=Math.min(1,R=+y),S()):f},i.paddingInner=function(y){return arguments.length?(f=Math.min(1,y),S()):f},i.paddingOuter=function(y){return arguments.length?(R=+y,S()):R},i.align=function(y){return arguments.length?(P=Math.max(0,Math.min(1,y)),S()):P},i.copy=function(){return _t(t(),[s,a]).round(p).paddingInner(f).paddingOuter(R).align(P)},oe.initRange.apply(S(),arguments)}var bt=function(){var i=n.__name(function(F,h,c,g){for(c=c||{},g=F.length;g--;c[F[g]]=h);return c},"o"),t=[1,10,12,14,16,18,19,21,23],e=[2,6],s=[1,3],a=[1,5],o=[1,6],u=[1,7],p=[1,5,10,12,14,16,18,19,21,23,34,35,36],f=[1,25],R=[1,26],P=[1,28],S=[1,29],y=[1,30],E=[1,31],v=[1,32],L=[1,33],M=[1,34],m=[1,35],T=[1,36],l=[1,37],W=[1,43],z=[1,42],X=[1,47],Y=[1,50],C=[1,10,12,14,16,18,19,21,23,34,35,36],$=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],_=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],A=[1,64],V={trace:n.__name(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:n.__name(function(h,c,g,x,w,r,rt){var d=r.length-1;switch(w){case 5:x.setOrientation(r[d]);break;case 9:x.setDiagramTitle(r[d].text.trim());break;case 12:x.setLineData({text:"",type:"text"},r[d]);break;case 13:x.setLineData(r[d-1],r[d]);break;case 14:x.setBarData({text:"",type:"text"},r[d]);break;case 15:x.setBarData(r[d-1],r[d]);break;case 16:this.$=r[d].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=r[d].trim(),x.setAccDescription(this.$);break;case 19:this.$=r[d-1];break;case 20:this.$=[Number(r[d-2]),...r[d]];break;case 21:this.$=[Number(r[d])];break;case 22:x.setXAxisTitle(r[d]);break;case 23:x.setXAxisTitle(r[d-1]);break;case 24:x.setXAxisTitle({type:"text",text:""});break;case 25:x.setXAxisBand(r[d]);break;case 26:x.setXAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 27:this.$=r[d-1];break;case 28:this.$=[r[d-2],...r[d]];break;case 29:this.$=[r[d]];break;case 30:x.setYAxisTitle(r[d]);break;case 31:x.setYAxisTitle(r[d-1]);break;case 32:x.setYAxisTitle({type:"text",text:""});break;case 33:x.setYAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 37:this.$={text:r[d],type:"text"};break;case 38:this.$={text:r[d],type:"text"};break;case 39:this.$={text:r[d],type:"markdown"};break;case 40:this.$=r[d];break;case 41:this.$=r[d-1]+""+r[d];break}},"anonymous"),table:[i(t,e,{3:1,4:2,7:4,5:s,34:a,35:o,36:u}),{1:[3]},i(t,e,{4:2,7:4,3:8,5:s,34:a,35:o,36:u}),i(t,e,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:a,35:o,36:u}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},i(p,[2,34]),i(p,[2,35]),i(p,[2,36]),{1:[2,1]},i(t,e,{4:2,7:4,3:21,5:s,34:a,35:o,36:u}),{1:[2,3]},i(p,[2,5]),i(t,[2,7],{4:22,34:a,35:o,36:u}),{11:23,37:24,38:f,39:R,40:27,41:P,42:S,43:y,44:E,45:v,46:L,47:M,48:m,49:T,50:l},{11:39,13:38,24:W,27:z,29:40,30:41,37:24,38:f,39:R,40:27,41:P,42:S,43:y,44:E,45:v,46:L,47:M,48:m,49:T,50:l},{11:45,15:44,27:X,33:46,37:24,38:f,39:R,40:27,41:P,42:S,43:y,44:E,45:v,46:L,47:M,48:m,49:T,50:l},{11:49,17:48,24:Y,37:24,38:f,39:R,40:27,41:P,42:S,43:y,44:E,45:v,46:L,47:M,48:m,49:T,50:l},{11:52,17:51,24:Y,37:24,38:f,39:R,40:27,41:P,42:S,43:y,44:E,45:v,46:L,47:M,48:m,49:T,50:l},{20:[1,53]},{22:[1,54]},i(C,[2,18]),{1:[2,2]},i(C,[2,8]),i(C,[2,9]),i($,[2,37],{40:55,41:P,42:S,43:y,44:E,45:v,46:L,47:M,48:m,49:T,50:l}),i($,[2,38]),i($,[2,39]),i(_,[2,40]),i(_,[2,42]),i(_,[2,43]),i(_,[2,44]),i(_,[2,45]),i(_,[2,46]),i(_,[2,47]),i(_,[2,48]),i(_,[2,49]),i(_,[2,50]),i(_,[2,51]),i(C,[2,10]),i(C,[2,22],{30:41,29:56,24:W,27:z}),i(C,[2,24]),i(C,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:f,39:R,40:27,41:P,42:S,43:y,44:E,45:v,46:L,47:M,48:m,49:T,50:l},i(C,[2,11]),i(C,[2,30],{33:60,27:X}),i(C,[2,32]),{31:[1,61]},i(C,[2,12]),{17:62,24:Y},{25:63,27:A},i(C,[2,14]),{17:65,24:Y},i(C,[2,16]),i(C,[2,17]),i(_,[2,41]),i(C,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},i(C,[2,31]),{27:[1,69]},i(C,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},i(C,[2,15]),i(C,[2,26]),i(C,[2,27]),{11:59,32:72,37:24,38:f,39:R,40:27,41:P,42:S,43:y,44:E,45:v,46:L,47:M,48:m,49:T,50:l},i(C,[2,33]),i(C,[2,19]),{25:73,27:A},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:n.__name(function(h,c){if(c.recoverable)this.trace(h);else{var g=new Error(h);throw g.hash=c,g}},"parseError"),parse:n.__name(function(h){var c=this,g=[0],x=[],w=[null],r=[],rt=this.table,d="",ct=0,Et=0,se=2,Mt=1,ne=r.slice.call(arguments,1),D=Object.create(this.lexer),U={yy:{}};for(var ft in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ft)&&(U.yy[ft]=this.yy[ft]);D.setInput(h,U.yy),U.yy.lexer=D,U.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var pt=D.yylloc;r.push(pt);var ae=D.options&&D.options.ranges;typeof U.yy.parseError=="function"?this.parseError=U.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function re(B){g.length=g.length-2*B,w.length=w.length-B,r.length=r.length-B}n.__name(re,"popStack");function It(){var B;return B=x.pop()||D.lex()||Mt,typeof B!="number"&&(B instanceof Array&&(x=B,B=x.pop()),B=c.symbols_[B]||B),B}n.__name(It,"lex");for(var I,q,O,mt,j={},ut,N,Vt,gt;;){if(q=g[g.length-1],this.defaultActions[q]?O=this.defaultActions[q]:((I===null||typeof I>"u")&&(I=It()),O=rt[q]&&rt[q][I]),typeof O>"u"||!O.length||!O[0]){var yt="";gt=[];for(ut in rt[q])this.terminals_[ut]&&ut>se&>.push("'"+this.terminals_[ut]+"'");D.showPosition?yt="Parse error on line "+(ct+1)+`:
|
|
2
2
|
`+D.showPosition()+`
|
|
3
3
|
Expecting `+gt.join(", ")+", got '"+(this.terminals_[I]||I)+"'":yt="Parse error on line "+(ct+1)+": Unexpected "+(I==Mt?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(yt,{text:D.match,token:this.terminals_[I]||I,line:D.yylineno,loc:pt,expected:gt})}if(O[0]instanceof Array&&O.length>1)throw new Error("Parse Error: multiple actions possible at state: "+q+", token: "+I);switch(O[0]){case 1:g.push(I),w.push(D.yytext),r.push(D.yylloc),g.push(O[1]),I=null,Et=D.yyleng,d=D.yytext,ct=D.yylineno,pt=D.yylloc;break;case 2:if(N=this.productions_[O[1]][1],j.$=w[w.length-N],j._$={first_line:r[r.length-(N||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(N||1)].first_column,last_column:r[r.length-1].last_column},ae&&(j._$.range=[r[r.length-(N||1)].range[0],r[r.length-1].range[1]]),mt=this.performAction.apply(j,[d,Et,ct,U.yy,O[1],w,r].concat(ne)),typeof mt<"u")return mt;N&&(g=g.slice(0,-1*N*2),w=w.slice(0,-1*N),r=r.slice(0,-1*N)),g.push(this.productions_[O[1]][0]),w.push(j.$),r.push(j._$),Vt=rt[g[g.length-2]][g[g.length-1]],g.push(Vt);break;case 3:return!0}}return!0},"parse")},k=function(){var F={EOF:1,parseError:n.__name(function(c,g){if(this.yy.parser)this.yy.parser.parseError(c,g);else throw new Error(c)},"parseError"),setInput:n.__name(function(h,c){return this.yy=c||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:n.__name(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var c=h.match(/(?:\r\n?|\n).*/g);return c?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:n.__name(function(h){var c=h.length,g=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-c),this.offset-=c;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var w=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===x.length?this.yylloc.first_column:0)+x[x.length-g.length].length-g[0].length:this.yylloc.first_column-c},this.options.ranges&&(this.yylloc.range=[w[0],w[0]+this.yyleng-c]),this.yyleng=this.yytext.length,this},"unput"),more:n.__name(function(){return this._more=!0,this},"more"),reject:n.__name(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:n.__name(function(h){this.unput(this.match.slice(h))},"less"),pastInput:n.__name(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:n.__name(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:n.__name(function(){var h=this.pastInput(),c=new Array(h.length+1).join("-");return h+this.upcomingInput()+`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a$ as gi, $ as xi, a3 as Xt, b2 as di, a0 as fi, b0 as pi, b as a, aB as Yt, a_ as mi, E as yi, t as bi, a1 as _t, aX as Ai, s as Nt, Q as wi, ac as Ci, A as Si, ay as Wt } from "./mermaid.core-
|
|
1
|
+
import { a$ as gi, $ as xi, a3 as Xt, b2 as di, a0 as fi, b0 as pi, b as a, aB as Yt, a_ as mi, E as yi, t as bi, a1 as _t, aX as Ai, s as Nt, Q as wi, ac as Ci, A as Si, ay as Wt } from "./mermaid.core-C-YWP2jz.js";
|
|
2
2
|
import { i as _i } from "./init-DjUOC4st.js";
|
|
3
3
|
import { o as ki } from "./ordinal-DfAQgscy.js";
|
|
4
|
-
import { l as zt } from "./linear-
|
|
4
|
+
import { l as zt } from "./linear-O3WIbS9A.js";
|
|
5
5
|
function Ri(e, t, i) {
|
|
6
6
|
e = +e, t = +t, i = (n = arguments.length) < 2 ? (t = e, e = 0, 1) : n < 3 ? 1 : +i;
|
|
7
7
|
for (var s = -1, n = Math.max(0, Math.ceil((t - e) / i)) | 0, o = new Array(n); ++s < n; )
|
package/package.json
CHANGED
package/dist/index-DB9V7zre.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DxL6VLOT.cjs"),pe=require("./useWorkbenchSession-CYrFzUN8.cjs"),xt=require("./index-BcUHp4mm.cjs"),Mt=require("./index-LAVofA4F.cjs");var Tt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M952 474H829.8C812.5 327.6 696.4 211.5 550 194.2V72c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v122.2C327.6 211.5 211.5 327.6 194.2 474H72c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h122.2C211.5 696.4 327.6 812.5 474 829.8V952c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V829.8C696.4 812.5 812.5 696.4 829.8 550H952c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM512 756c-134.8 0-244-109.2-244-244s109.2-244 244-244 244 109.2 244 244-109.2 244-244 244z"}},{tag:"path",attrs:{d:"M512 392c-32.1 0-62.1 12.4-84.8 35.2-22.7 22.7-35.2 52.7-35.2 84.8s12.5 62.1 35.2 84.8C449.9 619.4 480 632 512 632s62.1-12.5 84.8-35.2C619.4 574.1 632 544 632 512s-12.5-62.1-35.2-84.8A118.57 118.57 0 00512 392z"}}]},name:"aim",theme:"outlined"};function Fe(){return Fe=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(n[o]=a[o])}return n},Fe.apply(this,arguments)}const Lt=(n,t)=>e.reactExports.createElement(e.Icon,Fe({},n,{ref:t,icon:Tt})),$t=e.reactExports.forwardRef(Lt);var Bt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888.3 693.2c-42.5-24.6-94.3-18-129.2 12.8l-53-30.7V523.6c0-15.7-8.4-30.3-22-38.1l-136-78.3v-67.1c44.2-15 76-56.8 76-106.1 0-61.9-50.1-112-112-112s-112 50.1-112 112c0 49.3 31.8 91.1 76 106.1v67.1l-136 78.3c-13.6 7.8-22 22.4-22 38.1v151.6l-53 30.7c-34.9-30.8-86.8-37.4-129.2-12.8-53.5 31-71.7 99.4-41 152.9 30.8 53.5 98.9 71.9 152.2 41 42.5-24.6 62.7-73 53.6-118.8l48.7-28.3 140.6 81c6.8 3.9 14.4 5.9 22 5.9s15.2-2 22-5.9L674.5 740l48.7 28.3c-9.1 45.7 11.2 94.2 53.6 118.8 53.3 30.9 121.5 12.6 152.2-41 30.8-53.6 12.6-122-40.7-152.9zm-673 138.4a47.6 47.6 0 01-65.2-17.6c-13.2-22.9-5.4-52.3 17.5-65.5a47.6 47.6 0 0165.2 17.6c13.2 22.9 5.4 52.3-17.5 65.5zM522 463.8zM464 234a48.01 48.01 0 0196 0 48.01 48.01 0 01-96 0zm170 446.2l-122 70.3-122-70.3V539.8l122-70.3 122 70.3v140.4zm239.9 133.9c-13.2 22.9-42.4 30.8-65.2 17.6-22.8-13.2-30.7-42.6-17.5-65.5s42.4-30.8 65.2-17.6c22.9 13.2 30.7 42.5 17.5 65.5z"}}]},name:"deployment-unit",theme:"outlined"};function Ge(){return Ge=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(n[o]=a[o])}return n},Ge.apply(this,arguments)}const Dt=(n,t)=>e.reactExports.createElement(e.Icon,Ge({},n,{ref:t,icon:Bt})),Ot=e.reactExports.forwardRef(Dt);var zt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M904 160H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8zm0 624H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8zm0-312H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8z"}}]},name:"menu",theme:"outlined"};function Ke(){return Ke=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(n[o]=a[o])}return n},Ke.apply(this,arguments)}const Wt=(n,t)=>e.reactExports.createElement(e.Icon,Ke({},n,{ref:t,icon:zt})),it=e.reactExports.forwardRef(Wt);var qt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M705.6 124.9a8 8 0 00-11.6 7.2v64.2c0 5.5 2.9 10.6 7.5 13.6a352.2 352.2 0 0162.2 49.8c32.7 32.8 58.4 70.9 76.3 113.3a355 355 0 0127.9 138.7c0 48.1-9.4 94.8-27.9 138.7a355.92 355.92 0 01-76.3 113.3 353.06 353.06 0 01-113.2 76.4c-43.8 18.6-90.5 28-138.5 28s-94.7-9.4-138.5-28a353.06 353.06 0 01-113.2-76.4A355.92 355.92 0 01184 650.4a355 355 0 01-27.9-138.7c0-48.1 9.4-94.8 27.9-138.7 17.9-42.4 43.6-80.5 76.3-113.3 19-19 39.8-35.6 62.2-49.8 4.7-2.9 7.5-8.1 7.5-13.6V132c0-6-6.3-9.8-11.6-7.2C178.5 195.2 82 339.3 80 506.3 77.2 745.1 272.5 943.5 511.2 944c239 .5 432.8-193.3 432.8-432.4 0-169.2-97-315.7-238.4-386.7zM480 560h64c4.4 0 8-3.6 8-8V88c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8z"}}]},name:"poweroff",theme:"outlined"};function He(){return He=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(n[o]=a[o])}return n},He.apply(this,arguments)}const Vt=(n,t)=>e.reactExports.createElement(e.Icon,He({},n,{ref:t,icon:qt})),Ut=e.reactExports.forwardRef(Vt);var Qt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M876.6 239.5c-.5-.9-1.2-1.8-2-2.5-5-5-13.1-5-18.1 0L684.2 409.3l-67.9-67.9L788.7 169c.8-.8 1.4-1.6 2-2.5 3.6-6.1 1.6-13.9-4.5-17.5-98.2-58-226.8-44.7-311.3 39.7-67 67-89.2 162-66.5 247.4l-293 293c-3 3-2.8 7.9.3 11l169.7 169.7c3.1 3.1 8.1 3.3 11 .3l292.9-292.9c85.5 22.8 180.5.7 247.6-66.4 84.4-84.5 97.7-213.1 39.7-311.3zM786 499.8c-58.1 58.1-145.3 69.3-214.6 33.6l-8.8 8.8-.1-.1-274 274.1-79.2-79.2 230.1-230.1s0 .1.1.1l52.8-52.8c-35.7-69.3-24.5-156.5 33.6-214.6a184.2 184.2 0 01144-53.5L537 318.9a32.05 32.05 0 000 45.3l124.5 124.5a32.05 32.05 0 0045.3 0l132.8-132.8c3.7 51.8-14.4 104.8-53.6 143.9z"}}]},name:"tool",theme:"outlined"};function Ze(){return Ze=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(n[o]=a[o])}return n},Ze.apply(this,arguments)}const Ft=(n,t)=>e.reactExports.createElement(e.Icon,Ze({},n,{ref:t,icon:Qt})),Gt=e.reactExports.forwardRef(Ft);function Kt({active:n,agents:t,collapsed:a,onToggle:o,className:c,activeView:h="chat",onViewChange:l,onToolboxOpen:p,showLogout:w,onLogout:y,sidebarAgentMode:g=!1,onToggleSidebarMode:u,onAgentSelect:R}){const f=localStorage.getItem("sso_domain")||"",q=[{key:"chat",icon:e.jsxRuntimeExports.jsx(pe.RefIcon$4,{}),title:"对话"},...["maiduo","eccang"].includes(f)?[{key:"plan",icon:e.jsxRuntimeExports.jsx(Ot,{}),title:"自动化Beta"}]:[],{key:"professional",icon:e.jsxRuntimeExports.jsx(e.RefIcon$14,{}),title:"专业智能体"}],E=[...f==="yunduo"?[]:[{key:"toolbox",icon:e.jsxRuntimeExports.jsx(Gt,{}),label:"工具箱"},{key:"goals",icon:e.jsxRuntimeExports.jsx($t,{}),label:"目标追踪"}],{key:"settings",icon:e.jsxRuntimeExports.jsx(pe.RefIcon$3,{}),label:"通知配置"}];return e.jsxRuntimeExports.jsx("div",{className:"wandox-aside-wrap",children:e.jsxRuntimeExports.jsxs("div",{className:`wandox-aside ${a?"wandox-aside--collapsed":""} ${c||""}`,"aria-hidden":a,children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-aside-header",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-aside-header__title",children:"AI 智能体"}),o&&e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-aside-header-toggle",onClick:o,"aria-label":a?"展开侧边栏":"收起侧边栏",title:a?"展开侧边栏":"收起侧边栏",children:e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 24 24",children:[e.jsxRuntimeExports.jsx("title",{children:a?"展开侧边栏":"收起侧边栏"}),e.jsxRuntimeExports.jsx("path",{fill:"currentColor",d:"M21 5H11v14h10zM3 5h6v14H3zm0-2a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zm2 4.25a.75.75 0 0 0 0 1.5h2a.75.75 0 0 0 0-1.5zm-.75 3.5A.75.75 0 0 1 5 10h2a.75.75 0 0 1 0 1.5H5a.75.75 0 0 1-.75-.75m.75 2a.75.75 0 0 0 0 1.5h2a.75.75 0 0 0 0-1.5z"})]})})]}),e.jsxRuntimeExports.jsx("div",{className:"wandox-aside-main-nav",children:e.jsxRuntimeExports.jsx("div",{className:"wandox-aside-nav-list",children:q.map(r=>{const x=h===r.key,k=r.key==="professional";return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("div",{className:`wandox-aside-nav-item-wrap${x?" wandox-aside-nav-item-wrap--active":""}`,children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>l==null?void 0:l(r.key),className:`wandox-aside-nav-item${x?" wandox-aside-nav-item--active":""}`,children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-aside-nav-icon",children:r.icon}),e.jsxRuntimeExports.jsx("span",{className:"wandox-aside-nav-title",children:r.title})]}),k&&!a&&u&&e.jsxRuntimeExports.jsx(e.Tooltip,{title:g?"收起列表":"展开列表",placement:"right",children:e.jsxRuntimeExports.jsx("button",{type:"button",className:`wandox-aside-mode-toggle${g?" wandox-aside-mode-toggle--active":""}`,onClick:b=>{b.stopPropagation(),u()},children:g?e.jsxRuntimeExports.jsx(e.RefIcon$12,{style:{fontSize:11}}):e.jsxRuntimeExports.jsx(e.RefIcon$13,{style:{fontSize:11}})})})]}),k&&(g||a)&&e.jsxRuntimeExports.jsx("div",{className:"wandox-aside-agent-list",children:t.map(b=>{const D=b.agent_id;if(!D)return null;const v=n===D&&h==="professional";return e.jsxRuntimeExports.jsx(e.Tooltip,{title:b.name,placement:"right",children:e.jsxRuntimeExports.jsxs("button",{type:"button",className:`wandox-aside-agent-item${v?" wandox-aside-agent-item--active":""}`,onClick:()=>{R==null||R(D),h!=="professional"&&(l==null||l("professional"))},children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-aside-agent-icon",children:e.getAgentIconById(b.icon)}),e.jsxRuntimeExports.jsx("span",{className:"wandox-aside-agent-name",children:b.name})]})},D)})})]},r.key)})})}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-aside-bottom",children:[e.jsxRuntimeExports.jsx("p",{className:"wandox-aside-group-label",children:"系统功能"}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-aside-nav-list wandox-aside-nav-list--bottom",children:[E.map(r=>{const x=r.key!=="toolbox"&&h===r.key;return e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>{if(r.key==="toolbox"){p==null||p();return}l==null||l(r.key)},className:`wandox-aside-nav-item${x?" wandox-aside-nav-item--active":""}`,children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-aside-nav-icon",children:r.icon}),e.jsxRuntimeExports.jsx("span",{className:"wandox-aside-nav-title",children:r.label})]},r.key)}),w&&e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:y,className:"wandox-aside-nav-item wandox-aside-nav-item--logout",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-aside-nav-icon",children:e.jsxRuntimeExports.jsx(Ut,{})}),e.jsxRuntimeExports.jsx("span",{className:"wandox-aside-nav-title",children:"退出登录"})]})]}),e.jsxRuntimeExports.jsx("div",{style:{height:8}})]})]})})}function Ht(n){const{children:t}=n;return e.jsxRuntimeExports.jsx("div",{className:"wandox-layout wandox-root",children:e.jsxRuntimeExports.jsx("main",{className:"wandox-layout-content",style:{padding:0},children:t})})}function Zt(n){return n instanceof Error?n.message:"上传失败"}function Yt({open:n,playbook:t,onClose:a,onSubmit:o}){const c=e.reactExports.useMemo(()=>e.normalizeAgentInputFields(t==null?void 0:t.input_fields),[t]),[h,l]=e.reactExports.useState({}),[p,w]=e.reactExports.useState({}),[y,g]=e.reactExports.useState({}),u=e.useDynamicFieldOptions(c,h,l),R=e.reactExports.useMemo(()=>pe.getVisibleInputFields(c,h),[c,h]);e.reactExports.useEffect(()=>{n&&(l(pe.buildDefaultInputValues(c,(t==null?void 0:t.initial_params)??{})),w({}),g({}))},[c,n,t==null?void 0:t.initial_params]);const f=e.reactExports.useCallback((E,r)=>{l(x=>({...x,[E]:r}))},[]),q=e.reactExports.useCallback((E,r)=>async({file:x,onSuccess:k,onError:b})=>{var D,v;w(F=>({...F,[E]:!0}));try{const F=x,A=await e.POST_Api_V1_Oss_Upload2(F),z=(D=A==null?void 0:A.data)==null?void 0:D.url,C=((v=A==null?void 0:A.data)==null?void 0:v.name)||F.name;if(!z)throw new Error("上传结果缺少文件地址");g(I=>({...I,[z]:C})),l(I=>{if(r<=1)return{...I,[E]:z};const O=Array.isArray(I[E])?I[E]:I[E]?[I[E]]:[];return{...I,[E]:[...O,z]}}),k==null||k(A),e.staticMethods.success("上传成功")}catch(F){const A=F instanceof Error?F:new Error(Zt(F));b==null||b(A),e.staticMethods.error(A.message)}finally{w(F=>({...F,[E]:!1}))}},[]),U=()=>{if(!t)return;const E=R.filter(r=>r.required&&pe.isMissingFieldValue(h[r.name]));if(E.length>0){e.staticMethods.warning(`请填写必填参数:${E.map(r=>r.label).join("、")}`);return}o(t,h)};return e.jsxRuntimeExports.jsxs(xt.Drawer,{className:"wandox-playbook-params-drawer",title:e.jsxRuntimeExports.jsxs("div",{className:"wandox-playbook-params-drawer__title",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-playbook-params-drawer__title-main",children:"填写执行参数"}),e.jsxRuntimeExports.jsx("span",{className:"wandox-playbook-params-drawer__title-sub",children:t==null?void 0:t.name})]}),open:n,size:640,destroyOnHidden:!0,maskClosable:!1,onClose:a,footer:e.jsxRuntimeExports.jsx("div",{className:"wandox-playbook-params-drawer__footer",children:e.jsxRuntimeExports.jsxs(e.Space,{children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:a,children:"取消"}),e.jsxRuntimeExports.jsx(e.Button,{type:"primary",onClick:U,children:"开始执行"})]})}),children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-playbook-params-drawer__intro",children:[e.jsxRuntimeExports.jsx("span",{children:"填写本次运行需要的参数"}),e.jsxRuntimeExports.jsxs("span",{children:[R.length," 项"]})]}),e.jsxRuntimeExports.jsxs(e.Form,{layout:"vertical",className:"wandox-playbook-params-drawer__form",children:[R.map(E=>e.jsxRuntimeExports.jsx(e.Form.Item,{required:E.required,label:e.jsxRuntimeExports.jsxs("span",{className:"wandox-playbook-params-drawer__label",children:[E.label,E.description||E.hint?e.jsxRuntimeExports.jsx(e.Tooltip,{title:E.description||E.hint,children:e.jsxRuntimeExports.jsx(e.RefIcon,{"aria-label":`${E.label}说明`})}):null]}),children:e.jsxRuntimeExports.jsx(pe.AgentInputFieldControl,{field:E,value:h[E.name],uploading:!!p[E.name],fileNameMap:y,getOptionState:u.getFieldState,onChange:f,onUpload:q,onDownloadTemplate:r=>window.open(r.path,"_blank","noopener,noreferrer")})},E.name)),R.length===0?e.jsxRuntimeExports.jsxs("div",{className:"wandox-playbook-params-drawer__empty",children:[e.jsxRuntimeExports.jsx(e.Spin,{size:"small"})," 正在读取参数配置"]}):null]})]})}function Xt({playbooks:n,onPlaybookClick:t,onPlaybookDelete:a,activePlaybookId:o}){const{t:c}=e.useLanguage(),[h,l]=e.reactExports.useState(""),[p,w]=e.reactExports.useState(!1),[y,g]=e.reactExports.useState(null),[u,R]=e.reactExports.useState(!1),f=n.filter(r=>{var x;return r.name.toLowerCase().includes(h.toLowerCase())||((x=r.description)==null?void 0:x.toLowerCase().includes(h.toLowerCase()))}),q=(r,x)=>{x.stopPropagation(),g(r),w(!0)},U=async()=>{if(y){R(!0);try{await e.DELETE_Api_V1_Playbooks_SolidifyView_ByPlaybookId(y.playbook_id),a==null||a(y.playbook_id),w(!1),g(null)}catch{}finally{R(!1)}}},E=()=>{w(!1),g(null)};return e.jsxRuntimeExports.jsxs("div",{className:"wandox-solidified-list",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-solidified-list-search",children:e.jsxRuntimeExports.jsx(e.Input.Search,{placeholder:"搜索",value:h,onChange:r=>l(r.target.value),allowClear:!0,enterButton:!1})}),e.jsxRuntimeExports.jsx("div",{className:"wandox-solidified-list-content",children:f.length===0?e.jsxRuntimeExports.jsx(e.Empty,{description:c(h?"noData":"solidified.empty"),image:e.Empty.PRESENTED_IMAGE_SIMPLE}):e.jsxRuntimeExports.jsx("div",{className:"wandox-solidified-list-grid",children:f.map(r=>e.jsxRuntimeExports.jsxs("div",{className:`wandox-solidified-card ${o===r.playbook_id?"active":""}`,onClick:()=>t==null?void 0:t(r.playbook_id),onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(t==null||t(r.playbook_id))},role:"button",tabIndex:0,children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-solidified-card-icon",children:e.jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[e.jsxRuntimeExports.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2",fill:"none"}),e.jsxRuntimeExports.jsx("path",{d:"M9 3v18M15 3v18M3 9h18M3 15h18",stroke:"currentColor",strokeWidth:"1.5"}),e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]})}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-solidified-card-content",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-solidified-card-name",children:r.name}),r.description&&e.jsxRuntimeExports.jsx("div",{className:"wandox-solidified-card-desc",children:r.description})]}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-solidified-card-delete",onClick:x=>q(r,x),title:c("solidified.delete"),children:e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e.jsxRuntimeExports.jsx("path",{d:"M6 7v12a2 2 0 002 2h8a2 2 0 002-2V7M4 7h16M10 11v6M14 11v6M9 7V4a1 1 0 011-1h4a1 1 0 011 1v3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},r.playbook_id))})}),e.jsxRuntimeExports.jsx(e.Modal,{title:c("solidified.deleteConfirm"),open:p,onOk:U,onCancel:E,okText:c("confirm"),cancelText:c("cancel"),okButtonProps:{danger:!0,loading:u},children:e.jsxRuntimeExports.jsxs("p",{children:[c("solidified.deleteConfirm")," 「",y==null?void 0:y.name,"」?"]})})]})}function Jt({inputParams:n,onSearch:t,loading:a=!1}){const[o]=e.Form.useForm();e.reactExports.useEffect(()=>{const l={};for(const p of n)p.default!==void 0&&p.default!==null&&p.default!==""&&(l[p.name]=p.default);o.setFieldsValue(l)},[n,o]);const c=()=>{o.validateFields().then(l=>{const p={};for(const w of Object.keys(l)){const y=l[w];y!=null&&y!==""&&(p[w]=y)}t(p)})},h=l=>{const{name:p,type:w,description:y}=l,g={placeholder:y||`请输入${p}`};switch(w){case"integer":return e.jsxRuntimeExports.jsx(e.TypedInputNumber,{...g,style:{width:"100%"}});case"array":return e.jsxRuntimeExports.jsx(e.Input,{...g});case"boolean":return e.jsxRuntimeExports.jsx(e.Input,{...g});case"string":default:return e.jsxRuntimeExports.jsx(e.Input,{...g})}};return e.jsxRuntimeExports.jsx("div",{className:"wandox-solidify-params-form",children:e.jsxRuntimeExports.jsxs(e.Form,{form:o,layout:"inline",onFinish:c,style:{marginBottom:16},children:[n.map(l=>e.jsxRuntimeExports.jsx(e.Form.Item,{name:l.name,label:l.description||l.name,rules:[{required:l.required,message:`请输入${l.description||l.name}`}],style:{marginBottom:8},children:h(l)},l.name)),e.jsxRuntimeExports.jsx(e.Form.Item,{style:{marginBottom:8},children:e.jsxRuntimeExports.jsx(e.Button,{type:"primary",htmlType:"submit",loading:a,children:"查询"})})]})})}function es({open:n,loading:t,playbooks:a,activePlaybookId:o,onClose:c,onPlaybookClick:h,onPlaybookDelete:l}){return e.jsxRuntimeExports.jsx(xt.Drawer,{title:"工具箱",placement:"right",size:"min(440px, 100vw)",open:n,loading:t,onClose:c,getContainer:!1,rootClassName:"wandox-toolbox-drawer",styles:{body:{padding:0,overflow:"hidden"}},children:e.jsxRuntimeExports.jsx(Xt,{playbooks:a,onPlaybookClick:h,onPlaybookDelete:l,activePlaybookId:o})})}const ts="https://ai.maiduox.com/#/aitools/operation/product";function ss(n){const{title:t,widgets:a,ssoDomain:o,ssoToken:c,ssoCompany:h,onExecuteComplete:l,activeAgent:p,agents:w,childAgents:y,externalRobotName:g,externalShowPanel:u,agentSwitcher:R}=n;n.onWidgetsUpdate,n.count,e.useLanguage();const[f,q]=e.reactExports.useState(!1),[U,E]=e.reactExports.useState(!1),[r,x]=e.reactExports.useState(null),[k,b]=e.reactExports.useState(null),[D,v]=e.reactExports.useState("results"),[F,A]=e.reactExports.useState(!1),[z,C]=e.reactExports.useState([]),[I,O]=e.reactExports.useState(null),[W,T]=e.reactExports.useState({}),[P,M]=e.reactExports.useState([]),[ee,Z]=e.reactExports.useState(!1),[J,me]=e.reactExports.useState(null),[ne,ie]=e.reactExports.useState(void 0),[K,ce]=e.reactExports.useState(!1),[xe,ye]=e.reactExports.useState(!1),Y=e.reactExports.useMemo(()=>(y||[]).map(s=>s.name),[y]),de=e.reactExports.useMemo(()=>!p||p==="default"?null:(w==null?void 0:w.find(m=>m.agent_id===p||m.agent_code===p))||null,[p,w]),L=e.reactExports.useMemo(()=>e.getAgentPackageBenefit(de),[de]);e.reactExports.useEffect(()=>{b(null)},[p]),e.reactExports.useEffect(()=>{ke(),y&&y.length>0&&N()},[y]),e.reactExports.useEffect(()=>{if(u&&(q(!0),g)){const s=Y.find(m=>m===g);s?b(s):Y.length>0}},[u,g,Y]);const ke=async()=>{try{const s=await e.GET_Api_V1_Notification_Webhooks({});s!=null&&s.data&&M(s.data.map(m=>({webhook_id:m.webhook_id,name:m.name,platform:m.platform})))}catch{}},N=async()=>{try{const s={};await Promise.all(y.map(async m=>{var Q;try{const S=await e.GET_Api_V1_Notification_Agents_Webhook_ByAgentId(m.agent_id,{});(Q=S==null?void 0:S.data)!=null&&Q.webhook_id&&(s[m.agent_id]=S.data.webhook_id)}catch{}})),T(s)}catch{}},G=e.reactExports.useMemo(()=>k?a.filter(s=>{var S;const m=(S=s.title)==null?void 0:S.match(/^(.+?)\s*巡检结果$/);return(m?m[1]:s.agent_name)===k}):a,[a,k]),he=e.reactExports.useMemo(()=>{if(!k)return"";const s=(y||[]).find(m=>m.name===k);return(s==null?void 0:s.agent_id)||""},[k,y]),Ne=o==="maiduo"&&k==="差评监控",Le=s=>{const m=k===s?null:s;b(m),m&&q(!0)},je=s=>{me(s),ie(W[s.agent_id]),Z(!0)},ae=e.reactExports.useCallback(async s=>{if(s){A(!0);try{const m=await e.GET_Api_V1_Agents_ActionExecutes({agent_id:s,limit:50});if(m!=null&&m.data&&Array.isArray(m.data)){const Q=m.data.map((S,ge)=>({id:S.id||S.execute_id||`record_${ge}`,action_name:S.action_name||S.display_name||"未知动作",action_id:S.action_id||"",status:S.status||"pending",created_at:S.created_at||"",completed_at:S.completed_at,action_params:S.action_params,output_type:S.output_type,output_data:S.output_data,outputs:S.outputs,error:S.error})).sort((S,ge)=>new Date(ge.created_at).getTime()-new Date(S.created_at).getTime());C(Q)}else C([])}catch{C([])}finally{A(!1)}}},[]),oe=s=>{if(!s)return"";try{const m=new Date(s),Q=m.toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}),S=m.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"});return`${Q} ${S}`}catch{return s}},H=s=>({pending:"等待中",running:"执行中",success:"成功",failed:"失败"})[s]||s,X=s=>({pending:"wandox-exec-status--pending",running:"wandox-exec-status--running",success:"wandox-exec-status--success",failed:"wandox-exec-status--failed"})[s]||"";e.reactExports.useEffect(()=>{D==="history"&&he&&ae(he)},[D,he,ae]);const $=async()=>{if(!J||!ne){e.staticMethods.warning("请选择 Webhook");return}try{ce(!0),await e.POST_Api_V1_Notification_Agents_Webhook({},{agent_id:J.agent_id,webhook_id:ne}),e.staticMethods.success("绑定成功"),Z(!1),N()}catch(s){e.staticMethods.error((s==null?void 0:s.message)||"绑定失败")}finally{ce(!1)}},Se=async()=>{if(J)try{ce(!0),await e.DELETE_Api_V1_Notification_Agents_Webhook_Delete_ByAgentId(J.agent_id,{}),e.staticMethods.success("解绑成功"),Z(!1),ie(void 0),N()}catch(s){e.staticMethods.error((s==null?void 0:s.message)||"解绑失败")}finally{ce(!1)}},Ce=s=>{x(s),E(!0)},Ie=()=>{E(!1),x(null)},Ae=s=>{if(!s)return"";try{const m=new Date(s),Q=m.toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}),S=m.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"});return`${Q}
|
|
2
|
-
${S}`}catch{return s}},fe=(s,m)=>{const Q={high:"#ff4d4f",medium:"#faad14",low:"#52c41a"};return e.jsxRuntimeExports.jsxs("div",{className:"wandox-timeline-item",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-timeline-dot-wrapper",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-timeline-time",style:{whiteSpace:"pre-line"},children:Ae(s.timestamp||"")}),e.jsxRuntimeExports.jsx("div",{className:"wandox-timeline-dot",style:{background:Q[s.priority]}}),!m&&e.jsxRuntimeExports.jsx("div",{className:"wandox-timeline-line"})]}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-widget-card",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-widget-title",children:s.title}),s.ui_payload&&e.jsxRuntimeExports.jsx("div",{className:"wandox-widget-content wandox-markdown-content",children:e.jsxRuntimeExports.jsx(e.PayloadRenderer,{payload:s.ui_payload})}),s.actions&&s.actions.length>0&&e.jsxRuntimeExports.jsx("div",{className:"wandox-widget-actions",children:e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-widget-view-detail-btn",onClick:()=>Ce(s),children:[e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img",children:[e.jsxRuntimeExports.jsx("title",{children:"快速执行"}),e.jsxRuntimeExports.jsx("path",{d:"M13 2L3 14H12L11 22L21 10H12L13 2Z",fill:"currentColor"})]}),"快速执行 (",s.actions.length,")"]})})]})]},s.id||`${s.type}_${s.title}_${s.timestamp}`)};return e.jsxRuntimeExports.jsxs("div",{className:"wandox-widget-section",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-section-header",children:[e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[R??e.jsxRuntimeExports.jsx("span",{className:"wandox-widget-section-title",children:t}),L&&e.jsxRuntimeExports.jsx(e.Popover,{title:e.jsxRuntimeExports.jsx("div",{style:{paddingBottom:"8px",borderBottom:"1px solid #f0f0f0"},children:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"},children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("strong",{children:L.packageName}),L.subtitle&&e.jsxRuntimeExports.jsx("div",{style:{color:"#999",fontSize:"11px",fontWeight:400},children:L.subtitle})]}),e.jsxRuntimeExports.jsx(e.Badge,{count:"生效中",style:{backgroundColor:"#52c41a",fontSize:"10px",lineHeight:"18px",height:"18px",minWidth:"50px"}})]})}),content:e.jsxRuntimeExports.jsxs("div",{style:{fontSize:"12px",lineHeight:"1.6",minWidth:"280px"},children:[e.jsxRuntimeExports.jsxs("div",{style:{marginBottom:"8px",display:"flex",justifyContent:"space-between"},children:[e.jsxRuntimeExports.jsx("div",{style:{color:"#999"},children:"套餐类型:"}),e.jsxRuntimeExports.jsx("strong",{children:L.packageName})]}),L.asinUsage&&e.jsxRuntimeExports.jsxs("div",{style:{marginBottom:L.asinUsagePercent!=null?"4px":"8px",display:"flex",justifyContent:"space-between",gap:"16px"},children:[e.jsxRuntimeExports.jsx("div",{style:{color:"#999"},children:"ASIN 已用:"}),e.jsxRuntimeExports.jsx("strong",{style:{color:"#9444f5"},children:L.asinUsage})]}),L.asinUsagePercent!=null&&e.jsxRuntimeExports.jsx("div",{style:{marginBottom:"8px"},children:e.jsxRuntimeExports.jsx("div",{style:{height:"6px",borderRadius:"3px",background:"#f0eaff",overflow:"hidden"},children:e.jsxRuntimeExports.jsx("div",{style:{height:"100%",width:`${L.asinUsagePercent}%`,borderRadius:"3px",background:"linear-gradient(90deg, #9444f5, #b47aff)",transition:"width 0.3s ease"}})})}),e.jsxRuntimeExports.jsxs("div",{style:{marginBottom:"8px",display:"flex",justifyContent:"space-between"},children:[e.jsxRuntimeExports.jsx("div",{style:{color:"#999"},children:L.remainingLabel}),e.jsxRuntimeExports.jsx("strong",{style:{color:"#9444f5",fontWeight:"bold"},children:L.remainingValue})]}),e.jsxRuntimeExports.jsxs("div",{style:{marginBottom:"8px",display:"flex",justifyContent:"space-between"},children:[e.jsxRuntimeExports.jsx("div",{style:{color:"#999"},children:"到期时间:"}),e.jsxRuntimeExports.jsx("strong",{children:L.endTime})]}),e.jsxRuntimeExports.jsxs("div",{style:{marginBottom:"8px",display:"flex",justifyContent:"space-between"},children:[e.jsxRuntimeExports.jsx("div",{style:{color:"#999"},children:"开通时间:"}),e.jsxRuntimeExports.jsx("strong",{children:L.startTime})]}),L.coverageItems.length>0&&e.jsxRuntimeExports.jsxs("div",{style:{padding:"8px 12px",background:"#faf8ff",borderRadius:"8px"},children:[e.jsxRuntimeExports.jsx("div",{style:{marginBottom:"4px",color:"#9444f5",fontSize:"13px",fontWeight:"bold"},children:L.coverageTitle}),e.jsxRuntimeExports.jsx("div",{style:{fontSize:"11px",color:"#666",lineHeight:"2"},children:L.coverageItems.map(s=>e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(e.RefIcon$4,{style:{marginRight:"6px",color:"#9444f5"}}),s]},s))})]})]}),placement:"bottom",trigger:"hover",children:e.jsxRuntimeExports.jsx(e.Badge,{count:L.badgeText,style:{backgroundColor:L.badgeColor,color:L.badgeTextColor,cursor:"pointer"}})})]}),e.jsxRuntimeExports.jsx("div",{className:"wandox-inspection-controls",children:e.jsxRuntimeExports.jsxs("button",{type:"button",className:`wandox-inspection-agent-btn ${f?"wandox-inspection-agent-btn--expanded":""}`,onClick:()=>{f?(q(!1),b(null)):q(!0)},children:[e.jsxRuntimeExports.jsxs("span",{className:"wandox-inspection-agent-icon",children:[e.jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"4",stroke:"currentColor",strokeWidth:"1.5"}),e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor"})]}),e.jsxRuntimeExports.jsx("span",{className:"wandox-orbit-dot wandox-orbit-dot-1"}),e.jsxRuntimeExports.jsx("span",{className:"wandox-orbit-dot wandox-orbit-dot-2"}),e.jsxRuntimeExports.jsx("span",{className:"wandox-orbit-dot wandox-orbit-dot-3"})]}),e.jsxRuntimeExports.jsxs("span",{className:"wandox-inspection-agent-text",children:["巡检机器人(",Y.length,")"]})]})})]}),f&&e.jsxRuntimeExports.jsxs("div",{className:"wandox-timeline-list",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-agent-filter-row wandox-agent-filter-row--with-close",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-agent-filter-chips",children:[y.length>0&&e.jsxRuntimeExports.jsx("button",{type:"button",className:`wandox-agent-filter-chip ${k===null?"active":""}`,onClick:()=>b(null),children:"全部"}),y.map(s=>{const m=!!W[s.agent_id];return e.jsxRuntimeExports.jsxs("div",{className:`wandox-agent-filter-chip-compound ${k===s.name?"active":""}`,children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-agent-filter-chip-name",onClick:()=>Le(s.name),children:s.name}),e.jsxRuntimeExports.jsx("button",{type:"button",className:`wandox-agent-filter-chip-webhook ${m?"bound":""}`,onClick:()=>je(s),title:m?"已绑定 Webhook,点击修改":"绑定 Webhook 通知",children:m?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-webhook-dot","aria-hidden":"true"}),e.jsxRuntimeExports.jsx("span",{className:"wandox-webhook-label",children:"已通知"})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-webhook-plus","aria-hidden":"true",children:"+"}),e.jsxRuntimeExports.jsx("span",{className:"wandox-webhook-label",children:"通知"})]})})]},s.agent_id)})]}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-timeline-list-close",onClick:()=>{q(!1),b(null),v("results")},title:"关闭",children:"✕"})]}),Ne&&e.jsxRuntimeExports.jsxs("div",{className:"wandox-negative-review-notice",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-negative-review-notice-icon","aria-hidden":"true",children:"ℹ️"}),e.jsxRuntimeExports.jsxs("span",{children:["差评监控需要先设置需要监控的ASIN,请前往AI工具》",e.jsxRuntimeExports.jsx("a",{href:ts,target:"_blank",rel:"noreferrer",className:"wandox-negative-review-notice-link",children:"新老诊断"}),"进行设置。每个asin每一次都需要0.01算力。"]})]}),e.jsxRuntimeExports.jsx("div",{className:"wandox-timeline-tabs-header",children:e.jsxRuntimeExports.jsxs("div",{className:"wandox-timeline-tabs-nav",children:[e.jsxRuntimeExports.jsxs("button",{type:"button",className:`wandox-timeline-tab-btn ${D==="results"?"active":""}`,onClick:()=>v("results"),children:["巡检结果",G.length>0&&e.jsxRuntimeExports.jsx("span",{className:"wandox-timeline-tab-badge",children:G.length})]}),e.jsxRuntimeExports.jsx("button",{type:"button",className:`wandox-timeline-tab-btn ${D==="history"?"active":""}`,onClick:()=>v("history"),children:"执行记录"})]})}),D==="results"?e.jsxRuntimeExports.jsx("div",{className:"wandox-timeline-list-content",children:G.length>0?G.sort((s,m)=>{const Q=s.timestamp?new Date(s.timestamp).getTime():0;return(m.timestamp?new Date(m.timestamp).getTime():0)-Q}).map((s,m,Q)=>fe(s,m===Q.length-1)):e.jsxRuntimeExports.jsxs("div",{className:"wandox-empty-state",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-empty-icon",children:"�"}),e.jsxRuntimeExports.jsx("div",{className:"wandox-empty-text",children:k?"没有符合筛选条件的数据":"暂无工作区数据"}),e.jsxRuntimeExports.jsx("div",{className:"wandox-empty-desc",children:k?"请调整筛选条件":"工作区数据将在这里显示"})]})}):e.jsxRuntimeExports.jsx("div",{className:"wandox-timeline-list-content wandox-history-panel",children:k?F?e.jsxRuntimeExports.jsxs("div",{className:"wandox-loading-state",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-spinner wandox-spinner--small"}),e.jsxRuntimeExports.jsx("span",{children:"加载中..."})]}):z.length===0?e.jsxRuntimeExports.jsx("div",{className:"wandox-empty-state",children:e.jsxRuntimeExports.jsx("div",{className:"wandox-empty-text",children:"暂无执行记录"})}):e.jsxRuntimeExports.jsx("div",{className:"wandox-exec-history-list",children:z.map(s=>e.jsxRuntimeExports.jsxs("div",{className:"wandox-exec-history-item",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-exec-history-header",onClick:()=>O(I===s.id?null:s.id),onKeyDown:m=>m.key==="Enter"&&O(I===s.id?null:s.id),role:"button",tabIndex:0,children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-exec-history-info",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-exec-history-name",children:s.action_name}),e.jsxRuntimeExports.jsx("span",{className:"wandox-exec-history-time",children:oe(s.created_at)})]}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-exec-history-status-wrapper",children:[e.jsxRuntimeExports.jsx("span",{className:`wandox-exec-status ${X(s.status)}`,children:H(s.status)}),e.jsxRuntimeExports.jsx("span",{className:"wandox-exec-history-arrow","aria-hidden":"true",children:I===s.id?"▼":"▶"})]})]}),I===s.id&&e.jsxRuntimeExports.jsxs("div",{className:"wandox-exec-history-detail",children:[s.action_params&&Object.keys(s.action_params).length>0&&e.jsxRuntimeExports.jsxs("div",{className:"wandox-exec-params",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-exec-section-label",children:"执行参数"}),e.jsxRuntimeExports.jsx("div",{className:"wandox-exec-params-list",children:Object.entries(s.action_params).map(([m,Q])=>e.jsxRuntimeExports.jsxs("div",{className:"wandox-exec-param-item",children:[e.jsxRuntimeExports.jsxs("span",{className:"wandox-exec-param-key",children:[m,":"]}),e.jsxRuntimeExports.jsx("span",{className:"wandox-exec-param-value",children:typeof Q=="object"?JSON.stringify(Q):String(Q)})]},m))})]}),s.error?e.jsxRuntimeExports.jsxs("div",{className:"wandox-exec-error",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-exec-error-label",children:"错误信息:"}),e.jsxRuntimeExports.jsx("span",{className:"wandox-exec-error-msg",children:s.error})]}):s.output_type&&s.output_data?e.jsxRuntimeExports.jsxs("div",{className:"wandox-exec-outputs",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-exec-section-label",children:"执行结果"}),e.jsxRuntimeExports.jsx(e.PayloadRenderer,{payload:{type:s.output_type,...s.output_data}})]}):s.outputs?e.jsxRuntimeExports.jsxs("div",{className:"wandox-exec-outputs",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-exec-section-label",children:"执行结果"}),e.jsxRuntimeExports.jsx(e.PayloadRenderer,{payload:s.outputs})]}):e.jsxRuntimeExports.jsx("div",{className:"wandox-exec-no-output",children:"暂无输出结果"})]})]},s.id))}):e.jsxRuntimeExports.jsxs("div",{className:"wandox-empty-state",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-empty-icon",children:"🤖"}),e.jsxRuntimeExports.jsx("div",{className:"wandox-empty-text",children:"请先选择机器人"}),e.jsxRuntimeExports.jsx("div",{className:"wandox-empty-desc",children:"在上方选择一个机器人查看执行记录"})]})})]}),e.jsxRuntimeExports.jsx(e.ActionDetailDrawer,{open:U,title:(r==null?void 0:r.title)||"动作详情",actions:(r==null?void 0:r.actions)||[],widgetId:r==null?void 0:r.id,ssoToken:c,ssoDomain:o,ssoCompany:h,onClose:Ie,onExecuteComplete:l}),e.jsxRuntimeExports.jsx(e.Modal,{title:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M12 22C10.8954 22 10 21.1046 10 20V14C10 12.8954 10.8954 12 12 12C13.1046 12 14 12.8954 14 14V20C14 21.1046 13.1046 22 12 22Z"}),e.jsxRuntimeExports.jsx("path",{d:"M18 16C16.8954 16 16 15.1046 16 14V10C16 8.89543 16.8954 8 18 8C19.1046 8 20 8.89543 20 10V14C20 15.1046 19.1046 16 18 16Z"}),e.jsxRuntimeExports.jsx("path",{d:"M6 16C4.89543 16 4 15.1046 4 14V10C4 8.89543 4.89543 8 6 8C7.10457 8 8 8.89543 8 10V14C8 15.1046 7.10457 16 6 16Z"}),e.jsxRuntimeExports.jsx("path",{d:"M10.5 4C10.5 2.61929 11.6193 1.5 13 1.5H13.5C14.8807 1.5 16 2.61929 16 4V6H10.5V4Z"})]}),e.jsxRuntimeExports.jsx("span",{children:"配置 Webhook 通知"})]}),open:ee,onCancel:()=>{Z(!1),me(null),ie(void 0)},width:520,footer:null,centered:!0,children:e.jsxRuntimeExports.jsxs("div",{style:{padding:"8px 0"},children:[e.jsxRuntimeExports.jsxs("div",{style:{marginBottom:"20px",padding:"12px 16px",background:"#f5f7fa",borderRadius:"8px",border:"1px solid #e8eaed"},children:[e.jsxRuntimeExports.jsx("div",{style:{fontSize:"13px",color:"#666",marginBottom:"4px"},children:"智能体"}),e.jsxRuntimeExports.jsx("div",{style:{fontSize:"15px",color:"#1a1a1a",fontWeight:500},children:J==null?void 0:J.name})]}),e.jsxRuntimeExports.jsxs("div",{style:{marginBottom:"20px"},children:[e.jsxRuntimeExports.jsx("div",{style:{marginBottom:"8px",fontSize:"14px",color:"#333",fontWeight:500},children:"选择 通知地址"}),e.jsxRuntimeExports.jsx(e.Select,{style:{width:"100%"},size:"large",placeholder:"请选择 通知地址",value:ne,onChange:ie,options:P.map(s=>({label:`${s.name} (${s.platform==="dingtalk"?"钉钉":s.platform==="feishu"?"飞书":"企业微信"})`,value:s.webhook_id})),disabled:K,popupRender:s=>e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[s,e.jsxRuntimeExports.jsx(Mt.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:()=>ye(!0),children:"添加新的通知地址"})})]})}),P.length===0&&e.jsxRuntimeExports.jsxs("div",{style:{marginTop:"8px",padding:"8px 12px",background:"#fff7e6",border:"1px solid #ffd591",borderRadius:"4px",fontSize:"13px",color:"#d46b08",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsxRuntimeExports.jsx("span",{children:"⚠️"}),e.jsxRuntimeExports.jsx("span",{children:'暂无可用的 通知地址,请先在"通知配置"中创建'})]})]}),e.jsxRuntimeExports.jsxs("div",{style:{padding:"12px 16px",background:"#f0f9ff",borderRadius:"8px",border:"1px solid #bae7ff",marginBottom:"20px"},children:[e.jsxRuntimeExports.jsx("div",{style:{fontSize:"13px",color:"#0958d9",fontWeight:500,marginBottom:"8px"},children:"💡 功能说明"}),e.jsxRuntimeExports.jsxs("div",{style:{fontSize:"13px",color:"#096dd9",lineHeight:"1.8"},children:[e.jsxRuntimeExports.jsx("div",{children:"• 绑定后,该智能体执行完成时会自动发送通知"}),e.jsxRuntimeExports.jsx("div",{children:"• 通知内容包含执行结果和相关信息"}),e.jsxRuntimeExports.jsx("div",{children:"• 可随时修改或解除绑定"})]})]}),e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:"12px",justifyContent:"flex-end"},children:[W[(J==null?void 0:J.agent_id)||""]&&e.jsxRuntimeExports.jsx("button",{type:"button",onClick:Se,disabled:K,style:{marginRight:"auto",padding:"8px 20px",border:"1px solid #ff4d4f",borderRadius:"6px",background:"#fff",color:"#ff4d4f",cursor:K?"not-allowed":"pointer",fontSize:"14px",fontWeight:500,transition:"all 0.2s",opacity:K?.6:1},onMouseEnter:s=>{K||(s.currentTarget.style.background="#fff1f0")},onMouseLeave:s=>{s.currentTarget.style.background="#fff"},children:"解除绑定"}),e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Z(!1),me(null),ie(void 0)},disabled:K,style:{padding:"8px 24px",border:"1px solid #d9d9d9",borderRadius:"6px",background:"#fff",color:"#333",cursor:K?"not-allowed":"pointer",fontSize:"14px",fontWeight:500,transition:"all 0.2s",opacity:K?.6:1},onMouseEnter:s=>{K||(s.currentTarget.style.background="#fafafa")},onMouseLeave:s=>{s.currentTarget.style.background="#fff"},children:"取消"}),e.jsxRuntimeExports.jsx("button",{type:"button",onClick:$,disabled:K||!ne,style:{padding:"8px 24px",border:"none",borderRadius:"6px",background:K||!ne?"#d9d9d9":"#1890ff",color:"#fff",cursor:K||!ne?"not-allowed":"pointer",fontSize:"14px",fontWeight:500,transition:"all 0.2s"},onMouseEnter:s=>{!K&&ne&&(s.currentTarget.style.background="#40a9ff")},onMouseLeave:s=>{!K&&ne&&(s.currentTarget.style.background="#1890ff")},children:K?"保存中...":"保存"})]})]})}),e.jsxRuntimeExports.jsx(pe.QuickAddWebhook,{open:xe,onClose:()=>ye(!1),onSuccess:s=>{M(m=>[...m,s]),ie(s.webhook_id)}})]})}function ns({queueStatus:n}){if(!n)return null;const t=n.status==="waiting";return e.jsxRuntimeExports.jsx("div",{className:"wandox-queue-overlay",children:e.jsxRuntimeExports.jsx("div",{className:"wandox-queue-modal",children:t?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-queue-icon wandox-queue-icon--waiting",children:e.jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[e.jsxRuntimeExports.jsx("circle",{cx:"32",cy:"32",r:"28",stroke:"#E5E7EB",strokeWidth:"4"}),e.jsxRuntimeExports.jsx("path",{d:"M32 16V32L44 38",stroke:"#8B5CF6",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}),e.jsxRuntimeExports.jsx("div",{className:"wandox-queue-title",children:"当前使用人数较多,正在排队中..."}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-queue-stats",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-queue-stat",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-queue-stat-value",children:n.position}),e.jsxRuntimeExports.jsx("div",{className:"wandox-queue-stat-label",children:"前面还有"})]}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-queue-stat",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-queue-stat-value",children:["~",n.estimated_wait,"s"]}),e.jsxRuntimeExports.jsx("div",{className:"wandox-queue-stat-label",children:"预计等待"})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-queue-tip",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-queue-tip-icon",children:"💡"}),e.jsxRuntimeExports.jsx("span",{children:"小贴士:等待期间可先查看其他功能模块"})]})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-queue-icon wandox-queue-icon--ready",children:e.jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[e.jsxRuntimeExports.jsx("rect",{x:"4",y:"4",width:"56",height:"56",rx:"8",fill:"#10B981"}),e.jsxRuntimeExports.jsx("path",{d:"M18 32L28 42L46 22",stroke:"white",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),e.jsxRuntimeExports.jsx("div",{className:"wandox-queue-title wandox-queue-title--ready",children:"轮到您了!"}),e.jsxRuntimeExports.jsx("div",{className:"wandox-queue-subtitle",children:"正在处理您的请求..."})]})})})}function as({open:n,actionName:t,defaultParams:a={},onCancel:o,onExecute:c}){const[h,l]=e.reactExports.useState({});e.reactExports.useEffect(()=>{if(n){const u={};for(const R of Object.keys(a)){const f=a[R];(typeof f=="string"||typeof f=="number")&&(u[R]=String(f))}l(u)}},[n,a]);const p=(u,R)=>{l(f=>({...f,[u]:R}))},w=u=>{u.preventDefault();const R={...a};for(const f of Object.keys(h))R[f]=h[f];c(R)},y=u=>{u.target===u.currentTarget&&o()},g=(u,R)=>typeof R=="object"&&R!==null?null:e.jsxRuntimeExports.jsxs("div",{className:"wandox-form-item",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-form-label",children:u}),e.jsxRuntimeExports.jsx("input",{type:"text",className:"wandox-form-input",placeholder:`请输入 ${u}`,value:h[u]||"",onChange:f=>p(u,f.target.value)})]},u);return n?e.jsxRuntimeExports.jsx("div",{className:"wandox-modal-overlay",onClick:y,children:e.jsxRuntimeExports.jsxs("div",{className:"wandox-modal",style:{width:600},children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-modal-header",children:[e.jsxRuntimeExports.jsxs("h3",{className:"wandox-modal-title",children:["执行 Action: ",t]}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-modal-close",onClick:o,"aria-label":"关闭",children:e.jsxRuntimeExports.jsx("svg",{width:"24",height:"24",viewBox:"0 0 16 16",fill:"currentColor",children:e.jsxRuntimeExports.jsx("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"})})})]}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-modal-body",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-modal-description",children:"以下是默认参数,您可以修改后执行,或直接使用默认值执行"}),e.jsxRuntimeExports.jsxs("form",{onSubmit:w,children:[Object.keys(a).map(u=>g(u,a[u])),Object.keys(a).length===0&&e.jsxRuntimeExports.jsx("div",{className:"wandox-empty-params",children:"该 Action 无需参数"})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-modal-footer",children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-button wandox-button-default",onClick:o,children:"取消"}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-button wandox-button-primary",onClick:w,children:"执行"})]})]})}):null}const ot=["要努力呀,为了想要的生活,为了人间的烟火气,为了今天的风和月。","欣赏不来别人视若珍宝的,就该保持沉默。","日子总是有意思的,了无生趣的是打不起精神的你。","我们终其一生,就是要摆脱他人的期待,找到真正的自己。","别在最好的年纪选择了安逸,那是对自己最大的辜负。","你现在的气质里,藏着你走过的路、读过的书和爱过的人。","成长就是,你终于明白有些路只能一个人走。","不是每一次努力都有收获,但每一次收获都需要努力。","生活从不眷顾因循守旧、满足现状的人,而将更多机遇留给勇于探索的人。","所有的困难都是暂时的,熬过去就是晴天。","你若盛开,清风自来。","别人笑我太疯癫,我笑他人看不穿。","走慢一点,是为了走得更远。","不必羡慕别人,你的故事才刚刚开始。","心若向阳,何惧忧伤。","人生没有白走的路,每一步都算数。","你不是在浪费时间,你是在积蓄力量。","别让昨天的遗憾,占满今天的时间。","深夜的努力,终将照亮黎明。","只要路是对的,就不怕遥远。","生活不会辜负每一个认真的人。","做一个有温度的人,遇见有光的事。","你所经历的每一次失败,都是未来成功的伏笔。","不要因为走得太远,而忘记为什么出发。","把每一天当作礼物,而不是任务。","越努力,越幸运。","你值得拥有你所渴望的一切。","别把时间花在你不喜欢的事情上,除非它能带你去你喜欢的地方。","有些事现在不做,一辈子都不会做了。","你的潜力,远比你想象的要大。","不要等到准备好了才开始,开始了才会准备好。","慢慢来,比较快。","善待自己,你已经很努力了。","每一个你讨厌的早晨,都是别人求之不得的机会。","世界上只有一种真正的英雄主义,那就是认清生活的真相后仍然热爱它。","人生不是等待风暴过去,而是学会在雨中起舞。","别总想着逃离,先想想能不能改变。","你无法控制风向,但可以调整帆的方向。","没有人能替你走你该走的路。","不要因为没有掌声而停止歌唱。","把抱怨环境的心情,用来改善环境吧。","你今天的懒惰,是明天后悔的源头。","没有人永远年轻,但永远有人正在年轻。","读书破万卷,不如行路十里。","人生最大的遗憾,是轻易放弃了本不该放弃的。","你不是失败了,你只是还没成功。","今天的苦,是明天的底气。","别把别人的看法,活成自己的枷锁。","有一种勇敢,叫做即使害怕也要继续走。","生活是场修行,凡事皆有意义。","不要和自己过不去,人生很短,开心最重要。","你现在偷的懒,都是以后还的债。","最好的时机,就是现在。","你不必完美,但你必须真实。","与其等待一个完美的开始,不如从不完美中开始。","成功不是终点,失败也不是终结,重要的是继续的勇气。","每一个坚持的背后,都有一个不为人知的故事。","改变不了环境,就改变自己。","别用你的忙来掩盖你的懒,也别用你的懒来消耗你的忙。","人生就像骑自行车,要保持平衡就必须不断前行。","昨天已经过去,明天还未到来,今天才是你拥有的全部。","宁可辛苦一阵子,不要痛苦一辈子。","不要让今日的懒惰,成为明日的遗憾。","你的态度,决定了你人生的高度。","路是走出来的,不是想出来的。","做你自己,别人的角色已经有人在演了。","年轻时以为不读书不足惜,后来方知书中有乾坤。","你若想要,便去追;你若已得,便珍惜。","最怕你一生碌碌无为,还安慰自己平凡可贵。","人生没有捷径,弯路也是路。","种一棵树最好的时间是十年前,其次是现在。","每天进步一点点,人生就会不一样。","不要只是看,要有所感悟;不要只是听,要有所行动。","心态好了,一切都好了。","你的未来,取决于你现在的决定。","好好爱自己,才有能力去爱别人。","人生路上,勿忘初心。","有梦想就去追,别给自己的平庸找借口。","世界是你的,但首先你要努力。","坚持不一定成功,但放弃一定失败。","你比你想象的更坚强,比你感觉的更勇敢。","把每一次失败都当成学费,你就赚了。","选择了远方,便只顾风雨兼程。","人生的意义不在于拿一手好牌,而在于打好一手烂牌。","不要在还可以冲刺的年纪,选择散步。","钱不是万能的,但没有钱是万万不能的。努力赚钱,才是对自己最大的尊重。","所谓天才,不过是比别人多了一点坚持。","你改变不了昨天,但你可以决定明天。","做最好的自己,才能遇见最好的别人。","不要因为懒惰而失去了本来可以拥有的东西。","人生没有返回键,但有暂停和前进。","别等别人为你喝彩,先为自己鼓掌。","与其焦虑,不如行动。","每一个优秀的人,都曾经历过一段无人问津的岁月。","你的每一步努力,都在为未来的自己铺路。","不想当将军的士兵不是好士兵,但当不了将军的士兵也可以是好士兵。","生活的艺术,就是把每一个平凡的日子过得不平凡。","人生就是一场旅行,在乎的不是目的地,而是沿途的风景。","不要因为别人的否定,而放弃对自己的肯定。","勇敢不是不害怕,而是即使害怕也还是去做。","命运给了你一手烂牌,你要做的是把它打好。","真正的强大,是内心的平静。","你所不能击垮的,终将使你更强大。","成功的人找方法,失败的人找借口。","不要总是想着明天,今天就是你最年轻的一天。","人生最重要的不是你站在哪里,而是你朝哪个方向走。","每个人都是自己人生的主角,不要沦为配角。","你现在付出的努力,都是在为未来的幸福买单。","心宽了,路才宽。","你所拥有的,比你想要的更多。","不要用战术上的勤奋,掩盖战略上的懒惰。","很多人看起来很忙,实际上只是在低水平上勤奋。","格局大了,烦恼就少了。","你的圈子,决定了你的见识;你的见识,决定了你的未来。","别总是看别人的生活,好好经营自己的就够了。","脚踏实地,仰望星空,这才是人生的正确打开方式。","吃一堑,长一智;受一挫,强一分。","每一次跌倒,都是一次重新出发的机会。","低谷的时候,沉得住气;高峰的时候,守得住心。","你一定要过得很好,这样才不辜负自己受过的苦。","少说多做,是成功的捷径。","人生苦短,别把时间浪费在不值得的人和事上。","越是艰难处,越是修心时。","机会都是留给有准备的人的。","爱拼才会赢,努力才会赢。","人生就像一杯茶,不会苦一辈子,但总会苦一阵子。","不要轻言放弃,你不知道下一秒会发生什么奇迹。","真正的成熟,是能与不完美的自己握手言和。","你所走过的弯路,都是你成长的印记。","别人可以成功,你也可以。","只有不断超越自己,才能不断创造可能。","努力不一定成功,不努力一定不成功。","当你觉得累的时候,说明你在走上坡路。","不经历风雨,怎能见彩虹。","比起抱怨,不如改变。","年轻没有失败,试错才是成长。","你的样子,将决定你世界的样子。","愿你出走半生,归来仍是少年。","有时候你以为的终点,不过是下一段旅程的起点。","今天努力工作,明天努力生活。","不要总是活在别人的评价里,你自己最清楚自己是谁。","无论多难,都要坚持做你认为对的事。","你不需要变成别人,你只需要成为更好的自己。","凡事提前准备,才能游刃有余。","没有什么是理所当然的,感恩才能幸福。","不要把安全感建立在别人身上,那是一种危险的依赖。","清醒的认识自己,是成功的第一步。","沉默是金,但行动是钻石。","用行动证明,而不是用嘴巴解释。","最终你会明白,一切都是值得的。","把目光放长远,眼前的得失不算什么。","不要让自己的懒惰成为别人勤奋的舞台。","你的每一次选择,都在塑造未来的你。","有时候沉默不是因为没话说,而是因为懂得珍惜。","你今天的努力,是明天底气的来源。","先成为你想成为的人,其他的顺其自然。","把握现在,才能拥有未来。","越简单越快乐,越复杂越烦恼。","人生没有真正的绝境,除非你自己放弃。","你比你想象的更有力量。","把每一件平凡的事做好,就是不平凡。","那些没能打败你的,终将使你更强大。","做事情要有始有终,这是对自己最基本的尊重。","不在沉默中爆发,就在沉默中消亡。","不要害怕慢,就怕站。","只要还在走,就没有到不了的地方。","自律的人,才有资格谈自由。","与其等风来,不如追风去。","你有多自律,就有多自由。","凡是过往,皆为序章。","不要在该奋斗的年纪选择了安逸。","人生难得几回搏,此时不搏何时搏。","成长的代价是失去一些幼稚,但获得了更多可能。","有梦想的人,睡觉都是在充电。","不要辜负每一个认真的早晨。","生命的意义,在于不断地自我超越。","你有权利选择,但选择了就要承担。","最大的风险,是不冒任何风险。","生活会奖励那些敢于尝试的人。","不要拿别人的错误惩罚自己。","学会放下,才能腾出手来拥抱新的可能。","所有的天才都曾是努力的凡人。","比别人优秀不是目的,成为更好的自己才是。","你不需要被所有人喜欢,但你必须喜欢自己。","保持好奇心,世界就不会无聊。","每一个平静的背后,都有一颗强大的内心。","把抱怨的时间用来思考,把悲伤的时间用来行动。","只要心里有光,哪里都是出路。","你的奋斗轨迹,就是你最好的简历。","成功不是偶然的,它是努力、坚持和学习的结果。","不要小看自己,宇宙都是从一个点开始的。","真正的自由,是不依赖任何人的底气。","你的努力,终有一天会让你站在阳光下。","生活不在别处,就在此时此刻。","每一段经历,都是人生最好的礼物。"];function is(){return e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-skeleton-card",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-skeleton-row",children:[e.jsxRuntimeExports.jsx(e.Skeleton.Avatar,{active:!0,size:28,shape:"circle"}),e.jsxRuntimeExports.jsx(e.Skeleton.Input,{active:!0,style:{width:120,height:18}})]}),e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsxRuntimeExports.jsx(e.Skeleton.Input,{active:!0,block:!0,style:{height:40,borderRadius:10}}),e.jsxRuntimeExports.jsx(e.Skeleton.Button,{active:!0,style:{width:80,height:40,borderRadius:10}})]})]})}function os(){return e.jsxRuntimeExports.jsx("div",{className:"wandox-hub-skeleton-insights",children:[1,2,3].map(n=>e.jsxRuntimeExports.jsx("div",{className:"wandox-hub-skeleton-insight-card",children:e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-skeleton-insight-inner",children:[e.jsxRuntimeExports.jsx(e.Skeleton.Input,{active:!0,style:{width:52,height:22,borderRadius:100}}),e.jsxRuntimeExports.jsxs("div",{style:{flex:1},children:[e.jsxRuntimeExports.jsx(e.Skeleton.Input,{active:!0,block:!0,style:{height:16,marginBottom:6}}),e.jsxRuntimeExports.jsx(e.Skeleton.Input,{active:!0,style:{width:"70%",height:12}})]})]})},n))})}function rs(n){return!!n&&/^https?:\/\//.test(n)}function Ue(n){if(!n)return"✦";if(rs(n))return e.jsxRuntimeExports.jsx("img",{src:n,alt:""});const t=e.agentIconMap.get(n);return t?t.component:n}function ls(n,t){const a=`${n||""} ${t||""}`.toLowerCase();return a.includes("red")||a.includes("critical")?"wandox-insight-severity--red":a.includes("orange")||a.includes("high")?"wandox-insight-severity--orange":a.includes("yellow")||a.includes("medium")?"wandox-insight-severity--yellow":"wandox-insight-severity--gray"}function cs(n){const t=n.match(new RegExp("^\\p{Extended_Pictographic}","u"));return(t==null?void 0:t[0])||"📌"}function rt(n){return n.replace(new RegExp("^\\p{Extended_Pictographic}\\s*","u"),"")}function lt(n){var t;return n.bind_type==="playbook"&&n.bind_playbook_id&&((t=n.playbook_args)!=null&&t.length)?"执行":n.bind_type==="agent"?"找智能体聊聊":n.bind_type==="chat"?"分析一下":"查看详情"}function xs(n,t){const a=n.asin||n.ASIN||n.sku||n.seller_sku,o=n.site||n.marketplace||n.country;if(a||o)return[a,o&&`(${o})`].filter(Boolean).join(" ");const c=Object.values(n).find(h=>h!=null&&String(h).trim());return c?String(c):`参数 ${t+1}`}function ds(n,t){var o;const a=(o=n.query_template)==null?void 0:o.trim();return!a||!t?n.title:a.replace(/\{\{?\s*([\w.-]+)\s*\}?\}/g,(c,h)=>{const l=t[h];return l==null?c:String(l)})}function us(n){return!n||n.status==="disabled"||n.status==="error"||!n.scenes?[]:Object.entries(n.scenes).map(([t,a])=>({name:t,total_affected:a.total_affected,suggestions_count:a.suggestions_count,cards:Array.isArray(a.cards)?a.cards:[]})).filter(t=>t.cards.length>0)}function ps({agentLoading:n,mainAgentForHub:t,mainAgentQuestions:a,agents:o,hubChatOpen:c,setHubChatOpen:h,hubChatInput:l,setHubChatInput:p,hubScrollIdx:w,hubScrollFading:y,onHubChatSend:g,onHubInputFocus:u,onHubInputBlur:R,messages:f,executing:q,hubInlineChatInput:U,setHubInlineChatInput:E,onHubInlineSend:r,onEnterProfessional:x,playbooks:k,executePlaybook:b,onRequestPlaybookParams:D,onAbort:v,onRespondToProposal:F,ssoToken:A,ssoDomain:z,ssoCompany:C}){var Q,S,ge,Pe,be;const I=n&&!t,O=localStorage.getItem("sso_username")||"",W=localStorage.getItem("sso_user_id")||"",T=e.reactExports.useRef(null),P=e.reactExports.useRef(null),M=e.reactExports.useMemo(()=>[],[]),[ee,Z]=e.reactExports.useState(""),[J,me]=e.reactExports.useState([]),[ne,ie]=e.reactExports.useState(!1),[K,ce]=e.reactExports.useState("idle"),[xe,ye]=e.reactExports.useState(0),[Y,de]=e.reactExports.useState(null),[L,ke]=e.reactExports.useState(!1),N=o[0],G=(N==null?void 0:N.agent_code)||(N==null?void 0:N.agent_id)||"",he=(Q=N==null?void 0:N.questions)!=null&&Q.length?N.questions:a,Ne=z!=="yunduo"&&he[w%Math.max(he.length,1)]||"今天仓库订单处理的怎么样了?",Le=e.reactExports.useMemo(()=>ot[Math.floor(Math.random()*ot.length)],[]),je=e.reactExports.useMemo(()=>({Authorization:`Bearer ${A}`,"X-Tenant-ID":C,"X-Domain":z,"Content-Type":"application/json"}),[A,C,z]),ae=e.reactExports.useCallback(async(i=!1)=>{if(!(!A||!z)){ie(!0);try{const _=await fetch(`${e.getBaseURL()}/api/v1/insights/${i?"refresh":"recommendations"}`,{method:i?"POST":"GET",headers:je});if(!_.ok)throw new Error(`HTTP ${_.status}`);const ue=await _.json(),V=ue==null?void 0:ue.data;ce((V==null?void 0:V.status)||"error"),ye((V==null?void 0:V.total_cards)||0),me(us(V))}catch{ce("error"),ye(0),me([])}finally{ie(!1)}}},[je,z,A]);e.reactExports.useEffect(()=>{ae()},[ae]),e.reactExports.useEffect(()=>{!ee&&G&&Z(G)},[G,ee]);const oe=J,H=ee||G||((S=M[0])==null?void 0:S.agent_id)||(t==null?void 0:t.agent_id),X=e.useQuestionAutocomplete({token:A,domain:z,tenantId:C,agentId:H||"",limit:5});e.reactExports.useEffect(()=>{if(!L||c){X.clear();return}X.search(l)},[L,l,c,X.search,X.clear]);const $=oe.length>0&&oe.every(i=>i.cards.length===1),Se=M.slice(0,3),Ce=M.slice(3),Ie=H===G?N==null?void 0:N.name:(ge=M.find(i=>i.agent_id===H))==null?void 0:ge.name,Ae=H===G?N!=null&&N.icon?e.getAgentIconById(N.icon):e.getAgentIconById("robot"):Ue((Pe=M.find(i=>i.agent_id===H))==null?void 0:Pe.icon),fe=H===G?N==null?void 0:N.description:(be=M.find(i=>i.agent_id===H))==null?void 0:be.description,s=(i,_)=>{if(i.bind_type==="agent"&&i.bind_agent_code){x(i.bind_agent_code);return}if(i.bind_type==="playbook"&&i.bind_playbook_id&&_){h(!0),b({message:ds(i,_),playbook_id:i.bind_playbook_id,playbook_params:_});return}g(H,i.title)},m=(i,_,ue,V=!1,Be=!1)=>{const we=Array.isArray(_.playbook_args)?_.playbook_args:[],Re=_.bind_type==="playbook"&&!!_.bind_playbook_id&&we.length>0;return e.jsxRuntimeExports.jsxs("article",{className:`wandox-insight-card${V?" wandox-insight-card--modal":""}${Be?" wandox-insight-card--featured":""}`,children:[e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-insight-card-main",onClick:()=>{V&&de(null),s(_,we[0])},children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-insight-card-top",children:[e.jsxRuntimeExports.jsx("span",{className:`wandox-insight-severity ${ls(_.severity_color,_.priority)}`,children:_.severity_label||"观察"}),_.affected_count&&e.jsxRuntimeExports.jsx("span",{children:_.affected_count})]}),e.jsxRuntimeExports.jsx("h4",{children:_.title}),_.description&&e.jsxRuntimeExports.jsx("p",{children:_.description}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-insight-card-foot",children:[e.jsxRuntimeExports.jsx("span",{children:_.value_hint||"建议进一步确认"}),!Re&&e.jsxRuntimeExports.jsxs("strong",{children:[lt(_)," →"]})]})]}),Re&&e.jsxRuntimeExports.jsxs("div",{className:"wandox-insight-arg-list",children:[we.slice(0,V?10:3).map((ve,te)=>e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-insight-arg-action",onClick:()=>{V&&de(null),s(_,ve)},children:[e.jsxRuntimeExports.jsx("span",{children:xs(ve,te)}),e.jsxRuntimeExports.jsx("strong",{children:lt(_)})]},`${_.title}-${te}`)),!V&&we.length>3&&e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-insight-arg-more",onClick:()=>de(oe.find(ve=>ve.name===i)||null),children:["还有 ",we.length-3," 项可执行"]})]})]},`${i}-${_.title}-${ue}`)};return e.jsxRuntimeExports.jsx("div",{className:"wandox-view-scroll",children:e.jsxRuntimeExports.jsxs("div",{className:"wandox-view-content wandox-hub-v2",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-v2-header",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("h1",{className:"wandox-hub-v2-title",children:["您好,",O||"欢迎回来"]}),e.jsxRuntimeExports.jsx("p",{className:"wandox-hub-v2-subtitle",children:Le})]}),z!=="yunduo"&&e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-hub-v2-report",onClick:()=>{const i=new URLSearchParams;A&&i.append("authorization",A),z&&i.append("x-domain",z),C&&i.append("x-tenant-id",C),W&&i.append("user_id",W),O&&i.append("username",O),window.open(`https://ai.wandox.com/trend-report/trend-report-6.html${i.toString()?`?${i.toString()}`:""}`,"_blank")},children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-hub-v2-report-logo",children:"麦"}),e.jsxRuntimeExports.jsxs("span",{children:[e.jsxRuntimeExports.jsx("strong",{children:"麦多趋势报告"}),e.jsxRuntimeExports.jsx("small",{children:"第六期 已更新 →"})]})]})]}),I?e.jsxRuntimeExports.jsx(is,{}):e.jsxRuntimeExports.jsxs("div",{ref:T,className:`wandox-hub-main-card${c?" wandox-hub-main-card--open":""}`,children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-hub-main-card-search",style:{opacity:c?0:1,maxHeight:c?0:520,transition:"opacity 0.2s ease, max-height 0.35s cubic-bezier(0.4,0,0.2,1)"},children:e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-v2-input-panel",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-v2-input-head",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-v2-agent-title",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-hub-v2-agent-mark",children:Ae}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("strong",{children:Ie||(t==null?void 0:t.name)||"通用问答"}),e.jsxRuntimeExports.jsx("span",{children:fe||"问什么都行,系统会自动分流到对应的专业能力"})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-v2-chip-row",style:{display:"none"},children:[G&&e.jsxRuntimeExports.jsxs("button",{type:"button",className:`wandox-hub-v2-chip${H===G?" wandox-hub-v2-chip--active":""}`,onClick:()=>Z(G),title:(N==null?void 0:N.description)||(N==null?void 0:N.name)||"全部",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-hub-v2-chip-icon",children:N!=null&&N.icon?e.getAgentIconById(N.icon):"✦"}),"全部"]}),Se.map(i=>e.jsxRuntimeExports.jsxs("button",{type:"button",className:`wandox-hub-v2-chip${i.agent_id===H?" wandox-hub-v2-chip--active":""}`,onClick:()=>Z(i.agent_id),title:i.description||i.name,children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-hub-v2-chip-icon",children:Ue(i.icon)}),i.name]},i.agent_id)),Ce.length>0&&e.jsxRuntimeExports.jsx(e.Dropdown,{menu:{items:Ce.map(i=>({key:i.agent_id,label:e.jsxRuntimeExports.jsxs("span",{className:"wandox-hub-v2-more-item",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-hub-v2-chip-icon",children:Ue(i.icon)}),e.jsxRuntimeExports.jsx("span",{children:i.name})]})})),onClick:({key:i})=>Z(String(i))},placement:"bottomRight",children:e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-hub-v2-chip wandox-hub-v2-chip--more",children:["更多 ",e.jsxRuntimeExports.jsx(e.RefIcon$3,{})]})})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-v2-input-wrap",children:[e.jsxRuntimeExports.jsx(e.Input.TextArea,{value:l,onChange:i=>p(i.target.value),onPressEnter:i=>{i.shiftKey||(i.preventDefault(),g(H))},onFocus:()=>{ke(!0),u==null||u()},onBlur:()=>{window.setTimeout(()=>ke(!1),120),R==null||R()},placeholder:"请随便问,看看 AI 搭子怎么帮你避坑",autoSize:{minRows:3,maxRows:7},variant:"borderless",className:"wandox-hub-v2-textarea"}),e.jsxRuntimeExports.jsx(e.QuestionAutocomplete,{open:L,rewrittenQuestion:X.rewrittenQuestion,questions:X.questions,loading:X.loading,placement:"bottom",onSelectRewrite:i=>{p(i),X.clear()},onSelectQuestion:i=>{p(""),X.clear(),g(H,i.title)}})]}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-v2-input-bottom",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-v2-example",children:[e.jsxRuntimeExports.jsx("span",{className:"wandox-hub-v2-example-label",children:"示例:"}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-hub-v2-example-text",onClick:()=>{p(Ne)},style:{opacity:y?0:1,transform:y?"translateY(-4px)":"translateY(0)"},children:Ne})]}),e.jsxRuntimeExports.jsx(e.Button,{type:"primary",icon:e.jsxRuntimeExports.jsx(e.RefIcon$15,{}),className:"wandox-hub-v2-send",onClick:()=>g(H),children:"发送问题"})]})]})}),e.jsxRuntimeExports.jsxs("div",{style:{height:c?"100%":0,display:"flex",flexDirection:"column",opacity:c?1:0,overflow:"hidden",transition:"opacity 0.3s ease 0.1s, max-height 0.4s cubic-bezier(0.4,0,0.2,1)",position:"relative",zIndex:c?1:-1},children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-chat-header",children:[t&&e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-chat-agent-avatar",children:[e.getAgentIconById(t.icon),t.is_main&&e.jsxRuntimeExports.jsx("div",{className:"wandox-hub-chat-agent-badge"})]}),e.jsxRuntimeExports.jsx("span",{className:"wandox-hub-chat-agent-name",children:t==null?void 0:t.name}),e.jsxRuntimeExports.jsx("span",{className:"wandox-hub-chat-status",children:"对话中"}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-hub-chat-close",onClick:()=>{v(),h(!1)},children:"×"})]}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-chat-section__body wandox-chat-section__body--hub",children:[e.jsxRuntimeExports.jsx(e.ChatMessageList,{messages:f,executing:q,ssoToken:A,ssoDomain:z,ssoCompany:C,onExecutePlaybook:i=>b(i),onFillPlaybookParams:i=>D({playbook_id:i.playbookId,name:i.playbookName,input_fields:i.inputFields,initial_params:i.initialParams,playbook_type:i.playbookType}),onRespondToProposal:F,containerRef:P,className:"wandox-hub-messages"}),e.jsxRuntimeExports.jsx(e.ConversationOutline,{messages:f,scrollContainerRef:P})]}),e.jsxRuntimeExports.jsx("div",{className:"wandox-hub-chat-input-row",children:e.jsxRuntimeExports.jsx(e.ChatInput,{executing:q,onSend:r,playbooks:k,value:U,onValueChange:E,placeholder:"继续提问…",ssoToken:A,ssoDomain:z,ssoCompany:C,onRequestPlaybookParams:D})}),e.jsxRuntimeExports.jsx("div",{className:"wandox-hub-chat-footer",children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-hub-chat-enter-link",onClick:()=>x(),children:"进入完整对话视图 →"})})]})]}),(ne||K==="error"||K==="success"&&xe>=0)&&K!=="disabled"&&e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-section wandox-hub-v2-insights",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-v2-section-heading",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-v2-section-kicker",children:[e.jsxRuntimeExports.jsx("span",{}),e.jsxRuntimeExports.jsx("strong",{children:"基于你的数据,建议先看"})]}),e.jsxRuntimeExports.jsx("p",{children:"系统每天扫描你的店铺数据,自动识别出值得处理的场景"})]}),e.jsxRuntimeExports.jsx(e.Button,{type:"text",size:"small",icon:e.jsxRuntimeExports.jsx(e.RefIcon$7,{}),className:"wandox-hub-v2-refresh",onClick:()=>ae(!0),children:"换一批"})]}),ne?e.jsxRuntimeExports.jsx(os,{}):K==="error"?e.jsxRuntimeExports.jsxs("div",{className:"wandox-insight-empty",children:[e.jsxRuntimeExports.jsx("strong",{children:"数据获取失败,请稍后重试"}),e.jsxRuntimeExports.jsx(e.Button,{type:"link",size:"small",onClick:()=>ae(),children:"重试"})]}):oe.length===0?e.jsxRuntimeExports.jsxs("div",{className:"wandox-insight-empty",children:[e.jsxRuntimeExports.jsx("strong",{children:"暂无场景推荐,数据正常"}),e.jsxRuntimeExports.jsx("span",{children:"当前没有扫描到需要优先处理的运营场景"})]}):e.jsxRuntimeExports.jsx("div",{className:`wandox-insight-scene-list${$?" wandox-insight-scene-list--single-cards":""}${oe.length===1?" wandox-insight-scene-list--one-scene":""}`,children:oe.map(i=>e.jsxRuntimeExports.jsxs("section",{className:"wandox-insight-scene",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-insight-scene-head",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("strong",{children:rt(i.name)}),e.jsxRuntimeExports.jsxs("span",{children:["扫描到"," ",i.suggestions_count??i.cards.length," ","条建议"]})]})}),e.jsxRuntimeExports.jsx("div",{className:`wandox-insight-card-row${i.cards.length===1?" wandox-insight-card-row--single":""}`,children:i.cards.slice(0,4).map((_,ue)=>m(i.name,_,ue,!1,i.cards.length===1))}),i.cards.length>4&&e.jsxRuntimeExports.jsxs("button",{type:"button",className:"wandox-insight-view-all",onClick:()=>de(i),children:["查看全部 ",i.cards.length," 条建议 →"]})]},i.name))})]}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-section",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-v2-section-heading",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-hub-v2-section-kicker",children:[e.jsxRuntimeExports.jsx("span",{}),e.jsxRuntimeExports.jsx("strong",{children:"需要执行更专业的任务?"})]}),e.jsxRuntimeExports.jsx("p",{children:"直接进入对应专家,按业务流程一步步处理"})]}),e.jsxRuntimeExports.jsx(e.Button,{type:"link",size:"small",className:"wandox-hub-v2-refresh",onClick:()=>x(),children:"全部 →"})]}),I?e.jsxRuntimeExports.jsx("div",{className:"wandox-agent-grid",children:[1,2,3].map(i=>e.jsxRuntimeExports.jsxs("div",{className:"wandox-agent-entry-card",style:{pointerEvents:"none"},children:[e.jsxRuntimeExports.jsx(e.Skeleton.Avatar,{active:!0,size:36,shape:"square",style:{borderRadius:8,flexShrink:0}}),e.jsxRuntimeExports.jsxs("div",{style:{flex:1},children:[e.jsxRuntimeExports.jsx(e.Skeleton.Input,{active:!0,block:!0,style:{height:14,marginBottom:6}}),e.jsxRuntimeExports.jsx(e.Skeleton.Input,{active:!0,style:{width:"80%",height:11}})]})]},i))}):e.jsxRuntimeExports.jsx("div",{className:"wandox-agent-grid",children:o.filter(i=>!i.is_main).slice(0,4).map(i=>{const _=e.getAgentPackageBenefit(i);return e.jsxRuntimeExports.jsxs("button",{type:"button",className:`wandox-agent-entry-card${_?" wandox-agent-entry-card--with-badge":""}`,onClick:()=>x(i.agent_id||void 0),children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-agent-entry-icon",children:e.getAgentIconById(i.icon)}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-agent-entry-info",children:[e.jsxRuntimeExports.jsx("div",{className:"wandox-agent-entry-name",children:i.name}),e.jsxRuntimeExports.jsx("div",{className:"wandox-agent-entry-desc",children:i.description})]}),e.jsxRuntimeExports.jsx(e.RefIcon$6,{className:"wandox-agent-entry-arrow"}),_&&e.jsxRuntimeExports.jsx("span",{className:`wandox-agent-entry-badge wandox-agent-entry-badge--${_.kind}`,style:{background:_.badgeColor,color:_.badgeTextColor},children:_.badgeText})]},i.agent_id)})})]}),e.jsxRuntimeExports.jsx(e.Modal,{open:!!Y,onCancel:()=>de(null),footer:null,width:920,centered:!0,className:"wandox-insight-modal",title:Y?e.jsxRuntimeExports.jsxs("div",{className:"wandox-insight-modal-title",children:[e.jsxRuntimeExports.jsx("span",{children:cs(Y.name)}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("strong",{children:rt(Y.name)}),e.jsxRuntimeExports.jsxs("small",{children:[Y.cards.length," 条数据建议"]})]})]}):null,styles:{container:{padding:0}},children:Y&&e.jsxRuntimeExports.jsx("div",{className:"wandox-insight-modal-grid",children:Y.cards.map((i,_)=>m(Y.name,i,_,!0))})})]})})}function ms(n={}){const{presetAgents:t,initialAgentId:a}=n,{setAllQuestions:o}=e.useQuestionsStore(),[c,h]=e.reactExports.useState("default"),[l,p]=e.reactExports.useState([]),[w,y]=e.reactExports.useState([]),[g,u]=e.reactExports.useState([]),[R,f]=e.reactExports.useState(!1),[q,U]=e.reactExports.useState([]),[E,r]=e.reactExports.useState([]),[x,k]=e.reactExports.useState(!1),[b,D]=e.reactExports.useState(!1),v=e.reactExports.useRef(c),F=e.reactExports.useRef(0),A=e.reactExports.useRef(0);v.current=c;const z=e.reactExports.useCallback(async()=>{var O,W;if(t&&t.length>0){p(t),h(P=>{var M,ee;if(P&&P!=="default"&&t.some(Z=>Z.agent_code===P||Z.agent_id===P))return P;if(a){const Z=e.findAgentById(t,a);if(Z)return e.getAgentPrimaryId(Z);e.staticMethods.error("指定的智能体不存在,已切换到默认智能体")}return((M=t[0])==null?void 0:M.agent_code)||((ee=t[0])==null?void 0:ee.agent_id)||""});const T=[];for(const P of t)if(P.questions&&Array.isArray(P.questions)&&T.push(...P.questions),P.children)for(const M of P.children)M.questions&&Array.isArray(M.questions)&&T.push(...M.questions);o(T);return}k(!0);try{const{data:T}=await e.GET_Api_V1_Agents_List({page:1,page_size:99});if(p(T.filter(M=>!M.hidden)||[]),a){const M=e.findAgentById(T||[],a);M?h(e.getAgentPrimaryId(M)):(e.staticMethods.error("指定的智能体不存在,已切换到默认智能体"),h(((O=T[0])==null?void 0:O.agent_code)||""))}else h(((W=T[0])==null?void 0:W.agent_code)||"");const P=[];for(const M of T||[])if(M.questions&&Array.isArray(M.questions)&&P.push(...M.questions),M.children)for(const ee of M.children)ee.questions&&Array.isArray(ee.questions)&&P.push(...ee.questions);o(P)}catch{}k(!1)},[t,o,a]),C=e.reactExports.useCallback(async()=>{if(!c||c==="default")return;const O=c,W=++F.current;k(!0),D(!1),u([]);try{const{data:T}=await e.GET_Api_V1_Agents_Detail({agent_id:O});if(W!==F.current||v.current!==O)return;y(e.collectPlaybooksFromDetail(T));const P=T.playbook_groups||[];U(P);const M=T.children||[];r(M)}catch{if(W!==F.current||v.current!==O)return;u([])}finally{W===F.current&&v.current===O&&(k(!1),D(!0))}},[c]),I=e.reactExports.useCallback(async()=>{if(!c||c==="default"){u([]);return}const O=c,W=++A.current;f(!0);try{const{data:T}=await e.GET_Api_V1_Agents_UserPlaybooks({agent_id:O});if(W!==A.current||v.current!==O)return;const P=Array.isArray(T)?T:Array.isArray(T==null?void 0:T.user_playbooks)?T.user_playbooks:[];u(P)}catch{if(W!==A.current||v.current!==O)return;u([]),e.staticMethods.error("我的场景加载失败")}finally{W===A.current&&v.current===O&&f(!1)}},[c]);return{activeAgent:c,setActiveAgent:h,agents:l,playbooks:w,userPlaybooks:g,userPlaybooksLoading:R,playbookGroups:q,childAgents:E,loading:x,setLoading:k,playbooksLoaded:b,loadAgents:z,loadPlaybooks:C,loadUserPlaybooks:I}}function hs(n){const t=n.toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}),a=n.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"});return`${t}
|
|
3
|
-
${a}`}function Qe(n,t){return n.activeAgent===t.activeAgent&&n.webhookId===t.webhookId&&n.ssoToken===t.ssoToken&&n.ssoDomain===t.ssoDomain&&n.ssoCompany===t.ssoCompany}function js(n){const{activeAgent:t,webhookId:a="",ssoToken:o="",ssoDomain:c="",ssoCompany:h=""}=n,[l,p]=e.reactExports.useState([]),w=e.reactExports.useRef({activeAgent:t,webhookId:a,ssoToken:o,ssoDomain:c,ssoCompany:h});e.reactExports.useEffect(()=>{w.current={activeAgent:t,webhookId:a,ssoToken:o,ssoDomain:c,ssoCompany:h},p([])},[t,a,o,c,h]);const y=e.reactExports.useCallback(async()=>{if(!t)return;const g={activeAgent:t,webhookId:a,ssoToken:o,ssoDomain:c,ssoCompany:h};if(Qe(w.current,g))try{const u=await e.GET_Api_V1_Agents_Workspaces({agent_id:t,limit:10,use_cache:!1});if(!Qe(w.current,g))return;if(u!=null&&u.data&&Array.isArray(u.data)){const R=u.data.map(f=>{const q=Array.isArray(f.actions)?f.actions||[]:[],U=f.ui_payload,E=U==null?void 0:U.actions,r=Array.isArray(E)?E:[],k=[...q,...r].map(D=>{const v=D;return{label:v.display_name||v.label||"执行",action_id:v.action_id,playbook_id:v.playbook_id,display_name:v.display_name,display_icon:v.display_icon,params:v.params,params_fields_map:v.params_fields_map,type:v.type,url:v.url,style:v.style,status:v.action_status||v.status||void 0,sort_order:v.sort_order,executed_job_id:v.executed_job_id,supports_batch:v.supports_batch===!0,batch_max_items:v.batch_max_items,batch_id:v.batch_id,outputs:v.outputs}}),b=f.outputs;return{type:f.widget_type||"daily_report",priority:f.priority||"medium",title:f.title||"每日战报",summary:f.summary||"",timestamp:f.created_at?hs(new Date(f.created_at||"")):"",data:f.card_data||{},actions:k,id:f.inbox_id||"",agent_id:f.agent_id||"",read:!!f.is_read,ui_payload:b||U||{}}});if(R.length>0){const f=R.sort((q,U)=>{const E=q.timestamp?new Date(q.timestamp.replace(/\n/g," ")).getTime():0;return(U.timestamp?new Date(U.timestamp.replace(/\n/g," ")).getTime():0)-E});p(f)}else p([])}else p([])}catch(u){if(!Qe(w.current,g))return;throw p([]),u}},[t,a,o,c,h]);return{widgets:l,setWidgets:p,loadDailyReports:y}}function fs(){const[n,t]=e.reactExports.useState([]),[a,o]=e.reactExports.useState(!1),[c,h]=e.reactExports.useState(!1),[l,p]=e.reactExports.useState(""),[w,y]=e.reactExports.useState([]),[g,u]=e.reactExports.useState(!1),[R,f]=e.reactExports.useState(null),[q,U]=e.reactExports.useState(!0),E=e.reactExports.useRef(null),r=e.reactExports.useCallback(async()=>{if(E.current)return E.current;const C=(async()=>{o(!0);try{const I=await e.GET_Api_V1_Playbooks_SolidifyView_List({page:1,page_size:20});return Array.isArray(I==null?void 0:I.data)?(t(I.data),h(!0),!0):(h(!1),!1)}catch{return h(!1),!1}finally{o(!1),E.current=null}})();return E.current=C,C},[]),x=e.reactExports.useCallback(()=>c?Promise.resolve(!0):r(),[r,c]),k=e.reactExports.useCallback(C=>{p(C),f({session_id:C,type:"dashboard_intent",intents:[],data:{}}),U(!1),(async(O={})=>{u(!0);try{const W=await e.POST_Api_V1_Playbooks_SolidifyView_Run_ByPlaybookId(C,{params:O});W.success&&W.data&&(f(W.data),W.data.input_params&&y(W.data.input_params))}catch{}finally{u(!1)}})()},[]),b=e.reactExports.useCallback(C=>{if(!l)return;(async()=>{u(!0);try{const O=await e.POST_Api_V1_Playbooks_SolidifyView_Run_ByPlaybookId(l,{params:C});O.success&&O.data&&f(O.data)}catch{}finally{u(!1)}})()},[l]),D=e.reactExports.useCallback(C=>{l===C&&(p(""),f(null),y([])),r()},[l,r]),v=e.reactExports.useCallback(()=>{if(!l)return null;const C=n.find(I=>I.playbook_id===l);return(C==null?void 0:C.name)||null},[l,n]),F=e.reactExports.useCallback((C,I)=>{f(C),U(I!==void 0?I:!0)},[]),A=e.reactExports.useCallback(()=>{},[]),z=e.reactExports.useCallback(()=>{p(""),f(null),y([])},[]);return{solidifiedPlaybooks:n,solidifiedPlaybooksLoading:a,solidifiedPlaybooksLoaded:c,activeSolidifiedPlaybook:l,setActiveSolidifiedPlaybook:p,solidifyInputParams:w,solidifyLoading:g,dashboardData:R,setDashboardData:f,dashboardShowSaveButton:q,setDashboardShowSaveButton:U,loadSolidifiedPlaybooks:r,ensureSolidifiedPlaybooksLoaded:x,handleSolidifiedPlaybookClick:k,handleSolidifyParamsSearch:b,handleSolidifiedPlaybookDelete:D,getCurrentSolidifiedPlaybookName:v,handleDashboardPreview:F,handleSolidifyComplete:A,clearDashboard:z}}function Es(){const{allQuestions:n,setCurrentQuestion:t}=e.useQuestionsStore();e.reactExports.useEffect(()=>{if(n.length===0)return;const a=Math.floor(Math.random()*n.length);t(n[a]);const o=setInterval(()=>{const c=Math.floor(Math.random()*n.length);t(n[c])},1e4);return()=>{clearInterval(o)}},[n,t])}const ct={chat:{title:"对话",subtitle:""},plan:{title:"自动化",subtitle:"创建、管理并追踪自动化智能体的执行结果,支持定时触发与对内流转"},professional:{title:"专业智能体",subtitle:"深度分析与专业领域对话"},goals:{title:"目标追踪",subtitle:"跟踪关键业务指标和目标进展"},settings:{title:"通知配置",subtitle:"配置 Webhook 通知,实时接收系统重要事件"}},gs=5*60*1e3,Rs=3;function ys(n={}){const{showAside:t=!0,showLogout:a=!1,onLogout:o,presetAgents:c,webhookId:h,onReady:l,initialAgentId:p,initialPlaybookId:w,initialPlaybookParams:y}=n,g=localStorage.getItem("sso_token")||"",u=localStorage.getItem("sso_domain")||"maiduo",R=localStorage.getItem("sso_company")||"",q=`${e.getBaseURL()}/api/v1/oss/upload2`,U=e.reactExports.useCallback(async d=>{const{data:B}=await e.GET_Api_V1_Playbooks_Detail({playbook_id:d});return B},[]),E=e.reactExports.useCallback(d=>e.POST_Api_V1_Playbooks_SolidifyView_SaveV2({session_id:d.session_id||"",name:d.name,description:d.description}),[]),r=e.reactExports.useCallback(d=>e.POST_Api_V1_Playbooks_SolidifyView_PreviewV2({session_id:d.session_id||"",user_hint:d.user_hint||""}),[]),{activeAgent:x,setActiveAgent:k,agents:b,playbooks:D,userPlaybooks:v,userPlaybooksLoading:F,childAgents:A,loading:z,loadAgents:C,loadPlaybooks:I,loadUserPlaybooks:O,playbooksLoaded:W}=ms({presetAgents:c,initialAgentId:p}),[T,P]=e.reactExports.useState(()=>!!p),[M,ee]=e.reactExports.useState(!1),[Z,J]=e.reactExports.useState(!1),[me,ne]=e.reactExports.useState([]),[ie,K]=e.reactExports.useState(0),ce=e.reactExports.useRef(!1),{executing:xe,stopping:ye,executingRef:Y,queueStatus:de,messageData:L,actions:ke}=pe.useWorkbenchSession({activeAgent:x,webhookId:h,ssoToken:g,ssoDomain:u,ssoCompany:R,onRecommendationsUpdate:ne}),{sendMessage:N,executePlaybook:G,respondToProposal:he,stopCurrent:Ne,retrigger:Le,abort:je,clearMessages:ae}=ke;e.reactExports.useEffect(()=>{ce.current&&!xe&&K(d=>d+1),ce.current=xe},[xe]);const{widgets:oe,setWidgets:H,loadDailyReports:X}=js({activeAgent:x,webhookId:h,ssoToken:g,ssoDomain:u,ssoCompany:R}),$=fs();Es();const[Se,Ce]=e.reactExports.useState(()=>localStorage.getItem("wandox_sidebar_agent_mode")==="true"),Ie=e.reactExports.useCallback(()=>{Ce(d=>{const B=!d;return localStorage.setItem("wandox_sidebar_agent_mode",String(B)),B})},[]),[Ae,fe]=e.reactExports.useState(!1),[s,m]=e.reactExports.useState(!1),[Q,S]=e.reactExports.useState(!1),[ge,Pe]=e.reactExports.useState(!1),[be,i]=e.reactExports.useState(null),[_,ue]=e.reactExports.useState(!1),[V,Be]=e.reactExports.useState(null),[we,Re]=e.reactExports.useState(""),[ve,te]=e.reactExports.useState(null),[re,Ee]=e.reactExports.useState("chat"),[De,dt]=e.reactExports.useState(null),ut=e.reactExports.useCallback(()=>{fe(!0),m(!1)},[]),pt=e.reactExports.useCallback(()=>{fe(!1),m(!1)},[]),[Ye,Xe]=e.reactExports.useState(""),[Je,et]=e.reactExports.useState(0),[mt,ze]=e.reactExports.useState(!1),[tt,st]=e.reactExports.useState(!1),[ht,nt]=e.reactExports.useState(!1),[jt,ft]=e.reactExports.useState(""),Oe=e.reactExports.useRef(null),$e=e.reactExports.useRef(!1),[Et,gt]=e.reactExports.useState(null),[Rt,yt]=e.reactExports.useState(!1),bt=z||L.loading,wt=e.reactExports.useCallback(d=>{i(()=>d)},[]);e.reactExports.useEffect(()=>{l&&l({showInspectionResults:d=>{gt(d||null),yt(!0)}})},[l]),e.reactExports.useEffect(()=>{P(!!p),ee(!1),J(!1)},[p,w,y]);const vt=e.reactExports.useMemo(()=>(c||[]).map(d=>d.agent_id||d.agent_code||"").join("|"),[c]);e.reactExports.useEffect(()=>{C()},[vt]),e.reactExports.useEffect(()=>{if(x)return ne([]),I(),()=>{Y.current&&je()}},[x,h,g,u,R]),e.reactExports.useEffect(()=>{if(re!=="professional"){$e.current=!1;return}if(!x)return;$e.current||(L.loadMessagesAndDailyReport(),X()),$e.current=!1;let d=0,B=null;return B=setInterval(async()=>{try{await X(),d=0}catch{d++,d>=Rs&&B&&(clearInterval(B),B=null)}},gs),()=>{B&&clearInterval(B)}},[re,x,h,g,u,R]);const se=b.find(d=>d.is_main)??b[0],Me=(se==null?void 0:se.questions)||[];e.reactExports.useEffect(()=>{et(0),ze(!1)},[se==null?void 0:se.agent_id]),e.reactExports.useEffect(()=>{if(Me.length<=1||tt)return;let d;const B=setInterval(()=>{ze(!0),d=setTimeout(()=>{et(j=>(j+1)%Me.length),ze(!1)},350)},3500);return()=>{clearInterval(B),clearTimeout(d)}},[Me.length,tt]),e.reactExports.useEffect(()=>{if(Oe.current&&x&&x!=="default"){const d=Oe.current;Oe.current=null,N(d)}},[x,N]),e.reactExports.useEffect(()=>{if(!p||!T||!x||x==="default"||b.length===0)return;!!e.findAgentById(b,p)||P(!1)},[p,T,x,b]),e.reactExports.useEffect(()=>{!p||w||M||!x||x==="default"||!b.find(B=>e.matchesAgent(B,x)&&e.matchesAgent(B,p))||(ee(!0),Ee("professional"),$.clearDashboard(),P(!1))},[p,w,M,x,b,$]),e.reactExports.useEffect(()=>{var at;if(!p||!w||Z||!x||x==="default"||!W||!b.find(_e=>e.matchesAgent(_e,x)&&e.matchesAgent(_e,p)))return;const B=D.find(_e=>e.matchesPlaybook(_e,w));if(!B){Ee("professional"),e.staticMethods.error(`指定的剧本(${w})不存在,已切换到智能体界面`),J(!0),P(!1);return}J(!0),Ee("professional"),$e.current=!0,ae(),$.clearDashboard(),te(null),Re("");const j=y||{},le=Object.keys(j).length>0,qe=(B.input_fields??[]).filter(_e=>{if(!_e.required)return!1;const Ve=j[_e.name];return Ve==null||Ve===""});if((((at=B.input_fields)==null?void 0:at.length)??0)>0&&(!le||qe.length>0)){te(B),P(!1);return}G({message:B.name,playbook_id:w,playbook_params:j}),P(!1)},[p,w,Z,x,W,b,D,y]);const We=e.reactExports.useCallback(d=>{e.isSameAgentSelection(b,x,d)||(Y.current&&(je(),e.staticMethods.info("已中止当前剧本,切换智能体")),k(d),Re(""),te(null),$.clearDashboard(),ae(),H([]))},[je,x,b,ae,Y,k,$,H]),_t=(d,B)=>{const j=(B??Ye).trim()||Me[Je%Me.length]||"",le=d||(se==null?void 0:se.agent_id);!j||!le||(Xe(""),nt(!0),ae(),x===le?N(j):($e.current=!0,Oe.current=j,k(le)))},kt=(d,B)=>{$.handleDashboardPreview(d,B),Ee("chat"),k("default")},Nt=()=>{$.handleSolidifyComplete(),Ee("chat"),k("default")},St=d=>{Ee(d),(d==="goals"||d==="settings"||d==="plan"||d==="chat")&&$.clearDashboard()},Ct=()=>{m(!1),Pe(!0),$.ensureSolidifiedPlaybooksLoaded()},It=d=>{Pe(!1),$.handleSolidifiedPlaybookClick(d),Ee("chat"),k("default"),Re(""),te(null)},At=()=>{var d,B;if($.dashboardData)return e.jsxRuntimeExports.jsx(e.DashboardRenderer,{data:$.dashboardData,showSaveButton:$.dashboardShowSaveButton,onSaveSuccess:$.loadSolidifiedPlaybooks,onSaveDashboard:E,onPreviewDashboard:r,title:$.getCurrentSolidifiedPlaybookName()||void 0,customParamsForm:$.solidifyInputParams.length>0?e.jsxRuntimeExports.jsx(Jt,{inputParams:$.solidifyInputParams,onSearch:$.handleSolidifyParamsSearch,loading:$.solidifyLoading}):void 0,showGlobalFilter:$.solidifyInputParams.length>0});switch(re){case"chat":return e.jsxRuntimeExports.jsx(e.PlaybookContext.Provider,{value:{onExecutePlaybook:G,getPlaybookDetail:U,ossUploadUrl:q,ssoToken:g,ssoDomain:u,ssoCompany:R,onFillPlaybookParams:j=>{const le={playbook_id:j.playbookId,name:j.playbookName,input_fields:j.inputFields,initial_params:j.initialParams,playbook_type:j.playbookType};te(le),Ee("professional")}},children:e.jsxRuntimeExports.jsx(ps,{agentLoading:z,mainAgentForHub:se,mainAgentQuestions:Me,agents:b,hubChatOpen:ht,setHubChatOpen:nt,hubChatInput:Ye,setHubChatInput:Xe,hubScrollIdx:Je,hubScrollFading:mt,onHubChatSend:_t,onHubInputFocus:()=>st(!0),onHubInputBlur:()=>st(!1),messages:L.messages,executing:xe,hubInlineChatInput:jt,setHubInlineChatInput:ft,onHubInlineSend:(j,le,qe)=>{se!=null&&se.agent_id&&(x!==se.agent_id&&k(se.agent_id),N(j,le,qe))},onEnterProfessional:j=>{j&&k(j),Re(""),te(null),$.clearDashboard(),H([]),Ee("professional")},playbooks:D,executePlaybook:G,onRequestPlaybookParams:te,clearMessages:ae,onAbort:je,onRespondToProposal:he,ssoToken:g,ssoDomain:u,ssoCompany:R})});case"goals":return e.jsxRuntimeExports.jsx(e.GoalTracker,{});case"settings":return e.jsxRuntimeExports.jsx(pe.SettingsWithTabs,{});case"plan":return e.jsxRuntimeExports.jsx(pe.AutomationPage,{embedded:!0,onHeaderChange:dt,onCockpitEnter:ut,onCockpitExit:pt});case"professional":return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(ss,{title:((d=b.find(j=>e.matchesAgent(j,x)))==null?void 0:d.name)||"Wandox智能体",agentSwitcher:Se?void 0:e.jsxRuntimeExports.jsxs("div",{style:{display:"inline-flex",alignItems:"center",height:34,background:"#fff",border:"1px solid #e5e0f0",borderRadius:10,boxSizing:"border-box",overflow:"hidden"},children:[e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"0 0 0 8px"},children:[e.jsxRuntimeExports.jsx("div",{style:{width:22,height:22,flexShrink:0},children:e.getAgentIconById((B=b.find(j=>e.matchesAgent(j,x)))==null?void 0:B.icon)}),e.jsxRuntimeExports.jsx(e.Select,{value:x,onChange:j=>We(j),options:b.map(j=>({value:j.agent_id,label:j.name})),variant:"borderless",suffixIcon:e.jsxRuntimeExports.jsx(e.RefIcon$13,{style:{color:"#9275ff",verticalAlign:"middle"}}),style:{fontWeight:600,fontSize:14,minWidth:100,color:"#4a3a6a"},popupMatchSelectWidth:!1})]}),e.jsxRuntimeExports.jsx("button",{type:"button",onClick:Ie,title:"切换为侧边栏选择",style:{display:"flex",alignItems:"center",justifyContent:"center",width:34,height:"100%",cursor:"pointer",color:"#b0a0c8",borderLeft:"1px solid #e5e0f0",transition:"all 0.15s",background:"none",border:"none",padding:0},onMouseEnter:j=>{j.currentTarget.style.color="#7c3aed",j.currentTarget.style.background="#f5f0ff"},onMouseLeave:j=>{j.currentTarget.style.color="#b0a0c8",j.currentTarget.style.background="transparent"},children:e.jsxRuntimeExports.jsx(it,{style:{fontSize:13}})})]}),count:oe.length,widgets:oe,activeAgent:x,agents:b,childAgents:A,ssoDomain:u,ssoToken:g,ssoCompany:R,onWidgetsUpdate:H,onExecuteComplete:()=>{X()},externalRobotName:Et,externalShowPanel:Rt}),e.jsxRuntimeExports.jsx(e.Chat,{messages:L.messages,playbooks:D,messagesTotal:L.messagesTotal,loadMoreMessages:L.loadMoreMessages,loading:bt,executing:xe,ssoToken:g,ssoDomain:u,ssoCompany:R,activeAgent:x,webhookId:h,onExecutePlaybook:G,onSolidifySuccess:$.loadSolidifiedPlaybooks,onDashboardPreview:kt,onSolidifyComplete:Nt,onFillPlaybookParams:j=>{const le={playbook_id:j.playbookId,name:j.playbookName,input_fields:j.inputFields,initial_params:j.initialParams,playbook_type:j.playbookType};te(le)},onActionClick:j=>{j.action_id?(S(!0),be&&be({action_id:j.action_id,action_params:j.params})):j.playbook_id&&G({message:j.display_name||"执行",playbook_id:j.playbook_id,...j.params?{playbook_params:j.params}:{}})},onExecuteComplete:()=>{X()},onRespondToProposal:he,onRetrigger:Le}),e.jsxRuntimeExports.jsxs("div",{className:"chat-input-area",children:[e.jsxRuntimeExports.jsx(e.PlaybookHub,{playbooks:D,playbookLoading:z,onPlaybookClick:G,onSelectPlaybook:j=>{te(j)},recommendations:me,userPlaybooks:v,userPlaybooksLoading:F,onLoadUserPlaybooks:O,agentId:e.getAgentPrimaryId(b.find(j=>e.matchesAgent(j,x)))||x,recentRefreshKey:ie}),e.jsxRuntimeExports.jsx(e.ChatInput,{executing:xe,stopping:ye,onStop:Ne,onSend:N,playbooks:D,recommendations:me,value:we,onValueChange:Re,onRequestPlaybookParams:te,ssoToken:g,ssoDomain:u,ssoCompany:R})]})]});default:return null}},Te=re==="plan"?De??ct.plan:ct[re],Pt=(re==="plan"||!$.dashboardData)&&re!=="professional"&&re!=="chat";return e.jsxRuntimeExports.jsx(e.LanguageProvider,{children:e.jsxRuntimeExports.jsxs(Ht,{children:[e.jsxRuntimeExports.jsx("div",{className:`wandox-aside-overlay ${s?"wandox-aside-overlay--visible":""}`,onClick:()=>m(!1),onKeyDown:d=>d.key==="Escape"&&m(!1),role:"button",tabIndex:0,"aria-label":"关闭侧边栏"}),t&&e.jsxRuntimeExports.jsx(Kt,{active:x,agents:b,onChange:d=>{m(!1),We(d)},collapsed:Ae,onToggle:()=>fe(d=>!d),className:s?"wandox-aside--mobile-open":"",activeView:re,onViewChange:St,onToolboxOpen:Ct,showLogout:a,onLogout:o,sidebarAgentMode:Se,onToggleSidebarMode:Ie,onAgentSelect:d=>We(d)}),t&&Ae&&e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-aside-floating-open",onClick:()=>fe(!1),"aria-label":"展开侧边栏",title:"展开侧边栏",children:e.jsxRuntimeExports.jsx(it,{})}),e.jsxRuntimeExports.jsxs("div",{className:"wandox-workspace",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-mobile-header",children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"wandox-mobile-menu-btn",onClick:()=>{fe(!1),m(!0)},children:"☰"}),e.jsxRuntimeExports.jsx("h1",{className:"wandox-mobile-title",children:"Wandox"}),a&&o?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:o,style:{width:40,height:40,background:"transparent",border:"none",cursor:"pointer"},children:"退出"}):e.jsxRuntimeExports.jsx("div",{style:{width:40}})]}),Pt&&e.jsxRuntimeExports.jsxs("div",{className:"wandox-workspace-topbar",children:[e.jsxRuntimeExports.jsxs("div",{className:"wandox-workspace-topbar-info",children:[e.jsxRuntimeExports.jsx("h1",{className:"wandox-workspace-topbar-title",children:(Te==null?void 0:Te.title)??"您好,欢迎使用 AI 智能体"}),e.jsxRuntimeExports.jsx("p",{className:"wandox-workspace-topbar-subtitle",children:(Te==null?void 0:Te.subtitle)??""})]}),e.jsxRuntimeExports.jsx("div",{className:"wandox-workspace-topbar-actions",children:re==="plan"?De==null?void 0:De.actions:null})]}),e.jsxRuntimeExports.jsx("div",{className:`wandox-workspace-container${re==="plan"?" wandox-workspace-container--automation":""}`,children:At()})]}),e.jsxRuntimeExports.jsx(es,{open:ge,loading:$.solidifiedPlaybooksLoading,playbooks:$.solidifiedPlaybooks,activePlaybookId:$.activeSolidifiedPlaybook,onClose:()=>Pe(!1),onPlaybookClick:It,onPlaybookDelete:$.handleSolidifiedPlaybookDelete}),e.jsxRuntimeExports.jsx(e.ActionExecutionDrawer,{open:Q,ssoToken:g,ssoDomain:u,ssoCompany:R,onClose:()=>S(!1),onExecuteAction:wt,onExecuteComplete:()=>{setTimeout(()=>{X()},1e3)}}),e.jsxRuntimeExports.jsx(as,{open:_,actionId:(V==null?void 0:V.action_id)||"",actionName:(V==null?void 0:V.display_name)||"",defaultParams:V==null?void 0:V.params,onCancel:()=>{ue(!1),Be(null)},onExecute:d=>{ue(!1),S(!0),be&&V&&be({action_id:V.action_id,action_params:d}),Be(null)}}),e.jsxRuntimeExports.jsx(Yt,{open:!!ve,playbook:ve,onClose:()=>te(null),onSubmit:(d,B)=>{te(null),G({message:d.name,playbook_id:d.playbook_id,playbook_params:B})}}),T&&e.jsxRuntimeExports.jsx(e.InitialRouteLoading,{}),e.jsxRuntimeExports.jsx(ns,{queueStatus:de})]})})}exports.default=ys;
|