pisper 0.6.3 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +0 -6
- package/README.md +0 -6
- package/bin/pisper.mjs +7 -15
- package/lib/install.mjs +9 -49
- package/lib/npm-platform.mjs +0 -12
- package/package.json +8 -9
- package/web/.vite/manifest.json +713 -737
- package/web/assets/AppDialog-BOGrPFbo.js +1 -0
- package/web/assets/{AppOverlays-CR5iJcP5.js → AppOverlays-D1vfPPIC.js} +1 -1
- package/web/assets/AppSelect-BCexz4Ty.js +1 -0
- package/web/assets/{AppShortcuts-BachmLQ3.js → AppShortcuts-Dd4gu7qz.js} +1 -1
- package/web/assets/{AssetsPage-BltehMID.js → AssetsPage-BPhPo5eU.js} +1 -1
- package/web/assets/ChannelsPage-Cu4v-GU2.js +1 -0
- package/web/assets/ChatAppearancePage-BLRQ7aH6.js +2 -0
- package/web/assets/ChatHistoryPage-BYqJFbY5.js +1 -0
- package/web/assets/ChatPage-tqAIj2Go.js +554 -0
- package/web/assets/ConfigPage-Z-BQwP2X.js +1 -0
- package/web/assets/{DecisionsPage-DOhLbIaD.js → DecisionsPage-Db6MIGD2.js} +1 -1
- package/web/assets/{DesktopWindowControls-KmgemDO8.js → DesktopWindowControls-CBYGv94u.js} +1 -1
- package/web/assets/{FloatingWidgets-Bs7ec6lW.js → FloatingWidgets-dzsQIxAO.js} +1 -1
- package/web/assets/{GitDiffViewer-xm2LnN9r.js → GitDiffViewer-m5aLB7Li.js} +1 -1
- package/web/assets/MarkdownMessage-CA9ODRKk.js +2 -0
- package/web/assets/McpPage-rerFxjYZ.js +1 -0
- package/web/assets/MemoryPage-cukfU824.js +1 -0
- package/web/assets/MobileContextScreen-W8V4H3Xv.js +2 -0
- package/web/assets/MobileNavigation-CEVgs1Ke.js +1 -0
- package/web/assets/MobileShellContext-D8qX-BlM.js +1 -0
- package/web/assets/{PageHeader-C_bfu8Ir.js → PageHeader-DIs9bESb.js} +1 -1
- package/web/assets/{PluginsPage-BPx5ERHL.js → PluginsPage-09Um3mY4.js} +1 -1
- package/web/assets/QueryClientProvider-CHJtxoX1.js +1 -0
- package/web/assets/{QuickPromptIdeas-Bs-udcSZ.js → QuickPromptIdeas-DGIL0nN7.js} +1 -1
- package/web/assets/SchedulesPage-C75QUeB5.js +1 -0
- package/web/assets/SessionContextPanel-oaKXyi7k.js +1 -0
- package/web/assets/{SessionFilesPane-BIRQ_hHi.js → SessionFilesPane-DPijesqH.js} +2 -2
- package/web/assets/{SidebarMoreTools-BDqt5VTG.js → SidebarMoreTools-D1nDS3i0.js} +1 -1
- package/web/assets/SidebarRecentSessions-a7z2ZvDv.js +2 -0
- package/web/assets/{SidebarSettingsButton-B4_vEBS5.js → SidebarSettingsButton-CRdV0Vft.js} +1 -1
- package/web/assets/{SidebarUpdateStatus-DD8f4Fxv.js → SidebarUpdateStatus-DgNJBwgT.js} +1 -1
- package/web/assets/SkillsPage-DLirgTyX.js +1 -0
- package/web/assets/TerminalPanel-CJPy4Qhs.js +18 -0
- package/web/assets/{ThemeToggleButton-CXXbLtcY.js → ThemeToggleButton-C5QA5Kf2.js} +1 -1
- package/web/assets/{WebDesktopPet-DWFspeZE.js → WebDesktopPet-DgyHLE9y.js} +1 -1
- package/web/assets/{WorkbenchSidebarToggle-AgjfcT29.js → WorkbenchSidebarToggle-CcO1Al5A.js} +1 -1
- package/web/assets/WorkflowsPage-DrKHzJvb.js +1 -0
- package/web/assets/WorkspacePicker-B3liZkwe.js +1 -0
- package/web/assets/{api-Dzobr-o_.js → api-YI8_cHpR.js} +1 -1
- package/web/assets/{app-primitives-BBXY6U2S.js → app-primitives-SxfoFmHc.js} +1 -1
- package/web/assets/app-update-Bg6w1SOW.js +32 -0
- package/web/assets/arrow-up-DST6-qVQ.js +1 -0
- package/web/assets/catalog-BPCnu3F8.js +1 -0
- package/web/assets/channels-messages-DgWnmzUo.js +1 -0
- package/web/assets/chat-api-CqF-FICX.js +1 -0
- package/web/assets/{client-store-DPMvgPNS.js → client-store-BP_3-plw.js} +1 -1
- package/web/assets/{component-api-Nwo2yGZI.js → component-api-CN9Tcn5p.js} +1 -1
- package/web/assets/config-search-DOIJENN1.js +1 -0
- package/web/assets/dist-B7rNRXig.js +1 -0
- package/web/assets/dist-C3P9WH0T.js +1 -0
- package/web/assets/dist-CXiO_DNx.js +1 -0
- package/web/assets/dist-D8Wfxh48.js +1 -0
- package/web/assets/{dropdown-menu-DmL4pJTo.js → dropdown-menu-pKRdLJUe.js} +1 -1
- package/web/assets/{events-Bwv6HmwM.js → events-KqdUtjsm.js} +1 -1
- package/web/assets/{floating-widgets-store-DIy4GSy4.js → floating-widgets-store-Pjm1AdvO.js} +2 -2
- package/web/assets/folder-DPM8D8cf.js +1 -0
- package/web/assets/house-BNrzTkx9.js +1 -0
- package/web/assets/{http-DphgzWtw.js → http-Be2GB6DH.js} +1 -1
- package/web/assets/i18n-8nTnthu6.js +1 -0
- package/web/assets/{index-iBrSU61i.js → index-AF29hfx9.js} +2 -2
- package/web/assets/index-BAmsg90v.css +2 -0
- package/web/assets/monitor-ORxecA9m.js +1 -0
- package/web/assets/mount-app-WW5hteuX.js +9 -0
- package/web/assets/panels-top-left-BlZftvhg.js +1 -0
- package/web/assets/pick-system-directory-BnIFt85A.js +1 -0
- package/web/assets/{popover-BBuzaBfd.js → popover-CQqAaq-c.js} +1 -1
- package/web/assets/public-c36e4881.js +1 -0
- package/web/assets/public-components-C4ndcOCF.js +1 -0
- package/web/assets/{runtime-capabilities-store-DaWPY5y-.js → runtime-capabilities-store-CiL3ZPEo.js} +1 -1
- package/web/assets/scale-D0LcHVmf.js +1 -0
- package/web/assets/{session-change-summary-api-DFgTzTci.js → session-change-summary-api--7cl4LDn.js} +1 -1
- package/web/assets/session-context-store-DJnHgWwb.js +1 -0
- package/web/assets/session-list-DkNhT87s.js +1 -0
- package/web/assets/settings-navigation-CI7Yt4Or.js +1 -0
- package/web/assets/{shortcuts-BO-h6OmP.js → shortcuts-C_Cph88H.js} +1 -1
- package/web/assets/side-chat-context-Dn8w9ut8.js +3 -0
- package/web/assets/{sidebar-CfWEKOIK.js → sidebar-C3YJQV72.js} +1 -1
- package/web/assets/{speech-session-DKjw0mV_.js → speech-session-CoUr4n9Q.js} +1 -1
- package/web/assets/{startup-queries-CAQZvUIR.js → startup-queries-ByepQfGF.js} +1 -1
- package/web/assets/tabs-B60r4YwO.js +1 -0
- package/web/assets/{ui-store-2wpnH8Kf.js → ui-store-BGs-dEVz.js} +1 -1
- package/web/assets/{use-i18n-BSZKFkMb.js → use-i18n-a84Zp9dV.js} +1 -1
- package/web/assets/{useCustomUiComponents-BH86kuaq.js → useCustomUiComponents-BaQ_fwbr.js} +1 -1
- package/web/assets/useQuery-D3P5wO_Z.js +1 -0
- package/web/assets/web-preview-B7L-G6kp.js +1 -0
- package/web/assets/web-preview-events-C4AW4-It.js +1 -0
- package/web/index.html +2 -2
- package/web/assets/AppSelect-D149YYg1.js +0 -1
- package/web/assets/ChannelsPage-Tuw_qicj.js +0 -1
- package/web/assets/ChatAppearancePage-DME3PgDr.js +0 -2
- package/web/assets/ChatDockView-DoGtrBpY.js +0 -2
- package/web/assets/ChatHistoryPage-DTXS6i3n.js +0 -1
- package/web/assets/ChatPage-ibc_7olm.js +0 -4
- package/web/assets/ConfigPage-CI6one5Y.js +0 -1
- package/web/assets/MarkdownMessage-H1336cMr.js +0 -2
- package/web/assets/McpPage-Ck-7aLuZ.js +0 -1
- package/web/assets/MemoryPage-BEdNJ3ot.js +0 -1
- package/web/assets/MobileContextScreen-Dasny2J9.js +0 -2
- package/web/assets/MobileThreePane-DEKMHPfN.js +0 -1
- package/web/assets/SchedulesPage-W4Mg7frl.js +0 -1
- package/web/assets/SessionContextPanel-lu9F9AJg.js +0 -1
- package/web/assets/SidebarRecentSessions-1G_huYu9.js +0 -1
- package/web/assets/SkillsPage-CpRRosmo.js +0 -1
- package/web/assets/TerminalPanel-DVKC4htc.js +0 -18
- package/web/assets/Threads-B8ij_QtI.js +0 -1
- package/web/assets/WorkflowsPage-bhQlHSzS.js +0 -1
- package/web/assets/app-update-DppJNspd.js +0 -32
- package/web/assets/arrow-right-DqLOhpA2.js +0 -1
- package/web/assets/catalog-D4eaIju4.js +0 -1
- package/web/assets/channels-messages-CeRKS_DE.js +0 -1
- package/web/assets/chat-api-DfnvubiW.js +0 -1
- package/web/assets/chevron-left-BAtyp3_6.js +0 -1
- package/web/assets/config-search-CwVhh2uc.js +0 -1
- package/web/assets/dist-DAs5KRGl.js +0 -1
- package/web/assets/dist-swnK7PHk.js +0 -1
- package/web/assets/i18n-7QvbQzOQ.js +0 -1
- package/web/assets/index-CdASiNlI.css +0 -2
- package/web/assets/local-path-reveal-DWhkyox-.js +0 -1
- package/web/assets/mobile-shell-layout-CMpTmYRX.js +0 -1
- package/web/assets/mount-app-n_05p6iW.js +0 -9
- package/web/assets/panel-left-C_lYsiIA.js +0 -1
- package/web/assets/panel-right-BSUtqUd8.js +0 -1
- package/web/assets/pick-system-directory-R1F5WyaB.js +0 -1
- package/web/assets/pin-Dc2zE4cS.js +0 -1
- package/web/assets/public-BcTP7F3I.js +0 -1
- package/web/assets/public-components-Ck5BYo6M.js +0 -1
- package/web/assets/session-list-CMaoK_ZX.js +0 -1
- package/web/assets/session-streaming-state-llCTupbI.js +0 -3
- package/web/assets/side-chat-context-Dr2QLUJA.js +0 -1
- package/web/assets/tabs-DQYVDdOp.js +0 -1
- package/web/assets/use-animation-visibility-_Xe7jeUy.js +0 -1
- package/web/assets/useQuery-DdcpUQhO.js +0 -1
- package/web/assets/vendor-dockview-Bf3Gg83W.js +0 -1
- package/web/assets/vendor-dockview-D5adAaCg.css +0 -1
- package/web/assets/web-preview-BPNd1LUd.js +0 -1
- package/web/assets/web-preview-CQbpHjt1.js +0 -1
- package/web/assets/web-preview-events-o845ErdA.js +0 -1
- package/web/assets/web-preview-panel-DVQxVfig.js +0 -552
- package/web/assets/workflow-Bg94dy8I.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./utils-C8uzG5AZ.js";/* empty css */import{t as n}from"./use-animation-visibility-_Xe7jeUy.js";var r=e(),i=[`M-20 18 C120 0 170 76 320 42 S520 2 700 54 S920 104 1100 44`,`M-30 48 C110 82 200 6 350 48 S560 94 720 44 S930 2 1110 62`,`M-20 82 C130 42 220 112 390 68 S610 24 760 74 S940 118 1110 72`,`M-30 112 C120 142 260 72 420 112 S660 154 820 106 S980 62 1120 118`];function a({className:e,...a}){let{ref:o,playing:s}=n();return(0,r.jsx)(`svg`,{ref:o,"aria-hidden":`true`,className:t(`rb-threads`,!s&&`[&>path]:[animation-play-state:paused]!`,e),preserveAspectRatio:`none`,viewBox:`0 0 1080 140`,...a,children:i.map((e,t)=>(0,r.jsx)(`path`,{d:e,style:{animationDelay:`${t*-.7}s`}},e))})}export{a as Threads};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,u as r}from"./vendor-router-CZg2bCPV.js";import{i,r as a}from"./vendor-react-DwNgTV1j.js";import{u as o}from"./i18n-7QvbQzOQ.js";import{t as s}from"./use-i18n-BSZKFkMb.js";import{n as c,r as l,t as u}from"./collapsible-C__hRcbA.js";import{t as d}from"./label-BzlNatZM.js";import{t as f}from"./AppSelect-D149YYg1.js";import{a as p,i as m,n as h,o as g,t as _}from"./popover-BBuzaBfd.js";import{i as v,n as y,r as b,t as x}from"./progress-C_G6VqQ_.js";import{t as S}from"./switch-Ci_hmu39.js";import{i as C,r as w,t as T}from"./tabs-DQYVDdOp.js";import{t as E}from"./utils-C8uzG5AZ.js";import{t as D}from"./createLucideIcon-Cd-3GVxJ.js";import{t as O}from"./arrow-left-B8oVrQ2S.js";import{i as k,n as A,r as j,t as ee}from"./zap-3wDb3GcJ.js";import{t as M}from"./bell-BjONAtgH.js";import{t as N}from"./bot-B3TaBp_T.js";import{t as P}from"./check-2vYc6QaP.js";import{t as F}from"./chevron-down-CxtxIjiP.js";import{t as te}from"./chevron-left-BAtyp3_6.js";import{t as I}from"./chevron-right-C3t2Rckj.js";import{t as L}from"./circle-check-iEdCm3Pw.js";import{t as ne}from"./circle-x-Ba4QL7Ec.js";import{t as re}from"./code-xml-BrUXrBax.js";import{t as ie}from"./copy-DHmIFc52.js";import{t as R}from"./download-BCfIiuaL.js";import{t as ae}from"./file-code-corner-BnE1ljT0.js";import{t as oe}from"./file-Bllajneu.js";import{t as se}from"./grip-vertical-B__LYT0s.js";import{t as z}from"./image-BY_c3FYU.js";import{t as ce}from"./loader-circle-BOwQzHB-.js";import{t as le}from"./message-circle-D-XrK6Ft.js";import{t as ue}from"./panel-right-BSUtqUd8.js";import{t as de}from"./paperclip-BCXrwYpb.js";import{t as fe}from"./pencil-U08v_vV9.js";import{t as pe}from"./play-DNDjDNGn.js";import{t as me}from"./plus-fQbSqB1n.js";import{t as B}from"./refresh-cw-TbWxTY4K.js";import{t as he}from"./rocket-BgLSjoHY.js";import{t as ge}from"./search-D0mqDaf_.js";import{t as _e}from"./send-Cj-W03w_.js";import{t as ve}from"./server-BgNvmqwJ.js";import{t as ye}from"./settings-2-CXJjXJS9.js";import{t as be}from"./square-bHHVTT3G.js";import{t as V}from"./trash-2-CNrPOoPR.js";import{t as xe}from"./triangle-alert-CE1q54ci.js";import{t as Se}from"./x-07u4-129.js";import{i as H,n as U,o as Ce,t as we}from"./http-DphgzWtw.js";import{t as W}from"./api-Dzobr-o_.js";import{t as G}from"./button-CQA36izu.js";import{r as Te,t as Ee}from"./useQuery-DdcpUQhO.js";import{a as De,c as Oe,i as ke,o as Ae,r as je,s as Me,t as Ne}from"./dialog-D-ER2p-D.js";import{t as K}from"./input-CvjGYteF.js";import{t as q}from"./field-3bN8nouy.js";import{r as Pe}from"./format-BRFKAYMT.js";import{n as Fe,r as Ie,t as Le}from"./card-BdUpL1KB.js";import{a as Re,r as ze}from"./app-primitives-BBXY6U2S.js";import{a as Be,i as Ve,n as He,r as Ue,t as We}from"./sheet--Om3LZxh.js";import{t as Ge}from"./usePagePrimaryAction-CWPC0C_f.js";import{n as Ke,t as qe}from"./alert-QoPGoIY6.js";import{n as Je,r as Ye,t as Xe}from"./browser-notifications-DBS0oXqN.js";import{a as Ze,c as Qe,i as $e,n as et,o as tt,r as nt,s as rt,t as it}from"./sprite-engine-catalog-D1HQWa1X.js";import{t as J}from"./textarea-bYCRTyEt.js";import{a as at,c as ot,d as st,f as ct,i as lt,l as ut,n as dt,o as ft,r as pt,s as mt,t as ht,u as gt}from"./vendor-xyflow-hxQFvEHK.js";import{n as _t,o as vt}from"./routes-C4kwUiVG.js";var yt=D(`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`}]]),bt=D(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),xt=D(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Y=e(i(),1),St=Object.freeze([`media-input`,`media-background`,`media-inpaint`,`media-generate`,`media-frames`,`media-transform`,`media-preview`,`media-export`]);function Ct(e){return typeof e==`string`&&St.some(t=>t===e)}var X=a(),wt=({className:e,...t})=>(0,X.jsx)(pt,{className:E(`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}),Tt=[`trigger`,`prompt`,`skill`,`file`,`mcp`,`notification`,`condition`,`parallel`,`approval`,...St];function Et({data:e,selected:t}){return(0,X.jsxs)(`div`,{className:E(`flow-node relative flex w-40 min-h-16 cursor-grab flex-col justify-center gap-1 rounded-xl border border-border bg-card px-3 py-2.5 text-left shadow-sm transition-shadow [&_small]:text-[11px] [&_small]:font-normal [&_small]:text-muted-foreground [&_strong]:text-[13px] [&_strong]:font-medium [&.active]:border-primary [&.active]:ring-2 [&.active]:ring-[var(--brand-blue-border)] [&.type-condition]:border-amber-500/40 [&.type-parallel]:border-violet-500/40 [&.type-approval]:border-emerald-500/40 [&.compact]:w-28 [&.compact]:min-h-10 [&.compact]:px-2 [&.compact]:py-1`,`type-${e.kind}`,t&&`active`,e.compact&&`compact`),children:[!e.compact&&e.kind!==`trigger`&&(0,X.jsx)(lt,{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:ct.Left,title:e.inputLabel,"aria-label":e.inputLabel}),!e.compact&&e.kind===`condition`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(lt,{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:ct.Right,title:`true`,"aria-label":`true`}),(0,X.jsx)(lt,{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:ct.Bottom,title:`false`,"aria-label":`false`})]}):!e.compact&&(0,X.jsx)(lt,{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:ct.Right,title:e.outputLabel,"aria-label":e.outputLabel}),(0,X.jsx)(`small`,{children:e.typeLabel}),(0,X.jsx)(`strong`,{children:e.label})]})}var Dt={workflow:Et};function Ot(e){return typeof e==`string`&&Tt.includes(e)}function kt(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 At({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}=ut(),_=(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]=ot(_);(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:st.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(!Ot(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)(mt,{nodes:x,edges:E,nodeTypes:Dt,onNodesChange:C,connectionMode:gt.Strict,deleteKeyCode:[`Backspace`,`Delete`],fitView:!0,fitViewOptions:{padding:.18,minZoom:.6,maxZoom:1,nodes:x.length>8?x.slice(0,3).map(({id:e})=>({id:e})):void 0},minZoom:.15,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)(ht,{variant:dt.Dots,gap:20,size:1.2,color:`var(--canvas-grid)`}),(0,X.jsx)(at,{className:`workflow-react-flow-minimap !m-3 !h-24 !w-36 overflow-hidden rounded-lg border border-border !bg-card shadow-sm [&_svg]:h-full [&_svg]:w-full @max-[640px]/workflow:hidden`,nodeColor:kt,nodeStrokeWidth:3,pannable:!0,zoomable:!0}),(0,X.jsx)(wt,{position:`top-left`,showInteractive:!1})]}),(0,X.jsx)(`div`,{className:`pointer-events-none absolute bottom-3 left-3 z-[5] hidden max-w-[calc(100%-180px)] rounded-md bg-card px-2 py-1 text-[11px] leading-relaxed text-muted-foreground @min-[640px]/workflow:block`,children:i})]})}function jt(e){return(0,X.jsx)(ft,{children:(0,X.jsx)(At,{...e})})}function Mt(e){return new Map(e.map((e,t)=>[e.id,t]))}function Nt(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 Pt(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=Mt(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 Ft(e,t,n,r,i=`output`){return Pt(e,[...t,{id:`__candidate__`,source:n,sourcePort:i,target:r,targetPort:`input`}]).hasCycle}var It={trigger:`触发器`,prompt:`任务`,skill:`Skill`,file:`文件`,mcp:`MCP`,notification:`通知`,condition:`判断`,parallel:`并行`,approval:`审批`,"media-input":`图片输入`,"media-inpaint":`区域修补`,"media-background":`去背景`,"media-generate":`动作生成`,"media-frames":`拆分帧`,"media-transform":`帧处理`,"media-preview":`动画预览`,"media-export":`图集输出`},Lt=[{kind:`trigger`,label:`手动触发`,Icon:ee},{kind:`prompt`,label:`运行 Prompt`,Icon:N},{kind:`skill`,label:`调用 Skill`,Icon:v},{kind:`file`,label:`读写文件`,Icon:ae},{kind:`mcp`,label:`调用 MCP`,Icon:ve},{kind:`condition`,label:`条件分支`,Icon:b},{kind:`parallel`,label:`并行汇合`,Icon:j},{kind:`approval`,label:`人工审批`,Icon:L},{kind:`notification`,label:`发送通知`,Icon:M},{kind:`media-inpaint`,label:`区域修补`,Icon:z},{kind:`media-input`,label:`图片输入`,Icon:z},{kind:`media-background`,label:`去背景`,Icon:z},{kind:`media-generate`,label:`动作生成`,Icon:z},{kind:`media-frames`,label:`拆分帧`,Icon:z},{kind:`media-transform`,label:`帧处理`,Icon:z},{kind:`media-preview`,label:`动画预览`,Icon:z},{kind:`media-export`,label:`图集输出`,Icon:z}];function Rt(e,t){return t(e===`media-inpaint`?`workflows:imageNodes.inpaint`:e===`media-input`?`workflows:imageNodes.input`:e===`media-background`?`workflows:imageNodes.background`:e===`media-generate`?`workflows:imageNodes.generate`:e===`media-frames`?`workflows:imageNodes.frames`:e===`media-transform`?`workflows:imageNodes.transform`:e===`media-preview`?`workflows:imageNodes.preview`:e===`media-export`?`workflows:imageNodes.export`: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 zt(e,t){return Ct(e)?Rt(e,t):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 Bt(e,t){return t(e===`sprite`?`workflows:imageNodes.templateName`: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 Vt(e,t){return t(e===`sprite`?`workflows:imageNodes.templateDescription`: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:[],...Ct(t)?{image:nt()}:{},...o}}function Ht(e){return Nt(e,()=>crypto.randomUUID())}function Ut(e){return[{id:`input-task`,name:`task`,label:e?e(`workflows:inputs.task`):`本次任务`,description:e?e(`workflows:inputs.taskHint`):`描述这次运行需要完成的目标。`,type:`text`,required:!0,defaultValue:``},{id:`input-materials`,name:`materials`,label:e?e(`workflows:inputs.materials`):`参考材料`,description:e?e(`workflows:inputs.materialsHint`):`填写文件路径、链接、代码片段或需要处理的内容。`,type:`text`,required:!1,defaultValue:``},{id:`input-constraints`,name:`constraints`,label:e?e(`workflows:inputs.constraints`):`约束与输出要求`,description:e?e(`workflows:inputs.constraintsHint`):`说明范围、格式、禁止操作及验收条件。`,type:`text`,required:!1,defaultValue:``}]}function Wt(e){return`${e}\n\n本次任务:{{inputs.task}}\n参考材料:{{inputs.materials}}\n约束与输出要求:{{inputs.constraints}}\n以本次运行输入限定任务范围,节点只规定处理方法;不要把节点示例或工作流名称当作本次任务。`}var Gt=[{id:`code-review`,name:`代码审查`,description:`读取 diff → 运行测试 → 生成 review`,Icon:re,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:b,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:ge,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:oe,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:z,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:he,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)]}].map(e=>({...e,inputs:Ut(),nodes:e.nodes.map(e=>[`prompt`,`file`,`skill`,`mcp`].includes(e.kind)?{...e,prompt:Wt(e.prompt)}:e)}));function Kt(){let e=[Z(`sprite-trigger`,`trigger`,`手动触发`,``,0,180),Z(`sprite-source`,`media-input`,`参考图片`,``,180,180)],t=[{id:`sprite-input`,source:`sprite-trigger`,target:`sprite-source`,sourcePort:`output`,targetPort:`input`}];return[{id:`idle`,label:`待机呼吸`,prompt:`Subtle breathing idle cycle. Preserve the reference style; the feet stay planted.`},{id:`walk`,label:`走路`,prompt:`Walking cycle: alternating foot contact, passing pose and opposite contact. Keep the character in place.`},{id:`run`,label:`跑步`,prompt:`Running cycle: contact, compression, passing and flight. Preserve proportions and keep the character in place.`},{id:`attack`,label:`攻击`,prompt:`Attack sequence: anticipation, wind-up, strike and recovery. Use only the equipment visible in the reference.`}].forEach((n,r)=>{let i=r*140,a=[Z(`${n.id}-generate`,`media-generate`,n.label,`${n.prompt}\n{{inputs.task}}`,380,i,{image:nt({action:n.id,frameCount:4,directions:[...et]})}),Z(`${n.id}-background`,`media-background`,`色键去背景`,``,560,i),Z(`${n.id}-frames`,`media-frames`,`拆分连续帧`,``,740,i),Z(`${n.id}-align`,`media-transform`,`裁边与脚底对齐`,``,920,i)];e.push(...a);let o=[`sprite-source`,...a.map(e=>e.id),`sprite-preview`];for(let e=1;e<o.length;e++)t.push({id:`${n.id}-edge-${e}`,source:o[e-1],target:o[e],sourcePort:`output`,targetPort:`input`})}),e.push(Z(`sprite-preview`,`media-preview`,`动画预览`,``,1100,180),Z(`sprite-export`,`media-export`,`输出精灵图集`,``,1280,180)),t.push({id:`sprite-output`,source:`sprite-preview`,target:`sprite-export`,sourcePort:`output`,targetPort:`input`}),{id:`sprite`,name:`游戏精灵图生成`,description:`参考图 → 分方向动作 → 去背景 → 拆帧对齐 → 动画预览 → 图集`,Icon:z,nodes:e,edges:t,inputs:[{id:`sprite-reference`,name:`reference`,type:`image`,required:!0,label:`角色参考图`,description:`上传图片并保留原图风格。`,defaultValue:null},{id:`sprite-task`,name:`task`,type:`text`,required:!1,label:`角色与动作要求`,description:`本次运行的角色特征、动作及其他要求。`,defaultValue:``}]}}Gt.push(Kt());function qt(e){return e.nodes.reduce((e,t)=>e+(t.enabled&&t.kind===`media-generate`?nt(t.image).directions.length:0),0)}function Jt(e=``,t){let n=[Z(crypto.randomUUID(),`trigger`,`手动触发`,``,65,45),Z(crypto.randomUUID(),`prompt`,`运行 Prompt`,Wt(`按本次输入完成任务,结合材料执行所需步骤,验证产物并报告结果。`),235,45)];return{id:``,name:`未命名工作流`,description:``,status:`draft`,revision:1,cwd:e,model:null,inputs:Ut(t),tags:[],visibility:`private`,notifications:[],nodes:n,edges:Ht(n)}}function Yt(e,t){if(e.kind===`media-generate`){if(e.image?.action===`idle`)return t(`workflows:imageNodes.idle`);if(e.image?.action===`walk`)return t(`workflows:imageNodes.walk`);if(e.image?.action===`run`)return t(`workflows:imageNodes.run`);if(e.image?.action===`attack`)return t(`workflows:imageNodes.attack`)}return zt(e.kind,t)}function Xt(e,t=``,n){let r=e.nodes.map(t=>({...structuredClone(t),...e.id===`sprite`&&n?{label:Yt(t,n)}:{},id:crypto.randomUUID()})),i=Gt.includes(e)?Ut(n):[],a=new Map(e.nodes.map((e,t)=>[e.id,r[t].id]));return{...Jt(t,n),name:n&&Gt.includes(e)?Bt(e.id,n):e.name,description:n&&Gt.includes(e)?Vt(e.id,n):e.description,inputs:e.inputs.map(t=>{let r=i.find(e=>e.name===t.name);return{...structuredClone(t),...r?{label:r.label,description:r.description}:{},...e.id===`sprite`&&t.name===`reference`&&n?{label:n(`workflows:imageNodes.reference`),description:n(`workflows:imageNodes.referenceHint`)}:{},id:crypto.randomUUID()}}),nodes:r,edges:e.edges?e.edges.map(e=>({...e,id:crypto.randomUUID(),source:a.get(e.source)??``,target:a.get(e.target)??``})):Ht(r)}}function Zt({nodeCount:e,t,onAddNode:n}){let[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(``),s=[{label:t(`workflows:editor.flowNodes`),match:e=>[`trigger`,`condition`,`parallel`,`approval`].includes(e)},{label:t(`workflows:editor.agentNodes`),match:e=>[`prompt`,`skill`,`file`,`mcp`,`notification`].includes(e)},{label:t(`workflows:editor.imageNodes`),match:Ct}],c=Lt.filter(({kind:e})=>zt(e,t).toLocaleLowerCase().includes(a.trim().toLocaleLowerCase()));return(0,X.jsxs)(_,{open:r,onOpenChange:i,children:[(0,X.jsx)(m,{asChild:!0,children:(0,X.jsxs)(G,{variant:`outline`,size:`sm`,children:[(0,X.jsx)(me,{}),t(`workflows:editor.addNode`)]})}),(0,X.jsxs)(h,{align:`end`,className:`w-72 max-w-[calc(100vw-2rem)] p-2`,"aria-label":t(`workflows:workflowsPage.nodeLibrary`),children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(ge,{className:`pointer-events-none absolute left-2.5 top-2.5 size-4 text-muted-foreground`}),(0,X.jsx)(K,{value:a,onChange:e=>o(e.target.value),className:`pl-8`,placeholder:t(`workflows:editor.searchNodes`),"aria-label":t(`workflows:editor.searchNodes`)})]}),(0,X.jsxs)(`div`,{className:`node-library max-h-[min(420px,60vh)] overflow-y-auto overscroll-contain supports-[height:100dvh]:max-h-[min(420px,60dvh)]`,children:[s.map(r=>{let a=c.filter(({kind:e})=>r.match(e));return a.length===0?null:(0,X.jsxs)(`section`,{className:`py-1`,children:[(0,X.jsx)(`h3`,{className:`px-2 py-1.5 text-xs font-medium text-muted-foreground`,children:r.label}),a.map(({kind:r,Icon:a})=>(0,X.jsxs)(`button`,{type:`button`,draggable:!0,className:`flex min-h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>{n(r,zt(r,t),{x:160+e%4*180,y:100+Math.floor(e/4)*100}),i(!1)},onDragStart:e=>e.dataTransfer.setData(`text/plain`,JSON.stringify({kind:r,label:zt(r,t)})),onDragEnd:()=>i(!1),children:[(0,X.jsx)(a,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsx)(`span`,{className:`flex-1`,children:zt(r,t)}),(0,X.jsx)(se,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]},r))]},r.label)}),c.length===0&&(0,X.jsx)(`p`,{className:`p-3 text-xs text-muted-foreground`,children:t(`workflows:editor.noMatchingNodes`)})]})]})]})}function Qt({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.jsx)(`section`,{className:`builder-canvas relative h-full min-h-0 min-w-0 overflow-hidden bg-[var(--canvas-bg)]`,"aria-label":r(`workflows:editor.canvas`),children:(0,X.jsx)(jt,{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=>Rt(e,r),onAddNode:i,onConnect:a,onMoveNode:o,onSelectNode:s,onSelectEdge:c,onClearSelection:l,onDeleteNodes:u,onDeleteEdges:d})})}function $t(e){if(e.size>134217728)throw new Ce(`Workflow package exceeds 128 MiB`,{kind:`protocol`,data:{code:`workflow_bundle_too_large`}})}function en(e){return e instanceof Ce&&e.data?.code===`workflow_bundle_too_large`}function tn(e,t){return we(`/api/workflows/${encodeURIComponent(e)}/bundle`,{signal:t,timeout:12e4})}async function nn(e,t){return $t(e),U(`/api/workflows/import-bundle`,{method:`POST`,data:e,signal:t,timeout:12e4,parse:e=>{if(!e||typeof e!=`object`||!(`workflow`in e))throw H();let t=e.workflow;if(!t||typeof t!=`object`||!(`id`in t)||typeof t.id!=`string`)throw H()}})}var rn={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 Q(e){let t=e instanceof Ce?e.data?.code:typeof e==`string`?e:e&&typeof e==`object`&&`code`in e?e.code:``;return t===`workflow_image_source_stale`?o(`workflows:imageNodes.sourceStale`):t===`workflow_image_source_required`?o(`workflows:imageNodes.sourceRequired`):t===`workflow_image_engine_missing`?o(`workflows:imageNodes.engineMissing`):t===`workflow_image_generation_failed`?o(`workflows:imageNodes.generationFailed`):t===`workflow_image_too_large`?o(`workflows:imageNodes.tooLarge`):t===`workflow_image_timeout`?o(`workflows:imageNodes.timeout`):typeof t==`string`&&t.startsWith(`workflow_image_`)?o(`workflows:imageNodes.invalidOutput`):e instanceof Error?e.message:String(e)}function an({notify:e,requestConfirm:t,query:n}){let{t:r}=s(),[i,a]=(0,Y.useState)(rn),[o,c]=(0,Y.useState)(`all`),[l,u]=(0,Y.useState)(!0),[d,f]=(0,Y.useState)(``),[p,m]=(0,Y.useState)(``),h=(0,Y.useRef)(null);(0,Y.useEffect)(()=>()=>h.current?.abort(),[]);let g=(0,Y.useCallback)(async()=>{try{a(await W(`/api/workflows`)),m(``)}catch(e){m(Q(e))}finally{u(!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:o,setFilter:c,loading:l,busyId:d,error:p,visibleWorkflows:(0,Y.useMemo)(()=>i.workflows.filter(e=>{let t=_(e.id);return`${e.name} ${e.description}`.toLowerCase().includes(n.toLowerCase())?o===`running`?t?.status===`running`:o===`failed`?t?.status===`failed`:o===`draft`?e.status===`draft`:o!==`presets`:!1}),[i.workflows,o,_,n]),latestRun:_,runWorkflow:(0,Y.useCallback)(async(t,n={})=>{f(t.id),m(``);try{return await W(`/api/workflows/${encodeURIComponent(t.id)}/run`,{method:`POST`,body:JSON.stringify({inputs:n})}),await g(),e(r(`workflows:workflowsPage.workflowStarted`)),!0}catch(t){let n=Q(t);return m(n),e(n,`error`),!1}finally{f(``)}},[g,e,r]),stopRun:(0,Y.useCallback)(async t=>{f(t.id),m(``);try{await W(`/api/workflow-runs/${encodeURIComponent(t.id)}/stop`,{method:`POST`,body:`{}`}),await g(),e(r(`workflows:workflowsPage.stoppingWorkflow`),`info`)}catch(t){let n=Q(t);m(n),e(n,`error`)}finally{f(``)}},[g,e,r]),retryRun:(0,Y.useCallback)(async t=>{f(t.id);try{await W(`/api/workflow-runs/${encodeURIComponent(t.id)}/retry`,{method:`POST`,body:`{}`}),await g(),e(r(`workflows:workflowsPage.workflowStarted`))}catch(t){let n=Q(t);m(n),e(n,`error`)}finally{f(``)}},[g,e,r]),resolveApproval:(0,Y.useCallback)(async(t,n,r)=>{f(n);try{await W(`/api/workflow-runs/${encodeURIComponent(t.id)}/approvals/${encodeURIComponent(n)}`,{method:`POST`,body:JSON.stringify({approved:r})}),await g()}catch(t){let n=Q(t);m(n),e(n,`error`)}finally{f(``)}},[g,e]),duplicateWorkflow:(0,Y.useCallback)(async t=>{f(t.id);try{await W(`/api/workflows/${encodeURIComponent(t.id)}/duplicate`,{method:`POST`,body:`{}`}),await g(),e(r(`workflows:workflowsPage.workflowDuplicated`))}catch(t){let n=Q(t);m(n),e(n,`error`)}finally{f(``)}},[g,e,r]),exportWorkflow:(0,Y.useCallback)(async t=>{if(h.current)return;let n=new AbortController;h.current=n,f(t.id);try{let e=await tn(t.id,n.signal);if(n.signal.aborted)return;let r=URL.createObjectURL(e),i=document.createElement(`a`);i.href=r,i.download=`${t.name.replace(/[\\/:*?"<>|]/g,`-`)}.pisper-workflow.zip`,i.click(),window.setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch{n.signal.aborted||e(r(`workflows:workflowsPage.packageFailed`),`error`)}finally{h.current=null,n.signal.aborted||f(``)}},[e,r]),importWorkflow:(0,Y.useCallback)(async t=>{if(h.current)return;let n=new AbortController;h.current=n,f(`import`);try{if(await nn(t,n.signal),n.signal.aborted||(await g(),n.signal.aborted))return;e(r(`workflows:workflowsPage.workflowImported`))}catch(t){if(n.signal.aborted)return;let i=en(t)?r(`workflows:workflowsPage.packageTooLarge`):r(`workflows:workflowsPage.packageFailed`);m(i),e(i,`error`)}finally{h.current=null,n.signal.aborted||f(``)}},[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`})){f(n.id);try{await W(`/api/workflows/${encodeURIComponent(n.id)}`,{method:`DELETE`}),await g(),e(r(`workflows:workflowsPage.workflowDeleted`))}catch(t){let n=Q(t);m(n),e(n,`error`)}finally{f(``)}}},[g,e,t,r])}}function on(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 sn(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 cn({value:e,onChange:t,t:n}){return(0,X.jsx)(T,{value:e,onValueChange:e=>t(e),children:(0,X.jsxs)(w,{className:`[&_[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] [&_[data-slot='tabs-trigger']]:after:hidden w-fit max-w-full justify-start overflow-x-auto overflow-y-hidden [scrollbar-width:none]! [&::-webkit-scrollbar]:hidden`,children:[(0,X.jsx)(C,{value:`workflows`,children:n(`workflows:workflowsPage.workflows`)}),(0,X.jsx)(C,{value:`runs`,children:n(`workflows:workflowsPage.runHistory`)}),(0,X.jsx)(C,{value:`templates`,children:n(`workflows:workflowsPage.templates`)})]})})}function ln({workflows:e,runs:t,busyId:n,language:r,t:i,onRun:a,onEdit:o,onDuplicate:s,onExport:c,onImport:l,onDelete:u}){let d=(0,Y.useRef)(null),f=e=>t.filter(t=>t.workflowId===e).sort((e,t)=>Date.parse(t.startedAt)-Date.parse(e.startedAt))[0];return(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)] workflow-assets-panel overflow-hidden gap-0 py-0`,children:(0,X.jsxs)(Fe,{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)(Ie,{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)(G,{size:`sm`,variant:`outline`,onClick:()=>d.current?.click(),children:[(0,X.jsx)(yt,{"data-icon":`inline-start`}),i(`workflows:workflowsPage.import`)]}),(0,X.jsx)(`input`,{ref:d,className:`sr-only`,type:`file`,accept:`application/zip,.zip`,onChange:e=>{let t=e.target.files?.[0];e.currentTarget.value=``,t&&l(t)}})]}),e.length?(0,X.jsx)(`div`,{className:`flex flex-col`,children:e.map(e=>{let t=f(e.id),l=[`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?sn(t.status,i):i(`workflows:workflowsPage.neverRun`),(0,X.jsx)(`small`,{children:t?Pe(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)(G,{size:`icon-xs`,variant:l?`secondary`:`outline`,disabled:l||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)(B,{className:`animate-spin`}):(0,X.jsx)(pe,{fill:`currentColor`})}),(0,X.jsx)(G,{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)(fe,{})}),(0,X.jsx)(G,{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)(ie,{})}),(0,X.jsx)(G,{size:`icon-xs`,variant:`ghost`,title:i(`workflows:workflowsPage.export`),"aria-label":`${i(`workflows:workflowsPage.export`)}: ${e.name}`,onClick:()=>c(e),children:(0,X.jsx)(R,{})}),(0,X.jsx)(G,{size:`icon-xs`,variant:`ghost`,disabled:l,title:i(`workflows:workflowsPage.delete`),"aria-label":`${i(`workflows:workflowsPage.delete`)}: ${e.name}`,onClick:()=>u(e),children:(0,X.jsx)(V,{})})]})]},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 un({runs:e,busyId:t,language:n,t:r,onStop:i,onRetry:a,onApproval:o}){let[s,c]=(0,Y.useState)(e[0]?.id||``),l=[...e].sort((e,t)=>Date.parse(t.startedAt)-Date.parse(e.startedAt));return(0,X.jsxs)(`div`,{className:`flex flex-col gap-[8px]`,children:[l.map(e=>{let l=s===e.id,u=Math.round((Number(e.completedNodes)||0)/Math.max(1,Number(e.totalNodes)||1)*100);return(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)] overflow-hidden gap-0 py-0`,children:(0,X.jsxs)(Fe,{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:()=>c(l?``:e.id),children:[l?(0,X.jsx)(F,{size:15}):(0,X.jsx)(I,{size:15}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:e.workflowName||e.workflowId}),(0,X.jsxs)(`small`,{children:[sn(e.status,r),` · `,Pe(e.startedAt,n),` · v`,e.workflowRevision||1]})]}),(0,X.jsx)(x,{value:e.status===`completed`?100:u}),(0,X.jsx)(`em`,{children:on(e.durationMs)})]}),l&&(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?Q(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)(P,{size:14}):n.status===`failed`?(0,X.jsx)(ne,{size:14}):n.status===`running`||n.status===`waiting_approval`?(0,X.jsx)(B,{className:n.status===`running`?`animate-spin`:``,size:14}):(0,X.jsx)(be,{size:12})}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:n.label}),(0,X.jsxs)(`small`,{children:[sn(n.status,r),` · `,on(n.durationMs),` ·`,` `,r(`workflows:workflowsPage.countAttempts`,{count:n.attempts||0})]}),(n.error||n.summary)&&(0,X.jsx)(`p`,{children:n.error?Q(n.error):n.summary})]}),n.status===`waiting_approval`&&(0,X.jsxs)(`div`,{className:`workflow-approval-actions flex gap-[6px]`,children:[(0,X.jsxs)(G,{size:`xs`,disabled:t===n.id,onClick:()=>o(e,n.id,!0),children:[(0,X.jsx)(P,{"data-icon":`inline-start`}),r(`workflows:workflowsPage.approve`)]}),(0,X.jsxs)(G,{size:`xs`,variant:`destructive`,disabled:t===n.id,onClick:()=>o(e,n.id,!1),children:[(0,X.jsx)(ne,{"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)(G,{size:`sm`,variant:`destructive`,onClick:()=>i(e),children:[(0,X.jsx)(be,{"data-icon":`inline-start`}),r(`workflows:workflowsPage.stop`)]}):[`failed`,`cancelled`,`interrupted`].includes(e.status)?(0,X.jsxs)(G,{size:`sm`,variant:`outline`,onClick:()=>a(e),children:[(0,X.jsx)(B,{"data-icon":`inline-start`}),r(`workflows:workflowsPage.retryRun`)]}):null})]})]})},e.id)}),!l.length&&(0,X.jsx)(ze,{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 dn({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:Gt.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:Bt(n.id,e)}),(0,X.jsx)(`small`,{children:Vt(n.id,e)})]}),(0,X.jsx)(I,{size:15})]},n.id)})})}function fn({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:on(a)}),t(`workflows:workflowsPage.averageDuration`)]})]})}function pn({value:e=``,onValueChange:t,files:n=[],onFilesSelected:r,onRemoveFile:i,accept:a=`media`,allowFiles:o=!0,allowText:s=!0,multiple:c=!1,disabled:l=!1,label:u,placeholder:f,attachmentLabel:p,removeLabel:m,children:h,className:g,maxLength:_}){let v=(0,Y.useId)(),b=(0,Y.useRef)(null),x=a===`image`?`image/png,image/jpeg,image/webp`:a===`video`?`video/mp4,video/webm`:`image/png,image/jpeg,image/webp,video/mp4,video/webm`;return(0,X.jsxs)(`div`,{className:E(`flex min-w-0 flex-col gap-2`,g),children:[(0,X.jsx)(d,{htmlFor:s?`${v}-text`:`${v}-picker`,children:u}),(0,X.jsxs)(`div`,{className:`min-w-0 rounded-xl border bg-background focus-within:ring-2 focus-within:ring-ring/25`,onDragOver:e=>{o&&e.preventDefault()},onDrop:e=>{o&&(e.preventDefault(),!l&&e.dataTransfer.files.length&&r?.(Array.from(e.dataTransfer.files)))},children:[s&&(0,X.jsx)(J,{id:`${v}-text`,value:e,onChange:e=>t?.(e.target.value),placeholder:f,disabled:l,maxLength:_,className:`min-h-28 resize-y border-0 bg-transparent shadow-none focus-visible:ring-0`}),n.length>0&&(0,X.jsx)(`ul`,{className:E(`grid min-w-0 gap-2 p-3`,n.length>1&&`sm:grid-cols-2`),children:n.map(e=>(0,X.jsxs)(`li`,{className:`relative min-w-0 rounded-lg border bg-muted/20 p-2`,children:[e.url&&e.mimeType.startsWith(`image/`)?(0,X.jsx)(`img`,{src:e.url,alt:e.name,className:`h-32 w-full rounded object-contain`}):e.url&&e.mimeType.startsWith(`video/`)?(0,X.jsx)(`video`,{src:e.url,controls:!0,preload:`metadata`,className:`h-32 w-full rounded object-contain`,"aria-label":e.name}):(0,X.jsx)(`div`,{className:`flex h-12 items-center justify-center text-muted-foreground`,children:e.mimeType.startsWith(`video/`)?(0,X.jsx)(A,{}):(0,X.jsx)(y,{})}),(0,X.jsx)(`p`,{className:`mt-2 truncate pr-8 text-xs`,title:e.name,children:e.name}),i&&(0,X.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:l,className:`absolute right-1 bottom-1`,"aria-label":`${m} ${e.name}`,onClick:()=>i(e.id),children:(0,X.jsx)(Se,{className:`size-3.5`})})]},e.id))}),o&&(0,X.jsxs)(`div`,{className:`p-2`,children:[(0,X.jsx)(`input`,{id:`${v}-picker`,ref:b,className:`sr-only`,type:`file`,accept:x,multiple:c,disabled:l,"aria-label":p,onChange:e=>{let t=Array.from(e.currentTarget.files??[]);e.currentTarget.value=``,t.length&&r?.(t)}}),(0,X.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,disabled:l,onClick:()=>b.current?.click(),children:[(0,X.jsx)(de,{className:`size-4`}),p]})]})]}),h]})}function mn(e){if(!e||typeof e!=`object`||!(`models`in e)||!Array.isArray(e.models))throw H();return e.models.map(e=>{if(!e||typeof e!=`object`||!(`id`in e)||typeof e.id!=`string`||!(`name`in e)||typeof e.name!=`string`||!(`providerId`in e)||typeof e.providerId!=`string`||!(`providerName`in e)||typeof e.providerName!=`string`||!e.id.startsWith(`${e.providerId}/`))throw H();return{id:e.id,name:e.name,providerId:e.providerId,providerName:e.providerName}})}function hn(e){if(!e||typeof e!=`object`||!(`started`in e)||e.started!==!0||!(`run`in e)||!e.run||typeof e.run!=`object`||!(`id`in e.run)||typeof e.run.id!=`string`||!(`workflowId`in e.run)||typeof e.run.workflowId!=`string`)throw H();return{started:!0,run:{id:e.run.id,workflowId:e.run.workflowId}}}var gn={runNode:(e,t,n,r)=>U(`/api/workflows/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/run`,{method:`POST`,data:{sourceRunId:n},signal:r,parse:hn}),models:e=>U(`/api/workflow-image-models`,{signal:e,parse:mn})},_n=[`workflows`,`sprite-engines`];function vn(e){try{return it(e)}catch{throw H()}}var yn={catalog:e=>U(`/api/sprite-engines`,{signal:e,parse:vn}),download:(e,t)=>U(`/api/sprite-engines/${e}/download`,{method:`POST`,data:{},signal:t,parse:vn}),cancel:(e,t)=>U(`/api/sprite-engines/${e}/cancel`,{method:`POST`,data:{},signal:t,parse:vn}),remove:(e,t)=>U(`/api/sprite-engines/${e}`,{method:`DELETE`,signal:t,parse:vn})};function $({label:e,value:t,min:n,max:r,step:i=1,onChange:a}){return(0,X.jsxs)(q,{variant:`control`,children:[e,(0,X.jsx)(K,{type:`number`,value:t,min:n,max:r,step:i,onChange:e=>{if(!e.target.value)return;let t=e.target.valueAsNumber;Number.isFinite(t)&&a(Math.max(n,Math.min(r,t)))}})]})}function bn({t:e,id:t=`background`}){let n=Te(),[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(!1),s=(0,Y.useRef)(null);(0,Y.useEffect)(()=>()=>s.current?.abort(),[]);let c=Ee({queryKey:_n,queryFn:({signal:e})=>yn.catalog(e),refetchInterval:e=>e.state.data?.engines.some(e=>e.status===`downloading`)?1e3:!1}),l=c.data?.engines.find(e=>e.id===t),u=async()=>{if(s.current)return;let e=new AbortController;s.current=e,o(!0),i(!1);try{n.setQueryData(_n,await yn.download(t,e.signal))}catch{e.signal.aborted||i(!0)}finally{e.signal.aborted||o(!1),s.current===e&&(s.current=null)}};return(0,X.jsxs)(`div`,{className:`space-y-2 rounded-lg border p-3 text-xs`,children:[(0,X.jsx)(`p`,{children:e(`workflows:imageNodes.modelHint`)}),(0,X.jsx)(`p`,{children:l?.status===`ready`?e(`workflows:imageNodes.engineReady`):l?.status===`downloading`?e(`workflows:imageNodes.engineDownloading`,{percent:Math.round(l.total?100*l.received/l.total:0)}):e(`workflows:imageNodes.engineMissing`)}),(r||c.isError||l?.status===`failed`)&&(0,X.jsx)(`p`,{role:`alert`,children:e(`workflows:imageNodes.engineFailed`)}),l?.status!==`ready`&&(0,X.jsxs)(G,{size:`sm`,variant:`outline`,disabled:a||l?.status===`downloading`,onClick:()=>void u(),children:[a||l?.status===`downloading`?(0,X.jsx)(ce,{className:`animate-spin`}):(0,X.jsx)(R,{}),e(`workflows:imageNodes.download`)]})]})}function xn({node:e,inputs:t,t:n,onChange:r}){let i=nt(e.image),a=e=>r({image:{...i,...e}}),o=Ee({queryKey:[`workflows`,`image-models`],queryFn:({signal:e})=>gn.models(e),enabled:e.kind===`media-generate`}),[s,c]=(0,Y.useState)(0);(0,Y.useEffect)(()=>c(0),[e.id]);let l=i.transforms.find(e=>e.index===s)??{index:s,x:0,y:0,rotation:0,scale:1,opacity:1,durationMs:i.durationMs,enabled:!0},u=e=>a({transforms:[...i.transforms.filter(e=>e.index!==s),{...l,...e}]}),d=i.frameOrder,m=(e,t)=>{let n=[...d],r=e+t;r<0||r>=n.length||([n[e],n[r]]=[n[r],n[e]],a({frameOrder:n}))};return(0,X.jsxs)(`div`,{className:`my-3 space-y-3 border-y py-3`,children:[e.kind===`media-input`&&(0,X.jsxs)(q,{variant:`control`,children:[n(`workflows:imageNodes.inputField`),(0,X.jsxs)(f,{value:i.inputName,onChange:e=>a({inputName:e.target.value}),children:[!t.some(e=>e.type===`image`&&e.name===i.inputName)&&(0,X.jsx)(`option`,{value:i.inputName,children:n(`workflows:imageNodes.chooseInput`)}),t.filter(e=>e.type===`image`).map(e=>(0,X.jsx)(`option`,{value:e.name,children:e.label},e.id))]}),(0,X.jsx)(`small`,{children:n(`workflows:imageNodes.inputHint`)})]}),e.kind===`media-generate`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(q,{variant:`control`,children:[n(`workflows:imageNodes.imageModel`),(0,X.jsxs)(f,{value:e.model?`${e.model.provider}/${e.model.model}`:``,onChange:e=>{let t=o.data?.find(t=>t.id===e.target.value);r({model:t?{provider:t.providerId,model:t.id.slice(t.providerId.length+1)}:null})},children:[(0,X.jsx)(`option`,{value:``,children:n(`workflows:imageNodes.defaultImageModel`)}),o.data?.map(e=>(0,X.jsxs)(`option`,{value:e.id,children:[e.providerName,` / `,e.name]},e.id))]}),o.isError&&(0,X.jsx)(`small`,{role:`alert`,children:n(`workflows:imageNodes.modelsFailed`)})]}),(0,X.jsxs)(q,{variant:`control`,children:[n(`workflows:imageNodes.action`),(0,X.jsx)(K,{value:i.action,maxLength:160,onChange:e=>a({action:e.target.value})})]}),(0,X.jsx)(pn,{label:n(`workflows:imageNodes.prompt`),value:e.prompt,onValueChange:e=>r({prompt:e}),allowFiles:!1,maxLength:16e3,attachmentLabel:n(`workflows:inputs.chooseImage`),removeLabel:n(`workflows:inputs.removeMedia`)}),(0,X.jsx)($,{label:n(`workflows:imageNodes.frameCount`),value:i.frameCount,min:1,max:16,onChange:e=>a({frameCount:e})}),(0,X.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,X.jsx)(`legend`,{className:`text-sm`,children:n(`workflows:imageNodes.directions`)}),(0,X.jsx)(`div`,{className:`grid grid-cols-4 gap-1`,children:et.map(e=>(0,X.jsx)(G,{size:`sm`,variant:i.directions.includes(e)?`secondary`:`outline`,"aria-pressed":i.directions.includes(e),disabled:i.directions.length===1&&i.directions[0]===e,onClick:()=>a({directions:i.directions.includes(e)?i.directions.filter(t=>t!==e):et.filter(t=>i.directions.includes(t)||t===e)}),children:e},e))})]}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`workflows:imageNodes.generateHint`,{count:i.directions.length})})]}),e.kind===`media-background`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(q,{variant:`control`,children:[n(`workflows:imageNodes.method`),(0,X.jsxs)(f,{value:i.method,onChange:e=>a({method:e.target.value===`model`?`model`:`color`}),children:[(0,X.jsx)(`option`,{value:`color`,children:n(`workflows:imageNodes.colorKey`)}),(0,X.jsx)(`option`,{value:`model`,children:n(`workflows:imageNodes.localModel`)})]})]}),i.method===`model`?(0,X.jsx)(bn,{t:n}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`p`,{className:`text-sm`,children:n(`workflows:imageNodes.colors`)}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`workflows:imageNodes.colorsHint`)}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:i.colors.map((e,t)=>(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(`input`,{className:`h-8 w-10 cursor-pointer rounded border`,type:`color`,value:e,"aria-label":n(`workflows:imageNodes.colorAt`,{index:t+1}),onChange:e=>a({colors:i.colors.map((n,r)=>r===t?e.target.value:n)})}),(0,X.jsx)(G,{size:`icon-xs`,variant:`ghost`,"aria-label":n(`workflows:imageNodes.removeColor`),onClick:()=>a({colors:i.colors.filter((e,n)=>n!==t)}),children:(0,X.jsx)(V,{})})]},t))}),(0,X.jsxs)(G,{size:`sm`,variant:`outline`,disabled:i.colors.length>=8,onClick:()=>a({colors:[...i.colors,`#00ff00`]}),children:[(0,X.jsx)(me,{}),n(`workflows:imageNodes.addColor`)]})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,X.jsx)($,{label:n(`workflows:imageNodes.tolerance`),value:i.tolerance,min:0,max:255,onChange:e=>a({tolerance:e})}),(0,X.jsx)($,{label:n(`workflows:imageNodes.softness`),value:i.softness,min:0,max:64,onChange:e=>a({softness:e})})]}),(0,X.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[n(`workflows:imageNodes.edgeConnected`),(0,X.jsx)(S,{checked:i.edgeConnected,onCheckedChange:e=>a({edgeConnected:e})})]})]})]}),e.kind===`media-inpaint`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`workflows:imageNodes.regionHint`)}),(0,X.jsx)(bn,{t:n,id:`inpaint`}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,X.jsx)($,{label:n(`workflows:imageNodes.regionX`),value:i.region.x,min:0,max:99,onChange:e=>a({region:{...i.region,x:e}})}),(0,X.jsx)($,{label:n(`workflows:imageNodes.regionY`),value:i.region.y,min:0,max:99,onChange:e=>a({region:{...i.region,y:e}})}),(0,X.jsx)($,{label:n(`workflows:imageNodes.regionWidth`),value:i.region.width,min:1,max:100,onChange:e=>a({region:{...i.region,width:e}})}),(0,X.jsx)($,{label:n(`workflows:imageNodes.regionHeight`),value:i.region.height,min:1,max:100,onChange:e=>a({region:{...i.region,height:e}})})]})]}),e.kind===`media-frames`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`workflows:imageNodes.gridHint`)}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,X.jsx)($,{label:n(`workflows:imageNodes.columns`),value:i.columns,min:1,max:16,onChange:e=>a({columns:e})}),(0,X.jsx)($,{label:n(`workflows:imageNodes.rows`),value:i.rows,min:1,max:16,onChange:e=>a({rows:e})})]}),(0,X.jsx)($,{label:n(`workflows:imageNodes.duration`),value:i.durationMs,min:16,max:1e4,onChange:e=>a({durationMs:e})})]}),e.kind===`media-transform`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[n(`workflows:imageNodes.trim`),(0,X.jsx)(S,{checked:i.trim,onCheckedChange:e=>a({trim:e})})]}),(0,X.jsxs)(q,{variant:`control`,children:[n(`workflows:imageNodes.align`),(0,X.jsxs)(f,{value:i.align,onChange:e=>a({align:e.target.value===`center`?`center`:e.target.value===`none`?`none`:`bottom-center`}),children:[(0,X.jsx)(`option`,{value:`bottom-center`,children:n(`workflows:imageNodes.bottomCenter`)}),(0,X.jsx)(`option`,{value:`center`,children:n(`workflows:imageNodes.center`)}),(0,X.jsx)(`option`,{value:`none`,children:n(`workflows:imageNodes.noAlign`)})]})]}),(0,X.jsx)($,{label:n(`workflows:imageNodes.maxFrameSize`),value:i.maxFrameSize,min:16,max:1024,onChange:e=>a({maxFrameSize:Math.round(e)})}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`workflows:imageNodes.maxFrameSizeHint`,{size:i.maxFrameSize})}),(0,X.jsx)($,{label:n(`workflows:imageNodes.padding`),value:i.padding,min:0,max:64,onChange:e=>a({padding:e})}),(0,X.jsxs)(`details`,{className:`rounded-lg border p-3`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:n(`workflows:imageNodes.frameEdits`)}),(0,X.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,X.jsx)($,{label:n(`workflows:imageNodes.frameNumber`),value:s+1,min:1,max:512,onChange:e=>c(Math.round(e)-1)}),(0,X.jsxs)(`label`,{className:`flex justify-between text-sm`,children:[n(`workflows:imageNodes.frameEnabled`),(0,X.jsx)(S,{checked:l.enabled,onCheckedChange:e=>u({enabled:e})})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,X.jsx)($,{label:`X`,value:l.x,min:-4096,max:4096,onChange:e=>u({x:e})}),(0,X.jsx)($,{label:`Y`,value:l.y,min:-4096,max:4096,onChange:e=>u({y:e})}),(0,X.jsx)($,{label:n(`workflows:imageNodes.rotation`),value:l.rotation,min:-360,max:360,onChange:e=>u({rotation:e})}),(0,X.jsx)($,{label:n(`workflows:imageNodes.scale`),value:l.scale,min:.05,max:8,step:.05,onChange:e=>u({scale:e})}),(0,X.jsx)($,{label:n(`workflows:imageNodes.opacity`),value:l.opacity,min:0,max:1,step:.05,onChange:e=>u({opacity:e})}),(0,X.jsx)($,{label:n(`workflows:imageNodes.duration`),value:l.durationMs,min:16,max:1e4,onChange:e=>u({durationMs:e})})]}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`workflows:imageNodes.orderHint`)}),(0,X.jsx)(G,{size:`sm`,variant:`outline`,disabled:d.includes(s),onClick:()=>a({frameOrder:[...d,s]}),children:n(`workflows:imageNodes.addToOrder`)}),d.map((e,t)=>(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(`span`,{className:`mr-auto text-xs`,children:n(`workflows:imageNodes.frameAt`,{index:e+1})}),(0,X.jsx)(G,{size:`icon-xs`,variant:`ghost`,"aria-label":n(`workflows:imageNodes.earlier`),disabled:t===0,onClick:()=>m(t,-1),children:(0,X.jsx)(p,{})}),(0,X.jsx)(G,{size:`icon-xs`,variant:`ghost`,"aria-label":n(`workflows:imageNodes.later`),disabled:t===d.length-1,onClick:()=>m(t,1),children:(0,X.jsx)(g,{})}),(0,X.jsx)(G,{size:`icon-xs`,variant:`ghost`,"aria-label":n(`workflows:imageNodes.resetOrder`),onClick:()=>a({frameOrder:d.filter(t=>t!==e)}),children:(0,X.jsx)(V,{})})]},e))]})]})]}),e.kind===`media-preview`&&(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`workflows:imageNodes.previewHint`)}),e.kind===`media-export`&&(0,X.jsxs)(q,{variant:`control`,children:[n(`workflows:imageNodes.filename`),(0,X.jsx)(K,{value:i.filename,maxLength:100,onChange:e=>a({filename:e.target.value})}),(0,X.jsx)(`small`,{children:n(`workflows:imageNodes.exportHint`)})]})]})}var Sn={upload:(e,t)=>U(`/api/workflow-media?name=${encodeURIComponent(e.name)}`,{method:`POST`,data:e,headers:{"Content-Type":e.type},signal:t,timeout:12e4,parse:e=>{try{return tt(e)}catch{throw H()}}}),preview:(e,t)=>we(`/api/workflow-media/${encodeURIComponent(e)}/content`,{signal:t})};function Cn(e){try{return $e(e)}catch{return null}}function wn(e){let[t,n]=(0,Y.useState)({id:``,image:null,error:!1}),r=e?.media.id;return(0,Y.useEffect)(()=>{if(n({id:r??``,image:null,error:!1}),!r)return;let e=new AbortController,t=``,i=null;return Sn.preview(r,e.signal).then(a=>{if(e.signal.aborted)return;t=URL.createObjectURL(a),i=new Image;let o=i;i.onload=()=>{e.signal.aborted||n({id:r,image:o,error:!1})},i.onerror=()=>{e.signal.aborted||n({id:r,image:null,error:!0})},i.src=t}).catch(()=>{e.signal.aborted||n({id:r,image:null,error:!0})}),()=>{e.abort(),i&&(i.onload=null,i.onerror=null,i.src=``),t&&URL.revokeObjectURL(t)}},[r]),t.id===r?t:{id:r??``,image:null,error:!1}}function Tn(e,t){return t(e===`workflow_image_source_stale`?`workflows:imageNodes.sourceStale`:e===`workflow_image_source_required`?`workflows:imageNodes.sourceRequired`:e===`workflow_image_engine_missing`?`workflows:imageNodes.engineMissing`:e===`workflow_image_decode_failed`?`workflows:imageNodes.decodeFailed`:e===`workflow_image_generation_failed`?`workflows:imageNodes.generationFailed`:e===`workflow_image_too_large`?`workflows:imageNodes.tooLarge`:e===`workflow_image_cancelled`?`workflows:imageNodes.cancelled`:e===`workflow_image_timeout`?`workflows:imageNodes.timeout`:`workflows:imageNodes.invalidOutput`)}function En({value:e,previousValue:t,error:n,t:r}){let i=(0,Y.useMemo)(()=>Cn(e),[e]),a=(0,Y.useMemo)(()=>Cn(t),[t]),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(0),[p,m]=(0,Y.useState)(!1),[h,g]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(!1),[x,C]=(0,Y.useState)(!1),w=(0,Y.useRef)(null),T=(0,Y.useRef)(null),E=[...new Set(i?.frames.map(e=>e.action).filter(Boolean)??[])],D=[...new Set(i?.frames.map(e=>e.direction).filter(Boolean)??[])],O=E.includes(o)?o:E[0]??``,k=D.includes(c)?c:D[0]??``,A=(0,Y.useMemo)(()=>i?.frames.filter(e=>(!O||e.action===O)&&(!k||e.direction===k))??[],[i,O,k]),j=Math.min(u,Math.max(0,A.length-1)),ee=a?.frames.filter(e=>e.action===A[j]?.action&&e.direction===A[j]?.direction),M=ee?.[j]??ee?.[0]??a?.frames[0],N=wn(_?M:A[j]),P=wn(h&&!_?A[(j+A.length-1)%A.length]:void 0),F=wn(h&&!_?A[(j+1)%A.length]:void 0);(0,Y.useEffect)(()=>{d(0),m(!1),v(!1)},[O,k,e]),(0,Y.useEffect)(()=>()=>w.current?.abort(),[]),(0,Y.useEffect)(()=>{if(!p||A.length<2)return;let e=window.setTimeout(()=>{document.hidden||d((j+1)%A.length)},A[j]?.durationMs??125),t=()=>{document.hidden&&m(!1)};return document.addEventListener(`visibilitychange`,t),()=>{window.clearTimeout(e),document.removeEventListener(`visibilitychange`,t)}},[p,A,j]),(0,Y.useEffect)(()=>{let e=T.current?.getContext(`2d`);if(!e)return;e.clearRect(0,0,512,384);let t=[P.image,N.image,F.image].filter(e=>!!e),n=Math.min(1,512/Math.max(1,...t.map(e=>e.naturalWidth)),384/Math.max(1,...t.map(e=>e.naturalHeight)))*.9,r=(t,r)=>{if(!t)return;e.save(),e.imageSmoothingEnabled=!1,e.globalAlpha=r;let i=t.naturalWidth*n,a=t.naturalHeight*n;e.drawImage(t,(512-i)/2,384*.95-a,i,a),e.restore()};r(P.image,.2),r(F.image,.15),r(N.image,1)},[N.image,P.image,F.image]);let L=async e=>{if(!i||w.current)return;let t=new AbortController;w.current=t,C(!0),b(!1);let n=``;try{let r=e===`atlas`?i.atlas?.media:A[j]?.media,a=e===`json`?new Blob([JSON.stringify(i.atlas??i,null,2)],{type:`application/json`}):r?await Sn.preview(r.id,t.signal):null;if(!a||t.signal.aborted)return;n=URL.createObjectURL(a);let o=document.createElement(`a`);o.href=n,o.download=e===`json`?`animation.frames.json`:(r?.name??`animation.png`).replace(/[\\/:*?"<>|\p{Cc}]/gu,`_`),o.click()}catch{t.signal.aborted||b(!0)}finally{n&&URL.revokeObjectURL(n),t.signal.aborted||C(!1),w.current===t&&(w.current=null)}};return!i&&!n?(0,X.jsx)(`p`,{className:`my-3 text-xs text-muted-foreground`,children:r(`workflows:imageNodes.noResult`)}):(0,X.jsxs)(`section`,{className:`my-3 space-y-3 rounded-xl border p-3`,"aria-label":r(`workflows:imageNodes.result`),children:[(0,X.jsx)(`h3`,{className:`text-sm font-medium`,children:r(`workflows:imageNodes.result`)}),n&&(0,X.jsx)(`p`,{role:`alert`,className:`text-xs text-muted-foreground`,children:Tn(n,r)}),A.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[E.length>0&&(0,X.jsx)(f,{"aria-label":r(`workflows:imageNodes.action`),value:O,onChange:e=>s(e.target.value),children:E.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))}),D.length>0&&(0,X.jsx)(f,{"aria-label":r(`workflows:imageNodes.directions`),value:k,onChange:e=>l(e.target.value),children:D.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})]}),(0,X.jsxs)(`div`,{className:`relative overflow-hidden rounded-lg border bg-[repeating-conic-gradient(#d4d4d8_0%_25%,#fafafa_0%_50%)] bg-size-[16px_16px] dark:bg-[repeating-conic-gradient(#27272a_0%_25%,#3f3f46_0%_50%)]`,children:[(0,X.jsx)(`canvas`,{width:512,height:384,ref:T,className:`w-full`,role:`img`,"aria-label":r(`workflows:imageNodes.frameAt`,{index:j+1})}),!N.image&&!N.error&&(0,X.jsx)(ce,{className:`absolute top-1/2 left-1/2 size-5 animate-spin`})]}),N.error&&(0,X.jsx)(`p`,{role:`alert`,className:`text-xs`,children:r(`workflows:inputs.previewFailed`)}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-1`,children:[(0,X.jsx)(G,{size:`icon-sm`,variant:`outline`,"aria-label":r(`workflows:imageNodes.previousFrame`),disabled:A.length<2,onClick:()=>{m(!1),d((j+A.length-1)%A.length)},children:(0,X.jsx)(te,{})}),(0,X.jsx)(G,{size:`icon-sm`,variant:`outline`,"aria-label":r(p?`workflows:imageNodes.pause`:`workflows:imageNodes.play`),disabled:A.length<2,onClick:()=>m(!p),children:p?(0,X.jsx)(xt,{}):(0,X.jsx)(pe,{})}),(0,X.jsx)(G,{size:`icon-sm`,variant:`outline`,"aria-label":r(`workflows:imageNodes.nextFrame`),disabled:A.length<2,onClick:()=>{m(!1),d((j+1)%A.length)},children:(0,X.jsx)(I,{})}),(0,X.jsxs)(`span`,{className:`px-1 text-xs tabular-nums`,children:[j+1,` / `,A.length]})]}),(0,X.jsx)(`input`,{className:`w-full`,type:`range`,min:0,max:Math.max(0,A.length-1),value:j,"aria-label":r(`workflows:imageNodes.frameNumber`),onChange:e=>{m(!1),d(Number(e.target.value))}}),(0,X.jsxs)(`label`,{className:`flex items-center justify-between text-xs`,children:[r(`workflows:imageNodes.onionSkin`),(0,X.jsx)(S,{checked:h,onCheckedChange:g})]}),M&&(0,X.jsxs)(`label`,{className:`flex items-center justify-between text-xs`,children:[r(`workflows:imageNodes.showInput`),(0,X.jsx)(S,{checked:_,onCheckedChange:v})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(G,{size:`sm`,variant:`outline`,disabled:x,onClick:()=>void L(`frame`),children:[(0,X.jsx)(R,{}),r(`workflows:imageNodes.saveFrame`)]}),i?.atlas&&(0,X.jsxs)(G,{size:`sm`,variant:`outline`,disabled:x,onClick:()=>void L(`atlas`),children:[(0,X.jsx)(R,{}),`PNG`]}),(0,X.jsxs)(G,{size:`sm`,variant:`outline`,disabled:x,onClick:()=>void L(`json`),children:[(0,X.jsx)(R,{}),`JSON`]})]})]}),y&&(0,X.jsx)(`p`,{role:`alert`,className:`text-xs`,children:r(`workflows:imageNodes.downloadFailed`)})]})}function Dn(e){let t=Math.max(0,Math.round((Number(e)||0)/1e3));return t<60?`${t} 秒`:`${Math.floor(t/60)} 分 ${t%60} 秒`}function On({run:e,t}){return(0,X.jsxs)(Re,{role:`status`,children:[(0,X.jsx)(B,{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 kn({run:e,language:t,t:n}){return(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)] gap-0 py-0`,children:(0,X.jsxs)(Fe,{className:`p-3.5`,children:[(0,X.jsx)(Ie,{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`||e.status===`waiting_approval`?(0,X.jsx)(B,{className:`animate-spin`,size:15}):e.status===`completed`?(0,X.jsx)(L,{size:15}):(0,X.jsx)(xe,{size:15}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:e.status===`completed`?e.summary||n(`workflows:workflowsPage.workflowCompleted`):e.status===`waiting_approval`?n(`workflows:workflowsPage.waitingApproval`):e.status===`running`?e.currentNodeLabel||n(`workflows:workflowsPage.running`):e.error?Q(e.error):n(`workflows:workflowsPage.workflowFailed`)}),(0,X.jsxs)(`small`,{children:[Pe(e.startedAt,t),` · `,Dn(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`)})]})})}function An({input:e,value:t,onChange:n,label:r,disabled:i=!1,onBusyChange:a}){let{t:o}=s(),[c,l]=(0,Y.useState)({id:``,url:``}),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(``),m=(0,Y.useRef)(null),h=(0,Y.useRef)(!0),g=(0,Y.useRef)(a);g.current=a;let _=(0,Y.useRef)({onChange:n,id:e.id,type:e.type});_.current={onChange:n,id:e.id,type:e.type};let v=e.type,y=(()=>{try{return tt(t)}catch{return null}})(),b=y?.id;(0,Y.useEffect)(()=>(h.current=!0,d(!1),p(``),()=>{h.current=!1,m.current?.abort(),m.current=null,g.current?.(e.id,!1)}),[e.id,v]),(0,Y.useEffect)(()=>{if(l({id:``,url:``}),!b)return;let e=new AbortController,t=``;return Sn.preview(b,e.signal).then(n=>{e.signal.aborted||(t=URL.createObjectURL(n),l({id:b,url:t}))}).catch(()=>{e.signal.aborted||p(o(`workflows:inputs.previewFailed`))}),()=>{e.abort(),t&&URL.revokeObjectURL(t)}},[b,o]);let x=async(t,n)=>{if(!t.length||i||m.current||n!==`image`&&n!==`video`)return;if(t.length!==1){p(o(`workflows:inputs.oneFile`));return}let r=t[0];if(!(n===`image`?[`image/png`,`image/jpeg`,`image/webp`]:[`video/mp4`,`video/webm`]).includes(r.type)){p(o(`workflows:inputs.mediaType`));return}if(r.size>(n===`image`?8:64)*1024*1024){p(o(n===`image`?`workflows:inputs.imageLimit`:`workflows:inputs.videoLimit`));return}let a=new AbortController;m.current=a,d(!0),g.current?.(e.id,!0),p(``);try{let t=await Sn.upload(r,a.signal);h.current&&!a.signal.aborted&&m.current===a&&_.current.id===e.id&&_.current.type===n&&_.current.onChange(t)}catch{h.current&&!a.signal.aborted&&p(o(`workflows:inputs.uploadFailed`))}finally{m.current===a&&(m.current=null,h.current&&(d(!1),g.current?.(e.id,!1)))}};return(0,X.jsxs)(pn,{label:r,value:typeof t==`string`?t:``,onValueChange:n,files:y?[{...y,url:c.id===y.id?c.url:void 0}]:[],onFilesSelected:e=>void x(e,v),onRemoveFile:()=>n(``),accept:v===`image`?`image`:`video`,allowFiles:v===`image`||v===`video`,allowText:v!==`image`&&v!==`video`,disabled:i||u,maxLength:16e3,attachmentLabel:o(v===`image`?`workflows:inputs.chooseImage`:`workflows:inputs.chooseVideo`),removeLabel:o(`workflows:inputs.removeMedia`),children:[u&&(0,X.jsxs)(`p`,{role:`status`,className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(ce,{className:`size-3 animate-spin`}),o(`workflows:inputs.uploading`)]}),f&&(0,X.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:f})]})}function jn(e){return e===`number`||e===`boolean`||e===`text`||e===`image`||e===`video`?e:`string`}function Mn(e){if(e.type===`image`||e.type===`video`)try{return tt(e.defaultValue)}catch{return null}return e.type===`boolean`?e.defaultValue===!0||e.defaultValue===`true`:typeof e.defaultValue==`number`||typeof e.defaultValue==`string`?e.defaultValue:``}function Nn(e,t){if(!(e instanceof Ze))return t(`workflows:inputs.invalidDefinition`);let n=e.label||e.inputName;return e.code===`workflow_input_unsafe_name`?t(`workflows:inputs.invalidName`):e.code===`workflow_input_duplicate_name`?t(`workflows:inputs.duplicateName`,{name:n}):e.code===`workflow_input_required`?t(`workflows:inputs.requiredValue`,{name:n}):e.code===`workflow_input_type`?t(`workflows:inputs.invalidValue`,{name:n}):e.code===`workflow_input_too_long`?t(`workflows:inputs.valueTooLong`,{name:n}):e.code===`workflow_input_unknown`?t(`workflows:inputs.unknownInput`,{name:n}):t(`workflows:inputs.invalidDefinition`)}function Pn(e,t){try{return rt(e),``}catch(e){return Nn(e,t)}}function Fn(e,t,n){try{return Qe(e,t),``}catch(e){return Nn(e,n)}}function In(e,t){return Qe(e,t)}function Ln(e,t){return e.type===`text`?t(`workflows:inputs.longText`):e.type===`number`?t(`workflows:inputs.number`):e.type===`boolean`?t(`workflows:inputs.boolean`):e.type===`image`?t(`workflows:inputs.image`):e.type===`video`?t(`workflows:inputs.video`):t(`workflows:inputs.shortText`)}function Rn({inputs:e,onChange:t,t:n,onUploadBusy:r}){let i=(0,Y.useId)(),[a,o]=(0,Y.useState)(null),s=Pn(e,n),p=(n,r)=>t(e.map(e=>e.id===n?{...e,...r}:e));return(0,X.jsxs)(`section`,{className:`mt-4 min-w-0 space-y-3`,"aria-labelledby":`${i}-title`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`h3`,{id:`${i}-title`,className:`text-sm font-medium`,children:n(`workflows:workflowsPage.inputParameters`)}),(0,X.jsxs)(G,{variant:`ghost`,size:`sm`,disabled:e.length>=30,onClick:()=>{let r=e.length+1;for(;e.some(e=>e.name===`input_${r}`);)r+=1;let i=crypto.randomUUID();t([...e,{id:i,name:`input_${r}`,label:n(`workflows:workflowsPage.newInput`),type:`string`,required:!1,defaultValue:``,description:``}]),o(i)},children:[(0,X.jsx)(me,{}),n(`workflows:workflowsPage.addInput`)]})]}),(0,X.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:n(`workflows:inputs.definitionHint`)}),s&&(0,X.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:s}),e.length===0&&(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`workflows:inputs.emptyDefinition`)}),e.map(s=>(0,X.jsxs)(u,{className:`min-w-0 rounded-lg border`,open:a===s.id,onOpenChange:e=>o(e?s.id:null),children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 p-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,X.jsx)(`p`,{className:`truncate text-sm font-medium`,children:s.label||s.name}),(0,X.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[Ln(s,n),` ·`,` `,s.required?n(`workflows:workflowsPage.required`):n(`workflows:inputs.optional`)]})]}),(0,X.jsx)(l,{asChild:!0,children:(0,X.jsxs)(G,{variant:`ghost`,size:`sm`,"aria-label":n(`workflows:inputs.editNamedInput`,{name:s.label||s.name}),children:[(0,X.jsx)(fe,{}),n(`workflows:inputs.editInput`)]})})]}),(0,X.jsxs)(c,{className:`space-y-3 border-t p-3`,children:[(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(d,{htmlFor:`${i}-${s.id}-label`,className:`text-xs`,children:n(`workflows:inputs.label`)}),(0,X.jsx)(K,{id:`${i}-${s.id}-label`,value:s.label,maxLength:120,onChange:e=>p(s.id,{label:e.target.value})})]}),(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(d,{id:`${i}-${s.id}-type`,className:`text-xs`,children:n(`workflows:workflowsPage.parameterType`)}),(0,X.jsxs)(f,{"aria-labelledby":`${i}-${s.id}-type`,value:s.type,onChange:e=>{let t=jn(e.target.value);p(s.id,{type:t,defaultValue:t!==`boolean`&&``})},children:[(0,X.jsx)(`option`,{value:`string`,children:n(`workflows:inputs.shortText`)}),(0,X.jsx)(`option`,{value:`text`,children:n(`workflows:inputs.longText`)}),(0,X.jsx)(`option`,{value:`number`,children:n(`workflows:inputs.number`)}),(0,X.jsx)(`option`,{value:`boolean`,children:n(`workflows:inputs.boolean`)}),(0,X.jsx)(`option`,{value:`image`,children:n(`workflows:inputs.image`)}),(0,X.jsx)(`option`,{value:`video`,children:n(`workflows:inputs.video`)})]})]}),(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(d,{htmlFor:`${i}-${s.id}-description`,className:`text-xs`,children:n(`workflows:inputs.description`)}),(0,X.jsx)(J,{id:`${i}-${s.id}-description`,value:s.description,maxLength:300,rows:2,className:`min-h-14`,onChange:e=>p(s.id,{description:e.target.value})})]}),(0,X.jsxs)(`details`,{className:`group rounded-md border p-2`,children:[(0,X.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 text-xs font-medium [&::-webkit-details-marker]:hidden`,children:[n(`workflows:inputs.advancedSettings`),(0,X.jsx)(F,{className:`size-3.5 transition-transform group-open:rotate-180`})]}),(0,X.jsxs)(`div`,{className:`space-y-3 pt-3`,children:[(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(d,{htmlFor:`${i}-${s.id}-name`,className:`text-xs`,children:n(`workflows:workflowsPage.parameterName`)}),(0,X.jsx)(K,{id:`${i}-${s.id}-name`,value:s.name,maxLength:80,onChange:e=>p(s.id,{name:e.target.value})}),(0,X.jsx)(`code`,{className:`block break-all text-xs text-muted-foreground`,children:`{{inputs.`+s.name+`}}`})]}),(0,X.jsxs)(`div`,{className:`space-y-1`,children:[s.type!==`text`&&s.type!==`image`&&s.type!==`video`&&(0,X.jsx)(d,{htmlFor:`${i}-${s.id}-default`,className:`text-xs`,children:n(`workflows:inputs.defaultValue`)}),s.type===`boolean`?(0,X.jsx)(S,{id:`${i}-${s.id}-default`,checked:Mn(s)===!0,onCheckedChange:e=>p(s.id,{defaultValue:e})}):s.type===`text`||s.type===`image`||s.type===`video`?(0,X.jsx)(An,{input:s,value:s.defaultValue,label:n(`workflows:inputs.defaultValue`),onBusyChange:r,onChange:e=>p(s.id,{defaultValue:e})}):(0,X.jsx)(K,{id:`${i}-${s.id}-default`,type:s.type===`number`?`number`:`text`,value:String(Mn(s)),onChange:e=>p(s.id,{defaultValue:e.target.value})})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsx)(d,{htmlFor:`${i}-${s.id}-required`,className:`text-xs`,children:n(`workflows:workflowsPage.required`)}),(0,X.jsx)(S,{id:`${i}-${s.id}-required`,checked:s.required,onCheckedChange:e=>p(s.id,{required:e})})]})]})]}),(0,X.jsxs)(G,{variant:`ghost`,size:`sm`,"aria-label":n(`workflows:inputs.deleteInput`,{name:s.label}),onClick:()=>{t(e.filter(e=>e.id!==s.id)),o(null)},children:[(0,X.jsx)(V,{}),n(`workflows:inputs.removeInput`)]})]})]},s.id))]})}var zn={browser:{Icon:M},feishu:{Icon:N},weixin:{Icon:le},qq:{Icon:le},telegram:{Icon:_e}},Bn=[`workspace-write`,`full-access`];function Vn(e,t){return t(e===`workspace-write`?`workflows:workflowsPage.workspaceWrite`:`workflows:workflowsPage.fullAccess`)}function Hn(e,t){return t(e===`workspace-write`?`workflows:workflowsPage.workspaceWriteHelp`:`workflows:workflowsPage.fullAccessHelp`)}function Un(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 Wn({draft:e,catalog:t,t:n,onUpdateDraft:r,onInputUploadBusy:i}){return(0,X.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[(0,X.jsxs)(q,{variant:`control`,children:[n(`workflows:workflowsPage.name`),(0,X.jsx)(K,{value:e.name,onChange:e=>r({name:e.target.value})})]}),(0,X.jsxs)(q,{variant:`control`,children:[n(`workflows:workflowsPage.description`),(0,X.jsx)(J,{value:e.description,onChange:e=>r({description:e.target.value})})]}),(0,X.jsxs)(q,{variant:`control`,children:[n(`workflows:workflowsPage.workingDirectory`),(0,X.jsx)(K,{value:e.cwd,onChange:e=>r({cwd:e.target.value})})]}),(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,X.jsxs)(q,{variant:`control`,children:[n(`workflows:workflowsPage.visibility`),(0,X.jsxs)(f,{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)(q,{variant:`control`,children:[n(`workflows:workflowsPage.tags`),(0,X.jsx)(K,{value:e.tags.join(`, `),onChange:e=>r({tags:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)})})]}),(0,X.jsxs)(q,{variant:`control`,children:[n(`workflows:workflowsPage.revision`),(0,X.jsx)(K,{value:`v${e.revision}`,disabled:!0})]})]}),(0,X.jsxs)(q,{variant:`control`,children:[n(`workflows:workflowsPage.defaultModel`),(0,X.jsxs)(f,{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.jsx)(Rn,{inputs:e.inputs,t:n,onUploadBusy:i,onChange:e=>r({inputs:e})})]})}function Gn({node:e,catalog:t,t:n,systemNotificationPermission:r,onUpdateNode:i,onToggleNotification:a,onOpenChannels:o,onOpenSystemNotificationSettings:s}){let c=[`feishu`,`weixin`,`qq`,`telegram`].some(e=>t.notificationTargets[e]?.enabled),l=r==="default"||r===`granted`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(q,{variant:`control`,children:[n(`workflows:workflowsPage.notificationTitle`),(0,X.jsx)(K,{value:e.notification.title,onChange:t=>i({notification:{...e.notification,title:t.target.value}}),placeholder:`{{workflow.name}}`})]}),(0,X.jsxs)(q,{variant:`control`,children:[n(`workflows:workflowsPage.notificationContent`),(0,X.jsx)(J,{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`)}),!c&&(0,X.jsxs)(qe,{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)(xe,{}),(0,X.jsxs)(Ke,{children:[n(`workflows:workflowsPage.noExternalNotificationChannelsEnabled`),(0,X.jsx)(G,{type:`button`,variant:`link`,size:`sm`,onClick:o,children:n(`workflows:workflowsPage.openChannelSettings`)})]})]}),(r===`denied`||r===`unsupported`)&&(0,X.jsxs)(qe,{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)(xe,{}),(0,X.jsxs)(Ke,{children:[n(r===`unsupported`?`workflows:workflowsPage.systemNotificationsUnsupported`:`workflows:workflowsPage.systemNotificationPermissionRequired`),(0,X.jsx)(G,{type:`button`,variant:`link`,size:`sm`,onClick:s,children:n(`workflows:workflowsPage.openSystemNotificationSettings`)})]})]}),Object.entries(zn).map(([i,o])=>{let s=o.Icon,c=i===`browser`?l:!!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}),Un(i,n)]}),(0,X.jsx)(S,{checked:c&&(i!==`browser`||r===`granted`&&t.notificationTargets.browser.enabled)&&e.notificationTargets.includes(i),disabled:!c,"aria-label":Un(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 Kn({edge:e,nodes:t,t:n,onDelete:r}){let i=new Map(t.map(e=>[e.id,e]));return(0,X.jsxs)(`section`,{className:`min-w-0 space-y-3`,children:[(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)(G,{size:`sm`,variant:`destructive`,onClick:r,children:[(0,X.jsx)(V,{"data-icon":`inline-start`}),n(`workflows:workflowsPage.deleteConnection`)]})]})}function qn({node:e,inputs:t,selectedEdge:n,catalog:r,t:i,onUpdateNode:a,systemNotificationPermission:o,onToggleNotification:s,onCopy:c,onDelete:l,onOpenChannels:u,onOpenSystemNotificationSettings:d}){let p=(0,Y.useRef)(null);return(0,X.jsx)(`section`,{className:`min-w-0 space-y-3`,children:e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(q,{variant:`control`,children:[i(`workflows:workflowsPage.nodeName`),(0,X.jsx)(K,{value:e.label,onChange:e=>a({label:e.target.value})})]}),[`prompt`,`skill`,`file`,`mcp`].includes(e.kind)&&(0,X.jsxs)(q,{variant:`control`,children:[i(`workflows:workflowsPage.nodeModel`),(0,X.jsxs)(f,{value:e.model?`${e.model.provider}/${e.model.model}`:``,onChange:e=>{let t=r.models.find(t=>`${t.provider}/${t.model}`===e.target.value);a({model:t?{provider:t.provider,model:t.model}:null})},children:[(0,X.jsx)(`option`,{value:``,children:i(`workflows:workflowsPage.inheritWorkflowDefaultModel`)}),r.models.map(e=>(0,X.jsx)(`option`,{value:`${e.provider}/${e.model}`,children:e.label},`${e.provider}/${e.model}`))]})]}),e.kind===`trigger`&&(0,X.jsx)(`p`,{className:`rounded-lg bg-[var(--surface-subtle)] p-3 text-xs leading-relaxed text-muted-foreground`,children:i(`workflows:editor.manualTriggerHint`)}),e.kind===`parallel`&&(0,X.jsx)(`p`,{className:`rounded-lg bg-[var(--surface-subtle)] p-3 text-xs leading-relaxed text-muted-foreground`,children:i(`workflows:editor.parallelHint`)}),![`trigger`,`parallel`,`condition`,`approval`].includes(e.kind)&&(0,X.jsxs)(`details`,{className:`rounded-lg border p-3`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium`,children:i(`workflows:editor.executionSettings`)}),(0,X.jsxs)(`div`,{className:`grid gap-3 pt-3`,children:[(0,X.jsxs)(q,{variant:`control`,children:[i(`workflows:workflowsPage.retryCount`),(0,X.jsx)(K,{type:`number`,min:`0`,max:`3`,value:e.retries,onChange:e=>a({retries:Number(e.target.value)})})]}),(0,X.jsxs)(q,{variant:`control`,children:[i(`workflows:workflowsPage.timeoutMinutes`),(0,X.jsx)(K,{type:`number`,min:`1`,max:`240`,value:e.timeoutMinutes,onChange:e=>a({timeoutMinutes:Number(e.target.value)})})]}),(0,X.jsxs)(q,{variant:`control`,children:[i(`workflows:workflowsPage.failureHandling`),(0,X.jsxs)(f,{value:e.failurePolicy,onChange:e=>a({failurePolicy:e.target.value===`skip`?`skip`:`stop`}),children:[(0,X.jsx)(`option`,{value:`stop`,children:i(`workflows:workflowsPage.stopImmediately`)}),(0,X.jsx)(`option`,{value:`skip`,children:i(`workflows:workflowsPage.skipThisNode`)})]})]})]})]}),Ct(e.kind)&&(0,X.jsx)(xn,{node:e,inputs:t,t:i,onChange:a}),[`prompt`,`skill`,`file`,`mcp`].includes(e.kind)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(q,{variant:`control`,children:[i(`workflows:workflowsPage.executionMode`),(0,X.jsx)(f,{value:e.executionMode,onChange:e=>a({executionMode:e.target.value}),children:Bn.map(e=>(0,X.jsx)(`option`,{value:e,children:Vn(e,i)},e))}),(0,X.jsx)(`small`,{children:Hn(e.executionMode,i)})]}),e.kind===`skill`&&(0,X.jsxs)(q,{variant:`control`,children:[`Skill`,(0,X.jsxs)(f,{value:e.skillName,onChange:e=>a({skillName:e.target.value}),children:[(0,X.jsx)(`option`,{value:``,children:i(`workflows:workflowsPage.chooseSkill`)}),r.skills.map(e=>(0,X.jsx)(`option`,{value:e.name,children:e.name},e.id))]})]}),e.kind===`mcp`&&(0,X.jsxs)(q,{variant:`control`,children:[i(`workflows:workflowsPage.mcpToolNames`),(0,X.jsx)(K,{value:e.requestedToolNames.join(`, `),onChange:e=>a({requestedToolNames:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)}),placeholder:`server.tool_name`})]}),(0,X.jsxs)(q,{variant:`control`,children:[i(`workflows:inputs.nodeRules`),(0,X.jsx)(J,{ref:p,value:e.prompt,onChange:e=>a({prompt:e.target.value}),placeholder:i(`workflows:workflowsPage.describeTheWorkTheAgentShouldCompleteInThisNode`)})]}),(0,X.jsxs)(`div`,{className:`space-y-2 py-2`,children:[(0,X.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:i(`workflows:inputs.nodeRulesHint`)}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(t=>(0,X.jsx)(G,{type:`button`,variant:`outline`,size:`xs`,title:i(`workflows:inputs.insertVariable`,{name:t.label}),onClick:()=>{let n=p.current,r=n?.selectionStart??e.prompt.length,i=n?.selectionEnd??r,o=`{{inputs.`+t.name+`}}`;a({prompt:e.prompt.slice(0,r)+o+e.prompt.slice(i)}),requestAnimationFrame(()=>{n?.focus(),n?.setSelectionRange(r+o.length,r+o.length)})},children:(0,X.jsx)(`code`,{children:`{{inputs.`+t.name+`}}`})},t.id))})]}),(0,X.jsxs)(q,{variant:`control`,children:[i(`workflows:workflowsPage.outputFormat`),(0,X.jsxs)(f,{value:e.outputFormat,onChange:e=>a({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:`grid gap-3`,children:[(0,X.jsxs)(q,{variant:`control`,children:[i(`workflows:workflowsPage.dataPath`),(0,X.jsx)(K,{value:e.condition.source,onChange:t=>a({condition:{...e.condition,source:t.target.value}}),placeholder:`inputs.approved`})]}),(0,X.jsxs)(q,{variant:`control`,children:[i(`workflows:workflowsPage.operator`),(0,X.jsx)(f,{value:e.condition.operator,onChange:t=>a({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)(q,{variant:`control`,children:[i(`workflows:workflowsPage.comparisonValue`),(0,X.jsx)(K,{value:String(e.condition.value??``),onChange:t=>a({condition:{...e.condition,value:t.target.value}})})]})]}),e.kind===`notification`&&(0,X.jsx)(Gn,{node:e,catalog:r,t:i,systemNotificationPermission:o,onUpdateNode:a,onToggleNotification:s,onOpenChannels:u,onOpenSystemNotificationSettings:d}),e.kind===`approval`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(q,{variant:`control`,children:[i(`workflows:workflowsPage.approvalMessage`),(0,X.jsx)(J,{value:e.approval.message,onChange:t=>a({approval:{...e.approval,message:t.target.value}})})]}),(0,X.jsxs)(q,{variant:`control`,children:[i(`workflows:workflowsPage.approvalTimeout`),(0,X.jsx)(K,{type:`number`,min:`1`,max:`10080`,value:e.approval.timeoutMinutes,onChange:t=>a({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)(G,{size:`sm`,variant:`secondary`,onClick:c,children:[(0,X.jsx)(ie,{"data-icon":`inline-start`}),i(`workflows:workflowsPage.duplicateNode`)]}),(0,X.jsxs)(G,{size:`sm`,variant:`destructive`,onClick:l,children:[(0,X.jsx)(V,{"data-icon":`inline-start`}),i(`workflows:workflowsPage.deleteNode`)]})]})]}):(0,X.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-muted)] text-[12px] leading-[1.55]`,children:i(n?`workflows:workflowsPage.aConnectionIsCurrentlySelected`:`workflows:workflowsPage.dragNodesFromTheLeftToStartBuildingTheWorkflow`)})})}function Jn({draft:e,catalog:t,selectedNode:n,selectedEdge:r,currentRun:i,language:a,t:o,onUpdateNode:s,systemNotificationPermission:c,onToggleNotification:l,onDeleteEdge:u,onCopyNode:d,onDeleteNode:f,onOpenChannels:p,onOpenSystemNotificationSettings:m,onRunImageNode:h,imageRunBusy:g=!1}){let _=e.edges.filter(e=>e.target===n?.id).map(e=>e.source),v=(i?[i]:[]).find(t=>t.workflowId===e.id&&(n?.kind===`media-input`?!!t.inputs:_.length>0&&_.every(e=>t.nodes?.some(t=>t.id===e&&t.status===`completed`&&t.output)))),y=i;return(0,X.jsxs)(`div`,{className:`detail-stack min-w-0 space-y-5`,children:[r&&(0,X.jsx)(Kn,{edge:r,nodes:e.nodes,t:o,onDelete:u}),!r&&(0,X.jsx)(qn,{node:n,inputs:e.inputs,selectedEdge:r,catalog:t,t:o,onUpdateNode:s,systemNotificationPermission:c,onToggleNotification:l,onCopy:d,onDelete:f,onOpenChannels:p,onOpenSystemNotificationSettings:m}),n&&Ct(n.kind)&&h&&(0,X.jsxs)(`div`,{className:`space-y-2 rounded-lg border p-3`,children:[(0,X.jsxs)(G,{className:`w-full`,variant:`outline`,disabled:!e.id||!v||g,onClick:()=>{v&&h(n.id,v.id)},children:[(0,X.jsx)(pe,{}),o(`workflows:imageNodes.runNode`)]}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o(`workflows:imageNodes.runNodeHint`)})]}),n&&Ct(n.kind)&&(0,X.jsx)(En,{value:y?.nodes?.find(e=>e.id===n.id)?.output,previousValue:v?.nodes?.find(t=>t.id===e.edges.find(e=>e.target===n.id)?.source)?.output,error:y?.nodes?.find(e=>e.id===n.id)?.error,t:o},n.id),e.id&&i&&(0,X.jsxs)(`details`,{className:`rounded-lg border p-3`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:o(`workflows:workflowsPage.latestRun`)}),(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsx)(kn,{run:i,language:a,t:o})})]})]})}function Yn({workflowId:e,templateId:t,notify:n,onCreated:r}){let{t:i}=s(),[a,o]=(0,Y.useState)(rn),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(!0),[g,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(``),b=(0,Y.useRef)(null),x=(0,Y.useRef)(new Set),[S,C]=(0,Y.useState)(!1),w=(0,Y.useRef)(null),T=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>{let e=x.current;return T.current=!0,_(!1),C(!1),()=>{T.current=!1,w.current?.abort(),w.current=null,e.clear()}},[e,t]);let E=(0,Y.useCallback)((e,t)=>{t?x.current.add(e):x.current.delete(e),T.current&&C(x.current.size>0)},[]),D=!!window.pisperDesktop?.showNotification,[O,k]=(0,Y.useState)(()=>D?`checking`:Xe()),A=(0,Y.useCallback)(async()=>{if(!D){k(Xe());return}let e=window.pisperDesktop?.getNotificationStatus;if(!e){k(`granted`);return}try{let t=await e(),n=t?.permission;k(n==="default"||n===`denied`||n===`granted`||n===`checking`||n===`unsupported`?n:t?.supported===!1?`unsupported`:`granted`)}catch{k(`unsupported`)}},[D]),j=(0,Y.useCallback)(async n=>{try{let r=await W(`/api/workflows`,{signal:n});if(n.aborted)return;o(r);let a=e===`new`?null:r.workflows.find(t=>t.id===e),s=Gt.find(e=>e.id===t),c=a?structuredClone(a):s?Xt(s,r.cwd,i):Jt(r.cwd,i);l(c),d(e=>c.nodes.some(t=>t.id===e)?e:c.nodes[0]?.id||``),p(``),y(a||e===`new`?``:i(`workflows:workflowsPage.workflowNotFoundABlankEditorWasOpened`))}catch(e){n.aborted||y(Q(e))}finally{n.aborted||h(!1)}},[i,t,e]),ee=(0,Y.useCallback)(()=>{b.current?.abort();let e=new AbortController;b.current=e,h(!0),y(``),j(e.signal)},[j]);(0,Y.useEffect)(()=>(ee(),()=>b.current?.abort()),[ee]),(0,Y.useEffect)(()=>{A();let e=()=>void A();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[A]);let M=(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]),N=M?.status===`running`||M?.status===`waiting_approval`;(0,Y.useEffect)(()=>{if(!N)return;let e=new AbortController,t=!1,n=window.setInterval(async()=>{if(!t){t=!0;try{let t=await W(`/api/workflows`,{signal:e.signal});e.signal.aborted||o(t)}catch{}finally{t=!1}}},1500);return()=>{e.abort(),window.clearInterval(n)}},[N,e]);let P=(0,Y.useMemo)(()=>c?.nodes.find(e=>e.id===u)||null,[c?.nodes,u]),F=(0,Y.useMemo)(()=>c?.edges.find(e=>e.id===f)||null,[c?.edges,f]),te=(0,Y.useCallback)(e=>{l(t=>t&&{...t,...e})},[]),I=(0,Y.useCallback)(e=>{l(t=>t&&{...t,nodes:t.nodes.map(t=>t.id===u?{...t,...e}:t)})},[u]),L=(0,Y.useCallback)(e=>{d(e),p(``)},[]),ne=(0,Y.useCallback)(e=>{p(e),d(``)},[]),re=(0,Y.useCallback)(()=>{d(``),p(``)},[]),ie=(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(Ft(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`};l(e=>e&&{...e,edges:[...e.edges,o]}),p(o.id),d(``),n(i(`workflows:workflowsPage.connectionCreated`),`info`)},[c,n,i]),R=(0,Y.useCallback)(e=>{if(!e.length)return;let t=new Set(e);l(e=>e&&{...e,edges:e.edges.filter(e=>!t.has(e.id))}),p(``),n(i(`workflows:workflowsPage.connectionDeleted`),`info`)},[n,i]),ae=(0,Y.useCallback)(()=>{f&&R([f])},[R,f]),oe=(0,Y.useCallback)(e=>{if(!e.length)return;let t=new Set(e);l(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))}),re(),n(i(`workflows:workflowsPage.nodeDeleted`),`info`)},[re,n,i]),se=(0,Y.useCallback)((e,t,n)=>{let r=crypto.randomUUID();l(i=>i&&{...i,nodes:[...i.nodes,Z(r,e,t||It[e],``,n.x,n.y)]}),d(r),p(``)},[]),z=(0,Y.useCallback)((e,t)=>{l(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)})},[]),ce=(0,Y.useCallback)(()=>{if(!P)return;let e=crypto.randomUUID();l(t=>t&&{...t,nodes:[...t.nodes,{...P,id:e,label:`${P.label} 副本`,x:P.x+25,y:P.y+25}]}),d(e),p(``),n(i(`workflows:workflowsPage.nodeDuplicated`),`info`)},[n,P,i]),le=(0,Y.useCallback)(()=>{P&&oe([P.id])},[oe,P]),ue=(0,Y.useCallback)(async e=>{if(!P||P.kind!==`notification`)return;let t=P.notificationTargets;if(e!==`browser`){if(t.includes(e)){I({notificationTargets:t.filter(t=>t!==e)});return}if(!a.notificationTargets[e]?.enabled)return;I({notificationTargets:[...t,e]});return}if(t.includes(e)&&a.notificationTargets.browser.enabled&&O===`granted`){I({notificationTargets:t.filter(t=>t!==e)});return}let r=O;if(D){await A();let e=await window.pisperDesktop?.getNotificationStatus?.();r=e?.permission||(e?.supported===!1?`unsupported`:`granted`)}else if(r=await Ye(),k(r),r===`granted`)try{await Je()}catch(e){n(Q(e),`error`);return}if(r!==`granted`){n(i(r===`unsupported`?`workflows:workflowsPage.systemNotificationsUnsupported`:`workflows:workflowsPage.systemNotificationPermissionRequired`),`error`);return}try{let r=await W(`/api/settings/notifications/browser`,{method:`PATCH`,body:JSON.stringify({enabled:!0})});o(e=>({...e,notificationTargets:{...e.notificationTargets,browser:{enabled:r.browser.enabled}}})),I({notificationTargets:t.includes(e)?t:[...t,e]}),n(i(`workflows:workflowsPage.systemNotificationsEnabled`))}catch(e){n(Q(e),`error`)}},[a.notificationTargets,D,n,A,P,O,i,I]),de=(0,Y.useCallback)(async(t=`draft`,s=!1)=>{if(!c||!T.current||w.current)return null;if(x.current.size)return n(i(`workflows:inputs.uploading`),`info`),null;let u=Pn(c.inputs,i);if(u)return y(u),n(u,`error`),null;_(!0),y(``);let d=new AbortController;w.current=d;try{let u=new Set(Object.entries(a.notificationTargets).filter(([e,t])=>t.enabled&&(e!==`browser`||O===`granted`||O===`checking`)).map(([e])=>e)),f={...c,status:t,notifications:c.notifications.filter(e=>u.has(e)),nodes:c.nodes.map(e=>({...e,notificationTargets:e.notificationTargets.filter(e=>u.has(e))}))},p=c.id?await W(`/api/workflows/${encodeURIComponent(c.id)}`,{method:`PATCH`,body:JSON.stringify(f),signal:d.signal}):await W(`/api/workflows`,{method:`POST`,body:JSON.stringify(f),signal:d.signal});return d.signal.throwIfAborted(),o(p.state),l(e=>e===c?structuredClone(p.workflow):e&&{...e,id:p.workflow.id,revision:p.workflow.revision}),e===`new`&&!s&&r(p.workflow.id,!1),s||n(i(t===`published`?`workflows:workflowsPage.workflowPublished`:`workflows:workflowsPage.workflowDraftSaved`)),p.workflow}catch(e){if(d.signal.aborted)return null;let t=Q(e);return y(t),n(t,`error`),null}finally{w.current===d&&(w.current=null,T.current&&_(!1))}},[a.notificationTargets,c,n,r,O,i,e]),fe=(0,Y.useCallback)(async(t,a)=>{let s=await de(c?.status||`draft`,!0);if(!s||!T.current)return!1;if(x.current.size)return n(i(`workflows:inputs.uploading`),`info`),!1;let l=new AbortController;w.current=l,_(!0);try{a?await gn.runNode(s.id,a.nodeId,a.sourceRunId,l.signal):await W(`/api/workflows/${encodeURIComponent(s.id)}/run`,{method:`POST`,body:JSON.stringify({inputs:t}),signal:l.signal}),l.signal.throwIfAborted();let e=await W(`/api/workflows`,{signal:l.signal});return l.signal.throwIfAborted(),o(e),n(i(`workflows:workflowsPage.workflowStarted`)),!0}catch(e){if(l.signal.aborted)return!1;let t=Q(e);return y(t),n(t,`error`),!1}finally{w.current===l&&(w.current=null,T.current&&_(!1)),T.current&&!l.signal.aborted&&e===`new`&&r(s.id,!0)}},[c?.status,n,r,de,i,e]),pe=(0,Y.useCallback)(e=>fe(e),[fe]),me=(0,Y.useCallback)((e,t)=>fe(void 0,{nodeId:e,sourceRunId:t}),[fe]),B=(0,Y.useCallback)(async()=>{if(!T.current||w.current||!M||![`running`,`waiting_approval`].includes(M.status))return;let e=new AbortController;w.current=e,_(!0);try{await W(`/api/workflow-runs/${encodeURIComponent(M.id)}/stop`,{method:`POST`,body:`{}`,signal:e.signal}),e.signal.throwIfAborted();let t=await W(`/api/workflows`,{signal:e.signal});e.signal.throwIfAborted(),o(t),n(i(`workflows:workflowsPage.stoppingWorkflow`),`info`)}catch(t){if(e.signal.aborted)return;let r=Q(t);y(r),n(r,`error`)}finally{w.current===e&&(w.current=null,T.current&&_(!1))}},[M,n,i]),he=(0,Y.useCallback)(()=>de(`published`),[de]);return{catalog:a,draft:c,selectedNode:P,selectedEdge:F,selectedNodeId:u,selectedEdgeId:f,currentRun:M,loading:m,retryLoad:ee,busy:g||S,inputUploadsPending:S,onInputUploadBusy:E,running:N,error:v,systemNotificationPermission:O,updateDraft:te,updateNode:I,addEdge:ie,removeEdges:R,removeSelectedEdge:ae,removeNodes:oe,addNode:se,moveNode:z,copyNode:ce,deleteNode:le,toggleNotification:ue,selectNode:L,selectEdge:ne,clearSelection:re,saveWorkflow:de,runWorkflow:pe,runImageNode:me,stopWorkflow:B,publishWorkflow:he}}function Xn({workflow:e,onClose:t,onRun:n}){let{t:r}=s(),i=(0,Y.useId)(),a={id:`task`,name:`task`,label:r(`workflows:inputs.task`),description:r(`workflows:inputs.contextHint`),type:`text`,required:!1,defaultValue:``},o=e.inputs.length?e.inputs:[a],[c,l]=(0,Y.useState)(()=>Object.fromEntries(o.map(e=>[e.name,Mn(e)]))),[u,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)([]),_=(0,Y.useRef)(new Set),v=(0,Y.useRef)(c);v.current=c;let y=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>(y.current=!0,()=>{y.current=!1}),[]);let b=(e,t)=>{let n={...v.current,[e]:t};v.current=n,l(n)},x=(0,Y.useCallback)((e,t)=>{t?_.current.add(e):_.current.delete(e),y.current&&g([..._.current])},[]),C=(0,Y.useRef)(!1),w=async()=>{if(C.current||_.current.size)return;let e=v.current,i=Fn(o,e,r);if(i){m(i);return}C.current=!0,f(!0),m(``);try{let i=await n(In(o,e));if(!y.current)return;i?t():m(r(`workflows:inputs.startFailed`))}catch{y.current&&m(r(`workflows:inputs.startFailed`))}finally{C.current=!1,y.current&&f(!1)}};return(0,X.jsx)(Ne,{open:!0,onOpenChange:e=>{!e&&!C.current&&t()},children:(0,X.jsxs)(je,{className:`max-h-[85vh] overflow-y-auto supports-[height:100dvh]:max-h-[85dvh] sm:max-w-xl`,showCloseButton:!u,children:[(0,X.jsxs)(Ae,{children:[(0,X.jsx)(Me,{children:r(`workflows:inputs.runTitle`,{name:e.name})}),(0,X.jsx)(ke,{children:r(`workflows:inputs.runHint`)})]}),(0,X.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),w()},children:[qt(e)>0&&(0,X.jsx)(`p`,{className:`rounded-lg bg-muted p-3 text-sm`,children:r(`workflows:imageNodes.requestEstimate`,{count:qt(e)})}),o.map(e=>(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[e.type!==`text`&&e.type!==`image`&&e.type!==`video`&&(0,X.jsxs)(d,{htmlFor:`${i}-${e.id}`,className:`flex items-center gap-1`,children:[e.label,e.required&&(0,X.jsx)(`span`,{className:`text-destructive`,"aria-hidden":`true`,children:`*`})]}),e.type===`boolean`?(0,X.jsx)(S,{id:`${i}-${e.id}`,checked:c[e.name]===!0,disabled:u,onCheckedChange:t=>b(e.name,t)}):e.type===`text`||e.type===`image`||e.type===`video`?(0,X.jsx)(An,{input:e,value:c[e.name],disabled:u,label:`${e.label}${e.required?` *`:``}`,onBusyChange:x,onChange:t=>b(e.name,t)}):(0,X.jsx)(K,{id:`${i}-${e.id}`,type:e.type===`number`?`number`:`text`,step:e.type===`number`?`any`:void 0,value:String(c[e.name]??``),required:e.required,disabled:u,"aria-describedby":e.description?`${i}-${e.id}-description`:void 0,onChange:t=>b(e.name,t.target.value)}),e.description&&(0,X.jsx)(`p`,{id:`${i}-${e.id}-description`,className:`text-xs leading-relaxed text-muted-foreground`,children:e.description})]},e.id)),p&&(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:p}),(0,X.jsxs)(De,{children:[(0,X.jsx)(G,{type:`button`,variant:`outline`,disabled:u,onClick:()=>{C.current||t()},children:r(`workflows:sprite.cancel`)}),(0,X.jsxs)(G,{type:`submit`,disabled:u||h.length>0,children:[u?(0,X.jsx)(ce,{className:`animate-spin`}):(0,X.jsx)(pe,{}),r(`workflows:workflowsPage.run`)]})]})]})]})})}function Zn({message:e}){return e?(0,X.jsxs)(qe,{variant:`destructive`,children:[(0,X.jsx)(xe,{}),(0,X.jsx)(Ke,{children:e})]}):null}function Qn({label:e}){return(0,X.jsxs)(ze,{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)(B,{className:`animate-spin`,size:23}),(0,X.jsx)(`h2`,{children:e})]})}function $n({notify:e,requestConfirm:r,query:i=``}){let{t:a,language:o}=s(),c=t(),[l,u]=n(),d=l.get(`view`),f=d===`runs`||d===`templates`?d:`workflows`,p=()=>c(`${vt(`new`)}?template=sprite`),m=e=>u(t=>{let n=new URLSearchParams(t);return e===`workflows`?n.delete(`view`):n.set(`view`,e),n}),h=an({notify:e,requestConfirm:r,query:i}),[g,_]=(0,Y.useState)(null);return h.loading?(0,X.jsx)(Qn,{label:a(`workflows:workflowsPage.loadingWorkflows`)}):(0,X.jsxs)(`div`,{className:`workflows-page flex min-h-[100%] flex-col gap-[12px]`,children:[g&&(0,X.jsx)(Xn,{workflow:g,onClose:()=>_(null),onRun:e=>h.runWorkflow(g,e)}),(0,X.jsx)(Zn,{message:h.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)(cn,{value:f,t:a,onChange:m}),(0,X.jsx)(fn,{data:h.data,t:a})]}),f===`workflows`&&(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 rounded-2xl border bg-card p-5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`grid size-11 shrink-0 place-items-center rounded-xl bg-[var(--brand-blue-soft)] text-[var(--star-strong)]`,children:(0,X.jsx)(bt,{className:`size-5`})}),(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-medium`,children:a(`workflows:sprite.title`)}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(`workflows:sprite.description`)})]})]}),(0,X.jsxs)(G,{variant:`outline`,onClick:p,children:[a(`workflows:sprite.openStudio`),(0,X.jsx)(k,{className:`size-4`})]})]}),f===`workflows`?(0,X.jsx)(ln,{workflows:h.visibleWorkflows,runs:h.data.runs,busyId:h.busyId,language:o,t:a,onRun:_,onEdit:e=>c(vt(e)),onDuplicate:e=>void h.duplicateWorkflow(e),onExport:e=>void h.exportWorkflow(e),onImport:e=>void h.importWorkflow(e),onDelete:e=>void h.removeWorkflow(e)}):f===`runs`?(0,X.jsx)(un,{runs:h.data.runs,busyId:h.busyId,language:o,t:a,onStop:e=>void h.stopRun(e),onRetry:e=>void h.retryRun(e),onApproval:(e,t,n)=>void h.resolveApproval(e,t,n)}):(0,X.jsx)(dn,{t:a,onOpenTemplate:e=>c(`${vt(`new`)}?template=${encodeURIComponent(e)}`)})]})}function er({notify:e,registerPrimaryAction:i,registerWorkflowActions:a}){let{t:o,language:c}=s(),l=t(),{workflowId:u=`new`}=r(),[d]=n(),f=(0,Y.useCallback)(e=>{l(vt(e),{replace:!0})},[l]),p=Yn({workflowId:u,templateId:d.get(`template`),notify:e,onCreated:f}),{busy:m,publishWorkflow:h,runWorkflow:g,running:_,saveWorkflow:v,stopWorkflow:y}=p,[b,x]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(!1),D=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let e=D.current;if(!e)return;let t=()=>T(e.clientWidth>=1e3);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[p.loading]);let k=(0,Y.useCallback)(()=>{!m&&!_&&x(!0)},[m,_]);if(Ge(i,h),(0,Y.useEffect)(()=>a?.({save:()=>v(`draft`),run:_?y:k,busy:m||p.loading||!p.draft,running:_}),[m,p.draft,p.loading,a,k,_,v,y]),p.loading)return(0,X.jsx)(Qn,{label:o(`workflows:workflowsPage.loadingWorkflowEditor`)});if(!p.draft)return(0,X.jsxs)(ze,{size:`sm`,className:`gap-4 rounded-xl border bg-card p-6`,children:[(0,X.jsx)(xe,{className:`size-6 text-destructive`,"aria-hidden":`true`}),(0,X.jsx)(`h2`,{children:o(`workflows:workflowsPage.workflowEditorLoadFailed`)}),(0,X.jsx)(Zn,{message:p.error}),(0,X.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[(0,X.jsxs)(G,{onClick:p.retryLoad,children:[(0,X.jsx)(B,{className:`size-4`}),o(`workflows:workflowsPage.retryLoading`)]}),(0,X.jsx)(G,{variant:`outline`,onClick:()=>l(_t.workflows),children:o(`workflows:workflowsPage.backToWorkflows`)})]})]});let A=(0,X.jsx)(Jn,{draft:p.draft,catalog:p.catalog,selectedNode:p.selectedNode,selectedEdge:p.selectedEdge,currentRun:p.currentRun,onRunImageNode:(e,t)=>{p.runImageNode(e,t)},imageRunBusy:p.busy||p.running,language:c,t:o,systemNotificationPermission:p.systemNotificationPermission,onUpdateNode:p.updateNode,onToggleNotification:p.toggleNotification,onDeleteEdge:p.removeSelectedEdge,onCopyNode:p.copyNode,onDeleteNode:p.deleteNode,onOpenChannels:()=>l(_t.channels),onOpenSystemNotificationSettings:()=>{if(window.pisperDesktop?.openNotificationSettings){window.pisperDesktop.openNotificationSettings();return}l(`/config/notifications`)}}),j=p.selectedEdge?o(`workflows:workflowsPage.selectedConnection`):o(`workflows:editor.nodeProperties`);return(0,X.jsxs)(`div`,{ref:D,className:`workflow-editor-page @container/workflow flex min-w-0 flex-col gap-3`,children:[b&&(0,X.jsx)(Xn,{workflow:p.draft,onClose:()=>x(!1),onRun:g}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 rounded-xl border bg-card p-2`,children:[(0,X.jsx)(`nav`,{"aria-label":o(`workflows:workflowsPage.editorNavigation`),children:(0,X.jsxs)(G,{variant:`ghost`,size:`sm`,onClick:()=>l(_t.workflows),children:[(0,X.jsx)(O,{}),o(`workflows:workflowsPage.backToWorkflows`)]})}),(0,X.jsx)(`div`,{className:`hidden h-5 w-px bg-border @min-[640px]/workflow:block`}),(0,X.jsx)(`p`,{className:`min-w-0 flex-1 truncate px-1 text-sm font-medium`,title:p.draft.name,children:p.draft.name}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 max-[480px]:w-full max-[480px]:justify-end`,children:[(0,X.jsx)(Zt,{nodeCount:p.draft.nodes.length,t:o,onAddNode:p.addNode}),(0,X.jsxs)(Ne,{children:[(0,X.jsx)(Oe,{asChild:!0,children:(0,X.jsxs)(G,{variant:`ghost`,size:`sm`,children:[(0,X.jsx)(ye,{}),o(`workflows:workflowsPage.workflowSettings`)]})}),(0,X.jsxs)(je,{className:`sm:max-w-xl`,children:[(0,X.jsxs)(Ae,{children:[(0,X.jsx)(Me,{children:o(`workflows:workflowsPage.workflowSettings`)}),(0,X.jsx)(ke,{children:o(`workflows:editor.settingsDescription`)})]}),(0,X.jsx)(Wn,{draft:p.draft,catalog:p.catalog,t:o,onUpdateDraft:p.updateDraft,onInputUploadBusy:p.onInputUploadBusy})]})]}),!w&&(0,X.jsxs)(G,{variant:`ghost`,size:`sm`,onClick:()=>C(!0),children:[(0,X.jsx)(ue,{}),o(`workflows:editor.nodeProperties`)]})]})]}),(0,X.jsx)(Zn,{message:p.error}),p.running&&p.currentRun&&(0,X.jsx)(On,{run:p.currentRun,t:o}),(0,X.jsxs)(`div`,{className:E(`builder-layout grid h-[max(440px,calc(100vh-220px))] min-h-[440px] min-w-0 overflow-hidden rounded-xl border bg-card supports-[height:100dvh]:h-[max(440px,calc(100dvh-220px))]`,w?`grid-cols-[minmax(0,1fr)_320px]`:`grid-cols-1`),children:[(0,X.jsx)(Qt,{draft:p.draft,selectedNodeId:p.selectedNodeId,selectedEdgeId:p.selectedEdgeId,t:o,onAddNode:p.addNode,onConnect:p.addEdge,onMoveNode:p.moveNode,onSelectNode:e=>{p.selectNode(e),C(!0)},onSelectEdge:e=>{p.selectEdge(e),C(!0)},onClearSelection:p.clearSelection,onDeleteNodes:p.removeNodes,onDeleteEdges:p.removeEdges}),w&&(0,X.jsxs)(`aside`,{className:`flex min-h-0 min-w-0 flex-col border-l bg-card`,"aria-label":j,children:[(0,X.jsx)(`header`,{className:`border-b px-4 py-3`,children:(0,X.jsx)(`h2`,{className:`text-sm font-medium`,children:j})}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4`,children:A})]})]}),!w&&(0,X.jsx)(We,{open:S,onOpenChange:C,children:(0,X.jsxs)(He,{className:`gap-0 data-[side=right]:w-[min(400px,100vw)] data-[side=right]:sm:max-w-[400px]`,children:[(0,X.jsxs)(Ve,{className:`border-b pr-12`,children:[(0,X.jsx)(Be,{children:j}),(0,X.jsx)(Ue,{className:`sr-only`,children:o(`workflows:editor.inspectorDescription`)})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4`,children:A})]})})]})}export{er as WorkflowBuilder,$n as WorkflowsPage};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-Cd-3GVxJ.js";var t=e(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),n=e(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),r=e(`monitor-smartphone`,[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]),i=e(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]);function a(e){let t=String(e||``).trim().replace(/^#/,``);return/^[0-9a-fA-F]{6}$/.test(t)?`#${t.toLowerCase()}`:null}function o(e){return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16)}}function s({r:e,g:t,b:n}){let r=e=>Math.round(Math.min(255,Math.max(0,e))).toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`}function c(e,t,n){return s({r:e.r+(t.r-e.r)*n,g:e.g+(t.g-e.g)*n,b:e.b+(t.b-e.b)*n})}var l={r:255,g:255,b:255},u={r:24,g:24,b:27};function d({r:e,g:t,b:n},r){return`rgba(${e}, ${t}, ${n}, ${r})`}function f(e){let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function p({r:e,g:t,b:n}){return .2126*f(e)+.7152*f(t)+.0722*f(n)}function m(e,t){let n=p(e),r=p(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)}function h(e){return m(e,l)>=m(e,u)?`#fff`:`#18181b`}function g(e){for(let t=.22;t<=1;t+=.04){let n=c(e,u,t);if(m(o(n),l)>=4.5)return n}return`#18181b`}function _(e){for(let t=.46;t<=1;t+=.04){let n=c(e,l,t);if(m(o(n),u)>=4.5)return n}return`#fff`}function v(e){let t=o(e),n=c(t,u,.12),r=g(t),i=c(t,l,.93),a=c(t,l,.72),s=c(t,l,.22),f=c(t,l,.33),p=_(t),m=o(s),v=h(t),y=h(m);return`:root[data-accent='custom'] {
|
|
2
|
-
--star: ${e};
|
|
3
|
-
--star-hover: ${n};
|
|
4
|
-
--star-strong: ${r};
|
|
5
|
-
--star-soft: ${i};
|
|
6
|
-
--star-border: ${a};
|
|
7
|
-
--on-accent: ${v};
|
|
8
|
-
--brand-blue: ${e};
|
|
9
|
-
--brand-blue-hover: ${n};
|
|
10
|
-
--brand-blue-strong: ${r};
|
|
11
|
-
--brand-blue-soft: ${i};
|
|
12
|
-
--brand-blue-border: ${a};
|
|
13
|
-
--accent-ring: ${d(t,.16)};
|
|
14
|
-
--focus: ${e};
|
|
15
|
-
--focus-ring: ${d(t,.18)};
|
|
16
|
-
}
|
|
17
|
-
:root[data-theme='dark'][data-accent='custom'] {
|
|
18
|
-
--star: ${s};
|
|
19
|
-
--star-hover: ${f};
|
|
20
|
-
--star-strong: ${p};
|
|
21
|
-
--star-soft: ${d(m,.15)};
|
|
22
|
-
--star-border: ${d(m,.38)};
|
|
23
|
-
--on-accent: ${y};
|
|
24
|
-
--brand-blue: ${s};
|
|
25
|
-
--brand-blue-hover: ${f};
|
|
26
|
-
--brand-blue-strong: ${p};
|
|
27
|
-
--brand-blue-soft: ${d(m,.15)};
|
|
28
|
-
--brand-blue-border: ${d(m,.34)};
|
|
29
|
-
--accent-ring: ${d(m,.22)};
|
|
30
|
-
--focus: ${s};
|
|
31
|
-
--focus-ring: ${d(m,.26)};
|
|
32
|
-
}`}function y(){return window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke}function b(){return typeof window<`u`&&!!y()}function x(e,t){let n=y();return n?n(e,t):Promise.reject(Error(`Tauri IPC is unavailable.`))}async function S(){return x(`plugin:notification|is_permission_granted`)}async function C(){return x(`plugin:notification|request_permission`)}async function w(e,t){return x(`plugin:notification|notify`,{options:{title:e,body:t}})}var T=`https://github.com/ling-kong-ran/pisper/releases`,E=`release`;export{w as a,a as c,n as d,t as f,S as i,i as l,T as n,C as o,b as r,v as s,E as t,r as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-Cd-3GVxJ.js";var t=e(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./floating-widgets-store-DIy4GSy4.js";import{i as e}from"./useCustomUiComponents-BH86kuaq.js";export{e as listCustomUiComponents};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={zh:{"channelsPage.accessScope":`访问范围`,"channelsPage.accessScopeUpdated":`访问范围已更新`,"channelsPage.afterYouScanAndConfirmCredentialsAreSavedAndTheChannelStaysOnlineIncomingMessagesGoDirectlyToThe":`扫码确认后会自动保存凭据并保持在线,收到消息后直接交给指定模型和 {agent}。`,"channelsPage.allMembersInTheCurrentTenant":`当前租户所有成员`,"channelsPage.allUsersWhoMessageTheBot":`所有给机器人发消息的用户`,"channelsPage.allWeChatUsersWhoMessageTheBot":`所有给机器人发消息的微信用户`,"channelsPage.approvalMode":`审批模式`,"channelsPage.approvalModeUpdated":`渠道审批模式已更新`,"channelsPage.approvalRequired":`每次操作都需审批`,"channelsPage.authorizationSucceededConnecting":`授权成功,正在建立持续连接…`,"channelsPage.botToken":`Bot Token`,"channelsPage.cancel":`取消`,"channelsPage.cancelled":`已取消`,"channelsPage.cannotScanOpenTheSignInLink":`无法扫码?打开登录链接`,"channelsPage.channelChatReset":`渠道会话已重置`,"channelsPage.channelChats":`渠道会话`,"channelsPage.channelConnected":`渠道已经连接`,"channelsPage.channelEnabled":`渠道已启用`,"channelsPage.channelPaused":`渠道已暂停`,"channelsPage.channelReplyModelUpdated":`渠道回复模型已更新`,"channelsPage.closeDialog":`关闭对话框`,"channelsPage.configureName":`配置{name}`,"channelsPage.configuringAgainWillReplaceTheCurrentNameConnectionContinue":`重新配置会替换当前{name}连接,是否继续?`,"channelsPage.confirmingAuthorization":`正在确认授权…`,"channelsPage.connect":`连接`,"channelsPage.connectNameByQRCode":`扫码连接{name}`,"channelsPage.connectedTime":`已连接 {time}`,"channelsPage.connecting":`连接中`,"channelsPage.connectionFailed":`连接失败`,"channelsPage.connectionSaved":`连接设置已保存`,"channelsPage.connectionSettings":`连接设置`,"channelsPage.continueConfiguration":`继续配置`,"channelsPage.continueScanning":`继续扫码`,"channelsPage.countLinked":`{count} 个已绑定`,"channelsPage.createTheBotAppThroughTheOfficialFeishuAuthorizationPage":`由飞书官方授权页创建机器人应用。`,"channelsPage.defaultModel":`默认模型`,"channelsPage.defaultWorkingDirectoryForNewChats":`新会话默认工作目录`,"channelsPage.defaultWorkingDirectorySaved":`默认工作目录已保存`,"channelsPage.disconnect":`解除连接`,"channelsPage.disconnectName":`解除{name}连接`,"channelsPage.eachContactOrChatMapsToAnIndependentAgentSession":`每个联系人或聊天独立映射 Agent 会话`,"channelsPage.enableThisChannel":`启用此渠道`,"channelsPage.enterBotCredentialsForName":`输入 {name} 的机器人凭据。`,"channelsPage.enterPairingCode":`请输入手机上显示的数字配对码`,"channelsPage.enterTheNumberShownOnYourPhone":`输入手机显示的数字`,"channelsPage.establishingPersistentConnection":`正在建立持续连接`,"channelsPage.executionMode":`执行模式`,"channelsPage.executionModeUpdated":`渠道执行模式已更新`,"channelsPage.feishu":`飞书`,"channelsPage.feishuAppBot":`飞书应用机器人`,"channelsPage.feishuCapabilities":`私聊、群聊 @、图片和文件`,"channelsPage.fullAccess":`完全访问`,"channelsPage.generateANewQRCode":`重新生成二维码`,"channelsPage.goalMode":`目标`,"channelsPage.loadingChannels":`正在加载渠道`,"channelsPage.localCredentialsAndChatMappingsWillBeDeleted":`本地凭据和会话映射会被删除。`,"channelsPage.localSecurityBoundary":`本机安全边界`,"channelsPage.nameConnectionQRCode":`{name}连接二维码`,"channelsPage.nameDisconnected":`{name}已解除连接`,"channelsPage.nameReconnected":`{name}已重新连接`,"channelsPage.nameSettings":`{name}设置`,"channelsPage.nameTwoWayConnectionEstablished":`{name}已建立双向连接`,"channelsPage.noMessages":`暂无消息`,"channelsPage.noRoutedChats":`暂无路由会话`,"channelsPage.notConnected":`未连接`,"channelsPage.off":`关闭`,"channelsPage.officialSetupInstructions":`打开官方页面创建机器人,然后将 App ID、App Secret 或 Bot Token 粘贴到下方;Pisper 不会读取页面中的敏感信息。`,"channelsPage.officialSetupRequired":`先完成官方机器人创建`,"channelsPage.onceConnectedMessagesFromFeishuOrWeixinWillArriveHereInPisper":`连接完成后,来自飞书或微信的消息会在这里抵达 Pisper。`,"channelsPage.onceConnectedMessagesFromSupportedChannelsWillArriveHereInPisper":`连接完成后,来自已接入渠道的消息会在这里抵达 Pisper。`,"channelsPage.online":`在线`,"channelsPage.openOfficialSetup":`打开官方创建页面`,"channelsPage.openOfficialSetupQRCode":`官方机器人创建页面二维码`,"channelsPage.ownerOnlyAccessRespectsToolPermissionsAndExecutionMode":`默认仅允许扫码创建者使用;Agent 工具仍遵循已配置的工具权限和会话执行模式。渠道消息也支持 TUI 的 /dir、/mode、/run、/status、/stop、/new 命令。`,"channelsPage.pairingCodeSubmitted":`配对码已提交`,"channelsPage.persistentTwoWayConnection":`持续在线的双向连接`,"channelsPage.planMode":`计划`,"channelsPage.processing":`正在处理…`,"channelsPage.qq":`QQ`,"channelsPage.qqAppId":`QQ App ID`,"channelsPage.qqAppSecret":`QQ App Secret`,"channelsPage.qqBot":`QQ 机器人`,"channelsPage.qqCapabilities":`私聊、群聊、图片和文件`,"channelsPage.qqCredentialsOrToken":`请填写 App ID,并填写 App Secret;已有访问 Token 时也可使用 Token。`,"channelsPage.qqPersistentConnection":`QQ 机器人持续连接`,"channelsPage.qrCodeExpiresTime":`二维码将在 {time}过期`,"channelsPage.qrCodeOwnerOnly":`仅扫码创建者`,"channelsPage.reconnect":`重连`,"channelsPage.reconnectName":`重新连接{name}`,"channelsPage.reconnecting":`重连中`,"channelsPage.replyModel":`回复模型`,"channelsPage.requestingLoginQrCode":`正在申请登录二维码…`,"channelsPage.reset":`重置`,"channelsPage.resetChannelChat":`重置渠道会话`,"channelsPage.resetChat":`重置会话`,"channelsPage.resetTheAppChatLinkedToScope":`重置“{scope}”绑定的 {app} 会话?`,"channelsPage.retry":`重试`,"channelsPage.save":`保存`,"channelsPage.saving":`保存中…`,"channelsPage.scanAgainToReconnect":`重新扫码绑定`,"channelsPage.scanAndConfirmConnection":`请使用手机扫码并确认连接`,"channelsPage.scanWithQQToCreateOfficialBot":`使用手机 QQ 扫描二维码,授权创建并绑定官方机器人。`,"channelsPage.scannedWaitingForConfirmation":`已扫码,正在等待确认…`,"channelsPage.scanningAgainWillReplaceTheCurrentNameConnectionContinue":`重新扫码会替换当前{name}连接,是否继续?`,"channelsPage.signInToPersonalWeChatThroughTencentILinkBot":`由腾讯 iLink Bot 完成个人微信登录。`,"channelsPage.submitPairingCode":`提交配对码`,"channelsPage.teamMode":`团队`,"channelsPage.telegram":`Telegram`,"channelsPage.telegramBot":`Telegram 机器人`,"channelsPage.telegramCapabilities":`私聊、群聊、图片和文件`,"channelsPage.telegramPersistentConnection":`Telegram Bot 长轮询连接`,"channelsPage.tencentILinkContinuouslyPollsDirectMessagesAndSupportsTextAndMediaReplies":`腾讯 iLink 持续拉取私聊消息,并支持文字与媒体回复。`,"channelsPage.tencentILinkPersistentConnection":`Tencent iLink 持续连接`,"channelsPage.trueTwoWayMessagingNoNotificationWebhookRequired":`真正双向收发,不使用通知 Webhook`,"channelsPage.turnOffToDisconnectWhileKeepingSignInCredentials":`关闭后断开连接,但保留登录凭据`,"channelsPage.twoWay":`双向`,"channelsPage.twoWayCapability":`双向能力`,"channelsPage.useApplicationDefaultModel":`跟随应用默认模型`,"channelsPage.waitingForTheFirstReplyFromAfar":`等待远方的第一声回应`,"channelsPage.weChat":`微信`,"channelsPage.weChatCapabilities":`个人微信私聊、图片和文件`,"channelsPage.webSocketPersistentConnection":`WebSocket 长连接`,"channelsPage.webSocketReceivesDirectMessagesAndGroupMentions":`WebSocket 接收私聊和群聊 @ 消息。`,"channelsPage.workingDirectory":`工作目录`,"channelsPage.workspaceWrite":`工作区写入自动执行`},en:{"channelsPage.accessScope":`Access scope`,"channelsPage.accessScopeUpdated":`Access scope updated`,"channelsPage.afterYouScanAndConfirmCredentialsAreSavedAndTheChannelStaysOnlineIncomingMessagesGoDirectlyToThe":`After you scan and confirm, credentials are saved and the channel stays online. Incoming messages go directly to the selected model and {agent}.`,"channelsPage.allMembersInTheCurrentTenant":`All members in the current tenant`,"channelsPage.allUsersWhoMessageTheBot":`All users who message the bot`,"channelsPage.allWeChatUsersWhoMessageTheBot":`All WeChat users who message the bot`,"channelsPage.approvalMode":`Approval mode`,"channelsPage.approvalModeUpdated":`Channel approval mode updated`,"channelsPage.approvalRequired":`Approve every operation`,"channelsPage.authorizationSucceededConnecting":`Authorization succeeded; establishing connection…`,"channelsPage.botToken":`Bot token`,"channelsPage.cancel":`Cancel`,"channelsPage.cancelled":`Cancelled`,"channelsPage.cannotScanOpenTheSignInLink":`Cannot scan? Open the sign-in link`,"channelsPage.channelChatReset":`Channel chat reset`,"channelsPage.channelChats":`Channel chats`,"channelsPage.channelConnected":`Channel connected`,"channelsPage.channelEnabled":`Channel enabled`,"channelsPage.channelPaused":`Channel paused`,"channelsPage.channelReplyModelUpdated":`Channel reply model updated`,"channelsPage.closeDialog":`Close dialog`,"channelsPage.configureName":`Configure {name}`,"channelsPage.configuringAgainWillReplaceTheCurrentNameConnectionContinue":`Configuring again will replace the current {name} connection. Continue?`,"channelsPage.confirmingAuthorization":`Confirming authorization…`,"channelsPage.connect":`Connect`,"channelsPage.connectNameByQRCode":`Connect {name} by QR code`,"channelsPage.connectedTime":`Connected {time}`,"channelsPage.connecting":`Connecting`,"channelsPage.connectionFailed":`Connection failed`,"channelsPage.connectionSaved":`Connection settings saved`,"channelsPage.connectionSettings":`Connection Settings`,"channelsPage.continueConfiguration":`Continue configuration`,"channelsPage.continueScanning":`Continue scanning`,"channelsPage.countLinked":`{count} linked`,"channelsPage.createTheBotAppThroughTheOfficialFeishuAuthorizationPage":`Create the bot app through the official Feishu authorization page.`,"channelsPage.defaultModel":`Default model`,"channelsPage.defaultWorkingDirectoryForNewChats":`Default working directory for new chats`,"channelsPage.defaultWorkingDirectorySaved":`Default working directory saved`,"channelsPage.disconnect":`Disconnect`,"channelsPage.disconnectName":`Disconnect {name}`,"channelsPage.eachContactOrChatMapsToAnIndependentAgentSession":`Each contact or chat maps to an independent agent session`,"channelsPage.enableThisChannel":`Enable this channel`,"channelsPage.enterBotCredentialsForName":`Enter the {name} bot credentials.`,"channelsPage.enterPairingCode":`Enter the numeric pairing code shown on your phone`,"channelsPage.enterTheNumberShownOnYourPhone":`Enter the number shown on your phone`,"channelsPage.establishingPersistentConnection":`Establishing persistent connection`,"channelsPage.executionMode":`Execution mode`,"channelsPage.executionModeUpdated":`Channel execution mode updated`,"channelsPage.feishu":`Feishu`,"channelsPage.feishuAppBot":`Feishu app bot`,"channelsPage.feishuCapabilities":`Direct messages, group mentions, images, and files`,"channelsPage.fullAccess":`Full access`,"channelsPage.generateANewQRCode":`Generate a new QR code`,"channelsPage.goalMode":`Goal`,"channelsPage.loadingChannels":`Loading channels`,"channelsPage.localCredentialsAndChatMappingsWillBeDeleted":`Local credentials and chat mappings will be deleted.`,"channelsPage.localSecurityBoundary":`Local security boundary`,"channelsPage.nameConnectionQRCode":`{name} connection QR code`,"channelsPage.nameDisconnected":`{name} disconnected`,"channelsPage.nameReconnected":`{name} reconnected`,"channelsPage.nameSettings":`{name} settings`,"channelsPage.nameTwoWayConnectionEstablished":`{name} two-way connection established`,"channelsPage.noMessages":`No messages`,"channelsPage.noRoutedChats":`No routed chats`,"channelsPage.notConnected":`Not connected`,"channelsPage.off":`Off`,"channelsPage.officialSetupInstructions":`Open the official page to create the bot, then paste the App ID, App Secret, or Bot Token below; Pisper never reads sensitive values from that page.`,"channelsPage.officialSetupRequired":`Create the official bot first`,"channelsPage.onceConnectedMessagesFromFeishuOrWeixinWillArriveHereInPisper":`Once connected, messages from Feishu or Weixin will arrive here in Pisper.`,"channelsPage.onceConnectedMessagesFromSupportedChannelsWillArriveHereInPisper":`Once connected, messages from supported channels will arrive here in Pisper.`,"channelsPage.online":`Online`,"channelsPage.openOfficialSetup":`Open official setup page`,"channelsPage.openOfficialSetupQRCode":`QR code for the official bot setup page`,"channelsPage.ownerOnlyAccessRespectsToolPermissionsAndExecutionMode":`Only the person who scanned the QR code is allowed by default. Agent tools still follow the configured tool permissions and session execution mode. Channel messages also support the TUI commands /dir, /mode, /run, /status, /stop, and /new.`,"channelsPage.pairingCodeSubmitted":`Pairing code submitted`,"channelsPage.persistentTwoWayConnection":`Persistent two-way connection`,"channelsPage.planMode":`Plan`,"channelsPage.processing":`Processing…`,"channelsPage.qq":`QQ`,"channelsPage.qqAppId":`QQ App ID`,"channelsPage.qqAppSecret":`QQ App Secret`,"channelsPage.qqBot":`QQ bot`,"channelsPage.qqCapabilities":`Direct messages, group chats, images, and files`,"channelsPage.qqCredentialsOrToken":`Enter App ID and App Secret, or just a token.`,"channelsPage.qqPersistentConnection":`Persistent QQ bot connection`,"channelsPage.qrCodeExpiresTime":`QR code expires {time}`,"channelsPage.qrCodeOwnerOnly":`QR-code owner only`,"channelsPage.reconnect":`Reconnect`,"channelsPage.reconnectName":`Reconnect {name}`,"channelsPage.reconnecting":`Reconnecting`,"channelsPage.replyModel":`Reply model`,"channelsPage.requestingLoginQrCode":`Requesting login QR code…`,"channelsPage.reset":`Reset`,"channelsPage.resetChannelChat":`Reset channel chat`,"channelsPage.resetChat":`Reset chat`,"channelsPage.resetTheAppChatLinkedToScope":`Reset the {app} chat linked to “{scope}”?`,"channelsPage.retry":`Retry`,"channelsPage.save":`Save`,"channelsPage.saving":`Saving…`,"channelsPage.scanAgainToReconnect":`Scan again to reconnect`,"channelsPage.scanAndConfirmConnection":`Scan with your phone and confirm the connection`,"channelsPage.scanWithQQToCreateOfficialBot":`Scan with the QQ mobile app to authorize creation and binding of the official bot.`,"channelsPage.scannedWaitingForConfirmation":`Scanned; waiting for confirmation…`,"channelsPage.scanningAgainWillReplaceTheCurrentNameConnectionContinue":`Scanning again will replace the current {name} connection. Continue?`,"channelsPage.signInToPersonalWeChatThroughTencentILinkBot":`Sign in to personal WeChat through Tencent iLink Bot.`,"channelsPage.submitPairingCode":`Submit pairing code`,"channelsPage.teamMode":`Team`,"channelsPage.telegram":`Telegram`,"channelsPage.telegramBot":`Telegram bot`,"channelsPage.telegramCapabilities":`Direct messages, group chats, images, and files`,"channelsPage.telegramPersistentConnection":`Telegram Bot long-polling connection`,"channelsPage.tencentILinkContinuouslyPollsDirectMessagesAndSupportsTextAndMediaReplies":`Tencent iLink continuously polls direct messages and supports text and media replies.`,"channelsPage.tencentILinkPersistentConnection":`Persistent Tencent iLink connection`,"channelsPage.trueTwoWayMessagingNoNotificationWebhookRequired":`True two-way messaging; no notification webhook required`,"channelsPage.turnOffToDisconnectWhileKeepingSignInCredentials":`Turn off to disconnect while keeping sign-in credentials.`,"channelsPage.twoWay":`Two-way`,"channelsPage.twoWayCapability":`Two-way capability`,"channelsPage.useApplicationDefaultModel":`Use application default model`,"channelsPage.waitingForTheFirstReplyFromAfar":`Waiting for the first reply from afar`,"channelsPage.weChat":`WeChat`,"channelsPage.weChatCapabilities":`Personal WeChat messages, images, and files`,"channelsPage.webSocketPersistentConnection":`Persistent WebSocket connection`,"channelsPage.webSocketReceivesDirectMessagesAndGroupMentions":`WebSocket receives direct messages and group @ mentions.`,"channelsPage.workingDirectory":`Working Directory`,"channelsPage.workspaceWrite":`Auto-run workspace writes`}};export{e as channelsMessages};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./http-DphgzWtw.js";import{i as n}from"./api-Dzobr-o_.js";import{r,t as i}from"./startup-queries-CAQZvUIR.js";var a=e=>`/api/sessions/${encodeURIComponent(e)}`;async function o(t,n={}){let i=await e(t,n);return n.method&&n.method!==`GET`&&(/^\/api\/sessions(?:$|\/[^/]+(?:\/(?:derive|model|cwd|execution-mode|run-mode|thinking-level|goal|tree\/navigate))?$)/.test(t)&&r(`sessions`),t===`/api/settings/compaction`&&r(`config`)),i}var s={listSessions:({refresh:e=!0}={})=>i(`sessions`,e),searchSessionTreeLabels:(e,t=20)=>o(`/api/session-labels?${new URLSearchParams({query:e,limit:String(t)})}`),listSessionTreeLabels:(e=500)=>o(`/api/session-labels?limit=${e}`),createSession:(e,t=``)=>o(`/api/sessions`,{method:`POST`,data:{name:e,cwd:t||null}}),deriveSession:(e,t,n)=>o(`${a(e)}/derive`,{method:`POST`,data:{boundaryEntryId:t,name:n}}),getSessionTree:e=>o(`${a(e)}/tree`),navigateSessionTree:(e,t,n)=>o(`${a(e)}/tree/navigate`,{method:`POST`,data:{targetEntryId:t,summarize:n},timeout:18e4}),navigateSessionTreeTarget:(e,t)=>o(`${a(e)}/tree/navigate`,{method:`POST`,data:{targetEntryId:t,summarize:!1,includeTree:!1},timeout:18e4}),setSessionTreeLabel:(e,t,n)=>o(`${a(e)}/tree/labels/${encodeURIComponent(t)}`,{method:`PUT`,data:{label:n}}),getSessionCommands:e=>o(`${a(e)}/commands`),getConfig:({refresh:e=!1}={})=>i(`config`,e),updateCompactionPreference:e=>o(`/api/settings/compaction`,{method:`PATCH`,data:{thresholdPercent:e}}),getLiveSession:(e,t={})=>o(`${a(e)}/live`,t),getMessages:(e,t)=>{let n=new URLSearchParams({limit:String(t.limit)});return t.before&&n.set(`before`,t.before),o(`${a(e)}/messages?${n}`)},openStream:async(e,r)=>{await n({open:async()=>(await t(),fetch(`/api/chat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})),resume:async(e,n)=>(await t(),fetch(`/api/runs/${encodeURIComponent(e)}/events?after=${n}`)),onEvent:r})},retryLastTurn:async(e,r)=>{await n({open:async()=>(await t(),fetch(`${a(e)}/retry`,{method:`POST`})),resume:async(e,n)=>(await t(),fetch(`/api/runs/${encodeURIComponent(e)}/events?after=${n}`)),onEvent:r})},queueInput:(e,t,n,r)=>o(`${a(e)}/input`,{method:`POST`,data:{message:t,attachments:n,behavior:r}}),withdrawQueuedInput:(e,t)=>o(`${a(e)}/input/${encodeURIComponent(t)}`,{method:`DELETE`}),compactSession:e=>o(`${a(e)}/compact`,{method:`POST`,data:{},timeout:18e4}),getSessionWorkflowRuns:(e,t)=>o(`${a(e)}/workflow-runs`,{signal:t}),resolveWorkflowApproval:(e,t,n)=>o(`/api/workflow-runs/${encodeURIComponent(e)}/approvals/${encodeURIComponent(t)}`,{method:`POST`,data:{approved:n}}),stopWorkflowRun:e=>o(`/api/workflow-runs/${encodeURIComponent(e)}/stop`,{method:`POST`,data:{}}),abort:e=>o(`${a(e)}/abort`,{method:`POST`,data:{}}),resolveMobileOperation:(e,t,n)=>o(`${a(e)}/mobile-operations/${encodeURIComponent(t)}`,{method:`POST`,data:n}),pauseGoal:e=>o(`${a(e)}/goal`,{method:`PATCH`,data:{action:`pause`}}),setGoalBudget:(e,t)=>o(`${a(e)}/goal`,{method:`PATCH`,data:{action:`set-budget`,tokenBudget:t}}),getGitChanges:e=>o(`${a(e)}/git/changes`),commitGitChanges:(e,t)=>o(`${a(e)}/git/commit`,{method:`POST`,data:{message:t},timeout:6e4}),pushGitChanges:e=>o(`${a(e)}/git/push`,{method:`POST`,data:{},timeout:15e4}),revertGitChanges:e=>o(`${a(e)}/git/revert`,{method:`POST`,data:{},timeout:6e4}),getVcsChanges:e=>o(`${a(e)}/vcs/changes`),getFileDiff:(e,t)=>o(`${a(e)}/vcs/file-diff?path=${encodeURIComponent(t)}`),commitVcsChanges:(e,t)=>o(`${a(e)}/vcs/commit`,{method:`POST`,data:{message:t},timeout:15e4}),pushVcsChanges:e=>o(`${a(e)}/vcs/push`,{method:`POST`,data:{},timeout:15e4}),revertVcsChanges:e=>o(`${a(e)}/vcs/revert`,{method:`POST`,data:{},timeout:6e4}),getSessionFileChanges:(e,t={})=>o(`${a(e)}/file-changes`,t),getSessionFileChangeDiff:(e,t)=>o(`${a(e)}/file-changes/diff?path=${encodeURIComponent(t)}`),revertSessionFileChanges:(e,t=``)=>o(`${a(e)}/file-changes/revert`,{method:`POST`,data:{path:t},timeout:6e4}),approveSessionFileChanges:(e,t=``)=>o(`${a(e)}/file-changes/approve`,{method:`POST`,data:{path:t}}),updateModel:(e,t,n)=>o(`${a(e)}/model`,{method:`PUT`,data:{provider:t,model:n}}),getThinkingLevel:e=>o(`${a(e)}/thinking-level`),setThinkingLevel:(e,t)=>o(`${a(e)}/thinking-level`,{method:`PUT`,data:{level:t}}),updateExecutionMode:(e,t)=>o(`${a(e)}/execution-mode`,{method:`PUT`,data:{mode:t}}),updateRunMode:(e,t)=>o(`${a(e)}/run-mode`,{method:`PUT`,data:{mode:t}}),resolveApproval:(e,t,n)=>o(`${a(e)}/approvals/${encodeURIComponent(t)}`,{method:`POST`,data:{approved:n}}),updateCwd:(e,t)=>o(`${a(e)}/cwd`,{method:`PUT`,data:{cwd:t}}),renameSession:(e,t)=>o(a(e),{method:`PATCH`,data:{name:t}})};export{s as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-Cd-3GVxJ.js";var t=e(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";import{u as n}from"./i18n-7QvbQzOQ.js";var r=e(t(),1),i=`section`,a={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`},o=[{id:`sec-models`,section:`models`,card:i,titleKey:`config:configPage.models`,keywords:[`model`,`provider`,`llm`,`api`,`模型`,`供应商`,`大模型`]},{id:`sec-notifications`,section:`notifications`,card:i,titleKey:`config:configPage.notifications`,keywords:[`notification`,`push`,`alert`,`通知`,`推送`,`提醒`]},{id:`sec-interface`,section:`interface`,card:i,titleKey:`config:configPage.interface`,keywords:[`interface`,`theme`,`appearance`,`display`,`界面`,`主题`,`外观`,`显示`]},{id:`sec-shortcuts`,section:`shortcuts`,card:i,titleKey:`config:configPage.shortcuts`,keywords:[`keyboard`,`shortcut`,`hotkey`,`keybinding`,`voice`,`push to talk`,`快捷键`,`按键`,`键盘`,`语音`,`长按`]},{id:`sec-desktop-pet`,section:`desktop-pet`,card:i,titleKey:`config:configPage.desktopPet`,keywords:[`pet`,`petdex`,`宠物`,`桌宠`]},{id:`sec-updates`,section:`updates`,card:i,titleKey:`config:configPage.appUpdates`,keywords:[`update`,`upgrade`,`version`,`更新`,`升级`,`版本`]},{id:`sec-about`,section:`about`,card:i,titleKey:`config:configPage.about`,keywords:[`about`,`info`,`license`,`关于`,`信息`,`许可`]},{id:`sec-remote-access`,section:`remote-access`,card:i,titleKey:`config:configPage.remoteAccess`,keywords:[`remote`,`network`,`phone`,`远程`,`网络`,`手机`]},{id:`sec-mobile-server`,section:`mobile-server`,card:i,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-custom-ui`,section:`interface`,card:`interface-custom-ui`,titleKey:`config:interfaceSettings.customUiTab`,keywords:[`custom ui`,`standalone widgets`,`component`,`html`,`manifest`,`独立组件`,`自定义组件`,`组件`]},{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-workspaces`,section:`remote-access`,card:`remote-workspaces`,titleKey:`config:remoteWorkspace.title`,keywords:[`linux`,`remote workspace`,`服务器`,`远程工作区`]},{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`,`支持`,`捐赠`,`赞助`]}],s={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`],diy:[`interface-custom-ui`],components:[`interface-custom-ui`],widgets:[`interface-custom-ui`],组件:[`interface-custom-ui`],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`]},c=12;function l(e){return[n(e.titleKey,`zh-CN`).toLowerCase(),n(e.titleKey,`en-US`).toLowerCase()]}function u(e,t){let r=e.trim().toLowerCase();if(!r)return[];let i=new Set(s[r]||[]);for(let e of r.split(/\s+/))for(let t of s[e]||[])i.add(t);let u=[];for(let e of o){if(typeof window<`u`&&(e.id===`remote-workspaces`&&!window.pisperDesktop?.remoteWorkspaces||e.id===`remote-access-main`&&window.__PISPER_REMOTE_WORKSPACE__))continue;let[t,n]=l(e),a=0;i.has(e.id)?a=100:t===r||n===r?a=90:t.startsWith(r)||n.startsWith(r)?a=80:t.includes(r)||n.includes(r)?a=65:(e.keywords||[]).some(e=>{let t=e.toLowerCase();return t.includes(r)?r.length>=2||/[\u4e00-\u9fff]/.test(r):/[\u4e00-\u9fff]/.test(t)&&t.includes(r)})&&(a=40),a>0&&u.push({entry:e,score:a})}u.sort((e,t)=>t.score-e.score);let d=new Set,f=[];for(let{entry:e}of u){let r={entry:e,title:n(e.titleKey,t),sectionTitle:n(a[e.section],t)},i=`${e.section}|${r.title}`;if(!d.has(i)&&(d.add(i),f.push(r),f.length>=c))break}return f}var d=`pisper:config-card-highlight`,f=null;function p(e,t){f={card:e,section:t},window.dispatchEvent(new Event(d))}function m(){let e=f;return f=null,e}function h(e){let t=document.querySelector(`[data-config-card="${e.card}"]`);if(t||=document.querySelector(`[data-config-card="${i}"]`),!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 g(e){(0,r.useEffect)(()=>{let e=()=>{let e=m();e&&requestAnimationFrame(()=>requestAnimationFrame(()=>h(e)))};return e(),window.addEventListener(d,e),()=>window.removeEventListener(d,e)},[e])}export{g as i,p as n,u as r,i as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{i as r,n as i}from"./dist-Cfh4kzCK.js";import{a,c as o,i as s,n as c,o as l,s as u,t as d}from"./dist-B_a0oV4U.js";var f=e(t(),1),p=n(),m=Object.defineProperty,h=(e,t)=>m(e,`name`,{value:t,configurable:!0});function g(e){let t=e+`CollectionProvider`,[n,a]=u(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=h(e=>{let{scope:t,children:n}=e,r=f.useRef(null),i=f.useRef(new Map).current;return(0,p.jsx)(o,{scope:t,itemMap:i,collectionRef:r,children:n})},`CollectionProvider`);c.displayName=t;let l=e+`CollectionSlot`,d=i(l),m=f.forwardRef((e,t)=>{let{scope:n,children:i}=e,a=s(l,n),o=r(t,a.collectionRef);return(0,p.jsx)(d,{ref:o,children:i})});m.displayName=l;let g=e+`CollectionItemSlot`,_=`data-radix-collection-item`,v=i(g),y=f.forwardRef((e,t)=>{let{scope:n,children:i,...a}=e,o=f.useRef(null),c=r(t,o),l=s(g,n);return f.useEffect(()=>(l.itemMap.set(o,{ref:o,...a}),()=>void l.itemMap.delete(o))),(0,p.jsx)(v,{[_]:``,ref:c,children:i})});y.displayName=g;function b(t){let n=s(e+`CollectionConsumer`,t);return f.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${_}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return h(b,`useCollection`),[{Provider:c,Slot:m,ItemSlot:y},b,a]}h(g,`createCollection`);var _=new WeakMap,v=class e extends Map{static#e=h(this,`OrderedDict`);#t;constructor(e){super(e),this.#t=[...super.keys()],_.set(this,!0)}set(e,t){return _.get(this)&&(this.has(e)?this.#t[this.#t.indexOf(e)]=e:this.#t.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#t.length,a=x(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#t],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#t.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#t.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#t.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#t.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#t=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#t.splice(this.#t.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=y(this.#t,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=y(this.#t,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#t.indexOf(e)}keyAt(e){return y(this.#t,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function y(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=b(e,t);return n===-1?void 0:e[n]}h(y,`at`);function b(e,t){let n=e.length,r=x(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}h(b,`toSafeIndex`);function x(e){return e!==e||e===0?0:Math.trunc(e)}h(x,`toSafeInteger`);function S(e){let t=e+`CollectionProvider`,[n,a]=u(t),[o,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new v,setItemMap:h(()=>void 0,`setItemMap`)}),c=h(({state:e,...t})=>e?(0,p.jsx)(d,{...t,state:e}):(0,p.jsx)(l,{...t}),`CollectionProvider`);c.displayName=t;let l=h(e=>{let t=S();return(0,p.jsx)(d,{...e,state:t})},`CollectionInit`);l.displayName=t+`Init`;let d=h(e=>{let{scope:t,children:n,state:i}=e,a=f.useRef(null),[s,c]=f.useState(null),l=r(a,c),[u,d]=i;return f.useEffect(()=>{if(!s)return;let e=E(()=>{});return e.observe(s,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[s]),(0,p.jsx)(o,{scope:t,itemMap:u,setItemMap:d,collectionRef:l,collectionRefObject:a,collectionElement:s,children:n})},`CollectionProviderImpl`);d.displayName=t+`Impl`;let m=e+`CollectionSlot`,g=i(m),_=f.forwardRef((e,t)=>{let{scope:n,children:i}=e,a=s(m,n),o=r(t,a.collectionRef);return(0,p.jsx)(g,{ref:o,children:i})});_.displayName=m;let y=e+`CollectionItemSlot`,b=i(y),x=f.forwardRef((e,t)=>{let{scope:n,children:i,...a}=e,o=f.useRef(null),[c,l]=f.useState(null),u=r(t,o,l),{setItemMap:d}=s(y,n),m=f.useRef(a);C(m.current,a)||(m.current=a);let h=m.current;return f.useEffect(()=>{let e=h;return d(t=>c?t.has(c)?t.set(c,{...e,element:c}).toSorted(T):(t.set(c,{...e,element:c}),t.toSorted(T)):t),()=>{d(e=>!c||!e.has(c)?e:(e.delete(c),new v(e)))}},[c,h,d]),(0,p.jsx)(b,{"data-radix-collection-item":``,ref:u,children:i})});x.displayName=y;function S(){return f.useState(new v)}h(S,`useInitCollection`);function w(t){let{itemMap:n}=s(e+`CollectionConsumer`,t);return n}return h(w,`useCollection`),[{Provider:c,Slot:_,ItemSlot:x},{createCollectionScope:a,useCollection:w,useInitCollection:S}]}h(S,`createCollection`);function C(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}h(C,`shallowEqual`);function w(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}h(w,`isElementPreceding`);function T(e,t){return!e[1].element||!t[1].element?0:w(e[1].element,t[1].element)?-1:1}h(T,`sortByDocumentPosition`);function E(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}h(E,`getChildListObserver`);var D=Object.defineProperty,O=(e,t)=>D(e,`name`,{value:t,configurable:!0}),k=f.createContext(void 0);function A(e){let t=f.useContext(k);return e||t||`ltr`}O(A,`useDirection`);var j=Object.defineProperty,M=(e,t)=>j(e,`name`,{value:t,configurable:!0}),N=!1;function P(){let[e,t]=f.useState(N);return f.useEffect(()=>{N||(N=!0,t(!0))},[]),e}M(P,`useIsHydrated`);var F=f.useSyncExternalStore;function I(){return()=>{}}M(I,`subscribe`);function L(){return F(I,()=>!0,()=>!1)}M(L,`useIsHydratedModern`);var R=typeof F==`function`?L:P,z=Object.defineProperty,B=(e,t)=>z(e,`name`,{value:t,configurable:!0}),V=`rovingFocusGroup.onEntryFocus`,H={bubbles:!1,cancelable:!0},U=`RovingFocusGroup`,[W,G,K]=g(U),[q,J]=u(U,[K]),[Y,ee]=q(U),te=f.forwardRef(B(function(e,t){return(0,p.jsx)(W.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,p.jsx)(W.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,p.jsx)(ne,{...e,ref:t})})})},`RovingFocusGroup`)),ne=f.forwardRef(B(function(e,t){let{__scopeRovingFocusGroup:n,orientation:i,loop:a=!1,dir:c,currentTabStopId:u,defaultCurrentTabStopId:m,onCurrentTabStopIdChange:h,onEntryFocus:g,preventScrollOnEntryFocus:_=!1,...v}=e,y=f.useRef(null),b=r(t,y),x=A(c),[S,C]=s({prop:u,defaultProp:m??null,onChange:h,caller:U}),[w,T]=f.useState(!1),E=d(g),D=G(n),O=f.useRef(!1),[k,j]=f.useState(0);return f.useEffect(()=>{let e=y.current;if(e)return e.addEventListener(V,E),()=>e.removeEventListener(V,E)},[E]),(0,p.jsx)(Y,{scope:n,orientation:i,dir:x,loop:a,currentTabStopId:S,onItemFocus:f.useCallback(e=>C(e),[C]),onItemShiftTab:f.useCallback(()=>T(!0),[]),onFocusableItemAdd:f.useCallback(()=>j(e=>e+1),[]),onFocusableItemRemove:f.useCallback(()=>j(e=>e-1),[]),children:(0,p.jsx)(o.div,{tabIndex:w||k===0?-1:0,"data-orientation":i,...v,ref:b,style:{outline:`none`,...e.style},onMouseDown:l(e.onMouseDown,()=>{O.current=!0}),onFocus:l(e.onFocus,e=>{let t=!O.current;if(e.target===e.currentTarget&&t&&!w){let t=new CustomEvent(V,H);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=D().filter(e=>e.focusable);Q([e.find(e=>e.active),e.find(e=>e.id===S),...e].filter(Boolean).map(e=>e.ref.current),_)}}O.current=!1}),onBlur:l(e.onBlur,()=>T(!1))})})},`RovingFocusGroupImpl`)),re=`RovingFocusGroupItem`,ie=f.forwardRef(B(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:u,...d}=e,m=c(),h=s||m,g=ee(re,n),_=g.currentTabStopId===h,v=G(n),{onFocusableItemAdd:y,onFocusableItemRemove:b,currentTabStopId:x}=g,S=R();return a(()=>{if(!(!S||!r))return y(),()=>b()},[S,r,y,b]),f.useEffect(()=>{if(!(S||!r))return y(),()=>b()},[S,r,y,b]),(0,p.jsx)(W.ItemSlot,{scope:n,id:h,focusable:r,active:i,children:(0,p.jsx)(o.span,{tabIndex:_?0:-1,"data-orientation":g.orientation,...d,ref:t,onMouseDown:l(e.onMouseDown,e=>{r?g.onItemFocus(h):e.preventDefault()}),onFocus:l(e.onFocus,()=>g.onItemFocus(h)),onKeyDown:l(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){g.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Z(e,g.orientation,g.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=v().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=g.loop?$(n,r+1):n.slice(r+1)}setTimeout(()=>Q(n))}}),children:typeof u==`function`?u({isCurrentTabStop:_,hasTabStop:x!=null}):u})})},`RovingFocusGroupItem`)),ae={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function X(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}B(X,`getDirectionAwareKey`);function Z(e,t,n){let r=X(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return ae[r]}B(Z,`getFocusIntent`);function Q(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}B(Q,`focusFirst`);function $(e,t){return e.map((n,r)=>e[(t+r)%e.length])}B($,`wrapArray`);var oe=te,se=ie;export{g as a,A as i,oe as n,J as r,se as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{i as r,n as i}from"./dist-Cfh4kzCK.js";import{c as a,l as o,n as s,o as c,r as l,s as u,t as d}from"./dist-B_a0oV4U.js";import{a as f,i as p,n as m,r as h,t as g}from"./dist-DAs5KRGl.js";import{a as _,i as v,n as ee,r as te,s as ne,t as y}from"./es2015-0QT3KgdC.js";import{a as b,i as x,r as re,t as ie}from"./dist-alOyD2Bh.js";var S=e(t(),1),C=n(),ae=Object.defineProperty,w=(e,t)=>ae(e,`name`,{value:t,configurable:!0}),T=[`Enter`,` `],oe=[`ArrowDown`,`PageUp`,`Home`],E=[`ArrowUp`,`PageDown`,`End`],se=[...oe,...E],D={ltr:[...T,`ArrowRight`],rtl:[...T,`ArrowLeft`]},O={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},k=`Menu`,[A,ce,j]=f(k),[M,N]=u(k,[j,b,h]),P=b(),le=h(),[F,I]=M(k),[L,R]=M(k),z=w(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=P(t),[c,l]=S.useState(null),u=S.useRef(!1),f=d(a),m=p(i);return S.useEffect(()=>{let e=w(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=w(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),S.useEffect(()=>{if(!n)return;let e=w(()=>f(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,f]),(0,C.jsx)(x,{...s,children:(0,C.jsx)(F,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:l,children:(0,C.jsx)(L,{scope:t,onClose:S.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:m,modal:o,children:r})})})},`Menu`),B=S.forwardRef(w(function(e,t){let{__scopeMenu:n,...r}=e,i=P(n);return(0,C.jsx)(ie,{...i,...r,ref:t})},`MenuAnchor`)),V=`MenuPortal`,[H,ue]=M(V,{forceMount:void 0}),de=w(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=I(V,t);return(0,C.jsx)(H,{scope:t,forceMount:n,children:(0,C.jsx)(l,{present:n||a.open,children:(0,C.jsx)(v,{asChild:!0,container:i,children:r})})})},`MenuPortal`),U=`MenuContent`,[fe,W]=M(U),pe=S.forwardRef(w(function(e,t){let n=ue(U,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=I(U,e.__scopeMenu),o=R(U,e.__scopeMenu);return(0,C.jsx)(A.Provider,{scope:e.__scopeMenu,children:(0,C.jsx)(l,{present:r||a.open,children:(0,C.jsx)(A.Slot,{scope:e.__scopeMenu,children:o.modal?(0,C.jsx)(me,{...i,ref:t}):(0,C.jsx)(he,{...i,ref:t})})})})},`MenuContent`)),me=S.forwardRef(w(function(e,t){let n=I(U,e.__scopeMenu),i=S.useRef(null),a=r(t,i);return S.useEffect(()=>{let e=i.current;if(e)return y(e)},[]),(0,C.jsx)(G,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:c(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),he=S.forwardRef(w(function(e,t){let n=I(U,e.__scopeMenu);return(0,C.jsx)(G,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),ge=i(`MenuContent.ScrollLock`),G=S.forwardRef(w(function(e,t){let{__scopeMenu:n,loop:i=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:h,onDismiss:g,disableOutsideScroll:v,...y}=e,b=I(U,n),x=R(U,n),ie=P(n),ae=le(n),T=ce(n),[oe,D]=S.useState(null),O=S.useRef(null),k=r(t,O,b.onContentChange),A=S.useRef(0),j=S.useRef(``),M=S.useRef(0),N=S.useRef(null),F=S.useRef(`right`),L=S.useRef(0),z=v?ee:S.Fragment,B=v?{as:ge,allowPinchZoom:!0}:void 0,V=w(e=>{let t=j.current+e,n=T().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Me(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;w((function e(t){j.current=t,window.clearTimeout(A.current),t!==``&&(A.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);S.useEffect(()=>()=>window.clearTimeout(A.current),[]),te();let H=S.useCallback(e=>F.current===N.current?.side&&Pe(e,N.current?.area),[]);return(0,C.jsx)(fe,{scope:n,searchRef:j,onItemEnter:S.useCallback(e=>{H(e)&&e.preventDefault()},[H]),onItemLeave:S.useCallback(e=>{H(e)||(O.current?.focus(),D(null))},[H]),onTriggerLeave:S.useCallback(e=>{H(e)&&e.preventDefault()},[H]),pointerGraceTimerRef:M,onPointerGraceIntentChange:S.useCallback(e=>{N.current=e},[]),children:(0,C.jsx)(z,{...B,children:(0,C.jsx)(_,{asChild:!0,trapped:a,onMountAutoFocus:c(o,e=>{e.preventDefault(),O.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,C.jsx)(ne,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:h,onDismiss:g,children:(0,C.jsx)(m,{asChild:!0,...ae,dir:x.dir,orientation:`vertical`,loop:i,currentTabStopId:oe,onCurrentTabStopIdChange:D,onEntryFocus:c(u,e=>{x.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,C.jsx)(re,{role:`menu`,"aria-orientation":`vertical`,"data-state":Z(b.open),"data-radix-menu-content":``,dir:x.dir,...ie,...y,ref:k,style:{outline:`none`,...y.style},onKeyDown:c(y.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&V(e.key));let i=O.current;if(e.target!==i||!se.includes(e.key))return;e.preventDefault();let a=T().filter(e=>!e.disabled).map(e=>e.ref.current);E.includes(e.key)&&a.reverse(),Q(a)}),onBlur:c(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(A.current),j.current=``)}),onPointerMove:c(e.onPointerMove,$(e=>{let t=e.target,n=L.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>L.current?`right`:`left`;F.current=t,L.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),K=`MenuItem`,q=`menu.itemSelect`,_e=S.forwardRef(w(function(e,t){let{disabled:n=!1,onSelect:i,...a}=e,s=S.useRef(null),l=R(K,e.__scopeMenu),u=W(K,e.__scopeMenu),d=r(t,s),f=S.useRef(!1),p=w(()=>{let e=s.current;if(!n&&e){let t=new CustomEvent(q,{bubbles:!0,cancelable:!0});e.addEventListener(q,e=>i?.(e),{once:!0}),o(e,t),t.defaultPrevented?f.current=!1:l.onClose()}},`handleSelect`);return(0,C.jsx)(J,{...a,ref:d,disabled:n,onClick:c(e.onClick,p),onPointerDown:t=>{e.onPointerDown?.(t),f.current=!0},onPointerUp:c(e.onPointerUp,e=>{f.current||e.currentTarget?.click()}),onKeyDown:c(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(u.searchRef.current===``||e.key!==` `)&&T.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),J=S.forwardRef(w(function(e,t){let{__scopeMenu:n,disabled:i=!1,textValue:o,...s}=e,l=W(K,n),u=le(n),d=S.useRef(null),f=r(t,d),[p,m]=S.useState(!1),[h,_]=S.useState(``);return S.useEffect(()=>{let e=d.current;e&&_((e.textContent??``).trim())},[s.children]),(0,C.jsx)(A.ItemSlot,{scope:n,disabled:i,textValue:o??h,children:(0,C.jsx)(g,{asChild:!0,...u,focusable:!i,children:(0,C.jsx)(a.div,{role:`menuitem`,"data-highlighted":p?``:void 0,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,...s,ref:f,onPointerMove:c(e.onPointerMove,$(e=>{i?l.onItemLeave(e):(l.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:c(e.onPointerLeave,$(e=>l.onItemLeave(e))),onFocus:c(e.onFocus,()=>m(!0)),onBlur:c(e.onBlur,()=>m(!1))})})})},`MenuItemImpl`)),[ve,ye]=M(`MenuRadioGroup`,{value:void 0,onValueChange:w(()=>{},`onValueChange`)}),[be,xe]=M(`MenuItemIndicator`,{checked:!1}),Se=S.forwardRef(w(function(e,t){let{__scopeMenu:n,...r}=e;return(0,C.jsx)(a.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),Y=`MenuSub`,[Ce,we]=M(Y),Te=w(e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=I(Y,t),o=P(t),[c,l]=S.useState(null),[u,f]=S.useState(null),p=d(i);return S.useEffect(()=>(a.open===!1&&p(!1),()=>p(!1)),[a.open,p]),(0,C.jsx)(x,{...o,children:(0,C.jsx)(F,{scope:t,open:r,onOpenChange:p,content:u,onContentChange:f,children:(0,C.jsx)(Ce,{scope:t,contentId:s(),triggerId:s(),trigger:c,onTriggerChange:l,children:n})})})},`MenuSub`),X=`MenuSubTrigger`,Ee=S.forwardRef(w(function(e,t){let n=I(X,e.__scopeMenu),i=R(X,e.__scopeMenu),a=we(X,e.__scopeMenu),o=W(X,e.__scopeMenu),s=S.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:u}=o,d={__scopeMenu:e.__scopeMenu},f=S.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);S.useEffect(()=>f,[f]),S.useEffect(()=>{let e=l.current;return()=>{window.clearTimeout(e),u(null)}},[l,u]);let p=r(t,a.onTriggerChange);return(0,C.jsx)(B,{asChild:!0,...d,children:(0,C.jsx)(J,{id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?a.contentId:void 0,"data-state":Z(n.open),...e,ref:p,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:c(e.onPointerMove,$(t=>{o.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:c(e.onPointerLeave,$(e=>{f();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,a=i?-5:5,s=t[i?`left`:`right`],c=t[i?`right`:`left`];o.onPointerGraceIntentChange({area:[{x:e.clientX+a,y:e.clientY},{x:s,y:t.top},{x:c,y:t.top},{x:c,y:t.bottom},{x:s,y:t.bottom}],side:r}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:c(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||(o.searchRef.current===``||t.key!==` `)&&D[i.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})},`MenuSubTrigger`)),De=`MenuSubContent`,Oe=S.forwardRef(w(function(e,t){let n=ue(U,e.__scopeMenu),{forceMount:i=n.forceMount,align:a=`start`,...o}=e,s=I(U,e.__scopeMenu),u=R(U,e.__scopeMenu),d=we(De,e.__scopeMenu),f=S.useRef(null),p=r(t,f);return(0,C.jsx)(A.Provider,{scope:e.__scopeMenu,children:(0,C.jsx)(l,{present:i||s.open,children:(0,C.jsx)(A.Slot,{scope:e.__scopeMenu,children:(0,C.jsx)(G,{id:d.contentId,"aria-labelledby":d.triggerId,...o,ref:p,align:a,side:u.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{u.isUsingKeyboardRef.current&&f.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:c(e.onFocusOutside,e=>{e.target!==d.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:c(e.onEscapeKeyDown,e=>{u.onClose(),e.preventDefault()}),onKeyDown:c(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=O[u.dir].includes(e.key);t&&n&&(s.onOpenChange(!1),d.trigger?.focus(),e.preventDefault())})})})})})},`MenuSubContent`));function Z(e){return e?`open`:`closed`}w(Z,`getOpenState`);function ke(e){return e===`indeterminate`}w(ke,`isIndeterminate`);function Ae(e){return ke(e)?`indeterminate`:e?`checked`:`unchecked`}w(Ae,`getCheckedState`);function Q(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}w(Q,`focusFirst`);function je(e,t){return e.map((n,r)=>e[(t+r)%e.length])}w(je,`wrapArray`);function Me(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=je(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}w(Me,`getNextMatch`);function Ne(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}w(Ne,`isPointInPolygon`);function Pe(e,t){return t?Ne({x:e.clientX,y:e.clientY},t):!1}w(Pe,`isPointerInGraceArea`);function $(e){return t=>t.pointerType===`mouse`?e(t):void 0}w($,`whenMouse`);var Fe=z,Ie=B,Le=de,Re=pe,ze=_e,Be=Se,Ve=Te,He=Ee,Ue=Oe;export{Fe as a,Ue as c,Le as i,He as l,Re as n,Be as o,ze as r,Ve as s,Ie as t,N as u};
|