pisper 0.5.50 → 0.5.51
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/package.json +7 -7
- package/web/.vite/manifest.json +162 -159
- package/web/assets/{AppOverlays-DrS2NA9w.js → AppOverlays-DlB6SVT6.js} +1 -1
- package/web/assets/{AppSelect-CRjRgr38.js → AppSelect-kDqZkETY.js} +1 -1
- package/web/assets/{AssetsPage-C2GY8596.js → AssetsPage-mZkZgR9g.js} +1 -1
- package/web/assets/{ChannelsPage-FPSrQa1G.js → ChannelsPage-Dau7vaaV.js} +1 -1
- package/web/assets/{ChatDockView-BJGa8Bm8.js → ChatDockView-Cq7J6Xmn.js} +1 -1
- package/web/assets/{ChatHistoryPage-BBmrFY5U.js → ChatHistoryPage-BpoHAiYo.js} +1 -1
- package/web/assets/{ChatPage-DfQGtuLo.js → ChatPage-CCMsSvJV.js} +3 -3
- package/web/assets/{ConfigPage-D27UB6Ni.js → ConfigPage-BGZoCXnB.js} +1 -1
- package/web/assets/{MarkdownMessage-BQ_6o9-O.js → MarkdownMessage-Dbgb5XkJ.js} +1 -1
- package/web/assets/{MemoryPage-D46RKJLE.js → MemoryPage-BiAbcHbL.js} +1 -1
- package/web/assets/{PageHeader-DH1jtT2l.js → PageHeader-9ctH9v28.js} +1 -1
- package/web/assets/PluginsPage-D-D22LWb.js +1 -0
- package/web/assets/{PreviewPages-BBwzd5LJ.js → PreviewPages-DUZgwvOb.js} +1 -1
- package/web/assets/{SchedulesPage-AyePMsz_.js → SchedulesPage-C3sS9Ej3.js} +1 -1
- package/web/assets/{SkillsPage-Cb3i7xyX.js → SkillsPage-BeeTZyfc.js} +1 -1
- package/web/assets/{TerminalPanel-B06cwdRZ.js → TerminalPanel-a4jiIuSs.js} +1 -1
- package/web/assets/{WelcomeEffects-CsxWSguh.js → WelcomeEffects-Xo1Z1Nf4.js} +1 -1
- package/web/assets/{WorkflowsPage-Byq1cQot.js → WorkflowsPage-BCdz4ise.js} +1 -1
- package/web/assets/{WorkspacePicker-BNVaK0c9.js → WorkspacePicker-Ctf1A8lp.js} +1 -1
- package/web/assets/client-store-ohgbeJNh.js +1 -0
- package/web/assets/{collapsible-C4owDMcF.js → collapsible-U8Wh2f7S.js} +1 -1
- package/web/assets/{config-search-CsGhOXIG.js → config-search-CdRsMMUS.js} +1 -1
- package/web/assets/{dist-VQXpFPjV.js → dist-Dq4VqZgU.js} +1 -1
- package/web/assets/{dist-CyztUDRL.js → dist-cR3ayBwn.js} +1 -1
- package/web/assets/{es2015-BpePoPbM.js → es2015-DycjrqX-.js} +1 -1
- package/web/assets/{field-BAyGDYW_.js → field-t72VAR-1.js} +1 -1
- package/web/assets/index-Bd5A8V1V.js +40 -0
- package/web/assets/index-DUhopGVK.css +2 -0
- package/web/assets/{progress-BqaId9J2.js → progress-DQDjWjzV.js} +1 -1
- package/web/assets/{scroll-area-DkxdCF8r.js → scroll-area-C1DpxpHg.js} +1 -1
- package/web/assets/{separator-0_agp17Z.js → separator-Br2F2Mir.js} +1 -1
- package/web/assets/tool-labels-v0OysnpI.js +1 -0
- package/web/assets/{tooltip-D9uQM6ab.js → tooltip-DfGEs0yi.js} +1 -1
- package/web/assets/use-i18n-jYw5s_Yn.js +1 -0
- package/web/assets/{use-mobile-A2egKMjY.js → use-mobile-C1OVAMOm.js} +1 -1
- package/web/assets/web-preview-panel-uBOnhY4Z.js +556 -0
- package/web/assets/{welcome-brand-CYtVVlIL.js → welcome-brand-R7Xflzvb.js} +1 -1
- package/web/index.html +10 -10
- package/web/assets/PluginsPage-B4cG171E.js +0 -1
- package/web/assets/client-store-BSV7t02b.js +0 -1
- package/web/assets/index-CAWCOpxG.js +0 -40
- package/web/assets/index-DT-gaDrM.css +0 -2
- package/web/assets/tool-labels-BJhLig5u.js +0 -1
- package/web/assets/use-i18n-yjKc6F2w.js +0 -1
- package/web/assets/web-preview-panel-BOmJGqhe.js +0 -556
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./vendor-react-CHuvPdJE.js";import{d as r,l as i,s as a}from"./vendor-router-Bw2aAdMs.js";import{t as o}from"./api-B6CluO7V.js";import{n as s,t as c}from"./button-XhIEgIsg.js";import{t as l}from"./use-i18n-yjKc6F2w.js";import{t as u}from"./AppSelect-CRjRgr38.js";import{i as d,n as f,r as p,t as m}from"./progress-BqaId9J2.js";import{t as h}from"./utils-C8uzG5AZ.js";import{t as g}from"./check-jIXqkGKr.js";import{t as _}from"./chevron-down-DT6AXwTP.js";import{t as v}from"./code-xml-Z4K2ea1N.js";import{t as y}from"./copy-DS-8Hh_R.js";import{t as b}from"./file-code-corner-BKkXAMHR.js";import{t as x}from"./file-C8GNXmhJ.js";import{t as S}from"./image-Dh7-wI1d.js";import{t as C}from"./message-circle-Bc_EzZop.js";import{n as w,t as T}from"./zap-CFsp4Y1u.js";import{t as E}from"./pencil-CxA1IK0x.js";import{t as D}from"./play-N6mg4pFl.js";import{t as O}from"./send-DcLH_sg0.js";import{t as k}from"./square-BZ3Bi3O-.js";import{t as A}from"./trash-2-mhzzyC6i.js";import{t as j}from"./input-D1QFzNMx.js";import{At as M,B as N,E as ee,Nt as P,Pt as F,T as te,_t as I,a as ne,bt as L,d as re,f as R,ft as ie,g as z,h as B,ht as V,jt as ae,kt as oe,m as H,n as se,p as ce,pt as U,r as le,u as ue,vt as de,w as fe,xt as pe,yt as me}from"./index-CAWCOpxG.js";import{t as W}from"./field-BAyGDYW_.js";import{t as he}from"./usePagePrimaryAction-Bw0OFTDZ.js";import{n as G,t as K}from"./alert-B7D8joCd.js";import{a as ge,c as _e,d as ve,f as q,i as J,l as ye,n as be,o as xe,r as Se,s as Ce,t as we,u as Te}from"./vendor-xyflow-CnjXtcyK.js";var Ee=s(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),De=s(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Y=e(t(),1),X=n(),Oe=({className:e,...t})=>(0,X.jsx)(Se,{className:h(`gap-px overflow-hidden rounded-md border bg-card p-1 shadow-none!`,`[&>button]:rounded-md [&>button]:border-none! [&>button]:bg-transparent! [&>button]:hover:bg-secondary!`,e),...t}),ke=[`trigger`,`prompt`,`skill`,`file`,`mcp`,`notification`,`condition`,`parallel`,`approval`];function Ae({data:e,selected:t}){return(0,X.jsxs)(`div`,{className:h(`flow-node [.workflow-mini-map_&.compact]:w-[100px] [.workflow-mini-map_&.compact]:min-h-[42px] [.workflow-mini-map_&.compact]:p-[5px_8px] [.workflow-mini-map_&.compact]:cursor-default [.workflow-mini-map_&.compact_small]:text-[11px] [.workflow-mini-map_&.compact_strong]:max-w-[100%] [.workflow-mini-map_&.compact_strong]:overflow-hidden [.workflow-mini-map_&.compact_strong]:text-[12px] [.workflow-mini-map_&.compact_strong]:text-ellipsis [.workflow-mini-map_&.compact_strong]:whitespace-nowrap [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_strong]:text-[13px] [&.active]:border-[var(--star)] [&.active]:[animation:star-node-pulse_2.4s_var(--ease-out)_infinite] [&.type-condition]:border-[var(--warning-border)] [&.type-condition]:bg-[var(--warning-subtle)] [&.type-parallel]:border-[var(--violet-border)] [&.type-parallel]:bg-[var(--violet-soft)] [&.type-approval]:border-[var(--approval-border)] [&.type-approval]:bg-[var(--success-subtle)] [&.type-notification]:border-[var(--notification-border)] [&.type-notification]:bg-[var(--notification-soft)] dark:[&.type-condition]:bg-[var(--warning-soft)] dark:[&.type-并行]:bg-[var(--violet-soft)] dark:[&.type-审批]:bg-[var(--success-subtle)] dark:[&.type-通知]:bg-[var(--notification-soft)] relative flex w-[120px] min-h-[49px] flex-col items-start justify-center gap-[3px] [border:1px_solid_var(--accent-border)] rounded-[var(--r-sm)] bg-[var(--accent-soft)] [padding:7px_10px] text-left shadow-[0_8px_18px_-14px_var(--node-shadow)] cursor-grab`,`type-${e.kind}`,t&&`active`,e.compact&&`compact`),children:[!e.compact&&e.kind!==`trigger`&&(0,X.jsx)(J,{id:`input`,className:`flow-port after:absolute after:[content:''] after:inset-[-8px] absolute z-[3] w-[12px] h-[12px] [border:2px_solid_var(--solid)] rounded-[50%] bg-[var(--text)] [cursor:crosshair] input [.flow-port&]:top-[50%] [.flow-port&]:left-[-7px] [.flow-port&]:[transform:translateY(-50%)]`,type:`target`,position:q.Left,title:e.inputLabel,"aria-label":e.inputLabel}),!e.compact&&e.kind===`condition`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(J,{id:`true`,className:`flow-port after:absolute after:[content:''] after:inset-[-8px] absolute z-[3] w-[12px] h-[12px] [border:2px_solid_var(--solid)] rounded-[50%] bg-[var(--text)] [cursor:crosshair] output [.flow-port&]:top-[50%] [.flow-port&]:right-[-7px] [.flow-port&]:[transform:translateY(-50%)] condition-true`,type:`source`,position:q.Right,title:`true`,"aria-label":`true`}),(0,X.jsx)(J,{id:`false`,className:`flow-port after:absolute after:[content:''] after:inset-[-8px] absolute z-[3] w-[12px] h-[12px] [border:2px_solid_var(--solid)] rounded-[50%] bg-[var(--text)] [cursor:crosshair] output [.flow-port&]:top-[50%] [.flow-port&]:right-[-7px] [.flow-port&]:[transform:translateY(-50%)] condition-false`,type:`source`,position:q.Bottom,title:`false`,"aria-label":`false`})]}):!e.compact&&(0,X.jsx)(J,{id:`output`,className:`flow-port after:absolute after:[content:''] after:inset-[-8px] absolute z-[3] w-[12px] h-[12px] [border:2px_solid_var(--solid)] rounded-[50%] bg-[var(--text)] [cursor:crosshair] output [.flow-port&]:top-[50%] [.flow-port&]:right-[-7px] [.flow-port&]:[transform:translateY(-50%)]`,type:`source`,position:q.Right,title:e.outputLabel,"aria-label":e.outputLabel}),(0,X.jsx)(`small`,{children:e.typeLabel}),(0,X.jsx)(`strong`,{children:e.label})]})}var je={workflow:Ae};function Me(e){return typeof e==`string`&&ke.includes(e)}function Ne(e){return e.data.kind===`condition`?`var(--warning-strong)`:e.data.kind===`parallel`?`var(--workflow-violet)`:e.data.kind===`approval`?`var(--success)`:e.data.kind===`notification`?`var(--notification-border)`:`var(--star-strong)`}function Pe({nodes:e,edges:t,selectedNodeId:n,selectedEdgeId:r,hint:i,inputLabel:a,outputLabel:o,nodeTypeLabel:s,onAddNode:c,onConnect:l,onMoveNode:u,onSelectNode:d,onSelectEdge:f,onClearSelection:p,onDeleteNodes:m,onDeleteEdges:h}){let{screenToFlowPosition:g}=ye(),_=(0,Y.useMemo)(()=>e.map(e=>({id:e.id,type:`workflow`,position:{x:e.x,y:e.y},selected:e.id===n,data:{kind:e.kind,label:e.label,typeLabel:s(e.kind),inputLabel:a,outputLabel:o}})),[a,s,e,o,n]),v=(0,Y.useRef)(new Set),y=(0,Y.useRef)(new Map),b=(0,Y.useRef)(null),[x,S,C]=_e(_);(0,Y.useEffect)(()=>{S(e=>{let t=new Map(e.map(e=>[e.id,e])),n=e.length!==_.length,r=_.map(e=>{let r=t.get(e.id);if(!r)return n=!0,e;let i=v.current.has(e.id)?r.position:e.position,a=r.data.kind===e.data.kind&&r.data.label===e.data.label&&r.data.typeLabel===e.data.typeLabel&&r.data.inputLabel===e.data.inputLabel&&r.data.outputLabel===e.data.outputLabel&&r.data.compact===e.data.compact;return i.x===r.position.x&&i.y===r.position.y&&r.selected===e.selected&&a?r:(n=!0,{...r,position:i,selected:e.selected,data:e.data})});return n?r:e})},[_,S]);let w=(0,Y.useCallback)(()=>{b.current=null,y.current.forEach((e,t)=>u(t,e)),y.current.clear()},[u]),T=(0,Y.useCallback)((e,t)=>{y.current.set(e,t),b.current??=requestAnimationFrame(w)},[w]);(0,Y.useEffect)(()=>()=>{b.current!==null&&cancelAnimationFrame(b.current)},[]);let E=(0,Y.useMemo)(()=>t.map(e=>({id:e.id,source:e.source,sourceHandle:e.sourcePort,target:e.target,targetHandle:e.targetPort,selected:e.id===r,markerEnd:{type:ve.ArrowClosed,width:16,height:16,color:`var(--canvas-edge)`},style:{stroke:`var(--canvas-edge)`,strokeWidth:2}})),[t,r]),D=(0,Y.useCallback)(e=>{!e.source||!e.target||l(e.source,e.target,e.sourceHandle||`output`)},[l]),O=(0,Y.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},[]),k=(0,Y.useCallback)(e=>{e.preventDefault();let t={};try{t=JSON.parse(e.dataTransfer.getData(`text/plain`)||`{}`)}catch{return}if(!Me(t.kind))return;let n=g({x:e.clientX,y:e.clientY});c(t.kind,typeof t.label==`string`?t.label:s(t.kind),n)},[s,c,g]);return(0,X.jsxs)(`div`,{className:`workflow-react-flow absolute inset-0`,children:[(0,X.jsxs)(Ce,{nodes:x,edges:E,nodeTypes:je,onNodesChange:C,connectionMode:Te.Strict,deleteKeyCode:[`Backspace`,`Delete`],fitView:!0,fitViewOptions:{padding:.18,minZoom:.55,maxZoom:1},minZoom:.35,maxZoom:1.8,snapToGrid:!0,snapGrid:[20,20],panOnDrag:!0,zoomOnDoubleClick:!1,onConnect:D,onNodeClick:(e,t)=>d(t.id),onEdgeClick:(e,t)=>f(t.id),onPaneClick:p,onNodeDragStart:(e,t)=>v.current.add(t.id),onNodeDrag:(e,t)=>T(t.id,t.position),onNodeDragStop:(e,t)=>{v.current.delete(t.id),y.current.delete(t.id),u(t.id,t.position)},onNodesDelete:e=>m(e.map(e=>e.id)),onEdgesDelete:e=>h(e.map(e=>e.id)),onDragOver:O,onDrop:k,children:[(0,X.jsx)(we,{variant:be.Dots,gap:20,size:1.2,color:`var(--canvas-grid)`}),(0,X.jsx)(ge,{className:`workflow-react-flow-minimap [border:1px_solid_var(--stroke)] rounded-[var(--r-sm)] !bg-[var(--surface-subtle)]`,nodeColor:Ne,nodeStrokeWidth:3,pannable:!0,zoomable:!0}),(0,X.jsx)(Oe,{position:`top-left`,showInteractive:!1})]}),(0,X.jsx)(`div`,{className:`absolute z-[5] [left:12px] [bottom:10px] text-[var(--text-muted)] text-[12px] pointer-events-none`,children:i})]})}function Fe(e){return(0,X.jsx)(xe,{children:(0,X.jsx)(Pe,{...e})})}function Ie(e){return new Map(e.map((e,t)=>[e.id,t]))}function Le(e=[],t){return e.slice(1).map((n,r)=>{let i=e[r];return{id:t?.(r,i.id,n.id)||`edge-${r}-${i.id}-${n.id}`,source:i.id,sourcePort:`output`,target:n.id,targetPort:`input`}})}function Re(e=[],t=[]){let n=e.filter(e=>e.enabled!==!1),r=new Set(n.map(e=>e.id)),i=t.filter(e=>r.has(e.source)&&r.has(e.target)),a=new Map(n.map(e=>[e.id,[]])),o=new Map(n.map(e=>[e.id,[]])),s=new Map(n.map(e=>[e.id,0])),c=Ie(n);for(let e of i)a.get(e.target)?.push(e),o.get(e.source)?.push(e),s.set(e.target,(s.get(e.target)||0)+1);let l=n.filter(e=>s.get(e.id)===0),u=[];for(;l.length;){l.sort((e,t)=>c.get(e.id)-c.get(t.id));let e=l.shift();u.push(e);for(let t of o.get(e.id)||[]){let e=(s.get(t.target)||0)-1;s.set(t.target,e),e===0&&l.push(n.find(e=>e.id===t.target))}}let d=n.filter(e=>(a.get(e.id)||[]).length===0),f=d.find(e=>e.kind===`trigger`)||d[0];return{nodes:n,edges:i,incoming:a,outgoing:o,order:u,roots:d,unconnected:n.filter(e=>e.id!==f?.id&&(a.get(e.id)||[]).length===0),invalidTriggerTargets:n.filter(e=>e.kind===`trigger`&&(a.get(e.id)||[]).length>0),hasCycle:u.length!==n.length}}function ze(e,t,n,r,i=`output`){return Re(e,[...t,{id:`__candidate__`,source:n,sourcePort:i,target:r,targetPort:`input`}]).hasCycle}var Be={trigger:`触发器`,prompt:`任务`,skill:`Skill`,file:`文件`,mcp:`MCP`,notification:`通知`,condition:`判断`,parallel:`并行`,approval:`审批`},Ve=[{kind:`trigger`,label:`手动触发`,Icon:T},{kind:`prompt`,label:`运行 Prompt`,Icon:P},{kind:`skill`,label:`调用 Skill`,Icon:d},{kind:`file`,label:`读写文件`,Icon:b},{kind:`mcp`,label:`调用 MCP`,Icon:I},{kind:`condition`,label:`条件分支`,Icon:f},{kind:`parallel`,label:`并行汇合`,Icon:w},{kind:`approval`,label:`人工审批`,Icon:M},{kind:`notification`,label:`发送通知`,Icon:F}];function He(e,t){return t(e===`trigger`?`workflows:workflowsPage.triggerNode`:e===`skill`?`workflows:workflowsPage.skillNode`:e===`file`?`workflows:workflowsPage.fileNode`:e===`mcp`?`workflows:workflowsPage.mcpNode`:e===`notification`?`workflows:workflowsPage.notificationNode`:e===`condition`?`workflows:workflowsPage.conditionNode`:e===`parallel`?`workflows:workflowsPage.parallelNode`:e===`approval`?`workflows:workflowsPage.approvalNode`:`workflows:workflowsPage.task`)}function Ue(e,t){return t(e===`trigger`?`workflows:workflowsPage.manualTrigger`:e===`skill`?`workflows:workflowsPage.callSkill`:e===`file`?`workflows:workflowsPage.readWriteFiles`:e===`mcp`?`workflows:workflowsPage.callMcp`:e===`condition`?`workflows:workflowsPage.conditionBranch`:e===`parallel`?`workflows:workflowsPage.parallelJoin`:e===`approval`?`workflows:workflowsPage.humanApproval`:e===`notification`?`workflows:workflowsPage.sendNotification`:`workflows:workflowsPage.runPrompt`)}function We(e,t){return t(e===`pr-fix`?`workflows:workflowsPage.prFix`:e===`research`?`workflows:workflowsPage.research`:e===`report`?`workflows:workflowsPage.dailyWeeklyReport`:e===`asset`?`workflows:workflowsPage.assetGeneration`:e===`release`?`workflows:workflowsPage.releasePreparation`:`workflows:workflowsPage.codeReview`)}function Ge(e,t){return t(e===`pr-fix`?`workflows:workflowsPage.prFixDescription`:e===`research`?`workflows:workflowsPage.researchDescription`:e===`report`?`workflows:workflowsPage.reportDescription`:e===`asset`?`workflows:workflowsPage.assetDescription`:e===`release`?`workflows:workflowsPage.releaseDescription`:`workflows:workflowsPage.codeReviewDescription`)}function Z(e,t,n,r,i,a,o={}){return{id:e,kind:t,label:n,prompt:r,x:i,y:a,model:null,executionMode:`full-access`,retries:0,timeoutMinutes:20,failurePolicy:`stop`,enabled:!0,outputFormat:`text`,skillName:``,requestedToolNames:[],condition:{source:`previous`,operator:`exists`,value:``},approval:{message:``,timeoutMinutes:60},notification:{title:``,content:``},notificationTargets:[],...o}}function Ke(e){return Le(e,()=>crypto.randomUUID())}var qe=[{id:`code-review`,name:`代码审查`,description:`读取 diff → 运行测试 → 生成 review`,Icon:v,nodes:[Z(`review-trigger`,`trigger`,`手动触发`,``,65,45),Z(`review-diff`,`file`,`读取 diff`,`读取当前工作区的 git diff,识别改动范围与高风险文件。`,235,45),Z(`review-test`,`prompt`,`运行检查`,`运行适合当前项目的测试与 lint,记录失败原因。`,405,45),Z(`review-report`,`prompt`,`生成 review`,`结合 diff 和验证结果,输出按严重度排序的代码审查结论。`,235,180),Z(`review-notify`,`notification`,`发送结果`,``,405,180)]},{id:`pr-fix`,name:`PR 修复`,description:`定位失败 → 修改代码 → 回归测试`,Icon:f,nodes:[Z(`fix-trigger`,`trigger`,`手动触发`,``,65,45),Z(`fix-find`,`prompt`,`定位失败`,`检查项目状态与失败信息,定位最可能的根因。`,235,45),Z(`fix-code`,`prompt`,`修改代码`,`修复已定位的问题,保留用户已有改动,不执行破坏性命令。`,405,45),Z(`fix-test`,`prompt`,`回归测试`,`运行针对性测试和构建,确认修复没有引入回归。`,235,180),Z(`fix-notify`,`notification`,`通知结果`,``,405,180)]},{id:`research`,name:`资料调研`,description:`搜索资料 → 提取引用 → 点亮星忆`,Icon:de,nodes:[Z(`research-trigger`,`trigger`,`手动输入`,``,65,45),Z(`research-search`,`prompt`,`搜索资料`,`围绕工作流描述中的主题检索项目内资料与可用信息源。`,235,45),Z(`research-summary`,`prompt`,`整理引用`,`整理关键结论、证据、限制和下一步建议。`,405,45),Z(`research-memory`,`prompt`,`保存星忆`,`把适合长期保留的结论写入 Agent 记忆。`,320,180)]},{id:`report`,name:`日报周报`,description:`汇总会话 → 生成摘要 → 渠道通知`,Icon:x,nodes:[Z(`report-trigger`,`trigger`,`手动触发`,``,65,45),Z(`report-collect`,`prompt`,`汇总进展`,`汇总当前项目近期完成事项、风险与待办。`,235,45),Z(`report-write`,`prompt`,`生成报告`,`将汇总内容整理为清晰的日报或周报。`,405,45),Z(`report-notify`,`notification`,`渠道通知`,``,320,180)]},{id:`asset`,name:`资产生成`,description:`生成图片 → 存入资产库 → 通知验收`,Icon:S,nodes:[Z(`asset-trigger`,`trigger`,`手动输入`,``,65,45),Z(`asset-generate`,`prompt`,`生成视觉资产`,`根据工作流描述生成需要的视觉资产,并保存生成文件。`,235,45),Z(`asset-check`,`prompt`,`检查产物`,`检查生成资产是否完整、可访问并符合需求。`,405,45),Z(`asset-notify`,`notification`,`通知验收`,``,320,180)]},{id:`release`,name:`发布准备`,description:`版本检查 → changelog → 创建发布单`,Icon:me,nodes:[Z(`release-trigger`,`trigger`,`手动触发`,``,65,45),Z(`release-check`,`prompt`,`版本检查`,`检查工作区、测试、构建和版本信息是否满足发布要求。`,235,45),Z(`release-log`,`prompt`,`生成 changelog`,`根据近期提交和改动生成 changelog 与发布说明。`,405,45),Z(`release-report`,`prompt`,`发布清单`,`生成最终发布检查清单并标记阻塞项。`,320,180)]}];function Je(e=``){let t=[Z(crypto.randomUUID(),`trigger`,`手动触发`,``,65,45),Z(crypto.randomUUID(),`prompt`,`运行 Prompt`,``,235,45)];return{id:``,name:`未命名工作流`,description:``,status:`draft`,revision:1,cwd:e,model:null,inputs:[],tags:[],visibility:`private`,notifications:[],nodes:t,edges:Ke(t)}}function Ye(e,t=``){let n=e.nodes.map(e=>({...e,id:crypto.randomUUID()}));return{...Je(t),name:e.name,description:e.description,nodes:n,edges:Ke(n)}}function Xe({draft:e,selectedNodeId:t,selectedEdgeId:n,t:r,onAddNode:i,onConnect:a,onMoveNode:o,onSelectNode:s,onSelectEdge:c,onClearSelection:l,onDeleteNodes:u,onDeleteEdges:d}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] node-library [&_[data-slot='card-content']_>_div_>_small]:block [&_[data-slot='card-content']_>_div_>_small]:h-[15px] [&_[data-slot='card-content']_>_div_>_small]:text-[var(--text-muted)] [&_[data-slot='card-content']_>_div_>_small]:text-[13px] [&_[data-slot='card-content']_>_div_>_small]:font-[600] [&_[data-slot='card-content']_>_div_>_button]:grid [&_[data-slot='card-content']_>_div_>_button]:w-full [&_[data-slot='card-content']_>_div_>_button]:grid-cols-[auto_minmax(0,1fr)_auto] [&_[data-slot='card-content']_>_div_>_button]:items-center [&_[data-slot='card-content']_>_div_>_button]:gap-[7px] [&_[data-slot='card-content']_>_div_>_button]:border-0 [&_[data-slot='card-content']_>_div_>_button]:[border-top:1px_solid_var(--stroke-soft)] [&_[data-slot='card-content']_>_div_>_button]:bg-transparent [&_[data-slot='card-content']_>_div_>_button]:p-[8px_3px] [&_[data-slot='card-content']_>_div_>_button]:text-[var(--text)] [&_[data-slot='card-content']_>_div_>_button]:text-left [&_[data-slot='card-content']_>_div_>_button]:text-[12px] [&_[data-slot='card-content']_>_div_>_button]:cursor-grab [&_[data-slot='card-content']_>_div_>_button_span]:text-[var(--text-muted)] [&_[data-slot='card-content']_>_div_>_button_span]:text-[13px] max-[650px]:max-h-[220px] overflow-auto gap-0 py-0`,children:(0,X.jsxs)(B,{className:`p-3.5`,children:[(0,X.jsx)(z,{className:`workflow-section-title [.selection-list_&]:mb-[8px] [.node-library_&]:mb-[8px] text-[var(--text-soft)] text-[13px] font-[700] leading-[1.4]`,children:r(`workflows:workflowsPage.nodeLibrary`)}),Ve.map(({kind:e,label:t,Icon:n})=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`small`,{children:e===`trigger`?r(`workflows:workflowsPage.triggerGroup`):``}),(0,X.jsxs)(`button`,{draggable:!0,onDragStart:n=>n.dataTransfer.setData(`text/plain`,JSON.stringify({kind:e,label:t})),children:[(0,X.jsx)(n,{size:15}),Ue(e,r),(0,X.jsx)(`span`,{title:r(`workflows:workflowsPage.drag`),"aria-label":r(`workflows:workflowsPage.drag`),children:(0,X.jsx)(De,{size:13})})]})]},e))]})}),(0,X.jsx)(H,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] builder-canvas relative min-h-[620px] overflow-hidden p-0 !bg-[var(--canvas-bg)] dark:bg-[var(--canvas-bg)] max-[650px]:min-w-[620px] gap-0 py-0`,children:(0,X.jsx)(Fe,{nodes:e.nodes,edges:e.edges,selectedNodeId:t,selectedEdgeId:n,hint:r(`workflows:workflowsPage.dragFromANodeOutputToTheTargetInputToConnectThem`),inputLabel:r(`workflows:workflowsPage.inputPort`),outputLabel:r(`workflows:workflowsPage.outputPort`),nodeTypeLabel:e=>He(e,r),onAddNode:i,onConnect:a,onMoveNode:o,onSelectNode:s,onSelectEdge:c,onClearSelection:l,onDeleteNodes:u,onDeleteEdges:d})})]})}function Ze(e){let t=Math.max(0,Math.round((Number(e)||0)/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function Qe(e,t){return t(e===`running`?`workflows:workflowsPage.running`:e===`waiting_approval`?`workflows:workflowsPage.waitingApproval`:e===`completed`?`workflows:workflowsPage.completed`:e===`failed`?`workflows:workflowsPage.failed`:e===`cancelled`?`workflows:workflowsPage.stopped`:e===`interrupted`?`workflows:workflowsPage.interrupted`:`workflows:workflowsPage.draft`)}function $e({value:e,onChange:t,t:n}){return(0,X.jsx)(ue,{value:e,onValueChange:e=>t(e),children:(0,X.jsxs)(re,{className:`workflow-filter-list [&_[data-slot='tabs-trigger']]:min-w-[56px] [&_[data-slot='tabs-trigger']]:flex-none [&_[data-slot='tabs-trigger']]:[padding-inline:12px] [&_[data-slot='tabs-trigger']]:text-[12px] w-fit max-w-[100%] overflow-x-auto [scrollbar-width:none]`,children:[(0,X.jsx)(R,{value:`workflows`,children:n(`workflows:workflowsPage.workflows`)}),(0,X.jsx)(R,{value:`runs`,children:n(`workflows:workflowsPage.runHistory`)}),(0,X.jsx)(R,{value:`templates`,children:n(`workflows:workflowsPage.templates`)})]})})}function et({workflows:e,runs:t,busyId:n,language:r,t:i,onRun:a,onEdit:o,onDuplicate:s,onExport:l,onImport:u,onDelete:d}){let f=(0,Y.useRef)(null),p=e=>t.filter(t=>t.workflowId===e).sort((e,t)=>Date.parse(t.startedAt)-Date.parse(e.startedAt))[0];return(0,X.jsx)(H,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] workflow-assets-panel overflow-hidden gap-0 py-0`,children:(0,X.jsxs)(B,{className:`p-0`,children:[(0,X.jsxs)(`div`,{className:`workflow-table-head [&_>_div]:flex [&_>_div]:min-w-0 [&_>_div]:flex-col [&_>_div]:gap-[2px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] flex min-h-[58px] items-center justify-between gap-[12px] [border-bottom:1px_solid_var(--stroke-soft)] [padding:10px_14px]`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(z,{className:`workflow-section-title [.selection-list_&]:mb-[8px] [.node-library_&]:mb-[8px] text-[var(--text-soft)] text-[13px] font-[700] leading-[1.4]`,children:i(`workflows:workflowsPage.workflows`)}),(0,X.jsx)(`small`,{children:i(`workflows:workflowsPage.countWorkflows`,{count:e.length})})]}),(0,X.jsxs)(c,{size:`sm`,variant:`outline`,onClick:()=>f.current?.click(),children:[(0,X.jsx)(Ee,{"data-icon":`inline-start`}),i(`workflows:workflowsPage.import`)]}),(0,X.jsx)(`input`,{ref:f,className:`sr-only`,type:`file`,accept:`application/json,.json`,onChange:async e=>{let t=e.target.files?.[0];if(t)try{u(JSON.parse(await t.text()))}catch{u(null)}finally{e.currentTarget.value=``}}})]}),e.length?(0,X.jsx)(`div`,{className:`flex flex-col`,children:e.map(e=>{let t=p(e.id),u=[`running`,`waiting_approval`].includes(t?.status||``);return(0,X.jsxs)(`div`,{className:`workflow-asset-row first:[border-top:0] max-[650px]:grid-cols-[minmax(0,1fr)_92px] max-[650px]:gap-[8px_12px] max-[650px]:[padding-block:10px] grid min-h-[62px] grid-cols-[minmax(220px,1fr)_110px_150px_auto] items-center gap-[14px] [border-top:1px_solid_var(--stroke-soft)] [padding:8px_12px_8px_14px]`,children:[(0,X.jsxs)(`button`,{className:`workflow-asset-main [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:overflow-hidden [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] flex min-w-0 flex-col gap-[3px] border-0 bg-transparent text-[var(--text)] text-left cursor-pointer`,onClick:()=>o(e.id),children:[(0,X.jsx)(`strong`,{children:e.name}),(0,X.jsx)(`small`,{children:e.description||e.cwd})]}),(0,X.jsxs)(`span`,{className:`workflow-state [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:text-[10px] [&_small]:font-[400] [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&.running]:text-[var(--warning-strong)] [&.waiting_approval]:text-[var(--warning-strong)] [&.completed]:text-[var(--success)] [&.published]:text-[var(--success)] [&.failed]:text-[var(--danger)] max-[650px]:[.workflow-asset-row_>_&:nth-of-type(2)]:[grid-column:1] flex min-w-0 flex-col gap-[2px] text-[var(--text-secondary)] text-[11px] font-[600] ${e.status}`,children:[e.status===`published`?i(`workflows:workflowsPage.published`):i(`workflows:workflowsPage.draft`),(0,X.jsxs)(`small`,{children:[`v`,e.revision]})]}),(0,X.jsxs)(`span`,{className:`workflow-state [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:text-[10px] [&_small]:font-[400] [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&.running]:text-[var(--warning-strong)] [&.waiting_approval]:text-[var(--warning-strong)] [&.completed]:text-[var(--success)] [&.published]:text-[var(--success)] [&.failed]:text-[var(--danger)] max-[650px]:[.workflow-asset-row_>_&:nth-of-type(2)]:[grid-column:1] flex min-w-0 flex-col gap-[2px] text-[var(--text-secondary)] text-[11px] font-[600] ${t?.status||`idle`}`,children:[t?Qe(t.status,i):i(`workflows:workflowsPage.neverRun`),(0,X.jsx)(`small`,{children:t?N(t.startedAt,r):e.visibility})]}),(0,X.jsxs)(`div`,{className:`workflow-row-actions max-[650px]:[grid-column:2] max-[650px]:[grid-row:1/3] max-[650px]:flex-wrap flex items-center justify-end gap-[3px]`,children:[(0,X.jsx)(c,{size:`icon-xs`,variant:u?`secondary`:`outline`,disabled:u||n===e.id,title:i(`workflows:workflowsPage.run`),"aria-label":`${i(`workflows:workflowsPage.run`)}: ${e.name}`,onClick:()=>a(e),children:n===e.id?(0,X.jsx)(L,{className:`animate-spin`}):(0,X.jsx)(D,{fill:`currentColor`})}),(0,X.jsx)(c,{size:`icon-xs`,variant:`ghost`,title:i(`workflows:workflowsPage.edit`),"aria-label":`${i(`workflows:workflowsPage.edit`)}: ${e.name}`,onClick:()=>o(e.id),children:(0,X.jsx)(E,{})}),(0,X.jsx)(c,{size:`icon-xs`,variant:`ghost`,title:i(`workflows:workflowsPage.duplicateWorkflow`),"aria-label":`${i(`workflows:workflowsPage.duplicateWorkflow`)}: ${e.name}`,onClick:()=>s(e),children:(0,X.jsx)(y,{})}),(0,X.jsx)(c,{size:`icon-xs`,variant:`ghost`,title:i(`workflows:workflowsPage.export`),"aria-label":`${i(`workflows:workflowsPage.export`)}: ${e.name}`,onClick:()=>l(e),children:(0,X.jsx)(oe,{})}),(0,X.jsx)(c,{size:`icon-xs`,variant:`ghost`,disabled:u,title:i(`workflows:workflowsPage.delete`),"aria-label":`${i(`workflows:workflowsPage.delete`)}: ${e.name}`,onClick:()=>d(e),children:(0,X.jsx)(A,{})})]})]},e.id)})}):(0,X.jsx)(`div`,{className:`channel-route-empty [&_strong]:mt-[9px] [&_strong]:text-[var(--text)] [&_strong]:text-[12px] [&_span]:mt-[4px] [&_span]:text-[13px] [&.compact]:min-h-[110px] [.workflow-assets-panel_&]:min-h-[150px] [.workflow-assets-panel_&]:border-0 [.workflow-assets-panel_&]:bg-transparent grid min-h-[185px] place-content-center justify-items-center text-[var(--text-muted)] text-center compact`,children:(0,X.jsx)(`strong`,{children:i(`workflows:workflowsPage.noMatchingWorkflows`)})})]})})}function tt({runs:e,busyId:t,language:n,t:r,onStop:i,onRetry:a,onApproval:o}){let[s,l]=(0,Y.useState)(e[0]?.id||``),u=[...e].sort((e,t)=>Date.parse(t.startedAt)-Date.parse(e.startedAt));return(0,X.jsxs)(`div`,{className:`flex flex-col gap-[8px]`,children:[u.map(e=>{let u=s===e.id,d=Math.round((Number(e.completedNodes)||0)/Math.max(1,Number(e.totalNodes)||1)*100);return(0,X.jsx)(H,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] overflow-hidden gap-0 py-0`,children:(0,X.jsxs)(B,{className:`p-0`,children:[(0,X.jsxs)(`button`,{className:`workflow-run-summary hover:bg-[var(--surface-hover)] [&_>_span]:flex [&_>_span]:min-w-0 [&_>_span]:flex-col [&_>_span]:gap-[2px] [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:overflow-hidden [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] [&_small]:[font-style:normal] [&_em]:text-[var(--text-muted)] [&_em]:text-[11px] [&_em]:[font-style:normal] [&_[data-slot='progress']]:h-[5px] max-[650px]:grid-cols-[18px_minmax(0,1fr)_54px] max-[650px]:gap-[8px] max-[650px]:[&_[data-slot='progress']]:[grid-column:2/4] grid w-full min-h-[58px] grid-cols-[18px_minmax(180px,1fr)_minmax(120px,240px)_70px] items-center gap-[12px] border-0 bg-transparent [padding:9px_14px] text-[var(--text)] text-left cursor-pointer`,onClick:()=>l(u?``:e.id),children:[u?(0,X.jsx)(_,{size:15}):(0,X.jsx)(ae,{size:15}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:e.workflowName||e.workflowId}),(0,X.jsxs)(`small`,{children:[Qe(e.status,r),` · `,N(e.startedAt,n),` · v`,e.workflowRevision||1]})]}),(0,X.jsx)(m,{value:e.status===`completed`?100:d}),(0,X.jsx)(`em`,{children:Ze(e.durationMs)})]}),u&&(0,X.jsxs)(`div`,{className:`workflow-run-detail max-[650px]:pl-[14px] flex flex-col gap-[10px] [border-top:1px_solid_var(--stroke-soft)] [padding:12px_14px_14px_44px]`,children:[(e.summary||e.error)&&(0,X.jsx)(`div`,{className:`workflow-run-result [&.failed]:border-[var(--danger)] [&.failed]:text-[var(--danger)] [border-left:2px_solid_var(--success)] [padding:4px_8px] text-[var(--text-secondary)] text-[12px] whitespace-pre-wrap ${e.error?`failed`:``}`,children:e.error||e.summary}),(0,X.jsx)(`div`,{className:`flex flex-col`,children:(e.nodes||[]).map(n=>(0,X.jsxs)(`div`,{className:`workflow-run-node first:[border-top:0] [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:min-w-0 [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[2px] [&_strong]:text-[12px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] [&_p]:text-[var(--text-muted)] [&_p]:text-[11px] [&_p]:mt-[3px] [&_p]:whitespace-pre-wrap max-[650px]:grid-cols-[18px_minmax(0,1fr)] max-[650px]:[&_>_div]:[grid-column:2] grid min-h-[46px] grid-cols-[20px_minmax(0,1fr)_auto] items-center gap-[8px] [border-top:1px_solid_var(--stroke-soft)] [padding:6px_0] ${n.status}`,children:[(0,X.jsx)(`span`,{className:`workflow-node-status [.workflow-run-node.completed_&]:text-[var(--success)] [.workflow-run-node.failed_&]:text-[var(--danger)] grid place-items-center text-[var(--text-muted)]`,children:n.status===`completed`?(0,X.jsx)(g,{size:14}):n.status===`failed`?(0,X.jsx)(p,{size:14}):n.status===`running`||n.status===`waiting_approval`?(0,X.jsx)(L,{className:n.status===`running`?`animate-spin`:``,size:14}):(0,X.jsx)(k,{size:12})}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:n.label}),(0,X.jsxs)(`small`,{children:[Qe(n.status,r),` · `,Ze(n.durationMs),` ·`,` `,r(`workflows:workflowsPage.countAttempts`,{count:n.attempts||0})]}),(n.error||n.summary)&&(0,X.jsx)(`p`,{children:n.error||n.summary})]}),n.status===`waiting_approval`&&(0,X.jsxs)(`div`,{className:`workflow-approval-actions flex gap-[6px]`,children:[(0,X.jsxs)(c,{size:`xs`,disabled:t===n.id,onClick:()=>o(e,n.id,!0),children:[(0,X.jsx)(g,{"data-icon":`inline-start`}),r(`workflows:workflowsPage.approve`)]}),(0,X.jsxs)(c,{size:`xs`,variant:`destructive`,disabled:t===n.id,onClick:()=>o(e,n.id,!1),children:[(0,X.jsx)(p,{"data-icon":`inline-start`}),r(`workflows:workflowsPage.reject`)]})]})]},n.id))}),(0,X.jsx)(`div`,{className:`workflow-run-detail-actions flex gap-[6px]`,children:[`running`,`waiting_approval`].includes(e.status)?(0,X.jsxs)(c,{size:`sm`,variant:`destructive`,onClick:()=>i(e),children:[(0,X.jsx)(k,{"data-icon":`inline-start`}),r(`workflows:workflowsPage.stop`)]}):[`failed`,`cancelled`,`interrupted`].includes(e.status)?(0,X.jsxs)(c,{size:`sm`,variant:`outline`,onClick:()=>a(e),children:[(0,X.jsx)(L,{"data-icon":`inline-start`}),r(`workflows:workflowsPage.retryRun`)]}):null})]})]})},e.id)}),!u.length&&(0,X.jsx)(le,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)]`,children:(0,X.jsx)(`strong`,{children:r(`workflows:workflowsPage.noRunHistory`)})})]})}function nt({t:e,onOpenTemplate:t}){return(0,X.jsx)(`div`,{className:`workflow-template-gallery [&_>_button]:grid [&_>_button]:min-h-[72px] [&_>_button]:grid-cols-[34px_minmax(0,1fr)_18px] [&_>_button]:items-center [&_>_button]:gap-[10px] [&_>_button]:[border:1px_solid_var(--stroke)] [&_>_button]:rounded-[var(--r-sm)] [&_>_button]:bg-[var(--panel)] [&_>_button]:p-[11px] [&_>_button]:text-[var(--text)] [&_>_button]:text-left [&_>_button]:cursor-pointer [&_>_button:hover]:border-[var(--accent-border)] [&_>_button:hover]:bg-[var(--surface-hover)] [&_button_>_span:nth-child(2)]:flex [&_button_>_span:nth-child(2)]:min-w-0 [&_button_>_span:nth-child(2)]:flex-col [&_button_>_span:nth-child(2)]:gap-[3px] [&_strong]:text-[13px] [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] [&_small]:text-ellipsis [&_small]:whitespace-nowrap max-[650px]:grid-cols-[1fr] grid grid-cols-[repeat(2,minmax(0,1fr))] gap-[8px]`,children:qe.map(n=>{let r=n.Icon;return(0,X.jsxs)(`button`,{onClick:()=>t(n.id),children:[(0,X.jsx)(`span`,{className:`list-icon [.chat-resource-list_&]:grid [.chat-resource-list_&]:w-[28px] [.chat-resource-list_&]:h-[28px] [.chat-resource-list_&]:place-items-center [.chat-resource-list_&]:rounded-[var(--r-sm)] [.chat-resource-list_&]:bg-[var(--surface-subtle)] [.chat-resource-list_&]:text-[var(--star-strong)] [.session-workflow-summary_&]:grid [.session-workflow-summary_&]:w-[28px] [.session-workflow-summary_&]:h-[28px] [.session-workflow-summary_&]:place-items-center [.session-workflow-summary_&]:rounded-[var(--r-sm)] [.session-workflow-summary_&]:bg-[var(--surface-subtle)] [.session-workflow-summary_&]:text-[var(--star-strong)] grid w-[27px] h-[27px] place-items-center rounded-[var(--r-sm)] bg-[var(--accent-soft)] text-[var(--star-strong)] [.workflow-template-gallery_&]:grid [.workflow-template-gallery_&]:w-[32px] [.workflow-template-gallery_&]:h-[32px] [.workflow-template-gallery_&]:place-items-center [.workflow-template-gallery_&]:rounded-[var(--r-sm)] [.workflow-template-gallery_&]:bg-[var(--surface-subtle)] [.workflow-template-gallery_&]:text-[var(--star-strong)]`,children:(0,X.jsx)(r,{size:16})}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:We(n.id,e)}),(0,X.jsx)(`small`,{children:Ge(n.id,e)})]}),(0,X.jsx)(ae,{size:15})]},n.id)})})}function rt({data:e,t}){let n=e.runs.filter(e=>e.status===`failed`).length,r=e.runs.filter(e=>e.status===`waiting_approval`).length,i=e.runs.filter(e=>e.status===`completed`),a=i.length?i.reduce((e,t)=>e+(t.durationMs||0),0)/i.length:0;return(0,X.jsxs)(`div`,{className:`workflow-operations-strip [&_>_span]:inline-flex [&_>_span]:[align-items:baseline] [&_>_span]:gap-[5px] [&_>_span]:text-[var(--text-muted)] [&_>_span]:text-[11px] [&_>_span]:whitespace-nowrap [&_strong]:text-[var(--text)] [&_strong]:text-[13px] [&_strong]:[font-variant-numeric:tabular-nums] max-[650px]:justify-between max-[650px]:gap-[6px] max-[650px]:overflow-x-auto max-[650px]:[&_>_span]:flex-col max-[650px]:[&_>_span]:gap-[0] flex min-w-0 items-center gap-[18px]`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:e.limits.running}),t(`workflows:workflowsPage.running`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:r}),t(`workflows:workflowsPage.waitingApproval`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:n}),t(`workflows:workflowsPage.failed`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:Ze(a)}),t(`workflows:workflowsPage.averageDuration`)]})]})}function Q({className:e,...t}){return(0,X.jsx)(`textarea`,{"data-slot":`textarea`,className:h(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function it(e){let t=Math.max(0,Math.round((Number(e)||0)/1e3));return t<60?`${t} 秒`:`${Math.floor(t/60)} 分 ${t%60} 秒`}function at({run:e,t}){return(0,X.jsxs)(ne,{role:`status`,children:[(0,X.jsx)(L,{className:`animate-spin`,size:16}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:t(`workflows:workflowsPage.workflowRunning`)}),(0,X.jsx)(`small`,{children:t(`workflows:workflowsPage.runningNodeCompletedTotalCompleted`,{node:e.currentNodeLabel||t(`workflows:workflowsPage.preparing`),completed:e.completedNodes,total:e.totalNodes})})]})]})}function ot({run:e,language:t,t:n}){return(0,X.jsx)(H,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] gap-0 py-0`,children:(0,X.jsxs)(B,{className:`p-3.5`,children:[(0,X.jsx)(z,{className:`workflow-section-title [.selection-list_&]:mb-[8px] [.node-library_&]:mb-[8px] text-[var(--text-soft)] text-[13px] font-[700] leading-[1.4]`,children:n(`workflows:workflowsPage.latestRun`)}),e?(0,X.jsxs)(`div`,{className:`activity-row [&_span]:flex [&_span]:min-w-0 [&_span]:flex-col [&_span]:gap-[3px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_span]:text-[var(--text)] [&.failed]:text-[var(--danger)] [&.running]:text-[var(--star-strong)] grid grid-cols-[auto_minmax(0,1fr)] items-center gap-[9px] [border-top:1px_solid_var(--stroke-soft)] [padding:9px_2px] text-[var(--success)] ${e.status}`,children:[e.status===`running`?(0,X.jsx)(L,{className:`animate-spin`,size:15}):e.status===`completed`?(0,X.jsx)(M,{size:15}):(0,X.jsx)(V,{size:15}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:e.status===`completed`?e.summary||n(`workflows:workflowsPage.workflowCompleted`):e.status===`running`?e.currentNodeLabel||n(`workflows:workflowsPage.running`):e.error||n(`workflows:workflowsPage.workflowFailed`)}),(0,X.jsxs)(`small`,{children:[N(e.startedAt,t),` · `,it(e.durationMs)]})]})]}):(0,X.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-muted)] text-[12px] leading-[1.55]`,children:n(`workflows:workflowsPage.noRunHistory`)})]})})}var st={browser:{Icon:F},feishu:{Icon:P},weixin:{Icon:C},qq:{Icon:C},telegram:{Icon:O}},ct=[`workspace-write`,`full-access`];function lt(e,t){return t(e===`workspace-write`?`workflows:workflowsPage.workspaceWrite`:`workflows:workflowsPage.fullAccess`)}function ut(e,t){return t(e===`workspace-write`?`workflows:workflowsPage.workspaceWriteHelp`:`workflows:workflowsPage.fullAccessHelp`)}function dt(e,t){return t(e===`feishu`?`workflows:workflowsPage.feishu`:e===`weixin`?`workflows:workflowsPage.weChat`:e===`qq`?`workflows:workflowsPage.qq`:e===`telegram`?`workflows:workflowsPage.telegram`:`workflows:workflowsPage.browserNotification`)}function ft({draft:e,catalog:t,t:n,onUpdateDraft:r}){return(0,X.jsx)(H,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] gap-0 py-0`,children:(0,X.jsxs)(B,{className:`p-3.5`,children:[(0,X.jsx)(z,{className:`workflow-section-title [.selection-list_&]:mb-[8px] [.node-library_&]:mb-[8px] text-[var(--text-soft)] text-[13px] font-[700] leading-[1.4]`,children:n(`workflows:workflowsPage.workflowSettings`)}),(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.name`),(0,X.jsx)(j,{value:e.name,onChange:e=>r({name:e.target.value})})]}),(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.description`),(0,X.jsx)(Q,{value:e.description,onChange:e=>r({description:e.target.value})})]}),(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.workingDirectory`),(0,X.jsx)(j,{value:e.cwd,onChange:e=>r({cwd:e.target.value})})]}),(0,X.jsxs)(`div`,{className:`form-grid grid gap-[9px] three [.form-grid&]:grid-cols-[repeat(3,minmax(0,1fr))] max-[650px]:[.form-grid&]:grid-cols-[1fr]`,children:[(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.visibility`),(0,X.jsxs)(u,{value:e.visibility,onChange:e=>r({visibility:e.target.value===`shared`?`shared`:`private`}),children:[(0,X.jsx)(`option`,{value:`private`,children:n(`workflows:workflowsPage.private`)}),(0,X.jsx)(`option`,{value:`shared`,children:n(`workflows:workflowsPage.shared`)})]})]}),(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.tags`),(0,X.jsx)(j,{value:e.tags.join(`, `),onChange:e=>r({tags:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)})})]}),(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.revision`),(0,X.jsx)(j,{value:`v${e.revision}`,disabled:!0})]})]}),(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.defaultModel`),(0,X.jsxs)(u,{value:e.model?`${e.model.provider}/${e.model.model}`:``,onChange:e=>{let n=t.models.find(t=>`${t.provider}/${t.model}`===e.target.value);r({model:n?{provider:n.provider,model:n.model}:null})},children:[(0,X.jsx)(`option`,{value:``,children:n(`workflows:workflowsPage.useSystemDefault`)}),t.models.map(e=>(0,X.jsx)(`option`,{value:`${e.provider}/${e.model}`,children:e.label},`${e.provider}/${e.model}`))]})]}),(0,X.jsxs)(`div`,{className:`workflow-inputs-editor`,children:[(0,X.jsxs)(se,{children:[(0,X.jsx)(`strong`,{children:n(`workflows:workflowsPage.inputParameters`)}),(0,X.jsx)(c,{size:`icon-xs`,variant:`ghost`,title:n(`workflows:workflowsPage.addInput`),onClick:()=>r({inputs:[...e.inputs,{id:crypto.randomUUID(),name:`input_${e.inputs.length+1}`,label:n(`workflows:workflowsPage.newInput`),type:`string`,required:!1,defaultValue:``,description:``}]}),children:(0,X.jsx)(pe,{})})]}),e.inputs.map(t=>(0,X.jsxs)(`div`,{className:`workflow-input-row`,children:[(0,X.jsx)(j,{value:t.name,"aria-label":n(`workflows:workflowsPage.parameterName`),onChange:n=>r({inputs:e.inputs.map(e=>e.id===t.id?{...e,name:n.target.value}:e)})}),(0,X.jsxs)(u,{value:t.type,"aria-label":n(`workflows:workflowsPage.parameterType`),onChange:n=>r({inputs:e.inputs.map(e=>e.id===t.id?{...e,type:n.target.value}:e)}),children:[(0,X.jsx)(`option`,{value:`string`,children:`String`}),(0,X.jsx)(`option`,{value:`text`,children:`Text`}),(0,X.jsx)(`option`,{value:`number`,children:`Number`}),(0,X.jsx)(`option`,{value:`boolean`,children:`Boolean`})]}),(0,X.jsxs)(`label`,{className:`workflow-required-input`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:t.required,onChange:n=>r({inputs:e.inputs.map(e=>e.id===t.id?{...e,required:n.target.checked}:e)})}),n(`workflows:workflowsPage.required`)]}),(0,X.jsx)(c,{size:`icon-xs`,variant:`ghost`,title:n(`workflows:workflowsPage.delete`),onClick:()=>r({inputs:e.inputs.filter(e=>e.id!==t.id)}),children:(0,X.jsx)(A,{})})]},t.id))]})]})})}function pt({node:e,catalog:t,t:n,systemNotificationPermission:r,onUpdateNode:i,onToggleNotification:a,onOpenChannels:o,onOpenSystemNotificationSettings:s}){let l=[`feishu`,`weixin`,`qq`,`telegram`].some(e=>t.notificationTargets[e]?.enabled),u=r==="default"||r===`granted`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.notificationTitle`),(0,X.jsx)(j,{value:e.notification.title,onChange:t=>i({notification:{...e.notification,title:t.target.value}}),placeholder:`{{workflow.name}}`})]}),(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.notificationContent`),(0,X.jsx)(Q,{value:e.notification.content,onChange:t=>i({notification:{...e.notification,content:t.target.value}}),placeholder:`{{inputs.name}} · {{previous.summary}}`})]}),(0,X.jsx)(`strong`,{className:`block [margin-top:12px] text-[var(--text-secondary)] text-[12px]`,children:n(`workflows:workflowsPage.notificationChannels`)}),!l&&(0,X.jsxs)(K,{className:`workflow-notification-alert [&_[data-slot='alert-description']]:flex [&_[data-slot='alert-description']]:items-center [&_[data-slot='alert-description']]:gap-[4px] [&_[data-slot='alert-description']]:text-[11px] [&_[data-slot='alert-description']]:leading-[1.4] [margin:10px_0_6px] [border-color:color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_7%,var(--card))] text-[var(--text-secondary)]`,children:[(0,X.jsx)(V,{}),(0,X.jsxs)(G,{children:[n(`workflows:workflowsPage.noExternalNotificationChannelsEnabled`),(0,X.jsx)(c,{type:`button`,variant:`link`,size:`sm`,onClick:o,children:n(`workflows:workflowsPage.openChannelSettings`)})]})]}),(r===`denied`||r===`unsupported`)&&(0,X.jsxs)(K,{className:`workflow-notification-alert [&_[data-slot='alert-description']]:flex [&_[data-slot='alert-description']]:items-center [&_[data-slot='alert-description']]:gap-[4px] [&_[data-slot='alert-description']]:text-[11px] [&_[data-slot='alert-description']]:leading-[1.4] [margin:10px_0_6px] [border-color:color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_7%,var(--card))] text-[var(--text-secondary)]`,children:[(0,X.jsx)(V,{}),(0,X.jsxs)(G,{children:[n(r===`unsupported`?`workflows:workflowsPage.systemNotificationsUnsupported`:`workflows:workflowsPage.systemNotificationPermissionRequired`),(0,X.jsx)(c,{type:`button`,variant:`link`,size:`sm`,onClick:s,children:n(`workflows:workflowsPage.openSystemNotificationSettings`)})]})]}),Object.entries(st).map(([i,o])=>{let s=o.Icon,c=i===`browser`?u:!!t.notificationTargets[i]?.enabled;return(0,X.jsxs)(`div`,{className:`toggle-line [&_>_span]:flex [&_>_span]:items-center [&_>_span]:gap-[7px] [&_>_span]:text-[12px] flex min-h-[34px] items-center justify-between [border-top:1px_solid_var(--stroke-soft)]`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(s,{size:15}),dt(i,n)]}),(0,X.jsx)(ce,{checked:c&&(i!==`browser`||r===`granted`&&t.notificationTargets.browser.enabled)&&e.notificationTargets.includes(i),disabled:!c,"aria-label":dt(i,n),title:i===`browser`?c?t.notificationTargets.browser.enabled?n(`workflows:workflowsPage.systemNotificationsEnabled`):n(`workflows:workflowsPage.systemNotificationReady`):n(`workflows:workflowsPage.systemNotificationPermissionRequired`):n(c?`workflows:workflowsPage.notificationChannelEnabled`:`workflows:workflowsPage.notificationChannelNotEnabled`),onCheckedChange:()=>void a(i)})]},i)})]})}function mt({edge:e,nodes:t,t:n,onDelete:r}){let i=new Map(t.map(e=>[e.id,e]));return(0,X.jsx)(H,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] gap-0 py-0`,children:(0,X.jsxs)(B,{className:`p-3.5`,children:[(0,X.jsx)(z,{className:`workflow-section-title [.selection-list_&]:mb-[8px] [.node-library_&]:mb-[8px] text-[var(--text-soft)] text-[13px] font-[700] leading-[1.4]`,children:n(`workflows:workflowsPage.selectedConnection`)}),(0,X.jsxs)(`div`,{className:`workflow-edge-summary [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_span]:text-[var(--text-muted)] grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-[8px] [margin:10px_0]`,children:[(0,X.jsx)(`strong`,{children:i.get(e.source)?.label||n(`workflows:workflowsPage.unknownNode`)}),(0,X.jsx)(`span`,{children:`→`}),(0,X.jsx)(`strong`,{children:i.get(e.target)?.label||n(`workflows:workflowsPage.unknownNode`)})]}),(0,X.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-muted)] text-[12px] leading-[1.55]`,children:n(`workflows:workflowsPage.pressDeleteOrBackspaceToRemoveThisConnection`)}),(0,X.jsxs)(c,{size:`sm`,variant:`destructive`,onClick:r,children:[(0,X.jsx)(A,{"data-icon":`inline-start`}),n(`workflows:workflowsPage.deleteConnection`)]})]})})}function ht({node:e,selectedEdge:t,catalog:n,t:r,onUpdateNode:i,systemNotificationPermission:a,onToggleNotification:o,onCopy:s,onDelete:l,onOpenChannels:d,onOpenSystemNotificationSettings:f}){return(0,X.jsx)(H,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] gap-0 py-0`,children:(0,X.jsxs)(B,{className:`p-3.5`,children:[(0,X.jsx)(z,{className:`workflow-section-title [.selection-list_&]:mb-[8px] [.node-library_&]:mb-[8px] text-[var(--text-soft)] text-[13px] font-[700] leading-[1.4]`,children:r(`workflows:workflowsPage.selectedNode`)}),e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.nodeName`),(0,X.jsx)(j,{value:e.label,onChange:e=>i({label:e.target.value})})]}),(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.nodeModel`),(0,X.jsxs)(u,{value:e.model?`${e.model.provider}/${e.model.model}`:``,onChange:e=>{let t=n.models.find(t=>`${t.provider}/${t.model}`===e.target.value);i({model:t?{provider:t.provider,model:t.model}:null})},children:[(0,X.jsx)(`option`,{value:``,children:r(`workflows:workflowsPage.inheritWorkflowDefaultModel`)}),n.models.map(e=>(0,X.jsx)(`option`,{value:`${e.provider}/${e.model}`,children:e.label},`${e.provider}/${e.model}`))]})]}),(0,X.jsxs)(`div`,{className:`form-grid grid gap-[9px] three [.form-grid&]:grid-cols-[repeat(3,minmax(0,1fr))] max-[650px]:[.form-grid&]:grid-cols-[1fr]`,children:[(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.retryCount`),(0,X.jsx)(j,{type:`number`,min:`0`,max:`3`,value:e.retries,onChange:e=>i({retries:Number(e.target.value)})})]}),(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.timeoutMinutes`),(0,X.jsx)(j,{type:`number`,min:`1`,max:`240`,value:e.timeoutMinutes,onChange:e=>i({timeoutMinutes:Number(e.target.value)})})]}),(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.failureHandling`),(0,X.jsxs)(u,{value:e.failurePolicy,onChange:e=>i({failurePolicy:e.target.value===`skip`?`skip`:`stop`}),children:[(0,X.jsx)(`option`,{value:`stop`,children:r(`workflows:workflowsPage.stopImmediately`)}),(0,X.jsx)(`option`,{value:`skip`,children:r(`workflows:workflowsPage.skipThisNode`)})]})]})]}),[`prompt`,`skill`,`file`,`mcp`].includes(e.kind)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.executionMode`),(0,X.jsx)(u,{value:e.executionMode,onChange:e=>i({executionMode:e.target.value}),children:ct.map(e=>(0,X.jsx)(`option`,{value:e,children:lt(e,r)},e))}),(0,X.jsx)(`small`,{children:ut(e.executionMode,r)})]}),e.kind===`skill`&&(0,X.jsxs)(W,{variant:`control`,children:[`Skill`,(0,X.jsxs)(u,{value:e.skillName,onChange:e=>i({skillName:e.target.value}),children:[(0,X.jsx)(`option`,{value:``,children:r(`workflows:workflowsPage.chooseSkill`)}),n.skills.map(e=>(0,X.jsx)(`option`,{value:e.name,children:e.name},e.id))]})]}),e.kind===`mcp`&&(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.mcpToolNames`),(0,X.jsx)(j,{value:e.requestedToolNames.join(`, `),onChange:e=>i({requestedToolNames:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)}),placeholder:`server.tool_name`})]}),(0,X.jsxs)(W,{variant:`control`,children:[`Prompt`,(0,X.jsx)(Q,{value:e.prompt,onChange:e=>i({prompt:e.target.value}),placeholder:r(`workflows:workflowsPage.describeTheWorkTheAgentShouldCompleteInThisNode`)})]}),(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.outputFormat`),(0,X.jsxs)(u,{value:e.outputFormat,onChange:e=>i({outputFormat:e.target.value===`json`?`json`:`text`}),children:[(0,X.jsx)(`option`,{value:`text`,children:`Text`}),(0,X.jsx)(`option`,{value:`json`,children:`JSON`})]})]})]}),e.kind===`condition`&&(0,X.jsxs)(`div`,{className:`form-grid grid gap-[9px] three [.form-grid&]:grid-cols-[repeat(3,minmax(0,1fr))] max-[650px]:[.form-grid&]:grid-cols-[1fr]`,children:[(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.dataPath`),(0,X.jsx)(j,{value:e.condition.source,onChange:t=>i({condition:{...e.condition,source:t.target.value}}),placeholder:`inputs.approved`})]}),(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.operator`),(0,X.jsx)(u,{value:e.condition.operator,onChange:t=>i({condition:{...e.condition,operator:t.target.value}}),children:[`exists`,`not_exists`,`equals`,`not_equals`,`contains`,`greater_than`,`less_than`].map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})]}),(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.comparisonValue`),(0,X.jsx)(j,{value:String(e.condition.value??``),onChange:t=>i({condition:{...e.condition,value:t.target.value}})})]})]}),e.kind===`notification`&&(0,X.jsx)(pt,{node:e,catalog:n,t:r,systemNotificationPermission:a,onUpdateNode:i,onToggleNotification:o,onOpenChannels:d,onOpenSystemNotificationSettings:f}),e.kind===`approval`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.approvalMessage`),(0,X.jsx)(Q,{value:e.approval.message,onChange:t=>i({approval:{...e.approval,message:t.target.value}})})]}),(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.approvalTimeout`),(0,X.jsx)(j,{type:`number`,min:`1`,max:`10080`,value:e.approval.timeoutMinutes,onChange:t=>i({approval:{...e.approval,timeoutMinutes:Number(t.target.value)}})})]})]}),(0,X.jsxs)(`div`,{className:`mt-[15px] flex gap-2 max-[650px]:flex-wrap`,children:[(0,X.jsxs)(c,{size:`sm`,variant:`secondary`,onClick:s,children:[(0,X.jsx)(y,{"data-icon":`inline-start`}),r(`workflows:workflowsPage.duplicateNode`)]}),(0,X.jsxs)(c,{size:`sm`,variant:`destructive`,onClick:l,children:[(0,X.jsx)(A,{"data-icon":`inline-start`}),r(`workflows:workflowsPage.deleteNode`)]})]})]}):(0,X.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-muted)] text-[12px] leading-[1.55]`,children:r(t?`workflows:workflowsPage.aConnectionIsCurrentlySelected`:`workflows:workflowsPage.dragNodesFromTheLeftToStartBuildingTheWorkflow`)})]})})}function gt({draft:e,catalog:t,selectedNode:n,selectedEdge:r,currentRun:i,language:a,t:o,onUpdateDraft:s,onUpdateNode:c,systemNotificationPermission:l,onToggleNotification:u,onDeleteEdge:d,onCopyNode:f,onDeleteNode:p,onOpenChannels:m,onOpenSystemNotificationSettings:h}){return(0,X.jsxs)(`div`,{className:`detail-stack flex min-w-0 flex-col gap-[12px] [.mcp-layout_>_&]:min-h-0 max-[1150px]:[.memory-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.memory-layout_>_&]:grid max-[1150px]:[.memory-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.mcp-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.mcp-layout_>_&]:grid max-[1150px]:[.mcp-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.skills-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.skills-layout_>_&]:grid max-[1150px]:[.skills-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[650px]:[.memory-layout_>_&]:[grid-column:auto] max-[650px]:[.memory-layout_>_&]:grid-cols-[1fr] max-[650px]:[.mcp-layout_>_&]:[grid-column:auto] max-[650px]:[.mcp-layout_>_&]:grid-cols-[1fr] max-[650px]:[.skills-layout_>_&]:[grid-column:auto] max-[650px]:[.skills-layout_>_&]:grid-cols-[1fr] inspector !min-w-0 max-[1150px]:[.builder-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.builder-layout_>_&]:grid max-[1150px]:[.builder-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[900px]:[.builder-layout_>_&]:[grid-column:1/-1]`,children:[(0,X.jsx)(ft,{draft:e,catalog:t,t:o,onUpdateDraft:s}),r&&(0,X.jsx)(mt,{edge:r,nodes:e.nodes,t:o,onDelete:d}),(0,X.jsx)(ht,{node:n,selectedEdge:r,catalog:t,t:o,onUpdateNode:c,systemNotificationPermission:l,onToggleNotification:u,onCopy:f,onDelete:p,onOpenChannels:m,onOpenSystemNotificationSettings:h}),e.id&&(0,X.jsx)(ot,{run:i,language:a,t:o})]})}var _t={workflows:[],runs:[],limits:{maxConcurrent:4,running:0},notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1},qq:{enabled:!1},telegram:{enabled:!1}},models:[],skills:[],cwd:``};function $(e){return e instanceof Error?e.message:String(e)}function vt({notify:e,requestConfirm:t,query:n}){let{t:r}=l(),[i,a]=(0,Y.useState)(_t),[s,c]=(0,Y.useState)(`all`),[u,d]=(0,Y.useState)(!0),[f,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(``),g=(0,Y.useCallback)(async()=>{try{a(await o(`/api/workflows`)),h(``)}catch(e){h($(e))}finally{d(!1)}},[]);(0,Y.useEffect)(()=>{g()},[g]),(0,Y.useEffect)(()=>{let e=window.setInterval(()=>{g()},i.limits.running?1500:8e3);return()=>window.clearInterval(e)},[i.limits.running,g]);let _=(0,Y.useCallback)(e=>i.runs.filter(t=>t.workflowId===e).sort((e,t)=>Date.parse(t.startedAt)-Date.parse(e.startedAt))[0],[i.runs]);return{data:i,filter:s,setFilter:c,loading:u,busyId:f,error:m,visibleWorkflows:(0,Y.useMemo)(()=>i.workflows.filter(e=>{let t=_(e.id);return`${e.name} ${e.description}`.toLowerCase().includes(n.toLowerCase())?s===`running`?t?.status===`running`:s===`failed`?t?.status===`failed`:s===`draft`?e.status===`draft`:s!==`presets`:!1}),[i.workflows,s,_,n]),latestRun:_,runWorkflow:(0,Y.useCallback)(async(t,n={})=>{p(t.id),h(``);try{await o(`/api/workflows/${encodeURIComponent(t.id)}/run`,{method:`POST`,body:JSON.stringify({inputs:n})}),await g(),e(r(`workflows:workflowsPage.workflowStarted`))}catch(t){let n=$(t);h(n),e(n,`error`)}finally{p(``)}},[g,e,r]),stopRun:(0,Y.useCallback)(async t=>{p(t.id),h(``);try{await o(`/api/workflow-runs/${encodeURIComponent(t.id)}/stop`,{method:`POST`,body:`{}`}),await g(),e(r(`workflows:workflowsPage.stoppingWorkflow`),`info`)}catch(t){let n=$(t);h(n),e(n,`error`)}finally{p(``)}},[g,e,r]),retryRun:(0,Y.useCallback)(async t=>{p(t.id);try{await o(`/api/workflow-runs/${encodeURIComponent(t.id)}/retry`,{method:`POST`,body:`{}`}),await g(),e(r(`workflows:workflowsPage.workflowStarted`))}catch(t){let n=$(t);h(n),e(n,`error`)}finally{p(``)}},[g,e,r]),resolveApproval:(0,Y.useCallback)(async(t,n,r)=>{p(n);try{await o(`/api/workflow-runs/${encodeURIComponent(t.id)}/approvals/${encodeURIComponent(n)}`,{method:`POST`,body:JSON.stringify({approved:r})}),await g()}catch(t){let n=$(t);h(n),e(n,`error`)}finally{p(``)}},[g,e]),duplicateWorkflow:(0,Y.useCallback)(async t=>{p(t.id);try{await o(`/api/workflows/${encodeURIComponent(t.id)}/duplicate`,{method:`POST`,body:`{}`}),await g(),e(r(`workflows:workflowsPage.workflowDuplicated`))}catch(t){let n=$(t);h(n),e(n,`error`)}finally{p(``)}},[g,e,r]),exportWorkflow:(0,Y.useCallback)(async t=>{try{let e=await o(`/api/workflows/${encodeURIComponent(t.id)}/export`),n=new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${t.name.replace(/[\\/:*?"<>|]/g,`-`)}.pisper-workflow.json`,i.click(),URL.revokeObjectURL(r)}catch(t){e($(t),`error`)}},[e]),importWorkflow:(0,Y.useCallback)(async t=>{p(`import`);try{await o(`/api/workflows/import`,{method:`POST`,body:JSON.stringify(t)}),await g(),e(r(`workflows:workflowsPage.workflowImported`))}catch(t){let n=$(t);h(n),e(n,`error`)}finally{p(``)}},[g,e,r]),removeWorkflow:(0,Y.useCallback)(async n=>{if(await t?.({title:r(`workflows:workflowsPage.deleteWorkflow`),message:r(`workflows:workflowsPage.deleteWorkflowNameAndItsRunHistory`,{name:n.name}),confirmLabel:r(`workflows:workflowsPage.delete`),tone:`danger`})){p(n.id);try{await o(`/api/workflows/${encodeURIComponent(n.id)}`,{method:`DELETE`}),await g(),e(r(`workflows:workflowsPage.workflowDeleted`))}catch(t){let n=$(t);h(n),e(n,`error`)}finally{p(``)}}},[g,e,t,r])}}function yt({workflowId:e,templateId:t,notify:n,onCreated:r}){let{t:i}=l(),[a,s]=(0,Y.useState)(_t),[c,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(``),[p,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(!0),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(``),x=!!window.pisperDesktop?.showNotification,[S,C]=(0,Y.useState)(()=>x?`checking`:fe()),w=(0,Y.useCallback)(async()=>{if(!x){C(fe());return}let e=window.pisperDesktop?.getNotificationStatus;if(!e){C(`granted`);return}try{let t=await e(),n=t?.permission;C(n==="default"||n===`denied`||n===`granted`||n===`checking`||n===`unsupported`?n:t?.supported===!1?`unsupported`:`granted`)}catch{C(`unsupported`)}},[x]),T=(0,Y.useCallback)(async()=>{try{let n=await o(`/api/workflows`);s(n);let r=e===`new`?null:n.workflows.find(t=>t.id===e),a=qe.find(e=>e.id===t),c=r?structuredClone(r):a?Ye(a,n.cwd):Je(n.cwd);u(c),f(e=>c.nodes.some(t=>t.id===e)?e:c.nodes[0]?.id||``),m(``),b(r||e===`new`?``:i(`workflows:workflowsPage.workflowNotFoundABlankEditorWasOpened`))}catch(e){b($(e))}finally{g(!1)}},[i,t,e]);(0,Y.useEffect)(()=>{T()},[T]),(0,Y.useEffect)(()=>{w();let e=()=>void w();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[w]);let E=(0,Y.useMemo)(()=>a.runs.filter(e=>e.workflowId===c?.id).sort((e,t)=>Date.parse(t.startedAt)-Date.parse(e.startedAt))[0],[a.runs,c?.id]),D=E?.status===`running`;(0,Y.useEffect)(()=>{if(!D)return;let e=window.setInterval(async()=>{try{s(await o(`/api/workflows`))}catch{}},1500);return()=>window.clearInterval(e)},[D]);let O=(0,Y.useMemo)(()=>c?.nodes.find(e=>e.id===d)||null,[c?.nodes,d]),k=(0,Y.useMemo)(()=>c?.edges.find(e=>e.id===p)||null,[c?.edges,p]),A=(0,Y.useCallback)(e=>{u(t=>t&&{...t,...e})},[]),j=(0,Y.useCallback)(e=>{u(t=>t&&{...t,nodes:t.nodes.map(t=>t.id===d?{...t,...e}:t)})},[d]),M=(0,Y.useCallback)(e=>{f(e),m(``)},[]),N=(0,Y.useCallback)(e=>{m(e),f(``)},[]),P=(0,Y.useCallback)(()=>{f(``),m(``)},[]),F=(0,Y.useCallback)((e,t,r=`output`)=>{if(!c||e===t)return;let a=c.nodes.find(e=>e.id===t);if(!a||a.kind===`trigger`){n(i(`workflows:workflowsPage.aTriggerCannotHaveAnUpstreamConnection`),`error`);return}if(c.edges.some(n=>n.source===e&&n.target===t&&n.sourcePort===r)){n(i(`workflows:workflowsPage.thisConnectionAlreadyExists`),`info`);return}if(ze(c.nodes,c.edges,e,t,r)){n(i(`workflows:workflowsPage.aWorkflowCannotContainCyclicConnections`),`error`);return}let o={id:crypto.randomUUID(),source:e,sourcePort:r,target:t,targetPort:`input`};u(e=>e&&{...e,edges:[...e.edges,o]}),m(o.id),f(``),n(i(`workflows:workflowsPage.connectionCreated`),`info`)},[c,n,i]),I=(0,Y.useCallback)(e=>{if(!e.length)return;let t=new Set(e);u(e=>e&&{...e,edges:e.edges.filter(e=>!t.has(e.id))}),m(``),n(i(`workflows:workflowsPage.connectionDeleted`),`info`)},[n,i]),ne=(0,Y.useCallback)(()=>{p&&I([p])},[I,p]),L=(0,Y.useCallback)(e=>{if(!e.length)return;let t=new Set(e);u(e=>e&&{...e,nodes:e.nodes.filter(e=>!t.has(e.id)),edges:e.edges.filter(e=>!t.has(e.source)&&!t.has(e.target))}),P(),n(i(`workflows:workflowsPage.nodeDeleted`),`info`)},[P,n,i]),re=(0,Y.useCallback)((e,t,n)=>{let r=crypto.randomUUID();u(i=>i&&{...i,nodes:[...i.nodes,Z(r,e,t||Be[e],``,n.x,n.y)]}),f(r),m(``)},[]),R=(0,Y.useCallback)((e,t)=>{u(n=>n&&{...n,nodes:n.nodes.map(n=>n.id===e&&(n.x!==t.x||n.y!==t.y)?{...n,x:t.x,y:t.y}:n)})},[]),ie=(0,Y.useCallback)(()=>{if(!O)return;let e=crypto.randomUUID();u(t=>t&&{...t,nodes:[...t.nodes,{...O,id:e,label:`${O.label} 副本`,x:O.x+25,y:O.y+25}]}),f(e),m(``),n(i(`workflows:workflowsPage.nodeDuplicated`),`info`)},[n,O,i]),z=(0,Y.useCallback)(()=>{O&&L([O.id])},[L,O]),B=(0,Y.useCallback)(async e=>{if(!O||O.kind!==`notification`)return;let t=O.notificationTargets;if(e!==`browser`){if(t.includes(e)){j({notificationTargets:t.filter(t=>t!==e)});return}if(!a.notificationTargets[e]?.enabled)return;j({notificationTargets:[...t,e]});return}if(t.includes(e)&&a.notificationTargets.browser.enabled&&S===`granted`){j({notificationTargets:t.filter(t=>t!==e)});return}let r=S;if(x){await w();let e=await window.pisperDesktop?.getNotificationStatus?.();r=e?.permission||(e?.supported===!1?`unsupported`:`granted`)}else if(r=await ee(),C(r),r===`granted`)try{await te()}catch(e){n($(e),`error`);return}if(r!==`granted`){n(i(r===`unsupported`?`workflows:workflowsPage.systemNotificationsUnsupported`:`workflows:workflowsPage.systemNotificationPermissionRequired`),`error`);return}try{let r=await o(`/api/settings/notifications/browser`,{method:`PATCH`,body:JSON.stringify({enabled:!0})});s(e=>({...e,notificationTargets:{...e.notificationTargets,browser:{enabled:r.browser.enabled}}})),j({notificationTargets:t.includes(e)?t:[...t,e]}),n(i(`workflows:workflowsPage.systemNotificationsEnabled`))}catch(e){n($(e),`error`)}},[a.notificationTargets,x,n,w,O,S,i,j]),V=(0,Y.useCallback)(async(e=`draft`,t=!1)=>{if(!c)return null;v(!0),b(``);try{let l=new Set(Object.entries(a.notificationTargets).filter(([e,t])=>t.enabled&&(e!==`browser`||S===`granted`||S===`checking`)).map(([e])=>e)),d={...c,status:e,notifications:c.notifications.filter(e=>l.has(e)),nodes:c.nodes.map(e=>({...e,notificationTargets:e.notificationTargets.filter(e=>l.has(e))}))},f=c.id?await o(`/api/workflows/${encodeURIComponent(c.id)}`,{method:`PATCH`,body:JSON.stringify(d)}):await o(`/api/workflows`,{method:`POST`,body:JSON.stringify(d)});return s(f.state),u(structuredClone(f.workflow)),c.id||r(f.workflow.id),t||n(i(e===`published`?`workflows:workflowsPage.workflowPublished`:`workflows:workflowsPage.workflowDraftSaved`)),f.workflow}catch(e){let t=$(e);return b(t),n(t,`error`),null}finally{v(!1)}},[a.notificationTargets,c,n,r,S,i]);return{catalog:a,draft:c,selectedNode:O,selectedEdge:k,selectedNodeId:d,selectedEdgeId:p,currentRun:E,loading:h,busy:_,running:D,error:y,systemNotificationPermission:S,updateDraft:A,updateNode:j,addEdge:F,removeEdges:I,removeSelectedEdge:ne,removeNodes:L,addNode:re,moveNode:R,copyNode:ie,deleteNode:z,toggleNotification:B,selectNode:M,selectEdge:N,clearSelection:P,saveWorkflow:V,runWorkflow:(0,Y.useCallback)(async()=>{let e=await V(c?.status||`draft`,!0);if(e){v(!0);try{await o(`/api/workflows/${encodeURIComponent(e.id)}/run`,{method:`POST`,body:`{}`}),s(await o(`/api/workflows`)),n(i(`workflows:workflowsPage.workflowStarted`))}catch(e){let t=$(e);b(t),n(t,`error`)}finally{v(!1)}}},[c?.status,n,V,i]),stopWorkflow:(0,Y.useCallback)(async()=>{if(!(!E||E.status!==`running`)){v(!0);try{await o(`/api/workflow-runs/${encodeURIComponent(E.id)}/stop`,{method:`POST`,body:`{}`}),s(await o(`/api/workflows`)),n(i(`workflows:workflowsPage.stoppingWorkflow`),`info`)}catch(e){let t=$(e);b(t),n(t,`error`)}finally{v(!1)}}},[E,n,i]),publishWorkflow:(0,Y.useCallback)(()=>V(`published`),[V])}}function bt({message:e}){return e?(0,X.jsxs)(K,{variant:`destructive`,children:[(0,X.jsx)(V,{}),(0,X.jsx)(G,{children:e})]}):null}function xt({label:e}){return(0,X.jsxs)(le,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] gap-2 py-4`,children:[(0,X.jsx)(L,{className:`animate-spin`,size:23}),(0,X.jsx)(`h2`,{children:e})]})}function St({notify:e,requestConfirm:t,query:n=``}){let{t:r,language:i}=l(),o=a(),[s,c]=(0,Y.useState)(`workflows`),u=vt({notify:e,requestConfirm:t,query:n});return u.loading?(0,X.jsx)(xt,{label:r(`workflows:workflowsPage.loadingWorkflows`)}):(0,X.jsxs)(`div`,{className:`workflows-page flex min-h-[100%] flex-col gap-[12px]`,children:[(0,X.jsx)(bt,{message:u.error}),(0,X.jsxs)(`div`,{className:`workflow-page-toolbar max-[650px]:items-stretch max-[650px]:flex-col max-[650px]:gap-[8px] flex min-w-0 items-center justify-between gap-[16px]`,children:[(0,X.jsx)($e,{value:s,t:r,onChange:c}),(0,X.jsx)(rt,{data:u.data,t:r})]}),s===`workflows`?(0,X.jsx)(et,{workflows:u.visibleWorkflows,runs:u.data.runs,busyId:u.busyId,language:i,t:r,onRun:e=>void u.runWorkflow(e),onEdit:e=>o(U(e)),onDuplicate:e=>void u.duplicateWorkflow(e),onExport:e=>void u.exportWorkflow(e),onImport:e=>void u.importWorkflow(e),onDelete:e=>void u.removeWorkflow(e)}):s===`runs`?(0,X.jsx)(tt,{runs:u.data.runs,busyId:u.busyId,language:i,t:r,onStop:e=>void u.stopRun(e),onRetry:e=>void u.retryRun(e),onApproval:(e,t,n)=>void u.resolveApproval(e,t,n)}):(0,X.jsx)(nt,{t:r,onOpenTemplate:e=>o(`${U(`new`)}?template=${encodeURIComponent(e)}`)})]})}function Ct({notify:e,registerPrimaryAction:t,registerWorkflowActions:n}){let{t:o,language:s}=l(),c=a(),{workflowId:u=`new`}=i(),[d]=r(),f=(0,Y.useCallback)(e=>{c(U(e),{replace:!0})},[c]),p=yt({workflowId:u,templateId:d.get(`template`),notify:e,onCreated:f}),{busy:m,publishWorkflow:h,runWorkflow:g,running:_,saveWorkflow:v,stopWorkflow:y}=p;return he(t,h),(0,Y.useEffect)(()=>n?.({save:()=>v(`draft`),run:_?y:g,busy:m,running:_}),[m,n,g,_,v,y]),p.loading||!p.draft?(0,X.jsx)(xt,{label:o(`workflows:workflowsPage.loadingWorkflowEditor`)}):(0,X.jsxs)(`div`,{className:`preview-page flex min-h-[100%] flex-col workflow-editor-page`,children:[(0,X.jsx)(bt,{message:p.error}),p.running&&p.currentRun&&(0,X.jsx)(at,{run:p.currentRun,t:o}),(0,X.jsxs)(`div`,{className:`builder-layout [.preview-page_>_&]:min-h-0 [.preview-page_>_&]:flex-1 max-[1150px]:grid-cols-[180px_minmax(460px,1fr)] max-[900px]:grid-cols-[180px_minmax(520px,1fr)] max-[900px]:overflow-auto max-[650px]:flex max-[650px]:min-w-0 max-[650px]:flex-col max-[650px]:overflow-visible max-[650px]:[.page-workflowCreate_&]:w-[900px] grid min-h-[100%] grid-cols-[205px_minmax(480px,1fr)_300px] gap-[12px]`,children:[(0,X.jsx)(Xe,{draft:p.draft,selectedNodeId:p.selectedNodeId,selectedEdgeId:p.selectedEdgeId,t:o,onAddNode:p.addNode,onConnect:p.addEdge,onMoveNode:p.moveNode,onSelectNode:p.selectNode,onSelectEdge:p.selectEdge,onClearSelection:p.clearSelection,onDeleteNodes:p.removeNodes,onDeleteEdges:p.removeEdges}),(0,X.jsx)(gt,{draft:p.draft,catalog:p.catalog,selectedNode:p.selectedNode,selectedEdge:p.selectedEdge,currentRun:p.currentRun,language:s,t:o,systemNotificationPermission:p.systemNotificationPermission,onUpdateDraft:p.updateDraft,onUpdateNode:p.updateNode,onToggleNotification:p.toggleNotification,onDeleteEdge:p.removeSelectedEdge,onCopyNode:p.copyNode,onDeleteNode:p.deleteNode,onOpenChannels:()=>c(ie.channels),onOpenSystemNotificationSettings:()=>{if(window.pisperDesktop?.openNotificationSettings){window.pisperDesktop.openNotificationSettings();return}c(`/config/notifications`)}})]})]})}export{Ct as WorkflowBuilder,St as WorkflowsPage};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./vendor-react-CHuvPdJE.js";import{d as r,l as i,s as a}from"./vendor-router-Bw2aAdMs.js";import{t as o}from"./api-B6CluO7V.js";import{n as s,t as c}from"./button-XhIEgIsg.js";import{t as l}from"./use-i18n-jYw5s_Yn.js";import{t as u}from"./AppSelect-kDqZkETY.js";import{i as d,n as f,r as p,t as m}from"./progress-DQDjWjzV.js";import{t as h}from"./utils-C8uzG5AZ.js";import{t as g}from"./check-jIXqkGKr.js";import{t as _}from"./chevron-down-DT6AXwTP.js";import{t as v}from"./code-xml-Z4K2ea1N.js";import{t as y}from"./copy-DS-8Hh_R.js";import{t as b}from"./file-code-corner-BKkXAMHR.js";import{t as x}from"./file-C8GNXmhJ.js";import{t as S}from"./image-Dh7-wI1d.js";import{t as C}from"./message-circle-Bc_EzZop.js";import{n as w,t as T}from"./zap-CFsp4Y1u.js";import{t as E}from"./pencil-CxA1IK0x.js";import{t as D}from"./play-N6mg4pFl.js";import{t as O}from"./send-DcLH_sg0.js";import{t as k}from"./square-BZ3Bi3O-.js";import{t as A}from"./trash-2-mhzzyC6i.js";import{t as j}from"./input-D1QFzNMx.js";import{At as M,B as N,E as ee,Nt as P,Pt as F,T as te,_t as I,a as ne,bt as L,d as re,f as R,ft as ie,g as z,h as B,ht as V,jt as ae,kt as oe,m as H,n as se,p as ce,pt as U,r as le,u as ue,vt as de,w as fe,xt as pe,yt as me}from"./index-Bd5A8V1V.js";import{t as W}from"./field-t72VAR-1.js";import{t as he}from"./usePagePrimaryAction-Bw0OFTDZ.js";import{n as G,t as K}from"./alert-B7D8joCd.js";import{a as ge,c as _e,d as ve,f as q,i as J,l as ye,n as be,o as xe,r as Se,s as Ce,t as we,u as Te}from"./vendor-xyflow-CnjXtcyK.js";var Ee=s(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),De=s(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Y=e(t(),1),X=n(),Oe=({className:e,...t})=>(0,X.jsx)(Se,{className:h(`gap-px overflow-hidden rounded-md border bg-card p-1 shadow-none!`,`[&>button]:rounded-md [&>button]:border-none! [&>button]:bg-transparent! [&>button]:hover:bg-secondary!`,e),...t}),ke=[`trigger`,`prompt`,`skill`,`file`,`mcp`,`notification`,`condition`,`parallel`,`approval`];function Ae({data:e,selected:t}){return(0,X.jsxs)(`div`,{className:h(`flow-node [.workflow-mini-map_&.compact]:w-[100px] [.workflow-mini-map_&.compact]:min-h-[42px] [.workflow-mini-map_&.compact]:p-[5px_8px] [.workflow-mini-map_&.compact]:cursor-default [.workflow-mini-map_&.compact_small]:text-[11px] [.workflow-mini-map_&.compact_strong]:max-w-[100%] [.workflow-mini-map_&.compact_strong]:overflow-hidden [.workflow-mini-map_&.compact_strong]:text-[12px] [.workflow-mini-map_&.compact_strong]:text-ellipsis [.workflow-mini-map_&.compact_strong]:whitespace-nowrap [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_strong]:text-[13px] [&.active]:border-[var(--star)] [&.active]:[animation:star-node-pulse_2.4s_var(--ease-out)_infinite] [&.type-condition]:border-[var(--warning-border)] [&.type-condition]:bg-[var(--warning-subtle)] [&.type-parallel]:border-[var(--violet-border)] [&.type-parallel]:bg-[var(--violet-soft)] [&.type-approval]:border-[var(--approval-border)] [&.type-approval]:bg-[var(--success-subtle)] [&.type-notification]:border-[var(--notification-border)] [&.type-notification]:bg-[var(--notification-soft)] dark:[&.type-condition]:bg-[var(--warning-soft)] dark:[&.type-并行]:bg-[var(--violet-soft)] dark:[&.type-审批]:bg-[var(--success-subtle)] dark:[&.type-通知]:bg-[var(--notification-soft)] relative flex w-[120px] min-h-[49px] flex-col items-start justify-center gap-[3px] [border:1px_solid_var(--accent-border)] rounded-[var(--r-sm)] bg-[var(--accent-soft)] [padding:7px_10px] text-left shadow-[0_8px_18px_-14px_var(--node-shadow)] cursor-grab`,`type-${e.kind}`,t&&`active`,e.compact&&`compact`),children:[!e.compact&&e.kind!==`trigger`&&(0,X.jsx)(J,{id:`input`,className:`flow-port after:absolute after:[content:''] after:inset-[-8px] absolute z-[3] w-[12px] h-[12px] [border:2px_solid_var(--solid)] rounded-[50%] bg-[var(--text)] [cursor:crosshair] input [.flow-port&]:top-[50%] [.flow-port&]:left-[-7px] [.flow-port&]:[transform:translateY(-50%)]`,type:`target`,position:q.Left,title:e.inputLabel,"aria-label":e.inputLabel}),!e.compact&&e.kind===`condition`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(J,{id:`true`,className:`flow-port after:absolute after:[content:''] after:inset-[-8px] absolute z-[3] w-[12px] h-[12px] [border:2px_solid_var(--solid)] rounded-[50%] bg-[var(--text)] [cursor:crosshair] output [.flow-port&]:top-[50%] [.flow-port&]:right-[-7px] [.flow-port&]:[transform:translateY(-50%)] condition-true`,type:`source`,position:q.Right,title:`true`,"aria-label":`true`}),(0,X.jsx)(J,{id:`false`,className:`flow-port after:absolute after:[content:''] after:inset-[-8px] absolute z-[3] w-[12px] h-[12px] [border:2px_solid_var(--solid)] rounded-[50%] bg-[var(--text)] [cursor:crosshair] output [.flow-port&]:top-[50%] [.flow-port&]:right-[-7px] [.flow-port&]:[transform:translateY(-50%)] condition-false`,type:`source`,position:q.Bottom,title:`false`,"aria-label":`false`})]}):!e.compact&&(0,X.jsx)(J,{id:`output`,className:`flow-port after:absolute after:[content:''] after:inset-[-8px] absolute z-[3] w-[12px] h-[12px] [border:2px_solid_var(--solid)] rounded-[50%] bg-[var(--text)] [cursor:crosshair] output [.flow-port&]:top-[50%] [.flow-port&]:right-[-7px] [.flow-port&]:[transform:translateY(-50%)]`,type:`source`,position:q.Right,title:e.outputLabel,"aria-label":e.outputLabel}),(0,X.jsx)(`small`,{children:e.typeLabel}),(0,X.jsx)(`strong`,{children:e.label})]})}var je={workflow:Ae};function Me(e){return typeof e==`string`&&ke.includes(e)}function Ne(e){return e.data.kind===`condition`?`var(--warning-strong)`:e.data.kind===`parallel`?`var(--workflow-violet)`:e.data.kind===`approval`?`var(--success)`:e.data.kind===`notification`?`var(--notification-border)`:`var(--star-strong)`}function Pe({nodes:e,edges:t,selectedNodeId:n,selectedEdgeId:r,hint:i,inputLabel:a,outputLabel:o,nodeTypeLabel:s,onAddNode:c,onConnect:l,onMoveNode:u,onSelectNode:d,onSelectEdge:f,onClearSelection:p,onDeleteNodes:m,onDeleteEdges:h}){let{screenToFlowPosition:g}=ye(),_=(0,Y.useMemo)(()=>e.map(e=>({id:e.id,type:`workflow`,position:{x:e.x,y:e.y},selected:e.id===n,data:{kind:e.kind,label:e.label,typeLabel:s(e.kind),inputLabel:a,outputLabel:o}})),[a,s,e,o,n]),v=(0,Y.useRef)(new Set),y=(0,Y.useRef)(new Map),b=(0,Y.useRef)(null),[x,S,C]=_e(_);(0,Y.useEffect)(()=>{S(e=>{let t=new Map(e.map(e=>[e.id,e])),n=e.length!==_.length,r=_.map(e=>{let r=t.get(e.id);if(!r)return n=!0,e;let i=v.current.has(e.id)?r.position:e.position,a=r.data.kind===e.data.kind&&r.data.label===e.data.label&&r.data.typeLabel===e.data.typeLabel&&r.data.inputLabel===e.data.inputLabel&&r.data.outputLabel===e.data.outputLabel&&r.data.compact===e.data.compact;return i.x===r.position.x&&i.y===r.position.y&&r.selected===e.selected&&a?r:(n=!0,{...r,position:i,selected:e.selected,data:e.data})});return n?r:e})},[_,S]);let w=(0,Y.useCallback)(()=>{b.current=null,y.current.forEach((e,t)=>u(t,e)),y.current.clear()},[u]),T=(0,Y.useCallback)((e,t)=>{y.current.set(e,t),b.current??=requestAnimationFrame(w)},[w]);(0,Y.useEffect)(()=>()=>{b.current!==null&&cancelAnimationFrame(b.current)},[]);let E=(0,Y.useMemo)(()=>t.map(e=>({id:e.id,source:e.source,sourceHandle:e.sourcePort,target:e.target,targetHandle:e.targetPort,selected:e.id===r,markerEnd:{type:ve.ArrowClosed,width:16,height:16,color:`var(--canvas-edge)`},style:{stroke:`var(--canvas-edge)`,strokeWidth:2}})),[t,r]),D=(0,Y.useCallback)(e=>{!e.source||!e.target||l(e.source,e.target,e.sourceHandle||`output`)},[l]),O=(0,Y.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},[]),k=(0,Y.useCallback)(e=>{e.preventDefault();let t={};try{t=JSON.parse(e.dataTransfer.getData(`text/plain`)||`{}`)}catch{return}if(!Me(t.kind))return;let n=g({x:e.clientX,y:e.clientY});c(t.kind,typeof t.label==`string`?t.label:s(t.kind),n)},[s,c,g]);return(0,X.jsxs)(`div`,{className:`workflow-react-flow absolute inset-0`,children:[(0,X.jsxs)(Ce,{nodes:x,edges:E,nodeTypes:je,onNodesChange:C,connectionMode:Te.Strict,deleteKeyCode:[`Backspace`,`Delete`],fitView:!0,fitViewOptions:{padding:.18,minZoom:.55,maxZoom:1},minZoom:.35,maxZoom:1.8,snapToGrid:!0,snapGrid:[20,20],panOnDrag:!0,zoomOnDoubleClick:!1,onConnect:D,onNodeClick:(e,t)=>d(t.id),onEdgeClick:(e,t)=>f(t.id),onPaneClick:p,onNodeDragStart:(e,t)=>v.current.add(t.id),onNodeDrag:(e,t)=>T(t.id,t.position),onNodeDragStop:(e,t)=>{v.current.delete(t.id),y.current.delete(t.id),u(t.id,t.position)},onNodesDelete:e=>m(e.map(e=>e.id)),onEdgesDelete:e=>h(e.map(e=>e.id)),onDragOver:O,onDrop:k,children:[(0,X.jsx)(we,{variant:be.Dots,gap:20,size:1.2,color:`var(--canvas-grid)`}),(0,X.jsx)(ge,{className:`workflow-react-flow-minimap [border:1px_solid_var(--stroke)] rounded-[var(--r-sm)] !bg-[var(--surface-subtle)]`,nodeColor:Ne,nodeStrokeWidth:3,pannable:!0,zoomable:!0}),(0,X.jsx)(Oe,{position:`top-left`,showInteractive:!1})]}),(0,X.jsx)(`div`,{className:`absolute z-[5] [left:12px] [bottom:10px] text-[var(--text-muted)] text-[12px] pointer-events-none`,children:i})]})}function Fe(e){return(0,X.jsx)(xe,{children:(0,X.jsx)(Pe,{...e})})}function Ie(e){return new Map(e.map((e,t)=>[e.id,t]))}function Le(e=[],t){return e.slice(1).map((n,r)=>{let i=e[r];return{id:t?.(r,i.id,n.id)||`edge-${r}-${i.id}-${n.id}`,source:i.id,sourcePort:`output`,target:n.id,targetPort:`input`}})}function Re(e=[],t=[]){let n=e.filter(e=>e.enabled!==!1),r=new Set(n.map(e=>e.id)),i=t.filter(e=>r.has(e.source)&&r.has(e.target)),a=new Map(n.map(e=>[e.id,[]])),o=new Map(n.map(e=>[e.id,[]])),s=new Map(n.map(e=>[e.id,0])),c=Ie(n);for(let e of i)a.get(e.target)?.push(e),o.get(e.source)?.push(e),s.set(e.target,(s.get(e.target)||0)+1);let l=n.filter(e=>s.get(e.id)===0),u=[];for(;l.length;){l.sort((e,t)=>c.get(e.id)-c.get(t.id));let e=l.shift();u.push(e);for(let t of o.get(e.id)||[]){let e=(s.get(t.target)||0)-1;s.set(t.target,e),e===0&&l.push(n.find(e=>e.id===t.target))}}let d=n.filter(e=>(a.get(e.id)||[]).length===0),f=d.find(e=>e.kind===`trigger`)||d[0];return{nodes:n,edges:i,incoming:a,outgoing:o,order:u,roots:d,unconnected:n.filter(e=>e.id!==f?.id&&(a.get(e.id)||[]).length===0),invalidTriggerTargets:n.filter(e=>e.kind===`trigger`&&(a.get(e.id)||[]).length>0),hasCycle:u.length!==n.length}}function ze(e,t,n,r,i=`output`){return Re(e,[...t,{id:`__candidate__`,source:n,sourcePort:i,target:r,targetPort:`input`}]).hasCycle}var Be={trigger:`触发器`,prompt:`任务`,skill:`Skill`,file:`文件`,mcp:`MCP`,notification:`通知`,condition:`判断`,parallel:`并行`,approval:`审批`},Ve=[{kind:`trigger`,label:`手动触发`,Icon:T},{kind:`prompt`,label:`运行 Prompt`,Icon:P},{kind:`skill`,label:`调用 Skill`,Icon:d},{kind:`file`,label:`读写文件`,Icon:b},{kind:`mcp`,label:`调用 MCP`,Icon:I},{kind:`condition`,label:`条件分支`,Icon:f},{kind:`parallel`,label:`并行汇合`,Icon:w},{kind:`approval`,label:`人工审批`,Icon:M},{kind:`notification`,label:`发送通知`,Icon:F}];function He(e,t){return t(e===`trigger`?`workflows:workflowsPage.triggerNode`:e===`skill`?`workflows:workflowsPage.skillNode`:e===`file`?`workflows:workflowsPage.fileNode`:e===`mcp`?`workflows:workflowsPage.mcpNode`:e===`notification`?`workflows:workflowsPage.notificationNode`:e===`condition`?`workflows:workflowsPage.conditionNode`:e===`parallel`?`workflows:workflowsPage.parallelNode`:e===`approval`?`workflows:workflowsPage.approvalNode`:`workflows:workflowsPage.task`)}function Ue(e,t){return t(e===`trigger`?`workflows:workflowsPage.manualTrigger`:e===`skill`?`workflows:workflowsPage.callSkill`:e===`file`?`workflows:workflowsPage.readWriteFiles`:e===`mcp`?`workflows:workflowsPage.callMcp`:e===`condition`?`workflows:workflowsPage.conditionBranch`:e===`parallel`?`workflows:workflowsPage.parallelJoin`:e===`approval`?`workflows:workflowsPage.humanApproval`:e===`notification`?`workflows:workflowsPage.sendNotification`:`workflows:workflowsPage.runPrompt`)}function We(e,t){return t(e===`pr-fix`?`workflows:workflowsPage.prFix`:e===`research`?`workflows:workflowsPage.research`:e===`report`?`workflows:workflowsPage.dailyWeeklyReport`:e===`asset`?`workflows:workflowsPage.assetGeneration`:e===`release`?`workflows:workflowsPage.releasePreparation`:`workflows:workflowsPage.codeReview`)}function Ge(e,t){return t(e===`pr-fix`?`workflows:workflowsPage.prFixDescription`:e===`research`?`workflows:workflowsPage.researchDescription`:e===`report`?`workflows:workflowsPage.reportDescription`:e===`asset`?`workflows:workflowsPage.assetDescription`:e===`release`?`workflows:workflowsPage.releaseDescription`:`workflows:workflowsPage.codeReviewDescription`)}function Z(e,t,n,r,i,a,o={}){return{id:e,kind:t,label:n,prompt:r,x:i,y:a,model:null,executionMode:`full-access`,retries:0,timeoutMinutes:20,failurePolicy:`stop`,enabled:!0,outputFormat:`text`,skillName:``,requestedToolNames:[],condition:{source:`previous`,operator:`exists`,value:``},approval:{message:``,timeoutMinutes:60},notification:{title:``,content:``},notificationTargets:[],...o}}function Ke(e){return Le(e,()=>crypto.randomUUID())}var qe=[{id:`code-review`,name:`代码审查`,description:`读取 diff → 运行测试 → 生成 review`,Icon:v,nodes:[Z(`review-trigger`,`trigger`,`手动触发`,``,65,45),Z(`review-diff`,`file`,`读取 diff`,`读取当前工作区的 git diff,识别改动范围与高风险文件。`,235,45),Z(`review-test`,`prompt`,`运行检查`,`运行适合当前项目的测试与 lint,记录失败原因。`,405,45),Z(`review-report`,`prompt`,`生成 review`,`结合 diff 和验证结果,输出按严重度排序的代码审查结论。`,235,180),Z(`review-notify`,`notification`,`发送结果`,``,405,180)]},{id:`pr-fix`,name:`PR 修复`,description:`定位失败 → 修改代码 → 回归测试`,Icon:f,nodes:[Z(`fix-trigger`,`trigger`,`手动触发`,``,65,45),Z(`fix-find`,`prompt`,`定位失败`,`检查项目状态与失败信息,定位最可能的根因。`,235,45),Z(`fix-code`,`prompt`,`修改代码`,`修复已定位的问题,保留用户已有改动,不执行破坏性命令。`,405,45),Z(`fix-test`,`prompt`,`回归测试`,`运行针对性测试和构建,确认修复没有引入回归。`,235,180),Z(`fix-notify`,`notification`,`通知结果`,``,405,180)]},{id:`research`,name:`资料调研`,description:`搜索资料 → 提取引用 → 点亮星忆`,Icon:de,nodes:[Z(`research-trigger`,`trigger`,`手动输入`,``,65,45),Z(`research-search`,`prompt`,`搜索资料`,`围绕工作流描述中的主题检索项目内资料与可用信息源。`,235,45),Z(`research-summary`,`prompt`,`整理引用`,`整理关键结论、证据、限制和下一步建议。`,405,45),Z(`research-memory`,`prompt`,`保存星忆`,`把适合长期保留的结论写入 Agent 记忆。`,320,180)]},{id:`report`,name:`日报周报`,description:`汇总会话 → 生成摘要 → 渠道通知`,Icon:x,nodes:[Z(`report-trigger`,`trigger`,`手动触发`,``,65,45),Z(`report-collect`,`prompt`,`汇总进展`,`汇总当前项目近期完成事项、风险与待办。`,235,45),Z(`report-write`,`prompt`,`生成报告`,`将汇总内容整理为清晰的日报或周报。`,405,45),Z(`report-notify`,`notification`,`渠道通知`,``,320,180)]},{id:`asset`,name:`资产生成`,description:`生成图片 → 存入资产库 → 通知验收`,Icon:S,nodes:[Z(`asset-trigger`,`trigger`,`手动输入`,``,65,45),Z(`asset-generate`,`prompt`,`生成视觉资产`,`根据工作流描述生成需要的视觉资产,并保存生成文件。`,235,45),Z(`asset-check`,`prompt`,`检查产物`,`检查生成资产是否完整、可访问并符合需求。`,405,45),Z(`asset-notify`,`notification`,`通知验收`,``,320,180)]},{id:`release`,name:`发布准备`,description:`版本检查 → changelog → 创建发布单`,Icon:me,nodes:[Z(`release-trigger`,`trigger`,`手动触发`,``,65,45),Z(`release-check`,`prompt`,`版本检查`,`检查工作区、测试、构建和版本信息是否满足发布要求。`,235,45),Z(`release-log`,`prompt`,`生成 changelog`,`根据近期提交和改动生成 changelog 与发布说明。`,405,45),Z(`release-report`,`prompt`,`发布清单`,`生成最终发布检查清单并标记阻塞项。`,320,180)]}];function Je(e=``){let t=[Z(crypto.randomUUID(),`trigger`,`手动触发`,``,65,45),Z(crypto.randomUUID(),`prompt`,`运行 Prompt`,``,235,45)];return{id:``,name:`未命名工作流`,description:``,status:`draft`,revision:1,cwd:e,model:null,inputs:[],tags:[],visibility:`private`,notifications:[],nodes:t,edges:Ke(t)}}function Ye(e,t=``){let n=e.nodes.map(e=>({...e,id:crypto.randomUUID()}));return{...Je(t),name:e.name,description:e.description,nodes:n,edges:Ke(n)}}function Xe({draft:e,selectedNodeId:t,selectedEdgeId:n,t:r,onAddNode:i,onConnect:a,onMoveNode:o,onSelectNode:s,onSelectEdge:c,onClearSelection:l,onDeleteNodes:u,onDeleteEdges:d}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] node-library [&_[data-slot='card-content']_>_div_>_small]:block [&_[data-slot='card-content']_>_div_>_small]:h-[15px] [&_[data-slot='card-content']_>_div_>_small]:text-[var(--text-muted)] [&_[data-slot='card-content']_>_div_>_small]:text-[13px] [&_[data-slot='card-content']_>_div_>_small]:font-[600] [&_[data-slot='card-content']_>_div_>_button]:grid [&_[data-slot='card-content']_>_div_>_button]:w-full [&_[data-slot='card-content']_>_div_>_button]:grid-cols-[auto_minmax(0,1fr)_auto] [&_[data-slot='card-content']_>_div_>_button]:items-center [&_[data-slot='card-content']_>_div_>_button]:gap-[7px] [&_[data-slot='card-content']_>_div_>_button]:border-0 [&_[data-slot='card-content']_>_div_>_button]:[border-top:1px_solid_var(--stroke-soft)] [&_[data-slot='card-content']_>_div_>_button]:bg-transparent [&_[data-slot='card-content']_>_div_>_button]:p-[8px_3px] [&_[data-slot='card-content']_>_div_>_button]:text-[var(--text)] [&_[data-slot='card-content']_>_div_>_button]:text-left [&_[data-slot='card-content']_>_div_>_button]:text-[12px] [&_[data-slot='card-content']_>_div_>_button]:cursor-grab [&_[data-slot='card-content']_>_div_>_button_span]:text-[var(--text-muted)] [&_[data-slot='card-content']_>_div_>_button_span]:text-[13px] max-[650px]:max-h-[220px] overflow-auto gap-0 py-0`,children:(0,X.jsxs)(B,{className:`p-3.5`,children:[(0,X.jsx)(z,{className:`workflow-section-title [.selection-list_&]:mb-[8px] [.node-library_&]:mb-[8px] text-[var(--text-soft)] text-[13px] font-[700] leading-[1.4]`,children:r(`workflows:workflowsPage.nodeLibrary`)}),Ve.map(({kind:e,label:t,Icon:n})=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`small`,{children:e===`trigger`?r(`workflows:workflowsPage.triggerGroup`):``}),(0,X.jsxs)(`button`,{draggable:!0,onDragStart:n=>n.dataTransfer.setData(`text/plain`,JSON.stringify({kind:e,label:t})),children:[(0,X.jsx)(n,{size:15}),Ue(e,r),(0,X.jsx)(`span`,{title:r(`workflows:workflowsPage.drag`),"aria-label":r(`workflows:workflowsPage.drag`),children:(0,X.jsx)(De,{size:13})})]})]},e))]})}),(0,X.jsx)(H,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] builder-canvas relative min-h-[620px] overflow-hidden p-0 !bg-[var(--canvas-bg)] dark:bg-[var(--canvas-bg)] max-[650px]:min-w-[620px] gap-0 py-0`,children:(0,X.jsx)(Fe,{nodes:e.nodes,edges:e.edges,selectedNodeId:t,selectedEdgeId:n,hint:r(`workflows:workflowsPage.dragFromANodeOutputToTheTargetInputToConnectThem`),inputLabel:r(`workflows:workflowsPage.inputPort`),outputLabel:r(`workflows:workflowsPage.outputPort`),nodeTypeLabel:e=>He(e,r),onAddNode:i,onConnect:a,onMoveNode:o,onSelectNode:s,onSelectEdge:c,onClearSelection:l,onDeleteNodes:u,onDeleteEdges:d})})]})}function Ze(e){let t=Math.max(0,Math.round((Number(e)||0)/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function Qe(e,t){return t(e===`running`?`workflows:workflowsPage.running`:e===`waiting_approval`?`workflows:workflowsPage.waitingApproval`:e===`completed`?`workflows:workflowsPage.completed`:e===`failed`?`workflows:workflowsPage.failed`:e===`cancelled`?`workflows:workflowsPage.stopped`:e===`interrupted`?`workflows:workflowsPage.interrupted`:`workflows:workflowsPage.draft`)}function $e({value:e,onChange:t,t:n}){return(0,X.jsx)(ue,{value:e,onValueChange:e=>t(e),children:(0,X.jsxs)(re,{className:`workflow-filter-list [&_[data-slot='tabs-trigger']]:min-w-[56px] [&_[data-slot='tabs-trigger']]:flex-none [&_[data-slot='tabs-trigger']]:[padding-inline:12px] [&_[data-slot='tabs-trigger']]:text-[12px] w-fit max-w-[100%] overflow-x-auto [scrollbar-width:none]`,children:[(0,X.jsx)(R,{value:`workflows`,children:n(`workflows:workflowsPage.workflows`)}),(0,X.jsx)(R,{value:`runs`,children:n(`workflows:workflowsPage.runHistory`)}),(0,X.jsx)(R,{value:`templates`,children:n(`workflows:workflowsPage.templates`)})]})})}function et({workflows:e,runs:t,busyId:n,language:r,t:i,onRun:a,onEdit:o,onDuplicate:s,onExport:l,onImport:u,onDelete:d}){let f=(0,Y.useRef)(null),p=e=>t.filter(t=>t.workflowId===e).sort((e,t)=>Date.parse(t.startedAt)-Date.parse(e.startedAt))[0];return(0,X.jsx)(H,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] workflow-assets-panel overflow-hidden gap-0 py-0`,children:(0,X.jsxs)(B,{className:`p-0`,children:[(0,X.jsxs)(`div`,{className:`workflow-table-head [&_>_div]:flex [&_>_div]:min-w-0 [&_>_div]:flex-col [&_>_div]:gap-[2px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] flex min-h-[58px] items-center justify-between gap-[12px] [border-bottom:1px_solid_var(--stroke-soft)] [padding:10px_14px]`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(z,{className:`workflow-section-title [.selection-list_&]:mb-[8px] [.node-library_&]:mb-[8px] text-[var(--text-soft)] text-[13px] font-[700] leading-[1.4]`,children:i(`workflows:workflowsPage.workflows`)}),(0,X.jsx)(`small`,{children:i(`workflows:workflowsPage.countWorkflows`,{count:e.length})})]}),(0,X.jsxs)(c,{size:`sm`,variant:`outline`,onClick:()=>f.current?.click(),children:[(0,X.jsx)(Ee,{"data-icon":`inline-start`}),i(`workflows:workflowsPage.import`)]}),(0,X.jsx)(`input`,{ref:f,className:`sr-only`,type:`file`,accept:`application/json,.json`,onChange:async e=>{let t=e.target.files?.[0];if(t)try{u(JSON.parse(await t.text()))}catch{u(null)}finally{e.currentTarget.value=``}}})]}),e.length?(0,X.jsx)(`div`,{className:`flex flex-col`,children:e.map(e=>{let t=p(e.id),u=[`running`,`waiting_approval`].includes(t?.status||``);return(0,X.jsxs)(`div`,{className:`workflow-asset-row first:[border-top:0] max-[650px]:grid-cols-[minmax(0,1fr)_92px] max-[650px]:gap-[8px_12px] max-[650px]:[padding-block:10px] grid min-h-[62px] grid-cols-[minmax(220px,1fr)_110px_150px_auto] items-center gap-[14px] [border-top:1px_solid_var(--stroke-soft)] [padding:8px_12px_8px_14px]`,children:[(0,X.jsxs)(`button`,{className:`workflow-asset-main [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:overflow-hidden [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] flex min-w-0 flex-col gap-[3px] border-0 bg-transparent text-[var(--text)] text-left cursor-pointer`,onClick:()=>o(e.id),children:[(0,X.jsx)(`strong`,{children:e.name}),(0,X.jsx)(`small`,{children:e.description||e.cwd})]}),(0,X.jsxs)(`span`,{className:`workflow-state [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:text-[10px] [&_small]:font-[400] [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&.running]:text-[var(--warning-strong)] [&.waiting_approval]:text-[var(--warning-strong)] [&.completed]:text-[var(--success)] [&.published]:text-[var(--success)] [&.failed]:text-[var(--danger)] max-[650px]:[.workflow-asset-row_>_&:nth-of-type(2)]:[grid-column:1] flex min-w-0 flex-col gap-[2px] text-[var(--text-secondary)] text-[11px] font-[600] ${e.status}`,children:[e.status===`published`?i(`workflows:workflowsPage.published`):i(`workflows:workflowsPage.draft`),(0,X.jsxs)(`small`,{children:[`v`,e.revision]})]}),(0,X.jsxs)(`span`,{className:`workflow-state [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:text-[10px] [&_small]:font-[400] [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&.running]:text-[var(--warning-strong)] [&.waiting_approval]:text-[var(--warning-strong)] [&.completed]:text-[var(--success)] [&.published]:text-[var(--success)] [&.failed]:text-[var(--danger)] max-[650px]:[.workflow-asset-row_>_&:nth-of-type(2)]:[grid-column:1] flex min-w-0 flex-col gap-[2px] text-[var(--text-secondary)] text-[11px] font-[600] ${t?.status||`idle`}`,children:[t?Qe(t.status,i):i(`workflows:workflowsPage.neverRun`),(0,X.jsx)(`small`,{children:t?N(t.startedAt,r):e.visibility})]}),(0,X.jsxs)(`div`,{className:`workflow-row-actions max-[650px]:[grid-column:2] max-[650px]:[grid-row:1/3] max-[650px]:flex-wrap flex items-center justify-end gap-[3px]`,children:[(0,X.jsx)(c,{size:`icon-xs`,variant:u?`secondary`:`outline`,disabled:u||n===e.id,title:i(`workflows:workflowsPage.run`),"aria-label":`${i(`workflows:workflowsPage.run`)}: ${e.name}`,onClick:()=>a(e),children:n===e.id?(0,X.jsx)(L,{className:`animate-spin`}):(0,X.jsx)(D,{fill:`currentColor`})}),(0,X.jsx)(c,{size:`icon-xs`,variant:`ghost`,title:i(`workflows:workflowsPage.edit`),"aria-label":`${i(`workflows:workflowsPage.edit`)}: ${e.name}`,onClick:()=>o(e.id),children:(0,X.jsx)(E,{})}),(0,X.jsx)(c,{size:`icon-xs`,variant:`ghost`,title:i(`workflows:workflowsPage.duplicateWorkflow`),"aria-label":`${i(`workflows:workflowsPage.duplicateWorkflow`)}: ${e.name}`,onClick:()=>s(e),children:(0,X.jsx)(y,{})}),(0,X.jsx)(c,{size:`icon-xs`,variant:`ghost`,title:i(`workflows:workflowsPage.export`),"aria-label":`${i(`workflows:workflowsPage.export`)}: ${e.name}`,onClick:()=>l(e),children:(0,X.jsx)(oe,{})}),(0,X.jsx)(c,{size:`icon-xs`,variant:`ghost`,disabled:u,title:i(`workflows:workflowsPage.delete`),"aria-label":`${i(`workflows:workflowsPage.delete`)}: ${e.name}`,onClick:()=>d(e),children:(0,X.jsx)(A,{})})]})]},e.id)})}):(0,X.jsx)(`div`,{className:`channel-route-empty [&_strong]:mt-[9px] [&_strong]:text-[var(--text)] [&_strong]:text-[12px] [&_span]:mt-[4px] [&_span]:text-[13px] [&.compact]:min-h-[110px] [.workflow-assets-panel_&]:min-h-[150px] [.workflow-assets-panel_&]:border-0 [.workflow-assets-panel_&]:bg-transparent grid min-h-[185px] place-content-center justify-items-center text-[var(--text-muted)] text-center compact`,children:(0,X.jsx)(`strong`,{children:i(`workflows:workflowsPage.noMatchingWorkflows`)})})]})})}function tt({runs:e,busyId:t,language:n,t:r,onStop:i,onRetry:a,onApproval:o}){let[s,l]=(0,Y.useState)(e[0]?.id||``),u=[...e].sort((e,t)=>Date.parse(t.startedAt)-Date.parse(e.startedAt));return(0,X.jsxs)(`div`,{className:`flex flex-col gap-[8px]`,children:[u.map(e=>{let u=s===e.id,d=Math.round((Number(e.completedNodes)||0)/Math.max(1,Number(e.totalNodes)||1)*100);return(0,X.jsx)(H,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] overflow-hidden gap-0 py-0`,children:(0,X.jsxs)(B,{className:`p-0`,children:[(0,X.jsxs)(`button`,{className:`workflow-run-summary hover:bg-[var(--surface-hover)] [&_>_span]:flex [&_>_span]:min-w-0 [&_>_span]:flex-col [&_>_span]:gap-[2px] [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:overflow-hidden [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] [&_small]:[font-style:normal] [&_em]:text-[var(--text-muted)] [&_em]:text-[11px] [&_em]:[font-style:normal] [&_[data-slot='progress']]:h-[5px] max-[650px]:grid-cols-[18px_minmax(0,1fr)_54px] max-[650px]:gap-[8px] max-[650px]:[&_[data-slot='progress']]:[grid-column:2/4] grid w-full min-h-[58px] grid-cols-[18px_minmax(180px,1fr)_minmax(120px,240px)_70px] items-center gap-[12px] border-0 bg-transparent [padding:9px_14px] text-[var(--text)] text-left cursor-pointer`,onClick:()=>l(u?``:e.id),children:[u?(0,X.jsx)(_,{size:15}):(0,X.jsx)(ae,{size:15}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:e.workflowName||e.workflowId}),(0,X.jsxs)(`small`,{children:[Qe(e.status,r),` · `,N(e.startedAt,n),` · v`,e.workflowRevision||1]})]}),(0,X.jsx)(m,{value:e.status===`completed`?100:d}),(0,X.jsx)(`em`,{children:Ze(e.durationMs)})]}),u&&(0,X.jsxs)(`div`,{className:`workflow-run-detail max-[650px]:pl-[14px] flex flex-col gap-[10px] [border-top:1px_solid_var(--stroke-soft)] [padding:12px_14px_14px_44px]`,children:[(e.summary||e.error)&&(0,X.jsx)(`div`,{className:`workflow-run-result [&.failed]:border-[var(--danger)] [&.failed]:text-[var(--danger)] [border-left:2px_solid_var(--success)] [padding:4px_8px] text-[var(--text-secondary)] text-[12px] whitespace-pre-wrap ${e.error?`failed`:``}`,children:e.error||e.summary}),(0,X.jsx)(`div`,{className:`flex flex-col`,children:(e.nodes||[]).map(n=>(0,X.jsxs)(`div`,{className:`workflow-run-node first:[border-top:0] [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:min-w-0 [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[2px] [&_strong]:text-[12px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] [&_p]:text-[var(--text-muted)] [&_p]:text-[11px] [&_p]:mt-[3px] [&_p]:whitespace-pre-wrap max-[650px]:grid-cols-[18px_minmax(0,1fr)] max-[650px]:[&_>_div]:[grid-column:2] grid min-h-[46px] grid-cols-[20px_minmax(0,1fr)_auto] items-center gap-[8px] [border-top:1px_solid_var(--stroke-soft)] [padding:6px_0] ${n.status}`,children:[(0,X.jsx)(`span`,{className:`workflow-node-status [.workflow-run-node.completed_&]:text-[var(--success)] [.workflow-run-node.failed_&]:text-[var(--danger)] grid place-items-center text-[var(--text-muted)]`,children:n.status===`completed`?(0,X.jsx)(g,{size:14}):n.status===`failed`?(0,X.jsx)(p,{size:14}):n.status===`running`||n.status===`waiting_approval`?(0,X.jsx)(L,{className:n.status===`running`?`animate-spin`:``,size:14}):(0,X.jsx)(k,{size:12})}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:n.label}),(0,X.jsxs)(`small`,{children:[Qe(n.status,r),` · `,Ze(n.durationMs),` ·`,` `,r(`workflows:workflowsPage.countAttempts`,{count:n.attempts||0})]}),(n.error||n.summary)&&(0,X.jsx)(`p`,{children:n.error||n.summary})]}),n.status===`waiting_approval`&&(0,X.jsxs)(`div`,{className:`workflow-approval-actions flex gap-[6px]`,children:[(0,X.jsxs)(c,{size:`xs`,disabled:t===n.id,onClick:()=>o(e,n.id,!0),children:[(0,X.jsx)(g,{"data-icon":`inline-start`}),r(`workflows:workflowsPage.approve`)]}),(0,X.jsxs)(c,{size:`xs`,variant:`destructive`,disabled:t===n.id,onClick:()=>o(e,n.id,!1),children:[(0,X.jsx)(p,{"data-icon":`inline-start`}),r(`workflows:workflowsPage.reject`)]})]})]},n.id))}),(0,X.jsx)(`div`,{className:`workflow-run-detail-actions flex gap-[6px]`,children:[`running`,`waiting_approval`].includes(e.status)?(0,X.jsxs)(c,{size:`sm`,variant:`destructive`,onClick:()=>i(e),children:[(0,X.jsx)(k,{"data-icon":`inline-start`}),r(`workflows:workflowsPage.stop`)]}):[`failed`,`cancelled`,`interrupted`].includes(e.status)?(0,X.jsxs)(c,{size:`sm`,variant:`outline`,onClick:()=>a(e),children:[(0,X.jsx)(L,{"data-icon":`inline-start`}),r(`workflows:workflowsPage.retryRun`)]}):null})]})]})},e.id)}),!u.length&&(0,X.jsx)(le,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)]`,children:(0,X.jsx)(`strong`,{children:r(`workflows:workflowsPage.noRunHistory`)})})]})}function nt({t:e,onOpenTemplate:t}){return(0,X.jsx)(`div`,{className:`workflow-template-gallery [&_>_button]:grid [&_>_button]:min-h-[72px] [&_>_button]:grid-cols-[34px_minmax(0,1fr)_18px] [&_>_button]:items-center [&_>_button]:gap-[10px] [&_>_button]:[border:1px_solid_var(--stroke)] [&_>_button]:rounded-[var(--r-sm)] [&_>_button]:bg-[var(--panel)] [&_>_button]:p-[11px] [&_>_button]:text-[var(--text)] [&_>_button]:text-left [&_>_button]:cursor-pointer [&_>_button:hover]:border-[var(--accent-border)] [&_>_button:hover]:bg-[var(--surface-hover)] [&_button_>_span:nth-child(2)]:flex [&_button_>_span:nth-child(2)]:min-w-0 [&_button_>_span:nth-child(2)]:flex-col [&_button_>_span:nth-child(2)]:gap-[3px] [&_strong]:text-[13px] [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] [&_small]:text-ellipsis [&_small]:whitespace-nowrap max-[650px]:grid-cols-[1fr] grid grid-cols-[repeat(2,minmax(0,1fr))] gap-[8px]`,children:qe.map(n=>{let r=n.Icon;return(0,X.jsxs)(`button`,{onClick:()=>t(n.id),children:[(0,X.jsx)(`span`,{className:`list-icon [.chat-resource-list_&]:grid [.chat-resource-list_&]:w-[28px] [.chat-resource-list_&]:h-[28px] [.chat-resource-list_&]:place-items-center [.chat-resource-list_&]:rounded-[var(--r-sm)] [.chat-resource-list_&]:bg-[var(--surface-subtle)] [.chat-resource-list_&]:text-[var(--star-strong)] [.session-workflow-summary_&]:grid [.session-workflow-summary_&]:w-[28px] [.session-workflow-summary_&]:h-[28px] [.session-workflow-summary_&]:place-items-center [.session-workflow-summary_&]:rounded-[var(--r-sm)] [.session-workflow-summary_&]:bg-[var(--surface-subtle)] [.session-workflow-summary_&]:text-[var(--star-strong)] grid w-[27px] h-[27px] place-items-center rounded-[var(--r-sm)] bg-[var(--accent-soft)] text-[var(--star-strong)] [.workflow-template-gallery_&]:grid [.workflow-template-gallery_&]:w-[32px] [.workflow-template-gallery_&]:h-[32px] [.workflow-template-gallery_&]:place-items-center [.workflow-template-gallery_&]:rounded-[var(--r-sm)] [.workflow-template-gallery_&]:bg-[var(--surface-subtle)] [.workflow-template-gallery_&]:text-[var(--star-strong)]`,children:(0,X.jsx)(r,{size:16})}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:We(n.id,e)}),(0,X.jsx)(`small`,{children:Ge(n.id,e)})]}),(0,X.jsx)(ae,{size:15})]},n.id)})})}function rt({data:e,t}){let n=e.runs.filter(e=>e.status===`failed`).length,r=e.runs.filter(e=>e.status===`waiting_approval`).length,i=e.runs.filter(e=>e.status===`completed`),a=i.length?i.reduce((e,t)=>e+(t.durationMs||0),0)/i.length:0;return(0,X.jsxs)(`div`,{className:`workflow-operations-strip [&_>_span]:inline-flex [&_>_span]:[align-items:baseline] [&_>_span]:gap-[5px] [&_>_span]:text-[var(--text-muted)] [&_>_span]:text-[11px] [&_>_span]:whitespace-nowrap [&_strong]:text-[var(--text)] [&_strong]:text-[13px] [&_strong]:[font-variant-numeric:tabular-nums] max-[650px]:justify-between max-[650px]:gap-[6px] max-[650px]:overflow-x-auto max-[650px]:[&_>_span]:flex-col max-[650px]:[&_>_span]:gap-[0] flex min-w-0 items-center gap-[18px]`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:e.limits.running}),t(`workflows:workflowsPage.running`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:r}),t(`workflows:workflowsPage.waitingApproval`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:n}),t(`workflows:workflowsPage.failed`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:Ze(a)}),t(`workflows:workflowsPage.averageDuration`)]})]})}function Q({className:e,...t}){return(0,X.jsx)(`textarea`,{"data-slot":`textarea`,className:h(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function it(e){let t=Math.max(0,Math.round((Number(e)||0)/1e3));return t<60?`${t} 秒`:`${Math.floor(t/60)} 分 ${t%60} 秒`}function at({run:e,t}){return(0,X.jsxs)(ne,{role:`status`,children:[(0,X.jsx)(L,{className:`animate-spin`,size:16}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:t(`workflows:workflowsPage.workflowRunning`)}),(0,X.jsx)(`small`,{children:t(`workflows:workflowsPage.runningNodeCompletedTotalCompleted`,{node:e.currentNodeLabel||t(`workflows:workflowsPage.preparing`),completed:e.completedNodes,total:e.totalNodes})})]})]})}function ot({run:e,language:t,t:n}){return(0,X.jsx)(H,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] gap-0 py-0`,children:(0,X.jsxs)(B,{className:`p-3.5`,children:[(0,X.jsx)(z,{className:`workflow-section-title [.selection-list_&]:mb-[8px] [.node-library_&]:mb-[8px] text-[var(--text-soft)] text-[13px] font-[700] leading-[1.4]`,children:n(`workflows:workflowsPage.latestRun`)}),e?(0,X.jsxs)(`div`,{className:`activity-row [&_span]:flex [&_span]:min-w-0 [&_span]:flex-col [&_span]:gap-[3px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_span]:text-[var(--text)] [&.failed]:text-[var(--danger)] [&.running]:text-[var(--star-strong)] grid grid-cols-[auto_minmax(0,1fr)] items-center gap-[9px] [border-top:1px_solid_var(--stroke-soft)] [padding:9px_2px] text-[var(--success)] ${e.status}`,children:[e.status===`running`?(0,X.jsx)(L,{className:`animate-spin`,size:15}):e.status===`completed`?(0,X.jsx)(M,{size:15}):(0,X.jsx)(V,{size:15}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:e.status===`completed`?e.summary||n(`workflows:workflowsPage.workflowCompleted`):e.status===`running`?e.currentNodeLabel||n(`workflows:workflowsPage.running`):e.error||n(`workflows:workflowsPage.workflowFailed`)}),(0,X.jsxs)(`small`,{children:[N(e.startedAt,t),` · `,it(e.durationMs)]})]})]}):(0,X.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-muted)] text-[12px] leading-[1.55]`,children:n(`workflows:workflowsPage.noRunHistory`)})]})})}var st={browser:{Icon:F},feishu:{Icon:P},weixin:{Icon:C},qq:{Icon:C},telegram:{Icon:O}},ct=[`workspace-write`,`full-access`];function lt(e,t){return t(e===`workspace-write`?`workflows:workflowsPage.workspaceWrite`:`workflows:workflowsPage.fullAccess`)}function ut(e,t){return t(e===`workspace-write`?`workflows:workflowsPage.workspaceWriteHelp`:`workflows:workflowsPage.fullAccessHelp`)}function dt(e,t){return t(e===`feishu`?`workflows:workflowsPage.feishu`:e===`weixin`?`workflows:workflowsPage.weChat`:e===`qq`?`workflows:workflowsPage.qq`:e===`telegram`?`workflows:workflowsPage.telegram`:`workflows:workflowsPage.browserNotification`)}function ft({draft:e,catalog:t,t:n,onUpdateDraft:r}){return(0,X.jsx)(H,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] gap-0 py-0`,children:(0,X.jsxs)(B,{className:`p-3.5`,children:[(0,X.jsx)(z,{className:`workflow-section-title [.selection-list_&]:mb-[8px] [.node-library_&]:mb-[8px] text-[var(--text-soft)] text-[13px] font-[700] leading-[1.4]`,children:n(`workflows:workflowsPage.workflowSettings`)}),(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.name`),(0,X.jsx)(j,{value:e.name,onChange:e=>r({name:e.target.value})})]}),(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.description`),(0,X.jsx)(Q,{value:e.description,onChange:e=>r({description:e.target.value})})]}),(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.workingDirectory`),(0,X.jsx)(j,{value:e.cwd,onChange:e=>r({cwd:e.target.value})})]}),(0,X.jsxs)(`div`,{className:`form-grid grid gap-[9px] three [.form-grid&]:grid-cols-[repeat(3,minmax(0,1fr))] max-[650px]:[.form-grid&]:grid-cols-[1fr]`,children:[(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.visibility`),(0,X.jsxs)(u,{value:e.visibility,onChange:e=>r({visibility:e.target.value===`shared`?`shared`:`private`}),children:[(0,X.jsx)(`option`,{value:`private`,children:n(`workflows:workflowsPage.private`)}),(0,X.jsx)(`option`,{value:`shared`,children:n(`workflows:workflowsPage.shared`)})]})]}),(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.tags`),(0,X.jsx)(j,{value:e.tags.join(`, `),onChange:e=>r({tags:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)})})]}),(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.revision`),(0,X.jsx)(j,{value:`v${e.revision}`,disabled:!0})]})]}),(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.defaultModel`),(0,X.jsxs)(u,{value:e.model?`${e.model.provider}/${e.model.model}`:``,onChange:e=>{let n=t.models.find(t=>`${t.provider}/${t.model}`===e.target.value);r({model:n?{provider:n.provider,model:n.model}:null})},children:[(0,X.jsx)(`option`,{value:``,children:n(`workflows:workflowsPage.useSystemDefault`)}),t.models.map(e=>(0,X.jsx)(`option`,{value:`${e.provider}/${e.model}`,children:e.label},`${e.provider}/${e.model}`))]})]}),(0,X.jsxs)(`div`,{className:`workflow-inputs-editor`,children:[(0,X.jsxs)(se,{children:[(0,X.jsx)(`strong`,{children:n(`workflows:workflowsPage.inputParameters`)}),(0,X.jsx)(c,{size:`icon-xs`,variant:`ghost`,title:n(`workflows:workflowsPage.addInput`),onClick:()=>r({inputs:[...e.inputs,{id:crypto.randomUUID(),name:`input_${e.inputs.length+1}`,label:n(`workflows:workflowsPage.newInput`),type:`string`,required:!1,defaultValue:``,description:``}]}),children:(0,X.jsx)(pe,{})})]}),e.inputs.map(t=>(0,X.jsxs)(`div`,{className:`workflow-input-row`,children:[(0,X.jsx)(j,{value:t.name,"aria-label":n(`workflows:workflowsPage.parameterName`),onChange:n=>r({inputs:e.inputs.map(e=>e.id===t.id?{...e,name:n.target.value}:e)})}),(0,X.jsxs)(u,{value:t.type,"aria-label":n(`workflows:workflowsPage.parameterType`),onChange:n=>r({inputs:e.inputs.map(e=>e.id===t.id?{...e,type:n.target.value}:e)}),children:[(0,X.jsx)(`option`,{value:`string`,children:`String`}),(0,X.jsx)(`option`,{value:`text`,children:`Text`}),(0,X.jsx)(`option`,{value:`number`,children:`Number`}),(0,X.jsx)(`option`,{value:`boolean`,children:`Boolean`})]}),(0,X.jsxs)(`label`,{className:`workflow-required-input`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:t.required,onChange:n=>r({inputs:e.inputs.map(e=>e.id===t.id?{...e,required:n.target.checked}:e)})}),n(`workflows:workflowsPage.required`)]}),(0,X.jsx)(c,{size:`icon-xs`,variant:`ghost`,title:n(`workflows:workflowsPage.delete`),onClick:()=>r({inputs:e.inputs.filter(e=>e.id!==t.id)}),children:(0,X.jsx)(A,{})})]},t.id))]})]})})}function pt({node:e,catalog:t,t:n,systemNotificationPermission:r,onUpdateNode:i,onToggleNotification:a,onOpenChannels:o,onOpenSystemNotificationSettings:s}){let l=[`feishu`,`weixin`,`qq`,`telegram`].some(e=>t.notificationTargets[e]?.enabled),u=r==="default"||r===`granted`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.notificationTitle`),(0,X.jsx)(j,{value:e.notification.title,onChange:t=>i({notification:{...e.notification,title:t.target.value}}),placeholder:`{{workflow.name}}`})]}),(0,X.jsxs)(W,{variant:`control`,children:[n(`workflows:workflowsPage.notificationContent`),(0,X.jsx)(Q,{value:e.notification.content,onChange:t=>i({notification:{...e.notification,content:t.target.value}}),placeholder:`{{inputs.name}} · {{previous.summary}}`})]}),(0,X.jsx)(`strong`,{className:`block [margin-top:12px] text-[var(--text-secondary)] text-[12px]`,children:n(`workflows:workflowsPage.notificationChannels`)}),!l&&(0,X.jsxs)(K,{className:`workflow-notification-alert [&_[data-slot='alert-description']]:flex [&_[data-slot='alert-description']]:items-center [&_[data-slot='alert-description']]:gap-[4px] [&_[data-slot='alert-description']]:text-[11px] [&_[data-slot='alert-description']]:leading-[1.4] [margin:10px_0_6px] [border-color:color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_7%,var(--card))] text-[var(--text-secondary)]`,children:[(0,X.jsx)(V,{}),(0,X.jsxs)(G,{children:[n(`workflows:workflowsPage.noExternalNotificationChannelsEnabled`),(0,X.jsx)(c,{type:`button`,variant:`link`,size:`sm`,onClick:o,children:n(`workflows:workflowsPage.openChannelSettings`)})]})]}),(r===`denied`||r===`unsupported`)&&(0,X.jsxs)(K,{className:`workflow-notification-alert [&_[data-slot='alert-description']]:flex [&_[data-slot='alert-description']]:items-center [&_[data-slot='alert-description']]:gap-[4px] [&_[data-slot='alert-description']]:text-[11px] [&_[data-slot='alert-description']]:leading-[1.4] [margin:10px_0_6px] [border-color:color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_7%,var(--card))] text-[var(--text-secondary)]`,children:[(0,X.jsx)(V,{}),(0,X.jsxs)(G,{children:[n(r===`unsupported`?`workflows:workflowsPage.systemNotificationsUnsupported`:`workflows:workflowsPage.systemNotificationPermissionRequired`),(0,X.jsx)(c,{type:`button`,variant:`link`,size:`sm`,onClick:s,children:n(`workflows:workflowsPage.openSystemNotificationSettings`)})]})]}),Object.entries(st).map(([i,o])=>{let s=o.Icon,c=i===`browser`?u:!!t.notificationTargets[i]?.enabled;return(0,X.jsxs)(`div`,{className:`toggle-line [&_>_span]:flex [&_>_span]:items-center [&_>_span]:gap-[7px] [&_>_span]:text-[12px] flex min-h-[34px] items-center justify-between [border-top:1px_solid_var(--stroke-soft)]`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(s,{size:15}),dt(i,n)]}),(0,X.jsx)(ce,{checked:c&&(i!==`browser`||r===`granted`&&t.notificationTargets.browser.enabled)&&e.notificationTargets.includes(i),disabled:!c,"aria-label":dt(i,n),title:i===`browser`?c?t.notificationTargets.browser.enabled?n(`workflows:workflowsPage.systemNotificationsEnabled`):n(`workflows:workflowsPage.systemNotificationReady`):n(`workflows:workflowsPage.systemNotificationPermissionRequired`):n(c?`workflows:workflowsPage.notificationChannelEnabled`:`workflows:workflowsPage.notificationChannelNotEnabled`),onCheckedChange:()=>void a(i)})]},i)})]})}function mt({edge:e,nodes:t,t:n,onDelete:r}){let i=new Map(t.map(e=>[e.id,e]));return(0,X.jsx)(H,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] gap-0 py-0`,children:(0,X.jsxs)(B,{className:`p-3.5`,children:[(0,X.jsx)(z,{className:`workflow-section-title [.selection-list_&]:mb-[8px] [.node-library_&]:mb-[8px] text-[var(--text-soft)] text-[13px] font-[700] leading-[1.4]`,children:n(`workflows:workflowsPage.selectedConnection`)}),(0,X.jsxs)(`div`,{className:`workflow-edge-summary [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_span]:text-[var(--text-muted)] grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-[8px] [margin:10px_0]`,children:[(0,X.jsx)(`strong`,{children:i.get(e.source)?.label||n(`workflows:workflowsPage.unknownNode`)}),(0,X.jsx)(`span`,{children:`→`}),(0,X.jsx)(`strong`,{children:i.get(e.target)?.label||n(`workflows:workflowsPage.unknownNode`)})]}),(0,X.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-muted)] text-[12px] leading-[1.55]`,children:n(`workflows:workflowsPage.pressDeleteOrBackspaceToRemoveThisConnection`)}),(0,X.jsxs)(c,{size:`sm`,variant:`destructive`,onClick:r,children:[(0,X.jsx)(A,{"data-icon":`inline-start`}),n(`workflows:workflowsPage.deleteConnection`)]})]})})}function ht({node:e,selectedEdge:t,catalog:n,t:r,onUpdateNode:i,systemNotificationPermission:a,onToggleNotification:o,onCopy:s,onDelete:l,onOpenChannels:d,onOpenSystemNotificationSettings:f}){return(0,X.jsx)(H,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] gap-0 py-0`,children:(0,X.jsxs)(B,{className:`p-3.5`,children:[(0,X.jsx)(z,{className:`workflow-section-title [.selection-list_&]:mb-[8px] [.node-library_&]:mb-[8px] text-[var(--text-soft)] text-[13px] font-[700] leading-[1.4]`,children:r(`workflows:workflowsPage.selectedNode`)}),e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.nodeName`),(0,X.jsx)(j,{value:e.label,onChange:e=>i({label:e.target.value})})]}),(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.nodeModel`),(0,X.jsxs)(u,{value:e.model?`${e.model.provider}/${e.model.model}`:``,onChange:e=>{let t=n.models.find(t=>`${t.provider}/${t.model}`===e.target.value);i({model:t?{provider:t.provider,model:t.model}:null})},children:[(0,X.jsx)(`option`,{value:``,children:r(`workflows:workflowsPage.inheritWorkflowDefaultModel`)}),n.models.map(e=>(0,X.jsx)(`option`,{value:`${e.provider}/${e.model}`,children:e.label},`${e.provider}/${e.model}`))]})]}),(0,X.jsxs)(`div`,{className:`form-grid grid gap-[9px] three [.form-grid&]:grid-cols-[repeat(3,minmax(0,1fr))] max-[650px]:[.form-grid&]:grid-cols-[1fr]`,children:[(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.retryCount`),(0,X.jsx)(j,{type:`number`,min:`0`,max:`3`,value:e.retries,onChange:e=>i({retries:Number(e.target.value)})})]}),(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.timeoutMinutes`),(0,X.jsx)(j,{type:`number`,min:`1`,max:`240`,value:e.timeoutMinutes,onChange:e=>i({timeoutMinutes:Number(e.target.value)})})]}),(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.failureHandling`),(0,X.jsxs)(u,{value:e.failurePolicy,onChange:e=>i({failurePolicy:e.target.value===`skip`?`skip`:`stop`}),children:[(0,X.jsx)(`option`,{value:`stop`,children:r(`workflows:workflowsPage.stopImmediately`)}),(0,X.jsx)(`option`,{value:`skip`,children:r(`workflows:workflowsPage.skipThisNode`)})]})]})]}),[`prompt`,`skill`,`file`,`mcp`].includes(e.kind)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.executionMode`),(0,X.jsx)(u,{value:e.executionMode,onChange:e=>i({executionMode:e.target.value}),children:ct.map(e=>(0,X.jsx)(`option`,{value:e,children:lt(e,r)},e))}),(0,X.jsx)(`small`,{children:ut(e.executionMode,r)})]}),e.kind===`skill`&&(0,X.jsxs)(W,{variant:`control`,children:[`Skill`,(0,X.jsxs)(u,{value:e.skillName,onChange:e=>i({skillName:e.target.value}),children:[(0,X.jsx)(`option`,{value:``,children:r(`workflows:workflowsPage.chooseSkill`)}),n.skills.map(e=>(0,X.jsx)(`option`,{value:e.name,children:e.name},e.id))]})]}),e.kind===`mcp`&&(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.mcpToolNames`),(0,X.jsx)(j,{value:e.requestedToolNames.join(`, `),onChange:e=>i({requestedToolNames:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)}),placeholder:`server.tool_name`})]}),(0,X.jsxs)(W,{variant:`control`,children:[`Prompt`,(0,X.jsx)(Q,{value:e.prompt,onChange:e=>i({prompt:e.target.value}),placeholder:r(`workflows:workflowsPage.describeTheWorkTheAgentShouldCompleteInThisNode`)})]}),(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.outputFormat`),(0,X.jsxs)(u,{value:e.outputFormat,onChange:e=>i({outputFormat:e.target.value===`json`?`json`:`text`}),children:[(0,X.jsx)(`option`,{value:`text`,children:`Text`}),(0,X.jsx)(`option`,{value:`json`,children:`JSON`})]})]})]}),e.kind===`condition`&&(0,X.jsxs)(`div`,{className:`form-grid grid gap-[9px] three [.form-grid&]:grid-cols-[repeat(3,minmax(0,1fr))] max-[650px]:[.form-grid&]:grid-cols-[1fr]`,children:[(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.dataPath`),(0,X.jsx)(j,{value:e.condition.source,onChange:t=>i({condition:{...e.condition,source:t.target.value}}),placeholder:`inputs.approved`})]}),(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.operator`),(0,X.jsx)(u,{value:e.condition.operator,onChange:t=>i({condition:{...e.condition,operator:t.target.value}}),children:[`exists`,`not_exists`,`equals`,`not_equals`,`contains`,`greater_than`,`less_than`].map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})]}),(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.comparisonValue`),(0,X.jsx)(j,{value:String(e.condition.value??``),onChange:t=>i({condition:{...e.condition,value:t.target.value}})})]})]}),e.kind===`notification`&&(0,X.jsx)(pt,{node:e,catalog:n,t:r,systemNotificationPermission:a,onUpdateNode:i,onToggleNotification:o,onOpenChannels:d,onOpenSystemNotificationSettings:f}),e.kind===`approval`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.approvalMessage`),(0,X.jsx)(Q,{value:e.approval.message,onChange:t=>i({approval:{...e.approval,message:t.target.value}})})]}),(0,X.jsxs)(W,{variant:`control`,children:[r(`workflows:workflowsPage.approvalTimeout`),(0,X.jsx)(j,{type:`number`,min:`1`,max:`10080`,value:e.approval.timeoutMinutes,onChange:t=>i({approval:{...e.approval,timeoutMinutes:Number(t.target.value)}})})]})]}),(0,X.jsxs)(`div`,{className:`mt-[15px] flex gap-2 max-[650px]:flex-wrap`,children:[(0,X.jsxs)(c,{size:`sm`,variant:`secondary`,onClick:s,children:[(0,X.jsx)(y,{"data-icon":`inline-start`}),r(`workflows:workflowsPage.duplicateNode`)]}),(0,X.jsxs)(c,{size:`sm`,variant:`destructive`,onClick:l,children:[(0,X.jsx)(A,{"data-icon":`inline-start`}),r(`workflows:workflowsPage.deleteNode`)]})]})]}):(0,X.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-muted)] text-[12px] leading-[1.55]`,children:r(t?`workflows:workflowsPage.aConnectionIsCurrentlySelected`:`workflows:workflowsPage.dragNodesFromTheLeftToStartBuildingTheWorkflow`)})]})})}function gt({draft:e,catalog:t,selectedNode:n,selectedEdge:r,currentRun:i,language:a,t:o,onUpdateDraft:s,onUpdateNode:c,systemNotificationPermission:l,onToggleNotification:u,onDeleteEdge:d,onCopyNode:f,onDeleteNode:p,onOpenChannels:m,onOpenSystemNotificationSettings:h}){return(0,X.jsxs)(`div`,{className:`detail-stack flex min-w-0 flex-col gap-[12px] [.mcp-layout_>_&]:min-h-0 max-[1150px]:[.memory-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.memory-layout_>_&]:grid max-[1150px]:[.memory-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.mcp-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.mcp-layout_>_&]:grid max-[1150px]:[.mcp-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.skills-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.skills-layout_>_&]:grid max-[1150px]:[.skills-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[650px]:[.memory-layout_>_&]:[grid-column:auto] max-[650px]:[.memory-layout_>_&]:grid-cols-[1fr] max-[650px]:[.mcp-layout_>_&]:[grid-column:auto] max-[650px]:[.mcp-layout_>_&]:grid-cols-[1fr] max-[650px]:[.skills-layout_>_&]:[grid-column:auto] max-[650px]:[.skills-layout_>_&]:grid-cols-[1fr] inspector !min-w-0 max-[1150px]:[.builder-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.builder-layout_>_&]:grid max-[1150px]:[.builder-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[900px]:[.builder-layout_>_&]:[grid-column:1/-1]`,children:[(0,X.jsx)(ft,{draft:e,catalog:t,t:o,onUpdateDraft:s}),r&&(0,X.jsx)(mt,{edge:r,nodes:e.nodes,t:o,onDelete:d}),(0,X.jsx)(ht,{node:n,selectedEdge:r,catalog:t,t:o,onUpdateNode:c,systemNotificationPermission:l,onToggleNotification:u,onCopy:f,onDelete:p,onOpenChannels:m,onOpenSystemNotificationSettings:h}),e.id&&(0,X.jsx)(ot,{run:i,language:a,t:o})]})}var _t={workflows:[],runs:[],limits:{maxConcurrent:4,running:0},notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1},qq:{enabled:!1},telegram:{enabled:!1}},models:[],skills:[],cwd:``};function $(e){return e instanceof Error?e.message:String(e)}function vt({notify:e,requestConfirm:t,query:n}){let{t:r}=l(),[i,a]=(0,Y.useState)(_t),[s,c]=(0,Y.useState)(`all`),[u,d]=(0,Y.useState)(!0),[f,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(``),g=(0,Y.useCallback)(async()=>{try{a(await o(`/api/workflows`)),h(``)}catch(e){h($(e))}finally{d(!1)}},[]);(0,Y.useEffect)(()=>{g()},[g]),(0,Y.useEffect)(()=>{let e=window.setInterval(()=>{g()},i.limits.running?1500:8e3);return()=>window.clearInterval(e)},[i.limits.running,g]);let _=(0,Y.useCallback)(e=>i.runs.filter(t=>t.workflowId===e).sort((e,t)=>Date.parse(t.startedAt)-Date.parse(e.startedAt))[0],[i.runs]);return{data:i,filter:s,setFilter:c,loading:u,busyId:f,error:m,visibleWorkflows:(0,Y.useMemo)(()=>i.workflows.filter(e=>{let t=_(e.id);return`${e.name} ${e.description}`.toLowerCase().includes(n.toLowerCase())?s===`running`?t?.status===`running`:s===`failed`?t?.status===`failed`:s===`draft`?e.status===`draft`:s!==`presets`:!1}),[i.workflows,s,_,n]),latestRun:_,runWorkflow:(0,Y.useCallback)(async(t,n={})=>{p(t.id),h(``);try{await o(`/api/workflows/${encodeURIComponent(t.id)}/run`,{method:`POST`,body:JSON.stringify({inputs:n})}),await g(),e(r(`workflows:workflowsPage.workflowStarted`))}catch(t){let n=$(t);h(n),e(n,`error`)}finally{p(``)}},[g,e,r]),stopRun:(0,Y.useCallback)(async t=>{p(t.id),h(``);try{await o(`/api/workflow-runs/${encodeURIComponent(t.id)}/stop`,{method:`POST`,body:`{}`}),await g(),e(r(`workflows:workflowsPage.stoppingWorkflow`),`info`)}catch(t){let n=$(t);h(n),e(n,`error`)}finally{p(``)}},[g,e,r]),retryRun:(0,Y.useCallback)(async t=>{p(t.id);try{await o(`/api/workflow-runs/${encodeURIComponent(t.id)}/retry`,{method:`POST`,body:`{}`}),await g(),e(r(`workflows:workflowsPage.workflowStarted`))}catch(t){let n=$(t);h(n),e(n,`error`)}finally{p(``)}},[g,e,r]),resolveApproval:(0,Y.useCallback)(async(t,n,r)=>{p(n);try{await o(`/api/workflow-runs/${encodeURIComponent(t.id)}/approvals/${encodeURIComponent(n)}`,{method:`POST`,body:JSON.stringify({approved:r})}),await g()}catch(t){let n=$(t);h(n),e(n,`error`)}finally{p(``)}},[g,e]),duplicateWorkflow:(0,Y.useCallback)(async t=>{p(t.id);try{await o(`/api/workflows/${encodeURIComponent(t.id)}/duplicate`,{method:`POST`,body:`{}`}),await g(),e(r(`workflows:workflowsPage.workflowDuplicated`))}catch(t){let n=$(t);h(n),e(n,`error`)}finally{p(``)}},[g,e,r]),exportWorkflow:(0,Y.useCallback)(async t=>{try{let e=await o(`/api/workflows/${encodeURIComponent(t.id)}/export`),n=new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${t.name.replace(/[\\/:*?"<>|]/g,`-`)}.pisper-workflow.json`,i.click(),URL.revokeObjectURL(r)}catch(t){e($(t),`error`)}},[e]),importWorkflow:(0,Y.useCallback)(async t=>{p(`import`);try{await o(`/api/workflows/import`,{method:`POST`,body:JSON.stringify(t)}),await g(),e(r(`workflows:workflowsPage.workflowImported`))}catch(t){let n=$(t);h(n),e(n,`error`)}finally{p(``)}},[g,e,r]),removeWorkflow:(0,Y.useCallback)(async n=>{if(await t?.({title:r(`workflows:workflowsPage.deleteWorkflow`),message:r(`workflows:workflowsPage.deleteWorkflowNameAndItsRunHistory`,{name:n.name}),confirmLabel:r(`workflows:workflowsPage.delete`),tone:`danger`})){p(n.id);try{await o(`/api/workflows/${encodeURIComponent(n.id)}`,{method:`DELETE`}),await g(),e(r(`workflows:workflowsPage.workflowDeleted`))}catch(t){let n=$(t);h(n),e(n,`error`)}finally{p(``)}}},[g,e,t,r])}}function yt({workflowId:e,templateId:t,notify:n,onCreated:r}){let{t:i}=l(),[a,s]=(0,Y.useState)(_t),[c,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(``),[p,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(!0),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(``),x=!!window.pisperDesktop?.showNotification,[S,C]=(0,Y.useState)(()=>x?`checking`:fe()),w=(0,Y.useCallback)(async()=>{if(!x){C(fe());return}let e=window.pisperDesktop?.getNotificationStatus;if(!e){C(`granted`);return}try{let t=await e(),n=t?.permission;C(n==="default"||n===`denied`||n===`granted`||n===`checking`||n===`unsupported`?n:t?.supported===!1?`unsupported`:`granted`)}catch{C(`unsupported`)}},[x]),T=(0,Y.useCallback)(async()=>{try{let n=await o(`/api/workflows`);s(n);let r=e===`new`?null:n.workflows.find(t=>t.id===e),a=qe.find(e=>e.id===t),c=r?structuredClone(r):a?Ye(a,n.cwd):Je(n.cwd);u(c),f(e=>c.nodes.some(t=>t.id===e)?e:c.nodes[0]?.id||``),m(``),b(r||e===`new`?``:i(`workflows:workflowsPage.workflowNotFoundABlankEditorWasOpened`))}catch(e){b($(e))}finally{g(!1)}},[i,t,e]);(0,Y.useEffect)(()=>{T()},[T]),(0,Y.useEffect)(()=>{w();let e=()=>void w();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[w]);let E=(0,Y.useMemo)(()=>a.runs.filter(e=>e.workflowId===c?.id).sort((e,t)=>Date.parse(t.startedAt)-Date.parse(e.startedAt))[0],[a.runs,c?.id]),D=E?.status===`running`;(0,Y.useEffect)(()=>{if(!D)return;let e=window.setInterval(async()=>{try{s(await o(`/api/workflows`))}catch{}},1500);return()=>window.clearInterval(e)},[D]);let O=(0,Y.useMemo)(()=>c?.nodes.find(e=>e.id===d)||null,[c?.nodes,d]),k=(0,Y.useMemo)(()=>c?.edges.find(e=>e.id===p)||null,[c?.edges,p]),A=(0,Y.useCallback)(e=>{u(t=>t&&{...t,...e})},[]),j=(0,Y.useCallback)(e=>{u(t=>t&&{...t,nodes:t.nodes.map(t=>t.id===d?{...t,...e}:t)})},[d]),M=(0,Y.useCallback)(e=>{f(e),m(``)},[]),N=(0,Y.useCallback)(e=>{m(e),f(``)},[]),P=(0,Y.useCallback)(()=>{f(``),m(``)},[]),F=(0,Y.useCallback)((e,t,r=`output`)=>{if(!c||e===t)return;let a=c.nodes.find(e=>e.id===t);if(!a||a.kind===`trigger`){n(i(`workflows:workflowsPage.aTriggerCannotHaveAnUpstreamConnection`),`error`);return}if(c.edges.some(n=>n.source===e&&n.target===t&&n.sourcePort===r)){n(i(`workflows:workflowsPage.thisConnectionAlreadyExists`),`info`);return}if(ze(c.nodes,c.edges,e,t,r)){n(i(`workflows:workflowsPage.aWorkflowCannotContainCyclicConnections`),`error`);return}let o={id:crypto.randomUUID(),source:e,sourcePort:r,target:t,targetPort:`input`};u(e=>e&&{...e,edges:[...e.edges,o]}),m(o.id),f(``),n(i(`workflows:workflowsPage.connectionCreated`),`info`)},[c,n,i]),I=(0,Y.useCallback)(e=>{if(!e.length)return;let t=new Set(e);u(e=>e&&{...e,edges:e.edges.filter(e=>!t.has(e.id))}),m(``),n(i(`workflows:workflowsPage.connectionDeleted`),`info`)},[n,i]),ne=(0,Y.useCallback)(()=>{p&&I([p])},[I,p]),L=(0,Y.useCallback)(e=>{if(!e.length)return;let t=new Set(e);u(e=>e&&{...e,nodes:e.nodes.filter(e=>!t.has(e.id)),edges:e.edges.filter(e=>!t.has(e.source)&&!t.has(e.target))}),P(),n(i(`workflows:workflowsPage.nodeDeleted`),`info`)},[P,n,i]),re=(0,Y.useCallback)((e,t,n)=>{let r=crypto.randomUUID();u(i=>i&&{...i,nodes:[...i.nodes,Z(r,e,t||Be[e],``,n.x,n.y)]}),f(r),m(``)},[]),R=(0,Y.useCallback)((e,t)=>{u(n=>n&&{...n,nodes:n.nodes.map(n=>n.id===e&&(n.x!==t.x||n.y!==t.y)?{...n,x:t.x,y:t.y}:n)})},[]),ie=(0,Y.useCallback)(()=>{if(!O)return;let e=crypto.randomUUID();u(t=>t&&{...t,nodes:[...t.nodes,{...O,id:e,label:`${O.label} 副本`,x:O.x+25,y:O.y+25}]}),f(e),m(``),n(i(`workflows:workflowsPage.nodeDuplicated`),`info`)},[n,O,i]),z=(0,Y.useCallback)(()=>{O&&L([O.id])},[L,O]),B=(0,Y.useCallback)(async e=>{if(!O||O.kind!==`notification`)return;let t=O.notificationTargets;if(e!==`browser`){if(t.includes(e)){j({notificationTargets:t.filter(t=>t!==e)});return}if(!a.notificationTargets[e]?.enabled)return;j({notificationTargets:[...t,e]});return}if(t.includes(e)&&a.notificationTargets.browser.enabled&&S===`granted`){j({notificationTargets:t.filter(t=>t!==e)});return}let r=S;if(x){await w();let e=await window.pisperDesktop?.getNotificationStatus?.();r=e?.permission||(e?.supported===!1?`unsupported`:`granted`)}else if(r=await ee(),C(r),r===`granted`)try{await te()}catch(e){n($(e),`error`);return}if(r!==`granted`){n(i(r===`unsupported`?`workflows:workflowsPage.systemNotificationsUnsupported`:`workflows:workflowsPage.systemNotificationPermissionRequired`),`error`);return}try{let r=await o(`/api/settings/notifications/browser`,{method:`PATCH`,body:JSON.stringify({enabled:!0})});s(e=>({...e,notificationTargets:{...e.notificationTargets,browser:{enabled:r.browser.enabled}}})),j({notificationTargets:t.includes(e)?t:[...t,e]}),n(i(`workflows:workflowsPage.systemNotificationsEnabled`))}catch(e){n($(e),`error`)}},[a.notificationTargets,x,n,w,O,S,i,j]),V=(0,Y.useCallback)(async(e=`draft`,t=!1)=>{if(!c)return null;v(!0),b(``);try{let l=new Set(Object.entries(a.notificationTargets).filter(([e,t])=>t.enabled&&(e!==`browser`||S===`granted`||S===`checking`)).map(([e])=>e)),d={...c,status:e,notifications:c.notifications.filter(e=>l.has(e)),nodes:c.nodes.map(e=>({...e,notificationTargets:e.notificationTargets.filter(e=>l.has(e))}))},f=c.id?await o(`/api/workflows/${encodeURIComponent(c.id)}`,{method:`PATCH`,body:JSON.stringify(d)}):await o(`/api/workflows`,{method:`POST`,body:JSON.stringify(d)});return s(f.state),u(structuredClone(f.workflow)),c.id||r(f.workflow.id),t||n(i(e===`published`?`workflows:workflowsPage.workflowPublished`:`workflows:workflowsPage.workflowDraftSaved`)),f.workflow}catch(e){let t=$(e);return b(t),n(t,`error`),null}finally{v(!1)}},[a.notificationTargets,c,n,r,S,i]);return{catalog:a,draft:c,selectedNode:O,selectedEdge:k,selectedNodeId:d,selectedEdgeId:p,currentRun:E,loading:h,busy:_,running:D,error:y,systemNotificationPermission:S,updateDraft:A,updateNode:j,addEdge:F,removeEdges:I,removeSelectedEdge:ne,removeNodes:L,addNode:re,moveNode:R,copyNode:ie,deleteNode:z,toggleNotification:B,selectNode:M,selectEdge:N,clearSelection:P,saveWorkflow:V,runWorkflow:(0,Y.useCallback)(async()=>{let e=await V(c?.status||`draft`,!0);if(e){v(!0);try{await o(`/api/workflows/${encodeURIComponent(e.id)}/run`,{method:`POST`,body:`{}`}),s(await o(`/api/workflows`)),n(i(`workflows:workflowsPage.workflowStarted`))}catch(e){let t=$(e);b(t),n(t,`error`)}finally{v(!1)}}},[c?.status,n,V,i]),stopWorkflow:(0,Y.useCallback)(async()=>{if(!(!E||E.status!==`running`)){v(!0);try{await o(`/api/workflow-runs/${encodeURIComponent(E.id)}/stop`,{method:`POST`,body:`{}`}),s(await o(`/api/workflows`)),n(i(`workflows:workflowsPage.stoppingWorkflow`),`info`)}catch(e){let t=$(e);b(t),n(t,`error`)}finally{v(!1)}}},[E,n,i]),publishWorkflow:(0,Y.useCallback)(()=>V(`published`),[V])}}function bt({message:e}){return e?(0,X.jsxs)(K,{variant:`destructive`,children:[(0,X.jsx)(V,{}),(0,X.jsx)(G,{children:e})]}):null}function xt({label:e}){return(0,X.jsxs)(le,{size:`sm`,className:`workflow-card [&_h2]:text-[16px] [&_h2]:tracking-[-.02em] [.detail-stack_>_&]:[flex:0_0_auto] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--panel)] text-[var(--text)] shadow-[0_1px_2px_var(--sh-edge),0_14px_32px_-24px_var(--shadow)] gap-2 py-4`,children:[(0,X.jsx)(L,{className:`animate-spin`,size:23}),(0,X.jsx)(`h2`,{children:e})]})}function St({notify:e,requestConfirm:t,query:n=``}){let{t:r,language:i}=l(),o=a(),[s,c]=(0,Y.useState)(`workflows`),u=vt({notify:e,requestConfirm:t,query:n});return u.loading?(0,X.jsx)(xt,{label:r(`workflows:workflowsPage.loadingWorkflows`)}):(0,X.jsxs)(`div`,{className:`workflows-page flex min-h-[100%] flex-col gap-[12px]`,children:[(0,X.jsx)(bt,{message:u.error}),(0,X.jsxs)(`div`,{className:`workflow-page-toolbar max-[650px]:items-stretch max-[650px]:flex-col max-[650px]:gap-[8px] flex min-w-0 items-center justify-between gap-[16px]`,children:[(0,X.jsx)($e,{value:s,t:r,onChange:c}),(0,X.jsx)(rt,{data:u.data,t:r})]}),s===`workflows`?(0,X.jsx)(et,{workflows:u.visibleWorkflows,runs:u.data.runs,busyId:u.busyId,language:i,t:r,onRun:e=>void u.runWorkflow(e),onEdit:e=>o(U(e)),onDuplicate:e=>void u.duplicateWorkflow(e),onExport:e=>void u.exportWorkflow(e),onImport:e=>void u.importWorkflow(e),onDelete:e=>void u.removeWorkflow(e)}):s===`runs`?(0,X.jsx)(tt,{runs:u.data.runs,busyId:u.busyId,language:i,t:r,onStop:e=>void u.stopRun(e),onRetry:e=>void u.retryRun(e),onApproval:(e,t,n)=>void u.resolveApproval(e,t,n)}):(0,X.jsx)(nt,{t:r,onOpenTemplate:e=>o(`${U(`new`)}?template=${encodeURIComponent(e)}`)})]})}function Ct({notify:e,registerPrimaryAction:t,registerWorkflowActions:n}){let{t:o,language:s}=l(),c=a(),{workflowId:u=`new`}=i(),[d]=r(),f=(0,Y.useCallback)(e=>{c(U(e),{replace:!0})},[c]),p=yt({workflowId:u,templateId:d.get(`template`),notify:e,onCreated:f}),{busy:m,publishWorkflow:h,runWorkflow:g,running:_,saveWorkflow:v,stopWorkflow:y}=p;return he(t,h),(0,Y.useEffect)(()=>n?.({save:()=>v(`draft`),run:_?y:g,busy:m,running:_}),[m,n,g,_,v,y]),p.loading||!p.draft?(0,X.jsx)(xt,{label:o(`workflows:workflowsPage.loadingWorkflowEditor`)}):(0,X.jsxs)(`div`,{className:`preview-page flex min-h-[100%] flex-col workflow-editor-page`,children:[(0,X.jsx)(bt,{message:p.error}),p.running&&p.currentRun&&(0,X.jsx)(at,{run:p.currentRun,t:o}),(0,X.jsxs)(`div`,{className:`builder-layout [.preview-page_>_&]:min-h-0 [.preview-page_>_&]:flex-1 max-[1150px]:grid-cols-[180px_minmax(460px,1fr)] max-[900px]:grid-cols-[180px_minmax(520px,1fr)] max-[900px]:overflow-auto max-[650px]:flex max-[650px]:min-w-0 max-[650px]:flex-col max-[650px]:overflow-visible max-[650px]:[.page-workflowCreate_&]:w-[900px] grid min-h-[100%] grid-cols-[205px_minmax(480px,1fr)_300px] gap-[12px]`,children:[(0,X.jsx)(Xe,{draft:p.draft,selectedNodeId:p.selectedNodeId,selectedEdgeId:p.selectedEdgeId,t:o,onAddNode:p.addNode,onConnect:p.addEdge,onMoveNode:p.moveNode,onSelectNode:p.selectNode,onSelectEdge:p.selectEdge,onClearSelection:p.clearSelection,onDeleteNodes:p.removeNodes,onDeleteEdges:p.removeEdges}),(0,X.jsx)(gt,{draft:p.draft,catalog:p.catalog,selectedNode:p.selectedNode,selectedEdge:p.selectedEdge,currentRun:p.currentRun,language:s,t:o,systemNotificationPermission:p.systemNotificationPermission,onUpdateDraft:p.updateDraft,onUpdateNode:p.updateNode,onToggleNotification:p.toggleNotification,onDeleteEdge:p.removeSelectedEdge,onCopyNode:p.copyNode,onDeleteNode:p.deleteNode,onOpenChannels:()=>c(ie.channels),onOpenSystemNotificationSettings:()=>{if(window.pisperDesktop?.openNotificationSettings){window.pisperDesktop.openNotificationSettings();return}c(`/config/notifications`)}})]})]})}export{Ct as WorkflowBuilder,St as WorkflowsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./vendor-react-CHuvPdJE.js";import{t as r}from"./api-B6CluO7V.js";import{n as i,t as a}from"./button-XhIEgIsg.js";import{t as o}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./vendor-react-CHuvPdJE.js";import{t as r}from"./api-B6CluO7V.js";import{n as i,t as a}from"./button-XhIEgIsg.js";import{t as o}from"./use-i18n-jYw5s_Yn.js";import{n as s,r as c,t as l}from"./scroll-area-C1DpxpHg.js";import{t as u}from"./check-jIXqkGKr.js";import{t as d}from"./loader-circle-72TYCcVQ.js";import{t as f}from"./input-D1QFzNMx.js";import{A as p,M as m,N as h,P as g,bt as _,ht as v,j as y,jt as b,k as x}from"./index-Bd5A8V1V.js";import{n as S,t as C}from"./alert-B7D8joCd.js";var w=i(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),T=i(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),E=i(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),D=e(t(),1);function O(e){let t=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return t?t(e):Promise.reject(Error(`native bridge unavailable`))}async function k(){return window.__PISPER_MOBILE_APP__?(await O(`mobile_state`)).mode:null}async function A(){if(window.__PISPER_MOBILE_PLATFORM__!==`android`)throw Error(`workspace_import_unsupported`);let e=await O(`mobile_state`);if(e.mode!==`local`||!e.onDevice?.running)throw Error(`workspace_import_requires_local_runtime`);let t=await O(`mobile_import_workspace_directory`);if(t.path===null)return null;if(typeof t.path!=`string`||!t.path.startsWith(`/`))throw Error(`workspace_import_invalid_path`);return t.path}var j=n();function M({open:e,initialPath:t=``,description:n,onOpenChange:i,onSelect:O}){let{t:M}=o(),[N,P]=(0,D.useState)(t),[F,I]=(0,D.useState)(null),[L,R]=(0,D.useState)(!1),[z,B]=(0,D.useState)(!1),[V,H]=(0,D.useState)(!1),[U,W]=(0,D.useState)(!1),[G,K]=(0,D.useState)(null),[q,J]=(0,D.useState)(``),Y=(0,D.useRef)(0),X=(0,D.useRef)(0),Z=V||U,Q=G===`local`&&window.__PISPER_MOBILE_PLATFORM__===`android`,$=(0,D.useCallback)(async e=>{let t=++Y.current;B(!0),J(``);try{let n=await r(`/api/directories?path=${encodeURIComponent(e.trim())}`);if(t!==Y.current)return;if(!n||typeof n.path!=`string`||!n.path.trim()||n.parent!=null&&(typeof n.parent!=`string`||!n.parent.trim())||!Array.isArray(n.directories)||n.directories.some(e=>!e||typeof e.name!=`string`||!e.name.trim()||typeof e.path!=`string`||!e.path.trim()))throw Error(M(`common:workspacePicker.invalidListing`));P(n.path),I(n),R(!1)}catch(e){if(t!==Y.current)return;J(e instanceof Error?e.message:String(e))}finally{t===Y.current&&B(!1)}},[M]);(0,D.useEffect)(()=>{let n=++X.current;return e&&(P(t),I(null),H(!1),W(!1),R(!1),K(null),$(t),k().then(e=>{n===X.current&&K(e)}).catch(e=>{n===X.current&&J(e instanceof Error?e.message:String(e))})),()=>{Y.current+=1,X.current+=1}},[$,t,e]);let ee=e=>{e.preventDefault(),!Z&&!z&&$(N)},te=async()=>{let e=X.current;W(!0),J(``);try{let t=await A();e===X.current&&t&&await $(t)}catch(t){e===X.current&&J(t instanceof Error?t.message:String(t))}finally{e===X.current&&W(!1)}},ne=async()=>{if(!(!F||Z||z||q||N!==F.path)){H(!0),J(``);try{await O(F.path),i(!1)}catch(e){J(e instanceof Error?e.message:String(e))}finally{H(!1)}}};return(0,j.jsx)(x,{open:e,onOpenChange:e=>!Z&&i(e),children:(0,j.jsxs)(p,{showCloseButton:!Z,className:`max-w-[calc(100vw-24px)]! gap-0 overflow-hidden p-0 sm:max-w-[620px]!`,children:[(0,j.jsxs)(h,{className:`border-b px-4 py-3 pr-12`,children:[(0,j.jsx)(g,{children:M(`common:workspacePicker.setWorkingDirectory`)}),(0,j.jsx)(y,{children:n||M(`common:workspacePicker.selectDirectoryDescription`)})]}),Q&&(0,j.jsx)(`div`,{className:`border-b px-4 py-3`,children:(0,j.jsxs)(a,{type:`button`,variant:`outline`,className:`h-auto min-h-10 w-full whitespace-normal`,disabled:Z||z,onClick:()=>void te(),children:[U?(0,j.jsx)(d,{className:`animate-spin`}):(0,j.jsx)(w,{}),M(U?`common:workspacePicker.importingFolder`:`common:workspacePicker.importFolderCopy`)]})}),(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 px-4 py-3`,children:[(0,j.jsx)(a,{type:`button`,variant:`outline`,size:`icon`,title:M(`common:workspacePicker.parentFolder`),"aria-label":M(`common:workspacePicker.parentFolder`),disabled:z||Z||!F?.parent,onClick:()=>F?.parent&&void $(F.parent),children:(0,j.jsx)(c,{})}),(0,j.jsx)(a,{type:`button`,variant:`outline`,size:`icon`,title:M(`common:workspacePicker.defaultFolder`),"aria-label":M(`common:workspacePicker.defaultFolder`),disabled:z||Z,onClick:()=>void $(``),children:(0,j.jsx)(T,{})}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`div`,{className:`truncate text-[11px] text-content-muted`,children:M(G===`remote`?`common:workspacePicker.serverFolder`:`common:workspacePicker.workingDirectoryPath`)}),(0,j.jsx)(`div`,{className:`truncate font-mono text-xs`,title:F?.path||``,children:F?.path||M(`common:workspacePicker.defaultFolder`)})]}),(0,j.jsx)(a,{type:`button`,variant:`ghost`,size:`icon`,title:M(`common:workspacePicker.enterPath`),"aria-label":M(`common:workspacePicker.enterPath`),"aria-expanded":L,disabled:Z||z,onClick:()=>{P(F?.path||t),R(e=>!e)},children:(0,j.jsx)(E,{})}),(0,j.jsx)(a,{type:`button`,variant:`ghost`,size:`icon`,title:M(`common:workspacePicker.refreshFolder`),"aria-label":M(`common:workspacePicker.refreshFolder`),disabled:Z||z,onClick:()=>void $(F?.path||t),children:z?(0,j.jsx)(d,{className:`animate-spin`}):(0,j.jsx)(_,{})})]}),L&&(0,j.jsxs)(`form`,{className:`flex min-w-0 items-center gap-2 px-4 pb-3`,onSubmit:ee,children:[(0,j.jsx)(f,{className:`min-w-0 flex-1 font-mono text-[12px]`,value:N,disabled:Z||z,"aria-label":M(`common:workspacePicker.workingDirectoryPath`),placeholder:M(`common:workspacePicker.enterAbsolutePath`),onChange:e=>P(e.target.value)}),(0,j.jsxs)(a,{type:`submit`,variant:`secondary`,disabled:z||Z||!N.trim(),children:[(0,j.jsx)(b,{}),M(`common:workspacePicker.go`)]})]}),(0,j.jsx)(l,{className:`h-[min(340px,40dvh)] border-y bg-muted/20`,children:(0,j.jsxs)(`div`,{className:`p-2`,children:[!z&&F?.directories.map(e=>(0,j.jsxs)(`button`,{type:`button`,className:`grid min-h-11 w-full grid-cols-[24px_minmax(0,1fr)_20px] items-center rounded-md px-2 py-2 text-left text-[13px] hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,title:e.path,disabled:Z,onClick:()=>void $(e.path),children:[(0,j.jsx)(s,{className:`size-4 text-content-muted`}),(0,j.jsx)(`span`,{className:`truncate`,children:e.name}),(0,j.jsx)(b,{className:`size-4 text-content-muted`})]},e.path)),z&&(0,j.jsxs)(`div`,{role:`status`,className:`flex h-32 items-center justify-center gap-2 text-content-muted`,children:[(0,j.jsx)(d,{className:`size-4 animate-spin`}),(0,j.jsx)(`span`,{children:M(`common:workspacePicker.readingFolder`)})]}),!z&&!q&&F&&!F.directories.length&&(0,j.jsx)(`div`,{className:`flex h-32 items-center justify-center text-sm text-content-muted`,children:M(`common:workspacePicker.thisFolderHasNoSubfolders`)})]})}),q&&(0,j.jsxs)(C,{variant:`destructive`,className:`mx-4 mt-3 w-auto`,children:[(0,j.jsx)(v,{}),(0,j.jsx)(S,{className:`min-w-0 break-words`,children:q})]}),(0,j.jsxs)(m,{className:`m-0 border-t-0 bg-transparent px-4 py-3`,children:[(0,j.jsx)(a,{type:`button`,variant:`outline`,disabled:Z,onClick:()=>i(!1),children:M(`common:ui.cancel`)}),(0,j.jsxs)(a,{type:`button`,variant:`secondary`,disabled:z||Z||!F||!!q||N!==F.path,onClick:()=>void ne(),children:[V?(0,j.jsx)(d,{className:`animate-spin`}):(0,j.jsx)(u,{}),M(V?`common:workspacePicker.switching`:`common:workspacePicker.useThisFolder`)]})]})]})})}export{M as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./api-B6CluO7V.js";import{n as t}from"./button-XhIEgIsg.js";import{a as n}from"./vendor-state-DE1O_s6m.js";var r=t(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),i=t(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),a=t(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]);function o(e,t){try{let n=new URL(e,t);return n.protocol===`http:`||n.protocol===`https:`?n:null}catch{return null}}function s(e,t){let n=e.trim();return n&&o(/^[a-z][a-z\d+.-]*:/i.test(n)||n.startsWith(`//`)?n:`https://${n}`,t)?.href||null}function c({href:e,baseUrl:t,button:n=0,download:r=!1,altKey:i=!1,ctrlKey:a=!1,metaKey:s=!1,shiftKey:c=!1,behavior:l}){if(n!==0||r||i||a||s||c||l===`external`||l===`ignore`)return null;let u=o(e,t);if(!u)return null;let d=o(t,t);return d&&u.origin===d.origin?null:u.href}function l(){return typeof window<`u`&&window.__PISPER_MOBILE_APP__===!0}var u=null,d=!1,f=n()(t=>({client:l()?`mobile-app`:`web`,loaded:l(),load:({refresh:n=!0}={})=>u||(!n&&d?Promise.resolve():(u=(async()=>{let n=l();n&&t({client:`mobile-app`,loaded:!0});try{let r=await e(`/api/client-info`);t({client:n||r.client===`mobile-app`?`mobile-app`:`web`,loaded:!0})}catch{t({client:n?`mobile-app`:`web`,loaded:!0})}})().finally(()=>{d=!0,u=null}),u))}));function p(){return f(e=>e.client===`mobile-app`)}export{a,c as i,p as n,i as o,s as r,r as s,f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./vendor-react-CHuvPdJE.js";import{n as r,o as i}from"./button-XhIEgIsg.js";import{d as a,f as o,h as s,m as c,p as l}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./vendor-react-CHuvPdJE.js";import{n as r,o as i}from"./button-XhIEgIsg.js";import{d as a,f as o,h as s,m as c,p as l}from"./use-i18n-jYw5s_Yn.js";import{u}from"./es2015-DycjrqX-.js";import{n as d}from"./dist-cR3ayBwn.js";var f=e(t(),1),p=n(),m=Object.defineProperty,h=(e,t)=>m(e,`name`,{value:t,configurable:!0}),g=`Collapsible`,[_,v]=c(g),[y,b]=_(g),x=f.forwardRef(h(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:o,onOpenChange:c,...l}=e,[u,m]=a({prop:r,defaultProp:i??!1,onChange:c,caller:g});return(0,p.jsx)(y,{scope:n,disabled:o,contentId:d(),open:u,onOpenToggle:f.useCallback(()=>m(e=>!e),[m]),children:(0,p.jsx)(s.div,{"data-state":D(u),"data-disabled":o?``:void 0,...l,ref:t})})},`Collapsible`)),S=`CollapsibleTrigger`,C=f.forwardRef(h(function(e,t){let{__scopeCollapsible:n,...r}=e,i=b(S,n);return(0,p.jsx)(s.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":D(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:l(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),w=`CollapsibleContent`,T=f.forwardRef(h(function(e,t){let{forceMount:n,...r}=e,i=b(w,e.__scopeCollapsible);return(0,p.jsx)(u,{present:n||i.open,children:({present:e})=>(0,p.jsx)(E,{...r,ref:t,present:e})})},`CollapsibleContent`)),E=f.forwardRef(h(function(e,t){let{__scopeCollapsible:n,present:r,children:a,...c}=e,l=b(w,n),[u,d]=f.useState(r),m=f.useRef(null),h=i(t,m),g=f.useRef(0),_=g.current,v=f.useRef(0),y=v.current,x=l.open||u,S=f.useRef(x),C=f.useRef(void 0);return f.useEffect(()=>{let e=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(e)},[]),o(()=>{let e=m.current;if(e){C.current=C.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();g.current=t.height,v.current=t.width,S.current||(e.style.transitionDuration=C.current.transitionDuration,e.style.animationName=C.current.animationName),d(r)}},[l.open,r]),(0,p.jsx)(s.div,{"data-state":D(l.open),"data-disabled":l.disabled?``:void 0,id:l.contentId,hidden:!x,...c,ref:h,style:{"--radix-collapsible-content-height":_?`${_}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...e.style},children:x&&a})},`CollapsibleContentImpl`));function D(e){return e?`open`:`closed`}h(D,`getState`);var O=x,k=r(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),A=r(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),j=r(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),M=r(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),N=r(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]);function P({...e}){return(0,p.jsx)(O,{"data-slot":`collapsible`,...e})}function F({...e}){return(0,p.jsx)(C,{"data-slot":`collapsible-trigger`,...e})}function I({...e}){return(0,p.jsx)(T,{"data-slot":`collapsible-content`,...e})}export{M as a,k as c,N as i,I as n,j as o,F as r,A as s,P as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-CHuvPdJE.js";import{n}from"./button-XhIEgIsg.js";import{s as r}from"./use-i18n-yjKc6F2w.js";var i=n(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),a=n(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),o=n(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),s=e(t(),1),c=`section`,l={models:`config:configPage.models`,notifications:`config:configPage.notifications`,interface:`config:configPage.interface`,shortcuts:`config:configPage.shortcuts`,"desktop-pet":`config:configPage.desktopPet`,updates:`config:configPage.appUpdates`,about:`config:configPage.about`,"remote-access":`config:configPage.remoteAccess`,"mobile-server":`config:configPage.mobileServer`},u=[{id:`sec-models`,section:`models`,card:c,titleKey:`config:configPage.models`,keywords:[`model`,`provider`,`llm`,`api`,`模型`,`供应商`,`大模型`]},{id:`sec-notifications`,section:`notifications`,card:c,titleKey:`config:configPage.notifications`,keywords:[`notification`,`push`,`alert`,`通知`,`推送`,`提醒`]},{id:`sec-interface`,section:`interface`,card:c,titleKey:`config:configPage.interface`,keywords:[`interface`,`theme`,`appearance`,`display`,`界面`,`主题`,`外观`,`显示`]},{id:`sec-shortcuts`,section:`shortcuts`,card:c,titleKey:`config:configPage.shortcuts`,keywords:[`keyboard`,`shortcut`,`hotkey`,`keybinding`,`voice`,`push to talk`,`快捷键`,`按键`,`键盘`,`语音`,`长按`]},{id:`sec-desktop-pet`,section:`desktop-pet`,card:c,titleKey:`config:configPage.desktopPet`,keywords:[`pet`,`petdex`,`宠物`,`桌宠`]},{id:`sec-updates`,section:`updates`,card:c,titleKey:`config:configPage.appUpdates`,keywords:[`update`,`upgrade`,`version`,`更新`,`升级`,`版本`]},{id:`sec-about`,section:`about`,card:c,titleKey:`config:configPage.about`,keywords:[`about`,`info`,`license`,`关于`,`信息`,`许可`]},{id:`sec-remote-access`,section:`remote-access`,card:c,titleKey:`config:configPage.remoteAccess`,keywords:[`remote`,`network`,`phone`,`远程`,`网络`,`手机`]},{id:`sec-mobile-server`,section:`mobile-server`,card:c,titleKey:`config:configPage.mobileServer`,keywords:[`server`,`remote`,`network`,`服务器`,`远程`,`网络`]},{id:`models-current-model`,section:`models`,card:`models-current-model`,titleKey:`config:configPage.currentChatModel`,keywords:[`model`,`provider`,`quick setup`,`模型`,`供应商`,`快速配置`,`对话模型`]},{id:`models-connections`,section:`models`,card:`models-connections`,titleKey:`config:configPage.manageConnections`,keywords:[`provider`,`connection`,`api key`,`import`,`连接`,`供应商`,`导入`,`密钥`]},{id:`models-runtime-policy`,section:`models`,card:`models-connections`,titleKey:`config:configPage.agentRuntimePolicy`,keywords:[`runtime`,`agent`,`policy`,`运行策略`,`运行时`,`执行策略`]},{id:`models-visual`,section:`models`,card:`models-visual`,titleKey:`config:configPage.currentVisualModel`,keywords:[`image`,`video`,`visual`,`图片`,`图像`,`视频`,`视觉`,`生图`]},{id:`notifications-browser`,section:`notifications`,card:`notifications-browser`,titleKey:`config:notificationSettings.notification`,keywords:[`browser`,`system`,`push`,`浏览器通知`,`系统通知`,`推送`]},{id:`notifications-templates`,section:`notifications`,card:`notifications-templates`,titleKey:`config:notificationSettings.notificationTemplates`,keywords:[`template`,`模板`,`通知模板`]},{id:`interface-appearance`,section:`interface`,card:`interface-appearance`,titleKey:`config:interfaceSettings.appearance`,keywords:[`theme`,`dark`,`light`,`accent`,`font`,`corner`,`主题`,`深色`,`浅色`,`强调色`,`字体`,`圆角`,`外观`]},{id:`interface-motion`,section:`interface`,card:`interface-motion`,titleKey:`config:interfaceSettings.displayAndMotion`,keywords:[`motion`,`density`,`animation`,`动效`,`动画`,`密度`,`显示`]},{id:`interface-language`,section:`interface`,card:`interface-language`,titleKey:`config:languageSettings.displayLanguage`,keywords:[`language`,`chinese`,`english`,`语言`,`中文`,`英文`,`英语`]},{id:`desktop-pet-settings`,section:`desktop-pet`,card:`desktop-pet-settings`,titleKey:`config:desktopPetSettings.title`,keywords:[`pet`,`宠物`,`桌宠`,`宠物设置`]},{id:`desktop-pet-install`,section:`desktop-pet`,card:`desktop-pet-install`,titleKey:`config:desktopPetSettings.installTitle`,keywords:[`petdex`,`install`,`宠物安装`,`添加宠物`]},{id:`desktop-pet-installed`,section:`desktop-pet`,card:`desktop-pet-installed`,titleKey:`config:desktopPetSettings.installedTitle`,keywords:[`installed`,`已安装`,`宠物列表`]},{id:`mobile-server-main`,section:`mobile-server`,card:`mobile-server-main`,titleKey:`config:mobileServer.title`,keywords:[`server`,`remote`,`服务器`,`远程`,`手机访问`]},{id:`mobile-server-local`,section:`mobile-server`,card:`mobile-server-local`,titleKey:`config:mobileServer.localTitle`,keywords:[`local`,`on-device`,`本机`,`本地运行`]},{id:`remote-access-main`,section:`remote-access`,card:`remote-access-main`,titleKey:`config:remoteAccess.title`,keywords:[`remote`,`network`,`phone`,`远程`,`网络`,`手机`]},{id:`remote-access-pairing`,section:`remote-access`,card:`remote-access-pairing`,titleKey:`config:remoteAccess.pairing`,keywords:[`pairing`,`qr`,`配对`,`二维码`]},{id:`remote-access-devices`,section:`remote-access`,card:`remote-access-devices`,titleKey:`config:remoteAccess.devices`,keywords:[`device`,`paired`,`设备`,`已配对`,`授权`]},{id:`updates-main`,section:`updates`,card:`updates-main`,titleKey:`config:updateSettings.pisperAppUpdates`,keywords:[`update`,`version`,`channel`,`更新`,`版本`,`升级`,`渠道`]},{id:`updates-components`,section:`updates`,card:`updates-components`,titleKey:`config:updateSettings.appComponents`,keywords:[`component`,`runtime`,`sidecar`,`组件`,`运行时`]},{id:`updates-cli`,section:`updates`,card:`updates-cli`,titleKey:`config:cliSettings.title`,keywords:[`cli`,`terminal`,`command`,`命令行`,`终端`,`命令`]},{id:`updates-sponsors`,section:`updates`,card:`updates-sponsors`,titleKey:`config:updateSettings.sponsors`,keywords:[`sponsor`,`赞助`,`赞助商`]},{id:`about-project`,section:`about`,card:`about-project`,titleKey:`config:aboutSettings.projectInformation`,keywords:[`project`,`version`,`license`,`项目`,`版本`,`许可`]},{id:`about-support`,section:`about`,card:`about-support`,titleKey:`config:aboutSettings.supportPisper`,keywords:[`support`,`donate`,`sponsor`,`支持`,`捐赠`,`赞助`]}],d={provider:[`sec-models`,`models-current-model`,`models-connections`],供应商:[`sec-models`,`models-current-model`,`models-connections`],model:[`sec-models`,`models-current-model`,`models-connections`],模型:[`sec-models`,`models-current-model`,`models-connections`],theme:[`sec-interface`,`interface-appearance`],主题:[`sec-interface`,`interface-appearance`],interface:[`sec-interface`,`interface-appearance`],界面:[`sec-interface`,`interface-appearance`,`interface-language`],pet:[`sec-desktop-pet`,`desktop-pet-settings`,`desktop-pet-install`,`desktop-pet-installed`],宠物:[`sec-desktop-pet`,`desktop-pet-settings`,`desktop-pet-install`,`desktop-pet-installed`],update:[`sec-updates`,`updates-main`,`updates-components`],更新:[`sec-updates`,`updates-main`,`updates-components`],network:[`sec-remote-access`,`sec-mobile-server`,`remote-access-main`],网络:[`sec-remote-access`,`sec-mobile-server`,`remote-access-main`],remote:[`sec-remote-access`,`sec-mobile-server`,`remote-access-main`],远程:[`sec-remote-access`,`sec-mobile-server`,`remote-access-main`],notification:[`sec-notifications`,`notifications-browser`,`notifications-templates`],通知:[`sec-notifications`,`notifications-browser`,`notifications-templates`],language:[`interface-language`],语言:[`interface-language`]},f=12;function p(e){return[r(e.titleKey,`zh-CN`).toLowerCase(),r(e.titleKey,`en-US`).toLowerCase()]}function m(e,t){let n=e.trim().toLowerCase();if(!n)return[];let i=new Set(d[n]||[]);for(let e of n.split(/\s+/))for(let t of d[e]||[])i.add(t);let a=[];for(let e of u){let[t,r]=p(e),o=0;i.has(e.id)?o=100:t===n||r===n?o=90:t.startsWith(n)||r.startsWith(n)?o=80:t.includes(n)||r.includes(n)?o=65:(e.keywords||[]).some(e=>{let t=e.toLowerCase();return t.includes(n)?n.length>=2||/[\u4e00-\u9fff]/.test(n):/[\u4e00-\u9fff]/.test(t)&&t.includes(n)})&&(o=40),o>0&&a.push({entry:e,score:o})}a.sort((e,t)=>t.score-e.score);let o=new Set,s=[];for(let{entry:e}of a){let n={entry:e,title:r(e.titleKey,t),sectionTitle:r(l[e.section],t)},i=`${e.section}|${n.title}`;if(!o.has(i)&&(o.add(i),s.push(n),s.length>=f))break}return s}var h=`pisper:config-card-highlight`,g=null;function _(e,t){g={card:e,section:t},window.dispatchEvent(new Event(h))}function v(){let e=g;return g=null,e}function y(e){let t=document.querySelector(`[data-config-card="${e.card}"]`);if(t||=document.querySelector(`[data-config-card="${c}"]`),!t)return;t.scrollIntoView({behavior:`smooth`,block:`center`});let n={boxShadow:t.style.boxShadow,borderColor:t.style.borderColor,transition:t.style.transition};t.style.transition=`box-shadow .3s ease, border-color .3s ease`,t.style.boxShadow=`0 0 0 3px var(--focus-ring)`,t.style.borderColor=`var(--focus)`,window.setTimeout(()=>{t.style.boxShadow=n.boxShadow,t.style.borderColor=n.borderColor,t.style.transition=n.transition},1200)}function b(e){(0,s.useEffect)(()=>{let e=()=>{let e=v();e&&requestAnimationFrame(()=>requestAnimationFrame(()=>y(e)))};return e(),window.addEventListener(h,e),()=>window.removeEventListener(h,e)},[e])}export{o as a,b as i,_ as n,a as o,m as r,i as s,c as t};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-CHuvPdJE.js";import{n}from"./button-XhIEgIsg.js";import{s as r}from"./use-i18n-jYw5s_Yn.js";var i=n(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),a=n(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),o=n(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),s=e(t(),1),c=`section`,l={models:`config:configPage.models`,notifications:`config:configPage.notifications`,interface:`config:configPage.interface`,shortcuts:`config:configPage.shortcuts`,"desktop-pet":`config:configPage.desktopPet`,updates:`config:configPage.appUpdates`,about:`config:configPage.about`,"remote-access":`config:configPage.remoteAccess`,"mobile-server":`config:configPage.mobileServer`},u=[{id:`sec-models`,section:`models`,card:c,titleKey:`config:configPage.models`,keywords:[`model`,`provider`,`llm`,`api`,`模型`,`供应商`,`大模型`]},{id:`sec-notifications`,section:`notifications`,card:c,titleKey:`config:configPage.notifications`,keywords:[`notification`,`push`,`alert`,`通知`,`推送`,`提醒`]},{id:`sec-interface`,section:`interface`,card:c,titleKey:`config:configPage.interface`,keywords:[`interface`,`theme`,`appearance`,`display`,`界面`,`主题`,`外观`,`显示`]},{id:`sec-shortcuts`,section:`shortcuts`,card:c,titleKey:`config:configPage.shortcuts`,keywords:[`keyboard`,`shortcut`,`hotkey`,`keybinding`,`voice`,`push to talk`,`快捷键`,`按键`,`键盘`,`语音`,`长按`]},{id:`sec-desktop-pet`,section:`desktop-pet`,card:c,titleKey:`config:configPage.desktopPet`,keywords:[`pet`,`petdex`,`宠物`,`桌宠`]},{id:`sec-updates`,section:`updates`,card:c,titleKey:`config:configPage.appUpdates`,keywords:[`update`,`upgrade`,`version`,`更新`,`升级`,`版本`]},{id:`sec-about`,section:`about`,card:c,titleKey:`config:configPage.about`,keywords:[`about`,`info`,`license`,`关于`,`信息`,`许可`]},{id:`sec-remote-access`,section:`remote-access`,card:c,titleKey:`config:configPage.remoteAccess`,keywords:[`remote`,`network`,`phone`,`远程`,`网络`,`手机`]},{id:`sec-mobile-server`,section:`mobile-server`,card:c,titleKey:`config:configPage.mobileServer`,keywords:[`server`,`remote`,`network`,`服务器`,`远程`,`网络`]},{id:`models-current-model`,section:`models`,card:`models-current-model`,titleKey:`config:configPage.currentChatModel`,keywords:[`model`,`provider`,`quick setup`,`模型`,`供应商`,`快速配置`,`对话模型`]},{id:`models-connections`,section:`models`,card:`models-connections`,titleKey:`config:configPage.manageConnections`,keywords:[`provider`,`connection`,`api key`,`import`,`连接`,`供应商`,`导入`,`密钥`]},{id:`models-runtime-policy`,section:`models`,card:`models-connections`,titleKey:`config:configPage.agentRuntimePolicy`,keywords:[`runtime`,`agent`,`policy`,`运行策略`,`运行时`,`执行策略`]},{id:`models-visual`,section:`models`,card:`models-visual`,titleKey:`config:configPage.currentVisualModel`,keywords:[`image`,`video`,`visual`,`图片`,`图像`,`视频`,`视觉`,`生图`]},{id:`notifications-browser`,section:`notifications`,card:`notifications-browser`,titleKey:`config:notificationSettings.notification`,keywords:[`browser`,`system`,`push`,`浏览器通知`,`系统通知`,`推送`]},{id:`notifications-templates`,section:`notifications`,card:`notifications-templates`,titleKey:`config:notificationSettings.notificationTemplates`,keywords:[`template`,`模板`,`通知模板`]},{id:`interface-appearance`,section:`interface`,card:`interface-appearance`,titleKey:`config:interfaceSettings.appearance`,keywords:[`theme`,`dark`,`light`,`accent`,`font`,`corner`,`主题`,`深色`,`浅色`,`强调色`,`字体`,`圆角`,`外观`]},{id:`interface-motion`,section:`interface`,card:`interface-motion`,titleKey:`config:interfaceSettings.displayAndMotion`,keywords:[`motion`,`density`,`animation`,`动效`,`动画`,`密度`,`显示`]},{id:`interface-language`,section:`interface`,card:`interface-language`,titleKey:`config:languageSettings.displayLanguage`,keywords:[`language`,`chinese`,`english`,`语言`,`中文`,`英文`,`英语`]},{id:`desktop-pet-settings`,section:`desktop-pet`,card:`desktop-pet-settings`,titleKey:`config:desktopPetSettings.title`,keywords:[`pet`,`宠物`,`桌宠`,`宠物设置`]},{id:`desktop-pet-install`,section:`desktop-pet`,card:`desktop-pet-install`,titleKey:`config:desktopPetSettings.installTitle`,keywords:[`petdex`,`install`,`宠物安装`,`添加宠物`]},{id:`desktop-pet-installed`,section:`desktop-pet`,card:`desktop-pet-installed`,titleKey:`config:desktopPetSettings.installedTitle`,keywords:[`installed`,`已安装`,`宠物列表`]},{id:`mobile-server-main`,section:`mobile-server`,card:`mobile-server-main`,titleKey:`config:mobileServer.title`,keywords:[`server`,`remote`,`服务器`,`远程`,`手机访问`]},{id:`mobile-server-local`,section:`mobile-server`,card:`mobile-server-local`,titleKey:`config:mobileServer.localTitle`,keywords:[`local`,`on-device`,`本机`,`本地运行`]},{id:`remote-access-main`,section:`remote-access`,card:`remote-access-main`,titleKey:`config:remoteAccess.title`,keywords:[`remote`,`network`,`phone`,`远程`,`网络`,`手机`]},{id:`remote-access-pairing`,section:`remote-access`,card:`remote-access-pairing`,titleKey:`config:remoteAccess.pairing`,keywords:[`pairing`,`qr`,`配对`,`二维码`]},{id:`remote-access-devices`,section:`remote-access`,card:`remote-access-devices`,titleKey:`config:remoteAccess.devices`,keywords:[`device`,`paired`,`设备`,`已配对`,`授权`]},{id:`updates-main`,section:`updates`,card:`updates-main`,titleKey:`config:updateSettings.pisperAppUpdates`,keywords:[`update`,`version`,`channel`,`更新`,`版本`,`升级`,`渠道`]},{id:`updates-components`,section:`updates`,card:`updates-components`,titleKey:`config:updateSettings.appComponents`,keywords:[`component`,`runtime`,`sidecar`,`组件`,`运行时`]},{id:`updates-cli`,section:`updates`,card:`updates-cli`,titleKey:`config:cliSettings.title`,keywords:[`cli`,`terminal`,`command`,`命令行`,`终端`,`命令`]},{id:`updates-sponsors`,section:`updates`,card:`updates-sponsors`,titleKey:`config:updateSettings.sponsors`,keywords:[`sponsor`,`赞助`,`赞助商`]},{id:`about-project`,section:`about`,card:`about-project`,titleKey:`config:aboutSettings.projectInformation`,keywords:[`project`,`version`,`license`,`项目`,`版本`,`许可`]},{id:`about-support`,section:`about`,card:`about-support`,titleKey:`config:aboutSettings.supportPisper`,keywords:[`support`,`donate`,`sponsor`,`支持`,`捐赠`,`赞助`]}],d={provider:[`sec-models`,`models-current-model`,`models-connections`],供应商:[`sec-models`,`models-current-model`,`models-connections`],model:[`sec-models`,`models-current-model`,`models-connections`],模型:[`sec-models`,`models-current-model`,`models-connections`],theme:[`sec-interface`,`interface-appearance`],主题:[`sec-interface`,`interface-appearance`],interface:[`sec-interface`,`interface-appearance`],界面:[`sec-interface`,`interface-appearance`,`interface-language`],pet:[`sec-desktop-pet`,`desktop-pet-settings`,`desktop-pet-install`,`desktop-pet-installed`],宠物:[`sec-desktop-pet`,`desktop-pet-settings`,`desktop-pet-install`,`desktop-pet-installed`],update:[`sec-updates`,`updates-main`,`updates-components`],更新:[`sec-updates`,`updates-main`,`updates-components`],network:[`sec-remote-access`,`sec-mobile-server`,`remote-access-main`],网络:[`sec-remote-access`,`sec-mobile-server`,`remote-access-main`],remote:[`sec-remote-access`,`sec-mobile-server`,`remote-access-main`],远程:[`sec-remote-access`,`sec-mobile-server`,`remote-access-main`],notification:[`sec-notifications`,`notifications-browser`,`notifications-templates`],通知:[`sec-notifications`,`notifications-browser`,`notifications-templates`],language:[`interface-language`],语言:[`interface-language`]},f=12;function p(e){return[r(e.titleKey,`zh-CN`).toLowerCase(),r(e.titleKey,`en-US`).toLowerCase()]}function m(e,t){let n=e.trim().toLowerCase();if(!n)return[];let i=new Set(d[n]||[]);for(let e of n.split(/\s+/))for(let t of d[e]||[])i.add(t);let a=[];for(let e of u){let[t,r]=p(e),o=0;i.has(e.id)?o=100:t===n||r===n?o=90:t.startsWith(n)||r.startsWith(n)?o=80:t.includes(n)||r.includes(n)?o=65:(e.keywords||[]).some(e=>{let t=e.toLowerCase();return t.includes(n)?n.length>=2||/[\u4e00-\u9fff]/.test(n):/[\u4e00-\u9fff]/.test(t)&&t.includes(n)})&&(o=40),o>0&&a.push({entry:e,score:o})}a.sort((e,t)=>t.score-e.score);let o=new Set,s=[];for(let{entry:e}of a){let n={entry:e,title:r(e.titleKey,t),sectionTitle:r(l[e.section],t)},i=`${e.section}|${n.title}`;if(!o.has(i)&&(o.add(i),s.push(n),s.length>=f))break}return s}var h=`pisper:config-card-highlight`,g=null;function _(e,t){g={card:e,section:t},window.dispatchEvent(new Event(h))}function v(){let e=g;return g=null,e}function y(e){let t=document.querySelector(`[data-config-card="${e.card}"]`);if(t||=document.querySelector(`[data-config-card="${c}"]`),!t)return;t.scrollIntoView({behavior:`smooth`,block:`center`});let n={boxShadow:t.style.boxShadow,borderColor:t.style.borderColor,transition:t.style.transition};t.style.transition=`box-shadow .3s ease, border-color .3s ease`,t.style.boxShadow=`0 0 0 3px var(--focus-ring)`,t.style.borderColor=`var(--focus)`,window.setTimeout(()=>{t.style.boxShadow=n.boxShadow,t.style.borderColor=n.borderColor,t.style.transition=n.transition},1200)}function b(e){(0,s.useEffect)(()=>{let e=()=>{let e=v();e&&requestAnimationFrame(()=>requestAnimationFrame(()=>y(e)))};return e(),window.addEventListener(h,e),()=>window.removeEventListener(h,e)},[e])}export{o as a,b as i,_ as n,a as o,m as r,i as s,c as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./vendor-react-CHuvPdJE.js";import{i as r,o as i}from"./button-XhIEgIsg.js";import{d as a,f as o,h as s,m as c,p as l}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./vendor-react-CHuvPdJE.js";import{i as r,o as i}from"./button-XhIEgIsg.js";import{d as a,f as o,h as s,m as c,p as l}from"./use-i18n-jYw5s_Yn.js";import{a as u,i as d,l as f,n as p,r as m,s as h,t as g,u as _}from"./es2015-DycjrqX-.js";import{n as v}from"./dist-cR3ayBwn.js";var y=e(t(),1),b=n(),x=Object.defineProperty,S=(e,t)=>x(e,`name`,{value:t,configurable:!0}),C=`Dialog`,[w,T]=c(C),[E,D]=w(C),O=S(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=e,c=y.useRef(null),l=y.useRef(null),[u,d]=a({prop:r,defaultProp:i??!1,onChange:o,caller:C}),[f,p]=y.useState(0),[m,h]=y.useState(0);return(0,b.jsx)(E,{scope:t,triggerRef:c,contentRef:l,contentId:v(),titleId:v(),descriptionId:v(),titlePresent:f>0,descriptionPresent:m>0,setTitleCount:p,setDescriptionCount:h,open:u,onOpenChange:d,onOpenToggle:y.useCallback(()=>d(e=>!e),[d]),modal:s,children:n})},`Dialog`),k=`DialogTrigger`,A=y.forwardRef(S(function(e,t){let{__scopeDialog:n,...r}=e,a=D(k,n),o=i(t,a.triggerRef);return(0,b.jsx)(s.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":X(a.open),...r,ref:o,onClick:l(e.onClick,a.onOpenToggle)})},`DialogTrigger`)),j=`DialogPortal`,[M,N]=w(j,{forceMount:void 0}),P=S(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=D(j,t);return(0,b.jsx)(M,{scope:t,forceMount:n,children:y.Children.map(r,e=>(0,b.jsx)(_,{present:n||a.open,children:(0,b.jsx)(d,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),F=`DialogOverlay`,I=y.forwardRef(S(function(e,t){let n=N(F,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=D(F,e.__scopeDialog);return a.modal?(0,b.jsx)(_,{present:r||a.open,children:(0,b.jsx)(R,{...i,ref:t})}):null},`DialogOverlay`)),L=r(`DialogOverlay.RemoveScroll`),R=y.forwardRef(S(function(e,t){let{__scopeDialog:n,...r}=e,a=D(F,n),o=f(),c=i(t,o);return(0,b.jsx)(p,{as:L,allowPinchZoom:!0,shards:[a.contentRef],children:(0,b.jsx)(s.div,{"data-state":X(a.open),...r,ref:c,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),z=`DialogContent`,B=y.forwardRef(S(function(e,t){let n=N(z,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=D(z,e.__scopeDialog);return(0,b.jsx)(_,{present:r||a.open,children:a.modal?(0,b.jsx)(V,{...i,ref:t}):(0,b.jsx)(H,{...i,ref:t})})},`DialogContent`)),V=y.forwardRef(S(function(e,t){let n=D(z,e.__scopeDialog),r=y.useRef(null),a=i(t,n.contentRef,r);return y.useEffect(()=>{let e=r.current;if(e)return g(e)},[]),(0,b.jsx)(U,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:l(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:l(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:l(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),H=y.forwardRef(S(function(e,t){let n=D(z,e.__scopeDialog),r=y.useRef(!1),i=y.useRef(!1);return(0,b.jsx)(U,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),U=y.forwardRef(S(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=D(z,n);return m(),(0,b.jsx)(b.Fragment,{children:(0,b.jsx)(u,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,b.jsx)(h,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":X(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),W=`DialogTitle`,G=y.forwardRef(S(function(e,t){let{__scopeDialog:n,...r}=e,i=D(W,n),{setTitleCount:a}=i;return o(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,b.jsx)(s.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),K=`DialogDescription`,q=y.forwardRef(S(function(e,t){let{__scopeDialog:n,...r}=e,i=D(K,n),{setDescriptionCount:a}=i;return o(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,b.jsx)(s.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),J=`DialogClose`,Y=y.forwardRef(S(function(e,t){let{__scopeDialog:n,...r}=e,i=D(J,n);return(0,b.jsx)(s.button,{type:`button`,...r,ref:t,onClick:l(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function X(e){return e?`open`:`closed`}S(X,`getState`);export{I as a,A as c,q as i,T as l,Y as n,P as o,B as r,G as s,O as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-CHuvPdJE.js";import{f as n}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-CHuvPdJE.js";import{f as n}from"./use-i18n-jYw5s_Yn.js";var r=e(t(),1),i=Object.defineProperty,a=(e,t)=>i(e,`name`,{value:t,configurable:!0}),o=r.useId||(()=>void 0),s=0;function c(e){let[t,i]=r.useState(o());return n(()=>{e||i(e=>e??String(s++))},[e]),e||(t?`radix-${t}`:``)}a(c,`useId`);var l=Object.defineProperty,u=(e,t)=>l(e,`name`,{value:t,configurable:!0});function d(e){let t=r.useRef(e);return r.useEffect(()=>{t.current=e}),r.useMemo(()=>((...e)=>t.current?.(...e)),[])}u(d,`useCallbackRef`);export{c as n,d as t};
|