zen-gitsync 2.17.49 → 2.17.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/package.json +3 -2
- package/src/cli/ai/modelSetup.js +63 -2
- package/src/cli/ai/modelSetup.test.js +28 -2
- package/src/ui/public/assets/{AgentView-uHf-KMCH.css → AgentView-CAPlZLDq.css} +1 -1
- package/src/ui/public/assets/AgentView-D3EyOwN5.js +1 -0
- package/src/ui/public/assets/{AppVersionBadge-DyhIkbbF.js → AppVersionBadge-U0CyGRID.js} +2 -2
- package/src/ui/public/assets/{BranchSelector-CDQZlH-y.js → BranchSelector-CJQb9Z16.js} +1 -1
- package/src/ui/public/assets/{CommitForm-DpIXE8z1.js → CommitForm-D25Wj9NR.js} +1 -1
- package/src/ui/public/assets/{CommonDialog-NqZURH2F.js → CommonDialog-33jIvgti.js} +1 -1
- package/src/ui/public/assets/{AgentEngineSelector-D7DmG6PU.css → CopySessionButton-BLUHPwDR.css} +1 -1
- package/src/ui/public/assets/CopySessionButton-Bpe-A3h0.js +20 -0
- package/src/ui/public/assets/{EditorView-0T5LR5Hz.css → EditorView-B3bNe9Ic.css} +1 -1
- package/src/ui/public/assets/EditorView-Ce4rZawb.js +1 -0
- package/src/ui/public/assets/{FlowExecutionViewer-DxDKzmaP.js → FlowExecutionViewer-CAiAPsVH.js} +1 -1
- package/src/ui/public/assets/{FlowOrchestrationWorkspace-BHASB5iW.js → FlowOrchestrationWorkspace-CV84hp8i.js} +1 -1
- package/src/ui/public/assets/{LogList-CdtFyrLd.js → LogList-DMM6xsft.js} +1 -1
- package/src/ui/public/assets/{MindmapView-2tt7W7A3.js → MindmapView-FEdyCLvB.js} +1 -1
- package/src/ui/public/assets/{MonitorView--IW5ll8A.js → MonitorView-DSngr6xg.js} +1 -1
- package/src/ui/public/assets/{ProjectStartupButton-CWKSZVGw.js → ProjectStartupButton-DzodaStk.js} +1 -1
- package/src/ui/public/assets/{RecentDirectoriesChat-DINPN4ju.js → RecentDirectoriesChat-DvNSA3M_.js} +1 -1
- package/src/ui/public/assets/{RemoteManagerDialog-BVwpcCAu.js → RemoteManagerDialog-B8A7vQ0s.js} +1 -1
- package/src/ui/public/assets/{RemoteRepoCard-Dy3AF_XZ.js → RemoteRepoCard-ChdaJMso.js} +1 -1
- package/src/ui/public/assets/{SourceMapView-BnHeu5wE.js → SourceMapView-DxBk0ftU.js} +1 -1
- package/src/ui/public/assets/{SvgIcon-DcVasCdo.js → SvgIcon-IjDm7vQ-.js} +1 -1
- package/src/ui/public/assets/{UserInputNode-B313MadX.js → UserInputNode-DE8GEC3J.js} +1 -1
- package/src/ui/public/assets/WorkbenchView--CxNdUys.js +8 -0
- package/src/ui/public/assets/{WorkbenchView-rscs76HF.css → WorkbenchView-BaUAQnQR.css} +1 -1
- package/src/ui/public/assets/{_plugin-vue_export-helper-Bsx6Zj3t.js → _plugin-vue_export-helper-DcVJ6Vx3.js} +3 -3
- package/src/ui/public/assets/{agentConversations-BnG4a1oH.js → agentConversations-Dzt5oiO3.js} +5 -5
- package/src/ui/public/assets/{configStore-DQSKV2_Y.js → configStore-jJrldIrT.js} +1 -1
- package/src/ui/public/assets/{dagre-BmYeUlEa.js → dagre-Dkbv4_Ri.js} +3 -3
- package/src/ui/public/assets/{element-plus-DTtm3XCd.js → element-plus-BFy5M3jt.js} +1 -1
- package/src/ui/public/assets/{flow-mindmap-JxOspgwx.js → flow-mindmap-Qo4JDluG.js} +1 -1
- package/src/ui/public/assets/{index-BApctCNq.js → index-Do0MeO4E.js} +7 -7
- package/src/ui/public/assets/{monaco-D3R9OM26.js → monaco-Eb1VRwsF.js} +1 -1
- package/src/ui/public/assets/{office-docx-CO7mIaWO.js → office-docx-BeV9kLXP.js} +1 -1
- package/src/ui/public/assets/{office-excel-gA4KEkK4.js → office-excel-CILIK4LB.js} +1 -1
- package/src/ui/public/assets/{office-pptx-CQK4l_1Q.js → office-pptx-SxwVIVqF.js} +1 -1
- package/src/ui/public/assets/{vendor-O17eRefg.js → vendor-BXLxNxh-.js} +418 -416
- package/src/ui/public/assets/{vendor-U3ZXMgeO.css → vendor-aCkTc13z.css} +1 -1
- package/src/ui/public/assets/{vue-flow-BG6ZF1It.js → vue-flow--96Pa3sG.js} +1 -1
- package/src/ui/public/index.html +12 -12
- package/src/utils/aiEndpoint.js +48 -0
- package/src/utils/aiEndpoint.test.js +51 -1
- package/src/ui/public/assets/AgentEngineSelector-Bm_wrfGT.js +0 -1
- package/src/ui/public/assets/AgentView-BwqOHAs3.js +0 -1
- package/src/ui/public/assets/EditorView-BC6V8V5_.js +0 -1
- package/src/ui/public/assets/WorkbenchView-0cY9WHPM.js +0 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
.mindmap-preview[data-v-d2fe328b]{background:var(--bg-container,#fff);flex-direction:column;width:100%;height:100%;display:flex}.mindmap-preview-header[data-v-d2fe328b]{background:var(--bg-panel,var(--md-bg-subtle));font-size:var(--font-size-sm);align-items:center;gap:12px;padding:8px 14px;display:flex}.mindmap-preview-title[data-v-d2fe328b]{color:var(--text-primary,var(--md-text-strong));letter-spacing:.5px;font-weight:600}.mindmap-preview-hint[data-v-d2fe328b]{color:var(--text-secondary,var(--md-text-muted));font-size:var(--font-size-xs)}.mindmap-preview-canvas[data-v-d2fe328b]{flex:1;width:100%;min-height:0}.mindmap-preview-canvas[data-v-d2fe328b] .zm-mindmap,.mindmap-preview-canvas[data-v-d2fe328b]>*{width:100%;height:100%}.editor-agent-panel[data-v-469c856d]{background:var(--bg-panel);border-left:1px solid var(--border-color);flex-direction:column;flex-grow:1;flex-basis:0;min-width:200px;min-height:0;display:flex;overflow:hidden}.agent-panel-header[data-v-469c856d]{border-bottom:1px solid var(--border-color);flex-shrink:0;align-items:center;gap:8px;height:34px;padding:0 6px 0 12px;display:flex}.agent-panel-title[data-v-469c856d]{font-size:var(--font-size-xs);letter-spacing:.08em;text-transform:uppercase;color:var(--text-meta);white-space:nowrap;text-overflow:ellipsis;min-width:0;font-weight:700;overflow:hidden}.agent-panel-spacer[data-v-469c856d]{flex:1}.agent-panel-engine[data-v-469c856d]{flex:none}.agent-panel-icon-btn[data-v-469c856d]{border-radius:var(--radius-xs);width:24px;height:24px;color:var(--text-meta);cursor:pointer;transition:var(--transition-ui-fast);background:0 0;border:none;flex-shrink:0;justify-content:center;align-items:center;padding:0;display:flex}.agent-panel-icon-btn[data-v-469c856d]:hover{background:var(--bg-hover);color:var(--text-secondary)}.agent-panel-body[data-v-469c856d]{flex:1;grid-template:"stage"minmax(0,1fr)"composer"/minmax(0,1fr);min-height:0;display:grid}.agent-panel-body.is-wide[data-v-469c856d]{grid-template-columns:240px minmax(0,1fr);grid-template-areas:"list chat""list composer"}.agent-panel-convs[data-v-469c856d]{grid-area:stage;min-height:0;padding:8px 10px;overflow-y:auto}.agent-panel-chat[data-v-469c856d]{grid-area:stage;min-height:0;display:flex}.agent-panel-body.is-wide .agent-panel-convs[data-v-469c856d]{grid-area:list}.agent-panel-body.is-wide .agent-panel-chat[data-v-469c856d]{grid-area:chat}.agent-panel-composer[data-v-469c856d]{padding:var(--acu-space-3) var(--acu-space-4) var(--acu-space-4);background:linear-gradient(to top, var(--acu-bg) 70%, transparent);grid-area:composer}.agent-panel-composer[data-v-469c856d] .acu-input-queue{--acu-queue-edge:var(--role-pending-edge);--acu-queue-surface:var(--role-pending-surface);--acu-queue-ink:var(--role-pending-ink);--acu-queue-wash:var(--role-pending-wash)}.agent-panel-chat[data-v-469c856d]>.acu-chat{flex:1;min-width:0}.agent-panel-chat[data-v-469c856d] .acu-avatar--left{background:0 0}.agent-panel-composer[data-v-469c856d] .acu-input-wrap>.agent-context-slot{gap:var(--acu-space-2,8px);padding:var(--acu-space-2,8px) var(--acu-space-2,8px) 0;flex-wrap:wrap;display:flex}.agent-panel-composer[data-v-469c856d] .acu-input-attachments>.agent-context-slot{display:inline-flex}.agent-context-att[data-v-469c856d]{align-items:center;gap:var(--acu-space-2,8px);max-width:180px;padding:var(--acu-space-2,8px) var(--acu-space-3,12px);border:1px solid var(--acu-border);border-radius:var(--acu-radius-sm,8px);background:var(--acu-bg,var(--bg-container));color:var(--acu-text-secondary,var(--text-secondary));font-size:var(--acu-font-size-xs,12px);display:inline-flex;position:relative}.agent-context-att-icon[data-v-469c856d]{opacity:.75;flex-shrink:0}.agent-context-att-name[data-v-469c856d]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-context-att-remove[data-v-469c856d]{border-radius:var(--acu-radius-full,999px);background:var(--acu-text,var(--text-primary));width:18px;height:18px;color:var(--acu-bg,var(--bg-container));cursor:pointer;box-shadow:var(--acu-shadow-sm,0 1px 2px #0003);transition:transform var(--acu-duration-fast,.15s) var(--acu-easing,ease);border:none;justify-content:center;align-items:center;padding:0;display:inline-flex;position:absolute;top:-6px;right:-6px}.agent-context-att-remove[data-v-469c856d]:hover{transform:scale(1.12)}.agent-context-att-remove[data-v-469c856d]:active{transform:scale(1.02)}.editor-view[data-v-c65c2d3f]{background:var(--bg-container);width:100%;height:100%;box-shadow:var(--shadow-sm);border-radius:0;display:flex;overflow:hidden}.editor-sidebar[data-v-c65c2d3f]{background:var(--bg-panel);flex-direction:column;flex-shrink:0;display:flex;overflow:hidden}.sidebar-header[data-v-c65c2d3f]{flex-shrink:0;justify-content:space-between;align-items:center;padding:8px 10px 6px;display:flex}.sidebar-title[data-v-c65c2d3f]{font-size:var(--font-size-xs);letter-spacing:.08em;text-transform:uppercase;color:var(--text-secondary);-webkit-user-select:none;user-select:none;font-weight:700}.sidebar-action-btn[data-v-c65c2d3f]{cursor:pointer;color:var(--text-meta);border-radius:var(--radius-base);background:0 0;border:none;align-items:center;padding:3px;display:flex}.sidebar-action-btn[data-v-c65c2d3f]:hover{color:var(--text-primary);background:var(--bg-hover)}.sidebar-search[data-v-c65c2d3f]{flex-shrink:0;align-items:center;padding:6px 10px;display:flex;position:relative}.sidebar-search-icon[data-v-c65c2d3f]{color:var(--text-meta);pointer-events:none;position:absolute;left:18px}.sidebar-search-input[data-v-c65c2d3f]{min-width:0;height:26px;font-size:var(--font-size-sm);color:var(--text-primary);background:var(--bg-input,#ffffff0a);border:1px solid var(--border-color);border-radius:var(--radius-base);transition:border-color var(--transition-fast), background var(--transition-fast);outline:none;flex:1;padding:0 24px 0 26px}.sidebar-search-input[data-v-c65c2d3f]::placeholder{color:var(--text-meta)}.sidebar-search-input[data-v-c65c2d3f]:hover{border-color:var(--text-tertiary)}.sidebar-search-input[data-v-c65c2d3f]:focus{border-color:var(--color-primary);background:var(--bg-panel)}.sidebar-search-clear[data-v-c65c2d3f]{cursor:pointer;width:18px;height:18px;color:var(--text-meta);transition:background var(--transition-fast), color var(--transition-fast);background:0 0;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;display:flex;position:absolute;right:14px}.sidebar-search-clear[data-v-c65c2d3f]:hover{background:var(--bg-hover);color:var(--text-primary)}.tree-name-hit[data-v-c65c2d3f]{color:var(--color-warning-light);border-radius:var(--radius-xs);background:#f59e0b26;padding:0 1px}.sidebar-tree[data-v-c65c2d3f]{flex:1;padding:4px 0;overflow:hidden auto}.tree-node[data-v-c65c2d3f]{cursor:pointer;border-radius:var(--radius-base);-webkit-user-select:none;user-select:none;height:24px;color:var(--text-primary);font-size:var(--font-size-mid);transition:background var(--transition-fast);white-space:nowrap;align-items:center;gap:4px;padding-right:8px;display:flex;overflow:hidden}.tree-node[data-v-c65c2d3f]:hover{background:var(--bg-hover)}.tree-node--active[data-v-c65c2d3f]{background:var(--tint-primary-12);color:var(--color-primary)}.tree-node--selected[data-v-c65c2d3f]{outline-offset:-1px;background:#63b3ed26;outline:1px solid #63b3ed59}.tree-arrow[data-v-c65c2d3f]{color:var(--text-meta);transition:transform var(--transition-fast);flex-shrink:0;align-items:center;width:12px;display:flex}.tree-arrow.expanded[data-v-c65c2d3f]{transform:rotate(90deg)}.tree-arrow-spacer[data-v-c65c2d3f]{flex-shrink:0;width:12px}.tree-icon[data-v-c65c2d3f]{font-size:var(--font-size-base);flex-shrink:0;align-items:center;line-height:1;display:flex}.tree-icon.mit-icon[data-v-c65c2d3f]{fill:currentColor;vertical-align:middle;width:14px;height:14px;display:inline-block}.tree-icon--dir[data-v-c65c2d3f]{color:#e8b84b}.tree-name[data-v-c65c2d3f]{text-overflow:ellipsis;min-width:0;font-size:var(--font-size-mid);flex:1;overflow:hidden}.tree-loading[data-v-c65c2d3f]{border:1.5px solid var(--color-primary);border-top-color:#0000;border-radius:50%;flex-shrink:0;width:10px;height:10px;animation:.8s linear infinite spin-c65c2d3f;display:inline-block}.tree-empty[data-v-c65c2d3f]{font-size:var(--font-size-sm);color:var(--text-meta);text-align:center;padding:24px 12px}.sidebar-loading[data-v-c65c2d3f]{flex:1;justify-content:center;align-items:center;display:flex}.spin-icon[data-v-c65c2d3f]{border:2px solid var(--color-primary);border-top-color:#0000;border-radius:50%;width:20px;height:20px;animation:.8s linear infinite spin-c65c2d3f;display:inline-block}@keyframes spin-c65c2d3f{to{transform:rotate(360deg)}}.editor-resizer[data-v-c65c2d3f]{cursor:col-resize;width:6px;transition:background var(--transition-fast);z-index:2;background:0 0;flex-shrink:0;position:relative}.editor-resizer[data-v-c65c2d3f]:after{content:"";background:var(--color-gray-300);border-radius:var(--radius-xs);width:2px;height:32px;transition:background var(--transition-fast), height var(--transition-fast);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.editor-resizer[data-v-c65c2d3f]:hover{background:var(--tint-primary-06)}.editor-resizer[data-v-c65c2d3f]:hover:after{background:var(--color-primary);height:48px;box-shadow:0 0 8px #3b82f666}.editor-main[data-v-c65c2d3f]{flex-direction:column;flex:1;display:flex;overflow:hidden}.editor-tabs[data-v-c65c2d3f]{background:var(--bg-panel);scrollbar-width:none;flex-shrink:0;display:flex;overflow:auto hidden}.editor-tabs[data-v-c65c2d3f]::-webkit-scrollbar{display:none}.editor-tab[data-v-c65c2d3f]{cursor:pointer;height:34px;font-size:var(--font-size-mid);color:var(--text-secondary);transition:background var(--transition-fast), color var(--transition-fast);-webkit-user-select:none;user-select:none;flex-shrink:0;align-items:center;gap:6px;min-width:80px;max-width:200px;padding:0 12px;display:flex}.editor-tab[data-v-c65c2d3f]:hover{background:var(--bg-hover);color:var(--text-primary)}.editor-tab.active[data-v-c65c2d3f]{background:var(--bg-container);color:var(--text-primary);border-bottom:2px solid var(--color-primary)}.tab-name[data-v-c65c2d3f]{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}.tab-dirty-dot[data-v-c65c2d3f]{background:var(--color-warning);border-radius:50%;flex-shrink:0;width:6px;height:6px}.tab-close[data-v-c65c2d3f]{cursor:pointer;color:var(--text-meta);border-radius:var(--radius-base);opacity:0;transition:opacity var(--transition-fast), background var(--transition-fast);background:0 0;border:none;flex-shrink:0;align-items:center;padding:2px;display:flex}.editor-tab:hover .tab-close[data-v-c65c2d3f],.editor-tab.active .tab-close[data-v-c65c2d3f]{opacity:1}.tab-close[data-v-c65c2d3f]:hover{background:var(--bg-hover);color:var(--color-danger-dark)}.editor-empty[data-v-c65c2d3f]{flex:1}.monaco-container[data-v-c65c2d3f]{flex:1;min-width:0;overflow:hidden}.monaco-container.hidden[data-v-c65c2d3f]{display:none}.image-tab-placeholder[data-v-c65c2d3f]{justify-content:center;align-items:center;gap:var(--spacing-sm);color:var(--text-secondary);background:var(--bg-container);text-align:center;padding:var(--spacing-lg);flex-direction:column;flex:1;display:flex}.image-tab-placeholder-title[data-v-c65c2d3f]{font-size:var(--font-size-md);font-weight:var(--font-weight-medium);color:var(--text-primary);word-break:break-all;margin:0}.image-tab-placeholder-hint[data-v-c65c2d3f]{font-size:var(--font-size-sm);color:var(--text-meta);margin:0}.editor-body[data-v-c65c2d3f]{flex:1;min-height:0;display:flex;overflow:hidden}.preview-resizer[data-v-c65c2d3f]{cursor:col-resize;width:6px;transition:background var(--transition-fast);z-index:2;background:0 0;flex-shrink:0;order:99;margin-left:auto;position:relative}.preview-resizer[data-v-c65c2d3f]:after{content:"";background:var(--color-gray-300);border-radius:var(--radius-xs);width:2px;height:32px;transition:background var(--transition-fast), height var(--transition-fast);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.preview-resizer[data-v-c65c2d3f]:hover{background:var(--tint-primary-06)}.preview-resizer[data-v-c65c2d3f]:hover:after{background:var(--color-primary);height:48px;box-shadow:0 0 8px #3b82f666}.preview-panel[data-v-c65c2d3f]{background:var(--bg-panel);flex-direction:column;flex:1 1 0;min-width:200px;display:flex;overflow:hidden}.preview-header[data-v-c65c2d3f]{background:var(--bg-panel);flex-shrink:0;align-items:center;gap:6px;height:34px;padding:0 10px;display:flex}.preview-title[data-v-c65c2d3f]{font-size:var(--font-size-xs);letter-spacing:.08em;text-transform:uppercase;color:var(--text-secondary);-webkit-user-select:none;user-select:none;font-weight:700}.preview-ext-badge[data-v-c65c2d3f]{font-size:var(--font-size-xs);border-radius:var(--radius-base);background:var(--tint-primary-16);color:var(--color-primary);letter-spacing:.04em;padding:1px 5px;font-weight:600}.preview-header-spacer[data-v-c65c2d3f]{flex:1}.preview-close-btn[data-v-c65c2d3f]{cursor:pointer;color:var(--text-meta);border-radius:var(--radius-base);transition:color var(--transition-fast), background var(--transition-fast);background:0 0;border:none;align-items:center;padding:3px;display:flex}.preview-close-btn[data-v-c65c2d3f]:hover{color:var(--color-danger-dark);background:var(--bg-hover)}.preview-body[data-v-c65c2d3f]{flex-direction:column;flex:1;display:flex;overflow:hidden}.preview-iframe[data-v-c65c2d3f]{background:0 0;border:none;flex:1;width:100%;height:100%}.preview-markdown[data-v-c65c2d3f]{flex:1;width:100%;height:100%;overflow:auto}.preview-mindmap[data-v-c65c2d3f]{background:var(--bg-container,#fff);flex-direction:column;flex:1;width:100%;height:100%;display:flex;overflow:hidden}.mindmap-toggle-btn.disabled[data-v-c65c2d3f]{opacity:.45;cursor:not-allowed}.mindmap-toggle-btn.active[data-v-c65c2d3f]{color:#fff;background:linear-gradient(#6366f1 0%,#4f46e5 100%);border-color:#4f46e5}.preview-image-wrap[data-v-c65c2d3f]{background:var(--bg-container);flex:1;justify-content:center;align-items:center;padding:16px;display:flex;overflow:auto}.preview-image-wrap img[data-v-c65c2d3f]{object-fit:contain;border-radius:var(--radius-base);max-width:100%;max-height:100%;box-shadow:0 2px 12px #0003}.editor-tabs-spacer[data-v-c65c2d3f]{flex:1}.preview-toggle-btn[data-v-c65c2d3f]{cursor:pointer;height:34px;color:var(--text-secondary);font-size:var(--font-size-sm);white-space:nowrap;transition:background var(--transition-fast), color var(--transition-fast);background:0 0;border:none;flex-shrink:0;align-items:center;gap:5px;padding:0 10px;display:flex}.preview-toggle-btn[data-v-c65c2d3f]:hover{background:var(--bg-hover);color:var(--text-primary)}.preview-toggle-btn.active[data-v-c65c2d3f]{color:var(--color-primary);background:var(--tint-primary-08)}.sidebar-actions[data-v-c65c2d3f]{align-items:center;gap:2px;display:flex}.tree-inline-input-row[data-v-c65c2d3f]{cursor:default;background:var(--bg-hover)}.tree-inline-input[data-v-c65c2d3f]{min-width:0;height:20px;font-size:var(--font-size-mid);background:var(--bg-container);border:1px solid var(--color-primary);border-radius:var(--radius-base);color:var(--text-primary);outline:none;flex:1;padding:0 5px;font-family:inherit}.ctx-menu[data-v-c65c2d3f]{z-index:var(--z-menu-float);background:var(--bg-container);border:1px solid var(--border-color);border-radius:var(--radius-md);-webkit-user-select:none;user-select:none;min-width:160px;padding:4px;position:fixed;box-shadow:0 8px 24px #00000059}.ctx-menu-icon[data-v-c65c2d3f]{flex-shrink:0;width:13px;height:13px}.ctx-menu-item[data-v-c65c2d3f]{border-radius:var(--radius-base);cursor:pointer;width:100%;font-size:var(--font-size-mid);color:var(--text-primary);text-align:left;transition:background var(--transition-fast);background:0 0;border:none;align-items:center;gap:8px;padding:6px 10px;display:flex}.ctx-menu-item[data-v-c65c2d3f]:hover{background:var(--bg-hover)}.ctx-menu-item--danger[data-v-c65c2d3f]{color:var(--color-danger-dark)}.ctx-menu-item--danger[data-v-c65c2d3f]:hover{background:#ef44441a}.ctx-menu-sep[data-v-c65c2d3f]{background:var(--border-color);height:1px;margin:4px 2px}
|
|
1
|
+
.mindmap-preview[data-v-d2fe328b]{background:var(--bg-container,#fff);flex-direction:column;width:100%;height:100%;display:flex}.mindmap-preview-header[data-v-d2fe328b]{background:var(--bg-panel,var(--md-bg-subtle));font-size:var(--font-size-sm);align-items:center;gap:12px;padding:8px 14px;display:flex}.mindmap-preview-title[data-v-d2fe328b]{color:var(--text-primary,var(--md-text-strong));letter-spacing:.5px;font-weight:600}.mindmap-preview-hint[data-v-d2fe328b]{color:var(--text-secondary,var(--md-text-muted));font-size:var(--font-size-xs)}.mindmap-preview-canvas[data-v-d2fe328b]{flex:1;width:100%;min-height:0}.mindmap-preview-canvas[data-v-d2fe328b] .zm-mindmap,.mindmap-preview-canvas[data-v-d2fe328b]>*{width:100%;height:100%}.editor-agent-panel[data-v-c445cba6]{background:var(--bg-panel);border-left:1px solid var(--border-color);flex-direction:column;flex-grow:1;flex-basis:0;min-width:200px;min-height:0;display:flex;overflow:hidden}.agent-panel-header[data-v-c445cba6]{border-bottom:1px solid var(--border-color);flex-shrink:0;align-items:center;gap:8px;height:34px;padding:0 6px 0 12px;display:flex}.agent-panel-title[data-v-c445cba6]{font-size:var(--font-size-xs);letter-spacing:.08em;text-transform:uppercase;color:var(--text-meta);white-space:nowrap;text-overflow:ellipsis;min-width:0;font-weight:700;overflow:hidden}.agent-panel-spacer[data-v-c445cba6]{flex:1}.agent-panel-engine[data-v-c445cba6]{flex:none}.agent-panel-icon-btn[data-v-c445cba6]{border-radius:var(--radius-xs);width:24px;height:24px;color:var(--text-meta);cursor:pointer;transition:var(--transition-ui-fast);background:0 0;border:none;flex-shrink:0;justify-content:center;align-items:center;padding:0;display:flex}.agent-panel-icon-btn[data-v-c445cba6]:hover{background:var(--bg-hover);color:var(--text-secondary)}.agent-panel-body[data-v-c445cba6]{flex:1;grid-template:"stage"minmax(0,1fr)"composer"/minmax(0,1fr);min-height:0;display:grid}.agent-panel-body.is-wide[data-v-c445cba6]{grid-template-columns:240px minmax(0,1fr);grid-template-areas:"list chat""list composer"}.agent-panel-convs[data-v-c445cba6]{grid-area:stage;min-height:0;padding:8px 10px;overflow-y:auto}.agent-panel-chat[data-v-c445cba6]{grid-area:stage;min-height:0;display:flex}.agent-panel-body.is-wide .agent-panel-convs[data-v-c445cba6]{grid-area:list}.agent-panel-body.is-wide .agent-panel-chat[data-v-c445cba6]{grid-area:chat}.agent-panel-composer[data-v-c445cba6]{padding:var(--acu-space-3) var(--acu-space-4) var(--acu-space-4);background:linear-gradient(to top, var(--acu-bg) 70%, transparent);grid-area:composer}.agent-panel-composer[data-v-c445cba6] .acu-input-queue{--acu-queue-edge:var(--role-pending-edge);--acu-queue-surface:var(--role-pending-surface);--acu-queue-ink:var(--role-pending-ink);--acu-queue-wash:var(--role-pending-wash)}.agent-panel-chat[data-v-c445cba6]>.acu-chat{flex:1;min-width:0}.agent-panel-chat[data-v-c445cba6] .acu-avatar--left{background:0 0}.agent-panel-composer[data-v-c445cba6] .acu-input-wrap>.agent-context-slot{gap:var(--acu-space-2,8px);padding:var(--acu-space-2,8px) var(--acu-space-2,8px) 0;flex-wrap:wrap;display:flex}.agent-panel-composer[data-v-c445cba6] .acu-input-attachments>.agent-context-slot{display:inline-flex}.agent-context-att[data-v-c445cba6]{align-items:center;gap:var(--acu-space-2,8px);max-width:180px;padding:var(--acu-space-2,8px) var(--acu-space-3,12px);border:1px solid var(--acu-border);border-radius:var(--acu-radius-sm,8px);background:var(--acu-bg,var(--bg-container));color:var(--acu-text-secondary,var(--text-secondary));font-size:var(--acu-font-size-xs,12px);display:inline-flex;position:relative}.agent-context-att-icon[data-v-c445cba6]{opacity:.75;flex-shrink:0}.agent-context-att-name[data-v-c445cba6]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-context-att-remove[data-v-c445cba6]{border-radius:var(--acu-radius-full,999px);background:var(--acu-text,var(--text-primary));width:18px;height:18px;color:var(--acu-bg,var(--bg-container));cursor:pointer;box-shadow:var(--acu-shadow-sm,0 1px 2px #0003);transition:transform var(--acu-duration-fast,.15s) var(--acu-easing,ease);border:none;justify-content:center;align-items:center;padding:0;display:inline-flex;position:absolute;top:-6px;right:-6px}.agent-context-att-remove[data-v-c445cba6]:hover{transform:scale(1.12)}.agent-context-att-remove[data-v-c445cba6]:active{transform:scale(1.02)}.editor-view[data-v-c65c2d3f]{background:var(--bg-container);width:100%;height:100%;box-shadow:var(--shadow-sm);border-radius:0;display:flex;overflow:hidden}.editor-sidebar[data-v-c65c2d3f]{background:var(--bg-panel);flex-direction:column;flex-shrink:0;display:flex;overflow:hidden}.sidebar-header[data-v-c65c2d3f]{flex-shrink:0;justify-content:space-between;align-items:center;padding:8px 10px 6px;display:flex}.sidebar-title[data-v-c65c2d3f]{font-size:var(--font-size-xs);letter-spacing:.08em;text-transform:uppercase;color:var(--text-secondary);-webkit-user-select:none;user-select:none;font-weight:700}.sidebar-action-btn[data-v-c65c2d3f]{cursor:pointer;color:var(--text-meta);border-radius:var(--radius-base);background:0 0;border:none;align-items:center;padding:3px;display:flex}.sidebar-action-btn[data-v-c65c2d3f]:hover{color:var(--text-primary);background:var(--bg-hover)}.sidebar-search[data-v-c65c2d3f]{flex-shrink:0;align-items:center;padding:6px 10px;display:flex;position:relative}.sidebar-search-icon[data-v-c65c2d3f]{color:var(--text-meta);pointer-events:none;position:absolute;left:18px}.sidebar-search-input[data-v-c65c2d3f]{min-width:0;height:26px;font-size:var(--font-size-sm);color:var(--text-primary);background:var(--bg-input,#ffffff0a);border:1px solid var(--border-color);border-radius:var(--radius-base);transition:border-color var(--transition-fast), background var(--transition-fast);outline:none;flex:1;padding:0 24px 0 26px}.sidebar-search-input[data-v-c65c2d3f]::placeholder{color:var(--text-meta)}.sidebar-search-input[data-v-c65c2d3f]:hover{border-color:var(--text-tertiary)}.sidebar-search-input[data-v-c65c2d3f]:focus{border-color:var(--color-primary);background:var(--bg-panel)}.sidebar-search-clear[data-v-c65c2d3f]{cursor:pointer;width:18px;height:18px;color:var(--text-meta);transition:background var(--transition-fast), color var(--transition-fast);background:0 0;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;display:flex;position:absolute;right:14px}.sidebar-search-clear[data-v-c65c2d3f]:hover{background:var(--bg-hover);color:var(--text-primary)}.tree-name-hit[data-v-c65c2d3f]{color:var(--color-warning-light);border-radius:var(--radius-xs);background:#f59e0b26;padding:0 1px}.sidebar-tree[data-v-c65c2d3f]{flex:1;padding:4px 0;overflow:hidden auto}.tree-node[data-v-c65c2d3f]{cursor:pointer;border-radius:var(--radius-base);-webkit-user-select:none;user-select:none;height:24px;color:var(--text-primary);font-size:var(--font-size-mid);transition:background var(--transition-fast);white-space:nowrap;align-items:center;gap:4px;padding-right:8px;display:flex;overflow:hidden}.tree-node[data-v-c65c2d3f]:hover{background:var(--bg-hover)}.tree-node--active[data-v-c65c2d3f]{background:var(--tint-primary-12);color:var(--color-primary)}.tree-node--selected[data-v-c65c2d3f]{outline-offset:-1px;background:#63b3ed26;outline:1px solid #63b3ed59}.tree-arrow[data-v-c65c2d3f]{color:var(--text-meta);transition:transform var(--transition-fast);flex-shrink:0;align-items:center;width:12px;display:flex}.tree-arrow.expanded[data-v-c65c2d3f]{transform:rotate(90deg)}.tree-arrow-spacer[data-v-c65c2d3f]{flex-shrink:0;width:12px}.tree-icon[data-v-c65c2d3f]{font-size:var(--font-size-base);flex-shrink:0;align-items:center;line-height:1;display:flex}.tree-icon.mit-icon[data-v-c65c2d3f]{fill:currentColor;vertical-align:middle;width:14px;height:14px;display:inline-block}.tree-icon--dir[data-v-c65c2d3f]{color:#e8b84b}.tree-name[data-v-c65c2d3f]{text-overflow:ellipsis;min-width:0;font-size:var(--font-size-mid);flex:1;overflow:hidden}.tree-loading[data-v-c65c2d3f]{border:1.5px solid var(--color-primary);border-top-color:#0000;border-radius:50%;flex-shrink:0;width:10px;height:10px;animation:.8s linear infinite spin-c65c2d3f;display:inline-block}.tree-empty[data-v-c65c2d3f]{font-size:var(--font-size-sm);color:var(--text-meta);text-align:center;padding:24px 12px}.sidebar-loading[data-v-c65c2d3f]{flex:1;justify-content:center;align-items:center;display:flex}.spin-icon[data-v-c65c2d3f]{border:2px solid var(--color-primary);border-top-color:#0000;border-radius:50%;width:20px;height:20px;animation:.8s linear infinite spin-c65c2d3f;display:inline-block}@keyframes spin-c65c2d3f{to{transform:rotate(360deg)}}.editor-resizer[data-v-c65c2d3f]{cursor:col-resize;width:6px;transition:background var(--transition-fast);z-index:2;background:0 0;flex-shrink:0;position:relative}.editor-resizer[data-v-c65c2d3f]:after{content:"";background:var(--color-gray-300);border-radius:var(--radius-xs);width:2px;height:32px;transition:background var(--transition-fast), height var(--transition-fast);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.editor-resizer[data-v-c65c2d3f]:hover{background:var(--tint-primary-06)}.editor-resizer[data-v-c65c2d3f]:hover:after{background:var(--color-primary);height:48px;box-shadow:0 0 8px #3b82f666}.editor-main[data-v-c65c2d3f]{flex-direction:column;flex:1;display:flex;overflow:hidden}.editor-tabs[data-v-c65c2d3f]{background:var(--bg-panel);scrollbar-width:none;flex-shrink:0;display:flex;overflow:auto hidden}.editor-tabs[data-v-c65c2d3f]::-webkit-scrollbar{display:none}.editor-tab[data-v-c65c2d3f]{cursor:pointer;height:34px;font-size:var(--font-size-mid);color:var(--text-secondary);transition:background var(--transition-fast), color var(--transition-fast);-webkit-user-select:none;user-select:none;flex-shrink:0;align-items:center;gap:6px;min-width:80px;max-width:200px;padding:0 12px;display:flex}.editor-tab[data-v-c65c2d3f]:hover{background:var(--bg-hover);color:var(--text-primary)}.editor-tab.active[data-v-c65c2d3f]{background:var(--bg-container);color:var(--text-primary);border-bottom:2px solid var(--color-primary)}.tab-name[data-v-c65c2d3f]{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}.tab-dirty-dot[data-v-c65c2d3f]{background:var(--color-warning);border-radius:50%;flex-shrink:0;width:6px;height:6px}.tab-close[data-v-c65c2d3f]{cursor:pointer;color:var(--text-meta);border-radius:var(--radius-base);opacity:0;transition:opacity var(--transition-fast), background var(--transition-fast);background:0 0;border:none;flex-shrink:0;align-items:center;padding:2px;display:flex}.editor-tab:hover .tab-close[data-v-c65c2d3f],.editor-tab.active .tab-close[data-v-c65c2d3f]{opacity:1}.tab-close[data-v-c65c2d3f]:hover{background:var(--bg-hover);color:var(--color-danger-dark)}.editor-empty[data-v-c65c2d3f]{flex:1}.monaco-container[data-v-c65c2d3f]{flex:1;min-width:0;overflow:hidden}.monaco-container.hidden[data-v-c65c2d3f]{display:none}.image-tab-placeholder[data-v-c65c2d3f]{justify-content:center;align-items:center;gap:var(--spacing-sm);color:var(--text-secondary);background:var(--bg-container);text-align:center;padding:var(--spacing-lg);flex-direction:column;flex:1;display:flex}.image-tab-placeholder-title[data-v-c65c2d3f]{font-size:var(--font-size-md);font-weight:var(--font-weight-medium);color:var(--text-primary);word-break:break-all;margin:0}.image-tab-placeholder-hint[data-v-c65c2d3f]{font-size:var(--font-size-sm);color:var(--text-meta);margin:0}.editor-body[data-v-c65c2d3f]{flex:1;min-height:0;display:flex;overflow:hidden}.preview-resizer[data-v-c65c2d3f]{cursor:col-resize;width:6px;transition:background var(--transition-fast);z-index:2;background:0 0;flex-shrink:0;order:99;margin-left:auto;position:relative}.preview-resizer[data-v-c65c2d3f]:after{content:"";background:var(--color-gray-300);border-radius:var(--radius-xs);width:2px;height:32px;transition:background var(--transition-fast), height var(--transition-fast);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.preview-resizer[data-v-c65c2d3f]:hover{background:var(--tint-primary-06)}.preview-resizer[data-v-c65c2d3f]:hover:after{background:var(--color-primary);height:48px;box-shadow:0 0 8px #3b82f666}.preview-panel[data-v-c65c2d3f]{background:var(--bg-panel);flex-direction:column;flex:1 1 0;min-width:200px;display:flex;overflow:hidden}.preview-header[data-v-c65c2d3f]{background:var(--bg-panel);flex-shrink:0;align-items:center;gap:6px;height:34px;padding:0 10px;display:flex}.preview-title[data-v-c65c2d3f]{font-size:var(--font-size-xs);letter-spacing:.08em;text-transform:uppercase;color:var(--text-secondary);-webkit-user-select:none;user-select:none;font-weight:700}.preview-ext-badge[data-v-c65c2d3f]{font-size:var(--font-size-xs);border-radius:var(--radius-base);background:var(--tint-primary-16);color:var(--color-primary);letter-spacing:.04em;padding:1px 5px;font-weight:600}.preview-header-spacer[data-v-c65c2d3f]{flex:1}.preview-close-btn[data-v-c65c2d3f]{cursor:pointer;color:var(--text-meta);border-radius:var(--radius-base);transition:color var(--transition-fast), background var(--transition-fast);background:0 0;border:none;align-items:center;padding:3px;display:flex}.preview-close-btn[data-v-c65c2d3f]:hover{color:var(--color-danger-dark);background:var(--bg-hover)}.preview-body[data-v-c65c2d3f]{flex-direction:column;flex:1;display:flex;overflow:hidden}.preview-iframe[data-v-c65c2d3f]{background:0 0;border:none;flex:1;width:100%;height:100%}.preview-markdown[data-v-c65c2d3f]{flex:1;width:100%;height:100%;overflow:auto}.preview-mindmap[data-v-c65c2d3f]{background:var(--bg-container,#fff);flex-direction:column;flex:1;width:100%;height:100%;display:flex;overflow:hidden}.mindmap-toggle-btn.disabled[data-v-c65c2d3f]{opacity:.45;cursor:not-allowed}.mindmap-toggle-btn.active[data-v-c65c2d3f]{color:#fff;background:linear-gradient(#6366f1 0%,#4f46e5 100%);border-color:#4f46e5}.preview-image-wrap[data-v-c65c2d3f]{background:var(--bg-container);flex:1;justify-content:center;align-items:center;padding:16px;display:flex;overflow:auto}.preview-image-wrap img[data-v-c65c2d3f]{object-fit:contain;border-radius:var(--radius-base);max-width:100%;max-height:100%;box-shadow:0 2px 12px #0003}.editor-tabs-spacer[data-v-c65c2d3f]{flex:1}.preview-toggle-btn[data-v-c65c2d3f]{cursor:pointer;height:34px;color:var(--text-secondary);font-size:var(--font-size-sm);white-space:nowrap;transition:background var(--transition-fast), color var(--transition-fast);background:0 0;border:none;flex-shrink:0;align-items:center;gap:5px;padding:0 10px;display:flex}.preview-toggle-btn[data-v-c65c2d3f]:hover{background:var(--bg-hover);color:var(--text-primary)}.preview-toggle-btn.active[data-v-c65c2d3f]{color:var(--color-primary);background:var(--tint-primary-08)}.sidebar-actions[data-v-c65c2d3f]{align-items:center;gap:2px;display:flex}.tree-inline-input-row[data-v-c65c2d3f]{cursor:default;background:var(--bg-hover)}.tree-inline-input[data-v-c65c2d3f]{min-width:0;height:20px;font-size:var(--font-size-mid);background:var(--bg-container);border:1px solid var(--color-primary);border-radius:var(--radius-base);color:var(--text-primary);outline:none;flex:1;padding:0 5px;font-family:inherit}.ctx-menu[data-v-c65c2d3f]{z-index:var(--z-menu-float);background:var(--bg-container);border:1px solid var(--border-color);border-radius:var(--radius-md);-webkit-user-select:none;user-select:none;min-width:160px;padding:4px;position:fixed;box-shadow:0 8px 24px #00000059}.ctx-menu-icon[data-v-c65c2d3f]{flex-shrink:0;width:13px;height:13px}.ctx-menu-item[data-v-c65c2d3f]{border-radius:var(--radius-base);cursor:pointer;width:100%;font-size:var(--font-size-mid);color:var(--text-primary);text-align:left;transition:background var(--transition-fast);background:0 0;border:none;align-items:center;gap:8px;padding:6px 10px;display:flex}.ctx-menu-item[data-v-c65c2d3f]:hover{background:var(--bg-hover)}.ctx-menu-item--danger[data-v-c65c2d3f]{color:var(--color-danger-dark)}.ctx-menu-item--danger[data-v-c65c2d3f]:hover{background:#ef44441a}.ctx-menu-sep[data-v-c65c2d3f]{background:var(--border-color);height:1px;margin:4px 2px}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Cn as t,Dn as n,En as r,Gn as i,Gr as a,Hn as o,Mn as s,Mr as c,Pn as l,Rn as u,Tn as d,W as ee,Xr as f,Yn as p,Zn as te,_n as ne,dr as m,gn as re,hn as ie,i as h,ir as g,jn as _,ln as v,or as ae,qn as oe,qr as y,r as se,sr as b,vn as x,vr as S,wn as C,wr as w,xn as ce,yn as T,yr as le}from"./element-plus-BFy5M3jt.js";import{i as ue,n as E,o as de}from"./vendor-BXLxNxh-.js";import{n as D,t as O}from"./_plugin-vue_export-helper-DcVJ6Vx3.js";import{t as fe}from"./SvgIcon-IjDm7vQ-.js";import{t as pe}from"./configStore-jJrldIrT.js";import{a as me,c as he,i as ge,n as _e,o as ve,r as ye,s as be}from"./monaco-Eb1VRwsF.js";import{n as xe,r as Se}from"./flow-mindmap-Qo4JDluG.js";import{A as Ce,F as we,I as Te,M as Ee,N as De,O as Oe,P as k,d as ke,i as Ae,j as je,k as Me}from"./index-Do0MeO4E.js";import{a as Ne,c as Pe,f as Fe,i as Ie,l as Le,n as Re,o as ze,r as Be,s as A,t as j}from"./agentConversations-Dzt5oiO3.js";import{c as Ve,s as He,t as Ue}from"./CopySessionButton-Bpe-A3h0.js";function We(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,vue:`html`,html:`html`,htm:`html`,css:`css`,scss:`scss`,less:`less`,json:`json`,jsonc:`json`,md:`markdown`,markdown:`markdown`,yaml:`yaml`,yml:`yaml`,toml:`ini`,xml:`xml`,svg:`xml`,sh:`shell`,bash:`shell`,zsh:`shell`,fish:`shell`,ps1:`powershell`,py:`python`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,rb:`ruby`,php:`php`,c:`c`,cpp:`cpp`,h:`cpp`,cs:`csharp`,sql:`sql`,graphql:`graphql`,gql:`graphql`,txt:`plaintext`,log:`plaintext`,ini:`ini`,env:`ini`,gitignore:`ini`,dockerfile:`dockerfile`}[e.toLowerCase()]??`plaintext`}u(),m();var Ge={class:`mindmap-preview`},Ke={class:`mindmap-preview-canvas`},qe=O(l({__name:`MindmapPreview`,props:{content:{}},setup(e){let r=e,i=t(()=>Se(r.content||``,`未命名文档`));return(e,t)=>(p(),n(`div`,Ge,[t[0]||=C(`div`,{class:`mindmap-preview-header`},[C(`span`,{class:`mindmap-preview-title`},`整篇导图`),C(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),C(`div`,Ke,[s(w(xe),{data:i.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-d2fe328b`]]);u(),m(),c(),v();var Je={class:`agent-panel-header`},Ye=[`title`,`aria-label`],Xe={class:`agent-panel-title`},Ze={key:1,class:`agent-panel-title`},M=[`title`,`aria-label`],N=[`title`],P={class:`agent-panel-convs`},Qe=[`data-theme`],$e=[`title`],et={class:`agent-context-att-name`},tt=[`title`,`aria-label`],nt=O(l({__name:`EditorAgentPanel`,props:{activeFilePath:{},activeFileName:{},active:{type:Boolean}},emits:[`close`],setup(c,{emit:l}){let u=c,ee=l,{theme:te}=De(),ne=t(()=>te.value===`dark`?`dark`:`light`),{sessions:m,sessionsLoading:ie,currentSessionId:h,messages:_,isStreaming:v,pendingQuestion:ae,answeringQuestion:y,isSessionGenerating:se,currentEngine:x,pendingEngine:le,isEngineLocked:O,pickEngine:fe,loadSessions:pe,loadSession:me,deleteSession:he,renameSession:ge,newSession:_e,sendMessage:ve,answerQuestion:ye,stop:be,inputContextUsage:xe,queuedMessages:Se,queuePaused:Ce,removeQueuedMessage:we,flushQueued:Te}=Le(),Ee=t(()=>O.value?x.value:le.value);function Oe(e){O.value||fe(e)}let k=t(()=>A(m.value,se)),ke=Ie(),Ae=Ne(),je=ze(),Me=t(()=>k.value.find(e=>e.id===h.value)?.title||``),We=S(null),Ge=S(null),Ke=S(null),qe=S(null),nt=S(null),{width:rt,narrow:F}=Ve(nt),I=S(`chat`),L=S(null),it=S(!1),R=null,at=t(()=>!!u.activeFileName&&!it.value);function ot(e){return Array.from(e.children).find(e=>e.classList?.contains(`acu-input-attachments`))??null}function st(){let e=Ge.value?.$el;if(!e)return;let t=e.querySelector(`.agent-context-slot`);if(!at.value){if(!t)return;L.value=null,o(()=>t.remove());return}let n=L.value&&e.contains(L.value)?L.value:t;n||(n=document.createElement(`div`),n.className=`agent-context-slot`);let r=ot(e),i=r??e;n.parentElement!==i&&i.insertBefore(n,r?r.firstChild:e.firstChild),L.value=n}function ct(e=!0){We.value?.scrollToBottom(e)}async function lt(e){let t=it.value?void 0:u.activeFilePath||void 0;await ve(e.text,e.files,{openFilePath:t}),await o(),ct()}function ut(e){me(e),I.value=`chat`}function dt(){_e(),I.value=`chat`}g(()=>_.value.length,()=>{o(()=>ct(!1))});function ft(){let e=qe.value;!e||typeof MutationObserver>`u`||(R?.disconnect(),R=new MutationObserver(()=>st()),R.observe(e,{childList:!0,subtree:!0}))}return g(()=>u.active,e=>{e&&(I.value=`chat`,pe().catch(()=>{}),o(()=>{st(),ct(!1)}))}),g(F,e=>{e||(I.value=`chat`)}),g(()=>u.activeFilePath,()=>{it.value=!1}),g(at,e=>{e&&o(st)}),oe(()=>{pe().catch(()=>{}),o(()=>{st(),ft()})}),i(()=>{R?.disconnect(),R=null,L.value=null}),(t,i)=>(p(),n(`div`,{ref_key:`rootRef`,ref:nt,class:`editor-agent-panel`},[C(`div`,Je,[w(F)&&I.value===`list`?(p(),n(T,{key:0},[C(`button`,{class:`agent-panel-icon-btn agent-panel-back-btn`,title:w(D)(`@EDITOR:返回对话`),"aria-label":w(D)(`@EDITOR:返回对话`),onClick:i[0]||=e=>I.value=`chat`},[...i[4]||=[C(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[C(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),C(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,Ye),C(`span`,Xe,f(w(D)(`@EDITOR:会话列表`)),1)],64)):(p(),n(`span`,Ze,f(w(D)(`@EDITOR:g ai 对话`)),1)),i[7]||=C(`div`,{class:`agent-panel-spacer`},null,-1),!w(F)||I.value===`chat`?(p(),d(He,{key:2,class:`agent-panel-engine`,engine:Ee.value,locked:w(O),onSelect:Oe},null,8,[`engine`,`locked`])):r(``,!0),!w(F)||I.value===`chat`?(p(),d(Ue,{key:3,class:`agent-panel-copy`,messages:w(_),title:Me.value,engine:w(Fe)(Ee.value)},null,8,[`messages`,`title`,`engine`])):r(``,!0),w(F)&&I.value===`chat`?(p(),n(`button`,{key:4,class:`agent-panel-icon-btn agent-panel-list-btn`,title:w(D)(`@EDITOR:会话列表`),"aria-label":w(D)(`@EDITOR:会话列表`),onClick:i[1]||=e=>I.value=`list`},[...i[5]||=[e(`<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" data-v-c445cba6><line x1="8" y1="6" x2="21" y2="6" data-v-c445cba6></line><line x1="8" y1="12" x2="21" y2="12" data-v-c445cba6></line><line x1="8" y1="18" x2="21" y2="18" data-v-c445cba6></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-c445cba6></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-c445cba6></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-c445cba6></line></svg>`,1)]],8,M)):r(``,!0),C(`button`,{class:`agent-panel-icon-btn`,title:w(D)(`@EDITOR:关闭对话`),onClick:i[2]||=e=>ee(`close`)},[...i[6]||=[C(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[C(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),C(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,N)]),C(`div`,{class:a([`agent-panel-body`,{"is-wide":!w(F)}])},[b(C(`div`,P,[s(w(de),{"show-search":!0,items:k.value,"active-id":w(h),loading:w(ie),labels:w(ke),onSelect:ut,onNew:dt,onRename:w(ge),onDelete:w(he)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])],512),[[re,!w(F)||I.value===`list`]]),b(C(`div`,{ref_key:`chatHostRef`,ref:Ke,class:`agent-panel-chat`},[s(w(ue),{ref_key:`chatRef`,ref:We,"show-input":!1,messages:w(_),"assistant-name":w(Re),"assistant-avatar":w(j),theme:ne.value,question:w(ae),"question-submitting":w(y),"question-labels":w(Ae),"plan-config":{labels:{title:w(D)(`@AGENT:计划`),raw:w(D)(`@AGENT:原始参数`)}},"message-rail-config":w(Be),onAnswer:w(ye)},null,8,[`messages`,`assistant-name`,`assistant-avatar`,`theme`,`question`,`question-submitting`,`question-labels`,`plan-config`,`message-rail-config`,`onAnswer`])],512),[[re,!w(F)||I.value===`chat`]]),w(rt)>0?(p(),n(`div`,{key:0,ref_key:`composerRef`,ref:qe,class:`agent-panel-composer acu-root`,"data-theme":ne.value},[s(w(E),{ref_key:`inputRef`,ref:Ge,generating:w(v),"allow-queue":!0,queued:w(Se),"queue-paused":w(Ce),"queue-labels":w(je),placeholder:w(v)?w(D)(`@AGENT:生成中,发送后会排队,等本轮跑完自动接上…`):w(D)(`@AGENT:输入消息,Enter 发送`),"upload-config":{accept:w(Pe)},"context-usage":w(xe),onSend:lt,onStop:w(be),onUnqueue:w(we),onFlushQueued:w(Te)},null,8,[`generating`,`queued`,`queue-paused`,`queue-labels`,`placeholder`,`upload-config`,`context-usage`,`onStop`,`onUnqueue`,`onFlushQueued`]),L.value?(p(),d(ce,{key:0,to:L.value},[at.value?(p(),n(`div`,{key:0,class:`agent-context-att`,title:c.activeFilePath||``},[i[9]||=C(`svg`,{class:`agent-context-att-icon`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.7`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[C(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),C(`polyline`,{points:`14 3 14 8 19 8`})],-1),C(`span`,et,f(c.activeFileName),1),C(`button`,{type:`button`,class:`agent-context-att-remove`,title:w(D)(`@EDITOR:不引用当前文档`),"aria-label":w(D)(`@EDITOR:不引用当前文档`),onClick:i[3]||=e=>it.value=!0},[...i[8]||=[C(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`,"aria-hidden":`true`},[C(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),C(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,tt)],8,$e)):r(``,!0)],8,[`to`])):r(``,!0)],8,Qe)):r(``,!0)],2)],512))}}),[[`__scopeId`,`data-v-c445cba6`]]);u(),m(),c(),v();var rt={class:`sidebar-header`},F={class:`sidebar-title`},I={class:`sidebar-actions`},L={class:`sidebar-search`},it=[`placeholder`,`title`],R=[`title`,`aria-label`],at={key:0,class:`sidebar-tree`},ot={key:1,class:`tree-arrow-spacer`},st={class:`tree-icon mit-icon`,"aria-hidden":`true`},ct=[`xlink:href`],lt=[`onClick`,`onContextmenu`],ut={key:1,class:`tree-arrow-spacer`},dt={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},ft=[`xlink:href`],pt={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},mt=[`xlink:href`],ht=[`title`],gt={key:0,class:`tree-name-hit`},_t={key:4,class:`tree-loading`},vt={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning-dark)`}},yt={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-meta)`}},bt=[`placeholder`],xt={key:0,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},St={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning-dark)`}},Ct={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-meta)`}},wt=[`placeholder`],Tt={key:1,class:`tree-empty`},Et={key:1,class:`sidebar-loading`},Dt={class:`editor-main`},Ot={key:0,class:`editor-tabs`},kt=[`onClick`,`title`],At={class:`tab-name`},jt={key:0,class:`tab-dirty-dot`},Mt=[`onClick`],Nt=[`title`],Pt=[`disabled`,`title`],Ft=[`title`],It={class:`editor-body`},Lt={key:0,class:`image-tab-placeholder`},Rt={viewBox:`0 0 24 24`,width:`56`,height:`56`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{opacity:`.35`}},zt={class:`image-tab-placeholder-title`},Bt={class:`image-tab-placeholder-hint`},Vt={class:`preview-header`},Ht={class:`preview-title`},Ut={class:`preview-ext-badge`},Wt=[`title`],Gt={class:`preview-body`},Kt=[`sandbox`,`srcdoc`],qt=6e4,Jt=3e4,Yt=O(l({__name:`EditorView`,props:{pendingFilePath:{}},setup(c){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new be:t===`css`||t===`scss`||t===`less`?new ve:t===`html`||t===`handlebars`||t===`razor`?new me:t===`typescript`||t===`javascript`?new ge:new he}};let l=c,u=pe(),m=ke(),v=S([]),ue=S(!1),E=S(``),de=S(``),O=null;function xe(){E.value=``,de.value=``,O&&=(clearTimeout(O),null)}g(E,e=>{O&&clearTimeout(O),O=setTimeout(()=>{de.value=e,O=null},180)}),i(()=>{O&&clearTimeout(O),Pe(),hn()});let Se=null;function Ne(){Pe(),u.ui.fileTreeAutoRefresh&&(Se=setInterval(()=>{document.hidden||u.currentDirectory&&(E.value.trim()||A())},qt))}function Pe(){Se&&=(clearInterval(Se),null)}g(()=>u.currentDirectory,async()=>{if(Xt=!1,Ne(),await Ie(),M.value.some(e=>e.isDirty)){Xt=!0;return}M.value=[],N.value=null,nn(),await $t()}),g(()=>u.ui.fileTreeAutoRefresh,()=>{Ne()});async function Fe(e,t=0){let n=await(await fetch(`/api/browse_directory?path=${encodeURIComponent(e)}`)).json();return n.success?n.items.map(e=>({...e,depth:t,expanded:!1,loading:!1,children:(e.type,void 0)})):[]}async function Ie(){let e=u.currentDirectory;if(e){ue.value=!0;try{v.value=await Fe(e,0)}finally{ue.value=!1}}}function Le(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&Le(n.children,t));return t}function Re(e,t=0){return(e||[]).map(e=>{let n={name:e.name,path:e.path,type:e.type,depth:t,expanded:!1,loading:!1};return n.type===`directory`&&Array.isArray(e.children)&&(n.children=Re(e.children,t+1),n.expanded=!0),n})}async function ze(e){let t=u.currentDirectory;if(!t)return null;try{let n=await(await fetch(`/api/browse_directory_tree`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t,expand:e})})).json().catch(()=>null);return!n?.success||!Array.isArray(n.items)?null:Re(n.items,0)}catch{return null}}function Be(e,t){let n=new Map(e.map(e=>[e.path,e])),r=e.length!==t.length;if(!r){for(let n=0;n<t.length;n++)if(e[n].path!==t[n].path){r=!0;break}}for(let e=0;e<t.length;e++){let i=t[e],a=n.get(i.path);a&&(t[e]=a,a.name!==i.name&&(a.name=i.name,r=!0),a.type===`directory`&&a.expanded&&Array.isArray(i.children)&&(Array.isArray(a.children)?Be(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function A(e={}){if(!u.currentDirectory)return;let t=await ze([...Le(v.value)]);if(!t){e.notifyOnError&&h.error(D(`@EDITOR:刷新失败`));return}if(v.value.length===0){v.value=t;return}Be(v.value,t)&&(v.value=t)}async function j(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await Fe(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function Ve(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...Ve(n.children));return t}let He=t(()=>de.value.trim().toLowerCase());function Ue(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?Ue(r.children,t):[],i=r.name.toLowerCase().includes(t);r.type===`directory`?(i||e.length>0)&&(r.expanded=!0,r.children!==void 0&&(r.children=e),n.push(r)):i&&n.push(r)}return n}let Ge=t(()=>Ue(v.value,He.value)),Ke=t(()=>He.value.length>0&&Ge.value.length===0);function Je(e){let t=de.value.trim();if(!t)return[{text:e,hit:!1}];let n=e.toLowerCase(),r=t.toLowerCase(),i=[],a=0,o=n.indexOf(r,a);for(;o!==-1;)o>a&&i.push({text:e.slice(a,o),hit:!1}),i.push({text:e.slice(o,o+r.length),hit:!0}),a=o+r.length,o=n.indexOf(r,a);return a<e.length&&i.push({text:e.slice(a),hit:!1}),i}let Ye=S(null);function Xe(){let e=Ye.value;e&&(e.focus(),e.select())}function Ze(){E.value?(xe(),Ye.value?.focus()):(Ye.value?.blur(),z.value?.focus())}let M=S([]),N=S(null),P=S(null);async function Qe(e){if(P.value=e,e.type!==`file`){j(e);return}let t=M.value.find(t=>t.path===e.path);if(console.log(`[debug-open-in-editor] EditorView openFile existing tab check:`,{path:e.path,found:!!t,tabsCount:M.value.length}),t){N.value=e.path,o(()=>an());return}let n=e.name.split(`.`).pop()||``;if(Qn.has(n.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null};M.value.push(t),N.value=e.path,J.value=!0;return}if(k(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null};M.value.push(t),N.value=e.path,Y.value=!1,J.value=!0;return}try{let t=await fetch(`/api/editor/file?path=${encodeURIComponent(e.path)}`),r=await t.json();if(console.log(`[debug-open-in-editor] EditorView fetch /api/editor/file response:`,{path:e.path,status:t.status,data:r}),!r.success){h.error(`${D(`@EDITOR:打开文件失败: `)}${r.error}`);return}let i=We(n),a=B.get(e.path);a&&!a.isDisposed()&&a.setValue(r.content);let o={path:e.path,name:e.name,content:r.content,originalContent:r.content,isDirty:!1,language:i,diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null};console.log(`[debug-open-in-editor] EditorView pushing tab:`,{path:o.path,name:o.name,contentLen:o.content.length,lang:o.language}),M.value.push(o),N.value=e.path,console.log(`[debug-open-in-editor] EditorView tabs after push:`,M.value.length,`activeTabPath=`,N.value)}catch(e){console.log(`[debug-open-in-editor] EditorView fetch threw:`,e),h.error(`${D(`@EDITOR:打开文件失败: `)}${e.message}`)}}g(()=>l.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await o();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await Qe({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function $e(e,t){t.stopPropagation();let n=M.value.findIndex(t=>t.path===e);n!==-1&&(!M.value[n].isDirty||confirm(D(`@EDITOR:文件未保存,确认关闭?`)))&&(M.value.splice(n,1),N.value===e&&(N.value=M.value[Math.min(n,M.value.length-1)]?.path??null))}let et=()=>M.value.find(e=>e.path===N.value)??null,tt=t(()=>({expandedDirs:[...Le(v.value)],tabs:M.value.map(e=>e.path),activeTab:N.value})),Yt=!1,Xt=!1;function Zt(){Xt&&!Yt&&u.isUiLoaded&&u.saveEditorWorkspace(tt.value)}g(tt,()=>Zt());async function Qt(e){if(M.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(Qn.has(n)){M.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(k(t)){M.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null});return}try{let r=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}`)).json();if(!r.success)return;let i=B.get(e);i&&!i.isDisposed()&&z.value?.getModel()!==i&&(i.dispose(),B.delete(e)),M.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:We(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function $t(){try{for(let e=0;e<100&&!u.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!u.isUiLoaded)return;H.value=u.ui.editorSidebarWidth;let e=u.getEditorWorkspace();if(!e)return;Yt=!0;try{if(e.expandedDirs.length>0){let t=await ze(e.expandedDirs);t&&(v.value=t)}for(let t of e.tabs)await Qt(t);if(!l.pendingFilePath&&e.activeTab&&M.value.some(t=>t.path===e.activeTab)){N.value=e.activeTab;let t=et(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(Qn.has(n)||k(t.name))&&(J.value=!0)}}finally{Yt=!1}}finally{Xt=!0,Zt()}}let en=S(null),z=le(null),B=new Map;function tn(e){let t=B.get(e.path);return(!t||t.isDisposed())&&(t=ye.createModel(e.content,e.language,_e.file(e.path)),B.set(e.path,t)),t}function nn(){z.value?.setModel(null);for(let e of B.values())e.isDisposed()||e.dispose();B.clear()}function rn(){if(!en.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;z.value=ye.create(en.value,{theme:e?`vs-dark`:`vs`,fontSize:13,lineHeight:20,fontFamily:`'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace`,minimap:{enabled:!0},scrollBeyondLastLine:!1,renderWhitespace:`selection`,automaticLayout:!0,tabSize:2,wordWrap:`off`,smoothScrolling:!0,cursorBlinking:`smooth`,padding:{top:8,bottom:8},editContext:!1}),z.value.onDidChangeModelContent(()=>{let e=et();if(!e)return;let t=z.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),z.value.onDidBlurEditorText(()=>{u.ui.editorAutoSave&&et()?.isDirty&&vn(!1),requestAnimationFrame(()=>{if(!V.value||V.value.offsetParent===null)return;let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||an()})})}g(N,e=>{if(!z.value||!e)return;let t=M.value.find(t=>t.path===e);if(!t)return;let n=tn(t);z.value.setModel(n),o(()=>an()),dn(e)});function an(){if(!z.value)return;z.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let on=0,sn=new Map;async function cn(e){try{let t=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}&meta=1`)).json();return!t?.success||typeof t.mtimeMs!=`number`?null:{mtimeMs:t.mtimeMs}}catch{return null}}async function ln(e){try{let t=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}`)).json();return t?.success?{content:t.content,mtimeMs:typeof t.mtimeMs==`number`?t.mtimeMs:null}:null}catch{return null}}function un(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=B.get(e.path);if(!r||r.isDisposed())return;let i=z.value;if(!i||i.getModel()!==r){r.setValue(t);return}let a=i.saveViewState();r.pushEditOperations([],[{range:r.getFullModelRange(),text:t}],()=>null),i.restoreViewState(a)}async function dn(e){if(!e)return;let t=M.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++on,r=await cn(e);if(n!==on||M.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(sn.get(e)===r.mtimeMs)return;sn.set(e,r.mtimeMs);try{await se.confirm(D(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),D(`@EDITOR:文件已被外部改动`),{confirmButtonText:D(`@EDITOR:重新加载`),cancelButtonText:D(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await ln(e);i&&M.value.find(t=>t.path===e)===t&&un(t,i.content,i.mtimeMs)}function fn(){document.hidden||dn(N.value)}let pn=null;function mn(){hn(),pn=setInterval(()=>{document.hidden||dn(N.value)},Jt)}function hn(){pn&&=(clearInterval(pn),null)}g(()=>M.value.filter(e=>e.isDirty).length,e=>{m.setDirtyCount(e)},{immediate:!0}),i(()=>m.setDirtyCount(0)),De(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;ye.setTheme(e?`vs-dark`:`vs`)});let gn=null;function _n(){if(gn||!V.value)return;let e=[V.value],t=V.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}gn=new MutationObserver(()=>{V.value&&V.value.offsetParent!==null&&N.value&&z.value&&(dn(N.value),requestAnimationFrame(()=>{let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||an()}))});let n=gn;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}oe(async()=>{rn(),await Ie(),await $t(),_n(),Ne(),window.addEventListener(`focus`,fn),document.addEventListener(`visibilitychange`,fn),mn(),N.value&&o(()=>an())}),i(()=>{gn?.disconnect(),gn=null,window.removeEventListener(`focus`,fn),document.removeEventListener(`visibilitychange`,fn),z.value?.dispose(),B.forEach(e=>e.dispose()),B.clear()});async function vn(e=!1){let t=et();if(t)try{let n=await(await fetch(`/api/editor/file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t.path,content:t.content})})).json();if(!n.success){h.error(`${D(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||h.success(D(`@EDITOR:已保存`))}catch(e){h.error(`${D(`@EDITOR:保存失败: `)}${e.message}`)}}function yn(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),Xe();return}t&&e.key===`s`&&(e.preventDefault(),vn())}oe(()=>window.addEventListener(`keydown`,yn)),i(()=>window.removeEventListener(`keydown`,yn));let V=S(null),H=S(u.ui.editorSidebarWidth),bn=!1,xn=0,Sn=0;function Cn(e){bn=!0,xn=e.clientX,Sn=H.value,document.addEventListener(`mousemove`,wn),document.addEventListener(`mouseup`,Tn),e.preventDefault()}function wn(e){if(!bn)return;let t=e.clientX-xn;H.value=Math.max(140,Math.min(400,Sn+t))}function Tn(){bn=!1,document.removeEventListener(`mousemove`,wn),document.removeEventListener(`mouseup`,Tn),H.value!==u.ui.editorSidebarWidth&&u.setEditorSidebarWidth(H.value)}function En(e){return e.type===`directory`?Te(e.name):we(e.name)}let U=S(null),W=S(null),G=S(null),Dn=S(null);function On(){let e=P.value;return e?e.type===`directory`?{parentPath:e.path,afterNode:e,depth:e.depth+1}:{parentPath:e.path.includes(`/`)||e.path.includes(`\\`)?e.path.replace(/[\\/][^\\/]+$/,``):u.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:u.currentDirectory??``,afterNode:null,depth:0}}async function kn(){let e=On();P.value?.type===`directory`&&!P.value.expanded&&await j(P.value),U.value={...e,kind:`file`,value:``},await o(),G.value?.focus()}async function An(){let e=On();P.value?.type===`directory`&&!P.value.expanded&&await j(P.value),U.value={...e,kind:`directory`,value:``},await o(),G.value?.focus()}function jn(){U.value=null}async function Mn(){let e=U.value;if(!e||!e.value.trim()){U.value=null;return}let t=e.value.trim(),n=e.parentPath.replace(/[/\\]$/,``)+`/`+t;if(e.kind===`file`){let e=await(await fetch(`/api/editor/file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){h.error(e.error);return}h.success(D(`@EDITOR:创建成功`))}else{let e=await(await fetch(`/api/editor/directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){h.error(e.error);return}h.success(D(`@EDITOR:创建成功`))}U.value=null,await A()}function Nn(e){e.key===`Enter`&&(e.preventDefault(),Mn()),e.key===`Escape`&&(e.preventDefault(),jn())}let K=S(null),Pn=S(null);function Fn(e,t){e.preventDefault(),K.value={x:e.clientX,y:e.clientY,node:t}}function q(){K.value=null}async function In(){let e=K.value?.node;q(),e&&(P.value=e),e?.type===`directory`&&!e.expanded&&await j(e);let t=On();U.value={...t,kind:`file`,value:``},await o(),G.value?.focus()}async function Ln(){let e=K.value?.node;q(),e&&(P.value=e),e?.type===`directory`&&!e.expanded&&await j(e);let t=On();U.value={...t,kind:`directory`,value:``},await o(),G.value?.focus()}async function Rn(){let e=K.value?.node;q(),e&&(W.value={node:e,value:e.name},await o(),Dn.value?.focus(),Dn.value?.select())}async function zn(){let e=W.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){W.value=null;return}let t=e.value.trim(),n=e.node.path.replace(/[\\/][^\\/]+$/,``).replace(/[/\\]$/,``)+`/`+t,r=await(await fetch(`/api/editor/rename`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({oldPath:e.node.path,newPath:n})})).json();if(!r.success){h.error(r.error);return}let i=M.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,N.value===e.node.path&&(N.value=n)),W.value=null,await A()}function Bn(e){e.key===`Enter`&&(e.preventDefault(),zn()),e.key===`Escape`&&(e.preventDefault(),W.value=null)}async function Vn(){let e=K.value?.node;if(q(),!e)return;let t=e.type===`directory`?D(`@EDITOR:文件夹`):D(`@EDITOR:文件`);if(!confirm(`${D(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){h.error(n.error);return}let r=M.value.findIndex(t=>t.path===e.path);r!==-1&&(M.value.splice(r,1),N.value===e.path&&(N.value=M.value[Math.max(0,r-1)]?.path??null)),h.success(D(`@EDITOR:已删除`)),await A()}async function Hn(){let e=K.value?.node;if(q(),e)try{let t=await(await fetch(`/api/editor/reveal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||h.error(t.error)}catch(e){h.error(e?.message||String(e))}}function Un(e){let t=u.currentDirectory;if(!t)return e;let n=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``),r=n(t),i=n(e);return i===r?`.`:i.startsWith(r+`/`)?i.slice(r.length+1):i}async function Wn(e){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}async function Gn(){let e=K.value?.node;q(),e&&(await Wn(e.path)?h.success(D(`@EDITOR:已复制到剪贴板`)):h.error(D(`@EDITOR:复制失败`)))}async function Kn(){let e=K.value?.node;q(),e&&(await Wn(Un(e.path))?h.success(D(`@EDITOR:已复制到剪贴板`)):h.error(D(`@EDITOR:复制失败`)))}async function qn(){let e=K.value?.node;if(q(),e)try{let t=await(await fetch(`/api/editor/open-in-vscode`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||h.error(t.error||D(`@EDITOR:VSCode 未安装`))}catch(e){h.error(e?.message||String(e))}}let Jn=new Set([`html`,`htm`]),Yn=t(()=>{let e=K.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return Jn.has(t)});async function Xn(){let e=K.value?.node;if(q(),e)try{let t=await(await fetch(`/api/editor/open-in-browser`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||h.error(t.error||D(`@EDITOR:浏览器打开失败`))}catch(e){h.error(e?.message||String(e))}}oe(()=>document.addEventListener(`click`,q)),i(()=>document.removeEventListener(`click`,q));let Zn=new Set([`md`,`html`,`htm`,`svg`]),Qn=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),J=S(!1),Y=S(!1),X=S(!1),$n=S(!1),er=S(0),Z=t(()=>M.value.find(e=>e.path===N.value)??null),tr=t(()=>Z.value?.language===`plaintext`&&Z.value?.content===``),nr=t(()=>Z.value?.language===`office`),Q=t(()=>(Z.value?.name??``).split(`.`).pop()?.toLowerCase()??``),rr=t(()=>Zn.has(Q.value)||Qn.has(Q.value)||k(Q.value)),ir=t(()=>((Z.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),$=t(()=>Q.value===`md`&&ir.value>0);g(N,()=>{J.value&&!rr.value&&(J.value=!1),Y.value&&!$.value&&(Y.value=!1)});function ar(){rr.value&&(J.value||(Y.value=!1,X.value=!1),J.value=!J.value)}function or(){$.value&&(Y.value||(J.value=!1,X.value=!1),Y.value=!Y.value)}function sr(){X.value||(J.value=!1,Y.value=!1),X.value=!X.value,$n.value=!0}let cr=t(()=>{let e=Z.value;if(!e)return``;let t=Q.value,n=document.documentElement.getAttribute(`data-theme`)===`light`?`#ffffff`:`#0d1117`;return t===`html`||t===`htm`?Me(e.content):t===`svg`?`<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:${n};display:flex;align-items:center;justify-content:center;min-height:100vh;}svg{max-width:100%;max-height:90vh;}</style></head><body>${e.content}</body></html>`:``}),lr=!1,ur=0,dr=0;function fr(e){lr=!0,ur=e.clientX,dr=er.value,document.addEventListener(`mousemove`,pr),document.addEventListener(`mouseup`,mr),e.preventDefault()}function pr(e){if(!lr)return;let t=e.clientX-ur;er.value=Math.max(200,Math.min(900,dr+t))}function mr(){lr=!1,document.removeEventListener(`mousemove`,pr),document.removeEventListener(`mouseup`,mr)}return(t,i)=>(p(),n(T,null,[C(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:V},[C(`div`,{class:`editor-sidebar`,style:y({width:H.value+`px`})},[C(`div`,rt,[C(`span`,F,f(w(D)(`@EDITOR:资源管理器`)),1),C(`div`,I,[s(w(ee),{content:w(D)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:ae(()=>[C(`button`,{class:`sidebar-action-btn`,onClick:kn},[...i[11]||=[C(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[C(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),C(`polyline`,{points:`14 2 14 8 20 8`}),C(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),C(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1)]])]),_:1},8,[`content`]),s(w(ee),{content:w(D)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:ae(()=>[C(`button`,{class:`sidebar-action-btn`,onClick:An},[...i[12]||=[C(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[C(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),C(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),C(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)]])]),_:1},8,[`content`]),s(w(ee),{content:w(D)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:ae(()=>[C(`button`,{class:`sidebar-action-btn`,onClick:i[0]||=e=>A({notifyOnError:!0})},[...i[13]||=[C(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[C(`polyline`,{points:`1 4 1 10 7 10`}),C(`polyline`,{points:`23 20 23 14 17 14`}),C(`path`,{d:`M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15`})],-1)]])]),_:1},8,[`content`])])]),C(`div`,L,[i[15]||=C(`svg`,{class:`sidebar-search-icon`,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[C(`circle`,{cx:`11`,cy:`11`,r:`7`}),C(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),b(C(`input`,{ref_key:`searchInputRef`,ref:Ye,"onUpdate:modelValue":i[1]||=e=>E.value=e,type:`text`,class:`sidebar-search-input`,placeholder:w(D)(`@EDITOR:搜索文件...`),title:w(D)(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:ne(Ze,[`escape`])},null,40,it),[[ie,E.value]]),E.value?(p(),n(`button`,{key:0,class:`sidebar-search-clear`,title:w(D)(`@EDITOR:清除搜索`),"aria-label":w(D)(`@EDITOR:清除搜索`),onClick:xe},[...i[14]||=[C(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[C(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),C(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,R)):r(``,!0)]),ue.value?(p(),n(`div`,Et,[...i[24]||=[C(`span`,{class:`spin-icon`},null,-1)]])):(p(),n(`div`,at,[(p(!0),n(T,null,te(Ve(Ge.value),e=>(p(),n(T,{key:e.path},[W.value&&W.value.node.path===e.path?(p(),n(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:y({paddingLeft:12+e.depth*14+`px`})},[e.type===`directory`?(p(),n(`span`,{key:0,class:a([`tree-arrow`,{expanded:e.expanded}])},[...i[16]||=[C(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[C(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(p(),n(`span`,ot)),(p(),n(`svg`,st,[C(`use`,{"xlink:href":`#${En(e)}`},null,8,ct)])),b(C(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:Dn,"onUpdate:modelValue":i[2]||=e=>W.value.value=e,onKeydown:Bn,onBlur:zn,onClick:i[3]||=x(()=>{},[`stop`])},null,544),[[ie,W.value.value]])],4)):(p(),n(`div`,{key:1,class:a([`tree-node`,{"tree-node--dir":e.type===`directory`,"tree-node--file":e.type===`file`,"tree-node--active":N.value===e.path,"tree-node--selected":P.value?.path===e.path&&N.value!==e.path}]),style:y({paddingLeft:12+e.depth*14+`px`}),onClick:t=>Qe(e),onContextmenu:t=>Fn(t,e)},[e.type===`directory`?(p(),n(`span`,{key:0,class:a([`tree-arrow`,{expanded:e.expanded}])},[...i[17]||=[C(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[C(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(p(),n(`span`,ut)),e.type===`directory`?(p(),n(`svg`,dt,[C(`use`,{"xlink:href":`#${En(e)}`},null,8,ft)])):(p(),n(`svg`,pt,[C(`use`,{"xlink:href":`#${En(e)}`},null,8,mt)])),C(`span`,{class:`tree-name`,title:e.path},[(p(!0),n(T,null,te(Je(e.name),(e,t)=>(p(),n(T,{key:t},[e.hit?(p(),n(`span`,gt,f(e.text),1)):(p(),n(T,{key:1},[_(f(e.text),1)],64))],64))),128))],8,ht),e.loading?(p(),n(`span`,_t)):r(``,!0)],46,lt)),U.value&&U.value.afterNode?.path===e.path?(p(),n(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:y({paddingLeft:12+U.value.depth*14+`px`})},[i[20]||=C(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(p(),n(`svg`,vt,[...i[18]||=[C(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(p(),n(`svg`,yt,[...i[19]||=[C(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),C(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),b(C(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":i[4]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?w(D)(`@EDITOR:输入文件名`):w(D)(`@EDITOR:输入文件夹名`),onKeydown:Nn,onBlur:jn,onClick:i[5]||=x(()=>{},[`stop`])},null,40,bt),[[ie,U.value.value]])],4)):r(``,!0)],64))),128)),U.value&&U.value.afterNode===null?(p(),n(`div`,xt,[i[23]||=C(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(p(),n(`svg`,St,[...i[21]||=[C(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(p(),n(`svg`,Ct,[...i[22]||=[C(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),C(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),b(C(`input`,{ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":i[6]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?w(D)(`@EDITOR:输入文件名`):w(D)(`@EDITOR:输入文件夹名`),onKeydown:Nn,onBlur:jn,onClick:i[7]||=x(()=>{},[`stop`])},null,40,wt),[[ie,U.value.value]])])):r(``,!0),!U.value&&(Ke.value||v.value.length===0)?(p(),n(`div`,Tt,f(Ke.value?w(D)(`@EDITOR:未找到匹配文件`):w(D)(`@EDITOR:暂无文件`)),1)):r(``,!0)]))],4),C(`div`,{class:`editor-resizer`,onMousedown:Cn},null,32),C(`div`,Dt,[M.value.length>0?(p(),n(`div`,Ot,[(p(!0),n(T,null,te(M.value,e=>(p(),n(`div`,{key:e.path,class:a([`editor-tab`,{active:N.value===e.path,dirty:e.isDirty}]),onClick:t=>N.value=e.path,title:e.path},[C(`span`,At,f(e.name),1),e.isDirty?(p(),n(`span`,jt)):r(``,!0),C(`button`,{class:`tab-close`,onClick:t=>$e(e.path,t)},[...i[25]||=[C(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[C(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),C(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Mt)],10,kt))),128)),i[29]||=C(`div`,{class:`editor-tabs-spacer`},null,-1),rr.value?(p(),n(`button`,{key:0,class:a([`preview-toggle-btn`,{active:J.value}]),title:J.value?w(D)(`@EDITOR:关闭预览`):w(D)(`@EDITOR:打开预览`),onClick:ar},[i[26]||=C(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[C(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),C(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),C(`span`,null,f(w(D)(`@EDITOR:预览`)),1)],10,Nt)):r(``,!0),$.value?(p(),n(`button`,{key:1,class:a([`preview-toggle-btn mindmap-toggle-btn`,{active:Y.value,disabled:!$.value}]),disabled:!$.value,title:$.value?Y.value?w(D)(`@EDITOR:关闭思维导图`):w(D)(`@EDITOR:打开思维导图`):w(D)(`@EDITOR:需要至少一个 # 标题`),onClick:or},[i[27]||=e(`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-c65c2d3f><circle cx="12" cy="12" r="2" data-v-c65c2d3f></circle><circle cx="5" cy="6" r="1.6" data-v-c65c2d3f></circle><circle cx="19" cy="6" r="1.6" data-v-c65c2d3f></circle><circle cx="5" cy="18" r="1.6" data-v-c65c2d3f></circle><circle cx="19" cy="18" r="1.6" data-v-c65c2d3f></circle><line x1="11" y1="11" x2="6.4" y2="7" data-v-c65c2d3f></line><line x1="13" y1="11" x2="17.6" y2="7" data-v-c65c2d3f></line><line x1="11" y1="13" x2="6.4" y2="17" data-v-c65c2d3f></line><line x1="13" y1="13" x2="17.6" y2="17" data-v-c65c2d3f></line></svg>`,1),C(`span`,null,f(w(D)(`@EDITOR:思维导图`)),1)],10,Pt)):r(``,!0),C(`button`,{class:a([`preview-toggle-btn agent-toggle-btn`,{active:X.value}]),title:X.value?w(D)(`@EDITOR:关闭 g ai 对话`):w(D)(`@EDITOR:打开 g ai 对话`),onClick:sr},[i[28]||=C(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[C(`path`,{d:`M12 3l1.9 4.6L18.5 9.5l-4.6 1.9L12 16l-1.9-4.6L5.5 9.5l4.6-1.9z`}),C(`path`,{d:`M18 16.5l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1-2.1-.9 2.1-.9z`})],-1),C(`span`,null,f(w(D)(`@EDITOR:g ai 对话`)),1)],10,Ft)])):r(``,!0),M.value.length===0?(p(),d(Ae,{key:1,class:`editor-empty`,title:w(D)(`@EDITOR:从左侧选择文件打开`),hint:w(D)(`@EDITOR:Ctrl+S 保存`)},{icon:ae(()=>[...i[30]||=[C(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[C(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),C(`polyline`,{points:`14 2 14 8 20 8`})],-1)]]),_:1},8,[`title`,`hint`])):r(``,!0),C(`div`,It,[C(`div`,{class:a([`monaco-container`,{hidden:M.value.length===0||tr.value||nr.value}]),ref_key:`editorContainerRef`,ref:en},null,2),tr.value&&M.value.length>0&&!J.value&&!Y.value?(p(),n(`div`,Lt,[(p(),n(`svg`,Rt,[...i[31]||=[C(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),C(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),C(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),C(`p`,zt,f(Z.value?.name),1),C(`p`,Bt,f(w(D)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):r(``,!0),(J.value||Y.value||X.value)&&M.value.length>0?(p(),n(`div`,{key:1,class:`preview-resizer`,onMousedown:fr},null,32)):r(``,!0),$n.value?b((p(),d(nt,{key:2,active:X.value&&M.value.length>0,"active-file-path":N.value,"active-file-name":Z.value?.name??``,style:y({flexBasis:er.value+`px`}),onClose:i[8]||=e=>X.value=!1},null,8,[`active`,`active-file-path`,`active-file-name`,`style`])),[[re,X.value&&M.value.length>0]]):r(``,!0),(J.value||Y.value)&&M.value.length>0?(p(),n(`div`,{key:3,class:`preview-panel`,style:y({flexBasis:er.value+`px`})},[C(`div`,Vt,[C(`span`,Ht,f(Y.value?w(D)(`@EDITOR:思维导图`):w(D)(`@EDITOR:预览`)),1),C(`span`,Ut,f(Q.value.toUpperCase()),1),i[33]||=C(`div`,{class:`preview-header-spacer`},null,-1),C(`button`,{class:`preview-close-btn`,title:Y.value?w(D)(`@EDITOR:关闭思维导图`):w(D)(`@EDITOR:关闭预览`),onClick:i[9]||=e=>Y.value?Y.value=!1:J.value=!1},[...i[32]||=[C(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[C(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),C(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Wt)]),C(`div`,Gt,[Y.value&&Q.value===`md`&&Z.value?(p(),d(qe,{key:0,content:Z.value.content,class:`preview-mindmap`},null,8,[`content`])):J.value&&Q.value===`md`&&Z.value?(p(),d(je,{key:Z.value.path,content:Z.value.content,class:`preview-markdown`},null,8,[`content`])):J.value&&[`html`,`htm`,`svg`].includes(Q.value)?(p(),n(`iframe`,{key:2,class:`preview-iframe`,sandbox:w(Oe),srcdoc:cr.value},null,8,Kt)):J.value&&w(Qn).has(Q.value)&&Z.value?(p(),d(Ee,{key:3,"file-path":Z.value.path,"file-name":Z.value.name},null,8,[`file-path`,`file-name`])):J.value&&nr.value&&Z.value?(p(),d(Ce,{key:4,"file-path":Z.value.path},null,8,[`file-path`])):r(``,!0)])],4)):r(``,!0)])])],512),(p(),d(ce,{to:`body`},[K.value?(p(),n(`div`,{key:0,ref_key:`ctxMenuRef`,ref:Pn,class:`ctx-menu`,style:y({left:K.value.x+`px`,top:K.value.y+`px`}),onClick:i[10]||=x(()=>{},[`stop`])},[C(`button`,{class:`ctx-menu-item`,onClick:In},[i[34]||=C(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[C(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),C(`polyline`,{points:`14 2 14 8 20 8`}),C(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),C(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),_(` `+f(w(D)(`@EDITOR:新建文件`)),1)]),C(`button`,{class:`ctx-menu-item`,onClick:Ln},[i[35]||=C(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[C(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),C(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),C(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),_(` `+f(w(D)(`@EDITOR:新建文件夹`)),1)]),i[42]||=C(`div`,{class:`ctx-menu-sep`},null,-1),C(`button`,{class:`ctx-menu-item`,onClick:Gn},[i[36]||=C(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[C(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),C(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),_(` `+f(w(D)(`@EDITOR:复制绝对路径`)),1)]),C(`button`,{class:`ctx-menu-item`,onClick:Kn},[i[37]||=C(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[C(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),C(`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`})],-1),_(` `+f(w(D)(`@EDITOR:复制相对路径`)),1)]),i[43]||=C(`div`,{class:`ctx-menu-sep`},null,-1),Yn.value?(p(),n(`button`,{key:0,class:`ctx-menu-item`,onClick:Xn},[i[38]||=C(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[C(`circle`,{cx:`12`,cy:`12`,r:`9`}),C(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),C(`path`,{d:`M12 3a13 13 0 0 1 3.5 9 13 13 0 0 1-3.5 9 13 13 0 0 1-3.5-9A13 13 0 0 1 12 3z`})],-1),_(` `+f(w(D)(`@EDITOR:在浏览器中打开`)),1)])):r(``,!0),C(`button`,{class:`ctx-menu-item`,onClick:Hn},[i[39]||=C(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[C(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`}),C(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),_(` `+f(w(D)(`@EDITOR:在资源管理器中打开`)),1)]),C(`button`,{class:`ctx-menu-item`,onClick:qn},[s(fe,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),_(` `+f(w(D)(`@EDITOR:在 VSCode 中打开`)),1)]),C(`button`,{class:`ctx-menu-item`,onClick:Rn},[i[40]||=C(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[C(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),C(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),_(` `+f(w(D)(`@EDITOR:重命名`)),1)]),C(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Vn},[i[41]||=C(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[C(`polyline`,{points:`3 6 5 6 21 6`}),C(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),C(`path`,{d:`M10 11v6`}),C(`path`,{d:`M14 11v6`}),C(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),_(` `+f(w(D)(`@EDITOR:删除`)),1)])],4)):r(``,!0)]))],64))}}),[[`__scopeId`,`data-v-c65c2d3f`]]);export{Yt as default};
|
package/src/ui/public/assets/{FlowExecutionViewer-DxDKzmaP.js → FlowExecutionViewer-CAiAPsVH.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Cn as e,Dn as t,Hn as n,In as r,Jn as i,Mn as a,Pn as o,Rn as s,Yn as c,dr as l,ir as u,mr as d,or as f,wr as p}from"./element-plus-
|
|
1
|
+
import{Cn as e,Dn as t,Hn as n,In as r,Jn as i,Mn as a,Pn as o,Rn as s,Yn as c,dr as l,ir as u,mr as d,or as f,wr as p}from"./element-plus-BFy5M3jt.js";import{n as m,t as h}from"./_plugin-vue_export-helper-DcVJ6Vx3.js";import{i as g,l as _,n as v,s as y}from"./vue-flow--96Pa3sG.js";import{a as b,c as x,i as S,n as C,o as w,r as T,s as E,t as D}from"./UserInputNode-DE8GEC3J.js";s(),l();var O={class:`flow-exec-viewer`},k=`flow-execution-viewer`,A=h(o({__name:`FlowExecutionViewer`,props:{flowData:{type:Object,required:!0},currentNodeId:{type:String,default:void 0},executedNodeIds:{type:Array,default:()=>[]},failedNodeIds:{type:Array,default:()=>[]},executedEdgeIds:{type:Array,default:()=>[]}},setup(s){function l(e){switch(e){case`command`:return`📋`;case`wait`:return`⏰`;case`version`:return`📦`;case`confirm`:return`✋`;case`code`:return`🧩`;case`start`:return`🚀`;case`condition`:return`🔀`;case`user_input`:return`⌨️`;default:return``}}let h=o({name:`FlowExecStartNodeRenderer`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(e){return()=>r(x,{id:e.id,nodeId:e.id,nodeType:`start`,title:m(`@FLOWNODE:开始`),icon:l(`start`),enabled:e.data?.enabled,selected:e.data?.selected,execStatus:e.data?.execStatus,deletable:!1},{})}});function A(t){return o({name:`FlowExecWrappedNode`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(n){let i=e(()=>{let e=n.data?.config,t=[...Array.isArray(e?.conditionBranches)?e.conditionBranches:[]].sort((e,t)=>{let n=e?.handleId==="default"||e?.isDefault,r=t?.handleId==="default"||t?.isDefault;return n&&!r?1:!n&&r?-1:Number(e?.priority??0)-Number(t?.priority??0)}).map(e=>String(e?.handleId||``).trim()).filter(e=>!!e);return t.includes(`default`)||t.push(`default`),t.length?t:[`default`]});return()=>r(x,{id:n.id,nodeId:n.id,nodeType:n.data?.type,title:n.data?.label,icon:l(n.data?.type),enabled:n.data?.enabled,selected:n.data?.selected,execStatus:n.data?.execStatus,sourceHandleIds:n.data?.type===`condition`?i.value:void 0,deletable:!1},{default:()=>r(t,{data:n.data,id:n.id})})}})}let j={start:d(h),command:d(A(E)),wait:d(A(w)),version:d(A(b)),confirm:d(A(S)),code:d(A(T)),condition:d(A(C)),user_input:d(A(D))},M=s,{onPaneReady:N}=_({id:k}),P=null,F=null;async function I(e){if(e){if(!P){F=e;return}for(let t=0;t<6;t+=1){if(await n(),await new Promise(e=>requestAnimationFrame(()=>e())),!(typeof P?.findNode==`function`&&P.findNode(e))){await new Promise(e=>window.setTimeout(()=>e(),60));continue}try{await P.fitView({nodes:[e],padding:.35,includeHiddenNodes:!0,minZoom:.35,maxZoom:1.2,duration:200})}catch{}break}}}N(e=>{P=e,console.log(`[FlowExecutionViewer] onPaneReady, flowId=`,k),console.log(`[FlowExecutionViewer] instance keys=`,Object.keys(e||{}));try{P.fitView({padding:.2,includeHiddenNodes:!0,duration:0})}catch{}let t=(M.currentNodeId||F||``).trim();t&&(F=null,I(t))});let L=null;u(()=>M.currentNodeId,async e=>{e&&(L&&=(window.clearTimeout(L),null),L=window.setTimeout(async()=>{if(console.log(`[FlowExecutionViewer] focus request, flowId=`,k,`nodeId=`,e),!P){F=e,console.log(`[FlowExecutionViewer] flowInstance not ready, pendingFocusNodeId=`,F);return}I(e)},150))}),i(()=>{L&&=(window.clearTimeout(L),null)});let R=e(()=>{let e=Array.isArray(M.flowData?.nodes)?M.flowData.nodes:[],t=new Set(M.executedNodeIds),n=new Set(M.failedNodeIds),r=M.currentNodeId;return e.map(e=>{let i;r&&e.id===r?i=`running`:n.has(e.id)?i=`failed`:t.has(e.id)&&(i=`success`);let a=[];return t.has(e.id)&&a.push(`exec-node-done`),{...e,data:{...e.data,execStatus:i},class:a.join(` `)}})}),z=e(()=>{let e=Array.isArray(M.flowData?.edges)?M.flowData.edges:[],t=new Set(M.executedEdgeIds);return e.map(e=>{let n=[];return t.has(e.id)&&n.push(`exec-edge-done`),{...e,class:n.join(` `)}})});return(e,n)=>(c(),t(`div`,O,[a(p(y),{id:k,nodes:R.value,edges:z.value,"node-types":j,"nodes-draggable":!1,"nodes-connectable":!1,"elements-selectable":!1,"zoom-on-scroll":!0,"zoom-on-double-click":!1,"pan-on-drag":!0,"min-zoom":.2,"max-zoom":1.5},{default:f(()=>[a(p(g)),a(p(v))]),_:1},8,[`nodes`,`edges`])]))}}),[[`__scopeId`,`data-v-d2ccb36e`]]);export{A as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{A as t,At as n,C as r,Cn as i,Dn as a,En as o,Et as s,F as c,G as l,Gr as u,Gt as d,Hn as f,I as ee,In as p,J as m,Jn as te,K as h,M as g,Mn as _,Mr as v,N as y,Pn as b,Pt as x,Qn as S,Rn as C,Rt as w,S as ne,St as re,Tn as T,U as ie,Vt as ae,W as oe,Xn as E,Xr as D,Yn as O,Zn as k,at as se,bt as ce,c as A,ct as le,dr as j,dt as M,i as N,ir as P,jn as F,kt as I,l as L,ln as R,lt as ue,m as z,mr as B,or as V,qn as H,r as de,tn as fe,vn as pe,vr as U,w as me,wn as W,wr as G,x as K,y as he,yn as q,z as ge,zn as _e}from"./element-plus-DTtm3XCd.js";import{b as ve}from"./vendor-O17eRefg.js";import{n as J,t as Y}from"./_plugin-vue_export-helper-Bsx6Zj3t.js";import{t as ye}from"./dagre-BmYeUlEa.js";import{t as be}from"./SvgIcon-DcVasCdo.js";import{t as X}from"./configStore-DQSKV2_Y.js";import{t as xe}from"./CommonDialog-NqZURH2F.js";import{i as Se,l as Ce,n as we,s as Te}from"./vue-flow-BG6ZF1It.js";import{V as Z,a as Ee}from"./index-BApctCNq.js";import{a as De,c as Oe,i as Q,n as ke,o as Ae,r as je,s as Me,t as Ne}from"./UserInputNode-B313MadX.js";var Pe=e(ye(),1);C(),j();var Fe=b({__name:`NodeContextMenu`,props:{nodeId:{}},emits:[`execute-from-node`,`execute-single-node`],setup(e,{emit:t}){let n=e,i=t,a=U(!1);function o(e){e===`executeFrom`?i(`execute-from-node`,n.nodeId):e===`executeSingle`&&i(`execute-single-node`,n.nodeId)}return(e,t)=>{let n=m,i=r,s=me,c=ne;return O(),T(c,{trigger:`contextmenu`,onCommand:o,onVisibleChange:t[0]||=e=>a.value=e,"popper-class":`flow-node-dropdown`},{dropdown:V(()=>[_(s,null,{default:V(()=>[_(i,{command:`executeFrom`},{default:V(()=>[_(n,null,{default:V(()=>[_(G(fe))]),_:1}),t[1]||=F(` 从此处开始执行 `,-1)]),_:1}),_(i,{command:`executeSingle`},{default:V(()=>[_(n,null,{default:V(()=>[_(G(fe))]),_:1}),t[2]||=F(` 只执行此节点 `,-1)]),_:1})]),_:1})]),default:V(()=>[S(e.$slots,`default`,{dropdownVisible:a.value})]),_:3})}}});C(),j(),v();var Ie={class:`package-json-selector`},Le={class:`selector-container`},Re={class:`option-content`},ze={class:`option-main`},Be={class:`package-name`},Ve={class:`option-path`},$={key:0,class:`empty-hint`},He=Y(b({__name:`PackageJsonSelector`,props:{modelValue:{},placeholder:{},clearable:{type:Boolean},disabled:{type:Boolean}},emits:[`update:modelValue`,`change`],setup(e,{emit:t}){let r=e,s=t,l=U(!1),u=U([]),d=U(``),f=i({get:()=>r.modelValue,set:e=>{d.value=e,s(`update:modelValue`,e);let t=u.value.find(t=>t.fullPath===e);s(`change`,t||null)}}),te=i(()=>u.value.map(e=>({label:e.displayName,value:e.fullPath,relativePath:e.relativePath,version:e.version})));async function h(e){l.value=!0;try{let t=e?`/api/scan-package-files?directory=${encodeURIComponent(e)}`:`/api/scan-package-files`,n=await fetch(t);if(!n.ok)throw Error(`HTTP ${n.status}: ${n.statusText}`);let r=await n.json();if(r.success){u.value=r.packages||[],f.value&&!u.value.some(e=>e.fullPath===f.value)&&(f.value=``);let t=e?`目录 ${e}`:`当前项目`;N.success(`扫描 ${t} 完成,找到 ${u.value.length} 个 package.json 文件`)}else throw Error(r.error||`扫描失败`)}catch(e){console.error(`扫描package.json文件失败:`,e),N.error(`扫描失败: ${e.message}`),u.value=[]}finally{l.value=!1}}async function g(){try{let e=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:``})})).json();e.success?v(e):e.error&&N.error(e.error)}catch(e){N.error(`浏览目录失败: ${e.message}`)}}function v(e){if(!e||!e.items)return;let t=String(e.path||``),n=()=>{let e=String(t||``).trim();if(!e){N.warning(`请输入目录路径`);return}y(e)};de.alert(p(`div`,{class:`directory-browser`},[p(`div`,{class:`current-path`},[p(`span`,{class:`path-label`},`当前路径:`),p(`input`,{class:`path-value`,value:t,onInput:e=>{t=e.target.value},onKeydown:e=>{e.key===`Enter`&&(e.preventDefault(),n())}}),p(`button`,{type:`button`,class:`path-jump-btn`,onClick:n},`跳转`)]),p(`div`,{class:`directory-list`},[e.parentPath?p(`div`,{class:`directory-item parent-dir`,onClick:()=>y(e.parentPath)},[p(`span`,{class:`dir-icon`},p(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-warning)`}},[p(`path`,{d:`M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z`})])),p(`span`,{class:`dir-name`},`返回上级目录`)]):null,...e.items.map(e=>p(`div`,{class:`directory-item`,onClick:()=>y(e.path)},[p(`span`,{class:`dir-icon`},p(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-primary)`}},[p(`path`,{d:`M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z`})])),p(`span`,{class:`dir-name`},e.name)]))])]),`浏览并选择目录`,{confirmButtonText:`确定`,cancelButtonText:`取消`,showCancelButton:!0,customClass:`directory-browser-dialog`,callback:n=>{if(n===`confirm`){let n=String(t||e.path||``).trim();if(!n){N.warning(`请输入目录路径`);return}h(n)}}})}async function y(e){try{de.close(),setTimeout(async()=>{try{let t=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:e})})).json();t.success?v(t):t.error&&N.error(t.error)}catch(e){N.error(`浏览目录失败: ${e.message}`)}},100)}catch(e){N.error(`处理目录选择时出错: ${e.message}`)}}return h(),P(()=>r.modelValue,e=>{d.value=e},{immediate:!0}),(t,r)=>{let i=m,s=c,d=ee,p=ge,v=L;return O(),a(`div`,Ie,[W(`div`,Le,[_(d,{modelValue:f.value,"onUpdate:modelValue":r[0]||=e=>f.value=e,placeholder:e.placeholder||`选择 package.json 文件`,clearable:e.clearable,disabled:e.disabled||l.value,filterable:``,class:`package-select`},{default:V(()=>[(O(!0),a(q,null,k(te.value,e=>(O(),T(s,{key:e.value,label:e.label,value:e.value},{default:V(()=>[W(`div`,Re,[W(`div`,ze,[_(i,{class:`folder-icon`},{default:V(()=>[_(G(re))]),_:1}),W(`span`,Be,D(e.label),1)]),W(`div`,Ve,D(e.relativePath),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`clearable`,`disabled`]),_(p,{icon:l.value?G(n):G(ae),loading:l.value,disabled:e.disabled,size:`default`,onClick:r[1]||=e=>h(),class:`refresh-btn`,title:`刷新当前项目`},{default:V(()=>[F(D(l.value?`扫描中...`:`刷新`),1)]),_:1},8,[`icon`,`loading`,`disabled`]),_(p,{icon:G(ce),disabled:e.disabled||l.value,size:`default`,onClick:g,class:`custom-dir-btn`,title:`浏览并选择其他目录`},{default:V(()=>[...r[2]||=[F(` 其他目录 `,-1)]]),_:1},8,[`icon`,`disabled`])]),u.value.length===0&&!l.value?(O(),a(`div`,$,[_(v,{type:`info`,size:`small`},{default:V(()=>[...r[3]||=[F(` 未找到 package.json 文件,请确保项目包含有效的 package.json `,-1)]]),_:1})])):o(``,!0)])}}}),[[`__scopeId`,`data-v-90913902`]]);C(),v(),j();var Ue={class:`param-list`},We={key:0,class:`param-list__title`},Ge={key:0,class:`param-list__title-text`},Ke={class:`param-list__title-actions`},qe={key:1,class:`param-list__empty`},Je={key:2,class:`param-list__body`},Ye={class:`param-list__row-content`},Xe={key:0,class:`param-list__row-actions`},Ze=Y(b({__name:`ParamListContainer`,props:{modelValue:{},title:{},addable:{type:Boolean},removable:{type:Boolean},minItems:{},createItem:{type:Function},itemKey:{type:Function},disableAdd:{type:Boolean},disableRemove:{type:Function}},emits:[`update:modelValue`,`add`,`remove`],setup(e,{emit:t}){let n=e,r=t,s=i(()=>Array.isArray(n.modelValue)?n.modelValue:[]);function c(){if(!n.addable||n.disableAdd)return;let e=n.createItem;if(!e)return;let t=[...s.value,e()];r(`update:modelValue`,t),r(`add`)}function l(e){if(!n.removable)return;let t=typeof n.minItems==`number`?n.minItems:0;if(s.value.length<=t)return;let i=s.value[e];if(n.disableRemove&&n.disableRemove(i,e))return;let a=[...s.value];a.splice(e,1),r(`update:modelValue`,a),r(`remove`,e)}function d(e,t){return n.itemKey?n.itemKey(e,t):t}return(t,n)=>{let r=ge;return O(),a(`div`,Ue,[e.title!==void 0||e.addable?(O(),a(`div`,We,[e.title?(O(),a(`span`,Ge,D(e.title),1)):o(``,!0),W(`div`,Ke,[S(t.$slots,`title-actions`,{},void 0,!0),e.addable?(O(),T(r,{key:0,type:`primary`,plain:``,icon:G(w),disabled:e.disableAdd||!e.createItem,onClick:c},null,8,[`icon`,`disabled`])):o(``,!0)])])):o(``,!0),s.value.length===0?(O(),a(`div`,qe,[S(t.$slots,`empty`,{},void 0,!0)])):(O(),a(`div`,Je,[(O(!0),a(q,null,k(s.value,(n,i)=>(O(),a(`div`,{key:d(n,i),class:u([`param-list__row`,{"param-list__row--no-actions":!e.removable}])},[W(`div`,Ye,[S(t.$slots,`row`,{item:n,index:i},void 0,!0)]),e.removable?(O(),a(`div`,Xe,[_(r,{type:`danger`,plain:``,icon:G(ue),disabled:typeof e.minItems==`number`&&s.value.length<=e.minItems||(e.disableRemove?e.disableRemove(n,i):!1),onClick:e=>l(i)},null,8,[`icon`,`disabled`,`onClick`])])):o(``,!0)],2))),128))]))])}}}),[[`__scopeId`,`data-v-8f9701ab`]]);C(),j(),v();var Qe={class:`node-input-config`},$e={class:`input-row`},et={class:`input-field param-name-field`},tt={class:`field-label`},nt={class:`input-field type-field`},rt={class:`field-label`},it={class:`input-field value-field`},at={class:`field-label`},ot={class:`tree-node-label`},st={class:`input-field required-field`},ct={class:`field-label`},lt=Y(b({__name:`NodeInputConfig`,props:{modelValue:{},paramNames:{},disableParamNameEdit:{type:Boolean},predecessorNodes:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,s=U([]);P(()=>n.modelValue,e=>{s.value=e?[...e]:[]},{immediate:!0,deep:!0}),P(()=>n.paramNames,e=>{if(!e||e.length===0){s.value=[],r(`update:modelValue`,[]);return}let t=new Map(s.value.map(e=>[e.paramName,e])),n=[];for(let r of e)t.has(r)?n.push(t.get(r)):n.push({paramName:r,inputType:`manual`,required:!1,manualValue:``});s.value=n,r(`update:modelValue`,n)},{immediate:!0});function l(e,t,n){if(!s.value[e])return;let i=[...s.value];i[e]={...i[e],[t]:n},t===`inputType`&&(n===`manual`?(i[e].referenceNodeId=void 0,i[e].referenceOutputKey=void 0):i[e].manualValue=void 0),s.value=i,r(`update:modelValue`,i)}function u(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.data.label||e.id}function d(e){if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config,n=Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[];if(n.length>0)return n.map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}));let r=t?.codeOutputKeys;return(Array.isArray(r)?r:[]).map(e=>String(e||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let f=i(()=>!n.predecessorNodes||n.predecessorNodes.length===0?[]:n.predecessorNodes.map(e=>({value:e.id,label:u(e),children:d(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function p(e,t){if(!t)return;let[n,i]=t.split(`::`),a=[...s.value];a[e]={...a[e],referenceNodeId:n,referenceOutputKey:i},s.value=a,r(`update:modelValue`,a)}function te(e){return e.referenceNodeId&&e.referenceOutputKey?`${e.referenceNodeId}::${e.referenceOutputKey}`:``}return(t,n)=>{let r=ie,i=c,u=ee,d=m,h=A,g=z;return O(),a(`div`,Qe,[_(Ze,{"model-value":s.value,title:void 0,addable:!1,removable:!1},{empty:V(()=>[F(D(G(J)(`@NODEINPUT:命令中未检测到变量参数`)),1)]),row:V(({item:t,index:n})=>[W(`div`,$e,[W(`div`,et,[W(`label`,tt,D(G(J)(`@NODEINPUT:参数名`)),1),_(r,{"model-value":t.paramName,disabled:e.disableParamNameEdit,placeholder:G(J)(`@NODEINPUT:参数名`),size:`default`,"onUpdate:modelValue":e=>l(n,`paramName`,e)},null,8,[`model-value`,`disabled`,`placeholder`,`onUpdate:modelValue`])]),W(`div`,nt,[W(`label`,rt,D(G(J)(`@NODEINPUT:类型`)),1),_(u,{"model-value":t.inputType,placeholder:G(J)(`@NODEINPUT:选择类型`),size:`default`,"onUpdate:modelValue":e=>l(n,`inputType`,e)},{default:V(()=>[_(i,{value:`manual`,label:G(J)(`@NODEINPUT:手动输入`)},null,8,[`label`]),_(i,{value:`reference`,label:G(J)(`@NODEINPUT:引用节点`),disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`model-value`,`placeholder`,`onUpdate:modelValue`])]),W(`div`,it,[W(`label`,at,D(G(J)(`@NODEINPUT:值`)),1),t.inputType===`manual`?(O(),T(r,{key:0,"model-value":t.manualValue,placeholder:G(J)(`@NODEINPUT:输入参数值`),size:`default`,clearable:``,"onUpdate:modelValue":e=>l(n,`manualValue`,e)},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])):(O(),T(h,{key:1,"model-value":te(t),data:f.value,placeholder:G(J)(`@NODEINPUT:选择节点输出`),size:`default`,clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>p(n,e)},{default:V(({data:e})=>[W(`span`,ot,[e.children?o(``,!0):(O(),T(d,{key:0},{default:V(()=>[_(G(I))]),_:1})),F(` `+D(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),W(`div`,st,[W(`label`,ct,D(G(J)(`@NODEINPUT:必填`)),1),_(g,{"model-value":!!t.required,"onUpdate:modelValue":e=>l(n,`required`,e)},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`])])}}}),[[`__scopeId`,`data-v-276799ad`]]);C(),j(),v();var ut={class:`code-node-input-config`},dt={class:`input-row`},ft={class:`input-field name-field`},pt={class:`field-label`},mt={class:`input-field type-field`},ht={class:`field-label`},gt={class:`input-field value-field`},_t={class:`field-label`},vt={class:`input-field action-field`},yt={class:`field-label`},bt=Y(b({__name:`CodeNodeInputConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let r=e,o=n,s=U([]);P(()=>r.modelValue,e=>{s.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function l(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.data.label||e.id}function u(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config;return(Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[]).map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let d=i(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:l(e),children:u(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function f(){return{name:``,source:`reference`,required:!1,ref:{nodeId:``,outputKey:`stdout`}}}function p(){let e=[...s.value,f()];s.value=e,o(`update:modelValue`,e)}t({addRow:p});function m(e,t){if(!s.value[e])return;let n=[...s.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].manualValue===void 0&&(n[e].manualValue=``)):(n[e].manualValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),s.value=n,o(`update:modelValue`,n)}function te(e,t){if(!t)return;let[n,r]=t.split(`::`);m(e,{ref:{nodeId:n,outputKey:r}})}function h(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,n)=>{let r=ie,i=c,l=ee,u=A,p=z;return O(),a(`div`,ut,[_(Ze,{"model-value":s.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":f,"onUpdate:modelValue":n[0]||=e=>o(`update:modelValue`,e)},{empty:V(()=>[F(D(G(J)(`@NODECFG:暂无输入参数`)),1)]),row:V(({item:t,index:n})=>[W(`div`,dt,[W(`div`,ft,[W(`label`,pt,D(G(J)(`@NODECFG:参数名`)),1),_(r,{modelValue:t.name,"onUpdate:modelValue":[e=>t.name=e,e=>m(n,{name:e})],placeholder:G(J)(`@NODECFG:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),W(`div`,mt,[W(`label`,ht,D(G(J)(`@NODECFG:参数值`)),1),_(l,{modelValue:t.source,"onUpdate:modelValue":[e=>t.source=e,e=>m(n,{source:e})],style:{width:`110px`}},{default:V(()=>[_(i,{label:G(J)(`@NODECFG:引用`),value:`reference`,disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`]),_(i,{label:G(J)(`@NODECFG:手动`),value:`manual`},null,8,[`label`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),W(`div`,gt,[W(`label`,_t,D(G(J)(`@NODECFG:值`)),1),t.source===`manual`?(O(),T(r,{key:0,modelValue:t.manualValue,"onUpdate:modelValue":[e=>t.manualValue=e,e=>m(n,{manualValue:e})],placeholder:G(J)(`@NODECFG:请输入`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(O(),T(u,{key:1,"model-value":h(t),data:d.value,placeholder:G(J)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>te(n,e)},null,8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),W(`div`,vt,[W(`label`,yt,D(G(J)(`@NODEINPUT:必填`)),1),_(p,{"model-value":!!t.required,"onUpdate:modelValue":e=>m(n,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-b16df1ae`]]);C(),j(),v();var xt={class:`user-input-param-config`},St={class:`input-row`},Ct={class:`input-field name-field`},wt={class:`field-label`},Tt={class:`input-field type-field`},Et={class:`field-label`},Dt={class:`input-field value-field`},Ot={class:`field-label`},kt={class:`tree-node-label`},At={class:`input-field action-field`},jt={class:`field-label`},Mt=Y(b({__name:`UserInputParamConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let r=e,s=n,l=U([]);P(()=>r.modelValue,e=>{l.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function u(){return{name:``,source:`manual`,defaultValue:``,required:!1}}function d(){let e=[...l.value,u()];l.value=e,s(`update:modelValue`,e)}t({addRow:d});function f(e,t){if(!l.value[e])return;let n=[...l.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].defaultValue===void 0&&(n[e].defaultValue=``)):(n[e].defaultValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),l.value=n,s(`update:modelValue`,n)}function p(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.type===`user_input`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:用户输入`):e.data.label||e.id}function te(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config;return(Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[]).map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let h=i(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:p(e),children:te(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function g(e,t){if(!t)return;let[n,r]=t.split(`::`);f(e,{ref:{nodeId:n,outputKey:r}})}function v(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,n)=>{let i=ie,p=c,te=ee,y=m,b=A,x=z,S=ge;return O(),a(`div`,xt,[_(Ze,{"model-value":l.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":u,"onUpdate:modelValue":n[0]||=e=>s(`update:modelValue`,e)},{empty:V(()=>[F(D(G(J)(`@UINPUT:暂无输入参数`)),1)]),row:V(({item:e,index:t})=>[W(`div`,St,[W(`div`,Ct,[W(`label`,wt,D(G(J)(`@UINPUT:参数名`)),1),_(i,{modelValue:e.name,"onUpdate:modelValue":[t=>e.name=t,e=>f(t,{name:e})],placeholder:G(J)(`@UINPUT:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),W(`div`,Tt,[W(`label`,Et,D(G(J)(`@UINPUT:类型`)),1),_(te,{modelValue:e.source,"onUpdate:modelValue":[t=>e.source=t,e=>f(t,{source:e})],style:{width:`130px`}},{default:V(()=>[_(p,{label:G(J)(`@UINPUT:手动输入`),value:`manual`},null,8,[`label`]),_(p,{label:G(J)(`@UINPUT:引用`),value:`reference`,disabled:!r.predecessorNodes||r.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),W(`div`,Dt,[W(`label`,Ot,D(e.source===`manual`?G(J)(`@UINPUT:默认值`):G(J)(`@UINPUT:引用输出`)),1),e.source===`manual`?(O(),T(i,{key:0,modelValue:e.defaultValue,"onUpdate:modelValue":[t=>e.defaultValue=t,e=>f(t,{defaultValue:e})],placeholder:G(J)(`@UINPUT:默认值`),clearable:``},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(O(),T(b,{key:1,"model-value":v(e),data:h.value,placeholder:G(J)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>g(t,e)},{default:V(({data:e})=>[W(`span`,kt,[e.children?o(``,!0):(O(),T(y,{key:0},{default:V(()=>[_(G(I))]),_:1})),F(` `+D(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),W(`div`,At,[W(`label`,jt,D(G(J)(`@NODEINPUT:必填`)),1),_(x,{"model-value":!!e.required,"onUpdate:modelValue":e=>f(t,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),actions:V(()=>[e.addable===!1?o(``,!0):(O(),T(S,{key:0,type:`primary`,plain:``,size:`small`,onClick:d},{default:V(()=>[F(D(G(J)(`@UINPUT:添加参数`)),1)]),_:1}))]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-dd543a6a`]]);C(),j(),v();var Nt={key:0,class:`config-content`},Pt={class:`config-section`},Ft={class:`section-title`},It={key:0,class:`config-section`},Lt={class:`section-title`},Rt={key:1,class:`config-section`},zt={class:`section-title`},Bt={class:`sub-section`},Vt={class:`sub-title`},Ht={key:0,class:`empty-tip`},Ut={key:1,class:`condition-branch-list`},Wt={class:`branch-main`},Gt={class:`branch-header`},Kt={class:`branch-title`},qt={key:0,class:`branch-badge`},Jt={class:`branch-meta`},Yt={key:0,class:`branch-rules`},Xt={class:`rules-header`},Zt={class:`rule-col`},Qt={class:`field-label`},$t={class:`rule-col`},en={class:`field-label`},tn={class:`rule-col`},nn={class:`field-label`},rn={class:`rule-col`,style:{"align-self":`flex-end`}},an={key:1,class:`branch-default-tip`},on={key:0,class:`branch-actions`},sn={key:2,class:`config-section`},cn={class:`section-title`},ln={key:3,class:`config-section`},un={class:`section-title`},dn={key:4,class:`config-section`},fn={class:`section-title`},pn={key:5,class:`config-section`},mn={class:`section-title`},hn={key:6,class:`config-section`},gn={class:`section-title`},_n={class:`output-param-row`},vn={class:`output-param-field`},yn={class:`field-label`},bn={key:7,class:`config-section`},xn={class:`section-title`},Sn={key:0,class:`empty-tip`},Cn={key:1,class:`command-list`},wn=[`onClick`],Tn={class:`command-info`},En={class:`command-header`},Dn={class:`command-name`},On={key:0,class:`command-desc`},kn={class:`command-code`},An={class:`command-dir`},jn={key:8,class:`config-section`},Mn={class:`section-title`},Nn={style:{"margin-left":`var(--spacing-md)`}},Pn={key:9,class:`config-section`},Fn={class:`section-title`},In={class:`sub-section`},Ln={class:`sub-title`},Rn={class:`code-examples`},zn={class:`examples-title`},Bn={class:`examples-actions`},Vn={key:10,class:`config-section`},Hn={class:`section-title`},Un={class:`reference-tip`},Wn={class:`reference-tip`},Gn={class:`node-option`},Kn={class:`node-name`},qn={class:`node-id`},Jn={class:`reference-tip`},Yn={class:`reference-tip`},Xn={key:11,class:`config-section`},Zn={class:`section-title`},Qn={class:`output-param-row`},$n={class:`output-param-field`},er={class:`field-label`},tr={class:`output-param-field`},nr={class:`field-label`},rr={key:12,class:`config-section`},ir={class:`section-title`},ar={class:`output-param-row`},or={class:`output-param-field`},sr={class:`field-label`},cr={class:`output-param-field`},lr={class:`field-label`},ur={class:`dialog-footer`},dr={class:`footer-actions`},fr=`function main(param) {
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{A as t,At as n,C as r,Cn as i,Dn as a,En as o,Et as s,F as c,G as l,Gr as u,Gt as d,Hn as f,I as ee,In as p,J as m,Jn as te,K as h,M as g,Mn as _,Mr as v,N as y,Pn as b,Pt as x,Qn as S,Rn as C,Rt as w,S as ne,St as re,Tn as T,U as ie,Vt as ae,W as oe,Xn as E,Xr as D,Yn as O,Zn as k,at as se,bt as ce,c as A,ct as le,dr as j,dt as M,i as N,ir as P,jn as F,kt as I,l as L,ln as R,lt as ue,m as z,mr as B,or as V,qn as H,r as de,tn as fe,vn as pe,vr as U,w as me,wn as W,wr as G,x as K,y as he,yn as q,z as ge,zn as _e}from"./element-plus-BFy5M3jt.js";import{b as ve}from"./vendor-BXLxNxh-.js";import{n as J,t as Y}from"./_plugin-vue_export-helper-DcVJ6Vx3.js";import{t as ye}from"./dagre-Dkbv4_Ri.js";import{t as be}from"./SvgIcon-IjDm7vQ-.js";import{t as X}from"./configStore-jJrldIrT.js";import{t as xe}from"./CommonDialog-33jIvgti.js";import{i as Se,l as Ce,n as we,s as Te}from"./vue-flow--96Pa3sG.js";import{V as Z,a as Ee}from"./index-Do0MeO4E.js";import{a as De,c as Oe,i as Q,n as ke,o as Ae,r as je,s as Me,t as Ne}from"./UserInputNode-DE8GEC3J.js";var Pe=e(ye(),1);C(),j();var Fe=b({__name:`NodeContextMenu`,props:{nodeId:{}},emits:[`execute-from-node`,`execute-single-node`],setup(e,{emit:t}){let n=e,i=t,a=U(!1);function o(e){e===`executeFrom`?i(`execute-from-node`,n.nodeId):e===`executeSingle`&&i(`execute-single-node`,n.nodeId)}return(e,t)=>{let n=m,i=r,s=me,c=ne;return O(),T(c,{trigger:`contextmenu`,onCommand:o,onVisibleChange:t[0]||=e=>a.value=e,"popper-class":`flow-node-dropdown`},{dropdown:V(()=>[_(s,null,{default:V(()=>[_(i,{command:`executeFrom`},{default:V(()=>[_(n,null,{default:V(()=>[_(G(fe))]),_:1}),t[1]||=F(` 从此处开始执行 `,-1)]),_:1}),_(i,{command:`executeSingle`},{default:V(()=>[_(n,null,{default:V(()=>[_(G(fe))]),_:1}),t[2]||=F(` 只执行此节点 `,-1)]),_:1})]),_:1})]),default:V(()=>[S(e.$slots,`default`,{dropdownVisible:a.value})]),_:3})}}});C(),j(),v();var Ie={class:`package-json-selector`},Le={class:`selector-container`},Re={class:`option-content`},ze={class:`option-main`},Be={class:`package-name`},Ve={class:`option-path`},$={key:0,class:`empty-hint`},He=Y(b({__name:`PackageJsonSelector`,props:{modelValue:{},placeholder:{},clearable:{type:Boolean},disabled:{type:Boolean}},emits:[`update:modelValue`,`change`],setup(e,{emit:t}){let r=e,s=t,l=U(!1),u=U([]),d=U(``),f=i({get:()=>r.modelValue,set:e=>{d.value=e,s(`update:modelValue`,e);let t=u.value.find(t=>t.fullPath===e);s(`change`,t||null)}}),te=i(()=>u.value.map(e=>({label:e.displayName,value:e.fullPath,relativePath:e.relativePath,version:e.version})));async function h(e){l.value=!0;try{let t=e?`/api/scan-package-files?directory=${encodeURIComponent(e)}`:`/api/scan-package-files`,n=await fetch(t);if(!n.ok)throw Error(`HTTP ${n.status}: ${n.statusText}`);let r=await n.json();if(r.success){u.value=r.packages||[],f.value&&!u.value.some(e=>e.fullPath===f.value)&&(f.value=``);let t=e?`目录 ${e}`:`当前项目`;N.success(`扫描 ${t} 完成,找到 ${u.value.length} 个 package.json 文件`)}else throw Error(r.error||`扫描失败`)}catch(e){console.error(`扫描package.json文件失败:`,e),N.error(`扫描失败: ${e.message}`),u.value=[]}finally{l.value=!1}}async function g(){try{let e=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:``})})).json();e.success?v(e):e.error&&N.error(e.error)}catch(e){N.error(`浏览目录失败: ${e.message}`)}}function v(e){if(!e||!e.items)return;let t=String(e.path||``),n=()=>{let e=String(t||``).trim();if(!e){N.warning(`请输入目录路径`);return}y(e)};de.alert(p(`div`,{class:`directory-browser`},[p(`div`,{class:`current-path`},[p(`span`,{class:`path-label`},`当前路径:`),p(`input`,{class:`path-value`,value:t,onInput:e=>{t=e.target.value},onKeydown:e=>{e.key===`Enter`&&(e.preventDefault(),n())}}),p(`button`,{type:`button`,class:`path-jump-btn`,onClick:n},`跳转`)]),p(`div`,{class:`directory-list`},[e.parentPath?p(`div`,{class:`directory-item parent-dir`,onClick:()=>y(e.parentPath)},[p(`span`,{class:`dir-icon`},p(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-warning)`}},[p(`path`,{d:`M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z`})])),p(`span`,{class:`dir-name`},`返回上级目录`)]):null,...e.items.map(e=>p(`div`,{class:`directory-item`,onClick:()=>y(e.path)},[p(`span`,{class:`dir-icon`},p(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-primary)`}},[p(`path`,{d:`M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z`})])),p(`span`,{class:`dir-name`},e.name)]))])]),`浏览并选择目录`,{confirmButtonText:`确定`,cancelButtonText:`取消`,showCancelButton:!0,customClass:`directory-browser-dialog`,callback:n=>{if(n===`confirm`){let n=String(t||e.path||``).trim();if(!n){N.warning(`请输入目录路径`);return}h(n)}}})}async function y(e){try{de.close(),setTimeout(async()=>{try{let t=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:e})})).json();t.success?v(t):t.error&&N.error(t.error)}catch(e){N.error(`浏览目录失败: ${e.message}`)}},100)}catch(e){N.error(`处理目录选择时出错: ${e.message}`)}}return h(),P(()=>r.modelValue,e=>{d.value=e},{immediate:!0}),(t,r)=>{let i=m,s=c,d=ee,p=ge,v=L;return O(),a(`div`,Ie,[W(`div`,Le,[_(d,{modelValue:f.value,"onUpdate:modelValue":r[0]||=e=>f.value=e,placeholder:e.placeholder||`选择 package.json 文件`,clearable:e.clearable,disabled:e.disabled||l.value,filterable:``,class:`package-select`},{default:V(()=>[(O(!0),a(q,null,k(te.value,e=>(O(),T(s,{key:e.value,label:e.label,value:e.value},{default:V(()=>[W(`div`,Re,[W(`div`,ze,[_(i,{class:`folder-icon`},{default:V(()=>[_(G(re))]),_:1}),W(`span`,Be,D(e.label),1)]),W(`div`,Ve,D(e.relativePath),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`clearable`,`disabled`]),_(p,{icon:l.value?G(n):G(ae),loading:l.value,disabled:e.disabled,size:`default`,onClick:r[1]||=e=>h(),class:`refresh-btn`,title:`刷新当前项目`},{default:V(()=>[F(D(l.value?`扫描中...`:`刷新`),1)]),_:1},8,[`icon`,`loading`,`disabled`]),_(p,{icon:G(ce),disabled:e.disabled||l.value,size:`default`,onClick:g,class:`custom-dir-btn`,title:`浏览并选择其他目录`},{default:V(()=>[...r[2]||=[F(` 其他目录 `,-1)]]),_:1},8,[`icon`,`disabled`])]),u.value.length===0&&!l.value?(O(),a(`div`,$,[_(v,{type:`info`,size:`small`},{default:V(()=>[...r[3]||=[F(` 未找到 package.json 文件,请确保项目包含有效的 package.json `,-1)]]),_:1})])):o(``,!0)])}}}),[[`__scopeId`,`data-v-90913902`]]);C(),v(),j();var Ue={class:`param-list`},We={key:0,class:`param-list__title`},Ge={key:0,class:`param-list__title-text`},Ke={class:`param-list__title-actions`},qe={key:1,class:`param-list__empty`},Je={key:2,class:`param-list__body`},Ye={class:`param-list__row-content`},Xe={key:0,class:`param-list__row-actions`},Ze=Y(b({__name:`ParamListContainer`,props:{modelValue:{},title:{},addable:{type:Boolean},removable:{type:Boolean},minItems:{},createItem:{type:Function},itemKey:{type:Function},disableAdd:{type:Boolean},disableRemove:{type:Function}},emits:[`update:modelValue`,`add`,`remove`],setup(e,{emit:t}){let n=e,r=t,s=i(()=>Array.isArray(n.modelValue)?n.modelValue:[]);function c(){if(!n.addable||n.disableAdd)return;let e=n.createItem;if(!e)return;let t=[...s.value,e()];r(`update:modelValue`,t),r(`add`)}function l(e){if(!n.removable)return;let t=typeof n.minItems==`number`?n.minItems:0;if(s.value.length<=t)return;let i=s.value[e];if(n.disableRemove&&n.disableRemove(i,e))return;let a=[...s.value];a.splice(e,1),r(`update:modelValue`,a),r(`remove`,e)}function d(e,t){return n.itemKey?n.itemKey(e,t):t}return(t,n)=>{let r=ge;return O(),a(`div`,Ue,[e.title!==void 0||e.addable?(O(),a(`div`,We,[e.title?(O(),a(`span`,Ge,D(e.title),1)):o(``,!0),W(`div`,Ke,[S(t.$slots,`title-actions`,{},void 0,!0),e.addable?(O(),T(r,{key:0,type:`primary`,plain:``,icon:G(w),disabled:e.disableAdd||!e.createItem,onClick:c},null,8,[`icon`,`disabled`])):o(``,!0)])])):o(``,!0),s.value.length===0?(O(),a(`div`,qe,[S(t.$slots,`empty`,{},void 0,!0)])):(O(),a(`div`,Je,[(O(!0),a(q,null,k(s.value,(n,i)=>(O(),a(`div`,{key:d(n,i),class:u([`param-list__row`,{"param-list__row--no-actions":!e.removable}])},[W(`div`,Ye,[S(t.$slots,`row`,{item:n,index:i},void 0,!0)]),e.removable?(O(),a(`div`,Xe,[_(r,{type:`danger`,plain:``,icon:G(ue),disabled:typeof e.minItems==`number`&&s.value.length<=e.minItems||(e.disableRemove?e.disableRemove(n,i):!1),onClick:e=>l(i)},null,8,[`icon`,`disabled`,`onClick`])])):o(``,!0)],2))),128))]))])}}}),[[`__scopeId`,`data-v-8f9701ab`]]);C(),j(),v();var Qe={class:`node-input-config`},$e={class:`input-row`},et={class:`input-field param-name-field`},tt={class:`field-label`},nt={class:`input-field type-field`},rt={class:`field-label`},it={class:`input-field value-field`},at={class:`field-label`},ot={class:`tree-node-label`},st={class:`input-field required-field`},ct={class:`field-label`},lt=Y(b({__name:`NodeInputConfig`,props:{modelValue:{},paramNames:{},disableParamNameEdit:{type:Boolean},predecessorNodes:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,s=U([]);P(()=>n.modelValue,e=>{s.value=e?[...e]:[]},{immediate:!0,deep:!0}),P(()=>n.paramNames,e=>{if(!e||e.length===0){s.value=[],r(`update:modelValue`,[]);return}let t=new Map(s.value.map(e=>[e.paramName,e])),n=[];for(let r of e)t.has(r)?n.push(t.get(r)):n.push({paramName:r,inputType:`manual`,required:!1,manualValue:``});s.value=n,r(`update:modelValue`,n)},{immediate:!0});function l(e,t,n){if(!s.value[e])return;let i=[...s.value];i[e]={...i[e],[t]:n},t===`inputType`&&(n===`manual`?(i[e].referenceNodeId=void 0,i[e].referenceOutputKey=void 0):i[e].manualValue=void 0),s.value=i,r(`update:modelValue`,i)}function u(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.data.label||e.id}function d(e){if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config,n=Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[];if(n.length>0)return n.map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}));let r=t?.codeOutputKeys;return(Array.isArray(r)?r:[]).map(e=>String(e||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let f=i(()=>!n.predecessorNodes||n.predecessorNodes.length===0?[]:n.predecessorNodes.map(e=>({value:e.id,label:u(e),children:d(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function p(e,t){if(!t)return;let[n,i]=t.split(`::`),a=[...s.value];a[e]={...a[e],referenceNodeId:n,referenceOutputKey:i},s.value=a,r(`update:modelValue`,a)}function te(e){return e.referenceNodeId&&e.referenceOutputKey?`${e.referenceNodeId}::${e.referenceOutputKey}`:``}return(t,n)=>{let r=ie,i=c,u=ee,d=m,h=A,g=z;return O(),a(`div`,Qe,[_(Ze,{"model-value":s.value,title:void 0,addable:!1,removable:!1},{empty:V(()=>[F(D(G(J)(`@NODEINPUT:命令中未检测到变量参数`)),1)]),row:V(({item:t,index:n})=>[W(`div`,$e,[W(`div`,et,[W(`label`,tt,D(G(J)(`@NODEINPUT:参数名`)),1),_(r,{"model-value":t.paramName,disabled:e.disableParamNameEdit,placeholder:G(J)(`@NODEINPUT:参数名`),size:`default`,"onUpdate:modelValue":e=>l(n,`paramName`,e)},null,8,[`model-value`,`disabled`,`placeholder`,`onUpdate:modelValue`])]),W(`div`,nt,[W(`label`,rt,D(G(J)(`@NODEINPUT:类型`)),1),_(u,{"model-value":t.inputType,placeholder:G(J)(`@NODEINPUT:选择类型`),size:`default`,"onUpdate:modelValue":e=>l(n,`inputType`,e)},{default:V(()=>[_(i,{value:`manual`,label:G(J)(`@NODEINPUT:手动输入`)},null,8,[`label`]),_(i,{value:`reference`,label:G(J)(`@NODEINPUT:引用节点`),disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`model-value`,`placeholder`,`onUpdate:modelValue`])]),W(`div`,it,[W(`label`,at,D(G(J)(`@NODEINPUT:值`)),1),t.inputType===`manual`?(O(),T(r,{key:0,"model-value":t.manualValue,placeholder:G(J)(`@NODEINPUT:输入参数值`),size:`default`,clearable:``,"onUpdate:modelValue":e=>l(n,`manualValue`,e)},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])):(O(),T(h,{key:1,"model-value":te(t),data:f.value,placeholder:G(J)(`@NODEINPUT:选择节点输出`),size:`default`,clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>p(n,e)},{default:V(({data:e})=>[W(`span`,ot,[e.children?o(``,!0):(O(),T(d,{key:0},{default:V(()=>[_(G(I))]),_:1})),F(` `+D(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),W(`div`,st,[W(`label`,ct,D(G(J)(`@NODEINPUT:必填`)),1),_(g,{"model-value":!!t.required,"onUpdate:modelValue":e=>l(n,`required`,e)},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`])])}}}),[[`__scopeId`,`data-v-276799ad`]]);C(),j(),v();var ut={class:`code-node-input-config`},dt={class:`input-row`},ft={class:`input-field name-field`},pt={class:`field-label`},mt={class:`input-field type-field`},ht={class:`field-label`},gt={class:`input-field value-field`},_t={class:`field-label`},vt={class:`input-field action-field`},yt={class:`field-label`},bt=Y(b({__name:`CodeNodeInputConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let r=e,o=n,s=U([]);P(()=>r.modelValue,e=>{s.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function l(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.data.label||e.id}function u(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config;return(Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[]).map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let d=i(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:l(e),children:u(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function f(){return{name:``,source:`reference`,required:!1,ref:{nodeId:``,outputKey:`stdout`}}}function p(){let e=[...s.value,f()];s.value=e,o(`update:modelValue`,e)}t({addRow:p});function m(e,t){if(!s.value[e])return;let n=[...s.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].manualValue===void 0&&(n[e].manualValue=``)):(n[e].manualValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),s.value=n,o(`update:modelValue`,n)}function te(e,t){if(!t)return;let[n,r]=t.split(`::`);m(e,{ref:{nodeId:n,outputKey:r}})}function h(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,n)=>{let r=ie,i=c,l=ee,u=A,p=z;return O(),a(`div`,ut,[_(Ze,{"model-value":s.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":f,"onUpdate:modelValue":n[0]||=e=>o(`update:modelValue`,e)},{empty:V(()=>[F(D(G(J)(`@NODECFG:暂无输入参数`)),1)]),row:V(({item:t,index:n})=>[W(`div`,dt,[W(`div`,ft,[W(`label`,pt,D(G(J)(`@NODECFG:参数名`)),1),_(r,{modelValue:t.name,"onUpdate:modelValue":[e=>t.name=e,e=>m(n,{name:e})],placeholder:G(J)(`@NODECFG:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),W(`div`,mt,[W(`label`,ht,D(G(J)(`@NODECFG:参数值`)),1),_(l,{modelValue:t.source,"onUpdate:modelValue":[e=>t.source=e,e=>m(n,{source:e})],style:{width:`110px`}},{default:V(()=>[_(i,{label:G(J)(`@NODECFG:引用`),value:`reference`,disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`]),_(i,{label:G(J)(`@NODECFG:手动`),value:`manual`},null,8,[`label`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),W(`div`,gt,[W(`label`,_t,D(G(J)(`@NODECFG:值`)),1),t.source===`manual`?(O(),T(r,{key:0,modelValue:t.manualValue,"onUpdate:modelValue":[e=>t.manualValue=e,e=>m(n,{manualValue:e})],placeholder:G(J)(`@NODECFG:请输入`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(O(),T(u,{key:1,"model-value":h(t),data:d.value,placeholder:G(J)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>te(n,e)},null,8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),W(`div`,vt,[W(`label`,yt,D(G(J)(`@NODEINPUT:必填`)),1),_(p,{"model-value":!!t.required,"onUpdate:modelValue":e=>m(n,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-b16df1ae`]]);C(),j(),v();var xt={class:`user-input-param-config`},St={class:`input-row`},Ct={class:`input-field name-field`},wt={class:`field-label`},Tt={class:`input-field type-field`},Et={class:`field-label`},Dt={class:`input-field value-field`},Ot={class:`field-label`},kt={class:`tree-node-label`},At={class:`input-field action-field`},jt={class:`field-label`},Mt=Y(b({__name:`UserInputParamConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let r=e,s=n,l=U([]);P(()=>r.modelValue,e=>{l.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function u(){return{name:``,source:`manual`,defaultValue:``,required:!1}}function d(){let e=[...l.value,u()];l.value=e,s(`update:modelValue`,e)}t({addRow:d});function f(e,t){if(!l.value[e])return;let n=[...l.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].defaultValue===void 0&&(n[e].defaultValue=``)):(n[e].defaultValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),l.value=n,s(`update:modelValue`,n)}function p(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.type===`user_input`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:用户输入`):e.data.label||e.id}function te(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config;return(Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[]).map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let h=i(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:p(e),children:te(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function g(e,t){if(!t)return;let[n,r]=t.split(`::`);f(e,{ref:{nodeId:n,outputKey:r}})}function v(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,n)=>{let i=ie,p=c,te=ee,y=m,b=A,x=z,S=ge;return O(),a(`div`,xt,[_(Ze,{"model-value":l.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":u,"onUpdate:modelValue":n[0]||=e=>s(`update:modelValue`,e)},{empty:V(()=>[F(D(G(J)(`@UINPUT:暂无输入参数`)),1)]),row:V(({item:e,index:t})=>[W(`div`,St,[W(`div`,Ct,[W(`label`,wt,D(G(J)(`@UINPUT:参数名`)),1),_(i,{modelValue:e.name,"onUpdate:modelValue":[t=>e.name=t,e=>f(t,{name:e})],placeholder:G(J)(`@UINPUT:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),W(`div`,Tt,[W(`label`,Et,D(G(J)(`@UINPUT:类型`)),1),_(te,{modelValue:e.source,"onUpdate:modelValue":[t=>e.source=t,e=>f(t,{source:e})],style:{width:`130px`}},{default:V(()=>[_(p,{label:G(J)(`@UINPUT:手动输入`),value:`manual`},null,8,[`label`]),_(p,{label:G(J)(`@UINPUT:引用`),value:`reference`,disabled:!r.predecessorNodes||r.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),W(`div`,Dt,[W(`label`,Ot,D(e.source===`manual`?G(J)(`@UINPUT:默认值`):G(J)(`@UINPUT:引用输出`)),1),e.source===`manual`?(O(),T(i,{key:0,modelValue:e.defaultValue,"onUpdate:modelValue":[t=>e.defaultValue=t,e=>f(t,{defaultValue:e})],placeholder:G(J)(`@UINPUT:默认值`),clearable:``},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(O(),T(b,{key:1,"model-value":v(e),data:h.value,placeholder:G(J)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>g(t,e)},{default:V(({data:e})=>[W(`span`,kt,[e.children?o(``,!0):(O(),T(y,{key:0},{default:V(()=>[_(G(I))]),_:1})),F(` `+D(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),W(`div`,At,[W(`label`,jt,D(G(J)(`@NODEINPUT:必填`)),1),_(x,{"model-value":!!e.required,"onUpdate:modelValue":e=>f(t,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),actions:V(()=>[e.addable===!1?o(``,!0):(O(),T(S,{key:0,type:`primary`,plain:``,size:`small`,onClick:d},{default:V(()=>[F(D(G(J)(`@UINPUT:添加参数`)),1)]),_:1}))]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-dd543a6a`]]);C(),j(),v();var Nt={key:0,class:`config-content`},Pt={class:`config-section`},Ft={class:`section-title`},It={key:0,class:`config-section`},Lt={class:`section-title`},Rt={key:1,class:`config-section`},zt={class:`section-title`},Bt={class:`sub-section`},Vt={class:`sub-title`},Ht={key:0,class:`empty-tip`},Ut={key:1,class:`condition-branch-list`},Wt={class:`branch-main`},Gt={class:`branch-header`},Kt={class:`branch-title`},qt={key:0,class:`branch-badge`},Jt={class:`branch-meta`},Yt={key:0,class:`branch-rules`},Xt={class:`rules-header`},Zt={class:`rule-col`},Qt={class:`field-label`},$t={class:`rule-col`},en={class:`field-label`},tn={class:`rule-col`},nn={class:`field-label`},rn={class:`rule-col`,style:{"align-self":`flex-end`}},an={key:1,class:`branch-default-tip`},on={key:0,class:`branch-actions`},sn={key:2,class:`config-section`},cn={class:`section-title`},ln={key:3,class:`config-section`},un={class:`section-title`},dn={key:4,class:`config-section`},fn={class:`section-title`},pn={key:5,class:`config-section`},mn={class:`section-title`},hn={key:6,class:`config-section`},gn={class:`section-title`},_n={class:`output-param-row`},vn={class:`output-param-field`},yn={class:`field-label`},bn={key:7,class:`config-section`},xn={class:`section-title`},Sn={key:0,class:`empty-tip`},Cn={key:1,class:`command-list`},wn=[`onClick`],Tn={class:`command-info`},En={class:`command-header`},Dn={class:`command-name`},On={key:0,class:`command-desc`},kn={class:`command-code`},An={class:`command-dir`},jn={key:8,class:`config-section`},Mn={class:`section-title`},Nn={style:{"margin-left":`var(--spacing-md)`}},Pn={key:9,class:`config-section`},Fn={class:`section-title`},In={class:`sub-section`},Ln={class:`sub-title`},Rn={class:`code-examples`},zn={class:`examples-title`},Bn={class:`examples-actions`},Vn={key:10,class:`config-section`},Hn={class:`section-title`},Un={class:`reference-tip`},Wn={class:`reference-tip`},Gn={class:`node-option`},Kn={class:`node-name`},qn={class:`node-id`},Jn={class:`reference-tip`},Yn={class:`reference-tip`},Xn={key:11,class:`config-section`},Zn={class:`section-title`},Qn={class:`output-param-row`},$n={class:`output-param-field`},er={class:`field-label`},tr={class:`output-param-field`},nr={class:`field-label`},rr={key:12,class:`config-section`},ir={class:`section-title`},ar={class:`output-param-row`},or={class:`output-param-field`},sr={class:`field-label`},cr={class:`output-param-field`},lr={class:`field-label`},ur={class:`dialog-footer`},dr={class:`footer-actions`},fr=`function main(param) {
|
|
2
2
|
const out = new Object()
|
|
3
3
|
out.key0 = param.input
|
|
4
4
|
return out
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{Cn as e,D as t,Dn as n,En as r,F as i,Gn as a,Gr as o,Hn as s,I as c,J as l,L as u,Mn as d,Mr as f,Pn as p,Rn as m,Tn as h,U as ee,Ut as te,W as ne,Xr as g,Yn as _,Zn as v,_n as y,a as re,ct as ie,dr as ae,f as oe,gn as se,i as b,ir as x,jn as S,ln as C,or as w,p as ce,pt as le,qn as ue,qr as de,r as fe,sr as pe,vn as T,vr as E,vt as me,wn as D,wr as O,wt as he,yn as k,z as A}from"./element-plus-
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{Cn as e,D as t,Dn as n,En as r,F as i,Gn as a,Gr as o,Hn as s,I as c,J as l,L as u,Mn as d,Mr as f,Pn as p,Rn as m,Tn as h,U as ee,Ut as te,W as ne,Xr as g,Yn as _,Zn as v,_n as y,a as re,ct as ie,dr as ae,f as oe,gn as se,i as b,ir as x,jn as S,ln as C,or as w,p as ce,pt as le,qn as ue,qr as de,r as fe,sr as pe,vn as T,vr as E,vt as me,wn as D,wr as O,wt as he,yn as k,z as A}from"./element-plus-BFy5M3jt.js";import{n as j,t as M}from"./_plugin-vue_export-helper-DcVJ6Vx3.js";import{t as ge}from"./CommonDialog-33jIvgti.js";import{B as _e,D as ve,L as ye,V as be,z as xe}from"./index-Do0MeO4E.js";var N=[`#f14e32`,`#1e88e5`,`#43a047`,`#fb8c00`,`#8e24aa`,`#00acc1`,`#d81b60`,`#7cb342`,`#5e35b1`,`#00897b`];function P(e){return 10+e*14}function F(e){return N[e%N.length]}function I(e){if(!e)return[];let t=[];for(let n of e.split(`,`)){let e=n.trim();if(!e||e===`HEAD`||e.startsWith(`tag:`))continue;let r=e.match(/^HEAD\s*->\s*(.+)$/);t.push((r?r[1]:e).trim())}return t}function Se(e){let t=new Map,n=new Map;for(let r of e){let e=t.get(r.hash)??new Set;for(let t of I(r.branch))e.add(t);n.set(r.hash,Array.from(e));for(let n of r.parents??[]){let r=t.get(n)??new Set;for(let t of e)r.add(t);t.set(n,r)}}return n}function Ce(e){let t=[],n=[],r=0,i=0,a=new Set(e.map(e=>e.hash)),o=e=>t.findIndex(t=>t!==null&&t.hash===e),s=()=>{let e=t.findIndex(e=>e===null);return e===-1?(t.push(null),t.length-1):e};for(let c of e){let e=Array.isArray(c.parents)?c.parents:[],l=t.slice(),u=o(c.hash),d,f=!1;u===-1?(f=!0,u=s(),d=r++):d=t[u].colorIdx,t[u]=null;let p=[],m=new Set;for(let e=0;e<t.length;e++){let n=t[e];n!==null&&n.hash===c.hash&&(p.push({fromLane:e,color:F(n.colorIdx),branches:[],_hash:c.hash}),t[e]=null,m.add(e))}let h=[],ee=F(d);if(e.length>0){let n=e[0],i=o(n);i===-1?a.has(n)&&(t[u]={hash:n,colorIdx:d},h.push({toLane:u,color:ee,kind:`straight`,branches:[],_hash:n})):(h.push({toLane:i,color:ee,kind:i===u?`straight`:`curve`,branches:[],_hash:n}),i===u&&(t[u]={hash:n,colorIdx:d}));for(let n of e.slice(1)){let e=o(n);if(e!==-1)h.push({toLane:e,color:ee,kind:e===u?`straight`:`curve`,branches:[],_hash:n});else if(a.has(n)){let e=s(),i=r++;t[e]={hash:n,colorIdx:i},h.push({toLane:e,color:F(i),kind:e===u?`straight`:`curve`,branches:[],_hash:n})}}}let te=t.slice();i=Math.max(i,t.length);let ne=[];for(let e=0;e<l.length;e++){let t=l[e];t!==null&&(e===u||m.has(e)||e<te.length&&te[e]!==null&&te[e].hash===t.hash&&ne.push({lane:e,color:F(t.colorIdx),branches:[],_hash:t.hash}))}n.push({hash:c.hash,commitLane:u,color:ee,isMerge:e.length>1,isHead:f,hasTopLine:!f,passes:ne,topCurves:p,bottomEdges:h,branches:[]})}let c=Se(e),l=e=>c.get(e)??[];for(let e of n){e.branches=l(e.hash);for(let t of e.passes)t.branches=l(t._hash),delete t._hash;for(let t of e.topCurves)t.branches=l(t._hash),delete t._hash;for(let t of e.bottomEdges)t.branches=l(t._hash),delete t._hash}let u=i>0?20+(i-1)*14:0;return{rows:n,maxLanes:i,width:u}}m(),ae(),f();var we={class:`graph-wrap`},Te=[`viewBox`],Ee=[`x1`,`x2`,`stroke`],De=[`x1`,`x2`],L=[`d`,`stroke`],Oe=[`d`],ke=[`x1`,`x2`,`stroke`],R=[`d`,`stroke`],z=[`d`],B={class:`graph-layer graph-nodes`,"aria-hidden":`true`},V=[`cx`,`stroke`],H=[`cx`,`fill`],U=[`cx`,`stroke`],W=[`cx`],G=-1,Ae=M(p({__name:`CommitGraphCell`,props:{layout:{},width:{}},setup(t){let i=t,a=e(()=>P(i.layout.commitLane)),o=j(`@A1833:暂不属于任何分支`);function s(e){return e.length>0?e.join(`, `):o}let c=e(()=>`${i.layout.hash.slice(0,7)} · ${s(i.layout.branches)}`),l=e(()=>i.layout.passes.map(e=>({x:P(e.lane),color:e.color,title:s(e.branches)}))),u=e(()=>i.layout.topCurves.map(e=>{let t=P(e.fromLane),n=a.value;return{d:`M ${t} ${G} C ${t} ${15/2}, ${n} ${15/2}, ${n} 15`,color:e.color,title:s(e.branches)}})),d=e(()=>i.layout.bottomEdges.map(e=>{let t=a.value,n=P(e.toLane);return{d:e.kind===`straight`||t===n?`M ${t} 15 L ${n} 31`:`M ${t} 15 C ${t} 23, ${n} 23, ${n} 31`,color:e.color,title:s(e.branches)}}));return(e,i)=>(_(),n(`div`,we,[(_(),n(`svg`,{class:`graph-layer graph-lines`,viewBox:`0 0 ${t.width} ${O(30)}`,preserveAspectRatio:`none`,"aria-hidden":`true`},[(_(!0),n(k,null,v(l.value,(e,t)=>(_(),n(`line`,{key:`p`+t,x1:e.x,y1:G,x2:e.x,y2:31,stroke:e.color,"stroke-width":`2`},[D(`title`,null,g(e.title),1)],8,Ee))),128)),(_(!0),n(k,null,v(l.value,(e,t)=>(_(),n(`line`,{key:`ph`+t,x1:e.x,y1:G,x2:e.x,y2:31,stroke:`transparent`,"stroke-width":`8`},[D(`title`,null,g(e.title),1)],8,De))),128)),(_(!0),n(k,null,v(u.value,(e,t)=>(_(),n(`path`,{key:`t`+t,d:e.d,stroke:e.color,"stroke-width":`2`,fill:`none`},[D(`title`,null,g(e.title),1)],8,L))),128)),(_(!0),n(k,null,v(u.value,(e,t)=>(_(),n(`path`,{key:`th`+t,d:e.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[D(`title`,null,g(e.title),1)],8,Oe))),128)),t.layout.hasTopLine?(_(),n(`line`,{key:0,x1:a.value,y1:G,x2:a.value,y2:15,stroke:t.layout.color,"stroke-width":`2`},[D(`title`,null,g(s(t.layout.branches)),1)],8,ke)):r(``,!0),(_(!0),n(k,null,v(d.value,(e,t)=>(_(),n(`path`,{key:`b`+t,d:e.d,stroke:e.color,"stroke-width":`2`,fill:`none`},[D(`title`,null,g(e.title),1)],8,R))),128)),(_(!0),n(k,null,v(d.value,(e,t)=>(_(),n(`path`,{key:`bh`+t,d:e.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[D(`title`,null,g(e.title),1)],8,z))),128))],8,Te)),(_(),n(`svg`,B,[D(`g`,null,[D(`title`,null,g(c.value),1),t.layout.isMerge?(_(),n(`circle`,{key:0,cx:a.value,cy:`50%`,r:`4.5`,fill:`var(--bg-panel, #fff)`,stroke:t.layout.color,"stroke-width":`2`},null,8,V)):(_(),n(`circle`,{key:1,cx:a.value,cy:`50%`,r:`4`,fill:t.layout.color},null,8,H)),t.layout.isHead?(_(),n(`circle`,{key:2,cx:a.value,cy:`50%`,r:`7`,fill:`none`,stroke:t.layout.color,"stroke-width":`1.5`,opacity:`0.55`},null,8,U)):r(``,!0),D(`circle`,{cx:a.value,cy:`50%`,r:`9`,fill:`transparent`},null,8,W)])]))]))}}),[[`__scopeId`,`data-v-1288d6a2`]]);m(),ae(),f(),C();var je={class:`log-header`},Me={class:`header-left`},Ne={class:`log-actions`},Pe={viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,style:{display:`block`}},Fe={key:1,viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`currentColor`,style:{display:`block`}},Ie={key:0,class:`filter-panel-header`},Le={class:`filter-form`},Re={class:`filter-item`},ze={class:`compact-label`},Be={class:`filter-item`},Ve={class:`compact-label`},He={class:`filter-item`},Ue={class:`compact-label`},We={class:`filter-item`},Ge={class:`compact-label`},Ke={class:`filter-actions`},qe={key:0,role:`alert`,class:`log-error`},Je={key:1,class:`log-empty-state`},Ye={class:`log-empty-text`},Xe={key:2,class:`content-area-content`},Ze={class:`table-view-container`},Qe={class:`commit-message-cell`},$e={class:`message-content`},et={key:0,class:`branch-container`},tt={class:`message-text`},nt={class:`author-name`},rt=[`title`,`aria-label`,`onClick`],it={class:`commit-detail-container`},at={key:0,class:`commit-info`},ot={class:`commit-info-row`},st={class:`info-item date-item`},ct={class:`info-label`},lt={class:`info-value`},ut={class:`info-item branch-item`},dt={class:`info-label`},ft={key:0,class:`branch-container`},pt={key:1,class:`info-value info-value-muted`},mt={class:`info-item message-item`},ht={class:`info-label`},gt={class:`info-message-wrapper`},_t={class:`info-message-title`},vt=[`innerHTML`],yt=[`aria-label`,`onKeydown`],bt=`zen-gitsync:log-show-graph`,xt=M(p({__name:`LogList`,setup(f,{expose:p}){let m=_e(),ae=xe(),C=E([]),M=E(``),N=E(!1),P=e(()=>m.isLoadingLog||N.value),F=E(!1),I=E(localStorage.getItem(bt)!==`false`);x(I,e=>{localStorage.setItem(bt,String(e))});let we=e(()=>I.value&&C.value.length>0?Ce(C.value):null),Te=e(()=>{let e=new Map;if(we.value)for(let t of we.value.rows)e.set(t.hash,t);return e}),Ee=e(()=>Math.max(we.value?.width??0,28)),De=e(()=>Se(C.value)),L=E(!1),Oe=E(null),ke=E(!1),R=E(null),z=E([]),B=E(``),V=E(!1),H=E(``),U=E(`full-new`),W=E(``),G=E(``),xt=e(()=>R.value?De.value.get(R.value.hash)??[]:[]),K=E(!1),St=e(()=>R.value?.message?R.value.message.split(`
|
|
2
2
|
`)[0].trim():``),Ct=e(()=>R.value?.message?R.value.message.split(`
|
|
3
3
|
`).slice(1).join(`
|
|
4
4
|
`).trim():``),wt=e(()=>Ct.value.length>0),Tt=e(()=>Ct.value.replace(/\n/g,`<br>`)),q=E(!1),Et=E([]),Dt=E(``),J=E(null),Ot=E([]),kt=E([]),At=E([]),jt=E(!1),Mt=E(0),Nt=E(0),Y=E(null),Pt=E(null),Ft=e(()=>C.value),It=e(()=>z.value.map(e=>({path:e,name:e.split(`/`).pop()||e})));async function X(e=!1,t=1){let n=_e();if(!n.isGitRepo){M.value=`当前目录不是Git仓库`;return}try{t>1?L.value=!0:N.value=!0;let r=new URLSearchParams;r.append(`page`,t.toString()),r.append(`all`,e.toString()),r.append(`with_parents`,`true`),Et.value.length>0&&r.append(`author`,Et.value.join(`,`)),kt.value.length>0&&r.append(`branch`,kt.value.join(`,`)),Dt.value&&r.append(`message`,Dt.value),J.value&&Array.isArray(J.value)&&J.value.length===2&&(r.append(`dateFrom`,J.value[0]),r.append(`dateTo`,J.value[1])),r.append(`_t`,Date.now().toString());let i=await(await fetch(`/api/log?${r.toString()}`)).json();if(!i||!i.data||!Array.isArray(i.data)){M.value=`加载提交历史失败: 服务器返回数据格式不正确`;return}let a=t>1;a&&Array.isArray(i.data)?C.value=C.value.concat(i.data):Array.isArray(i.data)&&(C.value=i.data),n.currentPage=t,n.totalCommits=i.total??C.value.length,n.hasMoreData=i.hasMore===!0,!a&&!e&&s(()=>{Ut(),setTimeout(Sn,200)}),M.value=``}catch(e){M.value=`加载提交历史失败: `+(e instanceof Error?e.message:String(e)),t>1&&(n.hasMoreData=!1)}finally{t>1?L.value=!1:N.value=!1}}function Lt(e){return e.includes(`HEAD -> `)?e.replace(`HEAD -> `,``):e.includes(`origin/`)?e:e.trim()}function Rt(e){return e.includes(`HEAD`)?`success`:e.includes(`origin/`)?`warning`:`info`}function zt(e){return e?e.length>60||e.includes(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{Cn as e,Ct as t,Dn as n,En as r,Gn as i,Gr as a,J as o,L as s,Mn as c,Mr as l,Pn as u,Rn as d,Rt as f,Tn as p,Vt as m,W as h,Xr as g,Y as _,Yn as v,Zn as y,a as b,dr as x,gn as S,ht as C,i as w,ir as T,jn as E,ln as D,lt as ee,or as O,pt as te,qn as k,qr as ne,r as A,sr as j,vn as M,vr as N,wn as P,wr as F,xn as re,xt as ie,yn as I,z as ae}from"./element-plus-DTtm3XCd.js";import{C as oe,S as L,m as se}from"./vendor-O17eRefg.js";import{n as R,t as z}from"./_plugin-vue_export-helper-Bsx6Zj3t.js";import{r as ce,t as B}from"./configStore-DQSKV2_Y.js";import{n as le,t as ue}from"./flow-mindmap-JxOspgwx.js";import{i as V,x as de}from"./index-BApctCNq.js";x(),d();function H(e){let t=(e||``).trim();if(!t)return``;let n=t.replace(/[\\/]+$/,``);return n?/^[a-z]:$/i.test(n)?`${n}\\`:n:t}function U(e){return H(e).replace(/\//g,`\\`).replace(/\\+$/,``).toLowerCase()}function W(e,t){let n=U(e),r=U(t);return!n||!r?!1:n===r||n.startsWith(r.endsWith(`\\`)?r:`${r}\\`)}function G(e){let t=Math.max(e.lastIndexOf(`\\`),e.lastIndexOf(`/`));return t>0?e.slice(0,t):e}var fe=L(`mindmap`,()=>{let t=B(),n=N([]),r=N([]),i=N(null),a=N(!1),o=N(!1),s=N(null),c=N(``),l=N(``),u=e(()=>i.value!==null),d=e(()=>r.value.reduce((e,t)=>e+t.files.length,0)),f=e(()=>r.value.some(e=>e.loading));function p(){t.ui.mindmapDirs=[...n.value]}function m(e){return r.value.find(t=>U(t.dir)===U(e))}function h(e){let t=m(e);if(t)return t;let n={dir:e,files:[],error:null,loading:!1};return r.value.push(n),n}function g(e){let t=H(e);return!t||n.value.some(e=>U(e)===U(t))?!1:(n.value.push(t),h(t),!0)}let _=new Map;async function v(e){let t=m(e);if(!t)return;let r=U(t.dir),i=(_.get(r)||0)+1;_.set(r,i),t.loading=!0,t.error=null;try{let e=await(await fetch(`/api/mindmap/list?dir=${encodeURIComponent(t.dir)}`)).json();if(_.get(r)!==i)return;if(e.success){let r=typeof e.dir==`string`&&e.dir?e.dir:t.dir;if(r!==t.dir){let e=n.value.findIndex(e=>U(e)===U(t.dir));e>=0&&(n.value[e]=r),t.dir=r,p()}t.files=e.files||[]}else t.error=e.error||`读取目录失败`,t.files=[]}catch(e){if(_.get(r)!==i)return;t.error=e?.message||String(e),t.files=[]}finally{_.get(r)===i&&(t.loading=!1)}}async function y(){await Promise.all(n.value.map(e=>v(e)))}async function b(){let e=Array.isArray(t.ui.mindmapDirs)?t.ui.mindmapDirs:[];for(let t of e)g(t);c.value&&!n.value.some(e=>U(e)===U(c.value))&&(c.value=``),await y()}async function x(e){let t=[];for(let n of e||[]){let e=H(n);e&&g(e)&&t.push(e)}return t.length===0?0:(p(),c.value||=t[0],await Promise.all(t.map(e=>v(e))),t.length)}function S(e){let t=U(e);n.value=n.value.filter(e=>U(e)!==t),r.value=r.value.filter(e=>U(e.dir)!==t),_.delete(t),c.value&&U(c.value)===t&&(c.value=``),p()}function C(){if(n.value.length===0)return{dir:null,ambiguous:!1};let e=n.value.find(e=>U(e)===U(c.value));if(e)return{dir:e,ambiguous:!1};let t=i.value?.path;if(t){let e=n.value.find(e=>W(t,e));if(e)return{dir:e,ambiguous:!1}}return n.value.length===1?{dir:n.value[0],ambiguous:!1}:{dir:null,ambiguous:!0}}async function w(e,t=!1){if(!t&&a.value&&i.value)throw Error(`UNSAVED_CHANGES`);o.value=!0,s.value=null;try{let t=await(await fetch(`/api/mindmap/read?path=${encodeURIComponent(e)}`)).json();if(t.success){i.value={path:t.path,title:t.title,content:t.content,mtime:t.mtime},l.value=t.content,a.value=!1;let e=n.value.find(e=>W(t.path,e));c.value=e||G(t.path)}else s.value=t.error||`读取文件失败`}catch(e){s.value=e?.message||String(e)}finally{o.value=!1}}async function T(e,t=!1,n){let r=n?H(n):C().dir;if(!r)throw Error(`未选择目录`);if(!t&&a.value&&i.value)throw Error(`UNSAVED_CHANGES`);o.value=!0,s.value=null;try{let t=await(await fetch(`/api/mindmap/create`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({dir:r,name:e})})).json();if(t.success)i.value={path:t.path,title:t.title,content:t.content,mtime:t.mtime},l.value=t.content,a.value=!1,c.value=r,await v(r);else throw s.value=t.error||`新建失败`,Error(t.error||`新建失败`)}catch(e){throw e.message===`UNSAVED_CHANGES`||(s.value=e?.message||String(e)),e}finally{o.value=!1}}async function E(e){if(!i.value)throw Error(`没有打开的文件`);o.value=!0,s.value=null;try{let t=await(await fetch(`/api/mindmap/save`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:i.value.path,content:e})})).json();if(t.success){let n=i.value.path;return i.value&&(i.value.content=e,i.value.mtime=t.mtime),l.value=e,a.value=!1,await D(n),t}throw s.value=t.error||`保存失败`,Error(t.error||`保存失败`)}catch(e){throw s.value=e?.message||String(e),e}finally{o.value=!1}}async function D(e){let t=r.value.find(t=>W(e,t.dir));t&&await v(t.dir)}async function ee(e){let t=await(await fetch(`/api/mindmap/delete`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})})).json();if(!t.success)throw Error(t.error||`删除失败`);return i.value&&i.value.path===e&&(i.value=null,a.value=!1,l.value=``),await D(e),t}async function O(e,t){let n=await(await fetch(`/api/mindmap/rename`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,newName:t})})).json();if(!n.success)throw Error(n.error||`重命名失败`);return i.value&&e===i.value.path&&(i.value={...i.value,path:n.path,title:t}),await D(n.path||e),n}function te(){i.value&&(a.value=!0)}function k(){i.value=null,a.value=!1,l.value=``}return{dirs:n,groups:r,current:i,dirty:a,loading:o,refreshing:f,error:s,activeDir:c,hasCurrent:u,filesCount:d,init:b,addDirs:x,removeDir:S,refresh:y,refreshDir:v,resolveTargetDir:C,openFile:w,createFile:T,saveCurrent:E,deleteFile:ee,renameFile:O,markDirty:te,closeCurrent:k}});d(),x(),l(),D();var pe={class:`mindmap-view`},me={class:`mm-toolbar`},he={class:`mm-toolbar-left`},ge={class:`mm-dir-tooltip`},_e={key:1,class:`mm-dir-empty`},ve={class:`mm-toolbar-right`},ye={key:0,class:`mm-status`},be=[`title`],xe={key:0,class:`mm-status-dirty`},Se={class:`mm-body`},Ce={class:`mm-sidebar`},we={class:`mm-sidebar-header`},Te={class:`mm-sidebar-title`},Ee={class:`mm-sidebar-list`},De={key:0,class:`mm-sidebar-error`},Oe=[`title`,`onClick`,`onContextmenu`],ke={class:`mm-group-info`},Ae={class:`mm-group-name`},je={class:`mm-group-title`},Me={class:`mm-group-count`},Ne={class:`mm-group-path`},Pe={class:`mm-group-body`},Fe=[`title`],Ie=[`onClick`],Le={class:`mm-file-info`},Re=[`title`],ze={class:`mm-file-meta`},Be={class:`mm-editor`},Ve=1500,K=z(u({__name:`MindmapView`,setup(l){let u=fe(),d=B(),{currentLocale:x}=oe(ce()),D=e(()=>{let e=d.theme;return e===`dark`?!0:e===`light`?!1:window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}),L=N(null),z=N(!1);function H(){z.value=!0}async function U(e){z.value=!1;let t=(e||[]).filter(Boolean);if(t.length!==0)try{let e=await u.addDirs(t);e>0?w.success(R(`@MINDMAP:已添加目录`,{n:e})):w.info(R(`@MINDMAP:重复目录已忽略`))}catch(e){w.error(e?.message||R(`@MINDMAP:读取目录失败`))}}let G=N({});function K(e){G.value={...G.value,[e]:!G.value[e]},u.activeDir=e}function He(e){let t=e.replace(/[\\/]+$/,``).split(/[\\/]/);return t[t.length-1]||e}function Ue(e){return!!u.activeDir&&u.activeDir.toLowerCase()===e.toLowerCase()}function q(){let{dir:e,ambiguous:t}=u.resolveTargetDir();return e||(w.warning(R(t?`@MINDMAP:请选择目标目录`:`@MINDMAP:请先添加目录`)),null)}async function We(e){let t=e||q();if(!t||(e&&(u.activeDir=e),!await Ke()))return;let n=``;try{n=(await A.prompt(R(`@MINDMAP:输入文件名提示`),R(`@MINDMAP:新建思维导图`),{confirmButtonText:R(`@MINDMAP:新建`),cancelButtonText:R(`@MINDMAP:取消`),inputPlaceholder:R(`@MINDMAP:文件名占位`),inputValidator:e=>!e||!e.trim()?R(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||R(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await u.createFile(n,!0,t),w.success(R(`@MINDMAP:已新建并打开`))}catch(e){w.error(e?.message||R(`@MINDMAP:新建失败`))}}async function J(e=!1){if(u.current)try{let t=L.value?.exportData();if(!t){e||w.warning(R(`@MINDMAP:无法获取数据`));return}await u.saveCurrent(t),e||w.success(R(`@MINDMAP:已保存`))}catch(e){w.error(e?.message||R(`@MINDMAP:保存失败`))}}let Y=null;function Ge(){u.current&&u.dirty&&(Y&&clearTimeout(Y),Y=setTimeout(()=>{Y=null,u.current&&u.dirty&&J(!0)},Ve))}function X(){Y&&=(clearTimeout(Y),null)}async function Ke(){if(!u.dirty||!u.current)return!0;try{await A.confirm(R(`@MINDMAP:未保存提示`,{title:u.current.title}),R(`@MINDMAP:未保存的改动`),{confirmButtonText:R(`@MINDMAP:保存`),cancelButtonText:R(`@MINDMAP:丢弃`),distinguishCancelAndClose:!0,type:`warning`}),X();let e=L.value?.exportData();return e&&(await u.saveCurrent(e),w.success(R(`@MINDMAP:已保存`))),!0}catch(e){return e===`cancel`&&(X(),!0)}}async function qe(e){if(!(u.current&&u.current.path===e)&&await Ke())try{await u.openFile(e,!0)}catch(e){w.error(e?.message||R(`@MINDMAP:打开失败`))}}async function Je(e){let t=!!u.current&&W(u.current.path,e),n=R(`@MINDMAP:确认移除目录提示`,{dir:e});t&&(n=`${n} ${R(`@MINDMAP:当前文件将保持打开`)}`);try{await A.confirm(n,R(`@MINDMAP:移除目录`),{confirmButtonText:R(`@MINDMAP:移除目录`),cancelButtonText:R(`@MINDMAP:取消`),type:`warning`})}catch{return}u.removeDir(e),w.success(R(`@MINDMAP:已移除目录`))}let Z=N(null);function Ye(e,t){e.preventDefault(),Z.value={x:e.clientX,y:e.clientY,dir:t}}function Q(){Z.value=null}async function Xe(){let e=Z.value?.dir;if(Q(),!e)return;let t=await de(e);t.success?w.success(t.message||R(`@MINDMAP:已在文件管理器中打开`)):w.error(t.error||R(`@MINDMAP:打开目录失败`))}function Ze(){let e=Z.value?.dir;Q(),e&&We(e)}function Qe(){let e=Z.value?.dir;Q(),e&&Je(e)}async function $e(e){try{await A.confirm(R(`@MINDMAP:确认删除提示`,{title:e.title}),R(`@MINDMAP:删除`),{confirmButtonText:R(`@MINDMAP:删除`),cancelButtonText:R(`@MINDMAP:取消`),type:`warning`})}catch{return}try{await u.deleteFile(e.path),w.success(R(`@MINDMAP:已删除`))}catch(e){w.error(e?.message||R(`@MINDMAP:删除失败`))}}async function et(e){let t=``;try{t=(await A.prompt(R(`@MINDMAP:输入新名称提示`),R(`@MINDMAP:重命名`),{confirmButtonText:R(`@MINDMAP:确定`),cancelButtonText:R(`@MINDMAP:取消`),inputValue:e.title,inputValidator:e=>!e||!e.trim()?R(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||R(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await u.renameFile(e.path,t),w.success(R(`@MINDMAP:已重命名`))}catch(e){w.error(e?.message||R(`@MINDMAP:重命名失败`))}}function tt(e){u.markDirty(),Ge()}function nt(e){}async function rt(e){let t=e||q();if(!t)return;let n=``,r=``;try{n=(await A.prompt(R(`@MINDMAP:粘贴Markdown提示`),R(`@MINDMAP:从Markdown导入`),{confirmButtonText:R(`@MINDMAP:导入`),cancelButtonText:R(`@MINDMAP:取消`),inputType:`textarea`,inputPlaceholder:R(`@MINDMAP:Markdown占位`),inputValidator:e=>!e||!e.trim()?R(`@MINDMAP:内容不能为空`):!0})).value}catch{return}try{r=(await A.prompt(R(`@MINDMAP:输入文件名提示`),R(`@MINDMAP:文件名`),{confirmButtonText:R(`@MINDMAP:新建`),cancelButtonText:R(`@MINDMAP:取消`),inputValidator:e=>!e||!e.trim()?R(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||R(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await u.createFile(r,!0,t);let e=ue(n,r),i=JSON.stringify(e,null,2);await u.saveCurrent(i),w.success(R(`@MINDMAP:已导入`))}catch(e){w.error(e?.message||R(`@MINDMAP:导入失败`))}}async function it(){if(L.value)try{let e=L.value.getMarkdown();await navigator.clipboard.writeText(e),w.success(R(`@MINDMAP:已复制Markdown`))}catch(e){w.error(e?.message||R(`@MINDMAP:复制失败`))}}function at(e){(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),u.current&&u.dirty&&(X(),J()))}let ot=N(0);T(()=>u.current?.path,()=>{ot.value++});let $=N(!1);function st(){$.value=!$.value}let ct=e(()=>{let e=u.current?.content;if(!e)return null;try{return JSON.parse(e)}catch{return null}});k(async()=>{window.addEventListener(`keydown`,at),document.addEventListener(`click`,Q),await u.init()}),i(()=>{window.removeEventListener(`keydown`,at),document.removeEventListener(`click`,Q),X()});function lt(e){if(!e)return`-`;let t=new Date(e),n=Date.now()-e;return n<6e4?R(`@MINDMAP:刚刚`):n<36e5?`${Math.floor(n/6e4)}${R(`@MINDMAP:分钟前`)}`:n<864e5?`${Math.floor(n/36e5)}${R(`@MINDMAP:小时前`)}`:`${t.getMonth()+1}/${t.getDate()} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function ut(e){return e?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`:`0 B`}return(e,i)=>{let l=ae,d=s,w=h,T=o,k=b;return v(),n(`div`,pe,[P(`div`,me,[P(`div`,he,[c(l,{size:`small`,icon:F(t),onClick:H},{default:O(()=>[E(g(F(R)(`@MINDMAP:添加目录`)),1)]),_:1},8,[`icon`]),F(u).dirs.length>0?(v(),p(w,{key:0,placement:`bottom-start`,"show-after":200},{content:O(()=>[P(`div`,ge,[(v(!0),n(I,null,y(F(u).dirs,e=>(v(),n(`div`,{key:e},g(e),1))),128))])]),default:O(()=>[c(d,{size:`small`,type:`info`,class:`mm-dir-tag`},{default:O(()=>[E(g(F(R)(`@MINDMAP:个目录`,{n:F(u).dirs.length})),1)]),_:1})]),_:1})):(v(),n(`span`,_e,g(F(R)(`@MINDMAP:请先添加目录`)),1))]),P(`div`,ve,[c(l,{size:`small`,icon:F(f),disabled:F(u).dirs.length===0,onClick:i[0]||=e=>We()},{default:O(()=>[E(g(F(R)(`@MINDMAP:新建`)),1)]),_:1},8,[`icon`,`disabled`]),c(l,{size:`small`,icon:F(te),disabled:F(u).dirs.length===0,onClick:i[1]||=e=>rt()},{default:O(()=>[E(g(F(R)(`@MINDMAP:从MD导入`)),1)]),_:1},8,[`icon`,`disabled`]),c(l,{size:`small`,icon:F(C),disabled:!F(u).current,onClick:it},{default:O(()=>[E(g(F(R)(`@MINDMAP:复制MD`)),1)]),_:1},8,[`icon`,`disabled`]),c(l,{size:`small`,type:`primary`,icon:F(ie),disabled:!F(u).current||!F(u).dirty,loading:F(u).loading,onClick:i[2]||=()=>{X(),J()}},{default:O(()=>[E(g(F(R)(`@MINDMAP:保存`)),1)]),_:1},8,[`icon`,`disabled`,`loading`]),F(u).current?(v(),n(`span`,ye,[P(`span`,{class:`mm-status-title`,title:F(u).current.title},g(F(u).current.title),9,be),F(u).dirty?(v(),n(`span`,xe,`●`)):r(``,!0)])):r(``,!0)])]),P(`div`,Se,[P(`div`,Ce,[P(`div`,we,[P(`span`,Te,g(F(R)(`@MINDMAP:文件列表`)),1),c(l,{size:`small`,text:``,icon:F(m),loading:F(u).refreshing,onClick:i[3]||=e=>F(u).refresh(),disabled:F(u).dirs.length===0},null,8,[`icon`,`loading`,`disabled`])]),j((v(),n(`div`,Ee,[F(u).error?(v(),n(`div`,De,g(F(u).error),1)):r(``,!0),F(u).dirs.length===0?(v(),p(V,{key:1,class:`mm-sidebar-empty`,size:`inline`,title:F(R)(`@MINDMAP:请先添加目录`)},null,8,[`title`])):(v(!0),n(I,{key:2},y(F(u).groups,e=>(v(),n(`div`,{key:e.dir,class:`mm-group`},[P(`div`,{class:a([`mm-group-header`,{active:Ue(e.dir)}]),title:e.dir,onClick:t=>K(e.dir),onContextmenu:t=>Ye(t,e.dir)},[c(T,{class:a([`mm-group-caret`,{collapsed:G.value[e.dir]}])},{default:O(()=>[c(F(_))]),_:1},8,[`class`]),P(`div`,ke,[P(`div`,Ae,[P(`span`,je,g(He(e.dir)),1),P(`span`,Me,g(e.files.length),1)]),P(`div`,Ne,g(e.dir),1)])],42,Oe),j(P(`div`,Pe,[e.error?(v(),n(`div`,{key:0,class:`mm-group-error`,title:e.error},[P(`span`,null,g(F(R)(`@MINDMAP:目录不存在或已删除`)),1),c(l,{size:`small`,text:``,type:`danger`,onClick:t=>Je(e.dir)},{default:O(()=>[E(g(F(R)(`@MINDMAP:移除目录`)),1)]),_:1},8,[`onClick`])],8,Fe)):e.files.length===0?(v(),p(V,{key:1,class:`mm-sidebar-empty`,size:`inline`,title:F(R)(`@MINDMAP:该目录暂无思维导图`)},null,8,[`title`])):(v(!0),n(I,{key:2},y(e.files,e=>(v(),n(`div`,{key:e.path,class:a([`mm-file-item`,{active:F(u).current?.path===e.path}]),onClick:t=>qe(e.path)},[P(`div`,Le,[P(`div`,{class:`mm-file-title`,title:e.title},g(e.title),9,Re),P(`div`,ze,g(lt(e.mtime))+` · `+g(ut(e.size)),1)]),P(`div`,{class:`mm-file-actions`,onClick:i[4]||=M(()=>{},[`stop`])},[c(l,{size:`small`,text:``,icon:F(C),onClick:t=>et(e),title:F(R)(`@MINDMAP:重命名`)},null,8,[`icon`,`onClick`,`title`]),c(l,{size:`small`,text:``,type:`danger`,icon:F(ee),onClick:t=>$e(e),title:F(R)(`@MINDMAP:删除`)},null,8,[`icon`,`onClick`,`title`])])],10,Ie))),128))],512),[[S,!G.value[e.dir]]])]))),128))])),[[k,F(u).refreshing]])]),P(`div`,Be,[F(u).current?(v(),p(F(le),{key:ot.value,ref_key:`mmRef`,ref:L,data:ct.value,"preview-mode":$.value,onChange:tt,onSelect:nt,onCanvasTogglePreview:st},null,8,[`data`,`preview-mode`])):(v(),p(V,{key:0,class:`mm-editor-empty`,title:F(R)(`@MINDMAP:思维导图编辑器`),hint:F(u).dirs.length>0?F(R)(`@MINDMAP:从左侧选择或新建`):F(R)(`@MINDMAP:先选择目录提示`)},{icon:O(()=>[...i[7]||=[P(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[P(`circle`,{cx:`12`,cy:`12`,r:`2`}),P(`circle`,{cx:`5`,cy:`5`,r:`2`}),P(`circle`,{cx:`19`,cy:`5`,r:`2`}),P(`circle`,{cx:`5`,cy:`19`,r:`2`}),P(`circle`,{cx:`19`,cy:`19`,r:`2`}),P(`line`,{x1:`10.5`,y1:`10.5`,x2:`6.5`,y2:`6.5`}),P(`line`,{x1:`13.5`,y1:`10.5`,x2:`17.5`,y2:`6.5`}),P(`line`,{x1:`10.5`,y1:`13.5`,x2:`6.5`,y2:`17.5`}),P(`line`,{x1:`13.5`,y1:`13.5`,x2:`17.5`,y2:`17.5`})],-1)]]),_:1},8,[`title`,`hint`]))])]),c(F(se),{visible:z.value,mode:`directory`,multiple:!0,theme:D.value?`dark`:`light`,locale:F(x),"default-path":F(u).activeDir||F(u).dirs[0]||``,onClose:i[5]||=e=>z.value=!1,onConfirm:U},null,8,[`visible`,`theme`,`locale`,`default-path`]),(v(),p(re,{to:`body`},[Z.value?(v(),n(`div`,{key:0,class:`ctx-menu`,style:ne({left:Z.value.x+`px`,top:Z.value.y+`px`}),onClick:i[6]||=M(()=>{},[`stop`])},[P(`button`,{class:`ctx-menu-item`,onClick:Xe},[i[8]||=P(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[P(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`}),P(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),E(` `+g(F(R)(`@MINDMAP:打开目录`)),1)]),P(`button`,{class:`ctx-menu-item`,onClick:Ze},[i[9]||=P(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[P(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),P(`polyline`,{points:`14 2 14 8 20 8`}),P(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),P(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),E(` `+g(F(R)(`@MINDMAP:在此新建`)),1)]),i[11]||=P(`div`,{class:`ctx-menu-sep`},null,-1),P(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Qe},[i[10]||=P(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[P(`polyline`,{points:`3 6 5 6 21 6`}),P(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),P(`path`,{d:`M10 11v6`}),P(`path`,{d:`M14 11v6`}),P(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),E(` `+g(F(R)(`@MINDMAP:移除目录`)),1)])],4)):r(``,!0)]))])}}}),[[`__scopeId`,`data-v-6567b053`]]);export{K as default};
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{Cn as e,Ct as t,Dn as n,En as r,Gn as i,Gr as a,J as o,L as s,Mn as c,Mr as l,Pn as u,Rn as d,Rt as f,Tn as p,Vt as m,W as h,Xr as g,Y as _,Yn as v,Zn as y,a as b,dr as x,gn as S,ht as C,i as w,ir as T,jn as E,ln as D,lt as ee,or as O,pt as te,qn as k,qr as ne,r as A,sr as j,vn as M,vr as N,wn as P,wr as F,xn as re,xt as ie,yn as I,z as ae}from"./element-plus-BFy5M3jt.js";import{C as oe,S as L,m as se}from"./vendor-BXLxNxh-.js";import{n as R,t as z}from"./_plugin-vue_export-helper-DcVJ6Vx3.js";import{r as ce,t as B}from"./configStore-jJrldIrT.js";import{n as le,t as ue}from"./flow-mindmap-Qo4JDluG.js";import{i as V,x as de}from"./index-Do0MeO4E.js";x(),d();function H(e){let t=(e||``).trim();if(!t)return``;let n=t.replace(/[\\/]+$/,``);return n?/^[a-z]:$/i.test(n)?`${n}\\`:n:t}function U(e){return H(e).replace(/\//g,`\\`).replace(/\\+$/,``).toLowerCase()}function W(e,t){let n=U(e),r=U(t);return!n||!r?!1:n===r||n.startsWith(r.endsWith(`\\`)?r:`${r}\\`)}function G(e){let t=Math.max(e.lastIndexOf(`\\`),e.lastIndexOf(`/`));return t>0?e.slice(0,t):e}var fe=L(`mindmap`,()=>{let t=B(),n=N([]),r=N([]),i=N(null),a=N(!1),o=N(!1),s=N(null),c=N(``),l=N(``),u=e(()=>i.value!==null),d=e(()=>r.value.reduce((e,t)=>e+t.files.length,0)),f=e(()=>r.value.some(e=>e.loading));function p(){t.ui.mindmapDirs=[...n.value]}function m(e){return r.value.find(t=>U(t.dir)===U(e))}function h(e){let t=m(e);if(t)return t;let n={dir:e,files:[],error:null,loading:!1};return r.value.push(n),n}function g(e){let t=H(e);return!t||n.value.some(e=>U(e)===U(t))?!1:(n.value.push(t),h(t),!0)}let _=new Map;async function v(e){let t=m(e);if(!t)return;let r=U(t.dir),i=(_.get(r)||0)+1;_.set(r,i),t.loading=!0,t.error=null;try{let e=await(await fetch(`/api/mindmap/list?dir=${encodeURIComponent(t.dir)}`)).json();if(_.get(r)!==i)return;if(e.success){let r=typeof e.dir==`string`&&e.dir?e.dir:t.dir;if(r!==t.dir){let e=n.value.findIndex(e=>U(e)===U(t.dir));e>=0&&(n.value[e]=r),t.dir=r,p()}t.files=e.files||[]}else t.error=e.error||`读取目录失败`,t.files=[]}catch(e){if(_.get(r)!==i)return;t.error=e?.message||String(e),t.files=[]}finally{_.get(r)===i&&(t.loading=!1)}}async function y(){await Promise.all(n.value.map(e=>v(e)))}async function b(){let e=Array.isArray(t.ui.mindmapDirs)?t.ui.mindmapDirs:[];for(let t of e)g(t);c.value&&!n.value.some(e=>U(e)===U(c.value))&&(c.value=``),await y()}async function x(e){let t=[];for(let n of e||[]){let e=H(n);e&&g(e)&&t.push(e)}return t.length===0?0:(p(),c.value||=t[0],await Promise.all(t.map(e=>v(e))),t.length)}function S(e){let t=U(e);n.value=n.value.filter(e=>U(e)!==t),r.value=r.value.filter(e=>U(e.dir)!==t),_.delete(t),c.value&&U(c.value)===t&&(c.value=``),p()}function C(){if(n.value.length===0)return{dir:null,ambiguous:!1};let e=n.value.find(e=>U(e)===U(c.value));if(e)return{dir:e,ambiguous:!1};let t=i.value?.path;if(t){let e=n.value.find(e=>W(t,e));if(e)return{dir:e,ambiguous:!1}}return n.value.length===1?{dir:n.value[0],ambiguous:!1}:{dir:null,ambiguous:!0}}async function w(e,t=!1){if(!t&&a.value&&i.value)throw Error(`UNSAVED_CHANGES`);o.value=!0,s.value=null;try{let t=await(await fetch(`/api/mindmap/read?path=${encodeURIComponent(e)}`)).json();if(t.success){i.value={path:t.path,title:t.title,content:t.content,mtime:t.mtime},l.value=t.content,a.value=!1;let e=n.value.find(e=>W(t.path,e));c.value=e||G(t.path)}else s.value=t.error||`读取文件失败`}catch(e){s.value=e?.message||String(e)}finally{o.value=!1}}async function T(e,t=!1,n){let r=n?H(n):C().dir;if(!r)throw Error(`未选择目录`);if(!t&&a.value&&i.value)throw Error(`UNSAVED_CHANGES`);o.value=!0,s.value=null;try{let t=await(await fetch(`/api/mindmap/create`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({dir:r,name:e})})).json();if(t.success)i.value={path:t.path,title:t.title,content:t.content,mtime:t.mtime},l.value=t.content,a.value=!1,c.value=r,await v(r);else throw s.value=t.error||`新建失败`,Error(t.error||`新建失败`)}catch(e){throw e.message===`UNSAVED_CHANGES`||(s.value=e?.message||String(e)),e}finally{o.value=!1}}async function E(e){if(!i.value)throw Error(`没有打开的文件`);o.value=!0,s.value=null;try{let t=await(await fetch(`/api/mindmap/save`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:i.value.path,content:e})})).json();if(t.success){let n=i.value.path;return i.value&&(i.value.content=e,i.value.mtime=t.mtime),l.value=e,a.value=!1,await D(n),t}throw s.value=t.error||`保存失败`,Error(t.error||`保存失败`)}catch(e){throw s.value=e?.message||String(e),e}finally{o.value=!1}}async function D(e){let t=r.value.find(t=>W(e,t.dir));t&&await v(t.dir)}async function ee(e){let t=await(await fetch(`/api/mindmap/delete`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})})).json();if(!t.success)throw Error(t.error||`删除失败`);return i.value&&i.value.path===e&&(i.value=null,a.value=!1,l.value=``),await D(e),t}async function O(e,t){let n=await(await fetch(`/api/mindmap/rename`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,newName:t})})).json();if(!n.success)throw Error(n.error||`重命名失败`);return i.value&&e===i.value.path&&(i.value={...i.value,path:n.path,title:t}),await D(n.path||e),n}function te(){i.value&&(a.value=!0)}function k(){i.value=null,a.value=!1,l.value=``}return{dirs:n,groups:r,current:i,dirty:a,loading:o,refreshing:f,error:s,activeDir:c,hasCurrent:u,filesCount:d,init:b,addDirs:x,removeDir:S,refresh:y,refreshDir:v,resolveTargetDir:C,openFile:w,createFile:T,saveCurrent:E,deleteFile:ee,renameFile:O,markDirty:te,closeCurrent:k}});d(),x(),l(),D();var pe={class:`mindmap-view`},me={class:`mm-toolbar`},he={class:`mm-toolbar-left`},ge={class:`mm-dir-tooltip`},_e={key:1,class:`mm-dir-empty`},ve={class:`mm-toolbar-right`},ye={key:0,class:`mm-status`},be=[`title`],xe={key:0,class:`mm-status-dirty`},Se={class:`mm-body`},Ce={class:`mm-sidebar`},we={class:`mm-sidebar-header`},Te={class:`mm-sidebar-title`},Ee={class:`mm-sidebar-list`},De={key:0,class:`mm-sidebar-error`},Oe=[`title`,`onClick`,`onContextmenu`],ke={class:`mm-group-info`},Ae={class:`mm-group-name`},je={class:`mm-group-title`},Me={class:`mm-group-count`},Ne={class:`mm-group-path`},Pe={class:`mm-group-body`},Fe=[`title`],Ie=[`onClick`],Le={class:`mm-file-info`},Re=[`title`],ze={class:`mm-file-meta`},Be={class:`mm-editor`},Ve=1500,K=z(u({__name:`MindmapView`,setup(l){let u=fe(),d=B(),{currentLocale:x}=oe(ce()),D=e(()=>{let e=d.theme;return e===`dark`?!0:e===`light`?!1:window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}),L=N(null),z=N(!1);function H(){z.value=!0}async function U(e){z.value=!1;let t=(e||[]).filter(Boolean);if(t.length!==0)try{let e=await u.addDirs(t);e>0?w.success(R(`@MINDMAP:已添加目录`,{n:e})):w.info(R(`@MINDMAP:重复目录已忽略`))}catch(e){w.error(e?.message||R(`@MINDMAP:读取目录失败`))}}let G=N({});function K(e){G.value={...G.value,[e]:!G.value[e]},u.activeDir=e}function He(e){let t=e.replace(/[\\/]+$/,``).split(/[\\/]/);return t[t.length-1]||e}function Ue(e){return!!u.activeDir&&u.activeDir.toLowerCase()===e.toLowerCase()}function q(){let{dir:e,ambiguous:t}=u.resolveTargetDir();return e||(w.warning(R(t?`@MINDMAP:请选择目标目录`:`@MINDMAP:请先添加目录`)),null)}async function We(e){let t=e||q();if(!t||(e&&(u.activeDir=e),!await Ke()))return;let n=``;try{n=(await A.prompt(R(`@MINDMAP:输入文件名提示`),R(`@MINDMAP:新建思维导图`),{confirmButtonText:R(`@MINDMAP:新建`),cancelButtonText:R(`@MINDMAP:取消`),inputPlaceholder:R(`@MINDMAP:文件名占位`),inputValidator:e=>!e||!e.trim()?R(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||R(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await u.createFile(n,!0,t),w.success(R(`@MINDMAP:已新建并打开`))}catch(e){w.error(e?.message||R(`@MINDMAP:新建失败`))}}async function J(e=!1){if(u.current)try{let t=L.value?.exportData();if(!t){e||w.warning(R(`@MINDMAP:无法获取数据`));return}await u.saveCurrent(t),e||w.success(R(`@MINDMAP:已保存`))}catch(e){w.error(e?.message||R(`@MINDMAP:保存失败`))}}let Y=null;function Ge(){u.current&&u.dirty&&(Y&&clearTimeout(Y),Y=setTimeout(()=>{Y=null,u.current&&u.dirty&&J(!0)},Ve))}function X(){Y&&=(clearTimeout(Y),null)}async function Ke(){if(!u.dirty||!u.current)return!0;try{await A.confirm(R(`@MINDMAP:未保存提示`,{title:u.current.title}),R(`@MINDMAP:未保存的改动`),{confirmButtonText:R(`@MINDMAP:保存`),cancelButtonText:R(`@MINDMAP:丢弃`),distinguishCancelAndClose:!0,type:`warning`}),X();let e=L.value?.exportData();return e&&(await u.saveCurrent(e),w.success(R(`@MINDMAP:已保存`))),!0}catch(e){return e===`cancel`&&(X(),!0)}}async function qe(e){if(!(u.current&&u.current.path===e)&&await Ke())try{await u.openFile(e,!0)}catch(e){w.error(e?.message||R(`@MINDMAP:打开失败`))}}async function Je(e){let t=!!u.current&&W(u.current.path,e),n=R(`@MINDMAP:确认移除目录提示`,{dir:e});t&&(n=`${n} ${R(`@MINDMAP:当前文件将保持打开`)}`);try{await A.confirm(n,R(`@MINDMAP:移除目录`),{confirmButtonText:R(`@MINDMAP:移除目录`),cancelButtonText:R(`@MINDMAP:取消`),type:`warning`})}catch{return}u.removeDir(e),w.success(R(`@MINDMAP:已移除目录`))}let Z=N(null);function Ye(e,t){e.preventDefault(),Z.value={x:e.clientX,y:e.clientY,dir:t}}function Q(){Z.value=null}async function Xe(){let e=Z.value?.dir;if(Q(),!e)return;let t=await de(e);t.success?w.success(t.message||R(`@MINDMAP:已在文件管理器中打开`)):w.error(t.error||R(`@MINDMAP:打开目录失败`))}function Ze(){let e=Z.value?.dir;Q(),e&&We(e)}function Qe(){let e=Z.value?.dir;Q(),e&&Je(e)}async function $e(e){try{await A.confirm(R(`@MINDMAP:确认删除提示`,{title:e.title}),R(`@MINDMAP:删除`),{confirmButtonText:R(`@MINDMAP:删除`),cancelButtonText:R(`@MINDMAP:取消`),type:`warning`})}catch{return}try{await u.deleteFile(e.path),w.success(R(`@MINDMAP:已删除`))}catch(e){w.error(e?.message||R(`@MINDMAP:删除失败`))}}async function et(e){let t=``;try{t=(await A.prompt(R(`@MINDMAP:输入新名称提示`),R(`@MINDMAP:重命名`),{confirmButtonText:R(`@MINDMAP:确定`),cancelButtonText:R(`@MINDMAP:取消`),inputValue:e.title,inputValidator:e=>!e||!e.trim()?R(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||R(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await u.renameFile(e.path,t),w.success(R(`@MINDMAP:已重命名`))}catch(e){w.error(e?.message||R(`@MINDMAP:重命名失败`))}}function tt(e){u.markDirty(),Ge()}function nt(e){}async function rt(e){let t=e||q();if(!t)return;let n=``,r=``;try{n=(await A.prompt(R(`@MINDMAP:粘贴Markdown提示`),R(`@MINDMAP:从Markdown导入`),{confirmButtonText:R(`@MINDMAP:导入`),cancelButtonText:R(`@MINDMAP:取消`),inputType:`textarea`,inputPlaceholder:R(`@MINDMAP:Markdown占位`),inputValidator:e=>!e||!e.trim()?R(`@MINDMAP:内容不能为空`):!0})).value}catch{return}try{r=(await A.prompt(R(`@MINDMAP:输入文件名提示`),R(`@MINDMAP:文件名`),{confirmButtonText:R(`@MINDMAP:新建`),cancelButtonText:R(`@MINDMAP:取消`),inputValidator:e=>!e||!e.trim()?R(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||R(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await u.createFile(r,!0,t);let e=ue(n,r),i=JSON.stringify(e,null,2);await u.saveCurrent(i),w.success(R(`@MINDMAP:已导入`))}catch(e){w.error(e?.message||R(`@MINDMAP:导入失败`))}}async function it(){if(L.value)try{let e=L.value.getMarkdown();await navigator.clipboard.writeText(e),w.success(R(`@MINDMAP:已复制Markdown`))}catch(e){w.error(e?.message||R(`@MINDMAP:复制失败`))}}function at(e){(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),u.current&&u.dirty&&(X(),J()))}let ot=N(0);T(()=>u.current?.path,()=>{ot.value++});let $=N(!1);function st(){$.value=!$.value}let ct=e(()=>{let e=u.current?.content;if(!e)return null;try{return JSON.parse(e)}catch{return null}});k(async()=>{window.addEventListener(`keydown`,at),document.addEventListener(`click`,Q),await u.init()}),i(()=>{window.removeEventListener(`keydown`,at),document.removeEventListener(`click`,Q),X()});function lt(e){if(!e)return`-`;let t=new Date(e),n=Date.now()-e;return n<6e4?R(`@MINDMAP:刚刚`):n<36e5?`${Math.floor(n/6e4)}${R(`@MINDMAP:分钟前`)}`:n<864e5?`${Math.floor(n/36e5)}${R(`@MINDMAP:小时前`)}`:`${t.getMonth()+1}/${t.getDate()} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function ut(e){return e?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`:`0 B`}return(e,i)=>{let l=ae,d=s,w=h,T=o,k=b;return v(),n(`div`,pe,[P(`div`,me,[P(`div`,he,[c(l,{size:`small`,icon:F(t),onClick:H},{default:O(()=>[E(g(F(R)(`@MINDMAP:添加目录`)),1)]),_:1},8,[`icon`]),F(u).dirs.length>0?(v(),p(w,{key:0,placement:`bottom-start`,"show-after":200},{content:O(()=>[P(`div`,ge,[(v(!0),n(I,null,y(F(u).dirs,e=>(v(),n(`div`,{key:e},g(e),1))),128))])]),default:O(()=>[c(d,{size:`small`,type:`info`,class:`mm-dir-tag`},{default:O(()=>[E(g(F(R)(`@MINDMAP:个目录`,{n:F(u).dirs.length})),1)]),_:1})]),_:1})):(v(),n(`span`,_e,g(F(R)(`@MINDMAP:请先添加目录`)),1))]),P(`div`,ve,[c(l,{size:`small`,icon:F(f),disabled:F(u).dirs.length===0,onClick:i[0]||=e=>We()},{default:O(()=>[E(g(F(R)(`@MINDMAP:新建`)),1)]),_:1},8,[`icon`,`disabled`]),c(l,{size:`small`,icon:F(te),disabled:F(u).dirs.length===0,onClick:i[1]||=e=>rt()},{default:O(()=>[E(g(F(R)(`@MINDMAP:从MD导入`)),1)]),_:1},8,[`icon`,`disabled`]),c(l,{size:`small`,icon:F(C),disabled:!F(u).current,onClick:it},{default:O(()=>[E(g(F(R)(`@MINDMAP:复制MD`)),1)]),_:1},8,[`icon`,`disabled`]),c(l,{size:`small`,type:`primary`,icon:F(ie),disabled:!F(u).current||!F(u).dirty,loading:F(u).loading,onClick:i[2]||=()=>{X(),J()}},{default:O(()=>[E(g(F(R)(`@MINDMAP:保存`)),1)]),_:1},8,[`icon`,`disabled`,`loading`]),F(u).current?(v(),n(`span`,ye,[P(`span`,{class:`mm-status-title`,title:F(u).current.title},g(F(u).current.title),9,be),F(u).dirty?(v(),n(`span`,xe,`●`)):r(``,!0)])):r(``,!0)])]),P(`div`,Se,[P(`div`,Ce,[P(`div`,we,[P(`span`,Te,g(F(R)(`@MINDMAP:文件列表`)),1),c(l,{size:`small`,text:``,icon:F(m),loading:F(u).refreshing,onClick:i[3]||=e=>F(u).refresh(),disabled:F(u).dirs.length===0},null,8,[`icon`,`loading`,`disabled`])]),j((v(),n(`div`,Ee,[F(u).error?(v(),n(`div`,De,g(F(u).error),1)):r(``,!0),F(u).dirs.length===0?(v(),p(V,{key:1,class:`mm-sidebar-empty`,size:`inline`,title:F(R)(`@MINDMAP:请先添加目录`)},null,8,[`title`])):(v(!0),n(I,{key:2},y(F(u).groups,e=>(v(),n(`div`,{key:e.dir,class:`mm-group`},[P(`div`,{class:a([`mm-group-header`,{active:Ue(e.dir)}]),title:e.dir,onClick:t=>K(e.dir),onContextmenu:t=>Ye(t,e.dir)},[c(T,{class:a([`mm-group-caret`,{collapsed:G.value[e.dir]}])},{default:O(()=>[c(F(_))]),_:1},8,[`class`]),P(`div`,ke,[P(`div`,Ae,[P(`span`,je,g(He(e.dir)),1),P(`span`,Me,g(e.files.length),1)]),P(`div`,Ne,g(e.dir),1)])],42,Oe),j(P(`div`,Pe,[e.error?(v(),n(`div`,{key:0,class:`mm-group-error`,title:e.error},[P(`span`,null,g(F(R)(`@MINDMAP:目录不存在或已删除`)),1),c(l,{size:`small`,text:``,type:`danger`,onClick:t=>Je(e.dir)},{default:O(()=>[E(g(F(R)(`@MINDMAP:移除目录`)),1)]),_:1},8,[`onClick`])],8,Fe)):e.files.length===0?(v(),p(V,{key:1,class:`mm-sidebar-empty`,size:`inline`,title:F(R)(`@MINDMAP:该目录暂无思维导图`)},null,8,[`title`])):(v(!0),n(I,{key:2},y(e.files,e=>(v(),n(`div`,{key:e.path,class:a([`mm-file-item`,{active:F(u).current?.path===e.path}]),onClick:t=>qe(e.path)},[P(`div`,Le,[P(`div`,{class:`mm-file-title`,title:e.title},g(e.title),9,Re),P(`div`,ze,g(lt(e.mtime))+` · `+g(ut(e.size)),1)]),P(`div`,{class:`mm-file-actions`,onClick:i[4]||=M(()=>{},[`stop`])},[c(l,{size:`small`,text:``,icon:F(C),onClick:t=>et(e),title:F(R)(`@MINDMAP:重命名`)},null,8,[`icon`,`onClick`,`title`]),c(l,{size:`small`,text:``,type:`danger`,icon:F(ee),onClick:t=>$e(e),title:F(R)(`@MINDMAP:删除`)},null,8,[`icon`,`onClick`,`title`])])],10,Ie))),128))],512),[[S,!G.value[e.dir]]])]))),128))])),[[k,F(u).refreshing]])]),P(`div`,Be,[F(u).current?(v(),p(F(le),{key:ot.value,ref_key:`mmRef`,ref:L,data:ct.value,"preview-mode":$.value,onChange:tt,onSelect:nt,onCanvasTogglePreview:st},null,8,[`data`,`preview-mode`])):(v(),p(V,{key:0,class:`mm-editor-empty`,title:F(R)(`@MINDMAP:思维导图编辑器`),hint:F(u).dirs.length>0?F(R)(`@MINDMAP:从左侧选择或新建`):F(R)(`@MINDMAP:先选择目录提示`)},{icon:O(()=>[...i[7]||=[P(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[P(`circle`,{cx:`12`,cy:`12`,r:`2`}),P(`circle`,{cx:`5`,cy:`5`,r:`2`}),P(`circle`,{cx:`19`,cy:`5`,r:`2`}),P(`circle`,{cx:`5`,cy:`19`,r:`2`}),P(`circle`,{cx:`19`,cy:`19`,r:`2`}),P(`line`,{x1:`10.5`,y1:`10.5`,x2:`6.5`,y2:`6.5`}),P(`line`,{x1:`13.5`,y1:`10.5`,x2:`17.5`,y2:`6.5`}),P(`line`,{x1:`10.5`,y1:`13.5`,x2:`6.5`,y2:`17.5`}),P(`line`,{x1:`13.5`,y1:`13.5`,x2:`17.5`,y2:`17.5`})],-1)]]),_:1},8,[`title`,`hint`]))])]),c(F(se),{visible:z.value,mode:`directory`,multiple:!0,theme:D.value?`dark`:`light`,locale:F(x),"default-path":F(u).activeDir||F(u).dirs[0]||``,onClose:i[5]||=e=>z.value=!1,onConfirm:U},null,8,[`visible`,`theme`,`locale`,`default-path`]),(v(),p(re,{to:`body`},[Z.value?(v(),n(`div`,{key:0,class:`ctx-menu`,style:ne({left:Z.value.x+`px`,top:Z.value.y+`px`}),onClick:i[6]||=M(()=>{},[`stop`])},[P(`button`,{class:`ctx-menu-item`,onClick:Xe},[i[8]||=P(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[P(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`}),P(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),E(` `+g(F(R)(`@MINDMAP:打开目录`)),1)]),P(`button`,{class:`ctx-menu-item`,onClick:Ze},[i[9]||=P(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[P(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),P(`polyline`,{points:`14 2 14 8 20 8`}),P(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),P(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),E(` `+g(F(R)(`@MINDMAP:在此新建`)),1)]),i[11]||=P(`div`,{class:`ctx-menu-sep`},null,-1),P(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Qe},[i[10]||=P(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[P(`polyline`,{points:`3 6 5 6 21 6`}),P(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),P(`path`,{d:`M10 11v6`}),P(`path`,{d:`M14 11v6`}),P(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),E(` `+g(F(R)(`@MINDMAP:移除目录`)),1)])],4)):r(``,!0)]))])}}}),[[`__scopeId`,`data-v-6567b053`]]);export{K as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Cn as t,Dn as n,En as r,Gn as i,Gr as a,J as ee,Mn as o,Mr as s,Pn as c,Rn as l,Tn as te,U as ne,Vt as u,W as re,Wt as ie,Xr as d,Yn as f,Zn as p,dr as m,g as ae,i as h,jn as g,m as oe,or as _,qn as v,qr as y,r as b,vr as x,wn as S,wr as C,yn as w,z as se}from"./element-plus-DTtm3XCd.js";import{n as T,t as E}from"./_plugin-vue_export-helper-Bsx6Zj3t.js";import{r as D}from"./index-BApctCNq.js";l(),m(),s();var ce={class:`monitor-view`},O={class:`monitor-toolbar`},k={class:`toolbar-title`},A={key:0,class:`toolbar-host`},j={class:`toolbar-actions`},M={class:`toolbar-label`},N={class:`toolbar-label`},P={class:`metric-card`},F={class:`metric-card__header`},I={class:`metric-card__body`},L={class:`metric-sub`},R=[`title`],z={class:`metric-card`},B={class:`metric-card__header`},V={class:`metric-card__body`},H={class:`metric-sub`},U={class:`metric-card__footer`},W={class:`metric-card`},G={class:`metric-card__header`},le={class:`metric-card__body`},ue={class:`metric-value`},de={class:`metric-sub`},fe={class:`metric-card__footer`},pe={class:`metric-card`},me={class:`metric-card__header`},he={class:`metric-card__body`},ge={class:`metric-value`},_e={class:`metric-sub`},ve={class:`metric-card__footer`},ye={key:0,class:`metric-card disk-card`},be={class:`metric-card__header`},xe={key:0,class:`disks-rows`},Se={class:`disk-row`},Ce={class:`disk-mount`},we={class:`disk-usage`},Te={key:1,class:`disks-empty`},Ee={key:2,class:`metric-card__footer disks-summary`},De={key:1,class:`monitor-placeholder`},Oe={key:2,class:`monitor-error`},ke={key:3,class:`monitor-ports`},Ae={class:`ports-header`},je={class:`ports-title`},Me={class:`ports-table-wrap`},Ne={class:`ports-table`},Pe={class:`col-protocol`},Fe={class:`col-address`},Ie={class:`col-state`},Le={class:`col-action`},Re={class:`col-protocol`},ze={class:`col-address`},Be={class:`col-port`},Ve={class:`port-num`},He={class:`col-state`},Ue={class:`col-pid`},We=[`title`],Ge={class:`col-action`},Ke=[`title`],qe={key:0},Je={colspan:`7`,class:`ports-empty`},K=E(c({__name:`MonitorView`,setup(s){let c=D(),l=x(``),m=x(`port`),E=x(`asc`);function K(e){m.value===e?E.value=E.value===`asc`?`desc`:`asc`:(m.value=e,E.value=`asc`)}let q=t(()=>{let e=c.ports.slice(),t=l.value.trim().toLowerCase();t&&(e=e.filter(e=>String(e.localPort).includes(t)||String(e.pid).includes(t)||(e.processName||``).toLowerCase().includes(t)||(e.localAddress||``).toLowerCase().includes(t)||(e.protocol||``).toLowerCase().includes(t)||(e.state||``).toLowerCase().includes(t)));let n=E.value===`asc`?1:-1;return e.sort((e,t)=>{let r,i;return m.value===`port`?(r=e.localPort,i=t.localPort):m.value===`pid`?(r=Number(e.pid)||0,i=Number(t.pid)||0):(r=(e.processName||``).toLowerCase(),i=(t.processName||``).toLowerCase()),r<i?-1*n:r>i?1*n:0}),e});function J(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(r===0?0:1)} ${t[r]}`}function Y(e){if(!Number.isFinite(e)||e<=0)return`-`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60),i=Math.floor(e%60),a=[];return t>0&&a.push(`${t} ${T(`@MONITOR:天`)}`),n>0&&a.push(`${n} ${T(`@MONITOR:时`)}`),r>0&&a.push(`${r} ${T(`@MONITOR:分`)}`),a.push(`${i} ${T(`@MONITOR:秒`)}`),a.join(` `)}function X(e){return e>=90?`var(--color-danger)`:e>=70?`var(--color-warning)`:`var(--color-success)`}let Z=x(new Set),Ye=new Set([0,1,4]),Q=new Set([`system`,`idle`,`registry`,`memory compression`,`secure system`,`smss.exe`,`csrss.exe`,`wininit.exe`,`winlogon.exe`,`services.exe`,`lsass.exe`,`svchost.exe`,`fontdrvhost.exe`,`dwm.exe`]);function Xe(e){if(Ye.has(Number(e.pid)))return!0;let t=(e.processName||``).trim().toLowerCase();return t?Q.has(t)||Q.has(t.replace(/\.exe$/,``)):!1}async function Ze(e){let t=e.pid,n=e.processName||T(`@MONITOR:未知进程`);try{await b.confirm(T(`@MONITOR:确认终止进程提示`).replace(`{pid}`,String(t)).replace(`{process}`,n).replace(`{port}`,String(e.localPort)),T(`@MONITOR:终止进程`),{confirmButtonText:T(`@MONITOR:终止`),cancelButtonText:T(`@MONITOR:取消`),type:`warning`})}catch{return}Z.value.add(t);try{await c.killProcess(t,!0),h.success(T(`@MONITOR:已终止进程`).replace(`{pid}`,String(t)))}catch(e){h.error(e?.message||T(`@MONITOR:终止进程失败`))}finally{Z.value.delete(t)}}function $(){c.refresh().catch(e=>{h.error(e?.message||T(`@MONITOR:刷新失败`))})}function Qe(e){c.setAutoRefresh(e)}function $e(e){c.setShowAllPorts(e)}return v(()=>{c.startAutoRefresh()}),i(()=>{c.stopAutoRefresh()}),(t,i)=>{let s=oe,h=re,v=se,b=ae,x=ee,D=ne;return f(),n(`div`,ce,[S(`div`,O,[S(`div`,k,[i[4]||=S(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M22 12h-4l-3 9L9 3l-3 9H2`})],-1),S(`span`,null,d(C(T)(`@MONITOR:系统监控`)),1),C(c).overview?(f(),n(`span`,A,d(C(c).overview.system.hostname)+` · `+d(C(c).overview.system.platform)+`/`+d(C(c).overview.system.arch),1)):r(``,!0)]),S(`div`,j,[o(h,{content:C(T)(`@MONITOR:显示所有连接`),placement:`bottom`},{default:_(()=>[o(s,{"model-value":C(c).showAllPorts,onChange:$e,size:`small`},null,8,[`model-value`])]),_:1},8,[`content`]),S(`span`,M,d(C(T)(`@MONITOR:全部连接`)),1),o(h,{content:C(T)(`@MONITOR:自动刷新`),placement:`bottom`},{default:_(()=>[o(s,{"model-value":C(c).autoRefresh,onChange:Qe,size:`small`},null,8,[`model-value`])]),_:1},8,[`content`]),S(`span`,N,d(C(T)(`@MONITOR:自动`)),1),o(v,{size:`small`,icon:C(u),loading:C(c).loading,onClick:$},{default:_(()=>[g(d(C(T)(`@MONITOR:刷新`)),1)]),_:1},8,[`icon`,`loading`])])]),C(c).overview?(f(),n(`div`,{key:0,class:a([`monitor-cards`,{"monitor-cards--no-disks":!C(c).overview?.disks}])},[S(`div`,P,[S(`div`,F,[i[5]||=S(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`}),S(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`}),S(`path`,{d:`M9 2v2M15 2v2M9 20v2M15 20v2M2 9h2M2 15h2M20 9h2M20 15h2`})],-1),S(`span`,null,d(C(T)(`@MONITOR:CPU 占用`)),1)]),S(`div`,I,[S(`div`,{class:`metric-value`,style:y({color:X(C(c).overview.cpu.usage)})},[g(d(C(c).overview.cpu.usage.toFixed(1)),1),i[6]||=S(`span`,{class:`metric-unit`},`%`,-1)],4),S(`div`,L,d(C(c).overview.cpu.cores)+` `+d(C(T)(`@MONITOR:核心`)),1)]),o(b,{percentage:C(c).overview.cpu.usage,"stroke-width":6,"show-text":!1,color:X(C(c).overview.cpu.usage)},null,8,[`percentage`,`color`]),S(`div`,{class:`metric-card__footer`,title:C(c).overview.cpu.model},d(C(c).overview.cpu.model),9,R)]),S(`div`,z,[S(`div`,B,[i[7]||=S(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`rect`,{x:`2`,y:`6`,width:`20`,height:`12`,rx:`2`}),S(`path`,{d:`M6 10v4M10 10v4M14 10v4M18 10v4`})],-1),S(`span`,null,d(C(T)(`@MONITOR:内存占用`)),1)]),S(`div`,V,[S(`div`,{class:`metric-value`,style:y({color:X(C(c).overview.memory.usagePercent)})},[g(d(C(c).overview.memory.usagePercent.toFixed(1)),1),i[8]||=S(`span`,{class:`metric-unit`},`%`,-1)],4),S(`div`,H,d(J(C(c).overview.memory.used))+` / `+d(J(C(c).overview.memory.total)),1)]),o(b,{percentage:C(c).overview.memory.usagePercent,"stroke-width":6,"show-text":!1,color:X(C(c).overview.memory.usagePercent)},null,8,[`percentage`,`color`]),S(`div`,U,d(C(T)(`@MONITOR:空闲`))+` `+d(J(C(c).overview.memory.free)),1)]),S(`div`,W,[S(`div`,G,[i[9]||=S(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`circle`,{cx:`12`,cy:`12`,r:`10`}),S(`polyline`,{points:`12 6 12 12 16 14`})],-1),S(`span`,null,d(C(T)(`@MONITOR:系统运行时间`)),1)]),S(`div`,le,[S(`div`,ue,d(Y(C(c).overview.system.uptime)),1),S(`div`,de,d(C(c).overview.system.nodeVersion),1)]),S(`div`,fe,d(C(c).overview.system.hostname),1)]),S(`div`,pe,[S(`div`,me,[i[10]||=S(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M22 12h-4l-3 9L9 3l-3 9H2`})],-1),S(`span`,null,d(C(T)(`@MONITOR:监听端口`)),1)]),S(`div`,he,[S(`div`,ge,d(C(c).ports.length),1),S(`div`,_e,d(C(T)(`@MONITOR:TCP`))+` `+d(C(c).ports.filter(e=>e.protocol===`TCP`).length)+` · `+d(C(T)(`@MONITOR:UDP`))+` `+d(C(c).ports.filter(e=>e.protocol===`UDP`).length),1)]),S(`div`,ve,d(C(c).showAllPorts?C(T)(`@MONITOR:显示全部连接`):C(T)(`@MONITOR:仅监听端口`)),1)]),C(c).overview.disks?(f(),n(`div`,ye,[S(`div`,be,[i[11]||=e(`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-954fa37e><line x1="22" y1="12" x2="2" y2="12" data-v-954fa37e></line><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" data-v-954fa37e></path><line x1="6" y1="16" x2="6.01" y2="16" data-v-954fa37e></line><line x1="10" y1="16" x2="10.01" y2="16" data-v-954fa37e></line></svg>`,1),S(`span`,null,d(C(T)(`@MONITOR:磁盘占用`)),1)]),C(c).overview.disks.drives.length>0?(f(),n(`div`,xe,[(f(!0),n(w,null,p(C(c).overview.disks.drives,e=>(f(),n(`div`,{class:`disk-item`,key:e.mount},[S(`div`,Se,[S(`span`,Ce,d(e.mount),1),o(b,{class:`disk-bar`,percentage:e.usagePercent,"stroke-width":6,"show-text":!1,color:X(e.usagePercent)},null,8,[`percentage`,`color`]),S(`span`,{class:`disk-percent`,style:y({color:X(e.usagePercent)})},d(e.usagePercent.toFixed(1))+`% `,5)]),S(`div`,we,d(J(e.used))+` / `+d(J(e.total)),1)]))),128))])):(f(),n(`div`,Te,d(C(T)(`@MONITOR:暂无磁盘数据`)),1)),C(c).overview.disks.drives.length>1?(f(),n(`div`,Ee,d(J(C(c).overview.disks.used))+` / `+d(J(C(c).overview.disks.total))+` · `+d(C(c).overview.disks.usagePercent.toFixed(1))+`% `,1)):r(``,!0)])):r(``,!0)],2)):r(``,!0),!C(c).overview&&C(c).loading?(f(),n(`div`,De,[o(x,{class:`is-loading`},{default:_(()=>[o(C(u))]),_:1}),S(`span`,null,d(C(T)(`@MONITOR:加载中`)),1)])):r(``,!0),C(c).error&&!C(c).overview?(f(),n(`div`,Oe,[i[12]||=S(`svg`,{viewBox:`0 0 24 24`,width:`20`,height:`20`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`circle`,{cx:`12`,cy:`12`,r:`10`}),S(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),S(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})],-1),S(`span`,null,d(C(c).error),1),o(v,{size:`small`,onClick:$},{default:_(()=>[g(d(C(T)(`@MONITOR:重试`)),1)]),_:1})])):r(``,!0),C(c).overview?(f(),n(`div`,ke,[S(`div`,Ae,[S(`span`,je,d(C(T)(`@MONITOR:端口占用列表`)),1),o(D,{modelValue:l.value,"onUpdate:modelValue":i[0]||=e=>l.value=e,placeholder:C(T)(`@MONITOR:搜索端口 / PID / 进程名`),size:`small`,clearable:``,class:`ports-search`},{prefix:_(()=>[o(x,null,{default:_(()=>[o(C(ie))]),_:1})]),_:1},8,[`modelValue`,`placeholder`])]),S(`div`,Me,[S(`table`,Ne,[S(`thead`,null,[S(`tr`,null,[S(`th`,Pe,d(C(T)(`@MONITOR:协议`)),1),S(`th`,Fe,d(C(T)(`@MONITOR:本地地址`)),1),S(`th`,{class:`col-port sortable`,onClick:i[1]||=e=>K(`port`)},[g(d(C(T)(`@MONITOR:端口`))+` `,1),S(`span`,{class:a([`sort-arrow`,{active:m.value===`port`,desc:E.value===`desc`}])},`↕`,2)]),S(`th`,Ie,d(C(T)(`@MONITOR:状态`)),1),S(`th`,{class:`col-pid sortable`,onClick:i[2]||=e=>K(`pid`)},[i[13]||=g(` PID `,-1),S(`span`,{class:a([`sort-arrow`,{active:m.value===`pid`,desc:E.value===`desc`}])},`↕`,2)]),S(`th`,{class:`col-process sortable`,onClick:i[3]||=e=>K(`process`)},[g(d(C(T)(`@MONITOR:进程`))+` `,1),S(`span`,{class:a([`sort-arrow`,{active:m.value===`process`,desc:E.value===`desc`}])},`↕`,2)]),S(`th`,Le,d(C(T)(`@MONITOR:操作`)),1)])]),S(`tbody`,null,[(f(!0),n(w,null,p(q.value,(e,t)=>(f(),n(`tr`,{key:`${e.protocol}-${e.localPort}-${e.pid}-${t}`},[S(`td`,Re,[S(`span`,{class:a([`proto-badge`,`proto-${e.protocol.toLowerCase()}`])},d(e.protocol),3)]),S(`td`,ze,d(e.localAddress),1),S(`td`,Be,[S(`span`,Ve,d(e.localPort),1)]),S(`td`,He,[S(`span`,{class:a([`state-tag`,`state-${(e.state||`unknown`).toLowerCase()}`])},d(e.state||`-`),3)]),S(`td`,Ue,d(e.pid),1),S(`td`,{class:`col-process`,title:e.processName},d(e.processName||C(T)(`@MONITOR:未知`)),9,We),S(`td`,Ge,[Xe(e)?(f(),n(`span`,{key:0,class:`kill-protected`,title:C(T)(`@MONITOR:系统进程,不可终止`)},d(C(T)(`@MONITOR:系统`)),9,Ke)):(f(),te(v,{key:1,class:`kill-btn`,size:`small`,text:``,loading:Z.value.has(e.pid),disabled:Z.value.has(e.pid),onClick:t=>Ze(e)},{default:_(()=>[g(d(C(T)(`@MONITOR:终止`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`]))])]))),128)),q.value.length===0?(f(),n(`tr`,qe,[S(`td`,Je,d(l.value?C(T)(`@MONITOR:无匹配结果`):C(T)(`@MONITOR:暂无端口占用`)),1)])):r(``,!0)])])])])):r(``,!0)])}}}),[[`__scopeId`,`data-v-954fa37e`]]);export{K as default};
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Cn as t,Dn as n,En as r,Gn as i,Gr as a,J as ee,Mn as o,Mr as s,Pn as c,Rn as l,Tn as te,U as ne,Vt as u,W as re,Wt as ie,Xr as d,Yn as f,Zn as p,dr as m,g as ae,i as h,jn as g,m as oe,or as _,qn as v,qr as y,r as b,vr as x,wn as S,wr as C,yn as w,z as se}from"./element-plus-BFy5M3jt.js";import{n as T,t as E}from"./_plugin-vue_export-helper-DcVJ6Vx3.js";import{r as D}from"./index-Do0MeO4E.js";l(),m(),s();var ce={class:`monitor-view`},O={class:`monitor-toolbar`},k={class:`toolbar-title`},A={key:0,class:`toolbar-host`},j={class:`toolbar-actions`},M={class:`toolbar-label`},N={class:`toolbar-label`},P={class:`metric-card`},F={class:`metric-card__header`},I={class:`metric-card__body`},L={class:`metric-sub`},R=[`title`],z={class:`metric-card`},B={class:`metric-card__header`},V={class:`metric-card__body`},H={class:`metric-sub`},U={class:`metric-card__footer`},W={class:`metric-card`},G={class:`metric-card__header`},le={class:`metric-card__body`},ue={class:`metric-value`},de={class:`metric-sub`},fe={class:`metric-card__footer`},pe={class:`metric-card`},me={class:`metric-card__header`},he={class:`metric-card__body`},ge={class:`metric-value`},_e={class:`metric-sub`},ve={class:`metric-card__footer`},ye={key:0,class:`metric-card disk-card`},be={class:`metric-card__header`},xe={key:0,class:`disks-rows`},Se={class:`disk-row`},Ce={class:`disk-mount`},we={class:`disk-usage`},Te={key:1,class:`disks-empty`},Ee={key:2,class:`metric-card__footer disks-summary`},De={key:1,class:`monitor-placeholder`},Oe={key:2,class:`monitor-error`},ke={key:3,class:`monitor-ports`},Ae={class:`ports-header`},je={class:`ports-title`},Me={class:`ports-table-wrap`},Ne={class:`ports-table`},Pe={class:`col-protocol`},Fe={class:`col-address`},Ie={class:`col-state`},Le={class:`col-action`},Re={class:`col-protocol`},ze={class:`col-address`},Be={class:`col-port`},Ve={class:`port-num`},He={class:`col-state`},Ue={class:`col-pid`},We=[`title`],Ge={class:`col-action`},Ke=[`title`],qe={key:0},Je={colspan:`7`,class:`ports-empty`},K=E(c({__name:`MonitorView`,setup(s){let c=D(),l=x(``),m=x(`port`),E=x(`asc`);function K(e){m.value===e?E.value=E.value===`asc`?`desc`:`asc`:(m.value=e,E.value=`asc`)}let q=t(()=>{let e=c.ports.slice(),t=l.value.trim().toLowerCase();t&&(e=e.filter(e=>String(e.localPort).includes(t)||String(e.pid).includes(t)||(e.processName||``).toLowerCase().includes(t)||(e.localAddress||``).toLowerCase().includes(t)||(e.protocol||``).toLowerCase().includes(t)||(e.state||``).toLowerCase().includes(t)));let n=E.value===`asc`?1:-1;return e.sort((e,t)=>{let r,i;return m.value===`port`?(r=e.localPort,i=t.localPort):m.value===`pid`?(r=Number(e.pid)||0,i=Number(t.pid)||0):(r=(e.processName||``).toLowerCase(),i=(t.processName||``).toLowerCase()),r<i?-1*n:r>i?1*n:0}),e});function J(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(r===0?0:1)} ${t[r]}`}function Y(e){if(!Number.isFinite(e)||e<=0)return`-`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60),i=Math.floor(e%60),a=[];return t>0&&a.push(`${t} ${T(`@MONITOR:天`)}`),n>0&&a.push(`${n} ${T(`@MONITOR:时`)}`),r>0&&a.push(`${r} ${T(`@MONITOR:分`)}`),a.push(`${i} ${T(`@MONITOR:秒`)}`),a.join(` `)}function X(e){return e>=90?`var(--color-danger)`:e>=70?`var(--color-warning)`:`var(--color-success)`}let Z=x(new Set),Ye=new Set([0,1,4]),Q=new Set([`system`,`idle`,`registry`,`memory compression`,`secure system`,`smss.exe`,`csrss.exe`,`wininit.exe`,`winlogon.exe`,`services.exe`,`lsass.exe`,`svchost.exe`,`fontdrvhost.exe`,`dwm.exe`]);function Xe(e){if(Ye.has(Number(e.pid)))return!0;let t=(e.processName||``).trim().toLowerCase();return t?Q.has(t)||Q.has(t.replace(/\.exe$/,``)):!1}async function Ze(e){let t=e.pid,n=e.processName||T(`@MONITOR:未知进程`);try{await b.confirm(T(`@MONITOR:确认终止进程提示`).replace(`{pid}`,String(t)).replace(`{process}`,n).replace(`{port}`,String(e.localPort)),T(`@MONITOR:终止进程`),{confirmButtonText:T(`@MONITOR:终止`),cancelButtonText:T(`@MONITOR:取消`),type:`warning`})}catch{return}Z.value.add(t);try{await c.killProcess(t,!0),h.success(T(`@MONITOR:已终止进程`).replace(`{pid}`,String(t)))}catch(e){h.error(e?.message||T(`@MONITOR:终止进程失败`))}finally{Z.value.delete(t)}}function $(){c.refresh().catch(e=>{h.error(e?.message||T(`@MONITOR:刷新失败`))})}function Qe(e){c.setAutoRefresh(e)}function $e(e){c.setShowAllPorts(e)}return v(()=>{c.startAutoRefresh()}),i(()=>{c.stopAutoRefresh()}),(t,i)=>{let s=oe,h=re,v=se,b=ae,x=ee,D=ne;return f(),n(`div`,ce,[S(`div`,O,[S(`div`,k,[i[4]||=S(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M22 12h-4l-3 9L9 3l-3 9H2`})],-1),S(`span`,null,d(C(T)(`@MONITOR:系统监控`)),1),C(c).overview?(f(),n(`span`,A,d(C(c).overview.system.hostname)+` · `+d(C(c).overview.system.platform)+`/`+d(C(c).overview.system.arch),1)):r(``,!0)]),S(`div`,j,[o(h,{content:C(T)(`@MONITOR:显示所有连接`),placement:`bottom`},{default:_(()=>[o(s,{"model-value":C(c).showAllPorts,onChange:$e,size:`small`},null,8,[`model-value`])]),_:1},8,[`content`]),S(`span`,M,d(C(T)(`@MONITOR:全部连接`)),1),o(h,{content:C(T)(`@MONITOR:自动刷新`),placement:`bottom`},{default:_(()=>[o(s,{"model-value":C(c).autoRefresh,onChange:Qe,size:`small`},null,8,[`model-value`])]),_:1},8,[`content`]),S(`span`,N,d(C(T)(`@MONITOR:自动`)),1),o(v,{size:`small`,icon:C(u),loading:C(c).loading,onClick:$},{default:_(()=>[g(d(C(T)(`@MONITOR:刷新`)),1)]),_:1},8,[`icon`,`loading`])])]),C(c).overview?(f(),n(`div`,{key:0,class:a([`monitor-cards`,{"monitor-cards--no-disks":!C(c).overview?.disks}])},[S(`div`,P,[S(`div`,F,[i[5]||=S(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`}),S(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`}),S(`path`,{d:`M9 2v2M15 2v2M9 20v2M15 20v2M2 9h2M2 15h2M20 9h2M20 15h2`})],-1),S(`span`,null,d(C(T)(`@MONITOR:CPU 占用`)),1)]),S(`div`,I,[S(`div`,{class:`metric-value`,style:y({color:X(C(c).overview.cpu.usage)})},[g(d(C(c).overview.cpu.usage.toFixed(1)),1),i[6]||=S(`span`,{class:`metric-unit`},`%`,-1)],4),S(`div`,L,d(C(c).overview.cpu.cores)+` `+d(C(T)(`@MONITOR:核心`)),1)]),o(b,{percentage:C(c).overview.cpu.usage,"stroke-width":6,"show-text":!1,color:X(C(c).overview.cpu.usage)},null,8,[`percentage`,`color`]),S(`div`,{class:`metric-card__footer`,title:C(c).overview.cpu.model},d(C(c).overview.cpu.model),9,R)]),S(`div`,z,[S(`div`,B,[i[7]||=S(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`rect`,{x:`2`,y:`6`,width:`20`,height:`12`,rx:`2`}),S(`path`,{d:`M6 10v4M10 10v4M14 10v4M18 10v4`})],-1),S(`span`,null,d(C(T)(`@MONITOR:内存占用`)),1)]),S(`div`,V,[S(`div`,{class:`metric-value`,style:y({color:X(C(c).overview.memory.usagePercent)})},[g(d(C(c).overview.memory.usagePercent.toFixed(1)),1),i[8]||=S(`span`,{class:`metric-unit`},`%`,-1)],4),S(`div`,H,d(J(C(c).overview.memory.used))+` / `+d(J(C(c).overview.memory.total)),1)]),o(b,{percentage:C(c).overview.memory.usagePercent,"stroke-width":6,"show-text":!1,color:X(C(c).overview.memory.usagePercent)},null,8,[`percentage`,`color`]),S(`div`,U,d(C(T)(`@MONITOR:空闲`))+` `+d(J(C(c).overview.memory.free)),1)]),S(`div`,W,[S(`div`,G,[i[9]||=S(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`circle`,{cx:`12`,cy:`12`,r:`10`}),S(`polyline`,{points:`12 6 12 12 16 14`})],-1),S(`span`,null,d(C(T)(`@MONITOR:系统运行时间`)),1)]),S(`div`,le,[S(`div`,ue,d(Y(C(c).overview.system.uptime)),1),S(`div`,de,d(C(c).overview.system.nodeVersion),1)]),S(`div`,fe,d(C(c).overview.system.hostname),1)]),S(`div`,pe,[S(`div`,me,[i[10]||=S(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M22 12h-4l-3 9L9 3l-3 9H2`})],-1),S(`span`,null,d(C(T)(`@MONITOR:监听端口`)),1)]),S(`div`,he,[S(`div`,ge,d(C(c).ports.length),1),S(`div`,_e,d(C(T)(`@MONITOR:TCP`))+` `+d(C(c).ports.filter(e=>e.protocol===`TCP`).length)+` · `+d(C(T)(`@MONITOR:UDP`))+` `+d(C(c).ports.filter(e=>e.protocol===`UDP`).length),1)]),S(`div`,ve,d(C(c).showAllPorts?C(T)(`@MONITOR:显示全部连接`):C(T)(`@MONITOR:仅监听端口`)),1)]),C(c).overview.disks?(f(),n(`div`,ye,[S(`div`,be,[i[11]||=e(`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-954fa37e><line x1="22" y1="12" x2="2" y2="12" data-v-954fa37e></line><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" data-v-954fa37e></path><line x1="6" y1="16" x2="6.01" y2="16" data-v-954fa37e></line><line x1="10" y1="16" x2="10.01" y2="16" data-v-954fa37e></line></svg>`,1),S(`span`,null,d(C(T)(`@MONITOR:磁盘占用`)),1)]),C(c).overview.disks.drives.length>0?(f(),n(`div`,xe,[(f(!0),n(w,null,p(C(c).overview.disks.drives,e=>(f(),n(`div`,{class:`disk-item`,key:e.mount},[S(`div`,Se,[S(`span`,Ce,d(e.mount),1),o(b,{class:`disk-bar`,percentage:e.usagePercent,"stroke-width":6,"show-text":!1,color:X(e.usagePercent)},null,8,[`percentage`,`color`]),S(`span`,{class:`disk-percent`,style:y({color:X(e.usagePercent)})},d(e.usagePercent.toFixed(1))+`% `,5)]),S(`div`,we,d(J(e.used))+` / `+d(J(e.total)),1)]))),128))])):(f(),n(`div`,Te,d(C(T)(`@MONITOR:暂无磁盘数据`)),1)),C(c).overview.disks.drives.length>1?(f(),n(`div`,Ee,d(J(C(c).overview.disks.used))+` / `+d(J(C(c).overview.disks.total))+` · `+d(C(c).overview.disks.usagePercent.toFixed(1))+`% `,1)):r(``,!0)])):r(``,!0)],2)):r(``,!0),!C(c).overview&&C(c).loading?(f(),n(`div`,De,[o(x,{class:`is-loading`},{default:_(()=>[o(C(u))]),_:1}),S(`span`,null,d(C(T)(`@MONITOR:加载中`)),1)])):r(``,!0),C(c).error&&!C(c).overview?(f(),n(`div`,Oe,[i[12]||=S(`svg`,{viewBox:`0 0 24 24`,width:`20`,height:`20`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`circle`,{cx:`12`,cy:`12`,r:`10`}),S(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),S(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})],-1),S(`span`,null,d(C(c).error),1),o(v,{size:`small`,onClick:$},{default:_(()=>[g(d(C(T)(`@MONITOR:重试`)),1)]),_:1})])):r(``,!0),C(c).overview?(f(),n(`div`,ke,[S(`div`,Ae,[S(`span`,je,d(C(T)(`@MONITOR:端口占用列表`)),1),o(D,{modelValue:l.value,"onUpdate:modelValue":i[0]||=e=>l.value=e,placeholder:C(T)(`@MONITOR:搜索端口 / PID / 进程名`),size:`small`,clearable:``,class:`ports-search`},{prefix:_(()=>[o(x,null,{default:_(()=>[o(C(ie))]),_:1})]),_:1},8,[`modelValue`,`placeholder`])]),S(`div`,Me,[S(`table`,Ne,[S(`thead`,null,[S(`tr`,null,[S(`th`,Pe,d(C(T)(`@MONITOR:协议`)),1),S(`th`,Fe,d(C(T)(`@MONITOR:本地地址`)),1),S(`th`,{class:`col-port sortable`,onClick:i[1]||=e=>K(`port`)},[g(d(C(T)(`@MONITOR:端口`))+` `,1),S(`span`,{class:a([`sort-arrow`,{active:m.value===`port`,desc:E.value===`desc`}])},`↕`,2)]),S(`th`,Ie,d(C(T)(`@MONITOR:状态`)),1),S(`th`,{class:`col-pid sortable`,onClick:i[2]||=e=>K(`pid`)},[i[13]||=g(` PID `,-1),S(`span`,{class:a([`sort-arrow`,{active:m.value===`pid`,desc:E.value===`desc`}])},`↕`,2)]),S(`th`,{class:`col-process sortable`,onClick:i[3]||=e=>K(`process`)},[g(d(C(T)(`@MONITOR:进程`))+` `,1),S(`span`,{class:a([`sort-arrow`,{active:m.value===`process`,desc:E.value===`desc`}])},`↕`,2)]),S(`th`,Le,d(C(T)(`@MONITOR:操作`)),1)])]),S(`tbody`,null,[(f(!0),n(w,null,p(q.value,(e,t)=>(f(),n(`tr`,{key:`${e.protocol}-${e.localPort}-${e.pid}-${t}`},[S(`td`,Re,[S(`span`,{class:a([`proto-badge`,`proto-${e.protocol.toLowerCase()}`])},d(e.protocol),3)]),S(`td`,ze,d(e.localAddress),1),S(`td`,Be,[S(`span`,Ve,d(e.localPort),1)]),S(`td`,He,[S(`span`,{class:a([`state-tag`,`state-${(e.state||`unknown`).toLowerCase()}`])},d(e.state||`-`),3)]),S(`td`,Ue,d(e.pid),1),S(`td`,{class:`col-process`,title:e.processName},d(e.processName||C(T)(`@MONITOR:未知`)),9,We),S(`td`,Ge,[Xe(e)?(f(),n(`span`,{key:0,class:`kill-protected`,title:C(T)(`@MONITOR:系统进程,不可终止`)},d(C(T)(`@MONITOR:系统`)),9,Ke)):(f(),te(v,{key:1,class:`kill-btn`,size:`small`,text:``,loading:Z.value.has(e.pid),disabled:Z.value.has(e.pid),onClick:t=>Ze(e)},{default:_(()=>[g(d(C(T)(`@MONITOR:终止`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`]))])]))),128)),q.value.length===0?(f(),n(`tr`,qe,[S(`td`,Je,d(l.value?C(T)(`@MONITOR:无匹配结果`):C(T)(`@MONITOR:暂无端口占用`)),1)])):r(``,!0)])])])])):r(``,!0)])}}}),[[`__scopeId`,`data-v-954fa37e`]]);export{K as default};
|