import{aa as k,g as o,A as i,J as e,P as u,K as g,L as w,H as v,j as p,t as C,O as d,B as T,C as N,a9 as O,r as f}from"./index-DOFLUERq.js";import{a as _}from"./nodeMetadata-BYrn6PHN.js";import{_ as j}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./common-DEIQtiPI.js";import"./vue-flow-core-CsxnVOkM.js";import"./NodePropertyModal-mmcKGDvy.js";import"./SchemaFormRenderer-qVPQyEK7.js";import"./nodes-5SvwML7l.js";const R={class:"execution-results"},H={class:"execution-results-body"},S={class:"execution-details"},B={class:"details-left"},D={class:"history-list"},J={key:0,class:"success-overview-card"},L={class:"overview-card-header"},$={class:"overview-info-header"},E={key:1,class:"error-overview-card"},I={class:"overview-card-header"},V={class:"overview-info-header"},A={key:2,class:"no-execution-overview-card"},M={key:3},z=["onClick"],F={class:"history-item-header"},K={class:"history-node-name"},P={class:"history-item-meta"},W={class:"history-time"},q={key:4,class:"no-history"},G={key:0,class:"details-right"},Q={class:"node-detail-header"},U={class:"detail-tabs"},X={class:"node-detail-content"},Y={key:0,class:"detail-panel"},Z={class:"json-viewer"},ee={key:1,class:"detail-panel"},te={class:"json-viewer"},se={key:1,class:"details-right empty"},oe={key:0,class:"copy-tip"},ie={__name:"ExecutionResults",props:{executionResult:Object,executionHistory:Array},emits:["close"],setup(a,{emit:le}){const x=k(),l=f(null),r=f("output"),y=f(!1),b=n=>{l.value=n,r.value="output"},h=async n=>{try{const t=JSON.stringify(n,null,2);await navigator.clipboard.writeText(t),y.value=!0,setTimeout(()=>{y.value=!1},2e3)}catch{x.error("复制失败，请手动复制")}},m=n=>{if(typeof n!="object"||n===null)return n;const t={};for(const[s,c]of Object.entries(n))if(typeof c=="string"&&c.trim().startsWith("{"))try{t[s]=JSON.parse(c)}catch{t[s]=c}else t[s]=c;return t};return(n,t)=>(o(),i("div",R,[e("div",H,[e("div",S,[e("div",B,[e("div",D,[a.executionResult&&a.executionResult.success?(o(),i("div",J,[e("div",L,[t[5]||(t[5]=e("i",{class:"fa fa-check-circle text-success"},null,-1)),e("div",$,[t[4]||(t[4]=e("h5",null,"执行成功",-1)),e("p",null,"执行了 "+u(a.executionHistory.length)+" 个节点",1)])])])):a.executionResult&&!a.executionResult.success?(o(),i("div",E,[e("div",I,[t[7]||(t[7]=e("i",{class:"fa fa-exclamation-circle text-danger"},null,-1)),e("div",V,[t[6]||(t[6]=e("h5",null,"执行失败",-1)),e("p",null,u(a.executionResult.error),1)])])])):(o(),i("div",A,[...t[8]||(t[8]=[e("div",{class:"overview-card-header"},[e("i",{class:"fa fa-info-circle text-info"}),e("div",{class:"overview-info-header"},[e("h5",null,"无执行历史"),e("p",null,"请先执行流程查看结果")])],-1)])])),a.executionHistory&&a.executionHistory.length>0?(o(),i("div",M,[(o(!0),i(g,null,w(a.executionHistory,(s,c)=>(o(),i("div",{key:c,class:v(["history-item",[s.status,{active:l.value?.nodeId===s.nodeId}]]),onClick:ae=>b(s)},[e("div",F,[e("span",K,u(s.nodeLabel||p(_)(s.nodeType)?.label||s.nodeType),1),e("span",{class:v(["history-status-badge",s.status])},u(p(C)(s.status)),3)]),e("div",P,[e("span",W,u(new Date(s.timestamp).toLocaleTimeString()),1)])],10,z))),128))])):(o(),i("div",q,[...t[9]||(t[9]=[e("div",{class:"no-history-content"},[e("i",{class:"fa fa-history"}),e("p",null,"暂无执行历史")],-1)])]))])]),l.value?(o(),i("div",G,[e("div",Q,[e("h6",null,u(l.value.nodeLabel||p(_)(l.value.nodeType)?.label||l.value.nodeType),1),e("div",U,[e("button",{class:v(["tab-btn",{active:r.value==="input"}]),onClick:t[0]||(t[0]=s=>r.value="input")}," 输入 ",2),e("button",{class:v(["tab-btn",{active:r.value==="output"}]),onClick:t[1]||(t[1]=s=>r.value="output")}," 输出 ",2)])]),e("div",X,[r.value==="input"?(o(),i("div",Y,[l.value.inputs&&Object.keys(l.value.inputs).length>0?(o(),i("button",{key:0,class:"copy-btn-floating",onClick:t[2]||(t[2]=s=>h(l.value.inputs)),title:"复制"},[...t[10]||(t[10]=[e("i",{class:"fa fa-copy"},null,-1)])])):d("",!0),e("pre",Z,u(JSON.stringify(m(l.value.inputs||{}),null,2)),1)])):d("",!0),r.value==="output"?(o(),i("div",ee,[l.value.result&&Object.keys(l.value.result).length>0?(o(),i("button",{key:0,class:"copy-btn-floating",onClick:t[3]||(t[3]=s=>h(l.value.result)),title:"复制"},[...t[11]||(t[11]=[e("i",{class:"fa fa-copy"},null,-1)])])):d("",!0),e("pre",te,u(JSON.stringify(m(l.value.result||{}),null,2)),1)])):d("",!0)])])):(o(),i("div",se,[...t[12]||(t[12]=[e("div",{class:"empty-state"},[e("i",{class:"fa fa-mouse-pointer"}),e("p",null,"点击左侧节点查看详情")],-1)])]))])]),T(O,{name:"fade"},{default:N(()=>[y.value?(o(),i("div",oe,"已复制")):d("",!0)]),_:1})]))}},fe=j(ie,[["__scopeId","data-v-5b99f9ea"]]);export{fe as default};
