prime-dev-cli 2.0.7 → 2.0.9

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.
Files changed (98) hide show
  1. package/config/projects.json +80 -24
  2. package/dist/server/.next/BUILD_ID +1 -1
  3. package/dist/server/.next/app-build-manifest.json +3 -3
  4. package/dist/server/.next/build-manifest.json +2 -2
  5. package/dist/server/.next/cache/.rscinfo +1 -1
  6. package/dist/server/.next/cache/.tsbuildinfo +1 -1
  7. package/dist/server/.next/cache/eslint/.cache_1qa5vxt +1 -1
  8. package/dist/server/.next/fallback-build-manifest.json +2 -2
  9. package/dist/server/.next/next-minimal-server.js.nft.json +1 -1
  10. package/dist/server/.next/next-server.js.nft.json +1 -1
  11. package/dist/server/.next/prerender-manifest.json +3 -3
  12. package/dist/server/.next/server/app/_not-found.html +1 -1
  13. package/dist/server/.next/server/app/_not-found.rsc +1 -1
  14. package/dist/server/.next/server/app/api/admin-git-batch-create-branch/route.js.nft.json +1 -1
  15. package/dist/server/.next/server/app/api/admin-git-batch-delete-branch/route.js.nft.json +1 -1
  16. package/dist/server/.next/server/app/api/admin-git-batch-merge/route.js.nft.json +1 -1
  17. package/dist/server/.next/server/app/api/admin-git-batch-probe-remote-branch/route.js.nft.json +1 -1
  18. package/dist/server/.next/server/app/api/batch-list-branches/route.js +1 -1
  19. package/dist/server/.next/server/app/api/batch-list-branches/route.js.nft.json +1 -1
  20. package/dist/server/.next/server/app/api/batch-list-submodule-branches/route.js +1 -1
  21. package/dist/server/.next/server/app/api/batch-list-submodule-branches/route.js.nft.json +1 -1
  22. package/dist/server/.next/server/app/api/batch-switch-branch/route.js.nft.json +1 -1
  23. package/dist/server/.next/server/app/api/batch-switch-submodule-branch/route.js.nft.json +1 -1
  24. package/dist/server/.next/server/app/api/branch/switch/route.js.nft.json +1 -1
  25. package/dist/server/.next/server/app/api/branches/route.js.nft.json +1 -1
  26. package/dist/server/.next/server/app/api/check-workspace/route.js.nft.json +1 -1
  27. package/dist/server/.next/server/app/api/gwh-git-flow/route.js.nft.json +1 -1
  28. package/dist/server/.next/server/app/api/initialize-workspace/route.js.nft.json +1 -1
  29. package/dist/server/.next/server/app/api/microapp-proxy-config/route.js.nft.json +1 -1
  30. package/dist/server/.next/server/app/api/open-project/route.js.nft.json +1 -1
  31. package/dist/server/.next/server/app/api/project-config/route.js.nft.json +1 -1
  32. package/dist/server/.next/server/app/api/retry-project/route.js.nft.json +1 -1
  33. package/dist/server/.next/server/app/api/submodule-info/route.js.nft.json +1 -1
  34. package/dist/server/.next/server/app/api/uat-git-flow/route.js +2 -2
  35. package/dist/server/.next/server/app/api/uat-git-flow/route.js.nft.json +1 -1
  36. package/dist/server/.next/server/app/api/uat-git-flow/step/route.js +2 -2
  37. package/dist/server/.next/server/app/api/uat-git-flow/step/route.js.nft.json +1 -1
  38. package/dist/server/.next/server/app/configuration/page/app-build-manifest.json +1 -1
  39. package/dist/server/.next/server/app/configuration/page_client-reference-manifest.js +1 -1
  40. package/dist/server/.next/server/app/configuration.html +1 -1
  41. package/dist/server/.next/server/app/configuration.rsc +2 -2
  42. package/dist/server/.next/server/app/index.html +1 -1
  43. package/dist/server/.next/server/app/index.rsc +1 -1
  44. package/dist/server/.next/server/app/initialization/page/app-build-manifest.json +2 -2
  45. package/dist/server/.next/server/app/initialization/page.js.nft.json +1 -1
  46. package/dist/server/.next/server/app/initialization/page_client-reference-manifest.js +1 -1
  47. package/dist/server/.next/server/app/initialization.html +1 -1
  48. package/dist/server/.next/server/app/initialization.rsc +2 -2
  49. package/dist/server/.next/server/chunks/[root-of-the-server]__6c7b8215._.js +3 -0
  50. package/dist/server/.next/server/chunks/[root-of-the-server]__6c7b8215._.js.map +1 -0
  51. package/dist/server/.next/server/chunks/[root-of-the-server]__c52380bc._.js +3 -0
  52. package/dist/server/.next/server/chunks/[root-of-the-server]__c52380bc._.js.map +1 -0
  53. package/dist/server/.next/server/chunks/_24087f66._.js +1 -1
  54. package/dist/server/.next/server/chunks/_24087f66._.js.map +1 -1
  55. package/dist/server/.next/server/chunks/_61c263b3._.js +1 -1
  56. package/dist/server/.next/server/chunks/_61c263b3._.js.map +1 -1
  57. package/dist/server/.next/server/chunks/packages_server_42b02aec._.js +3 -0
  58. package/dist/server/.next/server/chunks/packages_server_42b02aec._.js.map +1 -0
  59. package/dist/server/.next/server/chunks/packages_server_854cbe00._.js +3 -0
  60. package/dist/server/.next/server/chunks/packages_server_854cbe00._.js.map +1 -0
  61. package/dist/server/.next/server/chunks/ssr/_283bdc73._.js +1 -1
  62. package/dist/server/.next/server/chunks/ssr/_283bdc73._.js.map +1 -1
  63. package/dist/server/.next/server/chunks/ssr/_c7905e3c._.js +1 -1
  64. package/dist/server/.next/server/chunks/ssr/_c7905e3c._.js.map +1 -1
  65. package/dist/server/.next/server/chunks/ssr/packages_server_src_622c27d6._.js +3 -0
  66. package/dist/server/.next/server/chunks/ssr/packages_server_src_622c27d6._.js.map +1 -0
  67. package/dist/server/.next/server/pages/404.html +1 -1
  68. package/dist/server/.next/server/pages/500.html +1 -1
  69. package/dist/server/.next/server/server-reference-manifest.js +1 -1
  70. package/dist/server/.next/server/server-reference-manifest.json +1 -1
  71. package/dist/server/.next/static/chunks/16b23f7570a551e1.js +3 -0
  72. package/dist/server/.next/static/chunks/{736431eeff70b2b7.js → 4e8de43e1f6c5336.js} +2 -2
  73. package/dist/server/.next/static/chunks/{51509164bafe1e57.js.map → 84a2f16086c26ab1.js.map} +1 -1
  74. package/dist/server/.next/static/chunks/b109f2fb91f36e31.js.map +1 -0
  75. package/dist/server/.next/static/chunks/{1ae3fa2333c12687.js → f3137530db91c282.js} +2 -2
  76. package/dist/server/.next/static/chunks/{227a962f4584edf8.js.map → fa09d2a29cc42906.js.map} +1 -1
  77. package/dist/server/.next/trace +2 -2
  78. package/package.json +1 -1
  79. package/plugin-marketplace/plugins/prime-dev-cli/skills/prime-workspace/SKILL.md +112 -22
  80. package/skills/prime-workspace/README.md +20 -2
  81. package/skills/prime-workspace/SKILL.md +510 -214
  82. package/skills/prime-workspace/references/api-contracts.md +125 -0
  83. package/skills/prime-workspace/references/microfrontend-proxy.md +155 -0
  84. package/dist/server/.next/server/chunks/[root-of-the-server]__131fe141._.js +0 -3
  85. package/dist/server/.next/server/chunks/[root-of-the-server]__131fe141._.js.map +0 -1
  86. package/dist/server/.next/server/chunks/[root-of-the-server]__36b87de0._.js +0 -3
  87. package/dist/server/.next/server/chunks/[root-of-the-server]__36b87de0._.js.map +0 -1
  88. package/dist/server/.next/server/chunks/packages_server_ccc16996._.js +0 -3
  89. package/dist/server/.next/server/chunks/packages_server_ccc16996._.js.map +0 -1
  90. package/dist/server/.next/server/chunks/packages_server_d1209331._.js +0 -3
  91. package/dist/server/.next/server/chunks/packages_server_d1209331._.js.map +0 -1
  92. package/dist/server/.next/server/chunks/ssr/packages_server_src_65e3de99._.js +0 -3
  93. package/dist/server/.next/server/chunks/ssr/packages_server_src_65e3de99._.js.map +0 -1
  94. package/dist/server/.next/static/chunks/6f824bb5811ceebd.js +0 -3
  95. package/dist/server/.next/static/chunks/f9854e63365b2956.js.map +0 -1
  96. /package/dist/server/.next/static/{Dz7Ultbv0aaqF3m4OrOHQ → zjt6jXsNQxDdU-RHF8TC7}/_buildManifest.js +0 -0
  97. /package/dist/server/.next/static/{Dz7Ultbv0aaqF3m4OrOHQ → zjt6jXsNQxDdU-RHF8TC7}/_clientMiddlewareManifest.json +0 -0
  98. /package/dist/server/.next/static/{Dz7Ultbv0aaqF3m4OrOHQ → zjt6jXsNQxDdU-RHF8TC7}/_ssgManifest.js +0 -0
@@ -1,3 +0,0 @@
1
- (globalThis.TURBOPACK=globalThis.TURBOPACK||[]).push(["object"==typeof document?document.currentScript:void 0,{31814:e=>{"use strict";var{g:s,__dirname:t}=e;{e.s({default:()=>h});var r=e.i(20393),a=e.i(19886),n=e.i(86871),c=e.i(70599),o=e.i(29255),l=e.i(31110),i=e.i(20546),d=e.i(58644);let s="submodules/common";function h({projectName:e,variant:t,onSwitched:h,refreshSignal:p}){let m="sub"===t,[u,g]=(0,a.useState)(null),[x,j]=(0,a.useState)(null),[b,f]=(0,a.useState)(!1),[y,N]=(0,a.useState)([]),[v,w]=(0,a.useState)(!1),[P,k]=(0,a.useState)(null),[C,S]=(0,a.useState)(""),[L,R]=(0,a.useState)(null),[A,$]=(0,a.useState)(null),I=(0,a.useRef)(null),B=e=>{$(e),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>$(null),5e3)},O=(0,a.useCallback)(async()=>{if(m)try{let t=await fetch(`/api/submodule-info?project=${encodeURIComponent(e)}&subPath=${encodeURIComponent(s)}`),r=await t.json();r.success&&r.data&&(j(!!r.data.exists),g(r.data))}catch(s){console.error(`获取子仓库信息失败 (${e}):`,s)}else try{let s=await fetch(`/api/branches?project=${encodeURIComponent(e)}`),t=await s.json();t.success&&t.data?.exists&&g({exists:!0,currentBranch:t.data.currentBranch||null,detached:!1,commitHash:""})}catch(s){console.error(`获取项目分支信息失败 (${e}):`,s)}},[m,e]),T=(0,a.useCallback)(async()=>{w(!0),k(null);try{let t=m?`&subPath=${encodeURIComponent(s)}`:"",r=await fetch(`/api/branches?project=${encodeURIComponent(e)}${t}`),a=await r.json();a.success?N(a.data?.branches||[]):k(a.error||"获取远程分支失败")}catch(s){console.error(`获取远程分支失败 (${e}):`,s),k("网络请求失败")}finally{w(!1)}},[m,e]);(0,a.useEffect)(()=>{O()},[O,p]),(0,a.useEffect)(()=>()=>{I.current&&clearTimeout(I.current)},[]);let E=async t=>{if(!L&&t!==u?.currentBranch){R(t);try{let r=await fetch("/api/branch/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(m?{projectName:e,branchName:t,subPath:s}:{projectName:e,branchName:t})}),a=await r.json();a.success?(f(!1),S(""),await O(),h?.()):(f(!1),S(""),B(a.error||"切换分支失败"))}catch(s){console.error(`切换分支失败 (${e}):`,s),f(!1),B("切换分支失败: 网络错误")}finally{R(null)}}};if(m&&!1===x)return null;let D=u?u.detached?u.commitHash?`(detached) ${u.commitHash}`:"(detached)":u.currentBranch||"未知分支":"",{visible:M,total:F}=(0,d.filterBranchOptions)(y,C),U=m?"flex items-center gap-1.5 px-2 py-1 bg-purple-50 border border-purple-200 rounded-md min-w-0":"flex items-center gap-1.5 px-2 py-1 bg-blue-50 border border-blue-200 rounded-md min-w-0",G=m?"text-xs font-medium text-purple-700 truncate shrink-0 max-w-[8rem]":"text-xs font-medium text-blue-700 truncate shrink-0 max-w-[8rem]",_=m?"flex items-center gap-1 text-xs font-medium text-purple-800 hover:bg-purple-100 rounded px-1 transition-colors min-w-0":"flex items-center gap-1 text-xs font-medium text-blue-800 hover:bg-blue-100 rounded px-1 transition-colors min-w-0";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:U,children:[m&&(0,r.jsx)("span",{className:G,title:`子仓库: ${e}/${s}`,children:"common"}),(0,r.jsxs)(o.DropdownMenu,{open:b,onOpenChange:e=>{f(e),e&&(S(""),T())},children:[(0,r.jsx)(o.DropdownMenuTrigger,{asChild:!0,children:(0,r.jsxs)("button",{type:"button",className:_,title:m?`点击切换子仓库(${e}/submodules/common)分支`:`点击切换 ${e} 分支`,children:[(0,r.jsx)("span",{className:"truncate max-w-[10rem]",children:D}),(0,r.jsx)(i.ChevronDownIcon,{className:"size-3 opacity-60 shrink-0"})]})}),(0,r.jsxs)(o.DropdownMenuContent,{align:"start",className:"w-72",children:[(0,r.jsx)("div",{className:"p-1",children:(0,r.jsx)(c.Input,{value:C,onChange:e=>S(e.target.value),placeholder:"搜索分支...",className:"h-8"})}),(0,r.jsx)(o.DropdownMenuSeparator,{}),v&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 px-3 py-4 text-sm text-gray-500",children:[(0,r.jsx)("span",{className:"animate-spin w-3 h-3 border-2 border-blue-500 border-t-transparent rounded-full"}),"加载远程分支中..."]}),!v&&P&&(0,r.jsxs)("div",{className:"px-3 py-3 text-sm",children:[(0,r.jsx)("p",{className:"text-red-600",children:P}),(0,r.jsx)(n.Button,{variant:"outline",size:"sm",onClick:T,className:"mt-2 h-7 px-2 text-xs",children:"重试"})]}),!v&&!P&&0===y.length&&(0,r.jsx)("div",{className:"px-3 py-4 text-sm text-gray-500",children:"暂无远程分支"}),!v&&!P&&y.length>0&&0===F&&(0,r.jsx)("div",{className:"px-3 py-4 text-sm text-gray-500",children:"没有匹配的分支"}),!v&&!P&&F>0&&(0,r.jsxs)("div",{className:"max-h-64 overflow-y-auto",children:[M.map(e=>(0,r.jsxs)(o.DropdownMenuItem,{disabled:null!==L,className:"flex items-center justify-between",onSelect:s=>{s.preventDefault(),E(e)},children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e}),(0,r.jsxs)("span",{className:"flex items-center gap-2 shrink-0",children:[e===u?.currentBranch&&(0,r.jsx)(l.CheckIcon,{className:"size-4 text-blue-600"}),L===e&&(0,r.jsx)("span",{className:"animate-spin w-3 h-3 border-2 border-blue-500 border-t-transparent rounded-full"})]})]},e)),F>M.length&&(0,r.jsxs)("div",{className:"px-3 py-2 text-xs text-gray-400 border-t",children:["共 ",F," 个匹配分支,仅展示前 ",M.length," 项,更多请使用上方搜索"]})]})]})]})]}),A&&(0,r.jsx)("div",{className:"fixed top-16 right-4 z-50 max-w-sm px-4 py-3 bg-red-50 border border-red-200 rounded-md shadow-lg text-sm text-red-600",children:A})]})}}},86442:function(e){var s,{g:t,__dirname:r,m:a,e:n}=e;"undefined"!=typeof __nccwpck_require__&&(__nccwpck_require__.ab=r+"/"),(s={}).endianness=function(){return"LE"},s.hostname=function(){return"undefined"!=typeof location?location.hostname:""},s.loadavg=function(){return[]},s.uptime=function(){return 0},s.freemem=function(){return Number.MAX_VALUE},s.totalmem=function(){return Number.MAX_VALUE},s.cpus=function(){return[]},s.type=function(){return"Browser"},s.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},s.networkInterfaces=s.getNetworkInterfaces=function(){return{}},s.arch=function(){return"javascript"},s.platform=function(){return"browser"},s.tmpdir=s.tmpDir=function(){return"/tmp"},s.EOL="\n",s.homedir=function(){return"/"},a.exports=s},87733:function(e){var{g:s,__dirname:t,m:r,e:a}=e;!function(){"use strict";var e={114:function(e){function s(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function t(e,s){for(var t,r="",a=0,n=-1,c=0,o=0;o<=e.length;++o){if(o<e.length)t=e.charCodeAt(o);else if(47===t)break;else t=47;if(47===t){if(n===o-1||1===c);else if(n!==o-1&&2===c){if(r.length<2||2!==a||46!==r.charCodeAt(r.length-1)||46!==r.charCodeAt(r.length-2)){if(r.length>2){var l=r.lastIndexOf("/");if(l!==r.length-1){-1===l?(r="",a=0):a=(r=r.slice(0,l)).length-1-r.lastIndexOf("/"),n=o,c=0;continue}}else if(2===r.length||1===r.length){r="",a=0,n=o,c=0;continue}}s&&(r.length>0?r+="/..":r="..",a=2)}else r.length>0?r+="/"+e.slice(n+1,o):r=e.slice(n+1,o),a=o-n-1;n=o,c=0}else 46===t&&-1!==c?++c:c=-1}return r}var r={resolve:function(){for(var e,r,a="",n=!1,c=arguments.length-1;c>=-1&&!n;c--)c>=0?r=arguments[c]:(void 0===e&&(e=""),r=e),s(r),0!==r.length&&(a=r+"/"+a,n=47===r.charCodeAt(0));if(a=t(a,!n),n)if(a.length>0)return"/"+a;else return"/";return a.length>0?a:"."},normalize:function(e){if(s(e),0===e.length)return".";var r=47===e.charCodeAt(0),a=47===e.charCodeAt(e.length-1);return(0!==(e=t(e,!r)).length||r||(e="."),e.length>0&&a&&(e+="/"),r)?"/"+e:e},isAbsolute:function(e){return s(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0==arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var a=arguments[t];s(a),a.length>0&&(void 0===e?e=a:e+="/"+a)}return void 0===e?".":r.normalize(e)},relative:function(e,t){if(s(e),s(t),e===t||(e=r.resolve(e))===(t=r.resolve(t)))return"";for(var a=1;a<e.length&&47===e.charCodeAt(a);++a);for(var n=e.length,c=n-a,o=1;o<t.length&&47===t.charCodeAt(o);++o);for(var l=t.length-o,i=c<l?c:l,d=-1,h=0;h<=i;++h){if(h===i){if(l>i){if(47===t.charCodeAt(o+h))return t.slice(o+h+1);else if(0===h)return t.slice(o+h)}else c>i&&(47===e.charCodeAt(a+h)?d=h:0===h&&(d=0));break}var p=e.charCodeAt(a+h);if(p!==t.charCodeAt(o+h))break;47===p&&(d=h)}var m="";for(h=a+d+1;h<=n;++h)(h===n||47===e.charCodeAt(h))&&(0===m.length?m+="..":m+="/..");return m.length>0?m+t.slice(o+d):(o+=d,47===t.charCodeAt(o)&&++o,t.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(s(e),0===e.length)return".";for(var t=e.charCodeAt(0),r=47===t,a=-1,n=!0,c=e.length-1;c>=1;--c)if(47===(t=e.charCodeAt(c))){if(!n){a=c;break}}else n=!1;return -1===a?r?"/":".":r&&1===a?"//":e.slice(0,a)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');s(e);var r,a=0,n=-1,c=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var o=t.length-1,l=-1;for(r=e.length-1;r>=0;--r){var i=e.charCodeAt(r);if(47===i){if(!c){a=r+1;break}}else -1===l&&(c=!1,l=r+1),o>=0&&(i===t.charCodeAt(o)?-1==--o&&(n=r):(o=-1,n=l))}return a===n?n=l:-1===n&&(n=e.length),e.slice(a,n)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!c){a=r+1;break}}else -1===n&&(c=!1,n=r+1);return -1===n?"":e.slice(a,n)},extname:function(e){s(e);for(var t=-1,r=0,a=-1,n=!0,c=0,o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(47===l){if(!n){r=o+1;break}continue}-1===a&&(n=!1,a=o+1),46===l?-1===t?t=o:1!==c&&(c=1):-1!==t&&(c=-1)}return -1===t||-1===a||0===c||1===c&&t===a-1&&t===r+1?"":e.slice(t,a)},format:function(e){var s,t;if(null===e||"object"!=typeof e)throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return s=e.dir||e.root,t=e.base||(e.name||"")+(e.ext||""),s?s===e.root?s+t:s+"/"+t:t},parse:function(e){s(e);var t,r={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return r;var a=e.charCodeAt(0),n=47===a;n?(r.root="/",t=1):t=0;for(var c=-1,o=0,l=-1,i=!0,d=e.length-1,h=0;d>=t;--d){if(47===(a=e.charCodeAt(d))){if(!i){o=d+1;break}continue}-1===l&&(i=!1,l=d+1),46===a?-1===c?c=d:1!==h&&(h=1):-1!==c&&(h=-1)}return -1===c||-1===l||0===h||1===h&&c===l-1&&c===o+1?-1!==l&&(0===o&&n?r.base=r.name=e.slice(1,l):r.base=r.name=e.slice(o,l)):(0===o&&n?(r.name=e.slice(1,c),r.base=e.slice(1,l)):(r.name=e.slice(o,c),r.base=e.slice(o,l)),r.ext=e.slice(c,l)),o>0?r.dir=e.slice(0,o-1):n&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};r.posix=r,e.exports=r}},s={};function a(t){var r=s[t];if(void 0!==r)return r.exports;var n=s[t]={exports:{}},c=!0;try{e[t](n,n.exports,a),c=!1}finally{c&&delete s[t]}return n.exports}a.ab=t+"/",r.exports=a(114)}()},7647:e=>{"use strict";var{g:s,__dirname:t}=e;{e.s({PROJECT_CONFIG_PATH:()=>t,ProjectStatus:()=>n,WORKSPACE_CONFIG:()=>s});var r=e.i(86442),a=e.i(87733);let s={WORKSPACE_ROOT:(0,a.join)((0,r.homedir)(),"Documents","prime-workspace"),GIT_TIMEOUT:3e5,MAX_CONCURRENT_CLONES:Math.max(2,Math.min((0,r.cpus)().length,8)),MAX_RETRY_ATTEMPTS:3},t=(0,a.join)((0,r.homedir)(),".prime-projects.json");var n=function(e){return e.PENDING="pending",e.EXISTING="existing",e.CLONING="cloning",e.SUCCESS="success",e.FAILED="failed",e.RETRYING="retrying",e.INCOMPLETE="incomplete",e}({})}},9993:e=>{"use strict";var{g:s,__dirname:t}=e;{e.s({buildBatchProbeRemoteBranchPayload:()=>v,buildBatchSwitchBranchPayload:()=>f,buildBatchSwitchSubBranchPayload:()=>N,default:()=>s,mapProbeRemoteBranchResultText:()=>w,validateBatchProbeRemoteBranchForm:()=>j,validateBatchSwitchBranchForm:()=>b,validateBatchSwitchSubBranchForm:()=>y});var r=e.i(20393),a=e.i(19886),n=e.i(42152),c=e.i(86871),o=e.i(75777),l=e.i(31814),i=e.i(70599),d=e.i(80226),h=e.i(29255),p=e.i(31110),m=e.i(20546),u=e.i(19579),g=e.i(7647),x=e.i(58644);function j(e,s){let t=[];return 0===e.length&&t.push("请先选择至少一个项目。"),s.trim()||t.push("请填写远端分支名称。"),t}function b(e,s){let t=[];return 0===e.length&&t.push("请先选择至少一个项目。"),s.trim()||t.push("请选择目标分支。"),t}function f(e,s,t){return{projects:[e],branchName:s.trim(),dryRun:t}}function y(e,s){let t=[];return 0===e.length&&t.push("请先选择至少一个项目。"),s.trim()||t.push("请选择子仓库目标分支。"),t}function N(e,s,t){return{projects:[e],branchName:s.trim(),dryRun:t}}function v(e,s,t){return{projects:[e],branchName:s.trim(),dryRun:t}}function w(e){return!0===e.exists?"存在":!1===e.exists?"不存在":e.success?"成功":"执行失败"}let s=()=>{let e=(0,n.useRouter)(),[s,t]=(0,a.useState)({isInitializing:!1,isCompleted:!1,isLoading:!0,hasCompleted:!1,globalProgress:0,globalMessage:"正在检查工作空间状态...",projects:{}}),[P,k]=(0,a.useState)({selectedProjects:[],createBranch:"release/",baseBranch:"main",mergeBranch:"feature/"}),[C,S]=(0,a.useState)({isRunning:!1,operationLogs:[],feedbacks:[],runId:""}),[L,R]=(0,a.useState)({selectedProjects:[],createBranch:"release/",baseBranch:"GWH",mergeBranch:"feature/"}),[A,$]=(0,a.useState)({isRunning:!1,operationLogs:[],feedbacks:[],runId:""}),[I,B]=(0,a.useState)({selectedProjects:[],targetBranch:"main",sourceBranch:""}),[O,T]=(0,a.useState)({isRunning:!1,operationLogs:[],feedbacks:[],progress:0,totalProjects:0,completedProjects:0,currentProject:""}),[E,D]=(0,a.useState)({selectedProjects:[],createBranch:"",baseBranch:"main"}),[M,F]=(0,a.useState)({isRunning:!1,operationLogs:[],feedbacks:[],progress:0,totalProjects:0,completedProjects:0,currentProject:""}),[U,G]=(0,a.useState)({selectedProjects:[],branchName:""}),[_,z]=(0,a.useState)({isRunning:!1,operationLogs:[],feedbacks:[],progress:0,totalProjects:0,completedProjects:0,currentProject:""}),[J,Y]=(0,a.useState)({selectedProjects:[],branchName:""}),[X,H]=(0,a.useState)({isRunning:!1,operationLogs:[],feedbacks:[],progress:0,totalProjects:0,completedProjects:0,currentProject:""}),[W,K]=(0,a.useState)({selectedProjects:[],branchName:""}),[V,q]=(0,a.useState)({isRunning:!1,operationLogs:[],feedbacks:[],progress:0,totalProjects:0,completedProjects:0,currentProject:""}),[Q,Z]=(0,a.useState)([]),[ee,es]=(0,a.useState)(!1),[et,er]=(0,a.useState)(null),[ea,en]=(0,a.useState)(!1),[ec,eo]=(0,a.useState)(""),[el,ei]=(0,a.useState)([]),[ed,eh]=(0,a.useState)(!1),[ep,em]=(0,a.useState)({selectedProjects:[],branchName:""}),[eu,eg]=(0,a.useState)({isRunning:!1,operationLogs:[],feedbacks:[],progress:0,totalProjects:0,completedProjects:0,currentProject:""}),[ex,ej]=(0,a.useState)([]),[eb,ef]=(0,a.useState)(!1),[ey,eN]=(0,a.useState)(null),[ev,ew]=(0,a.useState)(!1),[eP,ek]=(0,a.useState)(""),[eC,eS]=(0,a.useState)([]),[eL,eR]=(0,a.useState)(!1),[eA,e$]=(0,a.useState)(!1),[eI,eB]=(0,a.useState)(null),[eO,eT]=(0,a.useState)(!1),[eE,eD]=(0,a.useState)(!1),[eM,eF]=(0,a.useState)([]),[eU,eG]=(0,a.useState)({}),[e_,ez]=(0,a.useState)({});(0,a.useEffect)(()=>{eJ()},[]),(0,a.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/admin-status"),s=await e.json();e$(!!s?.isAdmin)}catch(e){console.error("获取管理员状态失败:",e),e$(!1)}})()},[]);let eJ=async()=>{try{t(e=>({...e,isLoading:!0,globalMessage:"正在检查工作空间状态..."}));let e=await fetch("/api/check-workspace"),s=await e.json();if(s.success){let e={};s.projects.forEach(s=>{e[s.name]={name:s.name,status:s.status,progress:100*(s.status===g.ProjectStatus.EXISTING),message:s.message,canRetry:!1,needsCleanup:s.needsCleanup||!1}}),t(t=>({...t,isLoading:!1,projects:e,globalMessage:s.message||"检查完成"}))}else t(e=>({...e,isLoading:!1,globalMessage:s.error||"检查工作空间状态失败"}))}catch(e){t(e=>({...e,isLoading:!1,globalMessage:"无法连接到服务器,请刷新页面重试"})),console.error("检查工作空间状态失败:",e)}},eY=e=>{switch(e.type){case"initialization":case"workspace_created":case"projects_loaded":if(t(s=>({...s,globalProgress:e.progress||0,globalMessage:e.message||""})),e.projects&&Array.isArray(e.projects)){let s={};e.projects.forEach(e=>{s[e]={name:e,status:g.ProjectStatus.PENDING,progress:0,message:"等待开始...",canRetry:!1}}),t(e=>({...e,projects:s}))}break;case"project_existing":if(e.projectName){let s=e.projectName;t(t=>({...t,globalProgress:e.progress??t.globalProgress,globalMessage:e.message??"",projects:{...t.projects,[s]:{...t.projects[s],status:g.ProjectStatus.EXISTING,message:"项目已存在",progress:100,canRetry:!1}}}))}break;case"project_start":if(e.projectName){let s=e.projectName;t(t=>({...t,globalProgress:e.progress??t.globalProgress,globalMessage:e.message??"",projects:{...t.projects,[s]:{...t.projects[s],status:g.ProjectStatus.CLONING,message:"开始克隆...",progress:0}}}))}break;case"project_progress":if(e.projectName){let s=e.projectName;t(t=>({...t,globalProgress:e.progress??t.globalProgress,projects:{...t.projects,[s]:{...t.projects[s],message:e.message??"",progress:Math.min(e.progress??0,100)}}}))}break;case"project_success":if(e.projectName){let s=e.projectName;t(t=>({...t,globalProgress:e.progress??t.globalProgress,projects:{...t.projects,[s]:{...t.projects[s],status:g.ProjectStatus.SUCCESS,message:"克隆成功",progress:100,canRetry:!1}}}))}break;case"project_failed":if(e.projectName){let s=e.projectName;t(t=>({...t,globalProgress:e.progress??t.globalProgress,projects:{...t.projects,[s]:{...t.projects[s],status:g.ProjectStatus.FAILED,message:"克隆失败",error:e.error,canRetry:!0}}}))}break;case"command_log":if(e.projectName&&e.logType&&void 0!==e.content&&e.timestamp){let s=e.projectName,r=e.logType,a=e.content,n=e.timestamp;t(e=>({...e,projects:{...e.projects,[s]:{...e.projects[s],logs:[...e.projects[s]?.logs||[],{type:r,content:a,timestamp:n}].slice(-1e3)}}}))}break;case"completion":t(s=>({...s,isInitializing:!1,isCompleted:!0,hasCompleted:!0,globalProgress:100,globalMessage:e.message??"初始化完成",completionSummary:e.result?{success:e.result.success,totalProjects:e.result.totalProjects,successCount:e.result.successCount,failedCount:e.result.failedCount,duration:e.result.duration}:void 0}));break;case"error":t(s=>({...s,isInitializing:!1,hasCompleted:!0,globalMessage:e.message??"发生错误",globalProgress:e.progress??s.globalProgress}))}},eX=async(e,s="cursor")=>{t(s=>({...s,projects:{...s.projects,[e]:{...s.projects[e],isOpening:!0}}}));try{let r=await fetch("/api/open-project",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:e,editor:s})}),a=await r.json();if(a.success&&a.editorUrl){let e=document.createElement("a");e.href=a.editorUrl,e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e)}else console.error("打开项目失败:",a.error);t(s=>({...s,projects:{...s.projects,[e]:{...s.projects[e],isOpening:!1}}}))}catch(s){t(s=>({...s,projects:{...s.projects,[e]:{...s.projects[e],isOpening:!1}}})),console.error("打开项目失败:",s)}},eH=async e=>{t(s=>({...s,projects:{...s.projects,[e]:{...s.projects[e],isCleaningUp:!0}}}));try{let s=await fetch("/api/cleanup-project",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:e})}),r=await s.json();r.success?t(s=>({...s,projects:{...s.projects,[e]:{...s.projects[e],status:g.ProjectStatus.PENDING,message:"已清理,待克隆",isCleaningUp:!1,needsCleanup:!1}}})):t(s=>({...s,projects:{...s.projects,[e]:{...s.projects[e],isCleaningUp:!1,error:r.error}}}))}catch(s){t(t=>({...t,projects:{...t.projects,[e]:{...t.projects[e],isCleaningUp:!1,error:s instanceof Error?s.message:String(s)}}}))}},eW=async e=>{t(s=>({...s,projects:{...s.projects,[e]:{...s.projects[e],status:g.ProjectStatus.RETRYING,message:"正在重试...",progress:0,canRetry:!1}}}));try{let s=await fetch("/api/retry-project",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:e})}),r=await s.json();t(s=>({...s,projects:{...s.projects,[e]:{...s.projects[e],status:r.success?g.ProjectStatus.SUCCESS:g.ProjectStatus.FAILED,message:r.message,error:r.error,progress:r.success?100:s.projects[e].progress,canRetry:!r.success}}}))}catch(s){t(t=>({...t,projects:{...t.projects,[e]:{...t.projects[e],status:g.ProjectStatus.FAILED,message:"重试失败",error:s instanceof Error?s.message:String(s),canRetry:!0}}}))}},eK=e=>{switch(e){case g.ProjectStatus.EXISTING:case g.ProjectStatus.SUCCESS:return"text-green-600 bg-green-50 border-green-200";case g.ProjectStatus.FAILED:return"text-red-600 bg-red-50 border-red-200";case g.ProjectStatus.INCOMPLETE:return"text-orange-600 bg-orange-50 border-orange-200";case g.ProjectStatus.CLONING:case g.ProjectStatus.RETRYING:return"text-blue-600 bg-blue-50 border-blue-200";case g.ProjectStatus.PENDING:default:return"text-gray-600 bg-gray-50 border-gray-200"}},eV=e=>{switch(e){case g.ProjectStatus.PENDING:return"待克隆";case g.ProjectStatus.EXISTING:return"已存在";case g.ProjectStatus.CLONING:return"克隆中";case g.ProjectStatus.SUCCESS:return"成功";case g.ProjectStatus.FAILED:return"失败";case g.ProjectStatus.INCOMPLETE:return"不完整";case g.ProjectStatus.RETRYING:return"重试中";default:return"未知"}},eq=()=>{let e=Object.values(s.projects);return e.length>0&&e.every(e=>e.status===g.ProjectStatus.EXISTING)},eQ=s=>{e.push(`/configuration?project=${encodeURIComponent(s)}`)},eZ=(e,s)=>{k(t=>({...t,[e]:s}))},e0=(e,s)=>{R(t=>({...t,[e]:s}))},e1=(e,s)=>{B(t=>({...t,[e]:s}))},e2=(e,s)=>{D(t=>({...t,[e]:s}))},e4=e=>{G(s=>({...s,branchName:e}))},e3=e=>{Y(s=>({...s,branchName:e}))},e5=e=>{K(s=>({...s,branchName:e})),en(!1),eo("")},e7=async()=>{let e=W.selectedProjects.length>0?W.selectedProjects:Object.keys(s.projects);if(0===e.length){er("暂无可用的项目"),Z([]);return}es(!0),er(null);try{let s=await fetch("/api/batch-list-branches",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projects:e})}),t=await s.json();t.success?(Z(t.branches||[]),Array.isArray(t.failedProjects)&&t.failedProjects.length>0&&er(`${t.failedProjects.length} 个项目获取分支失败(已跳过): ${t.failedProjects.map(e=>e.projectName).join(", ")}`)):(er(t.error||"获取分支列表失败"),Z([]))}catch(e){console.error("获取批量分支列表失败:",e),er("网络请求失败"),Z([])}finally{es(!1)}},e6=async e=>{let s=[];if(0===I.selectedProjects.length&&s.push("请先选择至少一个项目。"),I.targetBranch.trim()||s.push("请填写合入分支名称。"),I.sourceBranch.trim()||s.push("请填写被合入分支名称。"),s.length>0)return void T({isRunning:!1,operationLogs:[],feedbacks:s,progress:0,totalProjects:0,completedProjects:0,currentProject:""});let t=I.selectedProjects.length;T({isRunning:!0,operationLogs:[`开始批量分支合并,共 ${t} 个项目...`],feedbacks:[],progress:0,totalProjects:t,completedProjects:0,currentProject:""});let r=[],a=[];for(let s=0;s<I.selectedProjects.length;s++){let n=I.selectedProjects[s];T(e=>({...e,currentProject:n,completedProjects:s,progress:Math.round(s/t*100),operationLogs:[...e.operationLogs,`[进度] ${s+1}/${t} 开始处理项目 ${n}`]}));try{let s=await fetch("/api/admin-git-batch-merge",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projects:[n],targetBranch:I.targetBranch.trim(),sourceBranch:I.sourceBranch.trim(),dryRun:e})}),t=await s.json(),c=Array.isArray(t.operationLogs)?t.operationLogs:[],o=Array.isArray(t.feedbacks)?t.feedbacks:[t.error||"执行失败"];T(e=>({...e,operationLogs:[...e.operationLogs,...c],feedbacks:[...e.feedbacks,...o]})),a.push(...o),Array.isArray(t.projectResults)&&r.push(...t.projectResults)}catch(s){let e=s instanceof Error?s.message:"执行失败";T(s=>({...s,operationLogs:[...s.operationLogs,`[${n}] 请求失败: ${e}`],feedbacks:[...s.feedbacks,`[${n}] ${e}`]})),a.push(`[${n}] ${e}`),r.push({projectName:n,success:!1,reason:e})}}T(e=>({...e,isRunning:!1,progress:100,completedProjects:t,currentProject:"",operationLogs:[...e.operationLogs,"批量分支合并执行完成。"],feedbacks:a.length>0?a:e.feedbacks})),r.length>0?(eF(r),eD(!0)):(eF([]),eD(!1))},e8=async e=>{let s=[];if(0===E.selectedProjects.length&&s.push("请先选择至少一个项目。"),E.createBranch.trim()||s.push("请填写新分支名称。"),E.baseBranch.trim()||s.push("请填写来源分支名称。"),s.length>0)return void F({isRunning:!1,operationLogs:[],feedbacks:s,progress:0,totalProjects:0,completedProjects:0,currentProject:""});let t=E.selectedProjects.length;F({isRunning:!0,operationLogs:[`开始批量新建分支,共 ${t} 个项目...`],feedbacks:[],progress:0,totalProjects:t,completedProjects:0,currentProject:""});let r=[],a=[];for(let s=0;s<E.selectedProjects.length;s++){let n=E.selectedProjects[s];F(e=>({...e,currentProject:n,completedProjects:s,progress:Math.round(s/t*100),operationLogs:[...e.operationLogs,`[进度] ${s+1}/${t} 开始处理项目 ${n}`]}));try{let s=await fetch("/api/admin-git-batch-create-branch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projects:[n],createBranch:E.createBranch.trim(),baseBranch:E.baseBranch.trim(),dryRun:e})}),t=await s.json(),c=Array.isArray(t.operationLogs)?t.operationLogs:[],o=Array.isArray(t.feedbacks)?t.feedbacks:[t.error||"执行失败"];F(e=>({...e,operationLogs:[...e.operationLogs,...c],feedbacks:[...e.feedbacks,...o]})),a.push(...o),Array.isArray(t.projectResults)&&r.push(...t.projectResults)}catch(s){let e=s instanceof Error?s.message:"执行失败";F(s=>({...s,operationLogs:[...s.operationLogs,`[${n}] 请求失败: ${e}`],feedbacks:[...s.feedbacks,`[${n}] ${e}`]})),a.push(`[${n}] ${e}`),r.push({projectName:n,success:!1,reason:e})}}F(e=>({...e,isRunning:!1,progress:100,completedProjects:t,currentProject:"",operationLogs:[...e.operationLogs,"批量新建分支执行完成。"],feedbacks:a.length>0?a:e.feedbacks})),r.length>0?(eF(r),eD(!0)):(eF([]),eD(!1))},e9=async e=>{let s=[];if(0===U.selectedProjects.length&&s.push("请先选择至少一个项目。"),U.branchName.trim()||s.push("请填写远端分支名称。"),s.length>0)return void z({isRunning:!1,operationLogs:[],feedbacks:s,progress:0,totalProjects:0,completedProjects:0,currentProject:""});let t=U.selectedProjects.length;z({isRunning:!0,operationLogs:[`开始批量删除远端分支,共 ${t} 个项目...`],feedbacks:[],progress:0,totalProjects:t,completedProjects:0,currentProject:""});let r=[],a=[];for(let s=0;s<U.selectedProjects.length;s++){let n=U.selectedProjects[s];z(e=>({...e,currentProject:n,completedProjects:s,progress:Math.round(s/t*100),operationLogs:[...e.operationLogs,`[进度] ${s+1}/${t} 开始处理项目 ${n}`]}));try{let s=await fetch("/api/admin-git-batch-delete-branch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projects:[n],branchName:U.branchName.trim(),dryRun:e})}),t=await s.json(),c=Array.isArray(t.operationLogs)?t.operationLogs:[],o=Array.isArray(t.feedbacks)?t.feedbacks:[t.error||"执行失败"];z(e=>({...e,operationLogs:[...e.operationLogs,...c],feedbacks:[...e.feedbacks,...o]})),a.push(...o),Array.isArray(t.projectResults)&&r.push(...t.projectResults)}catch(s){let e=s instanceof Error?s.message:"执行失败";z(s=>({...s,operationLogs:[...s.operationLogs,`[${n}] 请求失败: ${e}`],feedbacks:[...s.feedbacks,`[${n}] ${e}`]})),a.push(`[${n}] ${e}`),r.push({projectName:n,success:!1,reason:e})}}z(e=>({...e,isRunning:!1,progress:100,completedProjects:t,currentProject:"",operationLogs:[...e.operationLogs,"批量删除远端分支执行完成。"],feedbacks:a.length>0?a:e.feedbacks})),r.length>0?(eF(r),eD(!0)):(eF([]),eD(!1))},se=async e=>{let s=j(J.selectedProjects,J.branchName);if(s.length>0)return void H({isRunning:!1,operationLogs:[],feedbacks:s,progress:0,totalProjects:0,completedProjects:0,currentProject:""});let t=J.selectedProjects.length;H({isRunning:!0,operationLogs:[`开始批量探测远端分支,共 ${t} 个项目...`],feedbacks:[],progress:0,totalProjects:t,completedProjects:0,currentProject:""});let r=[],a=[];for(let s=0;s<J.selectedProjects.length;s++){let n=J.selectedProjects[s];H(e=>({...e,currentProject:n,completedProjects:s,progress:Math.round(s/t*100),operationLogs:[...e.operationLogs,`[进度] ${s+1}/${t} 开始处理项目 ${n}`]}));try{let s=await fetch("/api/admin-git-batch-probe-remote-branch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v(n,J.branchName,e))}),t=await s.json(),c=Array.isArray(t.operationLogs)?t.operationLogs:[],o=Array.isArray(t.feedbacks)?t.feedbacks:[t.error||"执行失败"];H(e=>({...e,operationLogs:[...e.operationLogs,...c],feedbacks:[...e.feedbacks,...o]})),a.push(...o),Array.isArray(t.projectResults)&&r.push(...t.projectResults)}catch(s){let e=s instanceof Error?s.message:"执行失败";H(s=>({...s,operationLogs:[...s.operationLogs,`[${n}] 请求失败: ${e}`],feedbacks:[...s.feedbacks,`[${n}] ${e}`]})),a.push(`[${n}] ${e}`),r.push({projectName:n,success:!1,reason:e})}}H(e=>({...e,isRunning:!1,progress:100,completedProjects:t,currentProject:"",operationLogs:[...e.operationLogs,"批量探测远端分支执行完成。"],feedbacks:a.length>0?a:e.feedbacks})),r.length>0?(eF(r),eD(!0)):(eF([]),eD(!1))},ss=async e=>{let s=b(W.selectedProjects,W.branchName);if(s.length>0)return void q({isRunning:!1,operationLogs:[],feedbacks:s,progress:0,totalProjects:0,completedProjects:0,currentProject:""});let t=W.selectedProjects.length,r=W.branchName.trim();q({isRunning:!0,operationLogs:[`开始批量切换分支${e?"(DRY RUN)":""},目标分支: ${r},共 ${t} 个项目...`],feedbacks:[],progress:0,totalProjects:t,completedProjects:0,currentProject:""});let a=[],n=[];for(let s=0;s<W.selectedProjects.length;s++){let c=W.selectedProjects[s];q(e=>({...e,currentProject:c,completedProjects:s,progress:Math.round(s/t*100),operationLogs:[...e.operationLogs,`[进度] ${s+1}/${t} 开始处理项目 ${c}`]}));try{let s=await fetch("/api/batch-switch-branch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f(c,r,e))}),t=await s.json(),o=Array.isArray(t.operationLogs)?t.operationLogs:[],l=Array.isArray(t.feedbacks)?t.feedbacks:[t.error||"执行失败"];q(e=>({...e,operationLogs:[...e.operationLogs,...o],feedbacks:[...e.feedbacks,...l]})),n.push(...l),Array.isArray(t.projectResults)&&a.push(...t.projectResults)}catch(s){let e=s instanceof Error?s.message:"执行失败";q(s=>({...s,operationLogs:[...s.operationLogs,`[${c}] 请求失败: ${e}`],feedbacks:[...s.feedbacks,`[${c}] ${e}`]})),n.push(`[${c}] ${e}`),a.push({projectName:c,success:!1,reason:e})}}let c=a.filter(e=>e.success).length,o=a.length-c;q(e=>({...e,isRunning:!1,progress:100,completedProjects:t,currentProject:"",operationLogs:[...e.operationLogs,`批量切换分支执行完成。总结: 共 ${a.length} 个项目,成功 ${c} 个,失败 ${o} 个。`],feedbacks:n.length>0?n:e.feedbacks})),a.length>0?(ei(a),eh(!0)):(ei([]),eh(!1)),st(a.map(e=>e.projectName))},st=e=>{ez(s=>{let t={...s};return e.forEach(e=>{t[e]=(t[e]||0)+1}),t})},sr=e=>{em(s=>({...s,branchName:e})),ew(!1),ek("")},sa=async()=>{let e=ep.selectedProjects.length>0?ep.selectedProjects:Object.keys(s.projects);if(0===e.length){eN("暂无可用的项目"),ej([]);return}ef(!0),eN(null);try{let s=await fetch("/api/batch-list-submodule-branches",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projects:e})}),t=await s.json();t.success?(ej(t.branches||[]),Array.isArray(t.failedProjects)&&t.failedProjects.length>0&&eN(`${t.failedProjects.length} 个项目获取子仓库分支失败(已跳过): ${t.failedProjects.map(e=>e.projectName).join(", ")}`)):(eN(t.error||"获取子仓库分支列表失败"),ej([]))}catch(e){console.error("获取批量子仓库分支列表失败:",e),eN("网络请求失败"),ej([])}finally{ef(!1)}},sn=async e=>{let s=y(ep.selectedProjects,ep.branchName);if(s.length>0)return void eg({isRunning:!1,operationLogs:[],feedbacks:s,progress:0,totalProjects:0,completedProjects:0,currentProject:""});let t=ep.selectedProjects.length,r=ep.branchName.trim();eg({isRunning:!0,operationLogs:[`开始批量切换子仓库(submodules/common)分支${e?"(DRY RUN)":""},目标分支: ${r},共 ${t} 个项目...`],feedbacks:[],progress:0,totalProjects:t,completedProjects:0,currentProject:""});let a=[],n=[];for(let s=0;s<ep.selectedProjects.length;s++){let c=ep.selectedProjects[s];eg(e=>({...e,currentProject:c,completedProjects:s,progress:Math.round(s/t*100),operationLogs:[...e.operationLogs,`[进度] ${s+1}/${t} 开始处理项目 ${c}`]}));try{let s=await fetch("/api/batch-switch-submodule-branch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N(c,r,e))}),t=await s.json(),o=Array.isArray(t.operationLogs)?t.operationLogs:[],l=Array.isArray(t.feedbacks)?t.feedbacks:[t.error||"执行失败"];eg(e=>({...e,operationLogs:[...e.operationLogs,...o],feedbacks:[...e.feedbacks,...l]})),n.push(...l),Array.isArray(t.projectResults)&&a.push(...t.projectResults)}catch(s){let e=s instanceof Error?s.message:"执行失败";eg(s=>({...s,operationLogs:[...s.operationLogs,`[${c}] 请求失败: ${e}`],feedbacks:[...s.feedbacks,`[${c}] ${e}`]})),n.push(`[${c}] ${e}`),a.push({projectName:c,success:!1,reason:e})}}let c=a.filter(e=>e.success).length,o=a.length-c;eg(e=>({...e,isRunning:!1,progress:100,completedProjects:t,currentProject:"",operationLogs:[...e.operationLogs,`批量切换子仓库分支执行完成。总结: 共 ${a.length} 个项目,成功 ${c} 个,失败 ${o} 个。`],feedbacks:n.length>0?n:e.feedbacks})),a.length>0?(eS(a),eR(!0)):(eS([]),eR(!1)),st(a.map(e=>e.projectName))},sc=async e=>{let s=[];if(0===P.selectedProjects.length&&s.push("请先选择至少一个项目。"),P.createBranch.trim()||s.push("请填写创建分支名。"),P.baseBranch.trim()||s.push("请填写从 origin 哪个分支创建。"),P.mergeBranch.trim()||s.push("请填写被合并分支名称。"),s.length>0)return void S({isRunning:!1,operationLogs:[],feedbacks:s,runId:""});let t=`uat-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;S({isRunning:!0,operationLogs:[],feedbacks:[],runId:t});try{let s=await fetch("/api/uat-git-flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projects:P.selectedProjects,createBranch:P.createBranch.trim(),baseBranch:"main",mergeBranch:P.mergeBranch.trim(),dryRun:e,runId:t})}),r=await s.json();S({isRunning:!1,operationLogs:Array.isArray(r.operationLogs)?r.operationLogs:[],feedbacks:Array.isArray(r.feedbacks)?r.feedbacks:[r.error||"执行失败"],runId:""}),Array.isArray(r.projectResults)&&(eF(r.projectResults),eD(!0))}catch(e){S({isRunning:!1,operationLogs:[],feedbacks:[e instanceof Error?e.message:"执行失败"],runId:""}),eF([]),eD(!1)}},so=async e=>{let s=[];if(0===L.selectedProjects.length&&s.push("请先选择至少一个项目。"),L.createBranch.trim()||s.push("请填写创建分支名。"),L.baseBranch.trim()||s.push("请填写从 origin 哪个分支创建。"),L.mergeBranch.trim()||s.push("请填写被合并分支名称。"),s.length>0)return void $({isRunning:!1,operationLogs:[],feedbacks:s,runId:""});let t=`gwh-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;$({isRunning:!0,operationLogs:[],feedbacks:[],runId:t});try{let s=await fetch("/api/gwh-git-flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projects:L.selectedProjects,createBranch:L.createBranch.trim(),baseBranch:"GWH",mergeBranch:L.mergeBranch.trim(),dryRun:e,runId:t})}),r=await s.json();$({isRunning:!1,operationLogs:Array.isArray(r.operationLogs)?r.operationLogs:[],feedbacks:Array.isArray(r.feedbacks)?r.feedbacks:[r.error||"执行失败"],runId:""}),Array.isArray(r.projectResults)&&(eF(r.projectResults),eD(!0))}catch(e){$({isRunning:!1,operationLogs:[],feedbacks:[e instanceof Error?e.message:"执行失败"],runId:""}),eF([]),eD(!1)}},sl=async()=>{if(eI&&C.runId)try{let e=await fetch("/api/uat-git-flow/step",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"execute",runId:C.runId,stepId:eI.stepId})}),s=await e.json(),t=Array.isArray(s.operationLogs)?s.operationLogs:[],r=Array.isArray(s.feedbacks)?s.feedbacks:[s.error||"执行失败"];if(!s.success){S(e=>({...e,isRunning:!1,operationLogs:t,feedbacks:r,runId:""})),eB(null),eT(!1);return}S(e=>({...e,operationLogs:t,feedbacks:r,isRunning:!s.isComplete,runId:s.isComplete?"":e.runId})),s.nextStep?(eB(s.nextStep),eT(!0)):(eB(null),eT(!1),Array.isArray(s.projectResults)&&(eF(s.projectResults),eD(!0)))}catch(e){S(s=>({...s,isRunning:!1,operationLogs:s.operationLogs,feedbacks:[...s.feedbacks,e instanceof Error?e.message:"执行失败"],runId:""})),eB(null),eT(!1)}},si=async()=>{if(C.runId)try{let e=await fetch("/api/uat-git-flow/abort",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runId:C.runId})}),s=await e.json();s&&Array.isArray(s.operationLogs)?S(e=>({...e,isRunning:!1,operationLogs:s.operationLogs,feedbacks:Array.isArray(s.feedbacks)?s.feedbacks:e.feedbacks,runId:""})):S(e=>({...e,isRunning:!1,runId:""})),Array.isArray(s.projectResults)&&(eF(s.projectResults),eD(!0)),eB(null),eT(!1)}catch(e){S(s=>({...s,feedbacks:[...s.feedbacks,e instanceof Error?e.message:"中断失败"]}))}},sd=async()=>{if(A.runId)try{let e=await fetch("/api/gwh-git-flow/abort",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runId:A.runId})}),s=await e.json();s&&Array.isArray(s.operationLogs)?$(e=>({...e,isRunning:!1,operationLogs:s.operationLogs,feedbacks:Array.isArray(s.feedbacks)?s.feedbacks:e.feedbacks,runId:""})):$(e=>({...e,isRunning:!1,runId:""})),Array.isArray(s.projectResults)&&(eF(s.projectResults),eD(!0))}catch(e){$(s=>({...s,feedbacks:[...s.feedbacks,e instanceof Error?e.message:"中断失败"]}))}},sh=(0,x.filterBranchOptions)(Q,ec),sp=(0,x.filterBranchOptions)(ex,eP);return(0,r.jsxs)("div",{className:"container mx-auto p-4 sm:p-6 md:p-8",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold",children:"项目初始化"}),s.isLoading?(0,r.jsx)(c.Button,{disabled:!0,children:"检查中..."}):(0,r.jsx)(c.Button,{onClick:()=>{t(e=>({...e,isInitializing:!0,isCompleted:!1,hasCompleted:!1,globalProgress:0,globalMessage:"正在连接服务器...",projects:{},completionSummary:void 0}));let e=new EventSource("/api/initialize-workspace");e.onmessage=e=>{try{let s=JSON.parse(e.data);eY(s)}catch(e){console.error("解析 SSE 消息失败:",e)}},e.onerror=()=>{t(e=>e.hasCompleted?e:{...e,isInitializing:!1,globalMessage:"连接服务器失败,请重试"}),e.close()},e.addEventListener("error",()=>{e.close()})},disabled:s.isInitializing,children:s.isInitializing?"初始化中...":"创建项目空间"})]}),(s.isInitializing||s.isCompleted)&&!eq()&&(0,r.jsxs)("div",{className:"mb-6 p-4 bg-gray-50 rounded-lg",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,r.jsx)("span",{className:"text-sm font-medium",children:s.globalMessage}),(0,r.jsxs)("span",{className:"text-sm text-gray-600",children:[s.globalProgress,"%"]})]}),(0,r.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,r.jsx)("div",{className:"bg-blue-600 h-2 rounded-full transition-all duration-300",style:{width:`${s.globalProgress}%`}})})]}),s.completionSummary&&!eq()&&(0,r.jsxs)("div",{className:`mb-6 p-4 rounded-lg border ${s.completionSummary.success?"bg-green-50 border-green-200":"bg-yellow-50 border-yellow-200"}`,children:[(0,r.jsx)("h3",{className:"font-semibold mb-2",children:"初始化完成"}),(0,r.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[(0,r.jsxs)("div",{children:["总项目数: ",s.completionSummary.totalProjects]}),(0,r.jsxs)("div",{className:"text-green-600",children:["成功: ",s.completionSummary.successCount]}),(0,r.jsxs)("div",{className:"text-red-600",children:["失败: ",s.completionSummary.failedCount]}),(0,r.jsxs)("div",{children:["耗时: ",Math.round(s.completionSummary.duration/1e3),"s"]})]})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:Object.keys(s.projects).length>0?Object.values(s.projects).map(e=>(0,r.jsxs)("div",{className:`border rounded-lg p-4 ${eK(e.status)}`,children:[(0,r.jsxs)("div",{className:"flex justify-between items-start mb-2",children:[(0,r.jsx)("h2",{className:"font-semibold cursor-pointer hover:text-blue-600 transition-colors",onClick:()=>eQ(e.name),title:"点击进入项目配置",children:e.name}),(0,r.jsx)("span",{className:"text-xs px-2 py-1 rounded-full bg-white",children:eV(e.status)})]}),(0,r.jsx)("p",{className:"text-sm mb-2",children:e.message}),e.status===g.ProjectStatus.CLONING||e.status===g.ProjectStatus.RETRYING?(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("div",{className:"w-full bg-white rounded-full h-1",children:(0,r.jsx)("div",{className:"bg-current h-1 rounded-full transition-all duration-300",style:{width:`${e.progress}%`}})}),(0,r.jsxs)("span",{className:"text-xs",children:[e.progress,"%"]})]}):null,e.error&&(0,r.jsx)("p",{className:"text-xs text-red-600 mb-2",children:e.error}),(e.status===g.ProjectStatus.EXISTING||e.status===g.ProjectStatus.SUCCESS)&&(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsx)(l.default,{projectName:e.name,variant:"main",refreshSignal:e_[e.name]||0,onSwitched:()=>ez(s=>({...s,[e.name]:(s[e.name]||0)+1}))})}),(e.status===g.ProjectStatus.EXISTING||e.status===g.ProjectStatus.SUCCESS)&&(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsx)(l.default,{projectName:e.name,variant:"sub",refreshSignal:e_[e.name]||0})}),(0,r.jsxs)("div",{className:"space-y-2",children:[e.canRetry&&(0,r.jsx)(c.Button,{size:"sm",variant:"outline",onClick:()=>eW(e.name),className:"w-full",children:"重试"}),e.needsCleanup&&e.status===g.ProjectStatus.INCOMPLETE&&(0,r.jsx)(c.Button,{size:"sm",variant:"destructive",onClick:()=>eH(e.name),disabled:e.isCleaningUp,className:"w-full",children:e.isCleaningUp?"清理中...":"清理项目"}),(e.status===g.ProjectStatus.EXISTING||e.status===g.ProjectStatus.SUCCESS)&&(0,r.jsx)(o.EditorSplitButton,{onOpen:s=>eX(e.name,s),loading:e.isOpening,loadingText:"打开中...",size:"sm",variant:"default",className:"w-full"}),e.logs&&e.logs.length>0&&(0,r.jsx)(c.Button,{size:"sm",variant:"outline",onClick:()=>eG(s=>({...s,[e.name]:!s[e.name]})),className:"w-full",children:eU[e.name]?"隐藏日志":`查看日志 (${e.logs.length})`})]}),eU[e.name]&&e.logs&&e.logs.length>0&&(0,r.jsx)("div",{className:"mt-3 border-t pt-3",children:(0,r.jsx)("div",{className:"bg-black text-white rounded text-xs font-mono p-2 max-h-48 overflow-y-auto",children:e.logs.map((e,s)=>(0,r.jsxs)("div",{className:`mb-1 ${"stderr"===e.type?"text-red-400":"progress"===e.type?"text-yellow-400":"text-green-400"}`,children:[(0,r.jsx)("span",{className:"text-gray-500 mr-2",children:new Date(e.timestamp).toLocaleTimeString()}),(0,r.jsxs)("span",{className:"text-blue-400 mr-2",children:["[",e.type,"]"]}),(0,r.jsx)("span",{className:"whitespace-pre-wrap",children:e.content})]},s))})})]},e.name)):(0,r.jsx)("div",{className:"col-span-full text-center text-gray-500 py-8",children:s.isLoading?"正在检查项目状态...":s.isInitializing?"正在加载项目...":'点击"创建项目空间"开始初始化'})}),eA&&(0,r.jsxs)("div",{className:"mt-8 rounded-lg border bg-white p-4 shadow-sm",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"UAT上线前 Git 操作流"}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsx)(c.Button,{onClick:()=>sc(!1),disabled:C.isRunning,children:C.isRunning?"执行中...":"执行"}),(0,r.jsx)(c.Button,{variant:"outline",onClick:()=>sc(!0),disabled:C.isRunning,children:"DRY RUN"}),(0,r.jsx)(c.Button,{variant:"destructive",onClick:si,disabled:!C.isRunning,children:"中断"})]})]}),(0,r.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"uat-projects",children:"选择项目"}),(0,r.jsx)("select",{id:"uat-projects",multiple:!0,value:P.selectedProjects,onChange:e=>{let s=Array.from(e.target.selectedOptions).map(e=>e.value);k(e=>({...e,selectedProjects:s}))},className:"w-full min-h-[140px] rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",children:0===Object.keys(s.projects).length?(0,r.jsx)("option",{value:"",disabled:!0,children:"暂无可用项目"}):Object.keys(s.projects).map(e=>(0,r.jsx)("option",{value:e,children:e},e))}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"按住 Command / Ctrl 可多选"})]}),(0,r.jsxs)("div",{className:"grid gap-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"uat-create-branch",children:"创建分支名"}),(0,r.jsx)(i.Input,{id:"uat-create-branch",value:P.createBranch,onChange:e=>eZ("createBranch",e.target.value),placeholder:"例如: release/uat-2026-01"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"uat-base-branch",children:"从 origin 哪个分支创建(固定)"}),(0,r.jsx)(i.Input,{id:"uat-base-branch",value:P.baseBranch,disabled:!0,placeholder:"main"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"uat-merge-branch",children:"被合并分支名称"}),(0,r.jsx)(i.Input,{id:"uat-merge-branch",value:P.mergeBranch,onChange:e=>eZ("mergeBranch",e.target.value),placeholder:"例如: feature/xxx"})]})]})]}),(0,r.jsxs)("div",{className:"mt-6 grid gap-4 md:grid-cols-2",children:[(0,r.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold mb-2",children:"操作记录"}),0===C.operationLogs.length?(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"暂无记录"}):(0,r.jsx)("div",{className:"bg-black text-white rounded text-xs font-mono p-2 max-h-48 overflow-y-auto",children:C.operationLogs.map((e,s)=>(0,r.jsx)("div",{className:"mb-1 whitespace-pre-wrap",children:e},s))})]}),(0,r.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold mb-2",children:"反馈信息"}),0===C.feedbacks.length?(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"暂无反馈"}):(0,r.jsx)("div",{className:"space-y-1 text-sm",children:C.feedbacks.map((e,s)=>(0,r.jsx)("div",{className:"rounded bg-gray-50 px-2 py-1 text-gray-700",children:e},s))})]})]})]}),eA&&(0,r.jsxs)("div",{className:"mt-8 rounded-lg border bg-white p-4 shadow-sm",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"武汉协和版本上线前 Git 操作流"}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsx)(c.Button,{onClick:()=>so(!1),disabled:A.isRunning,children:A.isRunning?"执行中...":"执行"}),(0,r.jsx)(c.Button,{variant:"outline",onClick:()=>so(!0),disabled:A.isRunning,children:"DRY RUN"}),(0,r.jsx)(c.Button,{variant:"destructive",onClick:sd,disabled:!A.isRunning,children:"中断"})]})]}),(0,r.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"gwh-projects",children:"选择项目"}),(0,r.jsx)("select",{id:"gwh-projects",multiple:!0,value:L.selectedProjects,onChange:e=>{let s=Array.from(e.target.selectedOptions).map(e=>e.value);R(e=>({...e,selectedProjects:s}))},className:"w-full min-h-[140px] rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",children:0===Object.keys(s.projects).length?(0,r.jsx)("option",{value:"",disabled:!0,children:"暂无可用项目"}):Object.keys(s.projects).map(e=>(0,r.jsx)("option",{value:e,children:e},e))}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"按住 Command / Ctrl 可多选"})]}),(0,r.jsxs)("div",{className:"grid gap-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"gwh-create-branch",children:"创建分支名"}),(0,r.jsx)(i.Input,{id:"gwh-create-branch",value:L.createBranch,onChange:e=>e0("createBranch",e.target.value),placeholder:"例如: release/whxh-2026-03"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"gwh-base-branch",children:"从 origin 哪个分支创建(固定)"}),(0,r.jsx)(i.Input,{id:"gwh-base-branch",value:L.baseBranch,disabled:!0,placeholder:"GWH"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"gwh-merge-branch",children:"被合并分支名称"}),(0,r.jsx)(i.Input,{id:"gwh-merge-branch",value:L.mergeBranch,onChange:e=>e0("mergeBranch",e.target.value),placeholder:"例如: feature/xxx"})]})]})]}),(0,r.jsxs)("div",{className:"mt-6 grid gap-4 md:grid-cols-2",children:[(0,r.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold mb-2",children:"操作记录"}),0===A.operationLogs.length?(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"暂无记录"}):(0,r.jsx)("div",{className:"bg-black text-white rounded text-xs font-mono p-2 max-h-48 overflow-y-auto",children:A.operationLogs.map((e,s)=>(0,r.jsx)("div",{className:"mb-1 whitespace-pre-wrap",children:e},s))})]}),(0,r.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold mb-2",children:"反馈信息"}),0===A.feedbacks.length?(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"暂无反馈"}):(0,r.jsx)("div",{className:"space-y-1 text-sm",children:A.feedbacks.map((e,s)=>(0,r.jsx)("div",{className:"rounded bg-gray-50 px-2 py-1 text-gray-700",children:e},s))})]})]})]}),eA&&(0,r.jsxs)("div",{className:"mt-8 rounded-lg border bg-white p-4 shadow-sm",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"常用 Git 分支操作 · 批量分支合并"}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsx)(c.Button,{onClick:()=>e6(!1),disabled:O.isRunning,children:O.isRunning?"执行中...":"执行"}),(0,r.jsx)(c.Button,{variant:"outline",onClick:()=>e6(!0),disabled:O.isRunning,children:"DRY RUN"})]})]}),(0,r.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"batch-merge-projects",children:"选择项目"}),(0,r.jsx)("select",{id:"batch-merge-projects",multiple:!0,value:I.selectedProjects,onChange:e=>{let s=Array.from(e.target.selectedOptions).map(e=>e.value);B(e=>({...e,selectedProjects:s}))},className:"w-full min-h-[140px] rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",children:0===Object.keys(s.projects).length?(0,r.jsx)("option",{value:"",disabled:!0,children:"暂无可用项目"}):Object.keys(s.projects).map(e=>(0,r.jsx)("option",{value:e,children:e},e))}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"按住 Command / Ctrl 可多选"})]}),(0,r.jsxs)("div",{className:"grid gap-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"batch-merge-target-branch",children:"合入分支名称"}),(0,r.jsx)(i.Input,{id:"batch-merge-target-branch",value:I.targetBranch,onChange:e=>e1("targetBranch",e.target.value),placeholder:"例如: main"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"batch-merge-source-branch",children:"被合入分支名称"}),(0,r.jsx)(i.Input,{id:"batch-merge-source-branch",value:I.sourceBranch,onChange:e=>e1("sourceBranch",e.target.value),placeholder:"例如: release/candidate"})]})]})]}),(O.isRunning||O.progress>0)&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border p-3",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-2 text-sm",children:[(0,r.jsxs)("span",{children:["进度: ",O.completedProjects,"/",O.totalProjects,O.currentProject?` \xb7 当前项目: ${O.currentProject}`:""]}),(0,r.jsxs)("span",{children:[O.progress,"%"]})]}),(0,r.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,r.jsx)("div",{className:"bg-blue-600 h-2 rounded-full transition-all duration-300",style:{width:`${O.progress}%`}})})]}),(0,r.jsxs)("div",{className:"mt-6 grid gap-4 md:grid-cols-2",children:[(0,r.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold mb-2",children:"操作记录"}),0===O.operationLogs.length?(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"暂无记录"}):(0,r.jsx)("div",{className:"bg-black text-white rounded text-xs font-mono p-2 max-h-48 overflow-y-auto",children:O.operationLogs.map((e,s)=>(0,r.jsx)("div",{className:"mb-1 whitespace-pre-wrap",children:e},s))})]}),(0,r.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold mb-2",children:"反馈信息"}),0===O.feedbacks.length?(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"暂无反馈"}):(0,r.jsx)("div",{className:"space-y-1 text-sm",children:O.feedbacks.map((e,s)=>(0,r.jsx)("div",{className:"rounded bg-gray-50 px-2 py-1 text-gray-700",children:e},s))})]})]})]}),eA&&(0,r.jsxs)("div",{className:"mt-8 rounded-lg border bg-white p-4 shadow-sm",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"常用 Git 分支操作 · 批量新建分支"}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsx)(c.Button,{onClick:()=>e8(!1),disabled:M.isRunning,children:M.isRunning?"执行中...":"执行"}),(0,r.jsx)(c.Button,{variant:"outline",onClick:()=>e8(!0),disabled:M.isRunning,children:"DRY RUN"})]})]}),(0,r.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"batch-create-branch-projects",children:"选择项目"}),(0,r.jsx)("select",{id:"batch-create-branch-projects",multiple:!0,value:E.selectedProjects,onChange:e=>{let s=Array.from(e.target.selectedOptions).map(e=>e.value);D(e=>({...e,selectedProjects:s}))},className:"w-full min-h-[140px] rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",children:0===Object.keys(s.projects).length?(0,r.jsx)("option",{value:"",disabled:!0,children:"暂无可用项目"}):Object.keys(s.projects).map(e=>(0,r.jsx)("option",{value:e,children:e},e))}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"按住 Command / Ctrl 可多选"})]}),(0,r.jsxs)("div",{className:"grid gap-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"batch-create-branch-name",children:"新分支名称"}),(0,r.jsx)(i.Input,{id:"batch-create-branch-name",value:E.createBranch,onChange:e=>e2("createBranch",e.target.value),placeholder:"例如: release/2026-03"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"batch-create-branch-base",children:"来源分支名称"}),(0,r.jsx)(i.Input,{id:"batch-create-branch-base",value:E.baseBranch,onChange:e=>e2("baseBranch",e.target.value),placeholder:"例如: main"})]})]})]}),(M.isRunning||M.progress>0)&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border p-3",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-2 text-sm",children:[(0,r.jsxs)("span",{children:["进度: ",M.completedProjects,"/",M.totalProjects,M.currentProject?` \xb7 当前项目: ${M.currentProject}`:""]}),(0,r.jsxs)("span",{children:[M.progress,"%"]})]}),(0,r.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,r.jsx)("div",{className:"bg-blue-600 h-2 rounded-full transition-all duration-300",style:{width:`${M.progress}%`}})})]}),(0,r.jsxs)("div",{className:"mt-6 grid gap-4 md:grid-cols-2",children:[(0,r.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold mb-2",children:"操作记录"}),0===M.operationLogs.length?(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"暂无记录"}):(0,r.jsx)("div",{className:"bg-black text-white rounded text-xs font-mono p-2 max-h-48 overflow-y-auto",children:M.operationLogs.map((e,s)=>(0,r.jsx)("div",{className:"mb-1 whitespace-pre-wrap",children:e},s))})]}),(0,r.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold mb-2",children:"反馈信息"}),0===M.feedbacks.length?(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"暂无反馈"}):(0,r.jsx)("div",{className:"space-y-1 text-sm",children:M.feedbacks.map((e,s)=>(0,r.jsx)("div",{className:"rounded bg-gray-50 px-2 py-1 text-gray-700",children:e},s))})]})]})]}),eA&&(0,r.jsxs)("div",{className:"mt-8 rounded-lg border bg-white p-4 shadow-sm",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"常用 Git 分支操作 · 批量删除远端分支"}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsx)(c.Button,{onClick:()=>e9(!1),disabled:_.isRunning,children:_.isRunning?"执行中...":"执行"}),(0,r.jsx)(c.Button,{variant:"outline",onClick:()=>e9(!0),disabled:_.isRunning,children:"DRY RUN"})]})]}),(0,r.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"batch-delete-branch-projects",children:"选择项目"}),(0,r.jsx)("select",{id:"batch-delete-branch-projects",multiple:!0,value:U.selectedProjects,onChange:e=>{let s=Array.from(e.target.selectedOptions).map(e=>e.value);G(e=>({...e,selectedProjects:s}))},className:"w-full min-h-[140px] rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",children:0===Object.keys(s.projects).length?(0,r.jsx)("option",{value:"",disabled:!0,children:"暂无可用项目"}):Object.keys(s.projects).map(e=>(0,r.jsx)("option",{value:e,children:e},e))}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"按住 Command / Ctrl 可多选"})]}),(0,r.jsx)("div",{className:"grid gap-4",children:(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"batch-delete-branch-name",children:"远端分支名称"}),(0,r.jsx)(i.Input,{id:"batch-delete-branch-name",value:U.branchName,onChange:e=>e4(e.target.value),placeholder:"例如: release/2026-03"})]})})]}),(_.isRunning||_.progress>0)&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border p-3",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-2 text-sm",children:[(0,r.jsxs)("span",{children:["进度: ",_.completedProjects,"/",_.totalProjects,_.currentProject?` \xb7 当前项目: ${_.currentProject}`:""]}),(0,r.jsxs)("span",{children:[_.progress,"%"]})]}),(0,r.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,r.jsx)("div",{className:"bg-blue-600 h-2 rounded-full transition-all duration-300",style:{width:`${_.progress}%`}})})]}),(0,r.jsxs)("div",{className:"mt-6 grid gap-4 md:grid-cols-2",children:[(0,r.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold mb-2",children:"操作记录"}),0===_.operationLogs.length?(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"暂无记录"}):(0,r.jsx)("div",{className:"bg-black text-white rounded text-xs font-mono p-2 max-h-48 overflow-y-auto",children:_.operationLogs.map((e,s)=>(0,r.jsx)("div",{className:"mb-1 whitespace-pre-wrap",children:e},s))})]}),(0,r.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold mb-2",children:"反馈信息"}),0===_.feedbacks.length?(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"暂无反馈"}):(0,r.jsx)("div",{className:"space-y-1 text-sm",children:_.feedbacks.map((e,s)=>(0,r.jsx)("div",{className:"rounded bg-gray-50 px-2 py-1 text-gray-700",children:e},s))})]})]})]}),eA&&(0,r.jsxs)("div",{className:"mt-8 rounded-lg border bg-white p-4 shadow-sm",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"常用 Git 分支操作 · 批量探测远端分支"}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsx)(c.Button,{onClick:()=>se(!1),disabled:X.isRunning,children:X.isRunning?"执行中...":"执行"}),(0,r.jsx)(c.Button,{variant:"outline",onClick:()=>se(!0),disabled:X.isRunning,children:"DRY RUN"})]})]}),(0,r.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"batch-probe-branch-projects",children:"选择项目"}),(0,r.jsx)("select",{id:"batch-probe-branch-projects",multiple:!0,value:J.selectedProjects,onChange:e=>{let s=Array.from(e.target.selectedOptions).map(e=>e.value);Y(e=>({...e,selectedProjects:s}))},className:"w-full min-h-[140px] rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",children:0===Object.keys(s.projects).length?(0,r.jsx)("option",{value:"",disabled:!0,children:"暂无可用项目"}):Object.keys(s.projects).map(e=>(0,r.jsx)("option",{value:e,children:e},e))}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"按住 Command / Ctrl 可多选"})]}),(0,r.jsx)("div",{className:"grid gap-4",children:(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"batch-probe-branch-name",children:"远端分支名称"}),(0,r.jsx)(i.Input,{id:"batch-probe-branch-name",value:J.branchName,onChange:e=>e3(e.target.value),placeholder:"例如: release/2026-03"})]})})]}),(X.isRunning||X.progress>0)&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border p-3",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-2 text-sm",children:[(0,r.jsxs)("span",{children:["进度: ",X.completedProjects,"/",X.totalProjects,X.currentProject?` \xb7 当前项目: ${X.currentProject}`:""]}),(0,r.jsxs)("span",{children:[X.progress,"%"]})]}),(0,r.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,r.jsx)("div",{className:"bg-blue-600 h-2 rounded-full transition-all duration-300",style:{width:`${X.progress}%`}})})]}),(0,r.jsxs)("div",{className:"mt-6 grid gap-4 md:grid-cols-2",children:[(0,r.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold mb-2",children:"操作记录"}),0===X.operationLogs.length?(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"暂无记录"}):(0,r.jsx)("div",{className:"bg-black text-white rounded text-xs font-mono p-2 max-h-48 overflow-y-auto",children:X.operationLogs.map((e,s)=>(0,r.jsx)("div",{className:"mb-1 whitespace-pre-wrap",children:e},s))})]}),(0,r.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold mb-2",children:"反馈信息"}),0===X.feedbacks.length?(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"暂无反馈"}):(0,r.jsx)("div",{className:"space-y-1 text-sm",children:X.feedbacks.map((e,s)=>(0,r.jsx)("div",{className:"rounded bg-gray-50 px-2 py-1 text-gray-700",children:e},s))})]})]})]}),(0,r.jsxs)("div",{className:"mt-8 rounded-lg border bg-white p-4 shadow-sm",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"常用 Git 分支操作 · 批量切换分支"}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsx)(c.Button,{onClick:()=>ss(!1),disabled:V.isRunning,children:V.isRunning?"执行中...":"执行"}),(0,r.jsx)(c.Button,{variant:"outline",onClick:()=>ss(!0),disabled:V.isRunning,children:"DRY RUN"})]})]}),(0,r.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"batch-switch-branch-projects",children:"选择项目"}),(0,r.jsx)("select",{id:"batch-switch-branch-projects",multiple:!0,value:W.selectedProjects,onChange:e=>{let s=Array.from(e.target.selectedOptions).map(e=>e.value);K(e=>({...e,selectedProjects:s}))},className:"w-full min-h-[140px] rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",children:0===Object.keys(s.projects).length?(0,r.jsx)("option",{value:"",disabled:!0,children:"暂无可用项目"}):Object.keys(s.projects).map(e=>(0,r.jsx)("option",{value:e,children:e},e))}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"按住 Command / Ctrl 可多选;未选择时下拉聚合所有项目公共分支"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"batch-switch-branch-name",children:"目标分支"}),(0,r.jsxs)(h.DropdownMenu,{open:ea,onOpenChange:e=>{en(e),e&&(eo(""),e7())},children:[(0,r.jsx)(h.DropdownMenuTrigger,{asChild:!0,children:(0,r.jsxs)(c.Button,{variant:"outline",className:"w-full justify-between font-normal",children:[(0,r.jsx)("span",{className:"truncate",children:W.branchName||(ee?"加载中...":"点击选择目标分支")}),(0,r.jsx)(m.ChevronDownIcon,{className:"size-4 opacity-50 shrink-0"})]})}),(0,r.jsxs)(h.DropdownMenuContent,{align:"start",className:"w-72",children:[(0,r.jsx)("div",{className:"p-1",children:(0,r.jsx)(i.Input,{value:ec,onChange:e=>eo(e.target.value),placeholder:"搜索分支...",className:"h-8"})}),(0,r.jsx)(h.DropdownMenuSeparator,{}),ee&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 px-3 py-4 text-sm text-gray-500",children:[(0,r.jsx)("span",{className:"animate-spin w-3 h-3 border-2 border-blue-500 border-t-transparent rounded-full"}),"聚合获取各项目公共分支中..."]}),!ee&&et&&(0,r.jsxs)("div",{className:"px-3 py-3 text-sm",children:[(0,r.jsx)("p",{className:"text-red-600",children:et}),(0,r.jsx)(c.Button,{variant:"outline",size:"sm",onClick:e7,className:"mt-2 h-7 px-2 text-xs",children:"重试"})]}),!ee&&!et&&(0,r.jsx)(r.Fragment,{children:0===Q.length?(0,r.jsx)("div",{className:"px-3 py-4 text-sm text-gray-500",children:"暂无可用的公共分支"}):0===sh.total?(0,r.jsx)("div",{className:"px-3 py-4 text-sm text-gray-500",children:"没有匹配的分支"}):(0,r.jsxs)(r.Fragment,{children:[sh.visible.map(e=>(0,r.jsxs)(h.DropdownMenuItem,{className:"flex items-center justify-between",onSelect:s=>{s.preventDefault(),e5(e)},children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e}),e===W.branchName&&(0,r.jsx)(p.CheckIcon,{className:"size-4 text-blue-600 shrink-0"})]},e)),sh.total>sh.visible.length&&(0,r.jsxs)("div",{className:"px-3 py-2 text-xs text-gray-400 border-t",children:["共 ",sh.total," 个匹配分支,仅展示前 ",sh.visible.length," 项,更多请使用上方搜索"]})]})})]})]}),W.branchName&&(0,r.jsxs)("p",{className:"text-xs text-gray-500",children:["目标分支: ",(0,r.jsx)("span",{className:"text-blue-600 font-medium",children:W.branchName})]})]})]}),(V.isRunning||V.progress>0)&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border p-3",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-2 text-sm",children:[(0,r.jsxs)("span",{children:["进度: ",V.completedProjects,"/",V.totalProjects,V.currentProject?` \xb7 当前项目: ${V.currentProject}`:""]}),(0,r.jsxs)("span",{children:[V.progress,"%"]})]}),(0,r.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,r.jsx)("div",{className:"bg-blue-600 h-2 rounded-full transition-all duration-300",style:{width:`${V.progress}%`}})})]}),(0,r.jsxs)("div",{className:"mt-6 grid gap-4 md:grid-cols-2",children:[(0,r.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold mb-2",children:"操作记录"}),0===V.operationLogs.length?(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"暂无记录"}):(0,r.jsx)("div",{className:"bg-black text-white rounded text-xs font-mono p-2 max-h-48 overflow-y-auto",children:V.operationLogs.map((e,s)=>(0,r.jsx)("div",{className:"mb-1 whitespace-pre-wrap",children:e},s))})]}),(0,r.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold mb-2",children:"反馈信息"}),0===V.feedbacks.length?(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"暂无反馈"}):(0,r.jsx)("div",{className:"space-y-1 text-sm",children:V.feedbacks.map((e,s)=>(0,r.jsx)("div",{className:"rounded bg-gray-50 px-2 py-1 text-gray-700",children:e},s))})]})]})]}),(0,r.jsxs)("div",{className:"mt-8 rounded-lg border bg-white p-4 shadow-sm",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"常用 Git 分支操作 · 批量切换子仓库(submodules/common)分支"}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsx)(c.Button,{onClick:()=>sn(!1),disabled:eu.isRunning,children:eu.isRunning?"执行中...":"执行"}),(0,r.jsx)(c.Button,{variant:"outline",onClick:()=>sn(!0),disabled:eu.isRunning,children:"DRY RUN"})]})]}),(0,r.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"batch-switch-sub-projects",children:"选择项目"}),(0,r.jsx)("select",{id:"batch-switch-sub-projects",multiple:!0,value:ep.selectedProjects,onChange:e=>{let s=Array.from(e.target.selectedOptions).map(e=>e.value);em(e=>({...e,selectedProjects:s}))},className:"w-full min-h-[140px] rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",children:0===Object.keys(s.projects).length?(0,r.jsx)("option",{value:"",disabled:!0,children:"暂无可用项目"}):Object.keys(s.projects).map(e=>(0,r.jsx)("option",{value:e,children:e},e))}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"按住 Command / Ctrl 可多选;未选择时下拉聚合所有项目子仓库公共分支"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(d.Label,{htmlFor:"batch-switch-sub-name",children:"目标分支"}),(0,r.jsxs)(h.DropdownMenu,{open:ev,onOpenChange:e=>{ew(e),e&&(ek(""),sa())},children:[(0,r.jsx)(h.DropdownMenuTrigger,{asChild:!0,children:(0,r.jsxs)(c.Button,{variant:"outline",className:"w-full justify-between font-normal",children:[(0,r.jsx)("span",{className:"truncate",children:ep.branchName||(eb?"加载中...":"点击选择目标分支")}),(0,r.jsx)(m.ChevronDownIcon,{className:"size-4 opacity-50 shrink-0"})]})}),(0,r.jsxs)(h.DropdownMenuContent,{align:"start",className:"w-72",children:[(0,r.jsx)("div",{className:"p-1",children:(0,r.jsx)(i.Input,{value:eP,onChange:e=>ek(e.target.value),placeholder:"搜索分支...",className:"h-8"})}),(0,r.jsx)(h.DropdownMenuSeparator,{}),eb&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 px-3 py-4 text-sm text-gray-500",children:[(0,r.jsx)("span",{className:"animate-spin w-3 h-3 border-2 border-blue-500 border-t-transparent rounded-full"}),"聚合获取各项目子仓库公共分支中..."]}),!eb&&ey&&(0,r.jsxs)("div",{className:"px-3 py-3 text-sm",children:[(0,r.jsx)("p",{className:"text-red-600",children:ey}),(0,r.jsx)(c.Button,{variant:"outline",size:"sm",onClick:sa,className:"mt-2 h-7 px-2 text-xs",children:"重试"})]}),!eb&&!ey&&(0,r.jsx)(r.Fragment,{children:0===ex.length?(0,r.jsx)("div",{className:"px-3 py-4 text-sm text-gray-500",children:"暂无可用的公共子仓库分支"}):0===sp.total?(0,r.jsx)("div",{className:"px-3 py-4 text-sm text-gray-500",children:"没有匹配的分支"}):(0,r.jsxs)(r.Fragment,{children:[sp.visible.map(e=>(0,r.jsxs)(h.DropdownMenuItem,{className:"flex items-center justify-between",onSelect:s=>{s.preventDefault(),sr(e)},children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e}),e===ep.branchName&&(0,r.jsx)(p.CheckIcon,{className:"size-4 text-blue-600 shrink-0"})]},e)),sp.total>sp.visible.length&&(0,r.jsxs)("div",{className:"px-3 py-2 text-xs text-gray-400 border-t",children:["共 ",sp.total," 个匹配分支,仅展示前 ",sp.visible.length," 项,更多请使用上方搜索"]})]})})]})]}),ep.branchName&&(0,r.jsxs)("p",{className:"text-xs text-gray-500",children:["目标分支: ",(0,r.jsx)("span",{className:"text-blue-600 font-medium",children:ep.branchName})]})]})]}),(eu.isRunning||eu.progress>0)&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border p-3",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-2 text-sm",children:[(0,r.jsxs)("span",{children:["进度: ",eu.completedProjects,"/",eu.totalProjects,eu.currentProject?` \xb7 当前项目: ${eu.currentProject}`:""]}),(0,r.jsxs)("span",{children:[eu.progress,"%"]})]}),(0,r.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,r.jsx)("div",{className:"bg-blue-600 h-2 rounded-full transition-all duration-300",style:{width:`${eu.progress}%`}})})]}),(0,r.jsxs)("div",{className:"mt-6 grid gap-4 md:grid-cols-2",children:[(0,r.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold mb-2",children:"操作记录"}),0===eu.operationLogs.length?(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"暂无记录"}):(0,r.jsx)("div",{className:"bg-black text-white rounded text-xs font-mono p-2 max-h-48 overflow-y-auto",children:eu.operationLogs.map((e,s)=>(0,r.jsx)("div",{className:"mb-1 whitespace-pre-wrap",children:e},s))})]}),(0,r.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold mb-2",children:"反馈信息"}),0===eu.feedbacks.length?(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"暂无反馈"}):(0,r.jsx)("div",{className:"space-y-1 text-sm",children:eu.feedbacks.map((e,s)=>(0,r.jsx)("div",{className:"rounded bg-gray-50 px-2 py-1 text-gray-700",children:e},s))})]})]})]}),(0,r.jsx)(u.Dialog,{open:!1,onOpenChange:e=>{!e&&eI&&C.isRunning||eT(e)},children:(0,r.jsxs)(u.DialogContent,{showCloseButton:!1,children:[(0,r.jsxs)(u.DialogHeader,{children:[(0,r.jsx)(u.DialogTitle,{children:"确认执行下一步"}),(0,r.jsx)(u.DialogDescription,{children:eI?`${eI.projectName} \xb7 ${eI.description}`:"准备下一步执行"})]}),(0,r.jsx)("div",{className:"rounded-md border bg-gray-50 p-3 text-sm font-mono text-gray-700",children:eI?eI.command:""}),(0,r.jsxs)(u.DialogFooter,{children:[(0,r.jsx)(c.Button,{variant:"outline",onClick:si,children:"取消执行"}),(0,r.jsx)(c.Button,{onClick:sl,disabled:!eI,children:"确认并执行"})]})]})}),(0,r.jsx)(u.Dialog,{open:eA&&eE,onOpenChange:eD,children:(0,r.jsxs)(u.DialogContent,{children:[(0,r.jsxs)(u.DialogHeader,{children:[(0,r.jsx)(u.DialogTitle,{children:"操作结果"}),(0,r.jsx)(u.DialogDescription,{children:"查看所有项目执行结果"})]}),(0,r.jsx)("div",{className:"space-y-2",children:0===eM.length?(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"暂无结果"}):eM.map(e=>(0,r.jsxs)("div",{className:`rounded-md border px-3 py-2 text-sm ${e.success?"bg-green-50 text-green-700":"bg-red-50 text-red-700"}`,children:[(0,r.jsxs)("div",{className:"flex items-start justify-between",children:[(0,r.jsx)("span",{className:"font-medium",children:e.projectName}),(0,r.jsx)("span",{className:"ml-4 text-right",children:!0===e.exists||!1===e.exists?w(e):e.success?"成功":e.reason||"失败"})]}),!e.success&&e.rollbackActions&&e.rollbackActions.length>0&&(0,r.jsxs)("div",{className:"mt-2 text-xs text-gray-600",children:[(0,r.jsx)("div",{className:"font-semibold text-gray-700",children:"已回滚操作:"}),(0,r.jsx)("ul",{className:"mt-1 list-disc pl-4",children:e.rollbackActions.map((s,t)=>(0,r.jsx)("li",{children:s},`${e.projectName}-rollback-${t}`))})]})]},e.projectName))}),(0,r.jsx)(u.DialogFooter,{children:(0,r.jsx)(c.Button,{onClick:()=>eD(!1),children:"关闭"})})]})}),(0,r.jsx)(u.Dialog,{open:ed,onOpenChange:eh,children:(0,r.jsxs)(u.DialogContent,{children:[(0,r.jsxs)(u.DialogHeader,{children:[(0,r.jsx)(u.DialogTitle,{children:"批量切换分支结果"}),(0,r.jsx)(u.DialogDescription,{children:(()=>{let e=el.filter(e=>e.success).length,s=el.length-e;return`共 ${el.length} 个项目,成功 ${e} 个,失败 ${s} 个`})()})]}),(0,r.jsx)("div",{className:"space-y-2",children:0===el.length?(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"暂无结果"}):el.map(e=>(0,r.jsx)("div",{className:`rounded-md border px-3 py-2 text-sm ${e.success?"bg-green-50 text-green-700":"bg-red-50 text-red-700"}`,children:(0,r.jsxs)("div",{className:"flex items-start justify-between",children:[(0,r.jsx)("span",{className:"font-medium",children:e.projectName}),(0,r.jsx)("span",{className:"ml-4 text-right",children:e.success?"成功":e.reason||"失败"})]})},e.projectName))}),(0,r.jsx)(u.DialogFooter,{children:(0,r.jsx)(c.Button,{onClick:()=>eh(!1),children:"关闭"})})]})}),(0,r.jsx)(u.Dialog,{open:eL,onOpenChange:eR,children:(0,r.jsxs)(u.DialogContent,{children:[(0,r.jsxs)(u.DialogHeader,{children:[(0,r.jsx)(u.DialogTitle,{children:"批量切换子仓库分支结果"}),(0,r.jsx)(u.DialogDescription,{children:(()=>{let e=eC.filter(e=>e.success).length,s=eC.length-e;return`共 ${eC.length} 个项目,成功 ${e} 个,失败 ${s} 个`})()})]}),(0,r.jsx)("div",{className:"space-y-2",children:0===eC.length?(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"暂无结果"}):eC.map(e=>(0,r.jsx)("div",{className:`rounded-md border px-3 py-2 text-sm ${e.success?"bg-green-50 text-green-700":"bg-red-50 text-red-700"}`,children:(0,r.jsxs)("div",{className:"flex items-start justify-between",children:[(0,r.jsx)("span",{className:"font-medium",children:e.projectName}),(0,r.jsx)("span",{className:"ml-4 text-right",children:e.success?"成功":e.reason||"失败"})]})},e.projectName))}),(0,r.jsx)(u.DialogFooter,{children:(0,r.jsx)(c.Button,{onClick:()=>eR(!1),children:"关闭"})})]})})]})}}}}]);
2
-
3
- //# sourceMappingURL=f9854e63365b2956.js.map