pi-webapp 0.1.58-alpha.6 → 0.1.58

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.
@@ -0,0 +1,2 @@
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`c2e2e0b1-167a-42f9-8b44-a2d7ef7aa40e`,e._sentryDebugIdIdentifier=`sentry-dbid-c2e2e0b1-167a-42f9-8b44-a2d7ef7aa40e`)}catch{}})();import{r as e}from"./rolldown-runtime-CgmABjMJ.js";import{A as t,C as n,E as r,I as i,L as a,M as o,O as s,R as c,T as l,a as u,c as d,i as f,j as p,k as m,n as h,o as g,r as _,s as v,z as y}from"./app-ClkTJLf2.js";import{t as b}from"./react-CLFE7TFE.js";import{n as x}from"./clsx-DQAHfk8w.js";var S=e(b(),1),C=`[role="dialog"][aria-modal="true"], dialog[open], [role="menu"]`,w=`[hidden], [aria-hidden="true"], [inert]`;function T(e){if(document.visibilityState===`hidden`||!e.isConnected||e.closest(w)||getComputedStyle(e).visibility!==`visible`)return null;for(let t of Array.from(document.querySelectorAll(C)))if(!t.contains(e)&&!t.closest(w)&&t.getClientRects().length&&getComputedStyle(t).visibility===`visible`)return null;let t=e.getBoundingClientRect(),n=window.visualViewport,r=n?.offsetLeft??0,i=n?.offsetTop??0,a=Math.ceil(Math.max(t.left,r)),o=Math.ceil(Math.max(t.top,i)),s=Math.floor(Math.min(t.right,r+(n?.width??document.documentElement.clientWidth))),c=Math.floor(Math.min(t.bottom,i+(n?.height??document.documentElement.clientHeight)));return s<=a||c<=o||!e.contains(document.elementFromPoint((a+s)/2,(o+c)/2))?null:{x:a,y:o,width:s-a,height:c-o}}function E(e,t){let n=0,r,i=!1,a=e=>{r===e||r&&e&&r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height||(r=e,t(e))},o=[];for(let t=e;t;t=t.parentElement)o.push(t);let s=()=>{n||=requestAnimationFrame(c)};function c(){n=0,a(i?null:T(e)),!i&&document.visibilityState!==`hidden`&&o.some(e=>e.getAnimations().some(e=>e instanceof CSSTransition&&e.playState===`running`))&&s()}let l=()=>{document.visibilityState===`hidden`?a(null):s()},u=()=>{i=!0,a(null)},d=()=>{i=!1,s()},f=new ResizeObserver(s);for(let e of o)f.observe(e);let p=new IntersectionObserver(s);p.observe(e);let m=new MutationObserver(s);m.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`role`,`aria-modal`,`aria-hidden`,`hidden`,`inert`,`open`,`style`,`class`]});let h=window.visualViewport,g=new AbortController,_={signal:g.signal};window.addEventListener(`resize`,s,_),window.addEventListener(`scroll`,s,{..._,capture:!0,passive:!0}),window.addEventListener(`pagehide`,u,_),window.addEventListener(`pageshow`,d,_),document.addEventListener(`visibilitychange`,l,_),document.addEventListener(`transitionrun`,s,_),h?.addEventListener(`resize`,s,_),h?.addEventListener(`scroll`,s,_);let v=()=>{r=void 0,s(),matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`).addEventListener(`change`,v,{..._,once:!0})};return v(),()=>{g.abort(),cancelAnimationFrame(n),f.disconnect(),p.disconnect(),m.disconnect(),a(null)}}var D={panel:`_panel_1x0ti_1`,toolbar:`_toolbar_1x0ti_12`,controls:`_controls_1x0ti_23`,iconButton:`_iconButton_1x0ti_33`,location:`_location_1x0ti_33`,address:`_address_1x0ti_49`,loadingAddress:`_loadingAddress_1x0ti_55`,locationIcon:`_locationIcon_1x0ti_89`,go:`_go_1x0ti_115`,notice:`_notice_1x0ti_135`,viewport:`_viewport_1x0ti_153`,message:`_message_1x0ti_167`,messageTitle:`_messageTitle_1x0ti_181`,badge:`_badge_1x0ti_188`,suggestions:`_suggestions_1x0ti_210`,tip:`_tip_1x0ti_222`,recovery:`_recovery_1x0ti_232`,spinner:`_spinner_1x0ti_237`,spin:`_spin_1x0ti_237`,srOnly:`_srOnly_1x0ti_246`},O=x(),k=`localhost:3000`;function A({label:e,...t}){return(0,O.jsx)(d,{size:`sm`,"aria-label":e,title:e,className:D.iconButton,...t})}function j({model:e,visible:u,locale:f}){let{state:h,draft:g,submitted:_,pending:v,ipcFailed:b}=(0,S.useSyncExternalStore)(e.subscribe,e.getSnapshot),x=(0,S.useRef)(null),C=(0,S.useRef)(null),w=(0,S.useId)(),[T,j]=(0,S.useState)(``),M=(e,t)=>f===`zh`?e:t,N=g??(h.url||_),P=!v&&!!N.trim(),F=h.status===`failed`&&(h.error===`address`||h.error===`navigation`)&&g===null,I=u&&h.status===`ready`;(0,S.useLayoutEffect)(()=>{if(I&&x.current)return E(x.current,t=>e.layout(t))},[I,e]),(0,S.useEffect)(()=>{if(!T)return;let e=window.setTimeout(()=>j(``),2e3);return()=>window.clearTimeout(e)},[T]);let L=()=>{P&&e.open(N)},R=async()=>{j(await e.command(`copy`)?h.url:``)},z=!!(T&&T===h.url),B=h.error===`address`&&_.trim()===`?`,V=B?M(`请输入搜索关键词`,`Enter a search term`):h.error===`address`?M(`请输入 HTTP 或 HTTPS 地址`,`Enter an HTTP or HTTPS address`):h.error===`navigation`?M(`此地址无法在网页预览中打开`,`This address is blocked in Web Preview`):M(`页面加载失败`,`The page failed to load`),H=B?M(`在 ? 后输入要搜索的内容。`,`Type what you’d like to search for after the ?.`):h.error===`address`?M(`网址不能包含用户名或密码。若要搜索,请在关键词前加 ?。`,`URLs can’t include a username or password. To search, start with ? followed by your terms.`):h.error===`navigation`?M(`请尝试其他地址。`,`Try a different address.`):M(`请检查地址和网络连接。如果是本地服务,请确认它正在运行。`,`Check the address and your connection. If it’s a local server, make sure it’s running.`),U=()=>{C.current?.focus()};return(0,O.jsxs)(`section`,{className:D.panel,"aria-label":M(`网页预览`,`Web Preview`),children:[(0,O.jsxs)(`div`,{className:D.toolbar,children:[(0,O.jsxs)(`fieldset`,{className:D.controls,"aria-label":M(`页面导航`,`Page navigation`),children:[(0,O.jsx)(A,{label:M(`后退`,`Back`),icon:(0,O.jsx)(l,{"aria-hidden":`true`}),disabled:v||!h.canGoBack,onClick:()=>void e.command(`back`)}),(0,O.jsx)(A,{label:M(`前进`,`Forward`),icon:(0,O.jsx)(r,{"aria-hidden":`true`}),disabled:v||!h.canGoForward,onClick:()=>void e.command(`forward`)}),(0,O.jsx)(A,{label:M(`重新加载`,`Reload`),icon:(0,O.jsx)(i,{"aria-hidden":`true`}),disabled:v||!h.url||h.status===`loading`,onClick:()=>void e.command(`reload`)})]}),(0,O.jsx)(`form`,{className:D.address,onSubmit:e=>{e.preventDefault(),L()},children:(0,O.jsxs)(`div`,{className:D.location,"data-invalid":F,children:[(0,O.jsx)(c,{"aria-hidden":`true`,className:D.locationIcon}),(0,O.jsx)(`input`,{ref:C,"aria-label":M(`搜索或输入网址`,`Search or enter a URL`),type:`text`,dir:`auto`,autoCapitalize:`none`,autoComplete:`off`,spellCheck:!1,placeholder:M(`使用 Google 搜索或输入网址`,`Search Google or enter a URL`),value:N,"aria-invalid":F||void 0,"aria-describedby":F?w:void 0,onFocus:e=>e.currentTarget.select(),onChange:t=>e.edit(t.currentTarget.value)}),N&&(0,O.jsx)(A,{label:M(`清除地址`,`Clear address`),icon:(0,O.jsx)(s,{"aria-hidden":`true`}),onClick:()=>{e.edit(``),U()}}),(0,O.jsx)(d,{className:D.go,type:`submit`,variant:`primary`,size:`sm`,disabled:!P,children:M(`打开`,`Go`)})]})}),(0,O.jsxs)(`fieldset`,{className:D.controls,"aria-label":M(`页面操作`,`Page actions`),children:[(0,O.jsx)(A,{label:M(`复制地址`,`Copy URL`),icon:z?(0,O.jsx)(n,{"aria-hidden":`true`}):(0,O.jsx)(t,{"aria-hidden":`true`}),disabled:v||!h.url,onClick:()=>void R()}),(0,O.jsx)(A,{label:M(`在系统浏览器中打开`,`Open in system browser`),icon:(0,O.jsx)(a,{"aria-hidden":`true`}),disabled:v||!h.url,onClick:()=>void e.command(`external`)})]})]}),b&&(0,O.jsxs)(`div`,{className:D.notice,role:`alert`,children:[(0,O.jsx)(y,{size:16,"aria-hidden":`true`}),(0,O.jsx)(`span`,{children:M(`桌面预览操作失败,请重试。`,`The desktop preview action failed. Try again.`)})]}),(0,O.jsx)(`div`,{className:D.srOnly,role:`status`,children:z?M(`地址已复制。`,`URL copied.`):``}),(0,O.jsxs)(`div`,{ref:x,className:D.viewport,"data-web-preview-state":h.status,children:[h.status===`idle`&&(0,O.jsxs)(`div`,{className:D.message,children:[(0,O.jsx)(`div`,{className:D.badge,children:(0,O.jsx)(p,{size:24,"aria-hidden":`true`})}),(0,O.jsx)(`p`,{className:D.messageTitle,children:M(`打开网页开始预览`,`Open a page to preview`)}),(0,O.jsx)(`p`,{children:M(`打开网站、本机服务或局域网地址,也可以使用 Google 搜索。`,`Open a website, preview a local or LAN server, or search Google.`)}),(0,O.jsxs)(`div`,{className:D.suggestions,children:[(0,O.jsx)(d,{size:`sm`,variant:`outline`,icon:(0,O.jsx)(c,{"aria-hidden":`true`}),onClick:U,children:M(`Google 搜索`,`Search Google`)}),(0,O.jsx)(d,{size:`sm`,variant:`outline`,icon:(0,O.jsx)(m,{"aria-hidden":`true`}),onClick:()=>{e.edit(k),U()},children:(0,O.jsx)(`code`,{dir:`ltr`,children:k})})]}),(0,O.jsxs)(`p`,{className:D.tip,children:[M(`以 ? 开头可强制搜索,例如`,`To search instead of opening an address, try`),` `,(0,O.jsx)(`code`,{dir:`ltr`,children:M(`? 网页设计`,`? web design`)})]})]}),h.status===`loading`&&(0,O.jsxs)(`div`,{className:D.message,role:`status`,children:[(0,O.jsx)(`div`,{className:D.badge,children:(0,O.jsx)(o,{className:D.spinner,size:24,"aria-hidden":`true`})}),(0,O.jsx)(`p`,{className:D.messageTitle,children:M(`正在加载网页…`,`Loading page…`)}),h.url&&(0,O.jsx)(`p`,{className:D.loadingAddress,title:h.url,dir:`ltr`,children:h.url})]}),h.status===`ready`&&(0,O.jsx)(`span`,{className:D.srOnly,role:`status`,children:M(`预览已就绪`,`Preview ready`)}),h.status===`failed`&&(0,O.jsxs)(`div`,{className:D.message,children:[(0,O.jsx)(`div`,{className:D.badge,children:(0,O.jsx)(y,{size:24,"aria-hidden":`true`})}),(0,O.jsxs)(`div`,{role:`alert`,id:w,children:[(0,O.jsx)(`p`,{className:D.messageTitle,children:V}),(0,O.jsx)(`p`,{children:H})]}),F?(0,O.jsx)(d,{className:D.recovery,size:`sm`,variant:`outline`,onClick:U,children:M(`编辑输入`,`Edit input`)}):(0,O.jsx)(d,{className:D.recovery,size:`sm`,variant:`outline`,disabled:!P,onClick:L,children:M(`重试`,`Retry`)})]})]})]})}var M=v({id:_,apiVersion:1,activate(){},workbench:{apiVersion:1,entry:{category:`workspace`,kind:f,label:u,description:{zh:`在工作区打开网页`,en:`Open websites in the workspace`},icon:p},panels:[{kind:f,component:e=>{let t=g();if(!t)return null;let n=h(t,e.resource);return(0,O.jsx)(j,{model:n,visible:e.visible,locale:e.locale})}}]}});export{M as default};
2
+ //# debugId=c2e2e0b1-167a-42f9-8b44-a2d7ef7aa40e
@@ -0,0 +1,6 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/code-editor-C6MHaaWF.js","assets/rolldown-runtime-CgmABjMJ.js","assets/dist-IkQ96Etc.js","assets/app.js","assets/preference-CKBoM0dZ.js","assets/react-CLFE7TFE.js"])))=>i.map(i=>d[i]);
2
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`5e9c0e82-e4ac-44e5-b2e1-8014def94b0f`,e._sentryDebugIdIdentifier=`sentry-dbid-5e9c0e82-e4ac-44e5-b2e1-8014def94b0f`)}catch{}})();import{r as e}from"./rolldown-runtime-CgmABjMJ.js";import{I as t,J as n,K as r,P as i,R as a,W as o,Y as s,_ as c,d as l,f as u,g as d,h as f,m as p,p as m,q as h,s as g,u as _,v}from"./app-ClkTJLf2.js";import{a as y,c as b,o as x,t as S}from"./WorkspacePanel.module-CZiYvGfi.js";import{t as C}from"./react-CLFE7TFE.js";import{n as w}from"./preference-CKBoM0dZ.js";import{a as T,s as E}from"./app.js";import{n as D}from"./clsx-DQAHfk8w.js";import{a as O}from"./code-file-types-BZAEsqNG.js";var k={id:u.files,kind:`builtin`,version:`1.0.0`,name:{zh:`工作区文件`,en:`Workspace files`},description:{zh:`浏览、搜索工作区文件,预览代码、Markdown 与图片,并编辑文本文件。`,en:`Browse and search workspace files, preview code, Markdown and images, and edit text files.`}},A=e(C(),1);function j(e,t,n){if(!t)return null;let r=t.split(`/`).at(-1)??t,i=n?n.from===n.to?`L${n.from}`:`L${n.from}–${n.to}`:``,a=`${e.replace(/[\\/]+$/u,``)}/${t}`;return{detail:i?`${r} · ${i}`:r,reference:`Open file: ${t} (absolute: ${a}).${n?` Selected lines ${n.from}–${n.to}.`:``}`}}async function M(e,t,n,r){return l(await _(`/api/workspace/files/${e}`,{method:`POST`,headers:{Authorization:`Bearer ${E()}`,"Content-Type":`application/json`},body:JSON.stringify({sessionId:t,...n}),signal:r}))}async function N(e,t,n){let r=await _(`/api/workspace/files/raw`,{method:`POST`,headers:{Authorization:`Bearer ${E()}`,"Content-Type":`application/json`},body:JSON.stringify({sessionId:e,path:t}),signal:n});return r.response.ok?r.response.blob():l(r)}var P={raw:N,list:(e,t,n)=>M(`list`,e,{path:t},n),preview:(e,t,n)=>M(`preview`,e,{path:t},n),write:(e,t,n,r)=>M(`write`,e,{path:t,text:n,version:r}),status:(e,t)=>M(`status`,e,{},t),search:(e,t,n,r)=>M(`search`,e,{query:t,mode:n},r)},F=D(),I,L=()=>I??=T(()=>import(`./code-editor-C6MHaaWF.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5]));function R({text:e,filename:t,label:n,reveal:r,autoFocus:i,onChange:a,onSave:o,onSelection:s}){let c=(0,A.useRef)(null),[l,u]=(0,A.useState)(),[d,f]=(0,A.useState)(!1),p=(0,A.useRef)({onChange:a,onSave:o,onSelection:s});(0,A.useLayoutEffect)(()=>{p.current={onChange:a,onSave:o,onSelection:s}});let m=(0,A.useRef)(e);return(0,A.useEffect)(()=>{let e,r=!1;return L().then(({createCodeEditor:i})=>{!r&&c.current&&(e=i(c.current,{text:m.current,filename:t,label:n,onChange:e=>p.current.onChange(e),onSave:()=>p.current.onSave(),onSelection:e=>p.current.onSelection?.(e)}),u(e))}).catch(()=>{r||f(!0)}),()=>{r=!0,e?.destroy(),p.current.onSelection?.(null)}},[t,n]),(0,A.useEffect)(()=>{l?.setText(e)},[l,e]),(0,A.useEffect)(()=>{l&&r&&l.reveal(r.line)},[l,r]),(0,A.useEffect)(()=>{l&&i&&l.focus()},[l,i]),d?(0,F.jsx)(`p`,{className:S.state,role:`status`,children:w(`编辑器加载失败,请重新读取文件。`,`The editor could not load. Reload the file to try again.`)}):(0,F.jsx)(`div`,{ref:c,className:S.codeEditor,"aria-busy":!l,children:!l&&(0,F.jsx)(`p`,{className:S.state,children:w(`正在打开编辑器…`,`Opening the editor…`)})})}function z(e,t){let n=t.replace(/[?#].*$/u,``);try{n=decodeURI(n)}catch{}if(n===``||n.includes(`\\`)||n.includes(`\0`)||/^[a-z][a-z\d+.-]*:/iu.test(n)||n.startsWith(`//`))return;let r=n.startsWith(`/`)?[]:e.split(`/`).slice(0,-1);for(let e of n.split(`/`))if(e!==``&&e!==`.`){if(e===`..`){if(r.pop()===void 0)return}else r.push(e)}return r.length?r.join(`/`):void 0}var ee=e=>e.replace(/\r\n/gu,`
3
+ `),B=(0,A.memo)(function({sessionId:e,path:n,renderMarkdown:r,breadcrumb:i,trailing:a,refresh:s=0,reveal:c,onDirtyChange:l,onSaved:u,onSelection:d}){let[f,p]=(0,A.useState)(null),[h,g]=(0,A.useState)(!0),[_,v]=(0,A.useState)(!1),[y,b]=(0,A.useState)(0),[x,C]=(0,A.useState)(!1),[T,E]=(0,A.useState)(!1),[D,O]=(0,A.useState)(null),[k,j]=(0,A.useState)(!1),[M,N]=(0,A.useState)(!1),[I,L]=(0,A.useState)(null);(0,A.useEffect)(()=>{let t=new AbortController;return g(!0),v(!1),E(!1),C(!1),P.preview(e,n,t.signal).then(e=>{t.signal.aborted||(p(e),g(!1))}).catch(()=>{t.signal.aborted||(v(!0),g(!1))}),()=>t.abort()},[e,n,y]);let B=D!==null,V=(0,A.useRef)(B);(0,A.useLayoutEffect)(()=>{V.current=B});let H=(0,A.useRef)(s);(0,A.useEffect)(()=>{s===H.current||V.current||b(e=>e+1)},[s]);let U=/\.(?:md|markdown|mdown)$/i.test(n),W=n.split(`/`).at(-1),[te,ne]=(0,A.useState)(0),G=(0,A.useRef)(new Map);(0,A.useEffect)(()=>{let e=G.current;return e.clear(),()=>{for(let t of e.values())t&&URL.revokeObjectURL(t);e.clear()}},[e,n,y]);let K=(0,A.useMemo)(()=>({resolve(t){let r=z(n,t);if(r===void 0)return;let i=G.current,a=i.get(r);if(a!==void 0)return a??void 0;i.set(r,null),P.raw(e,r,new AbortController().signal).then(e=>{G.current===i&&i.get(r)===null&&(i.set(r,URL.createObjectURL(e)),ne(e=>e+1))}).catch(()=>{})}}),[e,n,y,te]),q=f?.kind===`text`?f:null,J=q?ee(q.text):``,Y=D??J,re=q!==null&&(!U||k);(0,A.useEffect)(()=>{l?.(B)},[B,l]),(0,A.useEffect)(()=>()=>l?.(!1),[l]),(0,A.useEffect)(()=>{c&&U&&j(!0)},[c,U]);let X=()=>!B||window.confirm(w(`放弃未保存的更改?`,`Discard unsaved changes?`)),Z=()=>{X()&&(O(null),L(null),b(e=>e+1))},Q=async(t=!1)=>{if(q&&D!==null&&!M){N(!0),L(null);try{let r=q.version;if(t){let t=await P.preview(e,n,new AbortController().signal);if(t.kind!==`text`)throw Error(`not text`);r=t.version}let i=q.text.includes(`\r
4
+ `)?D.replace(/\n/gu,`\r
5
+ `):D,a=await P.write(e,n,i,r);p({...q,text:i,version:a.version,size:a.size}),O(null),u?.()}catch(e){e instanceof m&&e.status===409&&e.reason===`conflict`?L({kind:`conflict`}):e instanceof m&&e.status===413?L({kind:`error`,message:w(`内容过大,无法保存(最多 5 MB、200,000 行)。`,`Too large to save (5 MB or 200,000 lines at most).`)}):e instanceof m&&e.status===409?L({kind:`error`,message:w(`会话已切换,未保存。`,`The session changed, so nothing was saved.`)}):L({kind:`error`,message:w(`保存失败,文件可能已移动、删除或无权写入。`,`Could not save. The file may have moved, been deleted, or be read-only.`)})}finally{N(!1)}}},$=(0,A.useMemo)(()=>f?.kind===`image`?`data:${f.mimeType};base64,${f.data}`:null,[f]);return(0,F.jsxs)(`div`,{className:S.body,children:[(0,F.jsxs)(`div`,{className:S.toolbar,children:[i??(0,F.jsx)(`span`,{className:S.path,title:n,children:n}),B&&(0,F.jsx)(`span`,{className:S.unsaved,role:`status`,children:w(`未保存`,`Unsaved`)}),!q&&(0,F.jsx)(`span`,{className:S.readonly,children:w(`只读`,`Read only`)}),U&&q&&(0,F.jsx)(`button`,{type:`button`,className:S.textButton,"aria-pressed":k,onClick:()=>j(e=>!e),children:k?w(`预览`,`Preview`):w(`编辑`,`Edit`)}),q&&(0,F.jsx)(`button`,{type:`button`,className:`${S.textButton} ${S.primaryButton}`,disabled:!B||M,title:w(`保存(⌘/Ctrl+S)`,`Save (⌘/Ctrl+S)`),onClick:()=>void Q(),children:M?w(`正在保存…`,`Saving…`):w(`保存`,`Save`)}),(0,F.jsx)(`button`,{type:`button`,className:S.iconButton,"aria-label":w(`重新读取文件`,`Reload file`),title:w(`重新读取文件`,`Reload file`),onClick:Z,children:(0,F.jsx)(t,{})}),a]}),I&&(0,F.jsx)(`div`,{className:S.saveProblem,role:`alert`,children:I.kind===`conflict`?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{children:w(`文件在你编辑期间已在磁盘上更改。`,`This file changed on disk while you were editing.`)}),(0,F.jsx)(`button`,{type:`button`,className:S.textButton,onClick:()=>{O(null),L(null),b(e=>e+1)},children:w(`放弃我的更改并重新读取`,`Discard mine and reload`)}),(0,F.jsx)(`button`,{type:`button`,className:S.textButton,onClick:()=>void Q(!0),children:w(`覆盖`,`Overwrite`)})]}):(0,F.jsx)(`span`,{children:I.message})}),(0,F.jsx)(`div`,{className:S.preview,"aria-busy":h,children:h&&!f?(0,F.jsx)(`p`,{className:S.state,role:`status`,children:w(`正在读取…`,`Reading…`)}):_?(0,F.jsxs)(`div`,{className:S.state,role:`status`,children:[(0,F.jsx)(`p`,{children:w(`文件读取失败,可能已移动、删除或无权访问。`,`Could not read this file. It may have moved, been deleted, or be inaccessible.`)}),(0,F.jsx)(`button`,{type:`button`,className:S.textButton,onClick:Z,children:w(`重试`,`Retry`)})]}):f?f.kind===`too-large`?(0,F.jsx)(`p`,{className:S.state,children:f.unit===`lines`?w(`文件行数过多,最多打开 ${f.limit.toLocaleString()} 行。`,`File has too many lines. Limit: ${f.limit.toLocaleString()} lines.`):w(`文件过大,无法打开。大小上限:${f.limit/1024/1024} MB`,`File is too large to open. Limit: ${f.limit/1024/1024} MB`)}):f.kind===`unsupported`?(0,F.jsx)(`p`,{className:S.state,children:w(`暂不支持预览此文件类型。`,`Preview is unavailable for this file type.`)}):f.kind===`image`&&$?T?(0,F.jsx)(`p`,{className:S.state,children:w(`图片无法解码。`,`This image could not be decoded.`)}):(0,F.jsx)(`button`,{type:`button`,className:S.imageButton,"aria-label":w(`放大图片`,`Enlarge image`),onClick:()=>C(!0),children:(0,F.jsx)(`img`,{className:S.image,src:$,alt:W,onError:()=>E(!0)})}):f.kind===`text`?re?(0,F.jsx)(R,{text:Y,filename:W,label:w(`编辑 ${W}`,`Edit ${W}`),reveal:c,autoFocus:U,onChange:e=>O(e===J?null:e),onSave:()=>void Q(),onSelection:d}):Y.trim()===``?(0,F.jsx)(`p`,{className:S.state,children:w(`空文件`,`Empty file`)}):(0,F.jsx)(`div`,{className:S.markdown,children:r(Y,K)}):null:null}),x&&$&&(0,F.jsx)(o,{src:$,alt:W,labels:{dialog:w(`图片预览`,`Image preview`),close:w(`关闭图片预览`,`Close image preview`)},onClose:()=>C(!1)})]})}),V=O(),H={ignored:0,untracked:1,added:2,modified:3,conflict:4},U={of:()=>void 0};function W(e){let t=new Map,n=[],r=new Map,i=(e,t)=>{let n=r.get(e);(n===void 0||H[t]>H[n])&&r.set(e,t)};for(let{path:r,state:a}of e.entries){let e=a===`deleted`?`modified`:a,o=r.endsWith(`/`),s=o?r.slice(0,-1):r;if(o?n.push([s,e]):a!==`deleted`&&t.set(s,e),e===`ignored`)continue;let c=s.split(`/`);for(let t=1;t<c.length;t++)i(c.slice(0,t).join(`/`),e)}return{of(e){let i=t.get(e);if(i)return i;for(let[t,r]of n)if(e===t||e.startsWith(`${t}/`))return r;return r.get(e)}}}var te=(e,t)=>({modified:t(`已修改`,`Modified`),added:t(`已添加`,`Added`),untracked:t(`未跟踪`,`Untracked`),conflict:t(`有冲突`,`Conflict`),ignored:t(`已忽略`,`Ignored`)})[e];function ne({size:e,className:t}){return(0,F.jsxs)(`svg`,{width:e,height:e,className:t,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:[(0,F.jsx)(`path`,{d:`M2.9 2.26h2.3c.55 0 1.06.27 1.37.73l.46.7c.15.23.41.37.69.37h4.58a1.95 1.95 0 0 1 1.95 1.95v5.83a1.95 1.95 0 0 1-1.95 1.95H2.9A1.95 1.95 0 0 1 .95 11.84V4.21A1.95 1.95 0 0 1 2.9 2.26Z`,fill:`currentColor`,fillOpacity:`.2`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinejoin:`round`}),(0,F.jsx)(`path`,{d:`M1.2 6.45h13.6`,stroke:`currentColor`,strokeWidth:`1.3`})]})}function G({target:e,label:t,onDismiss:r,onSelect:i}){let a=(0,A.useRef)(null),o=(0,A.useRef)(null),[s,c]=(0,A.useState)({top:0,left:0});(0,A.useLayoutEffect)(()=>{let t=a.current;c({left:Math.max(8,Math.min(e.x,window.innerWidth-t.offsetWidth-8)),top:Math.max(8,Math.min(e.y,window.innerHeight-t.offsetHeight-8))}),o.current?.focus({preventScroll:!0});let n=e=>{t.contains(e.target)||r()},i=()=>{r(),e.anchor.focus({preventScroll:!0})};return document.addEventListener(`pointerdown`,n,!0),window.addEventListener(`resize`,i),window.addEventListener(`scroll`,i,!0),()=>{document.removeEventListener(`pointerdown`,n,!0),window.removeEventListener(`resize`,i),window.removeEventListener(`scroll`,i,!0)}},[e,r]);let l=()=>{r(),e.anchor.focus({preventScroll:!0})};return(0,V.createPortal)((0,F.jsx)(b,{ref:a,role:`menu`,"aria-label":e.anchor.getAttribute(`aria-label`)??t,"data-file-tree-context-menu":``,className:S.fileMenu,style:s,onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),l()):e.key===`Tab`&&l()},children:(0,F.jsxs)(`button`,{ref:o,type:`button`,role:`menuitem`,className:S.fileMenuItem,onClick:()=>{l(),i()},children:[(0,F.jsx)(n,{}),t]})}),document.body)}function K({path:e,depth:t,tree:r,showMenu:i}){let[a,o]=(0,A.useState)(()=>r.levels.get(e)),[s,c]=(0,A.useState)(!0),[l,u]=(0,A.useState)(!1),[d,f]=(0,A.useState)(0);(0,A.useEffect)(()=>{let t=new AbortController;return c(!0),u(!1),P.list(r.sessionId,e,t.signal).then(n=>{t.signal.aborted||(r.levels.set(e,n),o(n),c(!1))}).catch(()=>{t.signal.aborted||(u(!0),c(!1))}),()=>t.abort()},[r.sessionId,r.levels,e,r.revision,d]);let p=r.compact?14:16,m=r.status??U;return(0,F.jsxs)(F.Fragment,{children:[s&&!a&&(0,F.jsx)(`li`,{role:`none`,className:S.state,"aria-live":`polite`,children:w(`正在读取…`,`Reading…`)}),l&&(0,F.jsxs)(`li`,{role:`none`,className:S.state,children:[(0,F.jsx)(`span`,{role:`status`,children:w(`目录读取失败,可能已移动、删除或无权访问。`,`Could not read this directory. It may have moved, been deleted, or be inaccessible.`)}),` `,(0,F.jsx)(`button`,{type:`button`,className:S.textButton,onClick:()=>f(e=>e+1),children:w(`重试`,`Retry`)})]}),!s&&!l&&a?.entries.length===0&&(0,F.jsx)(`li`,{role:`none`,className:S.state,children:w(`空目录`,`Empty directory`)}),a?.entries.map(e=>{let a=e.kind===`directory`,o=a&&r.expanded.has(e.path),s=e.kind===`other`,c=m.of(e.path);return(0,F.jsxs)(`li`,{role:`treeitem`,tabIndex:s?-1:0,"aria-label":e.name,"aria-level":t,"aria-expanded":a?o:void 0,"aria-disabled":s||void 0,"aria-haspopup":i&&!s?`menu`:void 0,"aria-description":c&&te(c,w),"data-git-status":c,"aria-selected":s?void 0:a?r.selectDirectory?e.path===r.selectedDirectory:void 0:e.path===r.selected,"data-files-path":e.path,children:[(0,F.jsxs)(`div`,{className:S.row,style:{paddingInlineStart:`${(r.compact?8:10)+(t-1)*(r.compact?12:14)}px`},title:s?w(`此条目不可访问或位于工作区之外`,`This entry is unavailable or outside the workspace`):e.path,onContextMenu:i&&!s?t=>{t.preventDefault(),t.stopPropagation();let n=t.currentTarget.parentElement,{left:r,bottom:o}=t.currentTarget.getBoundingClientRect(),s=t.clientX!==0||t.clientY!==0;i({anchor:n,path:e.path,kind:a?`directory`:`file`,x:s?t.clientX:r,y:s?t.clientY:o})}:void 0,onClick:t=>{s||(t.currentTarget.parentElement?.focus(),a?(r.toggle(e.path),r.selectDirectory?.(e.path)):r.open(e.path))},children:[a?o?(0,F.jsx)(n,{size:p,className:S.folderIcon}):(0,F.jsx)(ne,{size:p,className:S.folderIcon}):(0,F.jsx)(x,{path:e.name,size:p}),(0,F.jsx)(`span`,{className:S.name,children:e.name}),c&&c!==`ignored`&&(0,F.jsx)(`span`,{className:S.statusDot,"aria-hidden":`true`})]}),o&&(0,F.jsx)(`ul`,{role:`group`,className:S.level,children:(0,F.jsx)(K,{path:e.path,depth:t+1,tree:r,showMenu:i})})]},e.path)}),a?.truncated&&(0,F.jsx)(`li`,{role:`none`,className:S.state,children:w(`条目太多,只显示前 1000 项。`,`Too many entries. Showing the first 1,000.`)})]})}function q({root:e,label:t,...n}){let{toggle:r,open:i,sessionId:a}=n,o=c(),[s,l]=(0,A.useState)(null),u=(0,A.useRef)(()=>l(null)).current,p=s?.sessionId===a&&s.root===e?s:null,m=o?t=>l({...t,sessionId:a,root:e}):void 0;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`ul`,{role:`tree`,"aria-label":t,className:S.tree,onKeyDown:e=>{let t=e.target;if(t.getAttribute(`role`)!==`treeitem`||t.getAttribute(`aria-disabled`)===`true`)return;let a=t.dataset.filesPath,o=t.hasAttribute(`aria-expanded`),s=t.getAttribute(`aria-expanded`)===`true`;if(m&&(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`)){e.preventDefault(),e.stopPropagation();let{left:n,bottom:r}=t.firstElementChild.getBoundingClientRect();m({anchor:t,path:a,kind:o?`directory`:`file`,x:n,y:r});return}let c=[...e.currentTarget.querySelectorAll(`[role="treeitem"]:not([aria-disabled="true"])`)],l=c.indexOf(t),u;switch(e.key){case`ArrowDown`:u=c[l+1];break;case`ArrowUp`:u=c[l-1];break;case`Home`:u=c[0];break;case`End`:u=c.at(-1);break;case`ArrowRight`:o&&!s?r(a):s&&(u=c[l+1]);break;case`ArrowLeft`:s?r(a):u=t.parentElement?.closest(`[role="treeitem"]`)??void 0;break;case`Enter`:case` `:o?(r(a),n.selectDirectory?.(a)):i(a);break;default:return}e.preventDefault(),e.stopPropagation(),u?.focus()},children:(0,F.jsx)(K,{path:e,depth:1,tree:n,showMenu:m})}),o&&p&&(0,F.jsx)(G,{target:p,label:f(o.platform,p.kind),onDismiss:u,onSelect:()=>{d(o,{sessionId:a,path:p.path,kind:p.kind})}})]})}var J=4,Y=8,re=360;function X(e,t){let n=t?.split(`/`).slice(0,-1)??[],r=n.map((e,t)=>n.slice(0,t+1).join(`/`));return new Set(r.filter(t=>e===``||t.startsWith(`${e}/`)))}function Z({anchor:e,segment:t,sessionId:n,levels:r,selected:i,onOpen:a,onDismiss:o,onSelectDirectory:s}){let c=(0,A.useRef)(null),[l,u]=(0,A.useState)(()=>X(t.path,i)),[d,f]=(0,A.useState)();(0,A.useLayoutEffect)(()=>{let t=c.current,n=e.getBoundingClientRect(),r=n.bottom+J,i=Math.max(Y,Math.min(n.left,window.innerWidth-t.offsetWidth-Y));f({top:r,left:i,maxHeight:Math.min(re,Math.max(160,window.innerHeight-r-Y))}),y(t)},[e]),(0,A.useEffect)(()=>{let t=t=>{t.target instanceof Node&&(c.current?.contains(t.target)||e.contains(t.target))||t.target instanceof Element&&t.target.closest(`[data-file-tree-context-menu]`)||o()},n=t=>{if(t.key!==`Escape`||t.isComposing||t.defaultPrevented||t.ctrlKey||t.altKey||t.metaKey||t.shiftKey||t.target instanceof Element&&t.target.closest(`[data-file-tree-context-menu]`))return;t.preventDefault(),t.stopPropagation();let n=c.current?.contains(document.activeElement)||document.activeElement===document.body||document.activeElement===e;o(),n&&y(e)};return window.addEventListener(`pointerdown`,t,!0),window.addEventListener(`resize`,o),document.addEventListener(`keydown`,n,!0),()=>{window.removeEventListener(`pointerdown`,t,!0),window.removeEventListener(`resize`,o),document.removeEventListener(`keydown`,n,!0)}},[e,o]);let p=e=>u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),m=w(`${t.name} 中的文件`,`Files in ${t.name}`),{maxHeight:h,...g}=d??{visibility:`hidden`,top:0,left:0};return(0,V.createPortal)((0,F.jsx)(b,{ref:c,role:`dialog`,"aria-label":m,tabIndex:-1,className:S.crumbMenu,style:g,onKeyDown:e=>{e.target===c.current&&e.key===`ArrowDown`&&(e.preventDefault(),c.current.querySelector(`[role="treeitem"]:not([aria-disabled="true"])`)?.focus())},children:(0,F.jsx)(`div`,{className:S.crumbMenuScroll,style:{maxHeight:h},children:(0,F.jsx)(q,{root:t.path,label:m,sessionId:n,levels:r,revision:0,compact:!0,expanded:l,selected:i,toggle:p,open:e=>{o(),a(e)},selectDirectory:s&&(e=>{o(),s(e)})})})}),document.body)}function Q({sessionId:e,cwd:t,path:n,directory:r,levels:i,onOpen:a,onSelectDirectory:o}){let[s,c]=(0,A.useState)(null),l=`${e}\0${t}\0${r?`dir`:`file`}\0${n??``}`,u=s?.target===l?s:null,d=n?n.split(`/`):[],f=r?void 0:d.at(-1),p=[{name:t.split(/[\\/]/u).filter(Boolean).at(-1)??t,path:``,title:t},...(r?d:d.slice(0,-1)).map((e,t)=>{let n=d.slice(0,t+1).join(`/`);return{name:e,path:n,title:n}})],m=(0,A.useRef)(()=>c(null)).current;return(0,F.jsxs)(`nav`,{className:S.crumbs,"aria-label":w(`文件路径`,`File path`),children:[(0,F.jsxs)(`ol`,{children:[p.map((e,t)=>(0,F.jsxs)(`li`,{children:[t>0&&(0,F.jsx)(`span`,{className:S.crumbSeparator,"aria-hidden":`true`,children:`/`}),(0,F.jsx)(`button`,{type:`button`,className:S.crumb,title:e.title,"aria-haspopup":`dialog`,"aria-expanded":u?.segment.path===e.path,onClick:t=>{let n=t.currentTarget;c(t=>t?.target===l&&t.segment.path===e.path?null:{segment:e,anchor:n,target:l})},children:e.name})]},e.path)),f&&(0,F.jsxs)(`li`,{className:S.crumbFile,children:[(0,F.jsx)(`span`,{className:S.crumbSeparator,"aria-hidden":`true`,children:`/`}),(0,F.jsx)(`span`,{className:S.crumbCurrent,title:n,"aria-current":`page`,children:f})]})]}),u&&(0,F.jsx)(Z,{anchor:u.anchor,segment:u.segment,sessionId:e,levels:i,selected:n,onOpen:a,onDismiss:m},u.segment.path)]})}var $=`file-manager`;function ie({kind:e,path:t}){let n=t.split(`/`).at(-1)??``,r=n.lastIndexOf(`.`);return`pi-web-open-with:${e===`directory`?`directory`:`file:${r>0?n.slice(r).toLowerCase():``}`}`}function ae(e){try{return localStorage.getItem(e)}catch{return null}}function oe({app:e}){return e.icon?(0,F.jsx)(`img`,{className:S.openWithIcon,src:e.icon,alt:``}):e.id===$?(0,F.jsx)(s,{className:S.openWithIcon}):(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`${S.openWithIcon} ${S.openWithInitial}`,children:Array.from(e.name)[0]})}function se({sessionId:e,path:t,kind:n}){let r=v();return r?(0,F.jsx)(ce,{target:{sessionId:e,path:t,kind:n},bridge:r},JSON.stringify([e,t,n])):null}function ce({target:e,bridge:t}){let{sessionId:n,path:i,kind:a}=e,o=ie(e),[s,c]=(0,A.useState)(()=>ae(o)),[l,u]=(0,A.useState)([]),[d,m]=(0,A.useState)(!0),[h,g]=(0,A.useState)(!1),[_,v]=(0,A.useState)(!1),[y,x]=(0,A.useState)(!1),[C,T]=(0,A.useState)(0),[E,D]=(0,A.useState)({top:0,left:0}),O=(0,A.useRef)(null),k=(0,A.useRef)(null),j=(0,A.useRef)(null),{listApps:M}=t;(0,A.useEffect)(()=>{let e=!1;return m(!0),g(!1),M({sessionId:n,path:i,kind:a}).then(t=>{e||(u(t.ok?t.apps:[]),g(!t.ok))}).catch(()=>{e||(u([]),g(!0))}).finally(()=>{e||m(!1)}),()=>{e=!0}},[M,n,i,a,C]);let N={id:$,name:f(t.platform,a)},P=[...l,N],I=P.find(e=>e.id===s)??(a===`directory`?N:l.find(e=>e.isDefault)??N),L=async()=>{if(!_){v(!0);try{let n=I.id===$?await t.show(e):await t.openWith(e,I.id);n.ok||(p(n.reason,!0),T(e=>e+1))}catch{p(`failed`,!0)}finally{v(!1)}}},R=()=>{x(!1),k.current?.focus({preventScroll:!0})},z=e=>{c(e);try{localStorage.setItem(o,e)}catch{}R()},ee=()=>[...j.current?.querySelectorAll(`[role=menuitemradio]`)??[]];(0,A.useLayoutEffect)(()=>{if(!y||!O.current||!j.current)return;let e=()=>{let e=O.current?.getBoundingClientRect(),t=j.current;if(!e||!t)return;let n=e.bottom+4,r=t.offsetHeight;D({left:Math.max(8,Math.min(e.right-t.offsetWidth,window.innerWidth-t.offsetWidth-8)),top:n+r>window.innerHeight-8?Math.max(8,e.top-r-4):n})};e();let t=new ResizeObserver(e);t.observe(j.current),(j.current.querySelector(`[aria-checked="true"]`)??j.current)?.focus({preventScroll:!0});let n=e=>{!j.current?.contains(e.target)&&!O.current?.contains(e.target)&&x(!1)},r=()=>{x(!1),k.current?.focus({preventScroll:!0})};return document.addEventListener(`pointerdown`,n,!0),window.addEventListener(`resize`,r),()=>{t.disconnect(),document.removeEventListener(`pointerdown`,n,!0),window.removeEventListener(`resize`,r)}},[y]);let B=w(`选择打开方式`,`Choose an app to open with`),H=w(`打开`,`Open`);return(0,F.jsxs)(`div`,{ref:O,className:S.openWith,"aria-busy":d||_,children:[(0,F.jsxs)(`button`,{type:`button`,className:`${S.textButton} ${S.openWithMain}`,"aria-label":I.id===$?I.name:w(`用 ${I.name} 打开`,`Open with ${I.name}`),title:I.name,disabled:_||d&&(a===`file`||!!s),onClick:()=>{x(!1),L()},children:[(0,F.jsx)(oe,{app:I}),(0,F.jsx)(`span`,{className:S.openWithText,children:H})]}),(0,F.jsx)(`button`,{ref:k,type:`button`,className:`${S.iconButton} ${S.openWithChevron}`,"aria-label":B,title:B,"aria-haspopup":`menu`,"aria-expanded":y,onClick:()=>y?R():x(!0),onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),x(!0))},children:(0,F.jsx)(r,{})}),y&&(0,V.createPortal)((0,F.jsx)(b,{ref:j,role:`menu`,tabIndex:-1,"aria-label":B,className:`${S.fileMenu} ${S.openWithMenu}`,style:E,onKeyDown:e=>{if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),R();else if(e.key===`Tab`)R();else if([`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)){e.preventDefault(),e.stopPropagation();let t=ee(),n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowUp`?n<=0?t.length-1:n-1:(n+1)%t.length]?.focus()}},children:(0,F.jsxs)(`div`,{className:S.openWithMenuBody,children:[d&&(0,F.jsx)(`p`,{className:S.openWithHint,role:`status`,children:w(`正在查找可用应用…`,`Finding installed apps…`)}),h&&(0,F.jsx)(`p`,{className:S.openWithHint,role:`status`,children:w(`未能读取系统应用`,`Could not load system apps`)}),P.map(e=>(0,F.jsxs)(`div`,{role:`none`,children:[e.id===$&&l.length>0&&(0,F.jsx)(`div`,{role:`separator`,className:S.openWithSeparator}),(0,F.jsxs)(`button`,{type:`button`,role:`menuitemradio`,tabIndex:-1,"aria-checked":I.id===e.id,className:S.fileMenuItem,onClick:()=>z(e.id),children:[(0,F.jsx)(oe,{app:e}),(0,F.jsx)(`span`,{className:S.openWithName,children:e.name}),e.isDefault&&(0,F.jsx)(`span`,{className:S.openWithDefault,children:w(`默认`,`Default`)}),(0,F.jsx)(`span`,{className:S.openWithCheck,"aria-hidden":`true`,children:I.id===e.id?`✓`:``})]})]},e.id))]})}),document.body)]})}function le(e){return e.startsWith(`?`)?{mode:`content`,text:e.slice(1).trim()}:{mode:`name`,text:e.trim()}}function ue(e,t){let n=e.toLowerCase().indexOf(t.toLowerCase());return!t||n<0?e:(0,F.jsxs)(F.Fragment,{children:[e.slice(0,n),(0,F.jsx)(`mark`,{className:S.match,children:e.slice(n,n+t.length)}),e.slice(n+t.length)]})}function de(e,t){if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let n=[...e.currentTarget.querySelectorAll(`button[data-search-result]`)],r=n.indexOf(document.activeElement),i=e.key===`ArrowDown`?n[r+1]:r<=0?t:n[r-1];i&&(e.preventDefault(),i.focus())}function fe({sessionId:e,query:t,input:n,onOpen:r}){let{mode:i,text:a}=le(t),[o,s]=(0,A.useState)(null),[c,l]=(0,A.useState)(`idle`);if((0,A.useEffect)(()=>{if(!a||i===`content`&&a.length<2){s(null),l(`idle`);return}let t=new AbortController;l(`loading`);let n=window.setTimeout(()=>{P.search(e,a,i,t.signal).then(e=>{t.signal.aborted||(s(e),l(`idle`))}).catch(()=>{t.signal.aborted||l(`error`)})},i===`content`?300:150);return()=>{t.abort(),window.clearTimeout(n)}},[e,i,a]),!a||i===`content`&&a.length<2)return i===`content`?(0,F.jsx)(`p`,{className:S.state,children:w(`输入至少 2 个字符,在文件内容中搜索。`,`Type at least 2 characters to search file contents.`)}):null;if(c===`error`)return(0,F.jsx)(`p`,{className:S.state,role:`status`,children:w(`搜索失败,请重试。`,`Search failed. Try again.`)});if(!o||o.kind!==i)return(0,F.jsx)(`p`,{className:S.state,role:`status`,children:w(`正在搜索…`,`Searching…`)});if(!o.results.length)return(0,F.jsx)(`p`,{className:S.state,role:`status`,children:w(`没有匹配的结果。`,`No matches.`)});let u=o.truncated&&(0,F.jsx)(`p`,{className:S.state,children:w(`结果太多,只显示一部分。请输入更具体的内容。`,`Showing some results only. Type something more specific.`)});if(o.kind===`name`)return(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`ul`,{className:S.results,"aria-label":w(`匹配的文件`,`Matching files`),onKeyDown:e=>de(e,n),children:o.results.map(({path:e})=>{let t=e.lastIndexOf(`/`);return(0,F.jsx)(`li`,{children:(0,F.jsxs)(`button`,{type:`button`,"data-search-result":!0,className:S.result,title:e,onClick:()=>r(e),children:[(0,F.jsx)(x,{path:e,size:16}),(0,F.jsx)(`span`,{className:S.name,children:ue(e.slice(t+1),a)}),t>0&&(0,F.jsx)(`span`,{className:S.resultDirectory,children:e.slice(0,t)})]})},e)})}),u]});let d=new Map;for(let e of o.results)d.set(e.path,[...d.get(e.path)??[],e]);return(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`ul`,{className:S.results,"aria-label":w(`内容匹配`,`Content matches`),onKeyDown:e=>de(e,n),children:[...d].map(([e,t])=>(0,F.jsxs)(`li`,{children:[(0,F.jsxs)(`div`,{className:S.resultFile,title:e,children:[(0,F.jsx)(x,{path:e,size:14}),(0,F.jsx)(`span`,{className:S.name,children:e}),(0,F.jsx)(`span`,{className:S.resultCount,children:t.length})]}),(0,F.jsx)(`ul`,{children:t.map(t=>(0,F.jsx)(`li`,{children:(0,F.jsxs)(`button`,{type:`button`,"data-search-result":!0,className:S.resultLine,"aria-label":w(`${e} 第 ${t.line} 行:${t.text}`,`${e} line ${t.line}: ${t.text}`),onClick:()=>r(e,t.line),children:[(0,F.jsx)(`span`,{className:S.lineNumber,children:t.line}),(0,F.jsx)(`span`,{className:S.lineText,children:ue(t.text,a)})]})},t.line))})]},e))}),u]})}var pe=()=>({expanded:new Set,levels:new Map,scrollTop:0,selected:null,treeOpen:!0,query:``,status:U}),me=420;function he(e,t,n){let[r,i]=(0,A.useState)(null);return(0,A.useEffect)(()=>{i(null)},[t]),(0,A.useEffect)(()=>{n?.(j(e,t,r))},[n,e,t,r]),(0,A.useEffect)(()=>()=>n?.(null),[n]),(0,A.useCallback)(e=>i(t=>t?.from===e?.from&&t?.to===e?.to?t:e),[])}function ge({open:e,controls:t,onToggle:n}){let r=e?w(`隐藏文件目录`,`Hide file tree`):w(`显示文件目录`,`Show file tree`);return(0,F.jsx)(`button`,{type:`button`,className:`${S.iconButton} ${S.treeToggle}`,"aria-label":r,title:r,"aria-expanded":e,"aria-controls":t,onClick:n,children:(0,F.jsx)(i,{})})}var _e=(0,A.memo)(function({sessionId:e,cwd:n,idle:r,state:i,renderMarkdown:o,reportContext:s}){let[c,l]=(0,A.useState)(()=>new Set(i.expanded)),[u,d]=(0,A.useState)(()=>i.selected),[f,p]=(0,A.useState)(),m=!!v(),g=m&&f?.sessionId===e?f.path:void 0,_=m?t=>p({sessionId:e,path:t}):void 0,[y,b]=(0,A.useState)(i.treeOpen),[x,C]=(0,A.useState)(0),[T,E]=(0,A.useState)(!1),[D,O]=(0,A.useState)(i.query),[k,j]=(0,A.useState)(i.status),[M,N]=(0,A.useState)(),[I,L]=(0,A.useState)(null),R=(0,A.useRef)(null),z=(0,A.useRef)(!1),ee=(0,A.useCallback)(e=>{z.current=e},[]),V=(0,A.useRef)(null),H=(0,A.useCallback)(()=>{V.current?.abort();let t=new AbortController;V.current=t,P.status(e,t.signal).then(e=>{if(t.signal.aborted)return;let n=W(e);i.status=n,j(n)}).catch(()=>{})},[e,i]);(0,A.useEffect)(()=>(H(),()=>V.current?.abort()),[H]);let U=(0,A.useCallback)(()=>{C(e=>e+1),H()},[H]),te=(0,A.useRef)(r);(0,A.useEffect)(()=>{r&&!te.current&&U(),te.current=r},[r,U]);let ne=H,G=e=>{i.query=e,O(e)},K=`files-tree-${e}`,J=u?.cwd===n?u.path:void 0,Y=he(n,g===void 0?J:void 0,s),re=(0,A.useCallback)(e=>{e&&(e.scrollTop=i.scrollTop)},[i]);(0,A.useLayoutEffect)(()=>{let e=R.current;if(!e)return;let t=()=>E(e.clientWidth<me);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let X=e=>l(t=>{let n=e(t);return i.expanded=n,n}),Z=e=>X(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),$=e=>{i.treeOpen=e,b(e)},ie=(e,t)=>{if(e!==J&&z.current&&!window.confirm(w(`放弃未保存的更改?`,`Discard unsaved changes?`)))return;p(void 0),N(t?{line:t}:void 0);let r={cwd:n,path:e};i.selected=r,d(r);let a=e.split(`/`).slice(0,-1);a.length&&X(e=>{let t=a.map((e,t)=>a.slice(0,t+1).join(`/`));return t.every(t=>e.has(t))?e:new Set([...e,...t])}),T&&$(!1)},ae=(t,r=!1)=>(0,F.jsx)(Q,{sessionId:e,cwd:n,path:t,directory:r,levels:i.levels,onOpen:ie,onSelectDirectory:_}),oe=!y&&(0,F.jsx)(ge,{open:!1,controls:K,onToggle:()=>$(!0)}),ce=t=>(0,F.jsxs)(F.Fragment,{children:[ae(t,!0),(0,F.jsx)(se,{sessionId:e,path:t,kind:`directory`})]});return(0,F.jsxs)(`div`,{ref:R,className:S.files,"data-narrow":T||void 0,"data-tree-open":y||void 0,children:[(0,F.jsxs)(`div`,{className:S.filesMain,children:[J&&(0,F.jsx)(`div`,{className:S.body,hidden:g!==void 0,children:(0,F.jsx)(B,{sessionId:e,path:J,renderMarkdown:o,breadcrumb:ae(J),trailing:(0,F.jsxs)(F.Fragment,{children:[g===void 0&&(0,F.jsx)(se,{sessionId:e,path:J,kind:`file`}),oe]}),refresh:x,reveal:M,onDirtyChange:ee,onSaved:ne,onSelection:Y},J)}),(!J||g!==void 0)&&(0,F.jsxs)(`div`,{className:S.body,children:[(0,F.jsxs)(`div`,{className:S.toolbar,children:[m&&!(T&&y)?ce(g??``):ae(g,g!==void 0),oe]}),(0,F.jsxs)(`div`,{className:S.emptyFile,children:[(0,F.jsx)(h,{size:28,className:S.emptyFileIcon}),(0,F.jsx)(`p`,{className:S.emptyFileTitle,children:g===void 0?w(`打开的文件显示在这里`,`Open files appear here`):g.split(`/`).at(-1)}),(0,F.jsx)(`p`,{className:S.emptyFileHint,children:w(`请在目录树中选择一个文件,或在对话中点击文件路径。`,`Choose a file in the tree, or click a file path in the chat.`)})]})]})]}),y&&(0,F.jsxs)(`aside`,{id:K,className:S.filesSide,"aria-label":w(`文件目录`,`File tree`),children:[m&&T&&(0,F.jsx)(`div`,{className:S.toolbar,children:ce(g??``)}),(0,F.jsxs)(`div`,{className:S.toolbar,children:[(0,F.jsxs)(`label`,{className:S.search,title:n,children:[(0,F.jsx)(a,{}),(0,F.jsx)(`input`,{ref:L,type:`search`,value:D,placeholder:w(`筛选,或输入 ? 在文件中搜索`,`Filter, or type ? to search in files`),"aria-label":w(`筛选文件,或以 ? 开头在文件内容中搜索`,`Filter files, or start with ? to search file contents`),onChange:e=>G(e.target.value),onKeyDown:e=>{if(e.key===`Escape`&&D)e.preventDefault(),e.stopPropagation(),G(``);else if(e.key===`Enter`||e.key===`ArrowDown`){let t=e.currentTarget.closest(`aside`)?.querySelector(`button[data-search-result]`);if(!t)return;e.preventDefault(),e.key===`Enter`?t.click():t.focus()}}})]}),(0,F.jsx)(`button`,{type:`button`,className:S.iconButton,"aria-label":w(`重新读取文件列表`,`Reload files`),title:w(`重新读取文件列表`,`Reload files`),onClick:U,children:(0,F.jsx)(t,{})}),(0,F.jsx)(ge,{open:!0,controls:K,onToggle:()=>$(!1)})]}),D.trim()?(0,F.jsx)(`div`,{className:S.scroll,children:(0,F.jsx)(fe,{sessionId:e,query:D,input:I,onOpen:ie},x)}):(0,F.jsx)(`div`,{ref:re,className:S.scroll,onScroll:e=>{i.scrollTop=e.currentTarget.scrollTop},children:(0,F.jsx)(q,{root:``,label:w(`工作区文件`,`Workspace files`),sessionId:e,levels:i.levels,revision:x,expanded:c,selected:g===void 0?J:void 0,selectedDirectory:g,selectDirectory:_,status:k,toggle:Z,open:ie})})]})]})});function ve({sessionId:e,cwd:t,path:n,levels:r,renderMarkdown:i,open:a,reportContext:o}){let s=he(t,n,o),c=(0,A.useRef)(a);(0,A.useLayoutEffect)(()=>{c.current=a});let l=(0,A.useCallback)(e=>c.current(e),[]),u=(0,A.useMemo)(()=>(0,F.jsx)(Q,{sessionId:e,cwd:t,path:n,levels:r,onOpen:l}),[e,t,n,r,l]);return(0,F.jsx)(B,{sessionId:e,path:n,renderMarkdown:i,breadcrumb:u,trailing:(0,F.jsx)(se,{sessionId:e,path:n,kind:`file`}),onSelection:s})}var ye=g({id:k.id,apiVersion:1,activate(){},workbench:{apiVersion:1,entry:{category:`workspace`,label:k.name,panelTitle:{zh:`文件`,en:`Files`},description:{zh:`浏览和预览文件`,en:`Browse and preview files`},kind:`files`,icon:({size:e})=>(0,F.jsx)(x,{kind:`folder`,size:e})},panels:[{kind:`files`,component:e=>(0,F.jsx)(_e,{sessionId:e.session.sessionId,cwd:e.session.cwd,idle:e.session.idle,state:e.resource(pe),renderMarkdown:e.renderMarkdown,reportContext:e.reportContext})},{kind:`file-preview`,title:(e,t)=>(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(x,{path:e,size:16}),(0,F.jsx)(`span`,{children:t})]}),component:e=>(0,F.jsx)(ve,{sessionId:e.session.sessionId,cwd:e.session.cwd,path:e.contentId,renderMarkdown:e.renderMarkdown,levels:e.resource(()=>new Map),open:t=>e.open(`file-preview`,t,t.split(`/`).at(-1)),reportContext:e.reportContext})}]}});export{ye as default};
6
+ //# debugId=5e9c0e82-e4ac-44e5-b2e1-8014def94b0f
@@ -1,4 +1,4 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`6773b61f-6273-4318-878e-d3fcfd1521e4`,e._sentryDebugIdIdentifier=`sentry-dbid-6773b61f-6273-4318-878e-d3fcfd1521e4`)}catch{}})();import{r as e}from"./rolldown-runtime-CgmABjMJ.js";import{M as t,N as n,c as r,i,l as a,s as o,u as s,w as c,x as l,y as u}from"./app-CAQ6FgWC.js";import{t as d}from"./react-CLFE7TFE.js";import{c as f,i as p,o as m,r as h,t as g}from"./WorkspacePanel.module-CZiYvGfi.js";import{a as _,n as v}from"./preference-CKBoM0dZ.js";import{s as y}from"./app.js";import{n as b}from"./clsx-DQAHfk8w.js";var x=e(d(),1);function S(e){let t={stage:[`已暂存文件。`,`File staged.`],unstage:[`已取消暂存,工作区内容保留。`,`File unstaged. Working content preserved.`],commit:[`提交成功。`,`Commit created.`],"create-branch":[`分支已创建。`,`Branch created.`],"switch-branch":[`已切换分支。`,`Branch switched.`],state_changed:[`仓库状态已变化,已刷新;请检查后重新操作。`,`Repository changed. Review the refreshed state before trying again.`],busy:[`Git 操作正在进行,请稍后刷新。`,`A Git operation is in progress. Refresh shortly.`],agent_busy:[`共用此工作树的聊天正在运行,请等待回复结束。`,`A chat sharing this working tree is running. Wait for it to finish.`],session_changed:[`聊天已切换,请返回原聊天检查仓库状态。`,`Chat switched. Return to the original chat to check the repository.`],root_required:[`提交和切换分支请在仓库根目录工作区操作。`,`Open the repository root workspace to commit or switch branches.`],operation_in_progress:[`请先在终端完成冲突处理或正在进行的 Git 操作。`,`Finish conflict resolution or the ongoing Git operation in the terminal first.`],index_locked:[`Git 锁被占用,请等待其他 Git 操作完成。`,`Git is locked. Wait for other Git operations to finish.`],too_many_changes:[`仓库改动或分支过多,请在终端操作。`,`Too many changes or branches. Use the terminal for this operation.`],dirty_worktree:[`切换分支前请先提交或处理全部改动,包括未跟踪文件。`,`Commit or resolve all changes, including untracked files, before switching branches.`],nothing_staged:[`请先暂存要提交的文件。`,`Stage files before committing.`],identity_missing:[`请先在终端配置 Git user.name 和 user.email。`,`Configure Git user.name and user.email in the terminal first.`],invalid_branch:[`分支名称无效,请检查后重试。`,`Invalid branch name. Check the name and try again.`],branch_exists:[`同名分支已存在。`,`A branch with this name already exists.`],branch_in_use:[`该分支正在其他工作树中使用。`,`This branch is checked out in another worktree.`],no_commits:[`创建分支前请先完成首次提交。`,`Create an initial commit before creating a branch.`],invalid_path:[`该文件不支持此操作,请刷新检查。`,`This file cannot be changed here. Refresh and check it.`],invalid_message:[`请填写提交说明(最多 8 KB)。`,`Enter a commit message (up to 8 KB).`],git_failed:[`Git 操作失败。请检查仓库、身份、签名或 hooks 配置,再刷新确认。`,`Git operation failed. Check repository, identity, signing or hooks configuration, then refresh.`],outcome_unknown:[`未能确认操作结果。请刷新检查暂存区、历史和分支,确认前不要重复提交。`,`Operation outcome is unknown. Refresh and check staging, history and branches before repeating it.`]},n=t[e]??t.git_failed;return v(...n)}async function C(e,t,n,i){return r(await o(`/api/workspace/git/${e}`,{method:`POST`,headers:{Authorization:`Bearer ${y()}`,"Content-Type":`application/json`},body:JSON.stringify({sessionId:t,...n}),signal:i}))}var w={control:(e,t)=>C(`control`,e,{},t),write:(e,t)=>C(`write`,e,t),status:(e,t)=>C(`status`,e,{},t),diff:(e,t,n,r)=>C(`diff`,e,{path:t,area:n},r),history:(e,t,n)=>C(`history`,e,{cursor:t},n),commit:(e,t,n,r)=>C(`commit-detail`,e,{hash:t,parentIndex:n},r),commitDiff:(e,t,n,r,i)=>C(`commit-diff`,e,{hash:t,path:n,parentIndex:r},i)};function T(e,t,n,r=!0){let[i,a]=(0,x.useState)(null),[o,s]=(0,x.useState)(!0),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(0),f=(0,x.useCallback)(()=>{s(!0),d(e=>e+1)},[]);return(0,x.useEffect)(()=>{if(!t)return;let n=!1,i=!1,o=!1,c=new AbortController,u=async()=>{if(!(n||document.visibilityState===`hidden`)){if(i)o=!0;else{i=!0,s(!0);try{let t=await e(c.signal);n||(a(e=>JSON.stringify(e)===JSON.stringify(t)?e:t),l(!1))}catch{n||l(!0)}finally{i=!1,n||(s(!1),o&&(o=!1,u()))}}}};u();let d=r?window.setInterval(()=>{u()},5e3):void 0,f=()=>{u()};return window.addEventListener(`focus`,f),window.addEventListener(`pi-workspace-git-changed`,f),document.addEventListener(`visibilitychange`,f),()=>{n=!0,c.abort(),window.clearInterval(d),window.removeEventListener(`pi-workspace-git-changed`,f),window.removeEventListener(`focus`,f),document.removeEventListener(`visibilitychange`,f)}},[e,t,n,u,r]),{value:i,loading:o,error:c,refresh:f}}var E={panel:`_panel_1m2go_2`,viewSwitch:`_viewSwitch_1m2go_3`,viewButton:`_viewButton_1m2go_4`,repoBar:`_repoBar_1m2go_5`,branchPicker:`_branchPicker_1m2go_6`,branchTrigger:`_branchTrigger_1m2go_7`,repoName:`_repoName_1m2go_11`,divergence:`_divergence_1m2go_12`,count:`_count_1m2go_13`,scope:`_scope_1m2go_14`,changesScroll:`_changesScroll_1m2go_15`,groupHeading:`_groupHeading_1m2go_16`,list:`_list_1m2go_18`,changeRow:`_changeRow_1m2go_19`,change:`_change_1m2go_15`,diffScroll:`_diffScroll_1m2go_23`,filename:`_filename_1m2go_25`,status:`_status_1m2go_27`,added:`_added_1m2go_28`,removed:`_removed_1m2go_29`,fileAction:`_fileAction_1m2go_30`,commitFooter:`_commitFooter_1m2go_32`,commitForm:`_commitForm_1m2go_33`,rootHint:`_rootHint_1m2go_36`,actionRow:`_actionRow_1m2go_37`,hint:`_hint_1m2go_38`,feedback:`_feedback_1m2go_38`,feedbackRow:`_feedbackRow_1m2go_41`,actionButton:`_actionButton_1m2go_44`,branchPopover:`_branchPopover_1m2go_46`,pickerHeader:`_pickerHeader_1m2go_47`,branchSearch:`_branchSearch_1m2go_49`,field:`_field_1m2go_49`,branchList:`_branchList_1m2go_50`,branchOption:`_branchOption_1m2go_52`,newBranch:`_newBranch_1m2go_56`,form:`_form_1m2go_58`,checkbox:`_checkbox_1m2go_60`,diffSummary:`_diffSummary_1m2go_64`,stats:`_stats_1m2go_65`,diff:`_diff_1m2go_23`,diffLine:`_diffLine_1m2go_68`,lineNumber:`_lineNumber_1m2go_69`,lineText:`_lineText_1m2go_70`,diffHunk:`_diffHunk_1m2go_74`,diffNotice:`_diffNotice_1m2go_75`,noNewline:`_noNewline_1m2go_76`,reviewLayout:`_reviewLayout_1m2go_79`,inlinePreview:`_inlinePreview_1m2go_82`,inlineDiffToolbar:`_inlineDiffToolbar_1m2go_84`,diffIdentity:`_diffIdentity_1m2go_85`,diffDetails:`_diffDetails_1m2go_86`,diffArea:`_diffArea_1m2go_87`,diffNavigation:`_diffNavigation_1m2go_89`,diffPosition:`_diffPosition_1m2go_90`,diffViewport:`_diffViewport_1m2go_92`},D=b();function O({children:e,preview:t,selectionKey:n,onClose:r}){let i=(0,x.useRef)(null),a=!!t;return(0,x.useEffect)(()=>{a&&n&&i.current?.querySelector(`[data-git-file][aria-pressed="true"]`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[n,a]),(0,D.jsxs)(`div`,{className:E.reviewLayout,"data-preview":a,ref:i,children:[e,t&&(0,D.jsx)(`div`,{className:E.inlinePreview,role:`region`,"aria-label":v(`差异预览`,`Diff preview`),onKeyDown:e=>{e.key===`Escape`&&!e.nativeEvent.isComposing&&!e.defaultPrevented&&(e.preventDefault(),r())},children:t})]})}function k(e){return e===`staged`?v(`已暂存`,`Staged`):e===`unstaged`?v(`未暂存`,`Unstaged`):v(`未跟踪`,`Untracked`)}function A(e){let t=0,n=0,r=!1,i=e.split(`
2
- `);return i.at(-1)===``&&i.pop(),i.map(e=>{let i=e.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(e.startsWith(`diff --git `)&&(r=!1),i&&(t=Number(i[1]),n=Number(i[2]),r=!0),r&&!i){if(e.startsWith(`+`))return{kind:`add`,text:e,oldLine:null,newLine:n++};if(e.startsWith(`-`))return{kind:`remove`,text:e,oldLine:t++,newLine:null};if(e.startsWith(` `))return{kind:`context`,text:e,oldLine:t++,newLine:n++}}return{kind:`meta`,text:e,oldLine:null,newLine:null}})}function j(e){let t=[],n=[],r=[],i=null,a=``,o=``,s=``;for(let c of A(e)){if(c.kind!==`meta`){c.kind===`context`?i=null:i===null&&(i=n.length,n.push(t.length)),t.push({...c,kind:c.kind,change:i});continue}let e=c.text.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@\s?(.*)$/);if(e)i=null,t.push({kind:`hunk`,oldLine:Number(e[1]),newLine:Number(e[2]),text:e[3],change:null});else if(c.text===`\`){let e=t.at(-1);e&&e.kind!==`hunk`&&(e.noNewline=!0)}else c.text.startsWith(`diff --git `)?(i=null,a=o=s=``):c.text.startsWith(`old mode `)?a=c.text.slice(9):c.text.startsWith(`new mode `)?r.push({kind:`mode`,from:a,to:c.text.slice(9)}):c.text.startsWith(`rename from `)?o=c.text.slice(12):c.text.startsWith(`rename to `)?r.push({kind:`rename`,from:o,to:c.text.slice(10)}):c.text.startsWith(`copy from `)?s=c.text.slice(10):c.text.startsWith(`copy to `)?r.push({kind:`copy`,from:s,to:c.text.slice(8)}):c.text.startsWith(`new file mode `)?r.push({kind:`added`,from:``,to:c.text.slice(14)}):c.text.startsWith(`deleted file mode `)&&r.push({kind:`deleted`,from:c.text.slice(18),to:``})}return{lines:t,changes:n,notices:r.filter(e=>!n.length||e.kind!==`added`&&e.kind!==`deleted`)}}function M({path:e,label:t,value:r,loading:i,error:a,refresh:o,onClose:s}){let u=r?.kind===`text`?r.patch:``,d=(0,x.useMemo)(()=>j(u),[u,e]),{lines:f,changes:p,notices:m}=d,h=(0,x.useRef)(null),[_,y]=(0,x.useState)(null),b=_?.preview===d?_.index:-1;(0,x.useEffect)(()=>{h.current?.scrollTo({top:0,left:0})},[d]);let S=e=>{if(i||a||e<0||e>=p.length)return;let t=h.current,n=t?.querySelector(`[data-change="${e}"][data-change-start="true"]`);t&&n&&(t.scrollTo({top:t.scrollTop+n.getBoundingClientRect().top-t.getBoundingClientRect().top,left:t.scrollLeft}),y({preview:d,index:e}))},C=f.filter(e=>e.kind===`add`).length,w=f.filter(e=>e.kind===`remove`).length,T=r?.kind===`text`&&(0,D.jsxs)(`span`,{className:E.stats,children:[(0,D.jsxs)(`span`,{className:E.added,children:[`+`,C]}),(0,D.jsxs)(`span`,{className:E.removed,children:[`−`,w]})]}),O={empty:v(`此文件在所选范围内没有文本差异,或已不在改动列表中。`,`No text differences in this scope, or this file is no longer changed.`),binary:v(`二进制文件不支持文本差异预览。`,`Text diff is unavailable for binary files.`),"too-large":v(`差异过大,最多显示 512 KB / 10000 行。`,`Diff exceeds the preview limit of 512 KB / 10000 lines.`),unsupported:v(`此文件类型不支持差异预览。`,`Diff is unavailable for this file type.`),conflict:v(`此文件存在未解决的合并冲突,请在工作区文件或终端中检查。`,`This file has unresolved merge conflicts. Inspect it in workspace files or the terminal.`),submodule:v(`子模块已发生变化,请在子模块工作区中查看具体差异。`,`Submodule changed. Open its workspace to inspect the changes.`)};return(0,D.jsxs)(`div`,{className:g.body,children:[(0,D.jsxs)(`div`,{className:s?E.inlineDiffToolbar:g.toolbar,children:[s?(0,D.jsxs)(`div`,{className:E.diffIdentity,children:[(0,D.jsx)(`span`,{className:g.path,title:e,children:e}),(0,D.jsxs)(`div`,{className:E.diffDetails,children:[(0,D.jsx)(`span`,{className:E.diffArea,title:t,children:t}),T]})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:g.path,title:e,children:e}),(0,D.jsx)(`span`,{className:g.readonly,children:v(`只读`,`Read only`)})]}),(0,D.jsxs)(`div`,{className:E.diffNavigation,role:`group`,"aria-label":v(`改动跳转`,`Change navigation`),children:[(0,D.jsx)(`button`,{type:`button`,className:g.iconButton,"aria-label":v(`上一处改动`,`Previous change`),title:v(`上一处改动`,`Previous change`),disabled:i||a||b<=0,onClick:()=>S(b-1),children:(0,D.jsx)(c,{})}),(0,D.jsxs)(`span`,{className:E.diffPosition,role:`status`,"aria-label":v(`改动位置`,`Change position`),"aria-live":`polite`,"aria-atomic":`true`,title:v(`第 ${b+1} / ${p.length} 处改动`,`Change ${b+1} of ${p.length}`),children:[b+1,`/`,p.length]}),(0,D.jsx)(`button`,{type:`button`,className:g.iconButton,"aria-label":v(`下一处改动`,`Next change`),title:v(`下一处改动`,`Next change`),disabled:i||a||b+1>=p.length,onClick:()=>S(b+1),children:(0,D.jsx)(l,{})})]}),(0,D.jsx)(`button`,{type:`button`,className:g.iconButton,"aria-label":v(`刷新差异`,`Refresh diff`),title:v(`刷新差异`,`Refresh diff`),onClick:o,children:(0,D.jsx)(n,{})}),s&&(0,D.jsx)(`button`,{type:`button`,className:g.iconButton,"aria-label":v(`关闭差异预览`,`Close diff preview`),title:v(`关闭差异预览 · Esc`,`Close diff preview · Esc`),onClick:s,children:`×`})]}),!s&&(0,D.jsxs)(`div`,{className:E.diffSummary,children:[(0,D.jsx)(`span`,{children:t}),T]}),a&&(0,D.jsxs)(`div`,{className:g.state,role:`status`,children:[v(`差异读取失败,请重试。`,`Could not read this diff. Try again.`),` `,(0,D.jsx)(`button`,{type:`button`,className:g.textButton,onClick:o,children:v(`重试`,`Retry`)})]}),(0,D.jsxs)(`div`,{className:`${g.preview} ${E.diffViewport}`,"aria-busy":i,children:[!r&&!a&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:v(`正在读取差异…`,`Reading diff…`)}),r&&r.kind!==`text`&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:O[r.kind]}),r?.kind===`text`&&(0,D.jsxs)(`div`,{ref:h,className:E.diffScroll,tabIndex:0,role:`region`,"aria-label":v(`文件差异`,`File diff`),children:[m.map((e,t)=>(0,D.jsx)(`p`,{className:E.diffNotice,children:N(e)},t)),!f.length&&!m.length&&(0,D.jsx)(`p`,{className:g.state,children:O.empty}),(0,D.jsx)(`pre`,{className:E.diff,children:(0,D.jsx)(`code`,{children:f.map((e,t)=>e.kind===`hunk`?(0,D.jsxs)(`span`,{className:E.diffHunk,"data-kind":`hunk`,children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,children:`···`}),(0,D.jsxs)(`span`,{children:[v(`行 ${e.oldLine} / ${e.newLine}`,`Lines ${e.oldLine} / ${e.newLine}`),e.text&&` · ${e.text}`]})]},t):(0,D.jsxs)(`span`,{className:E.diffLine,"data-kind":e.kind,"data-change":e.change??void 0,"data-change-start":e.change!==null&&p[e.change]===t?`true`:void 0,"data-active":e.change!==null&&b===e.change?`true`:void 0,children:[(0,D.jsx)(`span`,{className:E.lineNumber,"aria-hidden":`true`,children:e.oldLine}),(0,D.jsx)(`span`,{className:E.lineNumber,"aria-hidden":`true`,children:e.newLine}),(0,D.jsxs)(`span`,{className:E.lineText,children:[e.text||` `,e.noNewline&&(0,D.jsx)(`span`,{className:E.noNewline,title:v(`文件末尾无换行`,`No newline at end of file`),"aria-label":v(`文件末尾无换行`,`No newline at end of file`),children:`↵`})]})]},t))})})]})]})]})}function N(e){switch(e.kind){case`mode`:return v(`文件权限:${e.from} → ${e.to}`,`File mode: ${e.from} → ${e.to}`);case`rename`:return v(`重命名:${e.from} → ${e.to}`,`Renamed: ${e.from} → ${e.to}`);case`copy`:return v(`复制:${e.from} → ${e.to}`,`Copied: ${e.from} → ${e.to}`);case`added`:return v(`新增空文件`,`Empty file added`);case`deleted`:return v(`删除空文件`,`Empty file deleted`)}}var P=(0,x.memo)(function({sessionId:e,path:t,area:n,visible:r,idle:i,onClose:a}){_();let o=T((0,x.useCallback)(r=>w.diff(e,t,n,r),[e,t,n]),r,i);return(0,D.jsx)(M,{path:t,label:k(n),onClose:a,...o})});function F(e,t){if(!e)return null;let n=t.find(t=>t.path===e.path);if(!n)return null;let r=n.conflict?[`unstaged`]:n.untracked?[`untracked`]:[...n.worktree===`.`?[]:[`unstaged`],...n.index===`.`?[]:[`staged`]];return r.includes(e.area)?e:r[0]?{path:e.path,area:r[0]}:null}function I({branch:e,control:n,disabled:r,model:i,open:a,onOpenChange:o,onDraftChange:s,onWrite:c}){let d=(0,x.useRef)(null),p=(0,x.useRef)(null),m=(0,x.useRef)(null),[_,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)(``);h(p,a,()=>o(!1)),(0,x.useEffect)(()=>{if(!a){y(!1),T(``),C(!1);return}let e=e=>{e.target instanceof Node&&!d.current?.contains(e.target)&&o(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[a,o]),(0,x.useEffect)(()=>{_&&m.current?.focus()},[_]);let O=n?.scope?`root_required`:n?.dirty?`dirty_worktree`:null,k=n?.branches.filter(e=>e.name.toLocaleLowerCase().includes(w.toLocaleLowerCase()))??[],A=async(e,t)=>{C(!0),await c(e,t)&&o(!1)};return(0,D.jsxs)(`div`,{ref:d,className:E.branchPicker,children:[(0,D.jsxs)(`button`,{type:`button`,className:E.branchTrigger,disabled:!n,"aria-label":v(`管理分支`,`Manage branches`),"aria-haspopup":`dialog`,"aria-expanded":a,title:e??v(`分离 HEAD`,`Detached HEAD`),onClick:()=>o(!a),children:[(0,D.jsx)(u,{}),(0,D.jsx)(`span`,{children:e??v(`分离 HEAD`,`Detached HEAD`)}),(0,D.jsx)(l,{})]}),a&&(0,D.jsxs)(f,{ref:p,className:E.branchPopover,compact:!0,role:`dialog`,"aria-modal":`true`,"aria-label":v(`管理分支`,`Manage branches`),children:[(0,D.jsxs)(`div`,{className:E.pickerHeader,children:[(0,D.jsx)(`span`,{children:_?v(`新建分支`,`New branch`):v(`本地分支`,`Local branches`)}),(0,D.jsx)(`button`,{type:`button`,className:g.iconButton,"aria-label":v(`关闭分支面板`,`Close branches`),onClick:()=>o(!1),children:`×`})]}),_?(0,D.jsxs)(`form`,{className:E.form,"aria-label":v(`创建分支`,`Create branch`),onSubmit:e=>{e.preventDefault(),!r&&i.branch.trim()&&n?.head&&!(i.checkout&&O)&&A(`create-branch`,{branch:i.branch,checkout:i.checkout})},children:[(0,D.jsxs)(`label`,{className:E.field,children:[v(`分支名称`,`Branch name`),(0,D.jsx)(`input`,{ref:m,"aria-label":v(`新分支名称`,`New branch name`),maxLength:256,value:i.branch,disabled:i.pending,placeholder:`feature/name`,onChange:e=>{i.branch=e.target.value,s()}})]}),(0,D.jsxs)(`label`,{className:E.checkbox,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:i.checkout,disabled:i.pending,onChange:e=>{i.checkout=e.target.checked,s()}}),v(`创建后切换`,`Switch after creating`)]}),i.checkout&&O&&(0,D.jsx)(`p`,{className:E.hint,children:S(O)}),(0,D.jsxs)(`div`,{className:E.actionRow,children:[(0,D.jsx)(`button`,{type:`button`,className:g.textButton,onClick:()=>y(!1),children:v(`返回`,`Back`)}),(0,D.jsx)(`button`,{className:E.actionButton,type:`submit`,disabled:r||!i.branch.trim()||!n?.head||i.checkout&&!!O,children:v(`创建分支`,`Create branch`)})]})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`input`,{className:E.branchSearch,type:`search`,"data-modal-autofocus":!0,"aria-label":v(`搜索分支`,`Search branches`),value:w,placeholder:v(`搜索分支…`,`Search branches…`),onChange:e=>T(e.target.value)}),(0,D.jsxs)(`div`,{className:E.branchList,role:`group`,"aria-label":v(`本地分支`,`Local branches`),children:[k.map(e=>(0,D.jsxs)(`button`,{type:`button`,className:E.branchOption,title:e.name,disabled:r||!!O||e.current||e.occupied||!n?.head,"aria-label":v(`切换到分支:${e.name}`,`Switch to branch: ${e.name}`),onClick:()=>{A(`switch-branch`,{branch:e.name})},children:[(0,D.jsx)(u,{}),(0,D.jsx)(`span`,{children:e.name}),(e.current||e.occupied)&&(0,D.jsx)(`small`,{children:e.current?v(`当前`,`Current`):v(`其他工作树`,`Other worktree`)})]},e.name)),k.length===0&&(0,D.jsx)(`p`,{className:E.hint,children:v(`没有匹配的分支。`,`No matching branches.`)})]}),O&&(0,D.jsx)(`p`,{className:E.hint,children:S(O)}),(0,D.jsxs)(`button`,{type:`button`,className:E.newBranch,disabled:i.pending||!n?.head,"aria-label":v(`新建分支`,`New branch`),onClick:()=>y(!0),children:[(0,D.jsx)(t,{}),v(`新建分支…`,`New branch…`)]})]}),!n?.head&&(0,D.jsx)(`p`,{className:E.hint,children:S(`no_commits`)}),i.pending&&(0,D.jsx)(`p`,{className:E.hint,role:`status`,children:v(`正在执行…`,`Running…`)}),n?.blocked&&(0,D.jsx)(`p`,{className:E.hint,children:S(n.blocked)}),b&&i.outcome&&!i.outcome.ok&&(0,D.jsx)(`p`,{className:E.feedback,"data-error":`true`,role:`status`,children:S(i.outcome.reason)})]})]})}function L(e){let t=[],n=0,r=1,i=[];for(let a of e){let e=t.findIndex(e=>e.hash===a.hash),o=e<0?t.length:e,s=e<0?n++%4:t[o].color,c=[...t];e>=0&&t.splice(e,1);let l=Math.min(o,t.length),u=[...new Set(a.parents)];for(let[e,r]of u.entries())t.some(e=>e.hash===r)||t.splice(l++,0,{hash:r,color:e===0?s:n++%4});i.push({lane:o,color:s,incoming:e>=0,rails:c.flatMap((e,n)=>e.hash===a.hash?[]:[{from:n,to:t.findIndex(t=>t.hash===e.hash),color:e.color}]),parents:u.map(e=>{let n=t.findIndex(t=>t.hash===e);return{hash:e,from:o,to:n,color:t[n].color}})}),r=Math.max(r,o+1,c.length,t.length)}return{rows:i,width:r*16+16}}var R={history:`_history_1fyyf_1`,historyToolbar:`_historyToolbar_1fyyf_2`,graphScroll:`_graphScroll_1fyyf_3`,historyList:`_historyList_1fyyf_4`,commitRow:`_commitRow_1fyyf_5`,loadMore:`_loadMore_1fyyf_7`,parentLink:`_parentLink_1fyyf_7`,graph:`_graph_1fyyf_3`,commitCopy:`_commitCopy_1fyyf_15`,subject:`_subject_1fyyf_16`,refLine:`_refLine_1fyyf_17`,ref:`_ref_1fyyf_17`,merge:`_merge_1fyyf_20`,commitMeta:`_commitMeta_1fyyf_21`,detail:`_detail_1fyyf_27`,message:`_message_1fyyf_33`,parentList:`_parentList_1fyyf_35`,parentSelect:`_parentSelect_1fyyf_36`,fileStats:`_fileStats_1fyyf_38`},z=(0,x.memo)(function({sessionId:e,visible:t,idle:n,model:r,onCommit:i}){let a=_(),{value:o,loading:s,error:c,refresh:l}=T((0,x.useCallback)(t=>w.history(e,void 0,t),[e]),t,n),[u,d]=(0,x.useState)(r.history),[f,p]=(0,x.useState)(r.selected),[m,h]=(0,x.useState)(!1),[y,b]=(0,x.useState)(!1),S=()=>{b(!1),l()},C=(0,x.useRef)(null);(0,x.useEffect)(()=>{o&&(r.history?.snapshot===o.snapshot&&r.history.commits.length||(C.current?.abort(),h(!1),b(!1),r.history=o,d(o)))},[o,r]),(0,x.useEffect)(()=>(t||(C.current?.abort(),h(!1)),()=>C.current?.abort()),[t]);let E=async()=>{let t=r.history;if(!t?.nextCursor||m)return;let n=new AbortController;C.current=n,h(!0),b(!1);try{let i=await w.history(e,t.nextCursor,n.signal);if(n.signal.aborted||r.history?.snapshot!==i.snapshot||r.history.nextCursor!==t.nextCursor)return;let a=new Set(t.commits.map(e=>e.hash)),o={...i,commits:[...t.commits,...i.commits.filter(e=>!a.has(e.hash))]};r.history=o,d(o)}catch{n.signal.aborted||b(!0)}finally{n.signal.aborted||h(!1)}},O=(0,x.useMemo)(()=>L(u?.commits??[]),[u?.commits]),k=e=>e*16+12,A=e=>{r.selected=e,p(e),i(e)},j={"--git-graph-width":`${O.width}px`};return(0,D.jsxs)(`div`,{className:R.history,"aria-busy":s||m,children:[(0,D.jsxs)(`div`,{className:R.historyToolbar,children:[(0,D.jsx)(`span`,{children:v(`提交历史与分支图`,`Commit history & graph`)}),(0,D.jsx)(`button`,{className:g.textButton,type:`button`,onClick:S,"aria-label":v(`刷新提交历史`,`Refresh history`),children:v(`刷新`,`Refresh`)})]}),u?.scope&&(0,D.jsxs)(`p`,{className:g.state,children:[v(`展示仓库提交关系;文件差异仅限当前目录:`,`Repository history; file diffs are limited to: `),u.scope]}),(c||y)&&(0,D.jsxs)(`p`,{className:g.state,role:`status`,children:[v(`历史读取失败或分支已变化,请刷新历史。`,`Could not read history, or refs changed. Refresh history.`),` `,(0,D.jsx)(`button`,{className:g.textButton,type:`button`,onClick:S,children:v(`重试`,`Retry`)})]}),!u&&!c&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:v(`正在读取历史…`,`Reading history…`)}),u?.kind===`not-repository`&&(0,D.jsx)(`p`,{className:g.state,children:v(`当前工作区不在 Git 仓库中。`,`This workspace is not in a Git repository.`)}),u?.kind===`unavailable`&&(0,D.jsx)(`p`,{className:g.state,children:v(`Git 不可用。`,`Git is unavailable.`)}),u?.kind===`repository`&&u.commits.length===0&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:v(`仓库尚无提交。`,`This repository has no commits yet.`)}),(0,D.jsx)(`div`,{className:R.graphScroll,children:(0,D.jsx)(`ol`,{className:R.historyList,style:j,"aria-label":v(`提交历史`,`Commit history`),children:u?.commits.map((e,t)=>{let n=O.rows[t],r=u.refs.filter(t=>t.hash===e.hash),i=new Date(e.authoredAt),o=Number.isNaN(i.getTime())?e.authoredAt:i.toLocaleDateString(a===`zh`?`zh-CN`:`en-US`);return(0,D.jsx)(`li`,{children:(0,D.jsxs)(`button`,{type:`button`,className:R.commitRow,"data-commit":e.hash,"aria-current":f===e.hash?`true`:void 0,"aria-label":v(`查看提交 ${e.hash.slice(0,7)}:${e.subject}`,`View commit ${e.hash.slice(0,7)}: ${e.subject}`),onClick:()=>A(e.hash),children:[(0,D.jsxs)(`svg`,{width:O.width,height:84,className:R.graph,"aria-hidden":`true`,"data-git-graph-row":e.hash,children:[n.rails.map((e,t)=>(0,D.jsx)(`path`,{"data-color":e.color,d:`M${k(e.from)} 0 L${k(e.from)} 42 C${k(e.from)} 64 ${k(e.to)} 64 ${k(e.to)} 84`},`r${t}`)),n.incoming&&(0,D.jsx)(`path`,{"data-color":n.color,d:`M${k(n.lane)} 0 V42`}),n.parents.map(e=>(0,D.jsx)(`path`,{"data-parent":e.hash,"data-color":e.color,d:`M${k(n.lane)} 42 C${k(n.lane)} 64 ${k(e.to)} 64 ${k(e.to)} 84`},e.hash)),(0,D.jsx)(`circle`,{"data-color":n.color,cx:k(n.lane),cy:42,r:4})]}),(0,D.jsxs)(`span`,{className:R.commitCopy,children:[(0,D.jsx)(`span`,{className:R.subject,children:e.subject||v(`(无提交说明)`,`(No subject)`)}),(0,D.jsxs)(`span`,{className:R.refLine,title:r.map(e=>`${e.kind}: ${e.name}`).join(` · `),children:[u.head===e.hash&&(0,D.jsx)(`span`,{className:R.ref,"data-kind":`head`,children:`HEAD`}),r.map(e=>(0,D.jsxs)(`span`,{className:R.ref,"data-kind":e.kind,children:[e.kind===`tag`?`${v(`标签`,`tag`)}: `:e.kind===`remote`?`${v(`远端`,`remote`)}: `:``,e.name]},`${e.kind}/${e.name}`)),e.parents.length>1&&(0,D.jsx)(`span`,{className:R.merge,children:v(`合并`,`Merge`)})]}),(0,D.jsxs)(`span`,{className:R.commitMeta,children:[(0,D.jsx)(`code`,{children:e.hash.slice(0,7)}),(0,D.jsx)(`span`,{children:e.author}),(0,D.jsx)(`time`,{dateTime:e.authoredAt,title:e.authoredAt,children:o})]})]})]})},e.hash)})})}),u?.nextCursor&&(0,D.jsx)(`button`,{type:`button`,className:R.loadMore,disabled:m||s||u.snapshot!==o?.snapshot,onClick:()=>{E()},children:m?v(`正在加载…`,`Loading…`):v(`加载更多提交`,`Load more commits`)})]})});function B(e){return{A:v(`新增`,`Added`),M:v(`修改`,`Modified`),D:v(`删除`,`Deleted`),R:v(`重命名`,`Renamed`),C:v(`复制`,`Copied`),T:v(`类型变化`,`Type changed`),U:v(`冲突`,`Conflict`),"?":v(`未跟踪`,`Untracked`)}[e]??e}var V=(0,x.memo)(function({sessionId:e,visible:t,idle:r,model:i,onCommit:a}){_();let o=(0,x.useRef)(null),[c,l]=(0,x.useState)(i.selection),u=(0,x.useCallback)(e=>{i.selection=e,l(e)},[i]),d=(0,x.useCallback)(()=>{let e=o.current?.querySelector(`[data-git-file][aria-pressed="true"]`);u(null),requestAnimationFrame(()=>e?.focus({preventScroll:!0}))},[u]),[f,h]=(0,x.useState)(i.view),y=(0,x.useRef)(null);(0,x.useEffect)(()=>{if(!t)return;let e=p(document);return y.current=e,()=>{e.dispose(),y.current=null}},[t]);let{value:b,loading:C,error:A}=T((0,x.useCallback)(t=>w.status(e,t),[e]),t&&f===`changes`,r),{value:j,loading:M,error:N}=T((0,x.useCallback)(t=>w.control(e,t),[e]),t&&f===`changes`,r),[L,R]=(0,x.useState)(!1);(0,x.useEffect)(()=>{t&&f===`changes`||R(!1)},[t,f]);let[,V]=(0,x.useReducer)(e=>e+1,0);(0,x.useEffect)(()=>{let e=()=>V();return window.addEventListener(`pi-workspace-git-changed`,e),()=>window.removeEventListener(`pi-workspace-git-changed`,e)},[]);let H=()=>window.dispatchEvent(new Event(`pi-workspace-git-changed`)),U=r?j?.blocked:`agent_busy`,W=i.pending||!j?.version||M||N||A||!!U,G=async(t,n={})=>{if(W||i.pending||!j)return!1;i.pending=!0,i.outcome=null,V();try{return await w.write(e,{action:t,expected:j.version,...n}),i.outcome={ok:!0,reason:t},t===`commit`&&i.message===n.message&&(i.message=``,i.coAuthor=!1),t===`create-branch`&&i.branch===n.branch&&(i.branch=``),!0}catch(e){return i.outcome={ok:!1,reason:e instanceof s?e.reason??(e.status<500?`git_failed`:`outcome_unknown`):`outcome_unknown`},!1}finally{i.pending=!1,window.dispatchEvent(new Event(`pi-workspace-git-changed`))}},K=b?.kind===`repository`?b:null;(0,x.useEffect)(()=>{if(!t||f!==`changes`||C||A||!b)return;let e=F(i.selection,b.kind===`repository`?b.entries:[]);e!==i.selection&&(i.selection=e,l(e))},[b,C,A,t,f,i]);let q=K?[{title:v(`冲突`,`Conflicts`),area:`unstaged`,changes:K.entries.filter(e=>e.conflict),conflict:!0},{title:k(`staged`),area:`staged`,changes:K.entries.filter(e=>!e.conflict&&!e.untracked&&e.index!==`.`)},{title:k(`unstaged`),area:`unstaged`,changes:K.entries.filter(e=>!e.conflict&&!e.untracked&&e.worktree!==`.`)},{title:k(`untracked`),area:`untracked`,changes:K.entries.filter(e=>e.untracked)}]:[],J=!W&&!K?.scope&&!!j?.staged&&!!i.message.trim(),Y=K?.root.split(/[\\/]/).at(-1)??``,X=K?[K.root,K.head,K.upstream??v(`未设置上游分支`,`No upstream branch`)].filter(Boolean).join(`
3
- `):``;return(0,D.jsxs)(`div`,{ref:o,className:`${g.body} ${E.panel}`,children:[(0,D.jsxs)(`div`,{className:g.toolbar,children:[(0,D.jsx)(`div`,{className:E.viewSwitch,role:`group`,"aria-label":v(`Git 视图`,`Git view`),children:[`changes`,`history`].map(e=>(0,D.jsx)(`button`,{type:`button`,className:`${g.textButton} ${E.viewButton}`,"aria-pressed":f===e,onClick:()=>{i.view=e,h(e)},children:e===`changes`?v(`改动`,`Changes`):v(`历史`,`History`)},e))}),f===`history`&&(0,D.jsx)(`span`,{className:g.readonly,children:v(`只读`,`Read only`)}),f===`changes`&&(0,D.jsx)(`button`,{type:`button`,className:g.iconButton,"aria-label":v(`刷新 Git 状态`,`Refresh Git status`),title:v(`刷新 Git 状态`,`Refresh Git status`),onClick:H,children:(0,D.jsx)(n,{})})]}),f===`history`?(0,D.jsx)(`div`,{className:g.scroll,children:(0,D.jsx)(z,{sessionId:e,visible:t,idle:r,model:i,onCommit:a})}):(0,D.jsxs)(D.Fragment,{children:[K&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:E.repoBar,children:[(0,D.jsx)(I,{branch:K.branch,control:j,disabled:W,model:i,open:L,onOpenChange:R,onDraftChange:V,onWrite:G}),(0,D.jsx)(`span`,{className:E.repoName,title:X,children:Y}),K.upstream&&K.ahead!==null&&(0,D.jsxs)(`span`,{className:E.divergence,title:v(`上游差异(本地记录)`,`Upstream divergence (local refs)`),children:[`↑`,K.ahead,` ↓`,K.behind]}),(0,D.jsxs)(`span`,{className:E.count,title:v(`改动文件`,`Changed files`),children:[K.entries.length,K.truncated?`+`:``]})]}),K.scope&&(0,D.jsxs)(`div`,{className:E.scope,title:K.scope,children:[v(`当前目录:`,`Directory: `),K.scope]})]}),(0,D.jsx)(O,{selectionKey:c?JSON.stringify(c):null,onClose:d,preview:c&&K?(0,D.jsx)(P,{sessionId:e,path:c.path,area:c.area,visible:t&&f===`changes`,idle:r,onClose:d},JSON.stringify([e,c])):null,children:(0,D.jsxs)(`div`,{className:`${g.scroll} ${E.changesScroll}`,"aria-busy":C,role:`region`,"aria-label":v(`改动文件`,`Changed files`),children:[A&&(0,D.jsxs)(`div`,{className:g.state,role:`status`,children:[v(`Git 读取失败,请检查仓库或重试。`,`Could not read Git. Check the repository or try again.`),` `,(0,D.jsx)(`button`,{type:`button`,className:g.textButton,onClick:H,children:v(`重试`,`Retry`)})]}),!b&&!A&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:v(`正在读取仓库…`,`Reading repository…`)}),b?.kind===`not-repository`&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:v(`当前工作区不在 Git 仓库中。`,`This workspace is not in a Git repository.`)}),b?.kind===`unavailable`&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:v(`Git 不可用,请在 Pi 所在机器安装 Git。`,`Git is unavailable. Install Git on the machine running Pi.`)}),K&&(0,D.jsxs)(D.Fragment,{children:[K.entries.length===0&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:K.scope?v(`当前目录没有未提交改动。`,`No uncommitted changes in this directory.`):v(`工作区干净,没有未提交改动。`,`Working tree clean. No uncommitted changes.`)}),q.filter(e=>e.changes.length>0).map(e=>(0,D.jsxs)(`section`,{"aria-label":e.title,children:[(0,D.jsxs)(`h3`,{className:E.groupHeading,children:[e.title,(0,D.jsx)(`span`,{children:e.changes.length})]}),(0,D.jsx)(`ul`,{className:E.list,children:e.changes.map(t=>{let n=e.conflict?`U`:e.area===`staged`?t.index:t.worktree;return(0,D.jsxs)(`li`,{className:E.changeRow,children:[(0,D.jsxs)(`button`,{type:`button`,className:E.change,title:t.originalPath?`${t.originalPath} → ${t.path}`:t.path,"data-git-file":JSON.stringify([e.area,t.path]),"aria-pressed":c?.path===t.path&&c.area===e.area,onClick:()=>u({path:t.path,area:e.area}),"aria-label":`${t.path}, ${B(n)}`,children:[(0,D.jsx)(m,{path:t.path,size:16}),(0,D.jsxs)(`span`,{className:E.filename,children:[t.path,t.originalPath&&(0,D.jsxs)(`small`,{children:[t.originalPath,` → `,t.path]})]}),(0,D.jsx)(`span`,{className:E.status,"data-status":n,"aria-hidden":`true`,children:n})]}),!e.conflict&&!t.submodule&&(0,D.jsx)(`button`,{type:`button`,className:E.fileAction,disabled:W,"aria-label":e.area===`staged`?v(`取消暂存 ${t.path}`,`Unstage ${t.path}`):v(`暂存 ${t.path}`,`Stage ${t.path}`),title:e.area===`staged`?v(`取消暂存`,`Unstage`):v(`暂存`,`Stage`),onClick:()=>{G(e.area===`staged`?`unstage`:`stage`,{path:t.path})},children:e.area===`staged`?`−`:`+`})]},t.path)})})]},e.title)),K.truncated&&(0,D.jsx)(`p`,{className:g.state,children:v(`仅显示前 1000 个改动文件,请缩小工作区范围。`,`Showing the first 1000 changed files. Open a smaller workspace to see more.`)})]})]})}),K&&(0,D.jsxs)(`div`,{className:E.commitFooter,"aria-busy":i.pending,children:[U&&(0,D.jsx)(`p`,{className:E.hint,role:`status`,children:S(U)}),N&&(0,D.jsx)(`p`,{className:E.hint,role:`status`,children:v(`操作状态读取失败,请刷新。`,`Could not read operation state. Refresh to retry.`)}),i.pending&&!L&&(0,D.jsx)(`p`,{className:E.hint,role:`status`,children:v(`正在执行 Git 操作…`,`Running Git operation…`)}),i.outcome&&!L&&(0,D.jsxs)(`div`,{className:E.feedbackRow,children:[(0,D.jsx)(`p`,{className:E.feedback,"data-error":!i.outcome.ok,role:`status`,children:S(i.outcome.reason)}),(0,D.jsx)(`button`,{type:`button`,className:g.iconButton,"aria-label":v(`关闭 Git 提示`,`Dismiss Git message`),onClick:()=>{i.outcome=null,V()},children:`×`})]}),K.scope?(0,D.jsx)(`p`,{className:E.rootHint,title:S(`root_required`),children:v(`提交请打开仓库根目录`,`Commit from repository root`)}):(0,D.jsxs)(`form`,{className:E.commitForm,"aria-label":v(`创建提交`,`Create commit`),onSubmit:e=>{e.preventDefault(),J&&G(`commit`,{message:i.message,coAuthor:i.coAuthor})},children:[(0,D.jsx)(`textarea`,{"aria-label":v(`提交说明`,`Commit message`),rows:1,maxLength:8192,disabled:i.pending,value:i.message,placeholder:v(`提交说明…`,`Commit message…`),onChange:e=>{i.message=e.target.value,V()},onKeyDown:e=>{let t=y.current?.guards(e.nativeEvent)??e.nativeEvent.isComposing;e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!t&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,D.jsxs)(`label`,{className:E.checkbox,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:i.coAuthor,disabled:i.pending,onChange:e=>{i.coAuthor=e.target.checked,V()}}),v(`添加 pi-webapp 为共同作者`,`Add pi-webapp as co-author`)]}),(0,D.jsxs)(`div`,{className:E.actionRow,children:[(0,D.jsx)(`span`,{className:E.hint,children:j?.staged?v(`仅暂存区 · ${j.staged} 个文件`,`Staged only · ${j.staged} files`):v(`先暂存要提交的文件`,`Stage files to commit`)}),(0,D.jsx)(`button`,{className:E.actionButton,type:`submit`,disabled:!J,title:v(`仅提交暂存区 · ⌘/Ctrl+Enter`,`Commit staged files · ⌘/Ctrl+Enter`),children:v(`提交`,`Commit`)})]})]})]})]})]})}),H=(0,x.memo)(function({sessionId:e,hash:t,visible:r,idle:i,onCommit:a}){_();let o=(0,x.useRef)(null),[s,c]=(0,x.useState)(null),l=()=>{let e=o.current?.querySelector(`[data-git-file][aria-pressed="true"]`);c(null),requestAnimationFrame(()=>e?.focus({preventScroll:!0}))},[u,d]=(0,x.useState)(0),{value:f,loading:p,error:h,refresh:y}=T((0,x.useCallback)(n=>w.commit(e,t,u,n),[e,t,u]),r,i,!1),b=f?.parentIndex===u?f:null;return(0,x.useEffect)(()=>{b&&s&&!b.files.some(e=>e.path===s)&&c(null)},[b,s]),(0,D.jsxs)(`div`,{className:`${g.body} ${E.panel}`,ref:o,children:[(0,D.jsxs)(`div`,{className:g.toolbar,children:[(0,D.jsxs)(`span`,{className:g.path,children:[v(`提交详情`,`Commit details`),` · `,t.slice(0,7)]}),(0,D.jsx)(`span`,{className:g.readonly,children:v(`只读`,`Read only`)}),(0,D.jsx)(`button`,{className:g.iconButton,type:`button`,onClick:y,"aria-label":v(`刷新提交详情`,`Refresh commit`),children:(0,D.jsx)(n,{})})]}),(0,D.jsx)(O,{selectionKey:s,onClose:l,preview:s&&b?(0,D.jsx)(U,{sessionId:e,hash:t,path:s,parentIndex:u,visible:r,idle:i,onClose:l},JSON.stringify([e,t,u,s])):null,children:(0,D.jsxs)(`div`,{className:g.scroll,"aria-busy":p,children:[h&&(0,D.jsxs)(`p`,{className:g.state,role:`status`,children:[v(`提交读取失败,可能已不可达。`,`Could not read this commit. It may no longer be reachable.`),` `,(0,D.jsx)(`button`,{className:g.textButton,type:`button`,onClick:y,children:v(`重试`,`Retry`)})]}),!f&&!h&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:v(`正在读取提交…`,`Reading commit…`)}),f&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:R.detail,children:[(0,D.jsx)(`h2`,{children:f.subject||v(`(无提交说明)`,`(No subject)`)}),(0,D.jsxs)(`dl`,{children:[(0,D.jsx)(`dt`,{children:v(`提交`,`Commit`)}),(0,D.jsx)(`dd`,{children:(0,D.jsx)(`code`,{children:f.hash})}),(0,D.jsx)(`dt`,{children:v(`作者`,`Author`)}),(0,D.jsxs)(`dd`,{children:[f.author,` <`,f.email,`>`]}),(0,D.jsx)(`dt`,{children:v(`创作时间`,`Authored`)}),(0,D.jsx)(`dd`,{children:(0,D.jsx)(`time`,{dateTime:f.authoredAt,children:f.authoredAt})}),(0,D.jsx)(`dt`,{children:v(`提交者`,`Committer`)}),(0,D.jsxs)(`dd`,{children:[f.committer,` <`,f.committerEmail,`>`]}),(0,D.jsx)(`dt`,{children:v(`提交时间`,`Committed`)}),(0,D.jsx)(`dd`,{children:(0,D.jsx)(`time`,{dateTime:f.committedAt,children:f.committedAt})}),(0,D.jsx)(`dt`,{children:v(`父提交`,`Parents`)}),(0,D.jsx)(`dd`,{className:R.parentList,children:f.parents.length?f.parents.map((e,t)=>(0,D.jsx)(`button`,{type:`button`,className:R.parentLink,onClick:()=>a(e),"aria-label":v(`打开父提交 ${t+1}:${e.slice(0,7)}`,`Open parent ${t+1}: ${e.slice(0,7)}`),children:(0,D.jsx)(`code`,{children:e.slice(0,7)})},e)):v(`根提交`,`Root commit`)})]}),(0,D.jsx)(`div`,{className:R.message,"aria-label":v(`完整提交说明`,`Full commit message`),children:f.message}),f.scope&&(0,D.jsxs)(`p`,{className:g.state,children:[v(`文件改动仅限:`,`File changes limited to: `),f.scope]})]}),f.parents.length>1?(0,D.jsxs)(`label`,{className:R.parentSelect,children:[v(`比较基准`,`Compare against`),(0,D.jsx)(`select`,{"aria-label":v(`比较父提交`,`Compare parent`),value:u,onChange:e=>{c(null),d(Number(e.target.value))},children:f.parents.map((e,t)=>(0,D.jsxs)(`option`,{value:t,children:[v(`父提交 ${t+1}`,`Parent ${t+1}`),` · `,e.slice(0,7)]},`${t}/${e}`))})]}):(0,D.jsx)(`p`,{className:g.state,children:f.parents.length?v(`与父提交比较`,`Compared with parent`):v(`与空目录比较`,`Compared with empty tree`)}),!b&&!h&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:v(`正在读取文件改动…`,`Reading changed files…`)}),b&&(0,D.jsxs)(`section`,{"aria-label":v(`提交文件`,`Commit files`),children:[(0,D.jsxs)(`h3`,{className:E.groupHeading,children:[v(`改动文件`,`Changed files`),(0,D.jsxs)(`span`,{children:[b.files.length,b.truncated?`+`:``]})]}),b.files.length===0&&(0,D.jsx)(`p`,{className:g.state,children:v(`所选比较在当前目录中没有文件改动。`,`No file changes in this directory for this comparison.`)}),(0,D.jsx)(`ul`,{className:E.list,children:b.files.map(e=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(`button`,{className:E.change,type:`button`,"data-git-file":e.path,"aria-pressed":s===e.path,onClick:()=>c(e.path),"aria-label":v(`查看提交差异:${e.path}`,`View commit diff: ${e.path}`),children:[(0,D.jsx)(m,{path:e.path,size:16}),(0,D.jsx)(`span`,{className:E.filename,children:e.path}),(0,D.jsx)(`span`,{className:R.fileStats,children:e.additions===null?v(`二进制`,`Binary`):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`span`,{className:E.added,children:[`+`,e.additions]}),(0,D.jsxs)(`span`,{className:E.removed,children:[`−`,e.deletions]})]})}),(0,D.jsx)(`span`,{className:E.status,"data-status":e.status,children:e.status})]})},e.path))}),b.truncated&&(0,D.jsx)(`p`,{className:g.state,children:v(`仅显示前 1000 个文件。`,`Showing the first 1000 files.`)})]})]})]})})]})}),U=(0,x.memo)(function({sessionId:e,hash:t,path:n,parentIndex:r,visible:i,idle:a,onClose:o}){_();let s=T((0,x.useCallback)(i=>w.commitDiff(e,t,n,r,i),[e,t,n,r]),i,a,!1),c=s.value?s.value.parentHash?`${v(`父提交`,`Parent`)} ${s.value.parentHash.slice(0,7)}`:v(`空目录`,`Empty tree`):``;return(0,D.jsx)(M,{onClose:o,path:n,label:`${t.slice(0,7)}${c?` · ${c}`:``}`,...s})}),W=()=>({selection:null,view:`changes`,history:null,selected:null,message:``,coAuthor:!1,branch:``,checkout:!0,pending:!1,outcome:null}),G={id:a.git,kind:`builtin`,version:`1.0.0`,name:{zh:`Git`,en:`Git`},description:{zh:`审阅工作区改动与提交历史,暂存文件、提交并管理本地分支。`,en:`Review workspace changes and history, stage files, commit and manage local branches.`}},K=i({id:G.id,apiVersion:1,activate(){},workbench:{apiVersion:1,entry:{category:`workspace`,label:{zh:`Git 改动`,en:`Git changes`},description:{zh:`查看分支和文件差异`,en:`Review branches and file diffs`},kind:`git`,icon:u},panels:[{kind:`git`,title:()=>(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(u,{size:16}),(0,D.jsx)(`span`,{children:`Git`})]}),component:e=>(0,D.jsx)(V,{sessionId:e.session.sessionId,visible:e.visible,idle:e.session.idle,model:e.resource(W),onCommit:t=>e.open(`git-commit`,t,t.slice(0,7))})},{kind:`git-commit`,component:e=>(0,D.jsx)(H,{sessionId:e.session.sessionId,hash:e.contentId,visible:e.visible,idle:e.session.idle,onCommit:t=>e.open(`git-commit`,t,t.slice(0,7))})},{kind:`git-diff`,component:e=>{let[t,n]=JSON.parse(e.contentId);return(0,D.jsx)(P,{sessionId:e.session.sessionId,area:t,path:n,visible:e.visible,idle:e.session.idle})}},{kind:`git-commit-diff`,component:e=>{let[t,n,r]=JSON.parse(e.contentId);return(0,D.jsx)(U,{sessionId:e.session.sessionId,hash:t,parentIndex:n,path:r,visible:e.visible,idle:e.session.idle})}}]}});export{K as default};
4
- //# debugId=6773b61f-6273-4318-878e-d3fcfd1521e4
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`79d915a8-b3d4-4d37-8f86-4e690121dd6c`,e._sentryDebugIdIdentifier=`sentry-dbid-79d915a8-b3d4-4d37-8f86-4e690121dd6c`)}catch{}})();import{r as e}from"./rolldown-runtime-CgmABjMJ.js";import{D as t,F as n,I as r,S as i,d as a,f as o,p as s,s as c,u as l,w as u}from"./app-ClkTJLf2.js";import{t as d}from"./react-CLFE7TFE.js";import{c as f,i as p,o as m,r as h,t as g}from"./WorkspacePanel.module-CZiYvGfi.js";import{a as _,n as v}from"./preference-CKBoM0dZ.js";import{s as y}from"./app.js";import{n as b}from"./clsx-DQAHfk8w.js";var x=e(d(),1);function S(e){let t={stage:[`已暂存文件。`,`File staged.`],unstage:[`已取消暂存,工作区内容保留。`,`File unstaged. Working content preserved.`],commit:[`提交成功。`,`Commit created.`],"create-branch":[`分支已创建。`,`Branch created.`],"switch-branch":[`已切换分支。`,`Branch switched.`],state_changed:[`仓库状态已变化,已刷新;请检查后重新操作。`,`Repository changed. Review the refreshed state before trying again.`],busy:[`Git 操作正在进行,请稍后刷新。`,`A Git operation is in progress. Refresh shortly.`],agent_busy:[`共用此工作树的聊天正在运行,请等待回复结束。`,`A chat sharing this working tree is running. Wait for it to finish.`],session_changed:[`聊天已切换,请返回原聊天检查仓库状态。`,`Chat switched. Return to the original chat to check the repository.`],root_required:[`提交和切换分支请在仓库根目录工作区操作。`,`Open the repository root workspace to commit or switch branches.`],operation_in_progress:[`请先在终端完成冲突处理或正在进行的 Git 操作。`,`Finish conflict resolution or the ongoing Git operation in the terminal first.`],index_locked:[`Git 锁被占用,请等待其他 Git 操作完成。`,`Git is locked. Wait for other Git operations to finish.`],too_many_changes:[`仓库改动或分支过多,请在终端操作。`,`Too many changes or branches. Use the terminal for this operation.`],dirty_worktree:[`切换分支前请先提交或处理全部改动,包括未跟踪文件。`,`Commit or resolve all changes, including untracked files, before switching branches.`],nothing_staged:[`请先暂存要提交的文件。`,`Stage files before committing.`],identity_missing:[`请先在终端配置 Git user.name 和 user.email。`,`Configure Git user.name and user.email in the terminal first.`],invalid_branch:[`分支名称无效,请检查后重试。`,`Invalid branch name. Check the name and try again.`],branch_exists:[`同名分支已存在。`,`A branch with this name already exists.`],branch_in_use:[`该分支正在其他工作树中使用。`,`This branch is checked out in another worktree.`],no_commits:[`创建分支前请先完成首次提交。`,`Create an initial commit before creating a branch.`],invalid_path:[`该文件不支持此操作,请刷新检查。`,`This file cannot be changed here. Refresh and check it.`],invalid_message:[`请填写提交说明(最多 8 KB)。`,`Enter a commit message (up to 8 KB).`],git_failed:[`Git 操作失败。请检查仓库、身份、签名或 hooks 配置,再刷新确认。`,`Git operation failed. Check repository, identity, signing or hooks configuration, then refresh.`],outcome_unknown:[`未能确认操作结果。请刷新检查暂存区、历史和分支,确认前不要重复提交。`,`Operation outcome is unknown. Refresh and check staging, history and branches before repeating it.`]},n=t[e]??t.git_failed;return v(...n)}async function C(e,t,n,r){return a(await l(`/api/workspace/git/${e}`,{method:`POST`,headers:{Authorization:`Bearer ${y()}`,"Content-Type":`application/json`},body:JSON.stringify({sessionId:t,...n}),signal:r}))}var w={control:(e,t)=>C(`control`,e,{},t),write:(e,t)=>C(`write`,e,t),status:(e,t)=>C(`status`,e,{},t),diff:(e,t,n,r)=>C(`diff`,e,{path:t,area:n},r),history:(e,t,n)=>C(`history`,e,{cursor:t},n),commit:(e,t,n,r)=>C(`commit-detail`,e,{hash:t,parentIndex:n},r),commitDiff:(e,t,n,r,i)=>C(`commit-diff`,e,{hash:t,path:n,parentIndex:r},i)};function T(e,t,n,r=!0){let[i,a]=(0,x.useState)(null),[o,s]=(0,x.useState)(!0),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(0),f=(0,x.useCallback)(()=>{s(!0),d(e=>e+1)},[]);return(0,x.useEffect)(()=>{if(!t)return;let n=!1,i=!1,o=!1,c=new AbortController,u=async()=>{if(!(n||document.visibilityState===`hidden`)){if(i)o=!0;else{i=!0,s(!0);try{let t=await e(c.signal);n||(a(e=>JSON.stringify(e)===JSON.stringify(t)?e:t),l(!1))}catch{n||l(!0)}finally{i=!1,n||(s(!1),o&&(o=!1,u()))}}}};u();let d=r?window.setInterval(()=>{u()},5e3):void 0,f=()=>{u()};return window.addEventListener(`focus`,f),window.addEventListener(`pi-workspace-git-changed`,f),document.addEventListener(`visibilitychange`,f),()=>{n=!0,c.abort(),window.clearInterval(d),window.removeEventListener(`pi-workspace-git-changed`,f),window.removeEventListener(`focus`,f),document.removeEventListener(`visibilitychange`,f)}},[e,t,n,u,r]),{value:i,loading:o,error:c,refresh:f}}var E={panel:`_panel_1m2go_2`,viewSwitch:`_viewSwitch_1m2go_3`,viewButton:`_viewButton_1m2go_4`,repoBar:`_repoBar_1m2go_5`,branchPicker:`_branchPicker_1m2go_6`,branchTrigger:`_branchTrigger_1m2go_7`,repoName:`_repoName_1m2go_11`,divergence:`_divergence_1m2go_12`,count:`_count_1m2go_13`,scope:`_scope_1m2go_14`,changesScroll:`_changesScroll_1m2go_15`,groupHeading:`_groupHeading_1m2go_16`,list:`_list_1m2go_18`,changeRow:`_changeRow_1m2go_19`,change:`_change_1m2go_15`,diffScroll:`_diffScroll_1m2go_23`,filename:`_filename_1m2go_25`,status:`_status_1m2go_27`,added:`_added_1m2go_28`,removed:`_removed_1m2go_29`,fileAction:`_fileAction_1m2go_30`,commitFooter:`_commitFooter_1m2go_32`,commitForm:`_commitForm_1m2go_33`,rootHint:`_rootHint_1m2go_36`,actionRow:`_actionRow_1m2go_37`,hint:`_hint_1m2go_38`,feedback:`_feedback_1m2go_38`,feedbackRow:`_feedbackRow_1m2go_41`,actionButton:`_actionButton_1m2go_44`,branchPopover:`_branchPopover_1m2go_46`,pickerHeader:`_pickerHeader_1m2go_47`,branchSearch:`_branchSearch_1m2go_49`,field:`_field_1m2go_49`,branchList:`_branchList_1m2go_50`,branchOption:`_branchOption_1m2go_52`,newBranch:`_newBranch_1m2go_56`,form:`_form_1m2go_58`,checkbox:`_checkbox_1m2go_60`,diffSummary:`_diffSummary_1m2go_64`,stats:`_stats_1m2go_65`,diff:`_diff_1m2go_23`,diffLine:`_diffLine_1m2go_68`,lineNumber:`_lineNumber_1m2go_69`,lineText:`_lineText_1m2go_70`,diffHunk:`_diffHunk_1m2go_74`,diffNotice:`_diffNotice_1m2go_75`,noNewline:`_noNewline_1m2go_76`,reviewLayout:`_reviewLayout_1m2go_79`,inlinePreview:`_inlinePreview_1m2go_82`,inlineDiffToolbar:`_inlineDiffToolbar_1m2go_84`,diffIdentity:`_diffIdentity_1m2go_85`,diffDetails:`_diffDetails_1m2go_86`,diffArea:`_diffArea_1m2go_87`,diffNavigation:`_diffNavigation_1m2go_89`,diffPosition:`_diffPosition_1m2go_90`,diffViewport:`_diffViewport_1m2go_92`},D=b();function O({children:e,preview:t,selectionKey:n,onClose:r}){let i=(0,x.useRef)(null),a=!!t;return(0,x.useEffect)(()=>{a&&n&&i.current?.querySelector(`[data-git-file][aria-pressed="true"]`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[n,a]),(0,D.jsxs)(`div`,{className:E.reviewLayout,"data-preview":a,ref:i,children:[e,t&&(0,D.jsx)(`div`,{className:E.inlinePreview,role:`region`,"aria-label":v(`差异预览`,`Diff preview`),onKeyDown:e=>{e.key===`Escape`&&!e.nativeEvent.isComposing&&!e.defaultPrevented&&(e.preventDefault(),r())},children:t})]})}function k(e){return e===`staged`?v(`已暂存`,`Staged`):e===`unstaged`?v(`未暂存`,`Unstaged`):v(`未跟踪`,`Untracked`)}function A(e){let t=0,n=0,r=!1,i=e.split(`
2
+ `);return i.at(-1)===``&&i.pop(),i.map(e=>{let i=e.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(e.startsWith(`diff --git `)&&(r=!1),i&&(t=Number(i[1]),n=Number(i[2]),r=!0),r&&!i){if(e.startsWith(`+`))return{kind:`add`,text:e,oldLine:null,newLine:n++};if(e.startsWith(`-`))return{kind:`remove`,text:e,oldLine:t++,newLine:null};if(e.startsWith(` `))return{kind:`context`,text:e,oldLine:t++,newLine:n++}}return{kind:`meta`,text:e,oldLine:null,newLine:null}})}function j(e){let t=[],n=[],r=[],i=null,a=``,o=``,s=``;for(let c of A(e)){if(c.kind!==`meta`){c.kind===`context`?i=null:i===null&&(i=n.length,n.push(t.length)),t.push({...c,kind:c.kind,change:i});continue}let e=c.text.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@\s?(.*)$/);if(e)i=null,t.push({kind:`hunk`,oldLine:Number(e[1]),newLine:Number(e[2]),text:e[3],change:null});else if(c.text===`\`){let e=t.at(-1);e&&e.kind!==`hunk`&&(e.noNewline=!0)}else c.text.startsWith(`diff --git `)?(i=null,a=o=s=``):c.text.startsWith(`old mode `)?a=c.text.slice(9):c.text.startsWith(`new mode `)?r.push({kind:`mode`,from:a,to:c.text.slice(9)}):c.text.startsWith(`rename from `)?o=c.text.slice(12):c.text.startsWith(`rename to `)?r.push({kind:`rename`,from:o,to:c.text.slice(10)}):c.text.startsWith(`copy from `)?s=c.text.slice(10):c.text.startsWith(`copy to `)?r.push({kind:`copy`,from:s,to:c.text.slice(8)}):c.text.startsWith(`new file mode `)?r.push({kind:`added`,from:``,to:c.text.slice(14)}):c.text.startsWith(`deleted file mode `)&&r.push({kind:`deleted`,from:c.text.slice(18),to:``})}return{lines:t,changes:n,notices:r.filter(e=>!n.length||e.kind!==`added`&&e.kind!==`deleted`)}}function M({path:e,label:n,value:i,loading:a,error:o,refresh:s,onClose:c}){let l=i?.kind===`text`?i.patch:``,d=(0,x.useMemo)(()=>j(l),[l,e]),{lines:f,changes:p,notices:m}=d,h=(0,x.useRef)(null),[_,y]=(0,x.useState)(null),b=_?.preview===d?_.index:-1;(0,x.useEffect)(()=>{h.current?.scrollTo({top:0,left:0})},[d]);let S=e=>{if(a||o||e<0||e>=p.length)return;let t=h.current,n=t?.querySelector(`[data-change="${e}"][data-change-start="true"]`);t&&n&&(t.scrollTo({top:t.scrollTop+n.getBoundingClientRect().top-t.getBoundingClientRect().top,left:t.scrollLeft}),y({preview:d,index:e}))},C=f.filter(e=>e.kind===`add`).length,w=f.filter(e=>e.kind===`remove`).length,T=i?.kind===`text`&&(0,D.jsxs)(`span`,{className:E.stats,children:[(0,D.jsxs)(`span`,{className:E.added,children:[`+`,C]}),(0,D.jsxs)(`span`,{className:E.removed,children:[`−`,w]})]}),O={empty:v(`此文件在所选范围内没有文本差异,或已不在改动列表中。`,`No text differences in this scope, or this file is no longer changed.`),binary:v(`二进制文件不支持文本差异预览。`,`Text diff is unavailable for binary files.`),"too-large":v(`差异过大,最多显示 512 KB / 10000 行。`,`Diff exceeds the preview limit of 512 KB / 10000 lines.`),unsupported:v(`此文件类型不支持差异预览。`,`Diff is unavailable for this file type.`),conflict:v(`此文件存在未解决的合并冲突,请在工作区文件或终端中检查。`,`This file has unresolved merge conflicts. Inspect it in workspace files or the terminal.`),submodule:v(`子模块已发生变化,请在子模块工作区中查看具体差异。`,`Submodule changed. Open its workspace to inspect the changes.`)};return(0,D.jsxs)(`div`,{className:g.body,children:[(0,D.jsxs)(`div`,{className:c?E.inlineDiffToolbar:g.toolbar,children:[c?(0,D.jsxs)(`div`,{className:E.diffIdentity,children:[(0,D.jsx)(`span`,{className:g.path,title:e,children:e}),(0,D.jsxs)(`div`,{className:E.diffDetails,children:[(0,D.jsx)(`span`,{className:E.diffArea,title:n,children:n}),T]})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:g.path,title:e,children:e}),(0,D.jsx)(`span`,{className:g.readonly,children:v(`只读`,`Read only`)})]}),(0,D.jsxs)(`div`,{className:E.diffNavigation,role:`group`,"aria-label":v(`改动跳转`,`Change navigation`),children:[(0,D.jsx)(`button`,{type:`button`,className:g.iconButton,"aria-label":v(`上一处改动`,`Previous change`),title:v(`上一处改动`,`Previous change`),disabled:a||o||b<=0,onClick:()=>S(b-1),children:(0,D.jsx)(t,{})}),(0,D.jsxs)(`span`,{className:E.diffPosition,role:`status`,"aria-label":v(`改动位置`,`Change position`),"aria-live":`polite`,"aria-atomic":`true`,title:v(`第 ${b+1} / ${p.length} 处改动`,`Change ${b+1} of ${p.length}`),children:[b+1,`/`,p.length]}),(0,D.jsx)(`button`,{type:`button`,className:g.iconButton,"aria-label":v(`下一处改动`,`Next change`),title:v(`下一处改动`,`Next change`),disabled:a||o||b+1>=p.length,onClick:()=>S(b+1),children:(0,D.jsx)(u,{})})]}),(0,D.jsx)(`button`,{type:`button`,className:g.iconButton,"aria-label":v(`刷新差异`,`Refresh diff`),title:v(`刷新差异`,`Refresh diff`),onClick:s,children:(0,D.jsx)(r,{})}),c&&(0,D.jsx)(`button`,{type:`button`,className:g.iconButton,"aria-label":v(`关闭差异预览`,`Close diff preview`),title:v(`关闭差异预览 · Esc`,`Close diff preview · Esc`),onClick:c,children:`×`})]}),!c&&(0,D.jsxs)(`div`,{className:E.diffSummary,children:[(0,D.jsx)(`span`,{children:n}),T]}),o&&(0,D.jsxs)(`div`,{className:g.state,role:`status`,children:[v(`差异读取失败,请重试。`,`Could not read this diff. Try again.`),` `,(0,D.jsx)(`button`,{type:`button`,className:g.textButton,onClick:s,children:v(`重试`,`Retry`)})]}),(0,D.jsxs)(`div`,{className:`${g.preview} ${E.diffViewport}`,"aria-busy":a,children:[!i&&!o&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:v(`正在读取差异…`,`Reading diff…`)}),i&&i.kind!==`text`&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:O[i.kind]}),i?.kind===`text`&&(0,D.jsxs)(`div`,{ref:h,className:E.diffScroll,tabIndex:0,role:`region`,"aria-label":v(`文件差异`,`File diff`),children:[m.map((e,t)=>(0,D.jsx)(`p`,{className:E.diffNotice,children:N(e)},t)),!f.length&&!m.length&&(0,D.jsx)(`p`,{className:g.state,children:O.empty}),(0,D.jsx)(`pre`,{className:E.diff,children:(0,D.jsx)(`code`,{children:f.map((e,t)=>e.kind===`hunk`?(0,D.jsxs)(`span`,{className:E.diffHunk,"data-kind":`hunk`,children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,children:`···`}),(0,D.jsxs)(`span`,{children:[v(`行 ${e.oldLine} / ${e.newLine}`,`Lines ${e.oldLine} / ${e.newLine}`),e.text&&` · ${e.text}`]})]},t):(0,D.jsxs)(`span`,{className:E.diffLine,"data-kind":e.kind,"data-change":e.change??void 0,"data-change-start":e.change!==null&&p[e.change]===t?`true`:void 0,"data-active":e.change!==null&&b===e.change?`true`:void 0,children:[(0,D.jsx)(`span`,{className:E.lineNumber,"aria-hidden":`true`,children:e.oldLine}),(0,D.jsx)(`span`,{className:E.lineNumber,"aria-hidden":`true`,children:e.newLine}),(0,D.jsxs)(`span`,{className:E.lineText,children:[e.text||` `,e.noNewline&&(0,D.jsx)(`span`,{className:E.noNewline,title:v(`文件末尾无换行`,`No newline at end of file`),"aria-label":v(`文件末尾无换行`,`No newline at end of file`),children:`↵`})]})]},t))})})]})]})]})}function N(e){switch(e.kind){case`mode`:return v(`文件权限:${e.from} → ${e.to}`,`File mode: ${e.from} → ${e.to}`);case`rename`:return v(`重命名:${e.from} → ${e.to}`,`Renamed: ${e.from} → ${e.to}`);case`copy`:return v(`复制:${e.from} → ${e.to}`,`Copied: ${e.from} → ${e.to}`);case`added`:return v(`新增空文件`,`Empty file added`);case`deleted`:return v(`删除空文件`,`Empty file deleted`)}}var P=(0,x.memo)(function({sessionId:e,path:t,area:n,visible:r,idle:i,onClose:a}){_();let o=T((0,x.useCallback)(r=>w.diff(e,t,n,r),[e,t,n]),r,i);return(0,D.jsx)(M,{path:t,label:k(n),onClose:a,...o})});function F(e,t){if(!e)return null;let n=t.find(t=>t.path===e.path);if(!n)return null;let r=n.conflict?[`unstaged`]:n.untracked?[`untracked`]:[...n.worktree===`.`?[]:[`unstaged`],...n.index===`.`?[]:[`staged`]];return r.includes(e.area)?e:r[0]?{path:e.path,area:r[0]}:null}function I({branch:e,control:t,disabled:r,model:a,open:o,onOpenChange:s,onDraftChange:c,onWrite:l}){let d=(0,x.useRef)(null),p=(0,x.useRef)(null),m=(0,x.useRef)(null),[_,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)(``);h(p,o,()=>s(!1)),(0,x.useEffect)(()=>{if(!o){y(!1),T(``),C(!1);return}let e=e=>{e.target instanceof Node&&!d.current?.contains(e.target)&&s(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[o,s]),(0,x.useEffect)(()=>{_&&m.current?.focus()},[_]);let O=t?.scope?`root_required`:t?.dirty?`dirty_worktree`:null,k=t?.branches.filter(e=>e.name.toLocaleLowerCase().includes(w.toLocaleLowerCase()))??[],A=async(e,t)=>{C(!0),await l(e,t)&&s(!1)};return(0,D.jsxs)(`div`,{ref:d,className:E.branchPicker,children:[(0,D.jsxs)(`button`,{type:`button`,className:E.branchTrigger,disabled:!t,"aria-label":v(`管理分支`,`Manage branches`),"aria-haspopup":`dialog`,"aria-expanded":o,title:e??v(`分离 HEAD`,`Detached HEAD`),onClick:()=>s(!o),children:[(0,D.jsx)(i,{}),(0,D.jsx)(`span`,{children:e??v(`分离 HEAD`,`Detached HEAD`)}),(0,D.jsx)(u,{})]}),o&&(0,D.jsxs)(f,{ref:p,className:E.branchPopover,compact:!0,role:`dialog`,"aria-modal":`true`,"aria-label":v(`管理分支`,`Manage branches`),children:[(0,D.jsxs)(`div`,{className:E.pickerHeader,children:[(0,D.jsx)(`span`,{children:_?v(`新建分支`,`New branch`):v(`本地分支`,`Local branches`)}),(0,D.jsx)(`button`,{type:`button`,className:g.iconButton,"aria-label":v(`关闭分支面板`,`Close branches`),onClick:()=>s(!1),children:`×`})]}),_?(0,D.jsxs)(`form`,{className:E.form,"aria-label":v(`创建分支`,`Create branch`),onSubmit:e=>{e.preventDefault(),!r&&a.branch.trim()&&t?.head&&!(a.checkout&&O)&&A(`create-branch`,{branch:a.branch,checkout:a.checkout})},children:[(0,D.jsxs)(`label`,{className:E.field,children:[v(`分支名称`,`Branch name`),(0,D.jsx)(`input`,{ref:m,"aria-label":v(`新分支名称`,`New branch name`),maxLength:256,value:a.branch,disabled:a.pending,placeholder:`feature/name`,onChange:e=>{a.branch=e.target.value,c()}})]}),(0,D.jsxs)(`label`,{className:E.checkbox,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:a.checkout,disabled:a.pending,onChange:e=>{a.checkout=e.target.checked,c()}}),v(`创建后切换`,`Switch after creating`)]}),a.checkout&&O&&(0,D.jsx)(`p`,{className:E.hint,children:S(O)}),(0,D.jsxs)(`div`,{className:E.actionRow,children:[(0,D.jsx)(`button`,{type:`button`,className:g.textButton,onClick:()=>y(!1),children:v(`返回`,`Back`)}),(0,D.jsx)(`button`,{className:E.actionButton,type:`submit`,disabled:r||!a.branch.trim()||!t?.head||a.checkout&&!!O,children:v(`创建分支`,`Create branch`)})]})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`input`,{className:E.branchSearch,type:`search`,"data-modal-autofocus":!0,"aria-label":v(`搜索分支`,`Search branches`),value:w,placeholder:v(`搜索分支…`,`Search branches…`),onChange:e=>T(e.target.value)}),(0,D.jsxs)(`div`,{className:E.branchList,role:`group`,"aria-label":v(`本地分支`,`Local branches`),children:[k.map(e=>(0,D.jsxs)(`button`,{type:`button`,className:E.branchOption,title:e.name,disabled:r||!!O||e.current||e.occupied||!t?.head,"aria-label":v(`切换到分支:${e.name}`,`Switch to branch: ${e.name}`),onClick:()=>{A(`switch-branch`,{branch:e.name})},children:[(0,D.jsx)(i,{}),(0,D.jsx)(`span`,{children:e.name}),(e.current||e.occupied)&&(0,D.jsx)(`small`,{children:e.current?v(`当前`,`Current`):v(`其他工作树`,`Other worktree`)})]},e.name)),k.length===0&&(0,D.jsx)(`p`,{className:E.hint,children:v(`没有匹配的分支。`,`No matching branches.`)})]}),O&&(0,D.jsx)(`p`,{className:E.hint,children:S(O)}),(0,D.jsxs)(`button`,{type:`button`,className:E.newBranch,disabled:a.pending||!t?.head,"aria-label":v(`新建分支`,`New branch`),onClick:()=>y(!0),children:[(0,D.jsx)(n,{}),v(`新建分支…`,`New branch…`)]})]}),!t?.head&&(0,D.jsx)(`p`,{className:E.hint,children:S(`no_commits`)}),a.pending&&(0,D.jsx)(`p`,{className:E.hint,role:`status`,children:v(`正在执行…`,`Running…`)}),t?.blocked&&(0,D.jsx)(`p`,{className:E.hint,children:S(t.blocked)}),b&&a.outcome&&!a.outcome.ok&&(0,D.jsx)(`p`,{className:E.feedback,"data-error":`true`,role:`status`,children:S(a.outcome.reason)})]})]})}function L(e){let t=[],n=0,r=1,i=[];for(let a of e){let e=t.findIndex(e=>e.hash===a.hash),o=e<0?t.length:e,s=e<0?n++%4:t[o].color,c=[...t];e>=0&&t.splice(e,1);let l=Math.min(o,t.length),u=[...new Set(a.parents)];for(let[e,r]of u.entries())t.some(e=>e.hash===r)||t.splice(l++,0,{hash:r,color:e===0?s:n++%4});i.push({lane:o,color:s,incoming:e>=0,rails:c.flatMap((e,n)=>e.hash===a.hash?[]:[{from:n,to:t.findIndex(t=>t.hash===e.hash),color:e.color}]),parents:u.map(e=>{let n=t.findIndex(t=>t.hash===e);return{hash:e,from:o,to:n,color:t[n].color}})}),r=Math.max(r,o+1,c.length,t.length)}return{rows:i,width:r*16+16}}var R={history:`_history_1fyyf_1`,historyToolbar:`_historyToolbar_1fyyf_2`,graphScroll:`_graphScroll_1fyyf_3`,historyList:`_historyList_1fyyf_4`,commitRow:`_commitRow_1fyyf_5`,loadMore:`_loadMore_1fyyf_7`,parentLink:`_parentLink_1fyyf_7`,graph:`_graph_1fyyf_3`,commitCopy:`_commitCopy_1fyyf_15`,subject:`_subject_1fyyf_16`,refLine:`_refLine_1fyyf_17`,ref:`_ref_1fyyf_17`,merge:`_merge_1fyyf_20`,commitMeta:`_commitMeta_1fyyf_21`,detail:`_detail_1fyyf_27`,message:`_message_1fyyf_33`,parentList:`_parentList_1fyyf_35`,parentSelect:`_parentSelect_1fyyf_36`,fileStats:`_fileStats_1fyyf_38`},z=(0,x.memo)(function({sessionId:e,visible:t,idle:n,model:r,onCommit:i}){let a=_(),{value:o,loading:s,error:c,refresh:l}=T((0,x.useCallback)(t=>w.history(e,void 0,t),[e]),t,n),[u,d]=(0,x.useState)(r.history),[f,p]=(0,x.useState)(r.selected),[m,h]=(0,x.useState)(!1),[y,b]=(0,x.useState)(!1),S=()=>{b(!1),l()},C=(0,x.useRef)(null);(0,x.useEffect)(()=>{o&&(r.history?.snapshot===o.snapshot&&r.history.commits.length||(C.current?.abort(),h(!1),b(!1),r.history=o,d(o)))},[o,r]),(0,x.useEffect)(()=>(t||(C.current?.abort(),h(!1)),()=>C.current?.abort()),[t]);let E=async()=>{let t=r.history;if(!t?.nextCursor||m)return;let n=new AbortController;C.current=n,h(!0),b(!1);try{let i=await w.history(e,t.nextCursor,n.signal);if(n.signal.aborted||r.history?.snapshot!==i.snapshot||r.history.nextCursor!==t.nextCursor)return;let a=new Set(t.commits.map(e=>e.hash)),o={...i,commits:[...t.commits,...i.commits.filter(e=>!a.has(e.hash))]};r.history=o,d(o)}catch{n.signal.aborted||b(!0)}finally{n.signal.aborted||h(!1)}},O=(0,x.useMemo)(()=>L(u?.commits??[]),[u?.commits]),k=e=>e*16+12,A=e=>{r.selected=e,p(e),i(e)},j={"--git-graph-width":`${O.width}px`};return(0,D.jsxs)(`div`,{className:R.history,"aria-busy":s||m,children:[(0,D.jsxs)(`div`,{className:R.historyToolbar,children:[(0,D.jsx)(`span`,{children:v(`提交历史与分支图`,`Commit history & graph`)}),(0,D.jsx)(`button`,{className:g.textButton,type:`button`,onClick:S,"aria-label":v(`刷新提交历史`,`Refresh history`),children:v(`刷新`,`Refresh`)})]}),u?.scope&&(0,D.jsxs)(`p`,{className:g.state,children:[v(`展示仓库提交关系;文件差异仅限当前目录:`,`Repository history; file diffs are limited to: `),u.scope]}),(c||y)&&(0,D.jsxs)(`p`,{className:g.state,role:`status`,children:[v(`历史读取失败或分支已变化,请刷新历史。`,`Could not read history, or refs changed. Refresh history.`),` `,(0,D.jsx)(`button`,{className:g.textButton,type:`button`,onClick:S,children:v(`重试`,`Retry`)})]}),!u&&!c&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:v(`正在读取历史…`,`Reading history…`)}),u?.kind===`not-repository`&&(0,D.jsx)(`p`,{className:g.state,children:v(`当前工作区不在 Git 仓库中。`,`This workspace is not in a Git repository.`)}),u?.kind===`unavailable`&&(0,D.jsx)(`p`,{className:g.state,children:v(`Git 不可用。`,`Git is unavailable.`)}),u?.kind===`repository`&&u.commits.length===0&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:v(`仓库尚无提交。`,`This repository has no commits yet.`)}),(0,D.jsx)(`div`,{className:R.graphScroll,children:(0,D.jsx)(`ol`,{className:R.historyList,style:j,"aria-label":v(`提交历史`,`Commit history`),children:u?.commits.map((e,t)=>{let n=O.rows[t],r=u.refs.filter(t=>t.hash===e.hash),i=new Date(e.authoredAt),o=Number.isNaN(i.getTime())?e.authoredAt:i.toLocaleDateString(a===`zh`?`zh-CN`:`en-US`);return(0,D.jsx)(`li`,{children:(0,D.jsxs)(`button`,{type:`button`,className:R.commitRow,"data-commit":e.hash,"aria-current":f===e.hash?`true`:void 0,"aria-label":v(`查看提交 ${e.hash.slice(0,7)}:${e.subject}`,`View commit ${e.hash.slice(0,7)}: ${e.subject}`),onClick:()=>A(e.hash),children:[(0,D.jsxs)(`svg`,{width:O.width,height:84,className:R.graph,"aria-hidden":`true`,"data-git-graph-row":e.hash,children:[n.rails.map((e,t)=>(0,D.jsx)(`path`,{"data-color":e.color,d:`M${k(e.from)} 0 L${k(e.from)} 42 C${k(e.from)} 64 ${k(e.to)} 64 ${k(e.to)} 84`},`r${t}`)),n.incoming&&(0,D.jsx)(`path`,{"data-color":n.color,d:`M${k(n.lane)} 0 V42`}),n.parents.map(e=>(0,D.jsx)(`path`,{"data-parent":e.hash,"data-color":e.color,d:`M${k(n.lane)} 42 C${k(n.lane)} 64 ${k(e.to)} 64 ${k(e.to)} 84`},e.hash)),(0,D.jsx)(`circle`,{"data-color":n.color,cx:k(n.lane),cy:42,r:4})]}),(0,D.jsxs)(`span`,{className:R.commitCopy,children:[(0,D.jsx)(`span`,{className:R.subject,children:e.subject||v(`(无提交说明)`,`(No subject)`)}),(0,D.jsxs)(`span`,{className:R.refLine,title:r.map(e=>`${e.kind}: ${e.name}`).join(` · `),children:[u.head===e.hash&&(0,D.jsx)(`span`,{className:R.ref,"data-kind":`head`,children:`HEAD`}),r.map(e=>(0,D.jsxs)(`span`,{className:R.ref,"data-kind":e.kind,children:[e.kind===`tag`?`${v(`标签`,`tag`)}: `:e.kind===`remote`?`${v(`远端`,`remote`)}: `:``,e.name]},`${e.kind}/${e.name}`)),e.parents.length>1&&(0,D.jsx)(`span`,{className:R.merge,children:v(`合并`,`Merge`)})]}),(0,D.jsxs)(`span`,{className:R.commitMeta,children:[(0,D.jsx)(`code`,{children:e.hash.slice(0,7)}),(0,D.jsx)(`span`,{children:e.author}),(0,D.jsx)(`time`,{dateTime:e.authoredAt,title:e.authoredAt,children:o})]})]})]})},e.hash)})})}),u?.nextCursor&&(0,D.jsx)(`button`,{type:`button`,className:R.loadMore,disabled:m||s||u.snapshot!==o?.snapshot,onClick:()=>{E()},children:m?v(`正在加载…`,`Loading…`):v(`加载更多提交`,`Load more commits`)})]})});function B(e){return{A:v(`新增`,`Added`),M:v(`修改`,`Modified`),D:v(`删除`,`Deleted`),R:v(`重命名`,`Renamed`),C:v(`复制`,`Copied`),T:v(`类型变化`,`Type changed`),U:v(`冲突`,`Conflict`),"?":v(`未跟踪`,`Untracked`)}[e]??e}var V=(0,x.memo)(function({sessionId:e,visible:t,idle:n,model:i,onCommit:a}){_();let o=(0,x.useRef)(null),[c,l]=(0,x.useState)(i.selection),u=(0,x.useCallback)(e=>{i.selection=e,l(e)},[i]),d=(0,x.useCallback)(()=>{let e=o.current?.querySelector(`[data-git-file][aria-pressed="true"]`);u(null),requestAnimationFrame(()=>e?.focus({preventScroll:!0}))},[u]),[f,h]=(0,x.useState)(i.view),y=(0,x.useRef)(null);(0,x.useEffect)(()=>{if(!t)return;let e=p(document);return y.current=e,()=>{e.dispose(),y.current=null}},[t]);let{value:b,loading:C,error:A}=T((0,x.useCallback)(t=>w.status(e,t),[e]),t&&f===`changes`,n),{value:j,loading:M,error:N}=T((0,x.useCallback)(t=>w.control(e,t),[e]),t&&f===`changes`,n),[L,R]=(0,x.useState)(!1);(0,x.useEffect)(()=>{t&&f===`changes`||R(!1)},[t,f]);let[,V]=(0,x.useReducer)(e=>e+1,0);(0,x.useEffect)(()=>{let e=()=>V();return window.addEventListener(`pi-workspace-git-changed`,e),()=>window.removeEventListener(`pi-workspace-git-changed`,e)},[]);let H=()=>window.dispatchEvent(new Event(`pi-workspace-git-changed`)),U=n?j?.blocked:`agent_busy`,W=i.pending||!j?.version||M||N||A||!!U,G=async(t,n={})=>{if(W||i.pending||!j)return!1;i.pending=!0,i.outcome=null,V();try{return await w.write(e,{action:t,expected:j.version,...n}),i.outcome={ok:!0,reason:t},t===`commit`&&i.message===n.message&&(i.message=``,i.coAuthor=!1),t===`create-branch`&&i.branch===n.branch&&(i.branch=``),!0}catch(e){return i.outcome={ok:!1,reason:e instanceof s?e.reason??(e.status<500?`git_failed`:`outcome_unknown`):`outcome_unknown`},!1}finally{i.pending=!1,window.dispatchEvent(new Event(`pi-workspace-git-changed`))}},K=b?.kind===`repository`?b:null;(0,x.useEffect)(()=>{if(!t||f!==`changes`||C||A||!b)return;let e=F(i.selection,b.kind===`repository`?b.entries:[]);e!==i.selection&&(i.selection=e,l(e))},[b,C,A,t,f,i]);let q=K?[{title:v(`冲突`,`Conflicts`),area:`unstaged`,changes:K.entries.filter(e=>e.conflict),conflict:!0},{title:k(`staged`),area:`staged`,changes:K.entries.filter(e=>!e.conflict&&!e.untracked&&e.index!==`.`)},{title:k(`unstaged`),area:`unstaged`,changes:K.entries.filter(e=>!e.conflict&&!e.untracked&&e.worktree!==`.`)},{title:k(`untracked`),area:`untracked`,changes:K.entries.filter(e=>e.untracked)}]:[],J=!W&&!K?.scope&&!!j?.staged&&!!i.message.trim(),Y=K?.root.split(/[\\/]/).at(-1)??``,X=K?[K.root,K.head,K.upstream??v(`未设置上游分支`,`No upstream branch`)].filter(Boolean).join(`
3
+ `):``;return(0,D.jsxs)(`div`,{ref:o,className:`${g.body} ${E.panel}`,children:[(0,D.jsxs)(`div`,{className:g.toolbar,children:[(0,D.jsx)(`div`,{className:E.viewSwitch,role:`group`,"aria-label":v(`Git 视图`,`Git view`),children:[`changes`,`history`].map(e=>(0,D.jsx)(`button`,{type:`button`,className:`${g.textButton} ${E.viewButton}`,"aria-pressed":f===e,onClick:()=>{i.view=e,h(e)},children:e===`changes`?v(`改动`,`Changes`):v(`历史`,`History`)},e))}),f===`history`&&(0,D.jsx)(`span`,{className:g.readonly,children:v(`只读`,`Read only`)}),f===`changes`&&(0,D.jsx)(`button`,{type:`button`,className:g.iconButton,"aria-label":v(`刷新 Git 状态`,`Refresh Git status`),title:v(`刷新 Git 状态`,`Refresh Git status`),onClick:H,children:(0,D.jsx)(r,{})})]}),f===`history`?(0,D.jsx)(`div`,{className:g.scroll,children:(0,D.jsx)(z,{sessionId:e,visible:t,idle:n,model:i,onCommit:a})}):(0,D.jsxs)(D.Fragment,{children:[K&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:E.repoBar,children:[(0,D.jsx)(I,{branch:K.branch,control:j,disabled:W,model:i,open:L,onOpenChange:R,onDraftChange:V,onWrite:G}),(0,D.jsx)(`span`,{className:E.repoName,title:X,children:Y}),K.upstream&&K.ahead!==null&&(0,D.jsxs)(`span`,{className:E.divergence,title:v(`上游差异(本地记录)`,`Upstream divergence (local refs)`),children:[`↑`,K.ahead,` ↓`,K.behind]}),(0,D.jsxs)(`span`,{className:E.count,title:v(`改动文件`,`Changed files`),children:[K.entries.length,K.truncated?`+`:``]})]}),K.scope&&(0,D.jsxs)(`div`,{className:E.scope,title:K.scope,children:[v(`当前目录:`,`Directory: `),K.scope]})]}),(0,D.jsx)(O,{selectionKey:c?JSON.stringify(c):null,onClose:d,preview:c&&K?(0,D.jsx)(P,{sessionId:e,path:c.path,area:c.area,visible:t&&f===`changes`,idle:n,onClose:d},JSON.stringify([e,c])):null,children:(0,D.jsxs)(`div`,{className:`${g.scroll} ${E.changesScroll}`,"aria-busy":C,role:`region`,"aria-label":v(`改动文件`,`Changed files`),children:[A&&(0,D.jsxs)(`div`,{className:g.state,role:`status`,children:[v(`Git 读取失败,请检查仓库或重试。`,`Could not read Git. Check the repository or try again.`),` `,(0,D.jsx)(`button`,{type:`button`,className:g.textButton,onClick:H,children:v(`重试`,`Retry`)})]}),!b&&!A&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:v(`正在读取仓库…`,`Reading repository…`)}),b?.kind===`not-repository`&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:v(`当前工作区不在 Git 仓库中。`,`This workspace is not in a Git repository.`)}),b?.kind===`unavailable`&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:v(`Git 不可用,请在 Pi 所在机器安装 Git。`,`Git is unavailable. Install Git on the machine running Pi.`)}),K&&(0,D.jsxs)(D.Fragment,{children:[K.entries.length===0&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:K.scope?v(`当前目录没有未提交改动。`,`No uncommitted changes in this directory.`):v(`工作区干净,没有未提交改动。`,`Working tree clean. No uncommitted changes.`)}),q.filter(e=>e.changes.length>0).map(e=>(0,D.jsxs)(`section`,{"aria-label":e.title,children:[(0,D.jsxs)(`h3`,{className:E.groupHeading,children:[e.title,(0,D.jsx)(`span`,{children:e.changes.length})]}),(0,D.jsx)(`ul`,{className:E.list,children:e.changes.map(t=>{let n=e.conflict?`U`:e.area===`staged`?t.index:t.worktree;return(0,D.jsxs)(`li`,{className:E.changeRow,children:[(0,D.jsxs)(`button`,{type:`button`,className:E.change,title:t.originalPath?`${t.originalPath} → ${t.path}`:t.path,"data-git-file":JSON.stringify([e.area,t.path]),"aria-pressed":c?.path===t.path&&c.area===e.area,onClick:()=>u({path:t.path,area:e.area}),"aria-label":`${t.path}, ${B(n)}`,children:[(0,D.jsx)(m,{path:t.path,size:16}),(0,D.jsxs)(`span`,{className:E.filename,children:[t.path,t.originalPath&&(0,D.jsxs)(`small`,{children:[t.originalPath,` → `,t.path]})]}),(0,D.jsx)(`span`,{className:E.status,"data-status":n,"aria-hidden":`true`,children:n})]}),!e.conflict&&!t.submodule&&(0,D.jsx)(`button`,{type:`button`,className:E.fileAction,disabled:W,"aria-label":e.area===`staged`?v(`取消暂存 ${t.path}`,`Unstage ${t.path}`):v(`暂存 ${t.path}`,`Stage ${t.path}`),title:e.area===`staged`?v(`取消暂存`,`Unstage`):v(`暂存`,`Stage`),onClick:()=>{G(e.area===`staged`?`unstage`:`stage`,{path:t.path})},children:e.area===`staged`?`−`:`+`})]},t.path)})})]},e.title)),K.truncated&&(0,D.jsx)(`p`,{className:g.state,children:v(`仅显示前 1000 个改动文件,请缩小工作区范围。`,`Showing the first 1000 changed files. Open a smaller workspace to see more.`)})]})]})}),K&&(0,D.jsxs)(`div`,{className:E.commitFooter,"aria-busy":i.pending,children:[U&&(0,D.jsx)(`p`,{className:E.hint,role:`status`,children:S(U)}),N&&(0,D.jsx)(`p`,{className:E.hint,role:`status`,children:v(`操作状态读取失败,请刷新。`,`Could not read operation state. Refresh to retry.`)}),i.pending&&!L&&(0,D.jsx)(`p`,{className:E.hint,role:`status`,children:v(`正在执行 Git 操作…`,`Running Git operation…`)}),i.outcome&&!L&&(0,D.jsxs)(`div`,{className:E.feedbackRow,children:[(0,D.jsx)(`p`,{className:E.feedback,"data-error":!i.outcome.ok,role:`status`,children:S(i.outcome.reason)}),(0,D.jsx)(`button`,{type:`button`,className:g.iconButton,"aria-label":v(`关闭 Git 提示`,`Dismiss Git message`),onClick:()=>{i.outcome=null,V()},children:`×`})]}),K.scope?(0,D.jsx)(`p`,{className:E.rootHint,title:S(`root_required`),children:v(`提交请打开仓库根目录`,`Commit from repository root`)}):(0,D.jsxs)(`form`,{className:E.commitForm,"aria-label":v(`创建提交`,`Create commit`),onSubmit:e=>{e.preventDefault(),J&&G(`commit`,{message:i.message,coAuthor:i.coAuthor})},children:[(0,D.jsx)(`textarea`,{"aria-label":v(`提交说明`,`Commit message`),rows:1,maxLength:8192,disabled:i.pending,value:i.message,placeholder:v(`提交说明…`,`Commit message…`),onChange:e=>{i.message=e.target.value,V()},onKeyDown:e=>{let t=y.current?.guards(e.nativeEvent)??e.nativeEvent.isComposing;e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!t&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,D.jsxs)(`label`,{className:E.checkbox,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:i.coAuthor,disabled:i.pending,onChange:e=>{i.coAuthor=e.target.checked,V()}}),v(`添加 pi-webapp 为共同作者`,`Add pi-webapp as co-author`)]}),(0,D.jsxs)(`div`,{className:E.actionRow,children:[(0,D.jsx)(`span`,{className:E.hint,children:j?.staged?v(`仅暂存区 · ${j.staged} 个文件`,`Staged only · ${j.staged} files`):v(`先暂存要提交的文件`,`Stage files to commit`)}),(0,D.jsx)(`button`,{className:E.actionButton,type:`submit`,disabled:!J,title:v(`仅提交暂存区 · ⌘/Ctrl+Enter`,`Commit staged files · ⌘/Ctrl+Enter`),children:v(`提交`,`Commit`)})]})]})]})]})]})}),H=(0,x.memo)(function({sessionId:e,hash:t,visible:n,idle:i,onCommit:a}){_();let o=(0,x.useRef)(null),[s,c]=(0,x.useState)(null),l=()=>{let e=o.current?.querySelector(`[data-git-file][aria-pressed="true"]`);c(null),requestAnimationFrame(()=>e?.focus({preventScroll:!0}))},[u,d]=(0,x.useState)(0),{value:f,loading:p,error:h,refresh:y}=T((0,x.useCallback)(n=>w.commit(e,t,u,n),[e,t,u]),n,i,!1),b=f?.parentIndex===u?f:null;return(0,x.useEffect)(()=>{b&&s&&!b.files.some(e=>e.path===s)&&c(null)},[b,s]),(0,D.jsxs)(`div`,{className:`${g.body} ${E.panel}`,ref:o,children:[(0,D.jsxs)(`div`,{className:g.toolbar,children:[(0,D.jsxs)(`span`,{className:g.path,children:[v(`提交详情`,`Commit details`),` · `,t.slice(0,7)]}),(0,D.jsx)(`span`,{className:g.readonly,children:v(`只读`,`Read only`)}),(0,D.jsx)(`button`,{className:g.iconButton,type:`button`,onClick:y,"aria-label":v(`刷新提交详情`,`Refresh commit`),children:(0,D.jsx)(r,{})})]}),(0,D.jsx)(O,{selectionKey:s,onClose:l,preview:s&&b?(0,D.jsx)(U,{sessionId:e,hash:t,path:s,parentIndex:u,visible:n,idle:i,onClose:l},JSON.stringify([e,t,u,s])):null,children:(0,D.jsxs)(`div`,{className:g.scroll,"aria-busy":p,children:[h&&(0,D.jsxs)(`p`,{className:g.state,role:`status`,children:[v(`提交读取失败,可能已不可达。`,`Could not read this commit. It may no longer be reachable.`),` `,(0,D.jsx)(`button`,{className:g.textButton,type:`button`,onClick:y,children:v(`重试`,`Retry`)})]}),!f&&!h&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:v(`正在读取提交…`,`Reading commit…`)}),f&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:R.detail,children:[(0,D.jsx)(`h2`,{children:f.subject||v(`(无提交说明)`,`(No subject)`)}),(0,D.jsxs)(`dl`,{children:[(0,D.jsx)(`dt`,{children:v(`提交`,`Commit`)}),(0,D.jsx)(`dd`,{children:(0,D.jsx)(`code`,{children:f.hash})}),(0,D.jsx)(`dt`,{children:v(`作者`,`Author`)}),(0,D.jsxs)(`dd`,{children:[f.author,` <`,f.email,`>`]}),(0,D.jsx)(`dt`,{children:v(`创作时间`,`Authored`)}),(0,D.jsx)(`dd`,{children:(0,D.jsx)(`time`,{dateTime:f.authoredAt,children:f.authoredAt})}),(0,D.jsx)(`dt`,{children:v(`提交者`,`Committer`)}),(0,D.jsxs)(`dd`,{children:[f.committer,` <`,f.committerEmail,`>`]}),(0,D.jsx)(`dt`,{children:v(`提交时间`,`Committed`)}),(0,D.jsx)(`dd`,{children:(0,D.jsx)(`time`,{dateTime:f.committedAt,children:f.committedAt})}),(0,D.jsx)(`dt`,{children:v(`父提交`,`Parents`)}),(0,D.jsx)(`dd`,{className:R.parentList,children:f.parents.length?f.parents.map((e,t)=>(0,D.jsx)(`button`,{type:`button`,className:R.parentLink,onClick:()=>a(e),"aria-label":v(`打开父提交 ${t+1}:${e.slice(0,7)}`,`Open parent ${t+1}: ${e.slice(0,7)}`),children:(0,D.jsx)(`code`,{children:e.slice(0,7)})},e)):v(`根提交`,`Root commit`)})]}),(0,D.jsx)(`div`,{className:R.message,"aria-label":v(`完整提交说明`,`Full commit message`),children:f.message}),f.scope&&(0,D.jsxs)(`p`,{className:g.state,children:[v(`文件改动仅限:`,`File changes limited to: `),f.scope]})]}),f.parents.length>1?(0,D.jsxs)(`label`,{className:R.parentSelect,children:[v(`比较基准`,`Compare against`),(0,D.jsx)(`select`,{"aria-label":v(`比较父提交`,`Compare parent`),value:u,onChange:e=>{c(null),d(Number(e.target.value))},children:f.parents.map((e,t)=>(0,D.jsxs)(`option`,{value:t,children:[v(`父提交 ${t+1}`,`Parent ${t+1}`),` · `,e.slice(0,7)]},`${t}/${e}`))})]}):(0,D.jsx)(`p`,{className:g.state,children:f.parents.length?v(`与父提交比较`,`Compared with parent`):v(`与空目录比较`,`Compared with empty tree`)}),!b&&!h&&(0,D.jsx)(`p`,{className:g.state,role:`status`,children:v(`正在读取文件改动…`,`Reading changed files…`)}),b&&(0,D.jsxs)(`section`,{"aria-label":v(`提交文件`,`Commit files`),children:[(0,D.jsxs)(`h3`,{className:E.groupHeading,children:[v(`改动文件`,`Changed files`),(0,D.jsxs)(`span`,{children:[b.files.length,b.truncated?`+`:``]})]}),b.files.length===0&&(0,D.jsx)(`p`,{className:g.state,children:v(`所选比较在当前目录中没有文件改动。`,`No file changes in this directory for this comparison.`)}),(0,D.jsx)(`ul`,{className:E.list,children:b.files.map(e=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(`button`,{className:E.change,type:`button`,"data-git-file":e.path,"aria-pressed":s===e.path,onClick:()=>c(e.path),"aria-label":v(`查看提交差异:${e.path}`,`View commit diff: ${e.path}`),children:[(0,D.jsx)(m,{path:e.path,size:16}),(0,D.jsx)(`span`,{className:E.filename,children:e.path}),(0,D.jsx)(`span`,{className:R.fileStats,children:e.additions===null?v(`二进制`,`Binary`):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`span`,{className:E.added,children:[`+`,e.additions]}),(0,D.jsxs)(`span`,{className:E.removed,children:[`−`,e.deletions]})]})}),(0,D.jsx)(`span`,{className:E.status,"data-status":e.status,children:e.status})]})},e.path))}),b.truncated&&(0,D.jsx)(`p`,{className:g.state,children:v(`仅显示前 1000 个文件。`,`Showing the first 1000 files.`)})]})]})]})})]})}),U=(0,x.memo)(function({sessionId:e,hash:t,path:n,parentIndex:r,visible:i,idle:a,onClose:o}){_();let s=T((0,x.useCallback)(i=>w.commitDiff(e,t,n,r,i),[e,t,n,r]),i,a,!1),c=s.value?s.value.parentHash?`${v(`父提交`,`Parent`)} ${s.value.parentHash.slice(0,7)}`:v(`空目录`,`Empty tree`):``;return(0,D.jsx)(M,{onClose:o,path:n,label:`${t.slice(0,7)}${c?` · ${c}`:``}`,...s})}),W=()=>({selection:null,view:`changes`,history:null,selected:null,message:``,coAuthor:!1,branch:``,checkout:!0,pending:!1,outcome:null}),G={id:o.git,kind:`builtin`,version:`1.0.0`,name:{zh:`Git`,en:`Git`},description:{zh:`审阅工作区改动与提交历史,暂存文件、提交并管理本地分支。`,en:`Review workspace changes and history, stage files, commit and manage local branches.`}},K=c({id:G.id,apiVersion:1,activate(){},workbench:{apiVersion:1,entry:{category:`workspace`,label:{zh:`Git 改动`,en:`Git changes`},description:{zh:`查看分支和文件差异`,en:`Review branches and file diffs`},kind:`git`,icon:i},panels:[{kind:`git`,title:()=>(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(i,{size:16}),(0,D.jsx)(`span`,{children:`Git`})]}),component:e=>(0,D.jsx)(V,{sessionId:e.session.sessionId,visible:e.visible,idle:e.session.idle,model:e.resource(W),onCommit:t=>e.open(`git-commit`,t,t.slice(0,7))})},{kind:`git-commit`,component:e=>(0,D.jsx)(H,{sessionId:e.session.sessionId,hash:e.contentId,visible:e.visible,idle:e.session.idle,onCommit:t=>e.open(`git-commit`,t,t.slice(0,7))})},{kind:`git-diff`,component:e=>{let[t,n]=JSON.parse(e.contentId);return(0,D.jsx)(P,{sessionId:e.session.sessionId,area:t,path:n,visible:e.visible,idle:e.session.idle})}},{kind:`git-commit-diff`,component:e=>{let[t,n,r]=JSON.parse(e.contentId);return(0,D.jsx)(U,{sessionId:e.session.sessionId,hash:t,parentIndex:n,path:r,visible:e.visible,idle:e.session.idle})}}]}});export{K as default};
4
+ //# debugId=79d915a8-b3d4-4d37-8f86-4e690121dd6c