@jetcrab/pi-desk 1.1.24-dev → 1.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/app/project-preview/page.tsx +13 -0
- package/src/client/l1_entry/pages/l1-project-preview-page.tsx +1 -5
- package/src/client/l2_biz/project-preview/hooks/l2-use-project-preview.ts +25 -0
- package/src/client/l2_biz/project-preview/l2-project-preview-storage.ts +7 -7
- package/src/client/l2_biz/project-preview/l2-project-preview.tsx +8 -5
- package/src/client/l2_biz/project-preview/runtime/l2-project-history-runtime.ts +14 -11
- package/src/client/l2_biz/project-preview/views/l2-project-branch-select.tsx +347 -0
- package/src/client/l2_biz/project-preview/views/l2-project-change-tree.tsx +28 -11
- package/src/client/l2_biz/project-preview/views/l2-project-history-list.tsx +35 -8
- package/src/client/l2_biz/project-preview/views/l2-project-history-view.tsx +46 -48
- package/src/client/l2_biz/workbench/file-workspace/l2-file-workspace-runtime.ts +2 -1
- package/src/client/l2_biz/workbench/file-workspace/l2-file-workspace-view.tsx +6 -2
- package/src/client/l3_modules/conversation/l3-conversation-viewport.tsx +18 -8
- package/src/client/l3_modules/project-files/l3-project-document-view.tsx +7 -4
- package/src/client/l3_modules/project-files/l3-project-file-runtime.ts +181 -89
- package/src/client/l3_modules/project-files/l3-project-file-tabs.tsx +80 -28
- package/src/common/l2_biz/project-preview/l2-project-history-messages.ts +4 -2
- package/src/common/l2_biz/project-preview/l2-project-preview-navigation.ts +14 -0
- package/temp/build/pi-desk/release/.next/BUILD_ID +1 -1
- package/temp/build/pi-desk/release/.next/build-manifest.json +3 -3
- package/temp/build/pi-desk/release/.next/prerender-manifest.json +3 -3
- package/temp/build/pi-desk/release/.next/react-loadable-manifest.json +1 -1
- package/temp/build/pi-desk/release/.next/required-server-files.js +3 -3
- package/temp/build/pi-desk/release/.next/required-server-files.json +3 -3
- package/temp/build/pi-desk/release/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/temp/build/pi-desk/release/.next/server/app/_global-error.html +1 -1
- package/temp/build/pi-desk/release/.next/server/app/_global-error.rsc +1 -1
- package/temp/build/pi-desk/release/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/temp/build/pi-desk/release/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/temp/build/pi-desk/release/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/temp/build/pi-desk/release/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/temp/build/pi-desk/release/.next/server/app/api/health/route.js +1 -1
- package/temp/build/pi-desk/release/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/temp/build/pi-desk/release/.next/server/app/page.js +2 -2
- package/temp/build/pi-desk/release/.next/server/app/page_client-reference-manifest.js +1 -1
- package/temp/build/pi-desk/release/.next/server/app/project-preview/page.js +1 -1
- package/temp/build/pi-desk/release/.next/server/app/project-preview/page_client-reference-manifest.js +1 -1
- package/temp/build/pi-desk/release/.next/server/chunks/27344.js +15 -0
- package/temp/build/pi-desk/release/.next/server/chunks/35985.js +1 -1
- package/temp/build/pi-desk/release/.next/server/middleware-build-manifest.js +1 -1
- package/temp/build/pi-desk/release/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/temp/build/pi-desk/release/.next/server/pages/500.html +1 -1
- package/temp/build/pi-desk/release/.next/server/server-reference-manifest.json +1 -1
- package/temp/build/pi-desk/release/.next/static/chunks/15302-6e070e13fa65c863.js +1 -0
- package/temp/build/pi-desk/release/.next/static/chunks/19991.bcca96d396b83030.js +1 -0
- package/temp/build/pi-desk/release/.next/static/chunks/65232-ef4e5a4174f62faf.js +15 -0
- package/temp/build/pi-desk/release/.next/static/chunks/app/{page-ff44dcf27c2ba1c2.js → page-18d63fd3920dfae0.js} +3 -3
- package/temp/build/pi-desk/release/.next/static/chunks/app/project-preview/page-038b6c14e03ed878.js +1 -0
- package/temp/build/pi-desk/release/.next/static/chunks/{webpack-48eecbb66781c006.js → webpack-c0b805df46fcf8b3.js} +1 -1
- package/temp/build/pi-desk/release/.next/static/css/c43b04c244a64fb4.css +1 -0
- package/temp/build/pi-desk/release/.next/trace-build +1 -1
- package/temp/build/pi-desk/release/.next/server/chunks/20460.js +0 -15
- package/temp/build/pi-desk/release/.next/static/chunks/15302-9c807afc6c60de0c.js +0 -1
- package/temp/build/pi-desk/release/.next/static/chunks/19991.8aa2e4b6df15fad6.js +0 -1
- package/temp/build/pi-desk/release/.next/static/chunks/9038-05fd2688407b39c1.js +0 -15
- package/temp/build/pi-desk/release/.next/static/chunks/app/project-preview/page-bc18765121950e65.js +0 -1
- package/temp/build/pi-desk/release/.next/static/css/10e063cfb3cda7bd.css +0 -1
- /package/temp/build/pi-desk/release/.next/static/{w3CeIboVupqJdq890TlcG → 6a4eIEjmpW5l8Qlgtzzzg}/_buildManifest.js +0 -0
- /package/temp/build/pi-desk/release/.next/static/{w3CeIboVupqJdq890TlcG → 6a4eIEjmpW5l8Qlgtzzzg}/_ssgManifest.js +0 -0
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
exports.id=20460,exports.ids=[20460],exports.modules={1222:(a,b,c)=>{"use strict";c.d(b,{Ms:()=>t,N1:()=>s,Sb:()=>v,tQ:()=>u});var d=c(87883),e=c(51949),f=c(98722);let g="pi-super:project-preview:global",h="pi-super:project-preview:projects",i=d.ai().min(5).max(95),j=d.Ik({maximized:d.zM(),directoryOpen:d.zM(),gitOpen:d.zM(),gitMaximized:d.zM(),treeLayout:d.k5(["directory","repository"]),directorySize:i,gitSize:i,logSize:i,changeSize:i}),k={maximized:!1,directoryOpen:!0,gitOpen:!1,gitMaximized:!1,treeLayout:"directory",directorySize:22,gitSize:45,logSize:62,changeSize:70},l=d.Ik({repositoryRoot:d.Yj().nullable(),mode:d.k5(["history","compare"]),tip:d.Yj(),base:d.Yj(),target:d.Yj(),strategy:d.k5(["merge-base","direct"]),query:d.Yj().max(200),author:d.Yj().max(200),selectedCommit:f.aD.nullable(),selectedChangePath:e._g.nullable(),logScroll:d.ai().nonnegative(),changesScroll:d.ai().nonnegative()}),m=d.Ie(a=>"object"==typeof a&&null!==a&&Array.isArray(a.cursorState)&&"object"==typeof a.viewState),n=d.Ik({page:d.k5(["files","code","git"]),historyPane:d.k5(["log","files"]),tabs:d.YO(e._g).max(20),activePath:e._g.nullable(),editorStates:d.g1(e._g,m),fileViewModes:d.g1(e._g,d.k5(["source","preview"])),expandedPaths:d.YO(d.Yj()).max(500),treeScrollTop:d.ai().nonnegative(),searchQuery:d.Yj().max(200),changesOnly:d.zM(),expandedRepositories:d.YO(d.Yj()).max(100),history:l,activeDiff:d.Ik({repositoryRoot:d.Yj(),path:e._g,comparison:f.xv.optional()}).nullable()}),o=d.Ik({cwd:d.Yj(),lastOpenedAt:d.ai(),state:n});function p(a){let b=a.replaceAll("\\","/").replace(/\/+$/,"");return/^[a-z]:\//i.test(b)||b.startsWith("//")?b.toLowerCase():b}function q(){try{let a=JSON.parse(window.localStorage.getItem(h)??"[]");if(!Array.isArray(a))return[];let b=Date.now();return a.flatMap(a=>{let c=o.safeParse(a);return c.success&&b-c.data.lastOpenedAt<2592e6?[c.data]:[]})}catch{return[]}}function r(a){try{window.localStorage.setItem(h,JSON.stringify(a.sort((a,b)=>b.lastOpenedAt-a.lastOpenedAt).slice(0,50)))}catch(a){console.warn("[Pi Desk][ProjectPreview] 保存项目浏览状态失败",a)}}function s(){try{let a=JSON.parse(window.localStorage.getItem(g)??"null");return{...k,...j.partial().parse(a)}}catch{return{...k}}}function t(a){try{window.localStorage.setItem(g,JSON.stringify(a))}catch(a){console.warn("[Pi Desk][ProjectPreview] 保存全局布局失败",a)}}function u(a){let b=p(a),c=q(),d=c.find(a=>a.cwd===b);return d&&(d.lastOpenedAt=Date.now()),r(c),d?.state??null}function v(a,b){let c=n.safeParse(b);if(!c.success)return;let d=p(a),e=q(),f=e.find(a=>a.cwd===d);f?f.state=c.data:e.push({cwd:d,lastOpenedAt:Date.now(),state:c.data}),r(e)}},4935:a=>{a.exports={markdown:"l4-markdown_markdown__oIf6d",status:"l4-markdown_status__EVcKw",alert:"l4-markdown_alert__Aooao",alertTitle:"l4-markdown_alertTitle__GIoFs",alertBody:"l4-markdown_alertBody__BtDVT"}},5701:(a,b,c)=>{"use strict";c.d(b,{V:()=>l});var d=c(52834);c(49147);var e=c(58029),f=c(82260),g=c(13943),h=c(15620),i=c(39395),j=c(54239);function k({className:a,orientation:b="vertical",...c}){return(0,d.jsx)(i.V,{"data-slot":"scroll-area-scrollbar","data-orientation":b,orientation:b,className:(0,h.cn)("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",a),...c,children:(0,d.jsx)(j.l,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}function l({className:a,viewportClassName:b,viewportRef:c,onViewportScroll:i,children:j,...m}){return(0,d.jsxs)(e.V,{"data-slot":"l4-scroll-area",className:(0,h.cn)("relative min-h-0 overflow-hidden",a),...m,children:[(0,d.jsx)(f.B,{ref:c,"data-slot":"l4-scroll-area-viewport",className:(0,h.cn)("size-full rounded-[inherit] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",b),onScroll:i,children:j}),(0,d.jsx)(k,{className:"data-[orientation=vertical]:h-full data-[orientation=vertical]:w-2.5 data-[orientation=vertical]:border-l data-[orientation=vertical]:border-l-transparent"}),(0,d.jsx)(g.I,{})]})}},6995:a=>{a.exports={document:"l3-markdown-preview_document__tuJfC"}},9860:(a,b,c)=>{"use strict";c.d(b,{G7:()=>k,L$:()=>n,h_:()=>o,oI:()=>l,uB:()=>j,xL:()=>m});var d=c(52834);c(49147);var e=c(86536),f=c(15620);c(16664);var g=c(89101),h=c(41568),i=c(97832);function j({className:a,...b}){return(0,d.jsx)(e.uB,{"data-slot":"command",className:(0,f.cn)("flex size-full flex-col overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground",a),...b})}function k({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:(0,d.jsxs)(g.MG,{className:"has-[[data-slot=command-input]:focus-visible]:outline-2 has-[[data-slot=command-input]:focus-visible]:outline-solid has-[[data-slot=command-input]:focus-visible]:-outline-offset-2 has-[[data-slot=command-input]:focus-visible]:outline-ring",children:[(0,d.jsx)(e.uB.Input,{"data-slot":"command-input",className:(0,f.cn)("min-h-8 w-full bg-transparent px-2.5 text-sm leading-5 outline-none disabled:cursor-not-allowed disabled:opacity-50",a),...b}),(0,d.jsx)(g.Sq,{children:(0,d.jsx)(h.A,{className:"size-4 shrink-0 opacity-50"})})]})})}function l({className:a,...b}){return(0,d.jsx)(e.uB.List,{"data-slot":"command-list",className:(0,f.cn)("pi-desk-chat-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",a),...b})}function m({className:a,...b}){return(0,d.jsx)(e.uB.Empty,{"data-slot":"command-empty",className:(0,f.cn)("py-6 text-center text-sm",a),...b})}function n({className:a,...b}){return(0,d.jsx)(e.uB.Group,{"data-slot":"command-group",className:(0,f.cn)("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",a),...b})}function o({className:a,children:b,...c}){return(0,d.jsxs)(e.uB.Item,{"data-slot":"command-item",className:(0,f.cn)("group/command-item relative flex min-h-8 cursor-pointer items-center gap-2 rounded-md px-2 py-1 text-sm leading-5 outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[selected=true]:*:[svg]:text-foreground",a),...c,children:[b,(0,d.jsx)(i.A,{className:"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"})]})}},11071:(a,b,c)=>{"use strict";c.d(b,{p:()=>g});var d=c(52834);c(49147);var e=c(17372),f=c(15620);function g({className:a,type:b,...c}){return(0,d.jsx)(e.p,{type:b,"data-slot":"input",className:(0,f.cn)("min-h-8 w-full min-w-0 rounded-lg border border-input bg-card px-2.5 py-1 text-sm leading-5 transition-colors duration-150 outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-muted disabled:opacity-50 aria-invalid:border-destructive aria-invalid:outline-destructive",a),...c})}},13221:(a,b,c)=>{"use strict";c.d(b,{T:()=>f});var d=c(52834);c(49147);var e=c(15620);function f({className:a,...b}){return(0,d.jsx)("textarea",{"data-slot":"textarea",className:(0,e.cn)("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-card px-2.5 py-2 text-sm leading-5 transition-colors duration-150 outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:cursor-not-allowed disabled:bg-muted disabled:opacity-50 aria-invalid:border-destructive aria-invalid:outline-destructive",a),...b})}},13749:(a,b,c)=>{"use strict";c.d(b,{$:()=>g,P:()=>f});var d=c(17983),e=c(95186);async function f(a,b,c,f){await (0,e.QL)(a,d.Ot,{...b,path:c,targetType:f})}function g(a,b){let c=/^[a-zA-Z]:[\\/]/.test(a)||a.startsWith("\\\\"),d=c?"\\":"/",e=(c?a.replaceAll("/","\\"):a).replace(/[\\/]+$/,"");return b?`${e}${d}${b.replaceAll("/",d)}`:/^[a-z]:$/i.test(e)?`${e}${d}`:e||d}},16664:(a,b,c)=>{"use strict";c.d(b,{Hl:()=>x,YM:()=>A,YV:()=>t,_Y:()=>y,hA:()=>w,uX:()=>B,vu:()=>z});var d=c(52834);c(49147);var e=c(52878),f=c(40282),g=c(40898),h=c(24505),i=c(56500),j=c(61576),k=c(82488),l=c(58029),m=c(82260),n=c(39395),o=c(54239),p=c(13943),q=c(32772),r=c(57850),s=c(15620);function t({onOpenChange:a,...b}){return(0,d.jsx)(e.D,{"data-slot":"app-dialog",...b,onOpenChange:(c,d)=>{c||!1===b.modal||"outside-press"!==d.reason||d.event.target instanceof Element&&"app-dialog-backdrop"===d.event.target.getAttribute("data-slot")?a?.(c,d):d.cancel()}})}function u({...a}){return(0,d.jsx)(f.Z,{"data-slot":"app-dialog-portal",...a})}function v({className:a,...b}){return(0,d.jsx)(g.X,{"data-slot":"app-dialog-backdrop",className:(0,s.cn)("fixed inset-0 z-[100] bg-black/35 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",a),...b})}function w({className:a,children:b,showCloseButton:c=!0,finalFocus:e=!1,backdropClassName:f,...g}){let{t:j}=(0,r.Bd)("common");return(0,d.jsxs)(u,{children:[(0,d.jsx)(v,{className:f,forceRender:!!f}),(0,d.jsxs)(h.h,{"data-slot":"app-dialog-content",finalFocus:e,className:(0,s.cn)("fixed top-1/2 left-1/2 z-[110] flex max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-[27.5rem] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-border bg-popover text-sm text-popover-foreground shadow-lg outline-none duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",a),...g,children:[b,c?(0,d.jsxs)(i.H,{"data-slot":"app-dialog-close-button","aria-label":j("closeDialog"),title:j("closeDialog"),className:"absolute top-2 right-2 flex size-8 cursor-pointer items-center justify-center rounded-lg text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground active:bg-foreground/14 focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",children:[(0,d.jsx)(q.A,{className:"size-4"}),(0,d.jsx)("span",{className:"sr-only",children:j("closeDialog")})]}):null]})]})}function x({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"app-dialog-header",className:(0,s.cn)("flex shrink-0 flex-col gap-1.5",a),...b})}function y({className:a,children:b,...c}){return(0,d.jsxs)(l.V,{"data-slot":"app-dialog-body",className:(0,s.cn)("relative min-h-0 flex-1 overflow-hidden",a),...c,children:[(0,d.jsx)(m.B,{"data-slot":"app-dialog-body-viewport",className:"h-full max-h-[inherit] w-full overscroll-contain rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-ring",children:b}),(0,d.jsx)(n.V,{"data-slot":"app-dialog-body-scrollbar",orientation:"vertical",className:"flex h-full w-2.5 touch-none border-l border-l-transparent p-px select-none",children:(0,d.jsx)(o.l,{"data-slot":"app-dialog-body-thumb",className:"relative flex-1 rounded-full bg-muted-foreground/45 hover:bg-muted-foreground/70"})}),(0,d.jsx)(p.I,{})]})}function z({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"app-dialog-footer",className:(0,s.cn)("flex shrink-0 flex-wrap justify-end gap-2 border-t bg-popover px-4 py-3",a),...b})}function A({className:a,...b}){return(0,d.jsx)(j.L,{"data-slot":"app-dialog-title",className:(0,s.cn)("text-lg leading-[1.4] font-semibold",a),...b})}function B({className:a,...b}){return(0,d.jsx)(k.r,{"data-slot":"app-dialog-description",className:(0,s.cn)("text-sm leading-5 text-muted-foreground",a),...b})}},17983:(a,b,c)=>{"use strict";c.d(b,{OC:()=>u,Ot:()=>l,Xe:()=>m,ZI:()=>o,_X:()=>q,fg:()=>n,p0:()=>p,p3:()=>s,ry:()=>r,ys:()=>t});var d=c(87883),e=c(51949),f=c(18997),g=c(98722);let h=d.Ik({cwd:d.Yj().trim().min(1).max(4096),workId:d.Yj().trim().min(1).optional()}).strict(),i=h.extend({repositoryRoot:e.rh}),j=h.extend({path:e.eC,imagePreviewMode:e.p$}).superRefine((a,b)=>{a.workId||e._g.safeParse(a.path).success||b.addIssue({code:"custom",path:["path"],message:"独立项目预览只接受根内相对路径"})}),k=d.k5(["file","directory"]),l={path:"/api/project-files/reveal",request:h.extend({path:d.KC([e.rh,e.eC]),targetType:k.optional()}).refine(a=>""!==a.path||"directory"===a.targetType,"文件路径不能为空").refine(a=>a.workId&&"directory"!==a.targetType||e.rh.safeParse(a.path).success,"独立项目和目录定位只接受根内相对路径"),response:d.Ik({}).strict()},m={path:"/api/project-files/list",request:h.extend({path:e.rh}).strict(),response:e.JH},n={path:"/api/project-files/search",request:h.extend(e.Nu.shape).strict(),response:e.jI},o={path:"/api/project-files/get",request:j,response:e.ih},p={path:"/api/project-git/get",request:h.extend({refresh:d.zM().optional()}).strict(),response:d.Ik({repositories:d.YO(f.u2).max(100)}).strict()},q={path:"/api/project-git-heads/get",request:h,response:d.Ik({repositories:d.YO(f.yl).max(f.y2)}).strict()},r={path:"/api/project-git-branches/list",request:i.strict(),response:g.WW},s={path:"/api/project-git-log/list",request:i.extend(g.co.shape).strict(),response:g.yw},t={path:"/api/project-git-changes/list",request:i.extend(g.ph.shape).strict(),response:g.T8},u={path:"/api/project-git-diff/get",request:i.extend({path:e._g,comparison:g.xv.optional()}).strict(),response:g.lw}},18997:(a,b,c)=>{"use strict";c.d(b,{FJ:()=>t,Ww:()=>h,cP:()=>i,gf:()=>r,u2:()=>p,y2:()=>g,yl:()=>o,zp:()=>m,zt:()=>q});var d=c(87883),e=c(53403),f=c(51949);let g=100,h=f.rh,i=d.Yj().trim().min(1).max(1024),j=d.gM("type",[d.Ik({type:d.eu("branch"),name:i}).strict(),d.Ik({type:d.eu("detached"),commit:d.Yj().regex(/^[0-9a-f]{40,64}$/)}).strict()]),k=d.k5(["added","modified","deleted","renamed","unmerged","untracked"]),l=d.Ik({path:f._g,oldPath:f._g.nullable(),indexStatus:k.nullable(),worktreeStatus:k.nullable()}).strict(),m=d.Ik({root:h,state:d.eu("ready"),head:j,changes:d.YO(l).max(5e4)}).strict(),n=d.Ik({root:h,state:d.eu("unavailable"),message:e.qf.refine(a=>("string"==typeof a?[a]:[a.default,...Object.values(a.translations)]).every(a=>a.length>0&&a.length<=2e3))}).strict(),o=d.gM("state",[m.omit({changes:!0}),n]),p=d.gM("state",[m,n]),q=d.gM("type",[d.Ik({type:d.eu("local"),name:i}).strict(),d.Ik({type:d.eu("remote"),name:i}).strict()]),r=d.Ik({head:j,recent:d.YO(i).max(5),local:d.YO(i).max(1e4),remote:d.YO(i).max(1e4)}).strict(),s=d.Ik({path:f._g,content:d.Yj()}).strict(),t=d.gM("kind",[d.Ik({kind:d.eu("text"),original:s,modified:s}).strict(),d.Ik({kind:d.eu("binary")}).strict(),d.Ik({kind:d.eu("too_large")}).strict()])},23423:(a,b,c)=>{"use strict";c.d(b,{$E:()=>f,Rv:()=>g,m4:()=>e});var d=c(87883);let e=d.Yj().trim().min(1),f=d.Yj().trim().min(1),g=d.Yj().trim().min(1)},28661:(a,b,c)=>{"use strict";function d(a){let b=atob(a.data),c=new Uint8Array(b.length);for(let a=0;a<b.length;a+=1)c[a]=b.charCodeAt(a);return new Blob([c],{type:a.mimeType})}c.d(b,{E:()=>d})},37096:(a,b,c)=>{"use strict";c.d(b,{HK:()=>g,WM:()=>i,wV:()=>h});var d=c(52834),e=c(39169),f=c(15620);function g({className:a,...b}){return(0,d.jsx)(e.YJ,{"data-slot":"resizable-panel-group",className:(0,f.cn)("flex h-full w-full aria-[orientation=vertical]:flex-col",a),...b})}function h({...a}){return(0,d.jsx)(e.Zk,{"data-slot":"resizable-panel",...a})}function i({withHandle:a,className:b,...c}){return(0,d.jsx)(e.wv,{"data-slot":"resizable-handle",className:(0,f.cn)("relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",b),...c})}},41994:(a,b,c)=>{"use strict";c.d(b,{k:()=>d});let d=c(87883).ai().int().nonnegative().max(Number.MAX_SAFE_INTEGER)},42704:(a,b,c)=>{"use strict";c.d(b,{AM:()=>l,Wv:()=>m,eO:()=>o,hl:()=>n});var d=c(52834);c(49147);var e=c(20104),f=c(10834),g=c(43088),h=c(47900),i=c(93915),j=c(62688),k=c(15620);function l({...a}){return(0,d.jsx)(e.y,{"data-slot":"popover",...a})}function m({...a}){return(0,d.jsx)(f.W,{"data-slot":"popover-trigger",...a})}function n({className:a,positionerClassName:b,align:c="center",alignOffset:e=0,side:f="bottom",sideOffset:j=4,finalFocus:l=!1,...m}){return(0,d.jsx)(g.i,{children:(0,d.jsx)(h.U,{align:c,alignOffset:e,side:f,sideOffset:j,className:(0,k.cn)("isolate z-50",b),children:(0,d.jsx)(i.i,{"data-slot":"popover-content",finalFocus:l,className:(0,k.cn)("z-50 flex w-80 max-w-[calc(100vw-2rem)] origin-(--transform-origin) flex-col gap-3 rounded-lg border border-border bg-popover p-3 text-sm text-popover-foreground shadow-md outline-hidden duration-100 motion-reduce:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",a),...m})})})}function o({className:a,...b}){return(0,d.jsx)(j.e,{"data-slot":"popover-title",className:(0,k.cn)("font-medium",a),...b})}},45427:(a,b,c)=>{"use strict";c.d(b,{n:()=>m});var d=c(52834),e=c(19480),f=c(36331),g=c(49147),h=c(38684),i=c(53437),j=c(6995),k=c.n(j);let l={cjk:e.h,code:f.a},m=(0,g.memo)(function({content:a,label:b,savedScrollTop:c,onScroll:e}){let f=(0,g.useRef)(null),j=(0,g.useRef)(c);return(0,g.useLayoutEffect)(()=>{f.current&&(f.current.scrollTop=j.current)},[]),(0,d.jsx)("div",{ref:f,"data-testid":"markdown-preview",role:"region","aria-label":b,tabIndex:0,className:"h-full min-h-0 overflow-auto overscroll-contain bg-background outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",onScroll:a=>e(a.currentTarget.scrollTop),children:(0,d.jsx)(h.jH,{className:`${k().document} ${i.om}`,allowedTags:i.IV,components:i.e6,remarkPlugins:i.XC,mode:"static",parseIncompleteMarkdown:!1,isAnimating:!1,controls:!1,lineNumbers:!1,plugins:l,children:a})})})},45694:(a,b,c)=>{"use strict";c.d(b,{z:()=>e});let d=`<script>
|
|
2
|
-
window.addEventListener('keydown', function (event) {
|
|
3
|
-
if (event.defaultPrevented || event.isComposing || event.repeat) return;
|
|
4
|
-
if (event.key === 'Escape' && !event.ctrlKey && !event.altKey && !event.metaKey && !event.shiftKey) {
|
|
5
|
-
event.preventDefault();
|
|
6
|
-
window.parent.postMessage('pi-desk:file-escape', '*');
|
|
7
|
-
} else if (event.key === 'Tab' && event.ctrlKey && !event.altKey && !event.metaKey) {
|
|
8
|
-
event.preventDefault();
|
|
9
|
-
window.parent.postMessage('pi-desk:file-switch-pane', '*');
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
</script>`;function e(a){return`${a}
|
|
13
|
-
${d}`}},45741:(a,b,c)=>{"use strict";c.d(b,{F:()=>Z});var d=c(52834),e=c(3935),f=c(22232),g=c(83401),h=c(97586),i=c(85278),j=c(90814),k=c(37496),l=c(26890),m=c(75152),n=c(35385),o=c(63155),p=c(41568),q=c(49147),r=c(57850),s=c(53403),t=c(4998),u=c(15620),v=c(82563),w=c(9365);let x=(0,q.createContext)({expandedPaths:new Set,togglePath:()=>{}}),y=({expanded:a,defaultExpanded:b=new Set,selectedPath:c,onSelect:e,onExpandedChange:f,className:g,children:h,...i})=>{let[j,k]=(0,q.useState)(b),l=a??j,m=(0,q.useCallback)(a=>{let b=new Set(l);b.has(a)?b.delete(a):b.add(a),k(b),f?.(b)},[l,f]),n=(0,q.useMemo)(()=>({expandedPaths:l,onSelect:e,selectedPath:c,togglePath:m}),[l,e,c,m]);return(0,d.jsx)(x.Provider,{value:n,children:(0,d.jsx)("div",{className:(0,u.cn)("rounded-lg border bg-background font-sans text-sm",g),role:"tree",...i,children:(0,d.jsx)("div",{className:"p-2",children:h})})})},z=({className:a,children:b,...c})=>(0,d.jsx)("span",{className:(0,u.cn)("shrink-0",a),...c,children:b}),A=({className:a,children:b,...c})=>(0,d.jsx)("span",{className:(0,u.cn)("truncate",a),...c,children:b}),B=(0,q.createContext)({isExpanded:!1,name:"",path:""}),C=({path:a,name:b,className:c,children:e,...f})=>{let{expandedPaths:g,togglePath:h,selectedPath:i,onSelect:j}=(0,q.useContext)(x),l=g.has(a),n=i===a,o=(0,q.useCallback)(()=>{h(a)},[h,a]),p=(0,q.useCallback)(()=>{j?.(a)},[j,a]),r=(0,q.useMemo)(()=>({isExpanded:l,name:b,path:a}),[l,b,a]);return(0,d.jsx)(B.Provider,{value:r,children:(0,d.jsx)(v.Nt,{onOpenChange:o,open:l,children:(0,d.jsxs)("div",{className:(0,u.cn)("",c),role:"treeitem","aria-expanded":l,"aria-selected":n,tabIndex:0,...f,children:[(0,d.jsxs)("div",{className:(0,u.cn)("flex min-h-9 w-full items-center gap-2 rounded-md px-2 py-1 text-left transition-colors hover:bg-foreground/8",n&&"bg-accent"),children:[(0,d.jsx)(v.R6,{render:(0,d.jsx)("button",{className:"flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md border-none bg-transparent p-0 outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":`${l?"收起":"展开"} ${b}`,type:"button"}),children:(0,d.jsx)(k.A,{className:(0,u.cn)("size-4 shrink-0 text-muted-foreground transition-transform",l&&"rotate-90")})}),(0,d.jsxs)("button",{className:"flex min-h-7 min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-md border-none bg-transparent p-0 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:p,type:"button",children:[(0,d.jsx)(z,{children:l?(0,d.jsx)(w.A,{className:"size-4 text-muted-foreground"}):(0,d.jsx)(m.A,{className:"size-4 text-muted-foreground"})}),(0,d.jsx)(A,{children:b})]})]}),(0,d.jsx)(v.Ke,{children:(0,d.jsx)("div",{className:"ml-4 border-l pl-2",children:e})})]})})})},D=(0,q.createContext)({name:"",path:""}),E=({path:a,name:b,icon:c,className:e,children:f,...g})=>{let{selectedPath:h,onSelect:j}=(0,q.useContext)(x),k=h===a,l=(0,q.useCallback)(()=>{j?.(a)},[j,a]),m=(0,q.useCallback)(b=>{("Enter"===b.key||" "===b.key)&&j?.(a)},[j,a]),n=(0,q.useMemo)(()=>({name:b,path:a}),[b,a]);return(0,d.jsx)(D.Provider,{value:n,children:(0,d.jsx)("div",{className:(0,u.cn)("flex min-h-9 cursor-pointer items-center gap-2 rounded-md px-2 py-1 outline-none transition-colors hover:bg-foreground/8 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",k&&"bg-accent",e),onClick:l,onKeyDown:m,role:"treeitem","aria-selected":k,tabIndex:0,...g,children:f??(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"size-6 shrink-0"}),(0,d.jsx)(z,{children:c??(0,d.jsx)(i.A,{className:"size-4 text-muted-foreground"})}),(0,d.jsx)(A,{children:b})]})})})};var F=c(5701),G=c(5319),H=c(32772),I=c(89101),J=c(59582);let K=["all","files","content"],L=[{key:"caseSensitive",label:"searchCaseSensitive",text:"Aa"},{key:"wholeWord",label:"searchWholeWord",text:"Ab"},{key:"regex",label:"searchRegex",text:".*"}];function M({input:a,inputRef:b,invalid:c,onQueryChange:e,onOptionsChange:f,onComposingChange:g,onClose:h,onOpenFirst:i,onFocusResults:j}){let{t:k}=(0,r.Bd)("projectFiles"),[l,m]=(0,q.useState)(null),n=(0,q.useRef)(!1),o=k("files"===a.scope?"searchFiles":"content"===a.scope?"searchContent":"searchAll");return(0,d.jsxs)("div",{className:"shrink-0 px-1 pt-1",children:[(0,d.jsxs)(I.MG,{className:"rounded-md",children:[(0,d.jsx)(I.Sq,{className:"pl-1.5 py-0",children:(0,d.jsx)(p.A,{className:"size-3.5"})}),(0,d.jsx)(I.iV,{ref:b,"data-testid":"project-file-search",className:"min-h-7 min-w-0 px-1.5 py-0.5 text-sm placeholder:text-xs",value:l??a.query,placeholder:o,"aria-label":o,"aria-invalid":c||void 0,autoComplete:"off",spellCheck:!1,onChange:a=>{n.current?m(a.target.value):e(a.target.value)},onCompositionStart:a=>{n.current=!0,m(a.currentTarget.value),g(!0)},onCompositionEnd:a=>{n.current=!1,m(null),e(a.currentTarget.value),g(!1)},onKeyDown:a=>{a.nativeEvent.isComposing||n.current||("Enter"===a.key?(a.preventDefault(),i()):"ArrowDown"===a.key&&(a.preventDefault(),j()))}}),(0,d.jsx)(I.Sq,{align:"inline-end",className:"pr-0.5 py-0 has-[>button]:mr-0",children:(0,d.jsxs)(J.m_,{children:[(0,d.jsx)(J.k$,{render:(0,d.jsx)(I.Ik,{size:"icon-xs",className:"min-h-7","aria-label":k("closeSearch"),onClick:h}),children:(0,d.jsx)(H.A,{className:"size-4"})}),(0,d.jsx)(J.ZI,{children:k("closeSearch")})]})})]}),(0,d.jsxs)("div",{className:"flex min-h-7 flex-wrap items-center justify-between gap-x-1",children:[(0,d.jsx)("div",{className:"flex min-w-0 items-center",role:"radiogroup","aria-label":k("searchScope"),children:K.map((b,c)=>(0,d.jsx)(G.$,{type:"button",role:"radio","aria-checked":a.scope===b,tabIndex:a.scope===b?0:-1,disabled:null!==l,variant:"ghost",size:"sm","data-testid":`project-search-scope-${b}`,className:(0,u.cn)("px-1 text-xs",a.scope===b&&"bg-accent text-accent-foreground"),onClick:()=>f({scope:b}),onKeyDown:a=>{let b="ArrowRight"===a.key||"ArrowDown"===a.key,d="ArrowLeft"===a.key||"ArrowUp"===a.key;if(!b&&!d&&"Home"!==a.key&&"End"!==a.key)return;a.preventDefault();let e="Home"===a.key?0:"End"===a.key?2:(c+(b?1:2))%3;f({scope:K[e]}),a.currentTarget.parentElement?.querySelectorAll('[role="radio"]')[e]?.focus()},children:k("all"===b?"searchScopeAll":"files"===b?"searchScopeFiles":"searchScopeContent")},b))}),(0,d.jsx)("div",{className:"ml-auto flex items-center",children:L.map(({key:b,label:c,text:e})=>(0,d.jsxs)(J.m_,{children:[(0,d.jsx)(J.k$,{render:(0,d.jsx)(G.$,{type:"button",variant:"ghost",size:"icon-sm",disabled:null!==l,"aria-label":k(c),"aria-pressed":a[b],"data-testid":`project-search-option-${b}`,className:(0,u.cn)("font-mono text-xs text-muted-foreground","wholeWord"===b&&"underline underline-offset-4"),onClick:()=>f({[b]:!a[b]})}),children:e}),(0,d.jsx)(J.ZI,{children:k(c)})]},b))})]})]})}function N(a,b,c=0){let e=[],f=0;for(let g of b){let b=Math.max(f,g.start-c,0),h=Math.min(g.end-c,a.length);h<=b||(e.push(a.slice(f,b)),e.push((0,d.jsx)("mark",{className:"rounded-sm bg-foreground/15 text-inherit",children:a.slice(b,h)},`${b}:${h}`)),f=h)}return e.push(a.slice(f)),e}function O({search:a,resultsRef:b,activePath:c,onOpen:e,wrapFile:f,renderFileIcon:g,fileDecoration:h}){let{t:l}=(0,r.Bd)("projectFiles"),m=(0,q.useId)(),[n,o]=(0,q.useState)(!1),[s,t]=(0,q.useState)(new Set),[v,w]=(0,q.useState)(null),x=new Map;for(let b of a.contentMatches){let a=x.get(b.path);a?a.push(b):x.set(b.path,[b])}let y=!!a.query.trim(),z=y&&"ready"===a.status,A=a.fileMatches.length,B=a.contentMatches.length,C="all"===a.scope&&A>3&&B>0&&!n,D=C?a.fileMatches.slice(0,3):a.fileMatches,E=l("searchCounts",{files:new Set([...a.fileMatches.map(a=>a.path),...x.keys()]).size,lines:B}),H=a=>{t(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})};return(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"flex min-h-6 flex-wrap items-center justify-between gap-x-2 px-2 text-xs text-muted-foreground",role:"status","aria-live":"polite",children:[(0,d.jsx)("span",{children:l("searchResults")}),z?(0,d.jsx)("span",{className:"tabular-nums",children:a.truncated?l("searchShownCounts",{counts:E}):E}):null]}),(0,d.jsx)(F.V,{className:"min-h-0 flex-1",viewportClassName:"pb-2",children:(0,d.jsx)("div",{ref:b,role:"region","aria-label":l("searchResults"),"aria-busy":y&&"loading"===a.status,onKeyDown:a=>{if("ArrowDown"!==a.key&&"ArrowUp"!==a.key&&"Home"!==a.key&&"End"!==a.key)return;let b=[...a.currentTarget.querySelectorAll("button")].filter(a=>!a.disabled&&!a.closest("[hidden]")),c=b.indexOf(document.activeElement);if(c<0)return;a.preventDefault();let d="Home"===a.key?0:"End"===a.key?b.length-1:Math.max(0,Math.min(b.length-1,c+("ArrowDown"===a.key?1:-1)));b[d]?.focus()},children:y?"loading"===a.status?(0,d.jsxs)("div",{className:"flex min-h-10 items-center gap-2 px-3 text-xs text-muted-foreground",children:[(0,d.jsx)(j.A,{className:"size-3.5 animate-spin"}),l("searching")]}):"error"===a.status?(0,d.jsx)("p",{role:"alert",className:"mx-3 my-2 break-words rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:a.error||l("searchFailed")}):z&&0===A&&0===B?(0,d.jsxs)("div",{className:"px-5 py-9 text-center text-sm text-muted-foreground",children:[(0,d.jsx)(p.A,{className:"mx-auto mb-3 size-6"}),(0,d.jsx)("p",{children:l(a.truncated?"resultLimit":"noMatches")}),(0,d.jsx)("p",{className:"mt-2 text-xs",children:l("searchTryOptions")})]}):z?(0,d.jsxs)(d.Fragment,{children:[A>0?(0,d.jsxs)("section",{children:["all"===a.scope?(0,d.jsxs)("h3",{className:"flex min-h-6 items-center gap-2 px-2 text-xs text-muted-foreground",children:[l("searchFileHeading"),(0,d.jsx)("span",{className:"tabular-nums",children:A})]}):null,D.map(({path:a,ranges:b})=>{let i=a.lastIndexOf("/"),j=h(a);return f(a,void 0,(0,d.jsxs)(G.$,{type:"button",variant:"ghost","data-testid":`project-search-result-${a}`,"data-search-result":"true",className:(0,u.cn)("mx-1 flex min-h-6 w-[calc(100%-0.5rem)] justify-start gap-1 px-1 py-0 text-left font-normal [@media(pointer:coarse)]:min-h-9",c===a&&"bg-accent"),title:a,onClick:()=>e(a),children:[(0,d.jsx)("span",{className:"shrink-0",children:g(a)}),(0,d.jsxs)("span",{className:"flex min-w-0 flex-1 items-baseline gap-1.5",children:[(0,d.jsx)("span",{className:(0,u.cn)("truncate text-sm",j.className),children:N(a.slice(i+1),b,i+1)}),i>=0?(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:N(a.slice(0,i),b)}):null]}),j.badge?(0,d.jsx)("span",{className:(0,u.cn)("text-xs",j.className),"aria-label":l("gitStatus",{status:j.badge}),children:j.badge}):null]},a))}),C?(0,d.jsx)(G.$,{type:"button",variant:"ghost",size:"sm",className:"ml-5 min-h-6 py-0 text-xs text-muted-foreground [@media(pointer:coarse)]:min-h-9",onClick:()=>o(!0),children:l("searchExpandFiles",{count:A-3})}):null]}):null,B>0?(0,d.jsxs)("section",{className:(0,u.cn)(A>0&&"mt-1"),children:["all"===a.scope?(0,d.jsxs)("h3",{className:"flex min-h-6 flex-wrap items-center gap-x-2 px-2 text-xs text-muted-foreground",children:[l("searchContentHeading"),(0,d.jsx)("span",{children:l("searchContentCounts",{lines:B,files:x.size})})]}):null,[...x].map(([a,b],c)=>{let g=a.lastIndexOf("/"),h=!s.has(a),j=`${m}-${c}`;return(0,d.jsxs)("section",{className:"mb-1",children:[(0,d.jsxs)(G.$,{type:"button",variant:"ghost",className:"min-h-6 w-full justify-start gap-1 rounded-none px-2 py-0 text-left font-normal [@media(pointer:coarse)]:min-h-9",title:a,"aria-expanded":h,"aria-controls":j,onClick:()=>H(a),onKeyDown:b=>{("ArrowLeft"===b.key&&h||"ArrowRight"===b.key&&!h)&&(b.preventDefault(),H(a))},children:[(0,d.jsx)(k.A,{className:(0,u.cn)("size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none",h&&"rotate-90")}),(0,d.jsx)(i.A,{className:"size-3.5 shrink-0 text-muted-foreground"}),(0,d.jsxs)("span",{className:"min-w-0 truncate text-sm",children:[a.slice(g+1),(0,d.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground",children:a.slice(0,Math.max(0,g))})]}),(0,d.jsx)("span",{className:"ml-auto shrink-0 rounded bg-muted px-1 text-xs text-muted-foreground tabular-nums",children:b.length})]}),(0,d.jsx)("div",{id:j,hidden:!h,children:b.map(({line:b,text:c,ranges:g})=>f(a,b,(0,d.jsxs)(G.$,{type:"button",variant:"ghost","data-testid":`project-search-line-${a}-${b}`,"data-search-result":"true",className:(0,u.cn)("min-h-6 w-full justify-start gap-1 rounded-none border-l-2 border-transparent py-0 pr-2 pl-5 text-left font-mono font-normal [@media(pointer:coarse)]:min-h-9",v?.path===a&&v.line===b&&"border-l-foreground/50 bg-accent"),title:c,"aria-label":l("searchOpenLine",{path:a,line:b}),onClick:()=>{w({path:a,line:b}),e(a,b)},children:[(0,d.jsx)("span",{className:"min-w-5 shrink-0 text-right text-xs text-muted-foreground tabular-nums",children:b}),(0,d.jsx)("span",{className:"min-w-0 truncate whitespace-pre text-sm",children:N(c,g)})]},`${a}:${b}`)))})]},a)})]}):null,a.truncated?(0,d.jsx)("p",{className:"px-3 py-2 text-xs leading-5 text-muted-foreground",children:l("resultLimit")}):null]}):null:(0,d.jsxs)("div",{className:"px-5 py-9 text-center text-sm text-muted-foreground",children:[(0,d.jsx)(p.A,{className:"mx-auto mb-3 size-6"}),(0,d.jsx)("p",{children:l("searchStart")}),(0,d.jsx)("p",{className:"mt-2 text-xs",children:l("files"===a.scope?"searchFiles":"content"===a.scope?"searchContent":"searchAll")})]})})}),"files"!==a.scope?(0,d.jsx)("p",{className:"shrink-0 px-2 py-1 text-xs leading-5 text-muted-foreground",children:l("searchTextLimit")}):null]})}var P=c(49057),Q=c(51108),R=c(57396),S=c.n(R),T=c(83731);let U=[],V=new WeakMap;function W(a){let b=a.split("/").at(-1)?.toLocaleLowerCase()??"",c=b.includes(".")?b.split(".").at(-1)??"":"";return["png","jpg","jpeg","webp","gif"].includes(c)?(0,d.jsx)(e.A,{className:"size-4 text-muted-foreground"}):"json"===c||"jsonl"===c?(0,d.jsx)(f.A,{className:"size-4 text-muted-foreground"}):["md","mdx","txt"].includes(c)?(0,d.jsx)(g.A,{className:"size-4 text-muted-foreground"}):["ts","tsx","js","jsx","mjs","cjs","py","go","rs","java","c","cpp","h","hpp","css","scss","html","xml","yaml","yml","toml","sql","sh"].includes(c)?(0,d.jsx)(h.A,{className:"size-4 text-muted-foreground"}):(0,d.jsx)(i.A,{className:"size-4 text-muted-foreground"})}function X(a){if(a)return(0,P.iH)(a.change)}function Y({state:a,onRetry:b}){let{t:c}=(0,r.Bd)("projectFiles");return a&&"idle"!==a.status&&"loading"!==a.status?"error"!==a.status?null:(0,d.jsx)("button",{type:"button",onClick:b,className:"min-h-8 w-full rounded px-2 text-left text-xs text-destructive hover:bg-destructive/10",children:c("retryReading",{error:a.error})}):(0,d.jsxs)("div",{className:"flex min-h-8 items-center gap-2 px-2 text-xs text-muted-foreground",children:[(0,d.jsx)(j.A,{className:"size-3.5 animate-spin"})," ",c("reading")]})}function Z({cwd:a,projectName:b,runtime:c,gitRuntime:e,onOpenGitBranches:f,onFileOpened:g,rootTitle:h,showRootTitle:i=!0,gitReadOnly:j=!1}){let v,w,x,{t:B}=(0,r.Bd)("projectFiles"),{locale:D}=(0,t.i)();(0,q.useSyncExternalStore)(c.subscribe,c.getRevision,c.getRevision),(0,q.useSyncExternalStore)(e.subscribe,e.getRevision,e.getRevision);let H=c.state,I=e.getWorkspace(a),J=(0,q.useRef)(null),K=(0,q.useRef)(null),L=(0,q.useRef)(null),N=(0,q.useRef)(null),[R,$]=(0,q.useState)(!1),_=(0,q.useRef)({}),aa=(0,q.useCallback)(a=>{a?V.set(c,_.current):V.get(c)===_.current&&V.delete(c),$(a)},[c]),ab=H.searchOpen,ac=()=>{$(!1),c.setSearchOpen(!1),requestAnimationFrame(()=>N.current?.focus())},[ad,ae]=(0,q.useState)({}),af=(a,b)=>{let c=ad[a]??300;return c<b?(0,d.jsx)("button",{type:"button",className:"min-h-8 px-3 text-sm text-muted-foreground hover:bg-accent",onClick:b=>{b.stopPropagation(),ae(b=>({...b,[a]:c+300}))},children:B("showMore",{visible:c,total:b})}):null};H?.search.query;let ag=I?.snapshot.repositories??U,ah=(0,P.eP)(ag),ai=new Map(ah.map(a=>[a.projectPath,a])),aj=ag.map(a=>a.root).filter(Boolean);[...I?.expandedRepositories??[]].join("\0");let ak=new Set(aj),al=new Map,am=new Set([...H.expandedPaths].map(a=>(0,T.Im)("directory",a))),an=(a,b)=>{let d=new Set(H.expandedPaths);for(let c of a.paths)b?d.add(c):d.delete(c);c.setExpandedPaths(d,!1),b&&!I?.changesOnly&&c.expandDirectoryChain(a.path,ak)},ao=a=>{for(let[b,c]of[...al].filter(([b])=>a.has((0,T.Im)("directory",b))!==H.expandedPaths.has(b)))an(c,a.has((0,T.Im)("directory",b)))},ap=(a,b)=>{c.openFile(a,b),g?.()},aq=a=>{c.openDiff(a.repositoryRoot,a.path),g?.()},ar=(b,e)=>(0,d.jsx)(Q.J,{cwd:a,path:b.targetPath,type:"directory",trigger:e,expanded:H.expandedPaths.has(b.path),onToggle:()=>an(b,!H.expandedPaths.has(b.path)),onReveal:c.canReveal?(a,b)=>c.revealFile(a,b):void 0},(0,T.Im)("directory",b.path)),as=(b,e,f=null,g=!1,h)=>(0,d.jsx)(Q.J,{cwd:a,path:b,type:"file",trigger:e,openLabel:B(g?"viewDiff":"openPreview"),onOpen:()=>g&&f?aq(f):ap(b,h),oldPath:f?.change.oldPath?(0,T._J)(f.repositoryRoot,f.change.oldPath):void 0,onReveal:c.canReveal?(a,b)=>c.revealFile(a,b):void 0},void 0===h?(0,T.Im)("file",b):`${b}:${h}`),at=(a,b,c,e)=>as(a,(0,d.jsxs)(E,{path:(0,T.Im)("file",a),name:b,title:a,"data-testid":`project-file-${a}`,onClick:()=>{e&&c?aq(c):ap(a)},children:[(0,d.jsx)("span",{className:"size-6 shrink-0"}),(0,d.jsx)(z,{children:W(a)}),(0,d.jsx)(A,{"data-testid":`project-file-name-${a}`,className:(0,u.cn)("min-w-0 flex-1",X(c)),children:b}),c?(0,d.jsx)("span",{className:(0,u.cn)("text-xs tabular-nums",X(c)),"aria-label":B("gitStatus",{status:(0,P.XB)(c.change)}),children:(0,P.XB)(c.change)}):null]}),c,e),au=(a,b,e)=>{let f=H?.directories.get(a);if(f?.status!=="ready")return(0,d.jsx)(Y,{state:f,onRetry:()=>void c.ensureDirectory(a)});let g=e?f.entries.filter(c=>{let d;return d=(0,T._J)(a,c.name),!aj.some(a=>a!==b&&d===a)}):f.entries;return(0,d.jsxs)(d.Fragment,{children:[g.slice(0,ad[`directory:${a}`]??300).map(f=>{let g=(0,T._J)(a,f.name);if("file"===f.type)return at(g,f.name,ai.get(g)??null,!1);let h=c.compactDirectory(g,ak);return al.set(g,h),ar(h,(0,d.jsx)(C,{path:(0,T.Im)("directory",g),name:h.label,title:h.targetPath,"data-testid":`project-folder-${g}`,children:au(h.targetPath,b,e)}))}),af(`directory:${a}`,g.length),f.truncated?(0,d.jsx)("p",{className:"px-2 py-2 text-xs leading-5 text-amber-600 dark:text-amber-400",children:B("directoryLimit")}):null,0===g.length?(0,d.jsx)("p",{className:"px-2 py-2 text-xs text-muted-foreground",children:B("emptyDirectory")}):null]})},av=(a,b)=>{let c=a.get(b);if(!c)return null;let e=[...c.directories.keys()].sort(T.Kn),f=[...c.files].sort(T.Kn),g=ad[`changes:${b}`]??300;return(0,d.jsxs)(d.Fragment,{children:[e.slice(0,g).map(b=>{let c=(0,T.xV)(b,a,ak);return al.set(b,c),ar(c,(0,d.jsx)(C,{path:(0,T.Im)("directory",b),name:c.label,title:c.targetPath,"data-testid":`project-folder-${b}`,children:av(a,c.targetPath)}))}),f.slice(0,Math.max(0,g-e.length)).map(a=>at(a,a.slice(a.lastIndexOf("/")+1),ai.get(a)??null,!0)),af(`changes:${b}`,e.length+f.length)]})},aw=a=>{if(a.startsWith("directory:")){let b=al.get(a.slice(10));b&&an(b,!H.expandedPaths.has(b.path));return}let b=a.slice(5),c=ai.get(b);I?.changesOnly&&c?aq(c):ap(b)},ax=(g,h,i)=>{if(I?.changesOnly&&!g)return null;let o=I?.expandedRepositories.has(h)??!1,p=g?.state==="ready"?ah.filter(a=>a.repositoryRoot===h):[],q=p.length;if(I?.changesOnly&&g?.state==="ready"&&0===q)return null;let r=(0,T.OA)(p.map(a=>a.projectPath),h);return(0,d.jsxs)("section",{"data-testid":`project-git-repository-${h||"root"}`,className:"border-b last:border-b-0",children:[(0,d.jsxs)("div",{className:"flex min-h-8 items-center gap-1 px-1 py-0.5",children:[(0,d.jsxs)("button",{"data-testid":`project-git-repository-toggle-${h||"root"}`,type:"button",className:"flex min-w-0 flex-1 items-center gap-1 rounded-md px-1 py-0.5 text-left hover:bg-muted/60","aria-expanded":o,onClick:()=>{o&&c.cancelDirectoryExpansion(h),e.toggleRepository(a,h),o||c.ensureDirectory(h)},children:[(0,d.jsx)(k.A,{className:(0,u.cn)("size-3 shrink-0 text-muted-foreground transition-transform",o&&"rotate-90")}),g?(0,d.jsx)(l.A,{className:"size-4 shrink-0 text-muted-foreground"}):(0,d.jsx)(m.A,{className:"size-4 shrink-0 text-muted-foreground"}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",title:g&&h||b,children:i})]}),g?(0,d.jsxs)("button",{"data-testid":`project-git-branch-${h||"root"}`,type:"button",disabled:j||"ready"!==g.state,className:(0,u.cn)((0,G.r)({variant:"ghost",size:"sm"}),"max-w-28 shrink gap-1 font-mono text-xs text-muted-foreground"),title:"ready"===g.state?B(j?"gitBranchReadOnly":"gitBranches"):(0,s.fD)(g.message,D),"aria-label":B(j?"gitBranchReadOnly":"gitBranches"),onClick:()=>f(h),children:[(0,d.jsx)(n.A,{className:"size-3 shrink-0"}),(0,d.jsx)("span",{className:"min-w-0 truncate",children:"ready"===g.state?(0,P.ws)(g.head):B("unavailable")}),q>0?(0,d.jsx)("span",{className:"rounded-md bg-muted px-1 text-xs text-status-warning",children:q}):null]}):null]}),o?I?.changesOnly?(0,d.jsx)(y,{className:"rounded-none border-0 bg-transparent px-1 pb-1",expanded:am,selectedPath:H?.activeDiff?(0,T.Im)("file",(0,P.oW)(H.activeDiff.repositoryRoot,H.activeDiff.path)):void 0,onExpandedChange:ao,onSelect:aw,children:q>0?av(r,h):(0,d.jsx)("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:B("noChanges")})}):(0,d.jsx)(y,{className:"rounded-none border-0 bg-transparent px-1 pb-1",expanded:am,selectedPath:H.activePath?(0,T.Im)("file",H.activePath):void 0,onExpandedChange:ao,onSelect:aw,children:au(h,g?.root??null,!0)}):null]},g?`git:${h}`:"workspace")},ay=1===ag.length&&ag[0]?.root===""?ag[0]:null,az=ag.length>0&&!ay,aA=az?I?.layout??"directory":"directory",aB=ay?(0,d.jsxs)("button",{type:"button",disabled:j||"ready"!==ay.state,className:(0,u.cn)((0,G.r)({variant:"ghost",size:"sm"}),"max-w-32 shrink gap-1 font-mono text-xs text-muted-foreground",!i&&"min-w-0 flex-1 justify-start"),"aria-label":B(j?"gitBranchReadOnly":"gitBranches"),title:"ready"===ay.state?`${B(j?"gitBranchReadOnly":"gitBranches")} \xb7 ${(0,P.ws)(ay.head)}`:(0,s.fD)(ay.message,D),onClick:()=>f(""),children:[(0,d.jsx)(n.A,{className:"size-3 shrink-0"}),(0,d.jsx)("span",{className:"truncate",children:"ready"===ay.state?(0,P.ws)(ay.head):B("unavailable")})]}):null,aC=(0,d.jsxs)("div",{className:"flex min-h-8 min-w-0 flex-wrap items-center gap-x-1 gap-y-0.5 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",tabIndex:i?void 0:0,"aria-label":B("projectFiles",{name:b}),children:[az?(0,d.jsx)("div",{className:"flex shrink-0 gap-0.5",role:"group","aria-label":B("layout"),children:["directory","repository"].map(b=>(0,d.jsx)("button",{"data-testid":`project-file-layout-${b}`,type:"button","aria-pressed":aA===b,className:(0,u.cn)((0,G.r)({variant:"ghost",size:"sm"}),aA===b&&"bg-accent text-accent-foreground"),onClick:()=>{c.cancelDirectoryExpansion(),e.setLayout(a,b)},children:B("directory"===b?"directory":"repository")},b))}):null,ag.length>0?(0,d.jsxs)("button",{"data-testid":"project-git-changes-toggle",type:"button","aria-pressed":I?.changesOnly??!1,className:(0,u.cn)((0,G.r)({variant:"ghost",size:"sm"}),"min-w-0 gap-1",I?.changesOnly&&"bg-accent text-accent-foreground"),onClick:()=>{c.cancelDirectoryExpansion(),e.setChangesOnly(a,!I?.changesOnly)},children:[(0,d.jsx)(o.A,{className:"size-3 shrink-0"}),(0,d.jsx)("span",{className:"truncate",children:B("changesOnly")}),(0,d.jsx)("span",{className:"rounded-md bg-muted px-1 font-mono text-xs",children:ah.length})]}):null,i?null:aB,(0,d.jsx)("button",{ref:N,type:"button",className:(0,u.cn)((0,G.r)({variant:"ghost",size:"icon-sm"}),"ml-auto"),"aria-label":B("searchProject"),title:B("searchProject"),onClick:()=>{c.setSearchOpen(!0),requestAnimationFrame(()=>K.current?.focus())},children:(0,d.jsx)(p.A,{className:"size-3.5"})})]});return(0,d.jsxs)("section",{className:"flex h-full min-h-0 flex-col bg-sidebar","aria-label":B("projectFiles",{name:b}),onKeyDown:a=>{!ab||"Escape"!==a.key||(a.stopPropagation(),a.nativeEvent.isComposing||R||(a.preventDefault(),ac()))},children:[ab?(0,d.jsx)(M,{input:H.search,inputRef:K,invalid:"error"===H.search.status,onQueryChange:a=>c.setSearchQuery(a),onOptionsChange:a=>c.setSearchOptions(a),onComposingChange:aa,onClose:ac,onOpenFirst:()=>{let a=c.state.search;if("ready"!==a.status)return;let b=a.fileMatches[0],d=a.contentMatches[0];b?ap(b.path):d&&ap(d.path,d.line)},onFocusResults:()=>L.current?.querySelector("button")?.focus()}):(0,d.jsxs)("div",{className:"border-b px-1",children:[i?(0,d.jsxs)("div",{className:"flex min-h-7 min-w-0 items-center gap-1",children:[(0,d.jsx)(Q.J,{cwd:a,path:"",type:"directory",onReveal:c.canReveal?(a,b)=>c.revealFile(a,b):void 0,trigger:h?(0,d.jsx)("div",{className:"flex min-w-0 flex-1",children:h}):(0,d.jsxs)("div",{tabIndex:0,className:"flex min-w-0 flex-1 items-baseline gap-1",children:[(0,d.jsx)("p",{className:"shrink-0 truncate text-xs font-semibold",title:b,children:b}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:"\xb7"}),(0,d.jsx)("p",{className:"min-w-0 truncate font-mono text-xs text-muted-foreground",title:a,children:(v=a.replaceAll("\\","/").split("/").filter(Boolean)).length<=2?a:`…/${v.slice(-2).join("/")}`})]})}),aB]}):null,i?aC:(0,d.jsx)(Q.J,{cwd:a,path:"",type:"directory",onReveal:c.canReveal?(a,b)=>c.revealFile(a,b):void 0,trigger:aC})]}),ab?(0,d.jsx)(O,{search:H.search,resultsRef:L,activePath:H.activeDiff?null:H.activePath,onOpen:ap,wrapFile:(a,b,c)=>as(a,c,ai.get(a)??null,!1,b),renderFileIcon:W,fileDecoration:a=>{let b=ai.get(a)??null;return{className:X(b),badge:b?(0,P.XB)(b.change):void 0}}},JSON.stringify([H.search.query,H.search.scope,H.search.caseSensitive,H.search.wholeWord,H.search.regex])):(0,d.jsxs)(F.V,{className:(0,u.cn)(S().tree,"min-h-0 flex-1"),viewportClassName:"py-0.5",viewportRef:J,onViewportScroll:a=>c.setTreeScrollTop(a.currentTarget.scrollTop),children:[ag.filter(a=>"unavailable"===a.state).map(a=>"unavailable"===a.state?(0,d.jsxs)("p",{role:"alert",className:"mx-2 mb-1 break-words rounded-md bg-muted px-2 py-2 text-sm text-destructive",children:[a.root||b,":",(0,s.fD)(a.message,D)]},a.root):null),I?.snapshot.status==="error"?(0,d.jsx)("p",{className:"mx-2 mb-1 rounded-md bg-muted px-2 py-2 text-sm text-destructive",children:I.snapshot.error}):null,"repository"===aA?(w=ag.some(a=>""===a.root),x=I?.changesOnly?ag.filter(a=>"unavailable"===a.state||a.changes.length>0):ag,(0,d.jsxs)("div",{className:"px-1",children:[w?null:ax(null,"",b),x.map(a=>ax(a,a.root,(0,P.Hj)(b,a.root))),I?.changesOnly&&0===x.length?(0,d.jsx)("p",{className:"px-2 py-5 text-center text-xs text-muted-foreground",children:B("noChangedFiles")}):null]})):(()=>{if(I?.changesOnly){let a=(0,T.OA)(ah.map(a=>a.projectPath));return(0,d.jsx)(y,{className:"rounded-none border-0 bg-transparent",expanded:am,selectedPath:H?.activeDiff?(0,T.Im)("file",(0,P.oW)(H.activeDiff.repositoryRoot,H.activeDiff.path)):H.activePath?(0,T.Im)("file",H.activePath):void 0,onExpandedChange:ao,onSelect:aw,children:ah.length>0?av(a,""):(0,d.jsx)("p",{className:"px-2 py-5 text-center text-xs text-muted-foreground",children:ag.some(a=>"unavailable"===a.state)?B("incompleteRepository"):B("noChangedFiles")})})}return(0,d.jsx)(y,{className:"rounded-none border-0 bg-transparent",expanded:am,selectedPath:H.activePath?(0,T.Im)("file",H.activePath):void 0,onExpandedChange:ao,onSelect:aw,children:au("",null,!1)})})()]})]})}},49057:(a,b,c)=>{"use strict";c.d(b,{A_:()=>k,Hj:()=>i,XB:()=>l,eP:()=>o,iH:()=>m,lN:()=>n,oW:()=>h,oY:()=>g,ws:()=>j});var d=c(53403),e=c(89172),f=c(83731);function g(a){let b=new Map;for(let c of a){let a=c.split("/").filter(Boolean),d=b,e="";for(let[b,f]of a.entries()){e=e?`${e}/${f}`:f;let g=d.get(f);g||(g={name:f,path:e,branchName:null,children:new Map},d.set(f,g)),b===a.length-1&&(g.branchName=c),d=g.children}}return function a(b){return[...b].sort((a,b)=>a.name.localeCompare(b.name,void 0,{numeric:!0,sensitivity:"base"})).map(b=>({name:b.name,path:b.path,branchName:b.branchName,children:a(b.children.values())}))}(b.values())}function h(a,b){return(0,f._J)(a,b)}function i(a,b){return b.split("/").at(-1)||a}function j(a){return"branch"===a.type?a.name:`@ ${a.commit.slice(0,7)}`}function k(a,b,c="en"){if(0===b.length)return null;let f=e.C[c];if(1===b.length){let e=b[0],g=i(a,e.root);if("unavailable"===e.state){let a=f.gitUnavailable;return{full:e.root?`${g} \xb7 ${a}`:a,compact:"Git !",title:`${g}${"en"===c?": ":":"}${(0,d.fD)(e.message,c)}`,diverged:!0}}let h=j(e.head);return{full:e.root?`${g} \xb7 ${h}`:h,compact:h,title:`${f.gitBranches}: ${g} \xb7 ${h}`,diverged:"detached"===e.head.type}}let g=`${b.length} ${f.repositoriesUnit}`;return{full:g,compact:`Git ${b.length}`,title:`${f.gitBranches}: ${g}`,diverged:!1}}function l(a){let b=[a.indexStatus,a.worktreeStatus];return b.includes("unmerged")?"!":b.includes("deleted")?"D":b.includes("renamed")?"R":b.includes("added")?"A":b.includes("modified")?"M":"?"}function m(a){let b=l(a);return"D"===b?"text-muted-foreground":"?"===b?"text-red-600 dark:text-red-400":"A"===b?"text-emerald-600 dark:text-emerald-400":"!"===b?"text-violet-600 dark:text-violet-400":"text-blue-600 dark:text-blue-400"}function n(a,b,c){if(/^(?:[a-z]:|\/|\\\\)/i.test(b))return null;let d=/^[a-z]:[\\/]/i.test(a)||a.startsWith("\\\\"),e=a=>d?a.toLowerCase():a,f=[...c].sort((a,b)=>b.root.length-a.root.length).find(a=>!a.root||e(b).startsWith(`${e(a.root)}/`));if(!f)return null;let g=f.root?b.slice(f.root.length+1):b;return{repository:f,path:g,change:"ready"===f.state?f.changes.find(a=>e(a.path)===e(g)):void 0}}function o(a){return a.flatMap(a=>"ready"===a.state?a.changes.map(b=>({repositoryRoot:a.root,repository:a,path:b.path,projectPath:h(a.root,b.path),change:b})):[])}},51108:(a,b,c)=>{"use strict";c.d(b,{J:()=>q});var d=c(52834),e=c(97586),f=c(87366),g=c(37496),h=c(9365),i=c(50599),j=c(49147),k=c(57850),l=c(93306),m=c(2719),n=c(91816),o=c(60819),p=c(13749);function q({cwd:a,path:b,type:c,trigger:r,openLabel:s,onOpen:t,expanded:u,onToggle:v,historical:w,oldPath:x,onReveal:y}){let{t:z}=(0,k.Bd)("projectFiles"),A=(0,m.G)(),[B,C]=(0,j.useState)(null),D=B??{cwd:a,path:b,type:c,oldPath:x},E=(0,j.useRef)(!1),F=(0,j.useRef)(""),G="file"===c?"file":"folder",H=a=>{(0,l.x)(a).then(a=>{a?A.success(z("copied")):A.error(z("copyFailed"))})},I=(D.path||D.cwd.replaceAll("\\","/")).split("/").filter(Boolean).at(-1)??D.cwd;return(0,d.jsxs)(n.tz,{onOpenChange:(d,e)=>{C(d?{cwd:a,path:b,type:c,oldPath:x}:null);let f=e.event;d&&("touch"===F.current||"pointerType"in f&&"touch"===f.pointerType||f.type.startsWith("touch"))&&(E.current=!0)},children:[(0,d.jsx)(n.Rc,{render:r,"data-project-path-menu-trigger":"",onPointerDown:a=>{F.current=a.pointerType,E.current=!1},onTouchEndCapture:a=>{let b=a.target;!B||!E.current||"touch"!==F.current||b instanceof Element&&b.closest("[data-project-path-menu-trigger]")===a.currentTarget&&a.cancelable&&a.preventDefault()},onClickCapture:a=>{E.current&&(a.preventDefault(),a.stopPropagation(),E.current=!1)},onKeyDownCapture:a=>{if(a.defaultPrevented||a.nativeEvent.isComposing)return;let b=a.target;if(!(b instanceof Element)||b.closest("[data-project-path-menu-trigger]")!==a.currentTarget||(F.current="keyboard",E.current=!1,"ContextMenu"!==a.key&&!("F10"===a.key&&a.shiftKey)))return;a.preventDefault(),a.stopPropagation();let c=b.getBoundingClientRect();a.currentTarget.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,button:2,clientX:c.left+Math.min(c.width,120)/2,clientY:c.top+Math.min(c.height,36)/2}))}}),(0,d.jsxs)(o.D,{children:[t?(0,d.jsxs)(n.kt,{onClick:t,children:[(0,d.jsx)(e.A,{}),s??z("openPreview")]}):null,v?(0,d.jsxs)(n.kt,{onClick:v,children:[u?(0,d.jsx)(f.A,{}):(0,d.jsx)(g.A,{}),z(u?"collapse":"expand")]}):null,t||v?(0,d.jsx)(n.K5,{}):null,y?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(n.kt,{"data-testid":`project-${G}-reveal-${b}`,onClick:()=>{y&&y(D.path,D.type).then(()=>A.success(z("revealRequested"))).catch(a=>{A.error(a instanceof Error?a.message:z("revealFailed"))})},children:[(0,d.jsx)(h.A,{}),w?"directory"===c?z("openCurrentWorkspace"):z("locateCurrentWorkspace"):"directory"===c?z("openFolder"):z("openContainingFolder")]}),(0,d.jsx)(n.K5,{})]}):null,(0,d.jsxs)(n.kt,{"data-testid":`project-${G}-copy-address-${b}`,onClick:()=>H((0,p.$)(D.cwd,D.path)),children:[(0,d.jsx)(i.A,{}),z("copyAbsolutePath")]}),(0,d.jsxs)(n.kt,{onClick:()=>H(D.path||"."),children:[(0,d.jsx)(i.A,{}),z("copyRelativePath")]}),(0,d.jsxs)(n.kt,{onClick:()=>H(I),children:[(0,d.jsx)(i.A,{}),z("directory"===c?"copyFolderName":"copyFileName")]}),D.oldPath?(0,d.jsxs)(n.kt,{onClick:()=>H(D.oldPath),children:[(0,d.jsx)(i.A,{}),z("copyOldRelativePath")]}):null]})]})}},51949:(a,b,c)=>{"use strict";c.d(b,{CT:()=>n,JH:()=>p,NL:()=>g,Nu:()=>q,_g:()=>k,eC:()=>l,gB:()=>h,ih:()=>v,jI:()=>u,p$:()=>m,rh:()=>j,uV:()=>e,xm:()=>f});var d=c(87883);let e=4096,f=5e3,g=5242880,h=1048576;function i(a,b){return""===a?b:!(a.length>e||a.startsWith("/")||a.includes("\\")||a.includes("\0")||/^[a-zA-Z]:/.test(a))&&a.split("/").every(a=>a.length>0&&"."!==a&&".."!==a)}let j=d.Yj().max(e).refine(a=>i(a,!0),"目录路径必须是规范相对路径"),k=d.Yj().min(1).max(e).refine(a=>i(a,!1),"文件路径必须是规范相对路径"),l=d.Yj().min(1).max(e).refine(a=>i(a,!1)||a.length>0&&a.length<=e&&!a.includes("\0")&&(a.startsWith("/")||a.startsWith("\\\\")||/^[a-zA-Z]:[\\/]/.test(a)),"预览路径必须是规范相对路径或绝对路径"),m=d.k5(["compressed","original"]),n=d.k5(["image/jpeg","image/png","image/webp","image/gif"]),o=d.Ik({name:d.Yj().min(1),type:d.k5(["directory","file"])}).strict(),p=d.Ik({entries:d.YO(o).max(f),truncated:d.zM()}).strict(),q=d.Ik({query:d.Yj().min(1).max(200).refine(a=>a.trim().length>0&&!/[\0\r\n]/.test(a),"搜索词必须是非空单行文本"),scope:d.k5(["all","files","content"]).default("all"),caseSensitive:d.zM().default(!1),wholeWord:d.zM().default(!1),regex:d.zM().default(!1)}).strict(),r=d.Ik({start:d.ai().int().nonnegative(),end:d.ai().int().nonnegative()}).strict().refine(a=>a.start<=a.end,"搜索命中区间无效"),s=d.Ik({path:k,ranges:d.YO(r)}).strict().refine(a=>a.ranges.every(b=>b.end<=a.path.length),"文件名命中区间越界"),t=d.Ik({path:k,line:d.ai().int().positive(),text:d.Yj().max(1e3),ranges:d.YO(r)}).strict().refine(a=>a.ranges.every(b=>b.end<=a.text.length),"正文命中区间越界"),u=d.Ik({fileMatches:d.YO(s).max(100),contentMatches:d.YO(t).max(200),truncated:d.zM()}).strict(),v=d.gM("kind",[d.Ik({kind:d.eu("text"),content:d.Yj(),size:d.ai().int().nonnegative().max(g)}).strict(),d.Ik({kind:d.eu("image"),mimeType:n,data:d.Yj().min(1),size:d.ai().int().positive().max(0xa00000)}).strict()])},51972:(a,b,c)=>{"use strict";function d(a,b,c){a.addCommand(b,c,"editorTextFocus && !findWidgetVisible && !suggestWidgetVisible && !renameInputVisible && !parameterHintsVisible && !referenceSearchVisible && !editorHoverVisible && !editorHoverFocused")}c.d(b,{e:()=>d})},52660:(a,b,c)=>{"use strict";c.d(b,{Wq:()=>g,ku:()=>i,lU:()=>h}),c(51949);let d=new Set,e="compressed";function f(){}function g(){return f(),e}function h(a){if(f(),e!==a){e=a;try{window.localStorage.setItem("pi-super:image-preview-mode",a)}catch{}for(let a of[...d])a()}}function i(a){return d.add(a),()=>d.delete(a)}},53403:(a,b,c)=>{"use strict";c.d(b,{fD:()=>f,qf:()=>e});var d=c(87883);let e=d.KC([d.Yj(),d.Ik({default:d.Yj(),translations:d.g1(d.Yj().min(1).max(35),d.Yj()).refine(a=>Object.keys(a).length<=16,"too many translations")}).strict()]);function f(a,b){return"string"==typeof a?a:a.translations[b]??a.translations[b.split("-")[0]]??a.default}},53437:(a,b,c)=>{"use strict";c.d(b,{IV:()=>o,om:()=>t,e6:()=>v,XC:()=>s});var d=c(52834),e=c(60816),f=c(63345),g=c(98004),h=c(40181),i=c(49028),j=c(21556),k=c(97832),l=c(57850),m=c(38684),n=c(15620);let o={input:["dataPiMarkdownProgress"],blockquote:["dataPiMarkdownAlert"]};function p(a){return{type:"paragraph",children:[],data:{hName:"input",hProperties:{type:"checkbox",disabled:!0,checked:"[x]"===a.toLowerCase(),..."[-]"===a?{dataPiMarkdownProgress:"true"}:{}}}}}var q=c(4935),r=c.n(q);let s=[...Object.values(m.U2),function(){return(a,b)=>{let c=String(b.value),d=(a,b)=>{let d=a.position?.start.offset;return void 0!==d&&c.slice(d,d+b.length)===b},e=a=>{let b=a.children?.[0];if("tableCell"===a.type&&a.children?.length===1&&b?.type==="text"){let c=b.value??"";/^\[[ xX-]\]$/.test(c)&&d(b,c)&&(a.children=[p(c)])}else if("listItem"===a.type&&b?.type==="paragraph"){let c=b.children?.[0];c?.type==="text"&&/^\[-\](?:\s|$)/.test(c.value??"")&&d(c,"[-]")&&(c.value=c.value.slice(3),b.children.unshift(p("[-]")),a.data={...a.data,hProperties:{className:["task-list-item"]}})}else if("blockquote"===a.type&&b?.type==="paragraph"){let c=b.children?.[0],e=c?.value?.match(/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\][ \t]*(?:\r?\n|$)/);c?.type==="text"&&e&&d(c,`[!${e[1]}]`)&&(e[0].endsWith("\n")||1===b.children.length||b.children[1]?.type==="break")&&(c.value=c.value.slice(e[0].length),c.value||(b.children.shift(),b.children[0]?.type==="break"&&b.children.shift()),0===b.children.length&&a.children.shift(),a.data={...a.data,hProperties:{dataPiMarkdownAlert:e[1].toLowerCase()}})}for(let b of a.children??[])e(b)};e(a)}}],t=r().markdown,u={note:{icon:e.A,label:"markdownNote"},tip:{icon:f.A,label:"markdownTip"},important:{icon:g.A,label:"markdownImportant"},warning:{icon:h.A,label:"markdownWarning"},caution:{icon:i.A,label:"markdownCaution"}},v={input:function({"data-pi-markdown-progress":a,...b}){let{t:c}=(0,l.Bd)("common");if(delete b.node,"checkbox"!==b.type)return(0,d.jsx)("input",{...b});let e=a?"progress":b.checked?"completed":"pending",f=a?"[-]":b.checked?"[x]":"[ ]",g=c(a?"markdownProgress":b.checked?"markdownCompleted":"markdownPending");return(0,d.jsxs)("span",{className:r().status,"data-state":e,role:"img","aria-label":g,title:g,children:[a?(0,d.jsx)(j.A,{"aria-hidden":"true"}):b.checked?(0,d.jsx)(k.A,{"aria-hidden":"true"}):null,(0,d.jsx)("span",{className:"sr-only","aria-hidden":"true",children:f})]})},blockquote:function({"data-pi-markdown-alert":a,className:b,children:c,...e}){let{t:f}=(0,l.Bd)("common");delete e.node;let g=Object.entries(u).find(([b])=>b===a)?.[1];if(!g)return(0,d.jsx)("blockquote",{...e,"data-streamdown":"blockquote",className:(0,n.cn)("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",b),children:c});let h=g.icon;return(0,d.jsxs)("aside",{className:r().alert,role:"note","aria-label":f(g.label),children:[(0,d.jsxs)("div",{className:r().alertTitle,children:[(0,d.jsx)(h,{"aria-hidden":"true"}),f(g.label)]}),(0,d.jsx)("div",{className:r().alertBody,children:c})]})}}},55091:(a,b,c)=>{"use strict";function d(a){return/\.(md|markdown)$/i.test(a)?"markdown":/\.html?$/i.test(a)?"html":null}c.d(b,{g:()=>d})},55579:(a,b,c)=>{"use strict";c.d(b,{F:()=>e});let d="/project-preview";function e(a){return a?`${d}?cwd=${encodeURIComponent(a)}`:d}},57396:a=>{a.exports={tree:"l3-project-file-browser_tree__KA1C9"}},59411:(a,b,c)=>{"use strict";c.d(b,{FH:()=>h,N$:()=>i,rB:()=>k,rn:()=>l});var d=c(87883),e=c(23423),f=c(41994);let g=d.Ik({cwd:e.m4,sessionCount:d.ai().int().nonnegative(),updatedAt:f.k}).strict(),h=d.Ik({forceRefresh:d.zM().default(!1)}).strict(),i=d.Ik({directories:d.YO(g)}).strict();d.Ik({cwd:e.m4,ignored:d.zM()}).strict(),d.Ik({}).strict();let j=d.Ik({cwd:e.m4,name:d.Yj().trim().min(1)}).strict(),k=d.Ik({cwd:e.m4.nullable()}).strict(),l=d.Ik({cwd:e.m4.nullable(),parentCwd:e.m4.nullable(),directories:d.YO(j)}).strict(),m=d.k5(["title","user","assistant","sessionId"]),n=d.Ik({scope:m,count:d.ai().int().positive(),entryId:e.Rv.nullable(),timestampMs:f.k.nullable(),preview:d.Yj().min(1).max(160)}).strict(),o=d.Ik({sessionId:e.$E,cwd:e.m4,name:d.Yj().nullable(),createdAt:f.k,updatedAt:f.k,messageCount:d.ai().int().nonnegative(),userMessageCount:d.ai().int().nonnegative(),firstMessage:d.Yj().max(160),matches:d.YO(n).min(1).max(4).nullable()}).strict();d.Ik({cwd:e.m4,query:d.Yj().trim().max(120).default(""),forceRefresh:d.zM().default(!1),searchIn:d.YO(m).min(1).max(4).default(["title","user"])}).strict(),d.Ik({cwd:e.m4,sessions:d.YO(o)}).strict(),d.Ik({cwd:e.m4,sessionId:e.$E,query:d.Yj().trim().max(120).default(""),page:d.Ik({index:d.ai().int().positive(),size:d.ai().int().positive().max(50)}).strict()}).strict();let p=d.Ik({entryId:e.Rv,timestampMs:f.k,text:d.Yj()}).strict();d.Ik({page:d.Ik({index:d.ai().int().positive(),size:d.ai().int().positive(),total:d.ai().int().nonnegative()}).strict(),messages:d.YO(p)}).strict()},60819:(a,b,c)=>{"use strict";c.d(b,{D:()=>k});var d=c(52834),e=c(65614),f=c(9698),g=c(5701),h=c(91816),i=c(15620),j=c(91464);function k({children:a}){return(0,d.jsx)(h.JW,{children:(0,d.jsx)(e.y,{className:"isolate z-[130] outline-none",side:"right",align:"start",alignOffset:4,children:(0,d.jsx)(f._,{"data-slot":"context-menu-content",finalFocus:!1,className:(0,i.cn)(j.hD,"flex flex-col overflow-hidden p-0"),children:(0,d.jsx)(g.V,{className:"min-h-0",viewportClassName:"p-1",children:a})})})})}},68341:(a,b,c)=>{"use strict";c.d(b,{Cp:()=>q,ph:()=>r,Tk:()=>p});var d=c(13749),e=c(95186),f=c(59411),g=c(92494);class h{constructor(a,b){this.cwd=a,this.reader=b,this.state={snapshot:{status:"idle",repositories:[],error:null},layout:"directory",changesOnly:!1,expandedRepositories:new Set},this.listeners=new Set,this.revision=0,this.request=null,this.disposed=!1,this.subscribe=a=>(this.listeners.add(a),()=>this.listeners.delete(a)),this.getRevision=()=>this.revision}getWorkspace(a){return a===this.cwd?this.state:null}ensureSnapshot(a){return a!==this.cwd||"ready"===this.state.snapshot.status||this.request?Promise.resolve():this.load(!1)}refreshSnapshot(a){return a===this.cwd?this.load(!0):Promise.resolve()}setLayout(a,b){this.state.layout=b,this.publish()}setChangesOnly(a,b){this.state.changesOnly=b,this.publish()}toggleRepository(a,b){let c=new Set(this.state.expandedRepositories);c.has(b)?c.delete(b):c.add(b),this.state.expandedRepositories=c,this.publish()}dispose(){this.disposed=!0,this.request?.abort(),this.request=null,this.listeners.clear()}async load(a){if(this.disposed)return;this.request?.abort();let b=new AbortController;this.request=b,this.state.snapshot={...this.state.snapshot,status:"loading",error:null},this.publish();try{let c=await this.reader.snapshot(b.signal,a);if(this.request!==b)return;this.state.snapshot={status:"ready",repositories:c.repositories,error:null}}catch(a){if(this.request!==b)return;this.state.snapshot={...this.state.snapshot,status:"error",error:a instanceof Error?a.message:"读取 Git 状态失败"}}this.request===b&&(this.request=null,this.publish())}publish(){if(!this.disposed)for(let a of(this.revision+=1,this.listeners))a()}}var i=c(52660),j=c(51601),k=c(21850),l=c(83731);function m(a,b){return(0,k.B)({msg:j.p["zh-CN"][a],i18n:{key:`projectHistory:${a}`,...b?{params:b}:{}}})}function n(){return{status:"idle",data:null,error:null}}class o{constructor(a,b){this.reader=a,this.files=b,this.state={repositoryRoot:null,mode:"history",tip:"HEAD",base:"",target:"HEAD",strategy:"merge-base",query:"",author:"",authorSuggestions:[],selectedCommit:null,selectedChangePath:null,branches:n(),log:n(),changes:n()},this.scroll={log:0,changes:0},this.listeners=new Set,this.requests=new Map,this.revision=0,this.disposed=!1,this.logPage=1,this.changesPage=1,this.range=null,this.selection=null,this.restoredCommit=null,this.restoredChangePath=null,this.restoredChangesScroll=null,this.queryTimer=null,this.collapsedDirectories=new Set,this.changeTree=(0,l.OA)([]),this.changeRows=[],this.subscribe=a=>(this.listeners.add(a),()=>this.listeners.delete(a)),this.getRevision=()=>this.revision}getChangeRows(){return this.changeRows}restoreBrowsing(a,b=!0){Object.assign(this.state,{repositoryRoot:a.repositoryRoot,mode:a.mode,tip:a.tip,base:a.base,target:a.target,strategy:a.strategy,query:a.query,author:a.author}),this.scroll.log=a.logScroll,this.restoredChangesScroll=a.changesScroll,this.restoredCommit=a.selectedCommit,this.restoredChangePath=a.selectedChangePath,b&&null!==a.repositoryRoot&&(this.loadBranches(),this.reload())}selectChange(a){this.state.changes.data?.items.some(b=>b.path===a)&&(this.state.selectedChangePath=a,this.publish())}toggleChangeDirectory(a){let b=this.changeRows.find(b=>b.directory?.path===a);if(b?.directory){if(b.expanded)this.collapsedDirectories.add(a);else for(let a of b.directory.paths)this.collapsedDirectories.delete(a);this.rebuildChangeRows(),this.publish()}}setScroll(a,b){this.scroll[a]=b}setRepository(a){if(a===this.state.repositoryRoot){"idle"===this.state.branches.status&&(this.loadBranches(),this.reload());return}this.cancel("branches"),this.state.repositoryRoot=a,this.state.tip=this.state.target="HEAD",this.state.base="",this.state.author="",this.state.authorSuggestions=[],this.state.branches=n(),this.resetSelection(),this.loadBranches(),this.reload()}setMode(a){this.state.mode!==a&&(this.state.mode=a,this.resetSelection(),this.reload())}setRevision(a,b){this.state[a]!==b&&(this.state[a]=b,this.resetSelection(),this.reload())}setStrategy(a){this.state.strategy!==a&&(this.state.strategy=a,this.resetSelection(),this.reload())}setQuery(a){this.setLogFilter("query",a)}setAuthor(a){this.setLogFilter("author",a)}setLogFilter(a,b){this.state[a]=b,this.resetSelection(),this.queryTimer=setTimeout(()=>{this.queryTimer=null,this.reload()},220)}refresh(){this.resetSelection(),this.loadBranches(),this.reload()}async reload(){if(!this.disposed&&null!==this.state.repositoryRoot){if("compare"===this.state.mode)return this.state.base?void await this.loadChanges({base:this.state.base,target:this.state.target,strategy:this.state.strategy},1,!0):void this.publish();await this.loadLog(1)}}selectCommit(a,b){let c="string"==typeof a?a:a.oid;this.state.selectedCommit=c,this.scroll.changes=0,this.clearHistoricalDiff(),this.loadChanges({commit:c,...b?{parent:b}:{}},1)}showAggregate(){this.range&&(this.state.selectedCommit=null,this.clearHistoricalDiff(),this.loadChanges(this.range,1))}loadMoreLog(){"ready"===this.state.log.status&&this.state.log.data?.hasMore&&!(this.state.log.data.items.length>=2e3)&&this.loadLog(this.logPage+1)}loadMoreChanges(){this.selection&&"ready"===this.state.changes.status&&this.state.changes.data?.hasMore&&this.loadChanges(this.selection,this.changesPage+1)}openChange(a){if(null===this.state.repositoryRoot)return;let b=this.state.changes.data,c=b?.items.find(b=>b.path===a);if(!b||!c)return;this.state.selectedChangePath=a,this.publish();let{original:d,target:e}=b.comparison,f=d?d.slice(0,8):m("emptyRevision"),g=m(this.state.selectedCommit||"merge-base"!==this.state.strategy?"historyDiffDirect":"historyDiffAncestor",{left:f,target:e.slice(0,8)});this.files.openDiff(this.state.repositoryRoot,a,{baseCommit:d,targetCommit:e,...c.oldPath?{oldPath:c.oldPath}:{}},g)}dispose(){for(let a of(this.disposed=!0,this.queryTimer&&clearTimeout(this.queryTimer),this.requests.values()))a.abort();this.requests.clear(),this.resetChangeTree(),this.listeners.clear()}async loadBranches(){let a=this.state.repositoryRoot;if(null===a||this.disposed)return;let b=this.begin("branches");this.state.branches={status:"loading",data:this.state.branches.data,error:null},this.publish();try{let c=await this.reader.branches(a,b.signal);if(!this.current("branches",b))return;this.state.branches={status:"ready",data:c,error:null}}catch(a){if(!this.current("branches",b))return;this.state.branches={status:"error",data:null,error:this.error(a)}}this.requests.delete("branches"),this.publish()}async loadLog(a){let b=this.state.repositoryRoot;if(this.disposed||null===b)return;let c=a>1?this.state.log.data:null,d=c?.tip??("compare"===this.state.mode?this.range?.target:this.state.tip),e=c?.exclude??("compare"===this.state.mode?this.range?.base:void 0);if(!d)return;let f=this.begin("log");this.state.log={status:"loading",data:c,error:null},this.publish();try{let g=await this.reader.log(b,{tip:d,...e?{exclude:e}:{},query:this.state.query,...this.state.author.trim()?{author:this.state.author.trim()}:{},page:{index:a,size:50}},f.signal);if(!this.current("log",f))return;for(let{author:b}of(this.logPage=a,g.items))b&&this.state.authorSuggestions.length<200&&!this.state.authorSuggestions.includes(b)&&this.state.authorSuggestions.push(b);if(this.state.log={status:"ready",data:{...g,items:[...c?.items??[],...g.items].slice(0,2e3)},error:null},1===a&&g.items[0]){let a=g.items.find(a=>a.oid===this.restoredCommit);this.restoredCommit=null,a?(this.state.selectedCommit=a.oid,this.loadChanges({commit:a.oid},1)):"history"===this.state.mode&&this.selectCommit(g.items[0])}}catch(a){if(!this.current("log",f))return;this.state.log={status:"error",data:c,error:this.error(a)}}this.requests.delete("log"),this.publish()}async loadChanges(a,b,c=!1){let d=this.state.repositoryRoot;if(this.disposed||null===d)return;let e=this.begin("changes"),f=b>1?this.state.changes.data:null;1===b&&this.resetChangeTree(),this.selection=a,this.state.changes={status:"loading",data:f,error:null},this.publish();try{let g=await this.reader.changes(d,{selection:a,page:{index:b,size:200}},e.signal);if(!this.current("changes",e))return;this.changesPage=b;let h=[...f?.items??[],...g.items];this.state.changes={status:"ready",data:{...g,items:h},error:null},this.changeTree=(0,l.OA)(h.map(a=>a.path)),null!==this.restoredChangesScroll&&(this.scroll.changes=this.restoredChangesScroll,this.restoredChangesScroll=null),this.rebuildChangeRows(),this.restoredChangePath&&h.some(a=>a.path===this.restoredChangePath)&&(this.state.selectedChangePath=this.restoredChangePath,this.restoredChangePath=null),this.selection="commit"in a?{commit:g.comparison.target,...g.commit?.selectedParent?{parent:g.commit.selectedParent}:{}}:{base:g.comparison.base,target:g.comparison.target,strategy:a.strategy},c&&"base"in this.selection&&(this.range=this.selection,this.loadLog(1))}catch(a){if(!this.current("changes",e))return;this.state.changes={status:"error",data:f,error:this.error(a)}}this.requests.delete("changes"),this.publish()}resetSelection(){this.restoredCommit=null,this.restoredChangePath=null,this.restoredChangesScroll=null,this.queryTimer&&clearTimeout(this.queryTimer),this.queryTimer=null,this.scroll.log=this.scroll.changes=0,this.cancel("log"),this.cancel("changes"),this.range=null,this.selection=null,this.state.selectedCommit=null,this.state.log=n(),this.state.changes=n(),this.resetChangeTree(),this.clearHistoricalDiff(),this.publish()}resetChangeTree(){this.collapsedDirectories.clear(),this.changeTree=(0,l.OA)([]),this.changeRows=[],this.state.selectedChangePath=null,this.scroll.changes=0}rebuildChangeRows(){let a=Math.floor(this.scroll.changes/36),b=this.changeRows[a],c=this.scroll.changes%36;this.changeRows=(0,l.qV)(this.changeTree,this.collapsedDirectories);let d=b?this.changeRows.findIndex(a=>a.key===b.key):-1;this.scroll.changes=d>=0?36*d+c:Math.min(this.scroll.changes,Math.max(0,(this.changeRows.length-1)*36))}clearHistoricalDiff(){this.files.state.activeDiff?.comparison&&this.files.closeDiff()}begin(a){this.cancel(a);let b=new AbortController;return this.requests.set(a,b),b}cancel(a){this.requests.get(a)?.abort(),this.requests.delete(a)}current(a,b){return!this.disposed&&this.requests.get(a)===b}error(a){return a instanceof Error?a.message:m("historyReadFailed")}publish(){if(!this.disposed)for(let a of(this.revision+=1,this.listeners))a()}}function p(a,b){return(0,e.QL)(a,{path:"/api/pi/directories/list",request:f.FH,response:f.N$},{forceRefresh:!1},b)}function q(a,b,c){return(0,e.QL)(a,{path:"/api/pi/directory-entries/list",request:f.rB,response:f.rn},{cwd:b},c)}function r(a,b,c,f,j,k={}){let l=(0,e.Y4)(a,{cwd:b},k.onUnauthorized),m=new g.h(b,l,{imagePreviewMode:i.Wq,onNotice:c,reveal:(c,e="file")=>(0,d.P)(a,{cwd:b},c,e),maxTabs:20}),n=new h(b,l),p=new o(l,m),q=!1;return{files:m,git:n,history:p,restore(){if(!q&&(q=!0,n.setLayout(b,j.treeLayout),f)){for(let a of(n.setChangesOnly(b,f.changesOnly),f.expandedRepositories))n.toggleRepository(b,a);m.restoreBrowsing(f),p.restoreBrowsing(f.history,!k.lazyHistory)}},dispose(){p.dispose(),n.dispose(),m.dispose()}}}},70448:a=>{a.exports={host:"l4-code-line-markers_host__BBo2H",added:"l4-code-line-markers_added__oTNsK",modified:"l4-code-line-markers_modified__PZnY_",deletedBefore:"l4-code-line-markers_deletedBefore___1b0w",deletedAfter:"l4-code-line-markers_deletedAfter__SEoHy"}},82386:(a,b,c)=>{"use strict";c.d(b,{B3:()=>m,BK:()=>g,R:()=>f,Tr:()=>l,cu:()=>j,dC:()=>k,ix:()=>n});var d=c(51949),e=c(37222);function f(){let a=Number.parseFloat(getComputedStyle(document.documentElement).fontSize)/16;return{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace',fontSize:14*a,lineHeight:Math.round(22*a)}}function g(a){let b=new MutationObserver(()=>a(f()));return b.observe(document.documentElement,{attributes:!0,attributeFilter:["data-pi-desk-display-size"]}),()=>b.disconnect()}let h=null,i=0;function j(){return h||(h=(async()=>{(0,e.fx)()?.locale==="zh-CN"&&await c.e(80880).then(c.t.bind(c,80880,23));let{monaco:a}=await Promise.all([c.e(73691),c.e(20842),c.e(82499)]).then(c.bind(c,82499));return globalThis.MonacoEnvironment={getWorker:(a,b)=>new Worker(new URL(c.p+c.u(354),c.b),{type:void 0,name:b})},a})())}function k(){return document.documentElement.classList.contains("dark")?"vs-dark":"vs"}function l(a){let b=new MutationObserver(()=>a(k()));return b.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>b.disconnect()}function m(a,b,c){i+=1;let d=b.split("/").map(a=>encodeURIComponent(a)).join("/");return a.Uri.parse(`inmemory://pi-desk/${i}/${c}/${d}`)}function n(a,b){if(b>d.gB)return"plaintext";let c=a.replaceAll("\\","/").split("/").at(-1)?.toLocaleLowerCase()??"";return"dockerfile"===c?"dockerfile":"makefile"===c?"plaintext":({bat:"bat",c:"c",cc:"cpp",cjs:"javascript",cpp:"cpp",cs:"csharp",css:"css",dockerfile:"dockerfile",go:"go",h:"cpp",hpp:"cpp",htm:"html",html:"html",ini:"ini",java:"java",js:"javascript",json:"javascript",jsonl:"javascript",jsx:"javascript",kt:"kotlin",less:"less",lua:"lua",md:"markdown",mdx:"markdown",mjs:"javascript",php:"php",ps1:"powershell",py:"python",rb:"ruby",rs:"rust",scss:"scss",sh:"shell",sql:"sql",swift:"swift",toml:"ini",ts:"typescript",tsx:"typescript",txt:"plaintext",xml:"xml",yaml:"yaml",yml:"yaml"})[c.includes(".")?c.split(".").at(-1)??"":""]??"plaintext"}},82563:(a,b,c)=>{"use strict";c.d(b,{Ke:()=>j,Nt:()=>h,R6:()=>i});var d=c(52834),e=c(33023),f=c(42500),g=c(91047);function h({...a}){return(0,d.jsx)(e.N,{"data-slot":"collapsible",...a})}function i({...a}){return(0,d.jsx)(f.R,{"data-slot":"collapsible-trigger",...a})}function j({...a}){return(0,d.jsx)(g.j,{"data-slot":"collapsible-content",...a})}},82589:(a,b,c)=>{"use strict";c.d(b,{b:()=>l});var d=c(52834),e=c(99451),f=c(49147),g=c(57850),h=c(5319),i=c(9860),j=c(42704),k=c(15620);function l({value:a,options:b,onChange:c,ariaLabel:m,placeholder:n,searchPlaceholder:o,emptyText:p,disabled:q=!1,className:r}){let{t:s}=(0,g.Bd)("common"),[t,u]=(0,f.useState)(!1),v=b.find(b=>b.value===a);return(0,d.jsxs)(j.AM,{open:t,onOpenChange:u,children:[(0,d.jsx)(j.Wv,{render:(0,d.jsxs)(h.$,{type:"button",variant:"outline",role:"combobox","aria-label":m,"aria-expanded":t,disabled:q,className:(0,k.cn)("w-full min-w-0 justify-between border-input px-2.5 font-normal focus-visible:-outline-offset-2",r),children:[(0,d.jsx)("span",{className:(0,k.cn)("min-w-0 truncate",!v&&"text-muted-foreground"),children:v?.label??n??s("selectPlaceholder")}),(0,d.jsx)(e.A,{className:"text-muted-foreground"})]})}),(0,d.jsx)(j.hl,{align:"start",sideOffset:4,positionerClassName:"z-[120]",className:"w-(--anchor-width) max-w-[calc(100vw-2rem)] gap-0 p-0",children:(0,d.jsxs)(i.uB,{children:[(0,d.jsx)(i.G7,{placeholder:o??s("searchPlaceholder"),autoFocus:!0}),(0,d.jsxs)(i.oI,{className:"max-h-[min(20rem,var(--available-height))]",children:[(0,d.jsx)(i.xL,{children:p??s("noMatches")}),(0,d.jsx)(i.L$,{children:b.map(b=>(0,d.jsx)(i.h_,{value:`${b.label} ${b.description??""} ${b.value}`,"data-checked":b.value===a?"true":void 0,onSelect:()=>{c(b.value),u(!1)},children:(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"block truncate",children:b.label}),b.description?(0,d.jsx)("span",{className:"mt-0.5 block truncate text-xs text-muted-foreground",children:b.description}):null]})},b.value))})]})]})})]})}},83731:(a,b,c)=>{"use strict";function d(a,b){return`${a}:${b}`}function e(a,b){return a?`${a}/${b}`:b}function f(a,b){return a.localeCompare(b,void 0,{numeric:!0,sensitivity:"base"})}function g(a,b,c=new Set){let d=[a],e=a;for(;!c.has(e);){let a=b(e);if(!a||c.has(a)||!a.startsWith(`${e}/`))break;d.push(a),e=a}return{path:a,targetPath:e,paths:d,label:e.slice(a.lastIndexOf("/")+1)}}function h(a,b=""){let c={path:b,directories:new Map,files:[]},d=new Map([[b,c]]);for(let f of a){let a=(b?f.slice(b.length+1):f).split("/"),g=c;for(let b of a.slice(0,-1)){let a=e(g.path,b),c=d.get(a);c||(c={path:a,directories:new Map,files:[]},d.set(a,c),g.directories.set(a,c)),g=c}g.files.push(f)}return d}function i(a,b,c){return g(a,a=>{let c=b.get(a);return c&&0===c.files.length&&1===c.directories.size?c.directories.keys().next().value??null:null},c)}function j(a,b,c=""){let e=[],g=(c,h)=>{let j=a.get(c);if(j){for(let c of[...j.directories.keys()].sort(f)){let f=i(c,a),j=!f.paths.some(a=>b.has(a));e.push({key:d("directory",c),type:"directory",path:f.targetPath,label:f.label,depth:h,directory:f,expanded:j}),j&&g(f.targetPath,h+1)}for(let a of[...j.files].sort(f))e.push({key:d("file",a),type:"file",path:a,label:a.slice(a.lastIndexOf("/")+1),depth:h})}};return g(c,0),e}c.d(b,{Im:()=>d,Kn:()=>f,OA:()=>h,_J:()=>e,qV:()=>j,rk:()=>g,xV:()=>i})},85544:(a,b,c)=>{"use strict";c.d(b,{k:()=>h});var d=c(52834);c(84593);var e=c(49147),f=c(15620),g=c(4998);function h(a){let{locale:b}=(0,g.i)(),{slides:c,index:h=0,onIndexChange:i,className:j,thumbnails:k=!0,ariaLabel:l="en"===b?"Image preview":"图片预览"}=a,m="inline"===a.mode,n="inline"===a.mode||a.open,o="modal"===a.mode?a.onClose:void 0;c.length;let p=Math.min(Math.max(h,0),Math.max(c.length-1,0)),q=`pi-desk-image-viewer-${(0,e.useId)().replaceAll(":","")}`,r=(0,e.useRef)(null),s=(0,e.useRef)(null),t=(0,e.useRef)(null);if((0,e.useRef)(""),(0,e.useRef)(""),(0,e.useRef)(p),(0,e.useRef)(p),(0,e.useRef)(i),(0,e.useRef)(o),(0,e.useMemo)(()=>JSON.stringify(c.map(a=>[a.src,a.alt])),[c]),(0,f.cn)("pi-desk-image-viewer",m?"pi-desk-image-viewer-inline":"pi-desk-image-viewer-modal",q,j),0===c.length||!n)return null;let u=(0,d.jsx)("span",{ref:r,className:"pi-desk-image-viewer-source","aria-hidden":"true",children:c.map((a,b)=>(0,d.jsx)("img",{src:a.src,alt:a.alt,width:a.width,height:a.height,decoding:"async",draggable:!1},b))});return m?(0,d.jsx)("div",{ref:s,className:"pi-desk-image-viewer-host",role:"region","aria-label":l,tabIndex:0,onKeyDown:a=>{let b=t.current;!b||b.fulled||a.altKey||a.ctrlKey||a.metaKey||a.nativeEvent.isComposing||("ArrowLeft"===a.key||"ArrowRight"===a.key)&&(a.preventDefault(),a.stopPropagation(),"ArrowLeft"===a.key?b.prev(!1):b.next(!1))},children:u}):u}},87348:(a,b,c)=>{"use strict";c.d(b,{e:()=>k});var d=c(52834),e=c(90814),f=c(49147),g=c(57850);c(82386),c(51972);var h=c(96478),i=c(70448),j=c.n(i);let k=(0,f.forwardRef)(function({path:a,content:b,size:c,savedState:i,onSaveState:k,onEscape:l,originalContent:m,onChanges:n,onOpenDiff:o,navigation:p,onNavigation:q},r){let{t:s}=(0,g.Bd)("common"),{t:t}=(0,g.Bd)("projectFiles"),{wrapLines:u}=(0,h.TX)(),v=(0,f.useRef)(null),w=(0,f.useRef)(null);(0,f.useRef)(k),(0,f.useRef)(u),(0,f.useRef)(i),(0,f.useRef)(l);let x=(0,f.useRef)(null);(0,f.useRef)(n),(0,f.useRef)(o),(0,f.useRef)(q);let y=(0,f.useRef)(null),z=(0,f.useRef)(null);(0,f.useCallback)(a=>{let b=z.current;y.current?.clear(),null===b||b>(a.getModel()?.getLineCount()??0)||(y.current??=a.createDecorationsCollection(),y.current.set([{range:{startLineNumber:b,startColumn:1,endLineNumber:b,endColumn:1},options:{isWholeLine:!0,className:"bg-accent"}}]))},[]);let[A,B]=(0,f.useState)("loading");return(0,f.useImperativeHandle)(r,()=>({openSearch(){w.current?.getAction("actions.find")?.run()},gotoLine(){w.current?.getAction("editor.action.gotoLine")?.run()},getSelectionText(){let a=w.current,b=a?.getModel(),c=a?.getSelection();return b&&c&&!c.isEmpty()?b.getValueInRange(c):""},getViewState:()=>w.current?.saveViewState()??null,focus(){w.current?.focus()},previousChange(){x.current?.previousChange()},nextChange(){x.current?.nextChange()}}),[]),(0,d.jsxs)("div",{"data-testid":"code-preview",className:"relative h-full min-h-0 w-full overflow-hidden bg-background",children:[(0,d.jsx)("div",{ref:v,className:`size-full ${j().host}`}),"loading"===A?(0,d.jsxs)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center gap-2 bg-background text-sm text-muted-foreground",children:[(0,d.jsx)(e.A,{className:"size-4 animate-spin"})," ",s("codeLoading")]}):null,"error"===A?(0,d.jsx)("div",{className:"absolute inset-0 flex items-center justify-center p-6 text-center text-sm text-destructive",children:s("codeFailed")}):null]})})},89101:(a,b,c)=>{"use strict";c.d(b,{Ik:()=>n,MG:()=>j,Sq:()=>l,iV:()=>o,oR:()=>p});var d=c(52834);c(49147);var e=c(80546),f=c(15620),g=c(5319),h=c(11071),i=c(13221);function j({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,f.cn)("group/input-group relative flex min-h-8 w-full min-w-0 items-center rounded-lg border border-input bg-card transition-colors duration-150 outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-muted has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:outline-2 has-[[data-slot=input-group-control]:focus-visible]:outline-solid has-[[data-slot=input-group-control]:focus-visible]:-outline-offset-2 has-[[data-slot=input-group-control]:focus-visible]:outline-ring has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",a),...b})}let k=(0,e.F)("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function l({className:a,align:b="inline-start",...c}){return(0,d.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":b,className:(0,f.cn)(k({align:b}),a),onClick:a=>{a.target.closest("button")||a.currentTarget.parentElement?.querySelector("input")?.focus()},...c})}let m=(0,e.F)("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"min-h-7 gap-2 rounded-md px-2",sm:"","icon-xs":"size-7 rounded-md p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function n({className:a,type:b="button",variant:c="ghost",size:e="xs",...h}){return(0,d.jsx)(g.$,{type:b,"data-size":e,variant:c,className:(0,f.cn)(m({size:e}),a),...h})}function o({className:a,...b}){return(0,d.jsx)(h.p,{"data-slot":"input-group-control",className:(0,f.cn)("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:outline-none focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0",a),...b})}function p({className:a,...b}){return(0,d.jsx)(i.T,{"data-slot":"input-group-control",className:(0,f.cn)("flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:outline-none focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0",a),...b})}},91464:(a,b,c)=>{"use strict";c.d(b,{S6:()=>d,dQ:()=>e,hD:()=>f});let d="relative flex min-h-7 cursor-pointer items-center gap-2 rounded-md px-2 py-1 text-sm leading-5 outline-none select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e="data-[variant=destructive]:text-destructive data-[variant=destructive]:data-highlighted:bg-destructive/10 data-[variant=destructive]:data-highlighted:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive",f="z-50 max-h-(--available-height) min-w-60 max-w-[calc(100vw-2rem)] origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-md outline-none transition-[opacity,transform] duration-100 ease-out data-starting-style:scale-[0.98] data-starting-style:opacity-0 data-ending-style:scale-[0.98] data-ending-style:opacity-0 motion-reduce:transition-none"},91816:(a,b,c)=>{"use strict";c.d(b,{Ip:()=>q,JW:()=>o,K5:()=>s,Rc:()=>p,kt:()=>r,tz:()=>n});var d=c(52834);c(49147);var e=c(49067),f=c(10962),g=c(48329),h=c(65614),i=c(9698),j=c(16484),k=c(36089),l=c(15620),m=c(91464);function n({...a}){return(0,d.jsx)(e.D,{"data-slot":"context-menu",...a})}function o({...a}){return(0,d.jsx)(f.g,{"data-slot":"context-menu-portal",...a})}function p({className:a,...b}){return(0,d.jsx)(g.R,{"data-slot":"context-menu-trigger",className:(0,l.cn)("select-none",a),...b})}function q({className:a,align:b="start",alignOffset:c=4,side:e="right",sideOffset:g=0,finalFocus:j=!1,...k}){return(0,d.jsx)(f.g,{children:(0,d.jsx)(h.y,{className:"isolate z-50 outline-none",align:b,alignOffset:c,side:e,sideOffset:g,children:(0,d.jsx)(i._,{"data-slot":"context-menu-content",finalFocus:j,className:(0,l.cn)(m.hD,a),...k})})})}function r({className:a,inset:b,variant:c="default",...e}){return(0,d.jsx)(j.D,{"data-slot":"context-menu-item","data-inset":b,"data-variant":c,className:(0,l.cn)(m.S6,m.dQ,"group/context-menu-item",a),...e})}function s({className:a,...b}){return(0,d.jsx)(k.w,{"data-slot":"context-menu-separator",className:(0,l.cn)("-mx-1 my-1 h-px bg-border",a),...b})}},92494:(a,b,c)=>{"use strict";c.d(b,{h:()=>o});var d=c(89172),e=c(21850),f=c(28661),g=c(96478),h=c(95186),i=c(55091),j=c(83731);let k={scope:"all",caseSensitive:!1,wholeWord:!1,regex:!1};function l(a){return{...a,status:a.query.trim()?"loading":"idle",fileMatches:[],contentMatches:[],truncated:!1,error:null}}function m(a,b){return(0,e.B)({msg:d.C["zh-CN"][a],i18n:{key:`projectFiles:${a}`,...b?{params:b}:{}}})}function n(a){return a instanceof Error?a.message:m("projectReadFailed")}class o{constructor(a,b,c){this.cwd=a,this.reader=b,this.options=c,this.state={tabs:[],activePath:null,directories:new Map,expandedPaths:new Set,treeScrollTop:0,search:l({query:"",...k}),searchOpen:!1,documents:new Map,activeDiff:null},this.listeners=new Set,this.directoryRequests=new Map,this.compactRequests=new Map,this.documentRequests=new Map,this.closeMissing=new Set,this.restoredTabs=new Set,this.restoredEditorStates=new Map,this.restoredFileViewModes=new Map,this.restoredPreviewScrollTops=new Map,this.searchRequest=null,this.navigation=null,this.diffRequest=null,this.revision=0,this.disposed=!1,this.subscribe=a=>(this.listeners.add(a),()=>this.listeners.delete(a)),this.getRevision=()=>this.revision}setSearchOpen(a){this.disposed||this.state.searchOpen===a||(this.cancelSearch(),this.state.searchOpen=a,this.state.search=l({...this.searchInput(),scope:a?"all":this.state.search.scope}),this.publish())}get pendingNavigation(){let a=this.state.activePath;return a&&!this.documentRequests.has(a)?this.navigation:null}consumeNavigation(a,b){this.navigation===a&&(this.navigation=null,b||this.options.onNotice?.(m("searchLineUnavailable")),this.publish())}get canReveal(){return!!this.options.reveal}getBrowsingDocumentSettings(){let a={},b={};for(let c of this.state.tabs){let d=this.state.documents.get(c),e=d?.status==="text"?d.editorState:this.restoredEditorStates.get(c);e&&JSON.stringify(e).length<32768&&(a[c]=e);let f=d?.status==="text"?d.viewMode:this.restoredFileViewModes.get(c);f&&(b[c]=f)}return{editorStates:a,fileViewModes:b}}restoreBrowsing(a){for(let b of(this.state.tabs=[...a.tabs],a.tabs)){this.restoredTabs.add(b);let c=a.editorStates[b];c&&this.restoredEditorStates.set(b,c);let d=a.fileViewModes[b];d&&this.restoredFileViewModes.set(b,d)}for(let b of(this.state.activePath=a.activePath&&a.tabs.includes(a.activePath)?a.activePath:null,this.state.expandedPaths=new Set(a.expandedPaths),this.state.treeScrollTop=a.treeScrollTop,this.state.search=l({query:a.searchQuery,...k}),a.tabs))this.state.documents.set(b,{status:"unloaded"});for(let b of a.expandedPaths)this.ensureDirectory(b);a.activeDiff?this.openDiff(a.activeDiff.repositoryRoot,a.activeDiff.path,a.activeDiff.comparison):this.state.activePath&&this.ensureDocument(this.state.activePath)}async revealFile(a,b="file"){if(!this.options.reveal)throw Error(m("revealUnavailable"));await this.options.reveal(a,b)}ensureRoot(){return this.ensureDirectory("")}ensureDirectory(a){if(this.disposed||this.state.directories.get(a)?.status==="ready")return Promise.resolve();let b=this.directoryRequests.get(a);if(b)return b.promise;let c=new AbortController,d=Promise.resolve().then(async()=>{try{if(c.signal.aborted)return;let b=await this.reader.list(a,c.signal);if(this.directoryRequests.get(a)?.controller!==c)return;this.state.directories.set(a,{status:"ready",...b})}catch(b){if(this.directoryRequests.get(a)?.controller!==c)return;this.state.directories.set(a,{status:"error",error:n(b)})}this.directoryRequests.get(a)?.controller===c&&(this.directoryRequests.delete(a),this.publish())});return this.directoryRequests.set(a,{controller:c,promise:d}),this.state.directories.set(a,{status:"loading"}),this.publish(),d}setExpandedPaths(a,b=!0){let c=[...this.state.expandedPaths].filter(b=>!a.has(b));for(let b of(this.state.expandedPaths=new Set(a),this.compactRequests.keys()))c.some(a=>b===a||b.startsWith(`${a}/`))&&this.compactRequests.delete(b);if(this.publish(),b)for(let b of a)this.ensureDirectory(b)}cancelDirectoryExpansion(a=""){for(let b of this.compactRequests.keys())(!a||b===a||b.startsWith(`${a}/`))&&this.compactRequests.delete(b)}compactDirectory(a,b){return(0,j.rk)(a,a=>{let b=this.onlyDirectory(a);return b&&this.state.directories.has(b)?b:null},b)}async expandDirectoryChain(a,b){let c={};this.compactRequests.set(a,c);let d=a,e=16;for(;!this.disposed&&this.compactRequests.get(a)===c&&this.state.expandedPaths.has(a);){if(this.state.directories.get(d)?.status!=="ready"){if(e--<=0)break;await this.ensureDirectory(d)}if(this.compactRequests.get(a)!==c||this.disposed)return;let f=this.onlyDirectory(d);if(!f||b.has(d)||b.has(f)||e<=0&&this.state.directories.get(f)?.status!=="ready")break;this.state.expandedPaths.add(f),d=f,this.publish()}this.compactRequests.get(a)===c&&this.compactRequests.delete(a)}onlyDirectory(a){let b=this.state.directories.get(a);if(b?.status!=="ready"||b.truncated||1!==b.entries.length)return null;let c=b.entries[0];return"directory"===c.type?(0,j._J)(a,c.name):null}setTreeScrollTop(a){this.state.treeScrollTop=a}refreshTree(){for(let a of(this.compactRequests.clear(),this.directoryRequests.values()))a.controller.abort();this.directoryRequests.clear(),this.state.directories.clear(),this.cancelSearch(),this.state.search=l(this.searchInput()),this.publish(),this.ensureRoot().then(()=>{if(!this.disposed){for(let a of this.state.expandedPaths)this.ensureDirectory(a);this.state.searchOpen&&this.state.search.query.trim()&&(this.cancelSearch(),this.state.search={...this.state.search,status:"loading"},this.search(this.state.search.query))}})}setSearchQuery(a){this.disposed||this.state.search.query===a||(this.cancelSearch(),this.state.search=l({...this.searchInput(),query:a}),this.publish())}setSearchOptions(a){if(this.disposed)return;let b=this.searchInput(),c={...b,...a};(c.scope!==b.scope||c.caseSensitive!==b.caseSensitive||c.wholeWord!==b.wholeWord||c.regex!==b.regex)&&(this.cancelSearch(),this.state.search=l(c),this.publish(),this.state.searchOpen&&this.search(c.query))}searchInput(){let{query:a,scope:b,caseSensitive:c,wholeWord:d,regex:e}=this.state.search;return{query:a,scope:b,caseSensitive:c,wholeWord:d,regex:e}}async search(a){if(this.disposed||!a.trim()||this.state.search.query!==a||"ready"===this.state.search.status||this.searchRequest)return;let b=new AbortController;this.searchRequest=b;let c=this.searchInput();this.state.search=l(c),this.publish();try{let a=await this.reader.search(c,b.signal);if(this.searchRequest!==b)return;this.state.search={...c,status:"ready",...a,error:null}}catch(a){if(this.searchRequest!==b)return;this.state.search={...l(c),status:"error",error:n(a)}}this.searchRequest===b&&(this.searchRequest=null,this.publish())}openFile(a,b){var c;let d,e;if(this.disposed)return;let f=(c=this.cwd,d=a.replaceAll("\\","/"),e=`${c.replaceAll("\\","/").replace(/\/+$/,"")}/`,(/^[a-z]:\//i.test(e)||e.startsWith("//")?d.toLowerCase().startsWith(e.toLowerCase()):d.startsWith(e))?d.slice(e.length):d),g=/^[a-z]:[\\/]/i.test(this.cwd)||this.cwd.startsWith("\\\\")?this.state.tabs.find(a=>a.toLowerCase()===f.toLowerCase())??f:f;if(!this.state.tabs.includes(g)){if(this.options.maxTabs&&this.state.tabs.length>=this.options.maxTabs)return void this.options.onNotice?.(m("maxOpenFiles",{count:this.options.maxTabs}));this.state.tabs.push(g)}this.clearDiff(),this.state.documents.has(g)||this.state.documents.set(g,{status:"unloaded"}),this.state.activePath=g,this.navigation=void 0===b?null:{line:b};let h=this.state.documents.get(g);void 0!==b&&h?.status==="text"&&(h.viewMode="source"),this.ensureDocument(g,void 0!==b),this.publish()}closeTabs(a,b){let c=this.state,d=[...c.tabs,...c.activeDiff?[null]:[]],e=d.indexOf(a);if(e<0&&"all"!==b)return;let f=new Set(d.filter((c,d)=>"all"===b||("current"===b?c===a:"others"===b?c!==a:"left"===b?d<e:d>e)));if(!f.size)return;let g=c.activeDiff?null:c.activePath;for(let a of f){if(null===a){this.clearDiff();continue}this.documentRequests.get(a)?.abort(),this.documentRequests.delete(a),this.releaseDocument(c.documents.get(a)),c.documents.delete(a),this.restoredEditorStates.delete(a),this.restoredFileViewModes.delete(a),this.restoredPreviewScrollTops.delete(a),this.closeMissing.delete(a),this.restoredTabs.delete(a)}if(c.tabs=c.tabs.filter(a=>!f.has(a)),c.activePath&&f.has(c.activePath)){this.navigation=null;let a=d.indexOf(c.activePath);c.activePath=d.slice(a+1).find(a=>null!==a&&!f.has(a))??d.slice(0,a).reverse().find(a=>null!==a&&!f.has(a))??null}this.publish(),!c.activeDiff&&c.activePath&&g!==c.activePath&&this.ensureDocument(c.activePath)}reloadFile(a){if(this.state.tabs.includes(a)){if(this.state.activePath===a&&this.navigation)return void this.ensureDocument(a,!0);this.invalidateDocument(a),this.publish(),this.ensureDocument(a)}}async ensureDocument(a,b=!1){if(this.disposed||!this.state.tabs.includes(a)||this.documentRequests.has(a))return;let c=this.state.documents.get(a);if(!b&&c&&["loading","text","image"].includes(c.status))return;let d=new AbortController;this.documentRequests.set(a,d),c?.status!=="text"&&this.state.documents.set(a,{status:"loading"}),this.publish();try{let b=await this.reader.get(a,this.options.imagePreviewMode(),d.signal);if(this.documentRequests.get(a)!==d)return;this.documentRequests.delete(a),this.closeMissing.delete(a),this.restoredTabs.delete(a),(c?.status!=="text"||"text"!==b.kind||c.content!==b.content||c.size!==b.size)&&this.state.documents.set(a,"text"===b.kind?{status:"text",content:b.content,size:b.size,editorState:c?.status==="text"?c.editorState:this.restoredEditorStates.get(a)??null,viewMode:this.state.activePath===a&&this.navigation?"source":c?.status==="text"?c.viewMode:this.restoredFileViewModes.get(a)??("markdown"===(0,i.g)(a)||this.options.htmlPreview&&"html"===(0,i.g)(a)?"preview":"source"),previewScrollTop:c?.status==="text"?c.previewScrollTop:this.restoredPreviewScrollTops.get(a)??0}:{status:"image",mimeType:b.mimeType,size:b.size,objectUrl:URL.createObjectURL((0,f.E)(b))}),this.state.activePath===a&&"text"!==b.kind&&(this.navigation=null),this.releaseDocument(c)}catch(f){if(this.documentRequests.get(a)!==d)return;this.documentRequests.delete(a);let b=this.restoredTabs.delete(a),e=this.closeMissing.delete(a);if((b||e)&&f instanceof h.aw&&404===f.status&&"errors:fileMissing"===f.errorKey){this.closeTabs(a,"current"),e&&this.options.onNotice?.(m("branchFileClosed",{path:a}));return}console.warn("[Pi Desk][ProjectFile] 读取文件失败",{cwd:this.cwd,path:a,error:n(f)}),this.state.documents.set(a,{status:"error",error:n(f)}),this.releaseDocument(c),this.state.activePath===a&&(this.navigation=null)}this.publish()}async compareFile(a,b,c){let d=this.state.documents.get(a);if(this.disposed||c.aborted||d?.status!=="text")return;if(!b){d.comparison&&(delete d.comparison,this.publish());return}let e={status:"loading"};d.comparison=e,this.publish();let f=()=>!this.disposed&&!c.aborted&&this.state.documents.get(a)===d&&d.comparison===e;try{let a=await this.reader.diff(b.repositoryRoot,b.path,c);if(!f())return;"text"===a.kind?(d.content=a.modified.content,d.size=new TextEncoder().encode(a.modified.content).length,d.comparison={status:"ready",repositoryRoot:b.repositoryRoot,path:b.path,original:a.original}):d.comparison={status:"unavailable"}}catch(b){if(!f())return;console.warn("[Pi Desk][ProjectFile] 读取行变更失败",{cwd:this.cwd,path:a,error:n(b)}),d.comparison={status:"error",error:n(b)}}this.publish()}openFileDiff(a,b){let c=this.state.documents.get(a);if(this.disposed||c?.status!=="text"||c.comparison?.status!=="ready")return;let d=c.comparison;this.clearDiff(),this.state.activeDiff={status:"text",repositoryRoot:d.repositoryRoot,path:d.path,original:d.original,modified:{path:d.path,content:c.content},initialLine:b},this.publish()}openDiff(a,b,c,d){this.disposed||(this.clearDiff(),this.state.activeDiff={status:"loading",repositoryRoot:a,path:b,comparison:c,label:d},this.publish(),this.ensureDiff())}closeDiff(){this.closeTabs(null,"current")}reloadDiff(){let a=this.state.activeDiff;a&&(this.clearDiff(),this.state.activeDiff={...a,status:"loading"},this.publish(),this.ensureDiff())}saveDiffState(a,b){this.state.activeDiff===a&&(a.editorState=b)}setDiffViewMode(a){this.state.activeDiff&&(0,g.ZQ)({diffViewMode:a})}setDiffWrapLines(a){this.state.activeDiff&&(0,g.ZQ)({wrapLines:a})}setDiffCollapseUnchanged(a){this.state.activeDiff&&(0,g.ZQ)({collapseUnchanged:a})}handleGitBranchChanged(a){for(let b of(this.refreshTree(),this.state.tabs))(!a||b===a||b.startsWith(`${a}/`))&&(this.invalidateDocument(b),this.closeMissing.add(b));this.state.activeDiff?.repositoryRoot===a?this.reloadDiff():this.publish(),!this.state.activeDiff&&this.state.activePath&&this.ensureDocument(this.state.activePath)}saveEditorState(a,b){let c=this.state.documents.get(a);c?.status==="text"&&(c.editorState=b)}savePreviewScrollTop(a,b){let c=this.state.documents.get(a);c?.status==="text"&&(c.previewScrollTop=b)}setWrapLines(a,b){this.state.documents.get(a)?.status==="text"&&(0,g.ZQ)({wrapLines:b})}setTextViewMode(a,b){let c=this.state.documents.get(a);c?.status==="text"&&c.viewMode!==b&&(c.viewMode=b,this.publish())}dispose(){for(let a of(this.disposed=!0,this.compactRequests.clear(),this.directoryRequests.values()))a.controller.abort();for(let a of(this.directoryRequests.clear(),this.documentRequests.values()))a.abort();for(let a of(this.documentRequests.clear(),this.cancelSearch(),this.clearDiff(),this.state.documents.values()))this.releaseDocument(a);this.state.documents.clear(),this.restoredPreviewScrollTops.clear(),this.listeners.clear()}async ensureDiff(){let a=this.state.activeDiff;if(this.disposed||a?.status!=="loading"||this.diffRequest)return;let b=new AbortController;this.diffRequest=b;try{let c=await this.reader.diff(a.repositoryRoot,a.path,b.signal,a.comparison);if(this.diffRequest!==b)return;this.state.activeDiff="text"===c.kind?{...a,status:"text",original:c.original,modified:c.modified}:"metadata"===c.kind?{...a,status:"metadata",originalMetadata:c.original,modifiedMetadata:c.modified}:{...a,status:c.kind,error:null}}catch(c){if(this.diffRequest!==b)return;this.state.activeDiff={...a,status:"error",error:n(c)}}this.diffRequest===b&&(this.diffRequest=null,this.publish())}clearDiff(){this.navigation=null,this.diffRequest?.abort(),this.diffRequest=null,this.state.activeDiff=null}cancelSearch(){this.searchRequest?.abort(),this.searchRequest=null}invalidateDocument(a){this.state.activePath===a&&(this.navigation=null),this.documentRequests.get(a)?.abort(),this.documentRequests.delete(a);let b=this.state.documents.get(a);b?.status==="text"&&(b.editorState&&this.restoredEditorStates.set(a,b.editorState),this.restoredFileViewModes.set(a,b.viewMode),this.restoredPreviewScrollTops.set(a,b.previewScrollTop)),this.releaseDocument(b),this.state.documents.set(a,{status:"unloaded"})}releaseDocument(a){a?.status==="image"&&URL.revokeObjectURL(a.objectUrl)}publish(){if(!this.disposed)for(let a of(this.revision+=1,this.listeners))a()}}},93306:(a,b,c)=>{"use strict";c.d(b,{x:()=>e});var d=c(97563);function e(a){return(0,d.h3)(a)}},95186:(a,b,c)=>{"use strict";c.d(b,{QL:()=>g,Y4:()=>h,aw:()=>f});var d=c(21850),e=c(17983);class f extends Error{constructor(a,b,c,d=null){super(c),this.status=a,this.code=b,this.errorKey=d,this.name="L3ProjectRequestError"}}async function g(a,b,c,e){let g=await fetch(b.path,{method:"POST",headers:{"Content-Type":"application/json","X-Pi-Desk-Client-Id":a},body:JSON.stringify(b.request.parse(c)),signal:e}),h=await g.json();if(!g.ok||0!==h.code||null===h.data)throw new f(g.status,h.code,h.msg?(0,d.B)(h):"项目读取失败",h.i18n?.key??null);return b.response.parse(h.data)}function h(a,b,c){async function d(b,d,e){try{return await g(a,b,d,e)}catch(a){throw!e?.aborted&&a instanceof f&&401===a.status&&c?.(),a}}return{list:(a,c)=>d(e.Xe,{...b,path:a},c),search:(a,c)=>d(e.fg,{...b,...a},c),get:(a,c,f)=>d(e.ZI,{...b,path:a,imagePreviewMode:c},f),snapshot:(a,c)=>d(e.p0,{...b,refresh:c},a),branches:(a,c)=>d(e.ry,{...b,repositoryRoot:a},c),log:(a,c,f)=>d(e.p3,{...b,repositoryRoot:a,...c},f),changes:(a,c,f)=>d(e.ys,{...b,repositoryRoot:a,...c},f),diff:(a,c,f,g)=>d(e.OC,{...b,repositoryRoot:a,path:c,comparison:g},f)}}},95198:(a,b,c)=>{"use strict";c.d(b,{q:()=>ap});var d=c(52834),e=c(57850),f=c(35385),g=c(46505),h=c(34911),i=c(38721),j=c(22207),k=c(79918),l=c(39620),m=c(9665),n=c(97586),o=c(84912),p=c(37096),q=c(5319),r=c(45741),s=c(32772),t=c(9913),u=c(87366),v=c(49147),w=c(15620),x=c(91816),y=c(60819),z=c(49057);let A=[{scope:"current",label:"closeTab"},{scope:"others",label:"closeOtherTabs"},{scope:"right",label:"closeRightTabs"},{scope:"left",label:"closeLeftTabs"},{scope:"all",label:"closeAllTabs"}];function B(a,b){let c=a.replaceAll("\\","/").split("/"),d=c.at(-1)??a;return b.some(b=>b!==a&&b.split("/").at(-1)===d)&&c.length>1?c.slice(-2).join("/"):d}function C({cwd:a,gitRuntime:b,paths:c,activePath:f,diffPath:g,mobile:h,actions:i,onActivate:j,onClose:k}){let{t:l}=(0,e.Bd)("projectFiles");(0,v.useSyncExternalStore)(b.subscribe,b.getRevision,b.getRevision);let m=b.getWorkspace(a)?.snapshot,o=(0,v.useRef)(null),p=(0,v.useRef)(!1),[r,D]=(0,v.useState)(!1),[E,F]=(0,v.useState)(!1),[G,H]=(0,v.useState)([]),I=void 0!==i,J=I&&!h?32:36,K=c.map(a=>({path:a,label:B(a,c),title:a}));g&&K.push({path:null,label:`${B(g,c)} \xb7 Diff`,title:g});let L=g?null:f;return 0===K.length?null:(0,d.jsxs)("div",{className:(0,w.cn)("shrink-0 bg-muted",I?"flex flex-wrap items-start":"border-b"),"data-testid":"file-tabs",children:[(0,d.jsx)("div",{className:(0,w.cn)("overflow-hidden",I&&"min-w-0 flex-[1_1_12rem]"),style:{maxHeight:r?void 0:(h?2:3)*J},children:(0,d.jsx)("div",{ref:o,role:"tablist","aria-label":l("openFiles"),className:"relative flex flex-wrap content-start items-start",children:K.map((b,c)=>{let e=!r&&G.includes(c),f=b.path===L,g=b.path&&m?.status==="ready"?(0,z.lN)(a,b.path,m.repositories)?.change:void 0,i=null===b.path?l("closeDiff",{name:b.title.split("/").at(-1)}):l("closeFile",{name:b.title.split("/").at(-1)});return(0,d.jsxs)(x.tz,{onOpenChange:(a,b)=>{a&&"pointerType"in b.event&&"touch"===b.event.pointerType&&(p.current=!0)},children:[(0,d.jsxs)(x.Rc,{render:(0,d.jsx)("div",{"data-file-tab":!0,"data-testid":null===b.path?`file-diff-tab-${b.title}`:`file-tab-${b.path}`,"aria-hidden":e||void 0,inert:e||void 0,title:b.title,className:(0,w.cn)("flex max-w-full items-center text-sm",I?h?"h-9":"h-8":"h-9 border-r border-b",h?"w-[min(50%,12rem)]":"max-w-60",e&&"invisible",f?"bg-background text-foreground shadow-[inset_0_-2px_0_var(--primary)]":"text-muted-foreground"),onPointerDown:a=>{"touch"===a.pointerType&&(p.current=!1)}}),children:[(0,d.jsxs)("button",{type:"button",role:"tab","aria-selected":f,className:"flex h-full min-w-0 flex-1 cursor-pointer items-center gap-2 pl-3 pr-1 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",onClick:()=>{if(p.current){p.current=!1;return}null!==b.path&&j(b.path)},onKeyDown:a=>{if("F10"===a.key&&a.shiftKey){a.preventDefault(),a.stopPropagation();let b=a.currentTarget.closest('[data-slot="context-menu-trigger"]');if(b){let a=b.getBoundingClientRect();b.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:a.left+a.width/2,clientY:a.top+a.height/2}))}return}let b="ArrowRight"===a.key||"ArrowDown"===a.key?1:"ArrowLeft"===a.key||"ArrowUp"===a.key?-1:0;if(!b)return;a.preventDefault();let d=(c+b+K.length)%K.length;D(!0);let e=o.current?.querySelectorAll('[role="tab"]');e?.[d]?.focus({preventScroll:!0})},children:[(0,d.jsx)(n.A,{className:"size-3.5 shrink-0"}),(0,d.jsx)("span",{className:(0,w.cn)("truncate",g&&(0,z.iH)(g)),children:b.label}),g?(0,d.jsx)("span",{className:(0,w.cn)("shrink-0 text-xs",(0,z.iH)(g)),"aria-label":l("gitStatus",{status:(0,z.XB)(g)}),children:(0,z.XB)(g)}):null]}),(0,d.jsx)(q.$,{variant:"ghost",size:"icon","data-testid":null===b.path?`file-diff-tab-close-${b.title}`:`file-tab-close-${b.path}`,"aria-label":i,onClick:a=>{if(a.stopPropagation(),p.current){p.current=!1;return}k(b.path,"current")},children:(0,d.jsx)(s.A,{className:"size-3.5"})})]}),(0,d.jsx)(y.D,{children:A.map(({scope:a,label:e})=>(0,d.jsxs)("span",{children:["all"===a?(0,d.jsx)(x.K5,{}):null,(0,d.jsx)(x.kt,{disabled:"others"===a?K.length<=1:"left"===a?0===c:"right"===a&&c===K.length-1,onClick:()=>{p.current=!1,k(b.path,a)},children:l(e)})]},a))})]},b.path??"diff")})})}),I&&i?(0,d.jsx)("div",{className:"ml-auto flex min-h-8 max-w-full flex-wrap items-center justify-end gap-1 px-1",role:"group","aria-label":l("fileActions"),children:i}):null,E?(0,d.jsxs)(q.$,{variant:"ghost",className:"w-full rounded-none text-muted-foreground","aria-expanded":r,onClick:()=>D(a=>!a),children:[r?(0,d.jsx)(t.A,{className:"size-3.5"}):(0,d.jsx)(u.A,{className:"size-3.5"}),r?l("collapseTabs"):l("expandTabs",{count:K.length})]}):null]})}var D=c(17747),E=c(31748),F=c(51314),G=c(30340),H=c(29837),I=c(41568),J=c(79904),K=c(50599),L=c(90814),M=c(93306),N=c(87348);c(82386),c(51972);var O=c(96478);let P=(0,v.forwardRef)(function({original:a,modified:b,viewMode:c,onEscape:f,savedState:g,onSaveState:h,initialLine:i},j){let{t:k}=(0,e.Bd)("common"),{wrapLines:l,collapseUnchanged:m}=(0,O.TX)(),n=(0,v.useRef)(null),o=(0,v.useRef)(null);(0,v.useRef)({viewMode:c,wrapLines:l,collapseUnchanged:m}),(0,v.useRef)(f),(0,v.useRef)(g),(0,v.useRef)(h),(0,v.useRef)(i);let[p,q]=(0,v.useState)("loading"),[r,s]=(0,v.useState)(null);return(0,v.useImperativeHandle)(j,()=>({previousChange(){o.current?.goToDiff("previous")},nextChange(){o.current?.goToDiff("next")},focus(){o.current?.getModifiedEditor().focus()}}),[]),(0,d.jsxs)("div",{"data-testid":"code-diff",className:"relative flex h-full min-h-0 w-full flex-col overflow-hidden bg-background",children:[(0,d.jsx)("div",{ref:n,className:"min-h-0 flex-1"}),(0,d.jsx)("div",{role:"status","aria-label":k("diffStatus"),className:"flex min-h-6 shrink-0 items-center justify-end border-t px-3 text-xs text-muted-foreground",children:null===r?k("diffCalculating"):k("diffCount",{count:r})}),"loading"===p?(0,d.jsxs)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center gap-2 bg-background text-sm text-muted-foreground",children:[(0,d.jsx)(L.A,{className:"size-4 animate-spin"})," ",k("diffLoading")]}):null,"error"===p?(0,d.jsx)("div",{className:"absolute inset-0 flex items-center justify-center p-6 text-center text-sm text-destructive",children:k("diffFailed")}):null]})});var Q=c(85544),R=c(2719),S=c(59582);function T({label:a,onClick:b,active:c=!1,children:e}){return(0,d.jsxs)(S.m_,{children:[(0,d.jsx)(S.k$,{render:(0,d.jsx)(q.$,{type:"button",size:"icon-sm",variant:"ghost","aria-label":a,"aria-pressed":c||void 0,onPointerDown:a=>a.preventDefault(),onClick:b}),children:e}),(0,d.jsx)(S.ZI,{children:a})]})}var U=c(45694),V=c(45427),W=c(55091);function X({ref:a,runtime:b,gitRuntime:c,compact:f,visible:g=!0,refreshOnFocus:h=!0,onEscape:i,onSwitchPane:j,renderHeader:k}){let{t:m}=(0,e.Bd)("projectFiles"),{wrapLines:p,diffViewMode:r,collapseUnchanged:s}=(0,O.TX)();(0,v.useSyncExternalStore)(b.subscribe,b.getRevision,b.getRevision);let{activeDiff:t,activePath:u}=b.state,w=!t&&u?b.state.documents.get(u):null,x=u?(0,W.g)(u):null,y=w?.status==="text"&&(!x||"source"===w.viewMode),A=(0,v.useRef)(null),B=(0,v.useRef)(null),C=(0,v.useRef)(null),L=(0,v.useRef)(null),S=(0,R.G)();(0,v.useImperativeHandle)(a,()=>({focus(){y?B.current?.focus():t?C.current?.focus():A.current?.querySelector('[data-testid="markdown-preview"]')?.focus()}}),[t,y]);let Z=()=>{u&&B.current&&b.saveEditorState(u,B.current.getViewState())},{refresh:$,unavailable:_}=function(a,b,c,d=!0){(0,v.useSyncExternalStore)(b.subscribe,b.getRevision,b.getRevision);let e=b.getWorkspace(a.cwd)?.snapshot,f=a.state.activePath,g=!!a.state.activeDiff;f&&a.state.documents.get(f);let h=(0,v.useRef)(c),i=(0,v.useCallback)(()=>{f&&!g&&(h.current(),a.reloadFile(f),b.refreshSnapshot(a.cwd))},[g,b,f,a]),j=f&&e?.status==="ready"?(0,z.lN)(a.cwd,f,e.repositories):null;return{refresh:i,unavailable:e?.status==="error"||j?.repository.state==="unavailable"}}(b,c,Z,h),aa=w?.status==="text"?w.comparison:void 0,[ab,ac]=(0,v.useState)(null),ad=aa?.status==="ready"&&w?.status==="text"&&ab?.original===aa.original.content&&ab.modified===w.content?ab.count:void 0,ae=a=>{u&&(Z(),b.openFileDiff(u,a))},af=_||aa?.status==="error"?m("gitMarkersFailed"):aa?.status==="unavailable"||aa?.status==="ready"&&null===ad?m("gitMarkersUnavailable"):aa?.status==="loading"||aa?.status==="ready"&&void 0===ad?m("gitMarkersLoading"):aa?.status==="ready"?m("gitChangesCount",{count:ad}):null,ag=t||u?(0,d.jsx)(d.Fragment,{children:t?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{className:"mr-auto shrink-0 px-1 text-xs text-muted-foreground",children:[t.label??m("headToWorking"),"text"===t.status&&t.original.content===t.modified.content?m("noDiffChanges"):""]}),(0,d.jsx)(T,{label:m("previousChange"),onClick:()=>C.current?.previousChange(),children:(0,d.jsx)(D.A,{className:"size-4"})}),(0,d.jsx)(T,{label:m("nextChange"),onClick:()=>C.current?.nextChange(),children:(0,d.jsx)(E.A,{className:"size-4"})}),f?null:(0,d.jsx)(T,{label:"side-by-side"===r?m("inlineDiff"):m("sideBySideDiff"),active:"inline"===r,onClick:()=>b.setDiffViewMode("side-by-side"===r?"inline":"side-by-side"),children:(0,d.jsx)(o.A,{className:"size-4"})}),(0,d.jsx)(T,{label:m(p?"wrapOff":"wrapOn"),active:p,onClick:()=>b.setDiffWrapLines(!p),children:(0,d.jsx)(F.A,{className:"size-4"})}),(0,d.jsx)(T,{label:m(s?"expandUnchanged":"collapseUnchanged"),active:s,onClick:()=>b.setDiffCollapseUnchanged(!s),children:(0,d.jsx)(G.A,{className:"size-4"})}),(0,d.jsx)(T,{label:m("reloadDiff"),onClick:()=>b.reloadDiff(),children:(0,d.jsx)(l.A,{className:"size-4"})})]}):(0,d.jsxs)(d.Fragment,{children:[x&&w?.status==="text"&&u?(0,d.jsx)("div",{className:"mr-auto flex shrink-0",role:"group","aria-label":m("markdown"===x?"markdownMode":"htmlMode"),children:["preview","source"].map(a=>(0,d.jsx)(q.$,{variant:w.viewMode===a?"secondary":"ghost",size:"sm","aria-pressed":w.viewMode===a,onClick:()=>{Z(),b.setTextViewMode(u,a)},children:m("preview"===a?"previewMode":"sourceMode")},a))}):null,y&&af?(0,d.jsx)("span",{"data-testid":"file-git-status",role:"status",className:"mr-auto min-w-0 truncate text-xs text-muted-foreground",title:aa?.status==="error"?aa.error:af,children:f&&aa?.status==="ready"&&"number"==typeof ad?m("gitChangesCompact",{count:ad}):af}):null,y&&aa?.status==="ready"?(0,d.jsxs)(d.Fragment,{children:["number"==typeof ad&&ad>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(T,{label:m("previousChange"),onClick:()=>B.current?.previousChange(),children:(0,d.jsx)(D.A,{className:"size-4"})}),(0,d.jsx)(T,{label:m("nextChange"),onClick:()=>B.current?.nextChange(),children:(0,d.jsx)(E.A,{className:"size-4"})})]}):null,(0,d.jsx)(T,{label:m("viewDiff"),onClick:()=>ae(),children:(0,d.jsx)(H.A,{className:"size-4"})})]}):null,y&&u?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(T,{label:m("findInFile"),onClick:()=>B.current?.openSearch(),children:(0,d.jsx)(I.A,{className:"size-4"})}),f?null:(0,d.jsx)(T,{label:m("goToLine"),onClick:()=>B.current?.gotoLine(),children:(0,d.jsx)(J.A,{className:"size-4"})}),(0,d.jsx)(T,{label:m(p?"wrapOff":"wrapOn"),active:p,onClick:()=>b.setWrapLines(u,!p),children:(0,d.jsx)(F.A,{className:"size-4"})}),(0,d.jsx)(T,{label:m("copySelectionOrAll"),onClick:()=>{if(w?.status!=="text")return;let a=B.current?.getSelectionText()??"";(0,M.x)(a||w.content).then(b=>{b?S.success(m(a?"selectedCodeCopied":"allCodeCopied")):S.error(m("copyContentFailed"))})},children:(0,d.jsx)(K.A,{className:"size-4"})})]}):null,u?(0,d.jsx)(T,{label:m("reloadCurrentFile"),onClick:$,children:(0,d.jsx)(l.A,{className:"size-4"})}):null]})}):null;return(0,d.jsxs)("div",{ref:A,className:"flex size-full min-h-0 min-w-0 flex-col outline-none",tabIndex:-1,onFocus:a=>{a.target===a.currentTarget&&(y?B.current?.focus():t?C.current?.focus():A.current?.querySelector('[data-testid="markdown-preview"]')?.focus())},children:[k?k(ag):ag?(0,d.jsx)("div",{className:"flex min-h-9 shrink-0 flex-wrap items-center justify-end gap-2 border-b px-3 py-1","aria-label":m("fileActions"),children:ag}):null,(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden pb-[env(safe-area-inset-bottom)]",children:t?"text"===t.status?(0,d.jsx)(P,{ref:C,original:t.original,modified:t.modified,viewMode:f?"inline":r,savedState:t.editorState,initialLine:t.initialLine,onSaveState:a=>b.saveDiffState(t,a),onEscape:i},`${t.repositoryRoot}:${t.path}`):"metadata"===t.status?(0,d.jsxs)("div",{className:"grid h-full grid-cols-1 gap-4 overflow-auto p-4 md:grid-cols-2",children:[(0,d.jsx)("pre",{className:"whitespace-pre-wrap break-all text-sm",children:t.originalMetadata}),(0,d.jsx)("pre",{className:"whitespace-pre-wrap break-all text-sm",children:t.modifiedMetadata})]}):"loading"===t.status?(0,d.jsx)(Y,{}):(0,d.jsxs)("div",{className:"flex size-full flex-col items-center justify-center gap-3 p-6 text-center text-sm",children:[(0,d.jsx)("p",{className:"text-muted-foreground",children:"binary"===t.status?m("binaryDiffUnavailable"):"too_large"===t.status?m("largeDiffUnavailable"):t.error}),"error"===t.status?(0,d.jsx)(q.$,{variant:"outline",onClick:()=>b.reloadDiff(),children:m("readAgain")}):null]}):u&&w?"loading"===w.status||"unloaded"===w.status?(0,d.jsx)(Y,{}):"error"===w.status?(0,d.jsxs)("div",{className:"flex size-full flex-col items-center justify-center gap-3 p-6 text-center",children:[(0,d.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:w.error}),(0,d.jsx)(q.$,{variant:"outline",onClick:()=>b.reloadFile(u),children:m("readAgain")})]}):"image"===w.status?(0,d.jsx)(Q.k,{mode:"inline",slides:[{src:w.objectUrl,alt:u}],ariaLabel:m("imageViewer",{name:u.replaceAll("\\","/").split("/").at(-1)??u})},w.objectUrl):"markdown"===x&&"preview"===w.viewMode?(0,d.jsx)(V.n,{content:w.content,label:m("markdownPreview",{name:u}),savedScrollTop:w.previewScrollTop,onScroll:a=>b.savePreviewScrollTop(u,a)},u):"html"===x&&"preview"===w.viewMode?(0,d.jsx)("iframe",{ref:L,className:"block size-full border-0 bg-white",sandbox:"allow-scripts",srcDoc:(0,U.z)(w.content),title:m("htmlPreview",{name:u})}):(0,d.jsx)(N.e,{ref:B,path:u,content:w.content,size:w.size,originalContent:aa?.status==="ready"?aa.original.content:void 0,onChanges:a=>{aa?.status==="ready"&&ac({original:aa.original.content,modified:w.content,count:a})},onOpenDiff:ae,savedState:w.editorState,navigation:b.pendingNavigation,onNavigation:(a,c)=>b.consumeNavigation(a,c),onSaveState:(a,c)=>b.saveEditorState(a,c),onEscape:i},u):(0,d.jsxs)("div",{"data-testid":"file-workspace-empty",className:"flex size-full flex-col items-center justify-center gap-3 p-6 text-sm text-muted-foreground",children:[(0,d.jsx)(n.A,{className:"size-6"}),m("noOpenFile")]})})]})}function Y(){let{t:a}=(0,e.Bd)("projectFiles");return(0,d.jsxs)("div",{className:"flex size-full items-center justify-center gap-2 text-sm text-muted-foreground",children:[(0,d.jsx)(L.A,{className:"size-4 animate-spin"}),a("loadingFile")]})}var Z=c(68341),$=c(1222),_=c(79739),aa=c(53403),ab=c(4998),ac=c(5701),ad=c(11071),ae=c(82589);function af({items:a,label:b,scrollTop:c,onScroll:e,render:f,role:g="listbox",onKeyDown:h}){let i=(0,v.useRef)(null),[j,k]=(0,v.useState)({top:c,height:300}),l=Math.max(0,Math.floor(j.top/36)-8),m=Math.min(a.length,Math.ceil((j.top+j.height)/36)+8);return(0,d.jsx)("div",{ref:i,role:g,tabIndex:"tree"===g?0:void 0,onKeyDown:h,"aria-label":b,className:"min-h-0 flex-1 overflow-auto overscroll-contain",onScroll:a=>{let b=a.currentTarget.scrollTop;k(a=>({...a,top:b})),e(b)},children:(0,d.jsx)("div",{style:{height:36*a.length,position:"relative"},children:(0,d.jsx)("div",{style:{position:"absolute",top:36*l,left:0,right:0},children:a.slice(l,m).map((a,b)=>f(a,l+b))})})})}var ag=c(37496),ah=c(9365),ai=c(75152),aj=c(51108),ak=c(83731);let al={added:"A",modified:"M",deleted:"D",renamed:"R","type-changed":"T"};function am({cwd:a,repositoryRoot:b,rows:c,changes:f,selectedPath:g,scrollTop:h,onScroll:i,onSelect:j,onToggle:k,onOpen:l,onReveal:m}){let{t:n}=(0,e.Bd)("projectHistory"),p=new Map(f.map(a=>[a.path,a]));return(0,d.jsx)(af,{role:"tree",label:n("changeFiles"),items:c,scrollTop:h,onScroll:i,onKeyDown:a=>{if(a.defaultPrevented||!a.currentTarget.contains(a.target))return;let b=a.target instanceof Element?a.target.closest("[data-tree-key]"):null;if(a.target instanceof Element&&a.target.closest("button"))return;let d=b?c.findIndex(a=>a.key===b.dataset.treeKey):-1,e=c[d],f=d;if("ArrowDown"===a.key)f=Math.min(c.length-1,d+1);else if("ArrowUp"===a.key)f=Math.max(0,d-1);else if("Home"===a.key)f=0;else if("End"===a.key)f=c.length-1;else if("ArrowRight"===a.key&&e?.directory)e.expanded?f=Math.min(c.length-1,d+1):k(e.directory.path);else if("ArrowLeft"===a.key&&e){if(e.expanded&&e.directory)k(e.directory.path);else for(let a=d-1;a>=0;a-=1)if(c[a].depth<e.depth){f=a;break}}else{if("Enter"!==a.key&&" "!==a.key||!e)return;e.directory?k(e.directory.path):"Enter"===a.key?l(e.path):j(e.path)}a.preventDefault();let g=c[f];if(!g)return;let h=a.currentTarget;36*f<h.scrollTop?h.scrollTop=36*f:(f+1)*36>h.scrollTop+h.clientHeight&&(h.scrollTop=(f+1)*36-h.clientHeight),requestAnimationFrame(()=>{[...h.querySelectorAll("[data-tree-key]")].find(a=>a.dataset.treeKey===g.key)?.focus()})},render:c=>{let e=p.get(c.path),f=(0,ak._J)(b,c.path),h=c.directory;return(0,d.jsx)(aj.J,{cwd:a,path:f,type:c.type,historical:!0,expanded:c.expanded,onToggle:h?()=>k(h.path):void 0,onOpen:"file"===c.type?()=>l(c.path):void 0,openLabel:n("viewDiff"),oldPath:"file"===c.type&&e?.oldPath?(0,ak._J)(b,e.oldPath):void 0,onReveal:m,trigger:(0,d.jsxs)("div",{role:"treeitem",tabIndex:0,"aria-level":c.depth+1,"aria-expanded":c.expanded,"aria-selected":"file"===c.type&&g===c.path,"data-tree-key":c.key,className:(0,w.cn)("flex h-9 min-w-0 cursor-pointer items-center gap-2 pr-2 text-sm outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","file"===c.type&&g===c.path&&"bg-accent"),style:{paddingLeft:8+16*c.depth},title:e?.oldPath&&"file"===c.type?`${(0,ak._J)(b,e.oldPath)} → ${f}`:f,onClick:a=>{h?a.detail<2&&k(h.path):j(c.path)},onDoubleClick:()=>{"file"===c.type&&l(c.path)},children:[h?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ag.A,{className:(0,w.cn)("size-4 shrink-0 text-muted-foreground",c.expanded&&"rotate-90")}),c.expanded?(0,d.jsx)(ah.A,{className:"size-4 shrink-0 text-muted-foreground"}):(0,d.jsx)(ai.A,{className:"size-4 shrink-0 text-muted-foreground"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"w-4 shrink-0"}),(0,d.jsx)("span",{className:(0,w.cn)("w-4 shrink-0 font-mono text-xs",e?.status==="added"?"text-emerald-600 dark:text-emerald-400":e?.status==="deleted"?"text-red-600 dark:text-red-400":"text-blue-600 dark:text-blue-400"),"aria-label":n("gitStatus",{status:e?al[e.status]:""}),children:e?al[e.status]:""})]}),(0,d.jsxs)("span",{className:"min-w-0 flex-1 truncate",children:[c.label,"directory"===c.type&&p.has(c.path)?"/":""]}),"file"===c.type?(0,d.jsx)(q.$,{size:"icon-sm",variant:"ghost","aria-label":n("viewDiffPath",{path:c.path}),onDoubleClick:a=>a.stopPropagation(),onClick:a=>{a.stopPropagation(),l(c.path)},children:(0,d.jsx)(o.A,{className:"size-4"})}):null]})},c.key)}})}function an(a){let{state:b,repositories:c,projectName:f,narrow:g,scroll:h}=a,{t:i}=(0,e.Bd)("projectHistory"),{locale:j,timeZone:k}=(0,ab.i)(),m=(0,v.useMemo)(()=>new Intl.DateTimeFormat("en"===j?"en-US":"zh-CN",{timeZone:k,month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),[j,k]),n=(0,v.useMemo)(()=>new Intl.DateTimeFormat("en"===j?"en-US":"zh-CN",{timeZone:k,timeZoneName:"shortOffset",year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),[j,k]),o=(0,v.useId)(),{mobilePane:r,onMobilePane:s}=a,t=b.changes.data,u=`${b.repositoryRoot}:${t?.comparison.original}:${t?.comparison.target}`,x=b.selectedChangePath,y=[{value:"HEAD",label:i("currentHead")},...(b.branches.data?.local??[]).map(a=>({value:`refs/heads/${a}`,label:a,description:i("localBranch")})),...(b.branches.data?.remote??[]).map(a=>({value:`refs/remotes/${a}`,label:a,description:i("remoteBranch")}))],z=b.branches.data?.upstream,A=t?.commit,B=c=>c?(0,d.jsxs)("div",{role:"alert",className:"flex flex-wrap items-center gap-2 p-3 text-sm text-destructive",children:[(0,d.jsx)("span",{className:"min-w-0 flex-1 break-words",children:c}),(0,d.jsx)(q.$,{size:"sm",variant:"outline",onClick:a.onRefresh,children:i("retry")}),"compare"===b.mode&&"merge-base"===b.strategy?(0,d.jsx)(q.$,{size:"sm",variant:"outline",onClick:()=>a.onStrategy("direct"),children:i("compareDirect")}):null]}):null,C=(0,d.jsxs)("div",{className:"flex size-full min-h-0 min-w-0 flex-col",children:[B(b.log.error),"loading"===b.log.status?(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground",children:[(0,d.jsx)(L.A,{className:"size-4 animate-spin"}),i("loadingCommits")]}):null,(0,d.jsx)(af,{items:b.log.data?.items??[],label:i("commitList"),scrollTop:h.log,onScroll:b=>a.onScroll("log",b),render:c=>(0,d.jsxs)("button",{type:"button",role:"option","aria-selected":b.selectedCommit===c.oid,className:(0,w.cn)("flex h-9 w-full items-center gap-3 border-b border-border/40 px-3 text-left text-sm outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",b.selectedCommit===c.oid&&"bg-accent"),onClick:()=>{var b;return b=c.oid,void(a.onCommit(b),g&&s("files"))},title:`${c.subject}
|
|
14
|
-
${c.oid}
|
|
15
|
-
${c.author} \xb7 ${n.format(c.timestampMs)}`,children:[(0,d.jsxs)("span",{className:"min-w-0 flex-1 truncate",children:[c.subject||i("noCommitMessage"),c.refs.length?(0,d.jsx)("span",{className:"ml-2 text-xs text-muted-foreground",children:c.refs.join(" \xb7 ")}):null]}),(0,d.jsx)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:c.oid.slice(0,7)}),g?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"w-20 truncate text-xs text-muted-foreground",children:c.author}),(0,d.jsx)("time",{className:"w-28 shrink-0 text-right text-xs text-muted-foreground",children:m.format(c.timestampMs)})]})]},c.oid)},`${b.repositoryRoot}:${b.mode}:${b.tip}:${b.base}:${b.target}:${b.query}:${b.author}`),"ready"!==b.log.status||b.log.data?.items.length?null:(0,d.jsx)("p",{className:"px-3 py-4 text-sm text-muted-foreground",children:b.query||b.author?i("noMatchingCommits"):i("noCommits")}),b.log.data?.truncated?(0,d.jsx)("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:i("scanLimit")}):null,(b.log.data?.items.length??0)>=2e3?(0,d.jsx)("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:i("loadedLimit")}):b.log.data?.hasMore?(0,d.jsx)(q.$,{variant:"ghost",size:"sm",disabled:"loading"===b.log.status,onClick:a.onMoreLog,children:i("loadMoreCommits")}):null]}),D=(0,d.jsxs)("div",{className:"flex size-full min-h-0 min-w-0 flex-col",children:[(0,d.jsxs)("div",{className:"flex min-h-9 shrink-0 flex-wrap items-center gap-2 border-b px-3 py-1",children:[g?(0,d.jsx)(q.$,{variant:"ghost",size:"icon-sm","aria-label":i("backCommits"),onClick:()=>s("log"),children:(0,d.jsx)(_.A,{className:"size-4"})}):null,(0,d.jsx)("span",{className:"text-sm font-medium",children:b.selectedCommit?i("commitChanges"):i("cumulativeChanges")}),t?(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:i("loadedFiles",{count:t.items.length})}):null,"compare"===b.mode&&b.selectedCommit?(0,d.jsx)(q.$,{variant:"ghost",size:"sm",onClick:a.onAggregate,children:i("backCumulative")}):null]}),B(b.changes.error),"loading"===b.changes.status?(0,d.jsxs)("div",{className:"flex items-center gap-2 p-3 text-xs text-muted-foreground",children:[(0,d.jsx)(L.A,{className:"size-4 animate-spin"}),i("loadingChanges")]}):null,(0,d.jsxs)(p.HK,{orientation:"vertical",defaultLayout:{"project-changes":a.panelSizes.changes,"project-detail":100-a.panelSizes.changes},onLayoutChanged:(b,c)=>{c.isUserInteraction&&void 0!==b["project-changes"]&&a.onPanelSize("changes",b["project-changes"])},children:[(0,d.jsx)(p.wV,{id:"project-changes",defaultSize:`${a.panelSizes.changes}%`,minSize:"80px",children:(0,d.jsxs)("div",{className:"flex size-full min-h-0 flex-col",children:[(0,d.jsx)(am,{cwd:a.cwd,repositoryRoot:b.repositoryRoot??"",rows:a.changeRows,changes:t?.items??[],selectedPath:x,scrollTop:h.changes,onScroll:b=>a.onScroll("changes",b),onSelect:a.onSelectChange,onToggle:a.onToggleDirectory,onOpen:a.onOpenFile,onReveal:a.onReveal},u),"ready"!==b.changes.status||t?.items.length?null:(0,d.jsx)("p",{className:"px-3 py-4 text-sm text-muted-foreground",children:i("noDiff")}),t?.hasMore?(0,d.jsx)(q.$,{size:"sm",variant:"ghost",disabled:"loading"===b.changes.status,onClick:a.onMoreChanges,children:i("loadMoreFiles")}):null,t?.truncated?(0,d.jsx)("p",{className:"p-3 text-xs text-muted-foreground",children:i("changesLimit")}):null]})}),(0,d.jsx)(p.WM,{}),(0,d.jsx)(p.wV,{id:"project-detail",defaultSize:`${100-a.panelSizes.changes}%`,minSize:"60px",children:(0,d.jsxs)(ac.V,{className:"h-full",viewportClassName:"p-3 text-sm",role:"region","aria-label":i("commitDetails"),children:[A?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("pre",{className:"mb-3 whitespace-pre-wrap break-words font-sans leading-relaxed",children:A.message}),(0,d.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,d.jsx)("span",{className:"min-w-0 flex-1 break-all font-mono text-xs",children:A.oid}),(0,d.jsx)(q.$,{size:"icon-sm",variant:"ghost","aria-label":i("copySha"),onClick:()=>a.onCopy(A.oid),children:(0,d.jsx)(K.A,{className:"size-4"})})]}),(0,d.jsxs)("p",{className:"mb-3 text-xs text-muted-foreground",children:[A.author," \xb7 ",n.format(A.timestampMs)]}),A.parents.length>1?(0,d.jsx)(ae.b,{className:"mb-3",ariaLabel:i("compareParent"),value:A.selectedParent??"",options:A.parents.map((a,b)=>({value:a,label:i("parentCommit",{count:b+1,oid:a.slice(0,10)})})),onChange:b=>a.onCommit(A.oid,b)}):null]}):t?(0,d.jsxs)("div",{className:"space-y-2 text-xs text-muted-foreground",children:[(0,d.jsx)("p",{children:"merge-base"===b.strategy?i("mergeBaseToTarget"):i("baseToTarget")}),(0,d.jsx)("p",{className:"break-all font-mono",children:t.comparison.original??i("emptyRevision")}),(0,d.jsx)("p",{className:"break-all font-mono",children:t.comparison.target})]}):(0,d.jsx)("p",{className:"text-muted-foreground",children:i("selectCommit")}),x?(0,d.jsx)("p",{className:"mt-3 break-all font-mono text-xs text-muted-foreground",children:x}):null]})})]})]});return(0,d.jsxs)("section",{className:"flex size-full min-h-0 min-w-0 flex-col","aria-label":i("historyAndCompare"),children:[(0,d.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b px-3 py-2",children:[(0,d.jsxs)("div",{className:"flex gap-1",role:"group","aria-label":i("viewMode"),children:[(0,d.jsx)(q.$,{size:"sm",variant:"history"===b.mode?"secondary":"ghost","aria-pressed":"history"===b.mode,onClick:()=>{a.onMode("history"),s("log")},children:i("historyMode")}),(0,d.jsx)(q.$,{size:"sm",variant:"compare"===b.mode?"secondary":"ghost","aria-pressed":"compare"===b.mode,onClick:()=>{a.onMode("compare"),s("log")},children:i("compareMode")})]}),(0,d.jsx)(ae.b,{className:"w-44",ariaLabel:i("selectRepository"),value:b.repositoryRoot??"",options:c.map(a=>({value:a.root,label:a.root||f,description:"unavailable"===a.state?(0,aa.fD)(a.message,j):void 0})),onChange:a.onRepository}),"history"===b.mode?(0,d.jsx)(ae.b,{className:"w-48",ariaLabel:i("viewBranch"),value:b.tip,options:y,onChange:b=>a.onRevision("tip",b)}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ae.b,{className:"w-44",ariaLabel:i("baseBranch"),placeholder:i("chooseBase"),value:b.base,options:y,onChange:b=>a.onRevision("base",b)}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:"→"}),(0,d.jsx)(ae.b,{className:"w-44",ariaLabel:i("targetBranch"),value:b.target,options:y,onChange:b=>a.onRevision("target",b)}),(0,d.jsx)(ae.b,{className:"w-48",ariaLabel:i("comparison"),value:b.strategy,options:[{value:"merge-base",label:i("introducedChanges")},{value:"direct",label:i("directComparison")}],onChange:b=>a.onStrategy("direct"===b?"direct":"merge-base")}),g?(0,d.jsx)(q.$,{size:"sm",variant:"outline",onClick:()=>s("files"),children:i("cumulativeChanges")}):null]}),(0,d.jsx)(ad.p,{className:"w-40 shrink-0","aria-label":i("filterAuthor"),placeholder:i("author"),list:o,value:b.author,onChange:b=>a.onAuthor(b.target.value)}),(0,d.jsx)("datalist",{id:o,children:b.authorSuggestions.map(a=>(0,d.jsx)("option",{value:a},a))}),(0,d.jsx)(ad.p,{className:"min-w-32 flex-1 basis-40","aria-label":i("searchCommits"),placeholder:i("searchCommits"),value:b.query,onChange:b=>a.onQuery(b.target.value)}),(0,d.jsx)(q.$,{size:"icon-sm",variant:"ghost","aria-label":i("refreshGit"),onClick:a.onRefresh,children:(0,d.jsx)(l.A,{className:"size-4"})})]}),b.branches.error?B(b.branches.error):null,z?(0,d.jsxs)("p",{className:"shrink-0 truncate border-b px-3 py-1 text-xs text-muted-foreground",title:z.ref,children:[z.ref.replace("refs/remotes/","")," \xb7 ",i("localRecord")," \xb7"," ",null===z.ahead||null===z.behind?i("refUnavailable"):i("aheadBehind",{ahead:z.ahead,behind:z.behind})]}):null,"compare"!==b.mode||b.base?g?"log"===r?C:D:(0,d.jsxs)(p.HK,{orientation:"horizontal",defaultLayout:{"project-log":a.panelSizes.log,"project-files":100-a.panelSizes.log},onLayoutChanged:(b,c)=>{c.isUserInteraction&&void 0!==b["project-log"]&&a.onPanelSize("log",b["project-log"])},children:[(0,d.jsx)(p.wV,{id:"project-log",defaultSize:`${a.panelSizes.log}%`,minSize:"30%",children:C}),(0,d.jsx)(p.WM,{}),(0,d.jsx)(p.wV,{id:"project-files",defaultSize:`${100-a.panelSizes.log}%`,minSize:"25%",children:D})]}):(0,d.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:i("chooseBaseBranch")})]})}let ao=()=>{};function ap({clientId:a,cwd:b,refreshOnFocus:c,title:s,actions:t,onEscape:u=ao,onUnauthorized:w}){let{t:x}=(0,e.Bd)("projectHistory"),y=(0,R.G)(),{files:z,git:A,history:B,global:D,updateGlobal:E,page:F,setPage:G,historyPane:H,setHistoryPane:I,setContainer:J,narrow:K,stacked:L,width:N,openGit:O,refresh:P}=function(a,b,c,d){let e=(0,R.G)(),[f]=(0,v.useState)($.N1),[g,h]=(0,v.useState)(f),i=(0,v.useCallback)(a=>{h(b=>({...b,...a})),(0,$.Ms)({...(0,$.N1)(),...a})},[]),[j]=(0,v.useState)(()=>(0,$.tQ)(b)),[k]=(0,v.useState)(()=>(0,Z.ph)(a,b,a=>e.show({level:"info",title:a}),j,f,{lazyHistory:!c,onUnauthorized:d})),{files:l,git:m,history:n}=k;(0,v.useSyncExternalStore)(l.subscribe,l.getRevision,l.getRevision),(0,v.useSyncExternalStore)(m.subscribe,m.getRevision,m.getRevision),(0,v.useSyncExternalStore)(n.subscribe,n.getRevision,n.getRevision);let[o,p]=(0,v.useState)(j?.page??"files"),[q,r]=(0,v.useState)(j?.historyPane??"log"),[s,t]=(0,v.useState)({width:1200,height:800}),[u,w]=(0,v.useState)(null);(0,v.useRef)(!1),(0,v.useRef)(()=>void 0);let x=s.width<900,y=x||s.height<680;m.getWorkspace(b).snapshot.repositories;let z=l.state,A=g.gitOpen&&(!y||"git"===o);return{files:l,git:m,history:n,global:g,updateGlobal:i,page:o,setPage:p,historyPane:q,setHistoryPane:r,setContainer:w,narrow:x,stacked:y,width:s.width,openGit(a){i({gitOpen:!0}),p("git"),void 0!==a&&n.setRepository(a)},refresh(){l.refreshTree(),m.refreshSnapshot(b),z.activeDiff?l.reloadDiff():z.activePath&&l.reloadFile(z.activePath),A&&n.refresh()}}}(a,b,c,w),{directoryOpen:Q,gitOpen:S,gitMaximized:T}=D,U=b.replaceAll("\\","/").split("/").filter(Boolean).at(-1)??b,V=A.getWorkspace(b),W=V.snapshot.repositories,Y=z.state,_=Y.activeDiff?[Y.activeDiff.repositoryRoot,Y.activeDiff.path].filter(Boolean).join("/"):null,aa=(0,d.jsx)(r.F,{cwd:b,projectName:U,showRootTitle:!1,runtime:z,gitRuntime:A,onOpenGitBranches:O,onFileOpened:()=>G("code")}),ab=(0,d.jsx)(X,{runtime:z,gitRuntime:A,compact:N<1100,refreshOnFocus:c,onEscape:u,renderHeader:a=>(0,d.jsx)(C,{cwd:b,gitRuntime:A,paths:Y.tabs,activePath:Y.activePath,diffPath:_,mobile:K,actions:a,onActivate:a=>z.openFile(a),onClose:(a,b)=>z.closeTabs(a,b)})}),ac=(0,d.jsxs)("div",{className:"flex size-full min-h-0 min-w-0 flex-col",children:[(0,d.jsxs)("div",{className:"flex h-9 shrink-0 items-center gap-2 border-b bg-muted px-3",children:[(0,d.jsx)(f.A,{className:"size-4"}),(0,d.jsx)("span",{className:"flex-1 text-sm font-medium",children:"Git"}),L?null:(0,d.jsx)(q.$,{size:"icon-sm",variant:"ghost","aria-label":x(T?"restoreGit":"maximizeGit"),onClick:()=>E({gitMaximized:!T}),children:T?(0,d.jsx)(g.A,{className:"size-4"}):(0,d.jsx)(h.A,{className:"size-4"})}),(0,d.jsx)(q.$,{size:"icon-sm",variant:"ghost","aria-label":x("collapseGit"),onClick:()=>{E({gitOpen:!1,gitMaximized:!1}),G("code")},children:(0,d.jsx)(i.A,{className:"size-4"})})]}),W.length?(0,d.jsx)(an,{state:B.state,cwd:b,changeRows:B.getChangeRows(),onSelectChange:a=>B.selectChange(a),onToggleDirectory:a=>B.toggleChangeDirectory(a),onReveal:(a,b)=>z.revealFile(a,b),repositories:W,projectName:U,narrow:K,mobilePane:H,onMobilePane:I,scroll:B.scroll,onScroll:(a,b)=>B.setScroll(a,b),panelSizes:{log:D.logSize,changes:D.changeSize},onPanelSize:(a,b)=>E("log"===a?{logSize:b}:{changeSize:b}),onRepository:a=>{B.setRepository(a),I("log")},onMode:a=>B.setMode(a),onRevision:(a,b)=>B.setRevision(a,b),onStrategy:a=>B.setStrategy(a),onQuery:a=>B.setQuery(a),onAuthor:a=>B.setAuthor(a),onCommit:(a,b)=>B.selectCommit(a,b),onAggregate:()=>B.showAggregate(),onMoreLog:()=>B.loadMoreLog(),onMoreChanges:()=>B.loadMoreChanges(),onOpenFile:a=>{B.openChange(a),G("code"),E({gitMaximized:!1})},onRefresh:()=>B.refresh(),onCopy:a=>{(0,M.x)(a).then(a=>{a||y.error(x("copyFailed"))})}}):(0,d.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:"loading"===V.snapshot.status||"idle"===V.snapshot.status?x("findingGit"):V.snapshot.error??x("noGit")})]}),ad=(0,d.jsxs)(p.HK,{orientation:"horizontal",defaultLayout:Q?{"project-tree":D.directorySize,"project-code":100-D.directorySize}:void 0,onLayoutChanged:(a,b)=>{b.isUserInteraction&&void 0!==a["project-tree"]&&E({directorySize:a["project-tree"]})},children:[Q?(0,d.jsx)(p.wV,{id:"project-tree",defaultSize:`${D.directorySize}%`,minSize:"180px",maxSize:"40%",children:aa}):null,Q?(0,d.jsx)(p.WM,{}):null,(0,d.jsx)(p.wV,{id:"project-code",minSize:"40%",children:ab})]},Q?"tree-visible":"tree-hidden");return(0,d.jsxs)("div",{ref:J,className:"flex size-full min-h-0 min-w-0 flex-col overflow-hidden","data-testid":"project-preview",children:[(0,d.jsxs)("header",{className:"flex min-h-9 shrink-0 items-center gap-1 bg-muted px-2 py-1 pt-[max(4px,env(safe-area-inset-top))]",children:[L?null:(0,d.jsx)(q.$,{size:"icon-sm",variant:"ghost","aria-label":x(Q?"collapseDirectory":"expandDirectory"),onClick:()=>E({directoryOpen:!Q}),children:Q?(0,d.jsx)(j.A,{className:"size-4"}):(0,d.jsx)(k.A,{className:"size-4"})}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 items-baseline gap-3",title:b,children:[(0,d.jsx)("div",{className:"min-w-0 shrink-0 max-w-[50%] max-sm:max-w-full max-sm:shrink",children:s??(0,d.jsx)("h1",{className:"truncate text-sm font-semibold",children:U})}),(0,d.jsx)("p",{className:"min-w-0 truncate text-xs text-muted-foreground max-sm:hidden",children:b})]}),(0,d.jsxs)(q.$,{size:"sm",variant:S?"secondary":"ghost","aria-pressed":S,onClick:()=>O(),children:[(0,d.jsx)(f.A,{className:"size-4"}),(0,d.jsx)("span",{className:"max-sm:hidden",children:x("gitRecords")})]}),(0,d.jsx)(q.$,{size:"icon-sm",variant:"ghost","aria-label":x("refreshPreview"),onClick:P,children:(0,d.jsx)(l.A,{className:"size-4"})}),t]}),V.snapshot.error?(0,d.jsx)("p",{role:"alert",className:"shrink-0 border-b px-3 py-2 text-sm text-destructive",children:V.snapshot.error}):null,L?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex shrink-0 gap-1 px-2 py-1",role:"group","aria-label":x("previewArea"),children:[(0,d.jsxs)(q.$,{size:"sm",variant:"files"===F?"secondary":"ghost",onClick:()=>G("files"),children:[(0,d.jsx)(m.A,{className:"size-4"}),x("files")]}),(0,d.jsxs)(q.$,{size:"sm",variant:"code"===F?"secondary":"ghost",onClick:()=>G("code"),children:[(0,d.jsx)(n.A,{className:"size-4"}),x("code")]}),(0,d.jsxs)(q.$,{size:"sm",variant:"git"===F?"secondary":"ghost",onClick:()=>O(),children:[(0,d.jsx)(o.A,{className:"size-4"}),"Git"]})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1",children:"files"===F?aa:"git"===F?ac:ab})]}):T&&S?ac:(0,d.jsxs)(p.HK,{orientation:"vertical",defaultLayout:S?{"project-main":100-D.gitSize,"project-git":D.gitSize}:void 0,onLayoutChanged:(a,b)=>{b.isUserInteraction&&void 0!==a["project-git"]&&E({gitSize:a["project-git"]})},children:[(0,d.jsx)(p.wV,{id:"project-main",defaultSize:S?`${100-D.gitSize}%`:"100%",minSize:"35%",children:ad}),S?(0,d.jsx)(p.WM,{}):null,S?(0,d.jsx)(p.wV,{id:"project-git",defaultSize:`${D.gitSize}%`,minSize:"300px",children:ac}):null]},S?"git-visible":"git-hidden")]})}},97563:(a,b,c)=>{"use strict";async function d(a){let b="u"<typeof navigator?void 0:navigator.clipboard;if(b?.writeText)try{return await b.writeText(a),!0}catch{}if("u"<typeof document||!document.body)return!1;let c=document.activeElement instanceof HTMLElement?document.activeElement:null,d=document.createElement("textarea");d.value=a,d.setAttribute("readonly",""),d.setAttribute("aria-hidden","true"),d.style.position="fixed",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.opacity="0";try{return document.body.append(d),d.select(),d.setSelectionRange(0,d.value.length),document.execCommand("copy")}catch{return!1}finally{d.remove();try{c?.focus()}catch{}}}c.d(b,{h3:()=>d,qj:()=>e});class e extends Error{constructor(a){super(a.message,{cause:a.cause}),this.name="PiDeskBrowserPluginError",this.pluginName=a.pluginName,this.contributionName=a.contributionName??null,this.phase=a.phase}}},98722:(a,b,c)=>{"use strict";c.d(b,{T8:()=>q,WW:()=>r,aD:()=>g,co:()=>m,lw:()=>s,ph:()=>p,xv:()=>k,yw:()=>n});var d=c(87883),e=c(51949),f=c(18997);let g=d.Yj().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),h=d.KC([g,d.eu("HEAD"),d.Yj().max(1024).regex(/^refs\/(?:heads|remotes)\/[^\0\r\n]+$/)]).refine(a=>!a.includes("..")&&!a.endsWith("/"),"Git 版本无效"),i=d.KC([d.Ik({commit:h,parent:g.optional()}).strict(),d.Ik({base:h,target:h,strategy:d.k5(["merge-base","direct"])}).strict()]),j=d.Ik({base:g.nullable(),target:g,original:g.nullable()}).strict(),k=d.Ik({baseCommit:g.nullable(),targetCommit:g,oldPath:e._g.optional()}).strict(),l=d.Ik({oid:g,parents:d.YO(g),subject:d.Yj(),author:d.Yj(),timestampMs:d.ai().int(),refs:d.YO(d.Yj())}).strict(),m=d.Ik({tip:h,exclude:h.optional(),query:d.Yj().trim().max(200).default(""),author:d.Yj().trim().max(200).optional(),page:d.Ik({index:d.ai().int().min(1).max(2e3),size:d.ai().int().min(1).max(100)}).strict()}).strict(),n=d.Ik({tip:g.nullable(),exclude:g.nullable(),items:d.YO(l),hasMore:d.zM(),truncated:d.zM()}).strict(),o=d.Ik({path:e._g,oldPath:e._g.nullable(),status:d.k5(["added","modified","deleted","renamed","type-changed"])}).strict(),p=d.Ik({selection:i,page:d.Ik({index:d.ai().int().min(1).max(5e4),size:d.ai().int().min(1).max(500)}).strict()}).strict(),q=d.Ik({comparison:j,commit:l.extend({message:d.Yj(),selectedParent:g.nullable()}).nullable(),items:d.YO(o),hasMore:d.zM(),truncated:d.zM()}).strict(),r=f.gf.extend({upstream:d.Ik({ref:d.Yj(),ahead:d.ai().int().nonnegative().nullable(),behind:d.ai().int().nonnegative().nullable()}).strict().nullable()}).strict(),s=d.KC([f.FJ,d.Ik({kind:d.eu("metadata"),original:d.Yj(),modified:d.Yj()}).strict()])}};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[15302],{5816:(e,t,i)=>{i.d(t,{A:()=>m,i:()=>d});var o=i(7962),r=i(44297),a=i(78121),n=i(69266),s=i(73230),l=i(48708);let c=()=>null;function d(){let e=(0,n.useSyncExternalStore)(l.re,l.fx,c);if(!e)throw Error("区域设置尚未就绪");return e}function h({children:e,locale:t,resources:i}){let[l]=(0,n.useState)(()=>{let e;return(e=(0,r.Q_)()).init({lng:t,fallbackLng:"en",resources:i,defaultNS:"common",ns:Object.keys(i.en??{}),initAsync:!1,interpolation:{escapeValue:!1}}),e});return(0,n.useEffect)(()=>(document.documentElement.lang=t,l.changeLanguage(t),(0,s.o)((e,t)=>l.exists(e)?l.t(e,t):null),()=>(0,s.o)(null)),[l,t]),(0,o.jsx)(a.xC,{i18n:l,children:e})}function m({children:e,resources:t,initialSettings:i}){let r=(0,n.useSyncExternalStore)(l.re,l.fx,c);return(0,n.useEffect)(()=>((0,l.UV)(i),(0,l.Hc)()),[i]),r?(0,o.jsx)(h,{locale:r.locale,resources:t,children:e}):null}},15710:(e,t,i)=>{i.d(t,{J:()=>a,a:()=>r});var o=i(38979);let r=o.Ik({locale:o.k5(["zh-CN","en"]),timeZone:o.Yj().trim().min(1).max(100).refine(e=>{try{return new Intl.DateTimeFormat("en",{timeZone:e}),!0}catch{return!1}},"无效的 IANA 时区")}).strict().readonly(),a=o.Ik({region:r}).strict().readonly()},26586:(e,t,i)=>{i.d(t,{A:()=>a,O:()=>r});var o=i(69266);let r=(0,o.createContext)(null);function a(){let e=(0,o.useContext)(r);if(null===e)throw Error("缺少页面 clientId Provider");return e}},32892:(e,t,i)=>{i.d(t,{Bc:()=>m,ZI:()=>u,k$:()=>f,m_:()=>p});var o=i(7962),r=i(82480),a=i(94970),n=i(68868),s=i(47716),l=i(64796),c=i(69036),d=i(76478),h=i(49426);function m({delay:e=0,...t}){return(0,o.jsx)(r.B,{"data-slot":"tooltip-provider",delay:e,...t})}function p({...e}){return(0,o.jsx)(a.s,{"data-slot":"tooltip",...e})}function f({...e}){return(0,o.jsx)(n.k,{"data-slot":"tooltip-trigger",...e})}function u({className:e,side:t="top",sideOffset:i=4,align:r="center",alignOffset:a=0,children:n,...m}){return(0,o.jsx)(s.K,{children:(0,o.jsx)(l.o,{align:r,alignOffset:a,side:t,sideOffset:i,className:"isolate z-50",children:(0,o.jsxs)(c.o,{"data-slot":"tooltip-content",className:(0,h.cn)("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-2 rounded-md bg-foreground px-2 py-1 text-xs leading-5 text-background duration-100 motion-reduce:animate-none has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...m,children:[n,(0,o.jsx)(d.P,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}},33550:(e,t,i)=>{i.d(t,{E6:()=>u,TX:()=>C,ZQ:()=>g});var o=i(69266),r=i(38979);let a="pi-super:code-preferences",n=r.Ik({wrapLines:r.zM().default(!0),diffViewMode:r.k5(["side-by-side","inline"]).default("side-by-side"),collapseUnchanged:r.zM().default(!1)}),s=n.parse({}),l=new Set,c=null;function d(e){try{window.localStorage.setItem(a,JSON.stringify(e))}catch(e){console.warn("[Pi Desk][CodePreferences] 保存代码显示偏好失败",e)}}function h(){try{let e=window.localStorage.getItem(a);if(null!==e){let t=n.safeParse(JSON.parse(e));return t.success?t.data:s}let t=r.Ik({wrapLines:r.zM()}).safeParse(JSON.parse(window.localStorage.getItem("pi-super:project-preview:global")??"null"));if(t.success){let e={...s,wrapLines:t.data.wrapLines};return d(e),e}}catch{}return s}function m(e,t){return e?.wrapLines===t.wrapLines&&e.diffViewMode===t.diffViewMode&&e.collapseUnchanged===t.collapseUnchanged}function p(){for(let e of l)e()}function f(e){if(null!==e.key&&e.key!==a)return;let t=h();m(c,t)||(c=t,p())}function u(){return c??=h()}function g(e){let t=n.parse({...u(),...e});m(c,t)||(c=t,d(t),p())}function y(e){return 0===l.size&&(c=h(),window.addEventListener("storage",f)),l.add(e),()=>{l.delete(e),0===l.size&&window.removeEventListener("storage",f)}}function C(){return(0,o.useSyncExternalStore)(y,u,()=>s)}},42643:(e,t,i)=>{i.d(t,{p:()=>o});let o={en:{chooseProject:"Open a project",switchProject:"Switch project",directoryPath:"Directory path",directoryPlaceholder:"Enter an absolute directory path",serverDirectoryHint:"Browse directories on the connected server.",openProject:"Open",recentProjects:"Project history",browseDirectories:"Browse directories",loadingDirectories:"Loading directories…",parentDirectory:"Parent directory",directoryRoots:"Directories",openThisDirectory:"Open this directory",noSubdirectories:"No subdirectories",noRecentProjects:"No project history. Enter a path or browse directories.",currentHead:"Current HEAD",localBranch:"Local branch",remoteBranch:"Remote branch \xb7 local record",retry:"Retry",compareDirect:"Compare directly",loadingCommits:"Loading commits…",commitList:"Git commits",noCommitMessage:"(no commit message)",noMatchingCommits:"No matching commits",noCommits:"No commits",scanLimit:"History scan limit reached. Choose a more specific branch or commit.",loadedLimit:"2,000 commits loaded. Narrow your search.",loadMoreCommits:"Load more commits",backCommits:"Back to commits",commitChanges:"Commit changes",cumulativeChanges:"Cumulative changes",loadedFiles:"{{count}} files loaded",backCumulative:"Back to cumulative changes",loadingChanges:"Loading changes…",noDiff:"No file differences",loadMoreFiles:"Load more files",changesLimit:"Change file display limit reached.",commitDetails:"Commit details",copySha:"Copy commit SHA",compareParent:"Compare parent commit",parentCommit:"Parent {{count}} \xb7 {{oid}}",mergeBaseToTarget:"Common ancestor → target commit",baseToTarget:"Base commit → target commit",emptyRevision:"Empty revision",selectCommit:"Select a commit to view its details",historyAndCompare:"Git history and comparison",viewMode:"Git view mode",historyMode:"Commit history",compareMode:"Compare branches",selectRepository:"Select repository",viewBranch:"View branch",baseBranch:"Base branch",chooseBase:"Choose base branch",targetBranch:"Target branch",comparison:"Comparison method",introducedChanges:"Changes introduced by this branch",directComparison:"Compare two versions directly",filterAuthor:"Filter by author",author:"Commit author",searchCommits:"Search commit message or SHA",refreshGit:"Refresh Git history",localRecord:"Local record",refUnavailable:"Reference unavailable",aheadBehind:"{{ahead}} ahead \xb7 {{behind}} behind",chooseBaseBranch:"Choose a base branch",restoreGit:"Restore Git panel",maximizeGit:"Maximize Git panel",collapseGit:"Collapse Git panel",copyFailed:"Could not copy",findingGit:"Detecting Git repositories…",noGit:"No Git repository found",collapseDirectory:"Collapse folder tree",expandDirectory:"Expand folder tree",previewDescription:"Read-only preview of project files and Git history",gitRecords:"Git history",refreshPreview:"Refresh project preview",restoreWindow:"Restore preview window",maximizeWindow:"Maximize preview window",closePreview:"Close project preview",previewArea:"Project preview area",files:"Files",code:"Code",changeFiles:"Files changed in commit",viewDiff:"View diff",gitStatus:"Git status {{status}}",viewDiffPath:"View diff: {{path}}",historyDiffAncestor:"Common ancestor {{left}} ↔ {{target}}",historyDiffDirect:"{{left}} ↔ {{target}}",historyReadFailed:"Could not read Git history"},"zh-CN":{chooseProject:"打开项目",switchProject:"切换项目",directoryPath:"目录路径",directoryPlaceholder:"输入完整目录路径",serverDirectoryHint:"选择所连接服务上的目录。",openProject:"打开",recentProjects:"历史项目",browseDirectories:"浏览目录",loadingDirectories:"正在读取目录…",parentDirectory:"上级目录",directoryRoots:"目录",openThisDirectory:"打开此目录",noSubdirectories:"没有子目录",noRecentProjects:"没有历史项目,可输入路径或浏览目录。",currentHead:"当前 HEAD",localBranch:"本地分支",remoteBranch:"远程分支 \xb7 本地记录",retry:"重试",compareDirect:"直接比较",loadingCommits:"读取提交…",commitList:"Git 提交列表",noCommitMessage:"(无提交说明)",noMatchingCommits:"没有匹配的提交",noCommits:"没有提交记录",scanLimit:"历史扫描达到上限,请选择更具体的分支或提交。",loadedLimit:"已加载 2000 条,请缩小查询范围。",loadMoreCommits:"加载更多提交",backCommits:"返回提交列表",commitChanges:"提交变更",cumulativeChanges:"累计变更",loadedFiles:"已加载 {{count}} 个文件",backCumulative:"返回累计变更",loadingChanges:"读取变更…",noDiff:"没有文件差异",loadMoreFiles:"加载更多文件",changesLimit:"变更文件超过显示上限。",commitDetails:"提交详情",copySha:"复制提交SHA",compareParent:"比较父提交",parentCommit:"父提交 {{count}} \xb7 {{oid}}",mergeBaseToTarget:"共同祖先 → 目标提交",baseToTarget:"基准提交 → 目标提交",emptyRevision:"空版本",selectCommit:"选择提交查看详情",historyAndCompare:"Git 历史与比较",viewMode:"Git 查看方式",historyMode:"提交记录",compareMode:"分支比较",selectRepository:"查看仓库",viewBranch:"查看分支",baseBranch:"基准分支",chooseBase:"选择基准分支",targetBranch:"目标分支",comparison:"比较方式",introducedChanges:"本分支引入的变更",directComparison:"两个版本直接比较",filterAuthor:"按提交用户筛选",author:"提交用户",searchCommits:"搜索提交说明或 SHA",refreshGit:"刷新Git记录",localRecord:"本地记录",refUnavailable:"引用不可用",aheadBehind:"领先 {{ahead}} \xb7 落后 {{behind}}",chooseBaseBranch:"选择基准分支",restoreGit:"还原Git区域",maximizeGit:"最大化Git区域",collapseGit:"收起Git区域",copyFailed:"复制失败",findingGit:"正在识别 Git 仓库…",noGit:"未发现 Git 仓库",collapseDirectory:"收起目录",expandDirectory:"展开目录",previewDescription:"只读项目文件和 Git 历史预览",gitRecords:"Git 记录",refreshPreview:"刷新项目预览",restoreWindow:"还原预览窗口",maximizeWindow:"最大化预览窗口",closePreview:"关闭项目预览",previewArea:"项目预览区域",files:"文件",code:"代码",changeFiles:"提交变更文件",viewDiff:"查看差异",gitStatus:"Git 状态 {{status}}",viewDiffPath:"查看差异 {{path}}",historyDiffAncestor:"共同祖先 {{left}} ↔ {{target}}",historyDiffDirect:"{{left}} ↔ {{target}}",historyReadFailed:"读取 Git 历史失败"}}},48708:(e,t,i)=>{i.d(t,{Hc:()=>y,SJ:()=>h,UV:()=>p,ae:()=>m,fx:()=>u,pW:()=>f,re:()=>g});var o=i(15710);let r=new Set,a=new Set,n=o.J.parse({region:{locale:"en",timeZone:"UTC"}}),s=null,l=!1,c=0;function d(e){return{locale:e,timeZone:n.region.timeZone,localePreference:n.region.locale,timeZonePreference:n.region.timeZone,pendingLocale:e===n.region.locale?null:n.region.locale}}function h(){return n}function m(e){return a.add(e),()=>a.delete(e)}function p(e){let t=o.J.parse(e),i=JSON.stringify(n)!==JSON.stringify(t);if(l&&!i)return;let c=l&&s?s.locale:t.region.locale;for(let e of(n=t,l=!0,s=d(c),r))e();if(i)for(let e of a)e()}function f(e){for(let t of(s={...d(e),pendingLocale:null},r))t()}function u(){return s}function g(e){return r.add(e),()=>r.delete(e)}function y(){if(c+=1,!s)for(let e of(s=d(n.region.locale),r))e();return()=>{0==(c-=1)&&(s=null,l=!1,n=o.J.parse({region:{locale:"en",timeZone:"UTC"}}),r.clear(),a.clear())}}},49426:(e,t,i)=>{i.d(t,{cn:()=>a});var o=i(77694),r=i(37810);function a(...e){return(0,r.QP)((0,o.$)(e))}},51821:(e,t,i)=>{i.d(t,{G:()=>x,c:()=>b});var o=i(7962),r=i(96381),a=i(89261),n=i(42360),s=i(47800),l=i(82136),c=i(71859),d=i(73208),h=i(45968),m=i(85937),p=i(94173),f=i(27315),u=i(10672),g=i(49362),y=i(69266),C=i(78121),w=i(49426);function v(){let{t:e}=(0,C.Bd)("common"),t=r.I();return(0,o.jsx)(o.Fragment,{children:t.toasts.slice(0,3).map(t=>{let i=t.data?.level??"info";return(0,o.jsxs)(a.m,{toast:t,"data-pi-desk-toast":i,className:(0,w.cn)("pointer-events-auto flex w-full items-start gap-3 rounded-xl border bg-popover px-3 py-3 text-popover-foreground shadow-md transition-[transform,opacity] duration-200 data-starting-style:translate-y-2 data-starting-style:opacity-0 data-ending-style:translate-y-2 data-ending-style:opacity-0","error"===i?"border-destructive/40":"warning"===i?"border-status-warning/40":"border-border"),children:["error"===i?(0,o.jsx)(m.A,{className:"mt-0.5 size-4 shrink-0 text-destructive"}):"warning"===i?(0,o.jsx)(p.A,{className:"mt-0.5 size-4 shrink-0 text-status-warning"}):"success"===i?(0,o.jsx)(f.A,{className:"mt-0.5 size-4 shrink-0 text-status-success"}):(0,o.jsx)(u.A,{className:"mt-0.5 size-4 shrink-0 text-primary"}),(0,o.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,o.jsx)(n.S,{className:"text-sm leading-5 font-medium"}),(0,o.jsx)(s.a,{className:"mt-1 text-sm leading-5 text-muted-foreground"})]}),(0,o.jsx)(l.e,{"aria-label":e("closeNotice"),title:e("closeNotice"),className:"flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,o.jsx)(g.A,{className:"size-3.5"})})]},t.id)})})}function b({children:e}){return(0,o.jsxs)(c.t,{timeout:3e3,limit:3,children:[e,(0,o.jsx)(d.S,{children:(0,o.jsx)(h.U,{className:"fixed right-3 bottom-3 z-[200] flex w-[min(24rem,calc(100vw-1.5rem))] flex-col gap-2 outline-none sm:right-5 sm:bottom-5",children:(0,o.jsx)(v,{})})})]})}function x(){let{add:e}=r.I(),{t}=(0,C.Bd)("common");return(0,y.useMemo)(()=>{let i=i=>{let o=i.title.trim().slice(0,120),r=i.description?.trim().slice(0,320);return e({title:o||t("pluginNotice"),...r?{description:r}:{},type:i.level,..."error"===i.level||"warning"===i.level?{priority:"high"}:{},data:{level:i.level}})};return{show:i,success:e=>i({level:"success",title:e}),error:e=>i({level:"error",title:e})}},[e,t])}},73230:(e,t,i)=>{i.d(t,{B:()=>a,o:()=>r});let o=null;function r(e){o=e}function a(e){return e.i18n?o?.(e.i18n.key,e.i18n.params)??e.msg:e.msg}},93540:(e,t,i)=>{i.d(t,{C:()=>o});let o={en:{reading:"Loading…",retryReading:"{{error}}. Retry",showMore:"Show more ({{visible}} / {{total}})",viewDiff:"View diff",openPreview:"Open preview",gitStatus:"Git status {{status}}",directoryLimit:"This folder has many entries. Showing the first 5,000; use search to find more.",emptyDirectory:"Empty folder",incompleteRepository:"Some repositories could not be read. The change list may be incomplete.",noChangedFiles:"No changed files",noChanges:"No changes",gitBranches:"Git branches",gitBranchReadOnly:"Git branch (read-only)",selectPreviewDirectory:"Switch preview directory",previewDirectories:"Preview directories",sessionDirectory:"Original folder",unavailable:"Unavailable",projectFiles:"{{name}} project files",searchFiles:"Search filenames or paths",searchAll:"Search files or content",searchContent:"Search file content",searchScope:"Search scope",searchScopeAll:"All",searchScopeFiles:"Files",searchScopeContent:"Content",searchCaseSensitive:"Match case",searchWholeWord:"Match whole word",searchRegex:"Use regular expression",searchResults:"Search results",searchStart:"Search this project",searchTryOptions:"Try another query or adjust the search options.",searchFailed:"Could not search the project. Please try again.",searchCounts:"{{files}} files \xb7 {{lines}} matching lines",searchShownCounts:"Shown: {{counts}}",searchFileHeading:"Filenames",searchContentHeading:"Content",searchContentCounts:"{{lines}} matching lines \xb7 {{files}} files",searchProjectRoot:"Project root",searchExpandFiles:"Show {{count}} more files",searchOpenLine:"Open {{path}}, line {{line}}",searchLineUnavailable:"The file content has changed and the matching line no longer exists.",searchTextLimit:"Content search: previewable UTF-8 text up to 5 MiB.",closeSearch:"Exit search",layout:"File organization",directory:"Folders",repository:"Repositories",changesOnly:"Changes only",searchProject:"Search project",noMatches:"No matching results",searching:"Searching…",resultLimit:"Results are limited. Refine your query or narrow the search scope.",copied:"Copied.",copyFailed:"Could not copy. Please try again.",revealRequested:"Opened the system file manager.",revealFailed:"Could not locate the file",collapse:"Collapse",expand:"Expand",openCurrentWorkspace:"Open current workspace folder",locateCurrentWorkspace:"Locate in current workspace",openFolder:"Open this folder",openContainingFolder:"Open containing folder",copyAbsolutePath:"Copy absolute path",copyRelativePath:"Copy relative path",copyFolderName:"Copy folder name",copyFileName:"Copy filename",copyOldRelativePath:"Copy original relative path",selectedCodeCopied:"Selected code copied.",allCodeCopied:"All code copied.",copyContentFailed:"Could not copy the file. Please copy it manually.",fileActions:"File actions",headToWorking:"HEAD ↔ working tree",gitChangesCount:"Against HEAD \xb7 {{count}} changes",gitChangesCompact:"{{count}} changes",gitMarkersLoading:"Comparing with HEAD…",gitMarkersFailed:"Could not read changes \xb7 Reload to retry",gitMarkersUnavailable:"Line change markers unavailable",gitAddedLines:"{{count}} lines added",gitModifiedLines:"{{count}} lines modified",gitDeletedLines:"{{count}} lines deleted",noDiffChanges:" \xb7 No content differences",previousChange:"Previous change",nextChange:"Next change",inlineDiff:"Switch to inline diff",sideBySideDiff:"Switch to side-by-side diff",wrapOff:"Turn off line wrapping",wrapOn:"Turn on line wrapping",expandUnchanged:"Expand unchanged content",collapseUnchanged:"Collapse unchanged content",reloadDiff:"Reload diff",htmlMode:"HTML display mode",markdownMode:"Markdown display mode",markdownPreview:"{{name}} Markdown preview",previewMode:"Preview",sourceMode:"Source",findInFile:"Find in file",goToLine:"Go to line",copySelectionOrAll:"Copy selected or all content",reloadCurrentFile:"Reload this file",binaryDiffUnavailable:"Binary files cannot be diffed online.",largeDiffUnavailable:"Files over 5 MB cannot be diffed online.",readAgain:"Reload",noOpenFile:"No file open",imageViewer:"{{name}} image viewer",htmlPreview:"{{name}} HTML preview",loadingFile:"Loading file…",closeTab:"Close tab",closeOtherTabs:"Close other tabs",closeRightTabs:"Close tabs to the right",closeLeftTabs:"Close tabs to the left",closeAllTabs:"Close all tabs",openFiles:"Open files",closeDiff:"Close diff {{name}}",closeFile:"Close file {{name}}",collapseTabs:"Collapse tabs",expandTabs:"Expand tabs \xb7 {{count}}",gitUnavailable:"Git unavailable",repositoriesUnit:"repositories",projectReadFailed:"Could not read project",revealUnavailable:"File location is not available yet",maxOpenFiles:"At most {{count}} files can be open. Close some files first.",branchFileClosed:"File no longer exists on the selected branch and was closed: {{path}}"},"zh-CN":{reading:"正在读取…",retryReading:"{{error}},点击重试",showMore:"显示更多({{visible}} / {{total}})",viewDiff:"查看差异",openPreview:"打开预览",gitStatus:"Git 状态 {{status}}",directoryLimit:"该目录内容较多,仅显示前 5000 项,请使用搜索。",emptyDirectory:"空目录",incompleteRepository:"仓库读取不完整,无法确认全部变更",noChangedFiles:"没有变更文件",noChanges:"没有变更",gitBranches:"Git 分支",gitBranchReadOnly:"Git 分支(只读)",selectPreviewDirectory:"切换预览目录",previewDirectories:"预览目录",sessionDirectory:"原目录",unavailable:"不可用",projectFiles:"{{name}} 项目文件",searchFiles:"搜索文件名或路径",searchAll:"搜索文件或内容",searchContent:"搜索文件内容",searchScope:"搜索范围",searchScopeAll:"全部",searchScopeFiles:"文件",searchScopeContent:"内容",searchCaseSensitive:"区分大小写",searchWholeWord:"全词匹配",searchRegex:"使用正则表达式",searchResults:"搜索结果",searchStart:"搜索这个项目",searchTryOptions:"试试其他关键词,或调整搜索选项。",searchFailed:"项目搜索失败,请重试。",searchCounts:"{{files}} 个文件 \xb7 {{lines}} 个命中行",searchShownCounts:"已显示:{{counts}}",searchFileHeading:"文件名",searchContentHeading:"内容",searchContentCounts:"{{lines}} 个命中行 \xb7 {{files}} 个文件",searchProjectRoot:"项目根目录",searchExpandFiles:"展开其余 {{count}} 个文件",searchOpenLine:"打开 {{path}} 第 {{line}} 行",searchLineUnavailable:"文件内容已变化,搜索命中行已不存在",searchTextLimit:"正文搜索:可预览的 UTF-8 文本,不超过 5 MiB。",closeSearch:"退出搜索",layout:"文件组织方式",directory:"目录",repository:"仓库",changesOnly:"只看变更",searchProject:"搜索项目",noMatches:"没有匹配结果",searching:"正在搜索…",resultLimit:"结果较多,已截断显示。请细化关键词或缩小搜索范围。",copied:"已复制。",copyFailed:"复制失败,请重试。",revealRequested:"已请求运行端文件管理器定位。",revealFailed:"系统定位失败",collapse:"收起",expand:"展开",openCurrentWorkspace:"打开当前工作区目录",locateCurrentWorkspace:"在当前工作区定位",openFolder:"打开此文件夹",openContainingFolder:"打开所在文件夹",copyAbsolutePath:"复制绝对路径",copyRelativePath:"复制相对路径",copyFolderName:"复制目录名",copyFileName:"复制文件名",copyOldRelativePath:"复制原相对路径",selectedCodeCopied:"已复制选中代码。",allCodeCopied:"已复制全部代码。",copyContentFailed:"复制文件内容失败,请手动复制。",fileActions:"文件操作",headToWorking:"HEAD ↔ 工作区",gitChangesCount:"相对 HEAD \xb7 {{count}} 处变更",gitChangesCompact:"{{count}} 处变更",gitMarkersLoading:"正在与 HEAD 比较…",gitMarkersFailed:"变更读取失败 \xb7 刷新重试",gitMarkersUnavailable:"此文件无法显示行变更",gitAddedLines:"新增 {{count}} 行",gitModifiedLines:"修改 {{count}} 行",gitDeletedLines:"删除 {{count}} 行",noDiffChanges:" \xb7 当前比较无内容差异",previousChange:"上一个变更",nextChange:"下一个变更",inlineDiff:"切换为单栏 Diff",sideBySideDiff:"切换为左右 Diff",wrapOff:"关闭自动换行",wrapOn:"开启自动换行",expandUnchanged:"展开未变更内容",collapseUnchanged:"折叠未变更内容",reloadDiff:"重新加载 Diff",htmlMode:"HTML 显示方式",markdownMode:"Markdown 显示方式",markdownPreview:"{{name}} Markdown 预览",previewMode:"预览",sourceMode:"源码",findInFile:"在文件中查找",goToLine:"跳转到行",copySelectionOrAll:"复制选中内容或全部",reloadCurrentFile:"重新加载当前文件",binaryDiffUnavailable:"二进制文件暂不支持在线 Diff。",largeDiffUnavailable:"文件超过 5MB,暂不支持在线 Diff。",readAgain:"重新读取",noOpenFile:"尚未打开文件",imageViewer:"{{name}} 图片查看器",htmlPreview:"{{name}} HTML 预览",loadingFile:"正在读取文件…",closeTab:"关闭标签",closeOtherTabs:"关闭其他标签",closeRightTabs:"关闭右侧标签",closeLeftTabs:"关闭左侧标签",closeAllTabs:"关闭全部标签",openFiles:"已打开文件",closeDiff:"关闭 Diff {{name}}",closeFile:"关闭文件 {{name}}",collapseTabs:"收起标签",expandTabs:"展开标签 \xb7 {{count}}",gitUnavailable:"Git 不可用",repositoriesUnit:"个仓库",projectReadFailed:"读取项目失败",revealUnavailable:"系统定位尚未准备好",maxOpenFiles:"最多打开 {{count}} 个文件,请先关闭部分文件",branchFileClosed:"文件在切换后的分支中不存在,已关闭:{{path}}"}}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[19991],{19991:(e,s,i)=>{i.r(s),i.d(s,{L2FileWorkspaceView:()=>b});var l=i(7962),a=i(39569),t=i(55079),n=i(49667),r=i(24925),c=i(48155),o=i(84630),d=i(59252),x=i(90680),m=i(69266),h=i(78121),u=i(73068),f=i(86963),p=i(70657),g=i(35842);function b({workSession:e,runtime:s,gitRuntime:i,mobile:j,presentation:w,onOpenGitBranches:v,onOpenSidebar:k,onHide:N,onExpand:z,onSwitchPane:A,onOpenTerminal:C}){let{t:y}=(0,h.Bd)("workbench");(0,m.useSyncExternalStore)(s.subscribe,s.getRevision,s.getRevision);let{workId:E,projectName:T}=e,P=s.getDirectory(E),R=s.getWorkspace(E),$=P.replaceAll("\\","/").split("/").filter(Boolean).at(-1)??P,F=P===e.cwd?T:$,[S,K]=(0,m.useState)(!0),B=(0,m.useRef)(null),D="expanded"===w,W=D&&S&&!j,_=j||"single"===w;if(!R)return null;let{activeDiff:I,activePath:O}=R,V=I?[I.repositoryRoot,I.path].filter(Boolean).join("/"):null,q=()=>{s.getExpandedWorkId()===E?z():N()},G=(V??O??y("file")).replaceAll("\\","/").split("/").at(-1);return(0,l.jsxs)("section",{"data-testid":"file-workspace","data-file-work-id":E,className:"relative isolate flex size-full min-h-0 min-w-0 flex-col overflow-hidden bg-background outline-none","aria-label":y("fileViewer",{name:T}),tabIndex:-1,onFocus:e=>{e.target===e.currentTarget&&B.current?.focus()},onKeyDown:e=>{if("Escape"!==e.key||e.defaultPrevented||e.repeat||e.nativeEvent.isComposing)return;let s=e.target instanceof Element?e.target:null;if(s?.closest('.monaco-editor, [role="menu"]')||e.currentTarget.querySelector(".viewer-fullscreen-exit"))return;let i=s?.closest('[role="dialog"]');i&&i!==e.currentTarget.closest('[role="dialog"]')||e.ctrlKey||e.altKey||e.metaKey||e.shiftKey||(e.preventDefault(),e.stopPropagation(),q())},children:[(0,l.jsxs)("header",{className:"flex min-h-14 shrink-0 items-center gap-2 border-b bg-muted px-3 pt-[env(safe-area-inset-top)]",children:[j||"single"===w?(0,l.jsx)(f.$,{variant:"ghost",size:"icon","aria-label":y("showSessionMenu"),onClick:k,children:(0,l.jsx)(a.A,{className:"size-5"})}):null,D&&!j?(0,l.jsx)(f.$,{variant:"ghost",size:"icon","aria-label":y(S?"collapseProjectTree":"expandProjectTree"),onClick:()=>K(e=>!e),children:S?(0,l.jsx)(t.A,{className:"size-4"}):(0,l.jsx)(n.A,{className:"size-4"})}):null,(0,l.jsxs)("div",{className:"min-w-0 flex-1 px-1",children:[(0,l.jsxs)("p",{className:"truncate text-sm font-semibold",title:V??O??T,children:[G,I?" \xb7 Diff":""]}),(0,l.jsxs)("p",{className:"truncate text-xs text-muted-foreground",title:`${P} \xb7 ${V??O??""}`,children:[F,V??O?` \xb7 ${V??O}`:""]})]}),j?null:(0,l.jsx)(f.$,{variant:"ghost",size:"icon","aria-label":y(D?"exitExpanded":"expandFile"),title:y(D?"exitExpanded":"expandFile"),"data-file-expand-trigger":"",onClick:z,children:D?(0,l.jsx)(r.A,{className:"size-4"}):(0,l.jsx)(c.A,{className:"size-4"})}),(0,l.jsxs)(f.$,{variant:"ghost","aria-label":y(_?"returnChat":"hideFile"),onClick:N,children:[(0,l.jsx)(o.A,{className:"size-4"}),y(_?"chat":"collapse")]})]}),(0,l.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1",children:[W?(0,l.jsxs)("aside",{className:"flex min-h-0 w-[clamp(200px,22%,280px)] shrink-0 flex-col border-r bg-sidebar","aria-label":y("browseProject"),children:[(0,l.jsxs)("div",{className:"flex min-h-9 shrink-0 items-center border-b px-3",children:[(0,l.jsx)("span",{className:"flex-1 text-xs font-medium",children:y("fileWorkspaceTitle")}),C?(0,l.jsx)(f.$,{variant:"ghost",size:"icon-sm","aria-label":y("newTerminal"),title:y("newTerminal"),onClick:()=>C(e.cwd),children:(0,l.jsx)(d.A,{className:"size-4"})}):null,(0,l.jsx)(f.$,{variant:"ghost",size:"icon-sm","aria-label":y("refreshFiles"),onClick:()=>{s.refreshTree(E),i.refreshSnapshot(P)},children:(0,l.jsx)(x.A,{className:"size-4"})})]}),(0,l.jsx)(p.k,{workId:E,cwd:e.cwd,projectName:T,runtime:s,gitRuntime:i,onOpenGitBranches:v})]}):null,(0,l.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,l.jsx)(g.X,{cwd:P,gitRuntime:i,paths:R.tabs,activePath:O,diffPath:V,mobile:j,onActivate:e=>s.activateFile(E,e),onClose:(e,i)=>s.closeTabs(E,e,i)}),(0,l.jsx)(u.R,{ref:B,runtime:s.getFileRuntime(E),gitRuntime:i,visible:D||R.windowOpen&&("split"===w||"files"===R.activePane),compact:_,onEscape:q,onSwitchPane:A},P)]})]})]})}}}]);
|