@alpacachen/dsh-simple-worktree 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/client.js +12 -11
- package/lib/index.js +22 -2
- package/package.json +1 -1
package/client/client.js
CHANGED
|
@@ -116,7 +116,8 @@ window.__ModuleLoader__.load({
|
|
|
116
116
|
.dswt-repo-heading { display: flex; min-width: 0; align-items: center; gap: 10px; }
|
|
117
117
|
.dswt-repo-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 26px; height: 26px; border-radius: 7px; color: var(--dsw-alias-brand-primary, #2563eb); background: color-mix(in srgb, var(--dsw-alias-brand-primary, #2563eb) 10%, transparent); font-size: 16px; }
|
|
118
118
|
.dswt-repo-heading h3 { overflow: hidden; margin: 0; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 650; line-height: 20px; }
|
|
119
|
-
.dswt-repo-
|
|
119
|
+
.dswt-repo-branch { display: flex; flex: none; align-items: baseline; gap: 6px; color: var(--dsw-alias-label-tertiary, #777); font-size: 11px; }
|
|
120
|
+
.dswt-repo-branch strong { color: var(--dsw-alias-label-primary, #111); font-size: 12px; font-weight: 600; }
|
|
120
121
|
.dswt-worktree-list { padding: 0 16px; }
|
|
121
122
|
.dswt-worktree { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; border-top: 1px solid var(--dsw-alias-border-l2, #eee); padding: 12px 0; }
|
|
122
123
|
.dswt-worktree-info { min-width: 0; }
|
|
@@ -141,19 +142,19 @@ window.__ModuleLoader__.load({
|
|
|
141
142
|
@media (prefers-reduced-motion: reduce) {
|
|
142
143
|
.dswt-dialog-overlay, .dswt-dialog-overlay *, .dswt-dialog-content, .dswt-dialog-content * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
|
|
143
144
|
}
|
|
144
|
-
`;var
|
|
145
|
+
`;var ae=require("react");var Ue=require("react");var Ma=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qe=(...e)=>e.filter((a,t,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===t).join(" ").trim();var ke=require("react");var Fa={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var Ta=(0,ke.forwardRef)(({color:e="currentColor",size:a=24,strokeWidth:t=2,absoluteStrokeWidth:o,className:r="",children:u,iconNode:s,...l},n)=>(0,ke.createElement)("svg",{ref:n,...Fa,width:a,height:a,stroke:e,strokeWidth:o?Number(t)*24/Number(a):t,className:qe("lucide",r),...l},[...s.map(([f,p])=>(0,ke.createElement)(f,p)),...Array.isArray(u)?u:[u]]));var K=(e,a)=>{let t=(0,Ue.forwardRef)(({className:o,...r},u)=>(0,Ue.createElement)(Ta,{ref:u,iconNode:a,className:qe(`lucide-${Ma(e)}`,o),...r}));return t.displayName=`${e}`,t};var bo=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],j=K("CircleAlert",bo);var Po=[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],ye=K("FolderGit2",Po);var Ro=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Z=K("LoaderCircle",Ro);var Ao=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],be=K("RefreshCw",Ao);var Do=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Pe=K("X",Do);var Ea=require("react"),Le="dsh-simple-worktree",qa={createWorktree:"\u521B\u5EFA worktree",dialogTitle:"{name} worktree",basedOn:"\u57FA\u4E8E",currentBranch:"\u5F53\u524D\u5206\u652F",currentBranchLabel:"\u5F53\u524D\u5206\u652F",mainBranch:"\u4E3B\u5206\u652F",taskName:"\u540D\u79F0",taskNamePlaceholder:"\u4F8B\u5982 login-fix",cancel:"\u53D6\u6D88",createAndOpen:"\u521B\u5EFA\u5E76\u6253\u5F00",creating:"\u521B\u5EFA\u4E2D\u2026",fillTaskName:"\u8BF7\u586B\u5199\u540D\u79F0\u3002",operationFailed:"worktree \u64CD\u4F5C\u5931\u8D25\uFF1A",close:"\u5173\u95ED",notGitWorkspace:"\u5F53\u524D Workspace \u4E0D\u662F Git \u4ED3\u5E93\u3002",worktrees:"Worktree \u7BA1\u7406",worktreesSubtitle:"\u626B\u63CF\u6240\u6709 Workspace \u4E2D\u7684 Git \u9879\u76EE\u548C Worktree",repositories:"\u4E2A\u9879\u76EE",worktreeCount:"\u4E2A Worktree",refresh:"\u5237\u65B0",noWorktrees:"\u6CA1\u6709\u53D1\u73B0 Worktree\u3002",noWorktreesHint:"\u4F1A\u9012\u5F52\u626B\u63CF\u6240\u6709 Workspace \u4E0B\u7684 Git \u9879\u76EE\u3002",branch:"\u5206\u652F",path:"\u8DEF\u5F84",mainRepository:"\u4E3B\u4ED3\u5E93",linkedWorktree:"linked worktree",clean:"clean",dirty:"dirty\uFF08{count} \u4E2A\u53D8\u66F4\u6587\u4EF6\uFF09",locked:"\u5DF2\u9501\u5B9A",prunable:"\u53EF\u6E05\u7406",open:"\u6253\u5F00",remove:"\u5220\u9664 Worktree",prune:"\u6E05\u7406\u5931\u6548\u8BB0\u5F55",removeConfirm:`\u786E\u8BA4\u5220\u9664 Worktree\uFF1F
|
|
145
146
|
|
|
146
147
|
\u8DEF\u5F84\uFF1A{path}
|
|
147
148
|
\u72B6\u6001\uFF1A{status}
|
|
148
149
|
|
|
149
150
|
\u8FD9\u4E0D\u4F1A\u5220\u9664 Git branch\u3002`,dirtyRemoveBlocked:"Worktree \u6709\u672A\u63D0\u4EA4\u53D8\u66F4\uFF0C\u9ED8\u8BA4\u4E0D\u4F1A\u5F3A\u5236\u5220\u9664\u3002",operationError:"\u64CD\u4F5C\u5931\u8D25\uFF1A",unavailable:"\u8DEF\u5F84\u4E0D\u53EF\u7528",registered:"\u5DF2\u6CE8\u518C Workspace",registerFailed:"Worktree \u5DF2\u521B\u5EFA\uFF0C\u4F46 Workspace \u6CE8\u518C\u5931\u8D25\u3002",cleanupFailed:`\u6E05\u7406\u5DF2\u521B\u5EFA Worktree \u5931\u8D25\uFF1A{error}
|
|
150
|
-
\u8DEF\u5F84\uFF1A{path}`,retryRegister:"\u91CD\u8BD5\u6CE8\u518C\u5E76\u6253\u5F00",cleanupCreated:"\u6E05\u7406\u5DF2\u521B\u5EFA Worktree",detached:"\uFF08\u5206\u79BB HEAD\uFF09"},Bo={createWorktree:"Create worktree",dialogTitle:"{name} worktree",basedOn:"Base",currentBranch:"Current branch",mainBranch:"Main branch",taskName:"Name",taskNamePlaceholder:"e.g. login-fix",cancel:"Cancel",createAndOpen:"Create and open",creating:"Creating\u2026",fillTaskName:"Enter a name.",operationFailed:"worktree operation failed: ",close:"Close",notGitWorkspace:"The current Workspace is not a Git repository.",worktrees:"Worktree Management",worktreesSubtitle:"Scan every Workspace for Git projects and Worktrees",repositories:"repositories",worktreeCount:"Worktrees",refresh:"Refresh",noWorktrees:"No Worktrees found.",noWorktreesHint:"Every Workspace is scanned recursively for Git projects.",branch:"Branch",path:"Path",mainRepository:"Main repository",linkedWorktree:"Linked worktree",clean:"clean",dirty:"dirty ({count} changed files)",locked:"locked",prunable:"prunable",open:"Open",remove:"Remove Worktree",prune:"Prune stale record",removeConfirm:`Remove this Worktree?
|
|
151
|
+
\u8DEF\u5F84\uFF1A{path}`,retryRegister:"\u91CD\u8BD5\u6CE8\u518C\u5E76\u6253\u5F00",cleanupCreated:"\u6E05\u7406\u5DF2\u521B\u5EFA Worktree",detached:"\uFF08\u5206\u79BB HEAD\uFF09"},Bo={createWorktree:"Create worktree",dialogTitle:"{name} worktree",basedOn:"Base",currentBranch:"Current branch",currentBranchLabel:"Current branch",mainBranch:"Main branch",taskName:"Name",taskNamePlaceholder:"e.g. login-fix",cancel:"Cancel",createAndOpen:"Create and open",creating:"Creating\u2026",fillTaskName:"Enter a name.",operationFailed:"worktree operation failed: ",close:"Close",notGitWorkspace:"The current Workspace is not a Git repository.",worktrees:"Worktree Management",worktreesSubtitle:"Scan every Workspace for Git projects and Worktrees",repositories:"repositories",worktreeCount:"Worktrees",refresh:"Refresh",noWorktrees:"No Worktrees found.",noWorktreesHint:"Every Workspace is scanned recursively for Git projects.",branch:"Branch",path:"Path",mainRepository:"Main repository",linkedWorktree:"Linked worktree",clean:"clean",dirty:"dirty ({count} changed files)",locked:"locked",prunable:"prunable",open:"Open",remove:"Remove Worktree",prune:"Prune stale record",removeConfirm:`Remove this Worktree?
|
|
151
152
|
|
|
152
153
|
Path: {path}
|
|
153
154
|
Status: {status}
|
|
154
155
|
|
|
155
156
|
This does not delete the Git branch.`,dirtyRemoveBlocked:"This Worktree has uncommitted changes; force removal is disabled.",operationError:"Operation failed: ",unavailable:"path unavailable",registered:"Workspace registered",registerFailed:"The Worktree was created, but Workspace registration failed.",cleanupFailed:`Could not clean up the created Worktree: {error}
|
|
156
|
-
Path: {path}`,retryRegister:"Retry registration and open",cleanupCreated:"Clean up created Worktree",detached:"(detached HEAD)"},ae=null,He=null;function Ua(e){let a=e?.get?.("locale");if(!a||typeof a.register!="function"||typeof a.bind!="function")return()=>{};ae=a;let t;try{t=a.register(Le,{zh:qa,en:Bo})}catch{}return He=a.bind(Le),()=>{t?.(),ae===a&&(ae=null,He=null)}}function xe(e){return He?He(e):qa[e]??e}var Mo=e=>ae&&typeof ae.subscribe=="function"?ae.subscribe(e):()=>{},Oa=()=>ae&&typeof ae.getSnapshot=="function"?ae.getSnapshot():null;function re(){return(0,Ea.useSyncExternalStore)(Mo,Oa,Oa),xe}function ue(e,a){return e.replace(/\{(\w+)\}/g,(t,o)=>a[o]??`{${o}}`)}function F(e){let a=String(e??"");return a.length>1?a.replace(/[\\/]+$/,""):a}function Ha(e){return String(e||"task").trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||"task"}function Wa(e,a){let t=e.includes("\\")?"\\":"/";return`${F(e)}.worktrees${t}${a}`}var R=A(require("react"),1);function J(e,a,{checkForDefaultPrevented:t=!0}={}){return function(r){if(e?.(r),t===!1||!r.defaultPrevented)return a?.(r)}}var Ga=A(require("react"),1);function Na(e,a){if(typeof e=="function")return e(a);e!=null&&(e.current=a)}function ea(...e){return a=>{let t=!1,o=e.map(r=>{let u=Na(r,a);return!t&&typeof u=="function"&&(t=!0),u});if(t)return()=>{for(let r=0;r<o.length;r++){let u=o[r];typeof u=="function"?u():Na(e[r],null)}}}}function _(...e){return Ga.useCallback(ea(...e),e)}var G=A(require("react"),1),aa=require("react/jsx-runtime");function za(e,a){let t=G.createContext(a),o=u=>{let{children:s,...l}=u,i=G.useMemo(()=>l,Object.values(l));return(0,aa.jsx)(t.Provider,{value:i,children:s})};o.displayName=e+"Provider";function r(u){let s=G.useContext(t);if(s)return s;if(a!==void 0)return a;throw new Error(`\`${u}\` must be used within \`${e}\``)}return[o,r]}function Va(e,a=[]){let t=[];function o(u,s){let l=G.createContext(s),i=t.length;t=[...t,s];let f=L=>{let{scope:I,children:h,...C}=L,d=I?.[e]?.[i]||l,m=G.useMemo(()=>C,Object.values(C));return(0,aa.jsx)(d.Provider,{value:m,children:h})};f.displayName=u+"Provider";function c(L,I){let h=I?.[e]?.[i]||l,C=G.useContext(h);if(C)return C;if(s!==void 0)return s;throw new Error(`\`${L}\` must be used within \`${u}\``)}return[f,c]}let r=()=>{let u=t.map(s=>G.createContext(s));return function(l){let i=l?.[e]||u;return G.useMemo(()=>({[`__scope${e}`]:{...l,[e]:i}}),[l,i])}};return r.scopeName=e,[o,Fo(r,...a)]}function Fo(...e){let a=e[0];if(e.length===1)return a;let t=()=>{let o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(u){let s=o.reduce((l,{useScope:i,scopeName:f})=>{let L=i(u)[`__scope${f}`];return{...l,...L}},{});return G.useMemo(()=>({[`__scope${a.scopeName}`]:s}),[s])}};return t.scopeName=a.scopeName,t}var We=A(require("react"),1);var _a=A(require("react"),1),de=globalThis?.document?_a.useLayoutEffect:()=>{};var To=We.useId||(()=>{}),Oo=0;function Ne(e){let[a,t]=We.useState(To());return de(()=>{e||t(o=>o??String(Oo++))},[e]),e||(a?`radix-${a}`:"")}var le=A(require("react"),1);var Ie=A(require("react"),1);function X(e){let a=Ie.useRef(e);return Ie.useEffect(()=>{a.current=e}),Ie.useMemo(()=>(...t)=>a.current?.(...t),[])}function Xa({prop:e,defaultProp:a,onChange:t=()=>{}}){let[o,r]=Eo({defaultProp:a,onChange:t}),u=e!==void 0,s=u?e:o,l=X(t),i=le.useCallback(f=>{if(u){let L=typeof f=="function"?f(e):f;L!==e&&l(L)}else r(f)},[u,e,r,l]);return[s,i]}function Eo({defaultProp:e,onChange:a}){let t=le.useState(e),[o]=t,r=le.useRef(o),u=X(a);return le.useEffect(()=>{r.current!==o&&(u(o),r.current=o)},[o,r,u]),t}var B=A(require("react"),1);var Ka=A(require("react"),1),ja=A(require("react-dom"),1);var T=A(require("react"),1);var he=require("react/jsx-runtime"),Re=T.forwardRef((e,a)=>{let{children:t,...o}=e,r=T.Children.toArray(t),u=r.find(Uo);if(u){let s=u.props.children,l=r.map(i=>i===u?T.Children.count(s)>1?T.Children.only(null):T.isValidElement(s)?s.props.children:null:i);return(0,he.jsx)(ta,{...o,ref:a,children:T.isValidElement(s)?T.cloneElement(s,void 0,l):null})}return(0,he.jsx)(ta,{...o,ref:a,children:t})});Re.displayName="Slot";var ta=T.forwardRef((e,a)=>{let{children:t,...o}=e;if(T.isValidElement(t)){let r=Wo(t),u=Ho(o,t.props);return t.type!==T.Fragment&&(u.ref=a?ea(a,r):r),T.cloneElement(t,u)}return T.Children.count(t)>1?T.Children.only(null):null});ta.displayName="SlotClone";var qo=({children:e})=>(0,he.jsx)(he.Fragment,{children:e});function Uo(e){return T.isValidElement(e)&&e.type===qo}function Ho(e,a){let t={...a};for(let o in a){let r=e[o],u=a[o];/^on[A-Z]/.test(o)?r&&u?t[o]=(...l)=>{u(...l),r(...l)}:r&&(t[o]=r):o==="style"?t[o]={...r,...u}:o==="className"&&(t[o]=[r,u].filter(Boolean).join(" "))}return{...e,...t}}function Wo(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,t=a&&"isReactWarning"in a&&a.isReactWarning;return t?e.ref:(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,t=a&&"isReactWarning"in a&&a.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var Za=require("react/jsx-runtime"),No=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],H=No.reduce((e,a)=>{let t=Ka.forwardRef((o,r)=>{let{asChild:u,...s}=o,l=u?Re:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Za.jsx)(l,{...s,ref:r})});return t.displayName=`Primitive.${a}`,{...e,[a]:t}},{});function $a(e,a){e&&ja.flushSync(()=>e.dispatchEvent(a))}var Ja=A(require("react"),1);function Qa(e,a=globalThis?.document){let t=X(e);Ja.useEffect(()=>{let o=r=>{r.key==="Escape"&&t(r)};return a.addEventListener("keydown",o,{capture:!0}),()=>a.removeEventListener("keydown",o,{capture:!0})},[t,a])}var ra=require("react/jsx-runtime"),Go="DismissableLayer",oa="dismissableLayer.update",zo="dismissableLayer.pointerDownOutside",Vo="dismissableLayer.focusOutside",Ya,at=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ua=B.forwardRef((e,a)=>{let{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:u,onInteractOutside:s,onDismiss:l,...i}=e,f=B.useContext(at),[c,L]=B.useState(null),I=c?.ownerDocument??globalThis?.document,[,h]=B.useState({}),C=_(a,g=>L(g)),d=Array.from(f.layers),[m]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),w=d.indexOf(m),v=c?d.indexOf(c):-1,y=f.layersWithOutsidePointerEventsDisabled.size>0,p=v>=w,x=Ko(g=>{let M=g.target,E=[...f.branches].some(V=>V.contains(M));!p||E||(r?.(g),s?.(g),g.defaultPrevented||l?.())},I),n=jo(g=>{let M=g.target;[...f.branches].some(V=>V.contains(M))||(u?.(g),s?.(g),g.defaultPrevented||l?.())},I);return Qa(g=>{v===f.layers.size-1&&(o?.(g),!g.defaultPrevented&&l&&(g.preventDefault(),l()))},I),B.useEffect(()=>{if(c)return t&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Ya=I.body.style.pointerEvents,I.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(c)),f.layers.add(c),et(),()=>{t&&f.layersWithOutsidePointerEventsDisabled.size===1&&(I.body.style.pointerEvents=Ya)}},[c,I,t,f]),B.useEffect(()=>()=>{c&&(f.layers.delete(c),f.layersWithOutsidePointerEventsDisabled.delete(c),et())},[c,f]),B.useEffect(()=>{let g=()=>h({});return document.addEventListener(oa,g),()=>document.removeEventListener(oa,g)},[]),(0,ra.jsx)(H.div,{...i,ref:C,style:{pointerEvents:y?p?"auto":"none":void 0,...e.style},onFocusCapture:J(e.onFocusCapture,n.onFocusCapture),onBlurCapture:J(e.onBlurCapture,n.onBlurCapture),onPointerDownCapture:J(e.onPointerDownCapture,x.onPointerDownCapture)})});ua.displayName=Go;var _o="DismissableLayerBranch",Xo=B.forwardRef((e,a)=>{let t=B.useContext(at),o=B.useRef(null),r=_(a,o);return B.useEffect(()=>{let u=o.current;if(u)return t.branches.add(u),()=>{t.branches.delete(u)}},[t.branches]),(0,ra.jsx)(H.div,{...e,ref:r})});Xo.displayName=_o;function Ko(e,a=globalThis?.document){let t=X(e),o=B.useRef(!1),r=B.useRef(()=>{});return B.useEffect(()=>{let u=l=>{if(l.target&&!o.current){let f=function(){tt(zo,t,c,{discrete:!0})};var i=f;let c={originalEvent:l};l.pointerType==="touch"?(a.removeEventListener("click",r.current),r.current=f,a.addEventListener("click",r.current,{once:!0})):f()}else a.removeEventListener("click",r.current);o.current=!1},s=window.setTimeout(()=>{a.addEventListener("pointerdown",u)},0);return()=>{window.clearTimeout(s),a.removeEventListener("pointerdown",u),a.removeEventListener("click",r.current)}},[a,t]),{onPointerDownCapture:()=>o.current=!0}}function jo(e,a=globalThis?.document){let t=X(e),o=B.useRef(!1);return B.useEffect(()=>{let r=u=>{u.target&&!o.current&&tt(Vo,t,{originalEvent:u},{discrete:!1})};return a.addEventListener("focusin",r),()=>a.removeEventListener("focusin",r)},[a,t]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function et(){let e=new CustomEvent(oa);document.dispatchEvent(e)}function tt(e,a,t,{discrete:o}){let r=t.originalEvent.target,u=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:t});a&&r.addEventListener(e,a,{once:!0}),o?$a(r,u):r.dispatchEvent(u)}var z=A(require("react"),1);var st=require("react/jsx-runtime"),la="focusScope.autoFocusOnMount",sa="focusScope.autoFocusOnUnmount",ot={bubbles:!1,cancelable:!0},Zo="FocusScope",da=z.forwardRef((e,a)=>{let{loop:t=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:u,...s}=e,[l,i]=z.useState(null),f=X(r),c=X(u),L=z.useRef(null),I=_(a,d=>i(d)),h=z.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;z.useEffect(()=>{if(o){let v=function(n){if(h.paused||!l)return;let g=n.target;l.contains(g)?L.current=g:se(L.current,{select:!0})},y=function(n){if(h.paused||!l)return;let g=n.relatedTarget;g!==null&&(l.contains(g)||se(L.current,{select:!0}))},p=function(n){if(document.activeElement===document.body)for(let M of n)M.removedNodes.length>0&&se(l)};var d=v,m=y,w=p;document.addEventListener("focusin",v),document.addEventListener("focusout",y);let x=new MutationObserver(p);return l&&x.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",y),x.disconnect()}}},[o,l,h.paused]),z.useEffect(()=>{if(l){ut.add(h);let d=document.activeElement;if(!l.contains(d)){let w=new CustomEvent(la,ot);l.addEventListener(la,f),l.dispatchEvent(w),w.defaultPrevented||($o(ar(dt(l)),{select:!0}),document.activeElement===d&&se(l))}return()=>{l.removeEventListener(la,f),setTimeout(()=>{let w=new CustomEvent(sa,ot);l.addEventListener(sa,c),l.dispatchEvent(w),w.defaultPrevented||se(d??document.body,{select:!0}),l.removeEventListener(sa,c),ut.remove(h)},0)}}},[l,f,c,h]);let C=z.useCallback(d=>{if(!t&&!o||h.paused)return;let m=d.key==="Tab"&&!d.altKey&&!d.ctrlKey&&!d.metaKey,w=document.activeElement;if(m&&w){let v=d.currentTarget,[y,p]=Jo(v);y&&p?!d.shiftKey&&w===p?(d.preventDefault(),t&&se(y,{select:!0})):d.shiftKey&&w===y&&(d.preventDefault(),t&&se(p,{select:!0})):w===v&&d.preventDefault()}},[t,o,h.paused]);return(0,st.jsx)(H.div,{tabIndex:-1,...s,ref:I,onKeyDown:C})});da.displayName=Zo;function $o(e,{select:a=!1}={}){let t=document.activeElement;for(let o of e)if(se(o,{select:a}),document.activeElement!==t)return}function Jo(e){let a=dt(e),t=rt(a,e),o=rt(a.reverse(),e);return[t,o]}function dt(e){let a=[],t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{let r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)a.push(t.currentNode);return a}function rt(e,a){for(let t of e)if(!Qo(t,{upTo:a}))return t}function Qo(e,{upTo:a}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(a!==void 0&&e===a)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Yo(e){return e instanceof HTMLInputElement&&"select"in e}function se(e,{select:a=!1}={}){if(e&&e.focus){let t=document.activeElement;e.focus({preventScroll:!0}),e!==t&&Yo(e)&&a&&e.select()}}var ut=er();function er(){let e=[];return{add(a){let t=e[0];a!==t&&t?.pause(),e=lt(e,a),e.unshift(a)},remove(a){e=lt(e,a),e[0]?.resume()}}}function lt(e,a){let t=[...e],o=t.indexOf(a);return o!==-1&&t.splice(o,1),t}function ar(e){return e.filter(a=>a.tagName!=="A")}var Ge=A(require("react"),1),ft=A(require("react-dom"),1);var nt=require("react/jsx-runtime"),tr="Portal",fa=Ge.forwardRef((e,a)=>{let{container:t,...o}=e,[r,u]=Ge.useState(!1);de(()=>u(!0),[]);let s=t||r&&globalThis?.document?.body;return s?ft.default.createPortal((0,nt.jsx)(H.div,{...o,ref:a}),s):null});fa.displayName=tr;var q=A(require("react"),1);var it=A(require("react"),1);function or(e,a){return it.useReducer((t,o)=>a[t][o]??t,e)}var Ae=e=>{let{present:a,children:t}=e,o=rr(a),r=typeof t=="function"?t({present:o.isPresent}):q.Children.only(t),u=_(o.ref,ur(r));return typeof t=="function"||o.isPresent?q.cloneElement(r,{ref:u}):null};Ae.displayName="Presence";function rr(e){let[a,t]=q.useState(),o=q.useRef({}),r=q.useRef(e),u=q.useRef("none"),s=e?"mounted":"unmounted",[l,i]=or(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return q.useEffect(()=>{let f=ze(o.current);u.current=l==="mounted"?f:"none"},[l]),de(()=>{let f=o.current,c=r.current;if(c!==e){let I=u.current,h=ze(f);e?i("MOUNT"):h==="none"||f?.display==="none"?i("UNMOUNT"):i(c&&I!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,i]),de(()=>{if(a){let f,c=a.ownerDocument.defaultView??window,L=h=>{let d=ze(o.current).includes(h.animationName);if(h.target===a&&d&&(i("ANIMATION_END"),!r.current)){let m=a.style.animationFillMode;a.style.animationFillMode="forwards",f=c.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=m)})}},I=h=>{h.target===a&&(u.current=ze(o.current))};return a.addEventListener("animationstart",I),a.addEventListener("animationcancel",L),a.addEventListener("animationend",L),()=>{c.clearTimeout(f),a.removeEventListener("animationstart",I),a.removeEventListener("animationcancel",L),a.removeEventListener("animationend",L)}}else i("ANIMATION_END")},[a,i]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:q.useCallback(f=>{f&&(o.current=getComputedStyle(f)),t(f)},[])}}function ze(e){return e?.animationName||"none"}function ur(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,t=a&&"isReactWarning"in a&&a.isReactWarning;return t?e.ref:(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,t=a&&"isReactWarning"in a&&a.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var pt=A(require("react"),1),na=0;function mt(){pt.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ct()),document.body.insertAdjacentElement("beforeend",e[1]??ct()),na++,()=>{na===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),na--}},[])}function ct(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var U=function(){return U=Object.assign||function(a){for(var t,o=1,r=arguments.length;o<r;o++){t=arguments[o];for(var u in t)Object.prototype.hasOwnProperty.call(t,u)&&(a[u]=t[u])}return a},U.apply(this,arguments)};function Ve(e,a){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&a.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)a.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]]);return t}function Lt(e,a,t){if(t||arguments.length===2)for(var o=0,r=a.length,u;o<r;o++)(u||!(o in a))&&(u||(u=Array.prototype.slice.call(a,0,o)),u[o]=a[o]);return e.concat(u||Array.prototype.slice.call(a))}var Ze=A(require("react"));var O=A(require("react"));var fe="right-scroll-bar-position",ne="width-before-scroll-bar",ia="with-scroll-bars-hidden",ca="--removed-body-scroll-bar-size";function _e(e,a){return typeof e=="function"?e(a):e&&(e.current=a),e}var xt=require("react");function It(e,a){var t=(0,xt.useState)(function(){return{value:e,callback:a,facade:{get current(){return t.value},set current(o){var r=t.value;r!==o&&(t.value=o,t.callback(o,r))}}}})[0];return t.callback=a,t.facade}var Xe=A(require("react"));var lr=typeof window<"u"?Xe.useLayoutEffect:Xe.useEffect,ht=new WeakMap;function pa(e,a){var t=It(a||null,function(o){return e.forEach(function(r){return _e(r,o)})});return lr(function(){var o=ht.get(t);if(o){var r=new Set(o),u=new Set(e),s=t.current;r.forEach(function(l){u.has(l)||_e(l,null)}),u.forEach(function(l){r.has(l)||_e(l,s)})}ht.set(t,e)},[e]),t}function sr(e){return e}function dr(e,a){a===void 0&&(a=sr);var t=[],o=!1,r={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return t.length?t[t.length-1]:e},useMedium:function(u){var s=a(u,o);return t.push(s),function(){t=t.filter(function(l){return l!==s})}},assignSyncMedium:function(u){for(o=!0;t.length;){var s=t;t=[],s.forEach(u)}t={push:function(l){return u(l)},filter:function(){return t}}},assignMedium:function(u){o=!0;var s=[];if(t.length){var l=t;t=[],l.forEach(u),s=t}var i=function(){var c=s;s=[],c.forEach(u)},f=function(){return Promise.resolve().then(i)};f(),t={push:function(c){s.push(c),f()},filter:function(c){return s=s.filter(c),t}}}};return r}function ma(e){e===void 0&&(e={});var a=dr(null);return a.options=U({async:!0,ssr:!1},e),a}var gt=A(require("react")),Ct=function(e){var a=e.sideCar,t=Ve(e,["sideCar"]);if(!a)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=a.read();if(!o)throw new Error("Sidecar medium not found");return gt.createElement(o,U({},t))};Ct.isSideCarExport=!0;function La(e,a){return e.useMedium(a),Ct}var Ke=ma();var xa=function(){},De=O.forwardRef(function(e,a){var t=O.useRef(null),o=O.useState({onScrollCapture:xa,onWheelCapture:xa,onTouchMoveCapture:xa}),r=o[0],u=o[1],s=e.forwardProps,l=e.children,i=e.className,f=e.removeScrollBar,c=e.enabled,L=e.shards,I=e.sideCar,h=e.noRelative,C=e.noIsolation,d=e.inert,m=e.allowPinchZoom,w=e.as,v=w===void 0?"div":w,y=e.gapMode,p=Ve(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=I,n=pa([t,a]),g=U(U({},p),r);return O.createElement(O.Fragment,null,c&&O.createElement(x,{sideCar:Ke,removeScrollBar:f,shards:L,noRelative:h,noIsolation:C,inert:d,setCallbacks:u,allowPinchZoom:!!m,lockRef:t,gapMode:y}),s?O.cloneElement(O.Children.only(l),U(U({},g),{ref:n})):O.createElement(v,U({},g,{className:i,ref:n}),l))});De.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};De.classNames={fullWidth:ne,zeroRight:fe};var D=A(require("react"));var Ce=A(require("react"));var vt=A(require("react"));var St;var wt=function(){if(St)return St;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function fr(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var a=wt();return a&&e.setAttribute("nonce",a),e}function nr(e,a){e.styleSheet?e.styleSheet.cssText=a:e.appendChild(document.createTextNode(a))}function ir(e){var a=document.head||document.getElementsByTagName("head")[0];a.appendChild(e)}var Ia=function(){var e=0,a=null;return{add:function(t){e==0&&(a=fr())&&(nr(a,t),ir(a)),e++},remove:function(){e--,!e&&a&&(a.parentNode&&a.parentNode.removeChild(a),a=null)}}};var ha=function(){var e=Ia();return function(a,t){vt.useEffect(function(){return e.add(a),function(){e.remove()}},[a&&t])}};var Be=function(){var e=ha(),a=function(t){var o=t.styles,r=t.dynamic;return e(o,r),null};return a};var cr={left:0,top:0,right:0,gap:0},ga=function(e){return parseInt(e||"",10)||0},pr=function(e){var a=window.getComputedStyle(document.body),t=a[e==="padding"?"paddingLeft":"marginLeft"],o=a[e==="padding"?"paddingTop":"marginTop"],r=a[e==="padding"?"paddingRight":"marginRight"];return[ga(t),ga(o),ga(r)]},Ca=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return cr;var a=pr(e),t=document.documentElement.clientWidth,o=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,o-t+a[2]-a[0])}};var mr=Be(),ge="data-scroll-locked",Lr=function(e,a,t,o){var r=e.left,u=e.top,s=e.right,l=e.gap;return t===void 0&&(t="margin"),`
|
|
157
|
+
Path: {path}`,retryRegister:"Retry registration and open",cleanupCreated:"Clean up created Worktree",detached:"(detached HEAD)"},ee=null,He=null;function Ua(e){let a=e?.get?.("locale");if(!a||typeof a.register!="function"||typeof a.bind!="function")return()=>{};ee=a;let t;try{t=a.register(Le,{zh:qa,en:Bo})}catch{}return He=a.bind(Le),()=>{t?.(),ee===a&&(ee=null,He=null)}}function xe(e){return He?He(e):qa[e]??e}var Mo=e=>ee&&typeof ee.subscribe=="function"?ee.subscribe(e):()=>{},Oa=()=>ee&&typeof ee.getSnapshot=="function"?ee.getSnapshot():null;function oe(){return(0,Ea.useSyncExternalStore)(Mo,Oa,Oa),xe}function re(e,a){return e.replace(/\{(\w+)\}/g,(t,o)=>a[o]??`{${o}}`)}function F(e){let a=String(e??"");return a.length>1?a.replace(/[\\/]+$/,""):a}function Ha(e){return String(e||"task").trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||"task"}function Wa(e,a){let t=e.includes("\\")?"\\":"/";return`${F(e)}.worktrees${t}${a}`}var R=A(require("react"),1);function $(e,a,{checkForDefaultPrevented:t=!0}={}){return function(r){if(e?.(r),t===!1||!r.defaultPrevented)return a?.(r)}}var Ga=A(require("react"),1);function Na(e,a){if(typeof e=="function")return e(a);e!=null&&(e.current=a)}function ea(...e){return a=>{let t=!1,o=e.map(r=>{let u=Na(r,a);return!t&&typeof u=="function"&&(t=!0),u});if(t)return()=>{for(let r=0;r<o.length;r++){let u=o[r];typeof u=="function"?u():Na(e[r],null)}}}}function z(...e){return Ga.useCallback(ea(...e),e)}var N=A(require("react"),1),aa=require("react/jsx-runtime");function za(e,a){let t=N.createContext(a),o=u=>{let{children:s,...l}=u,n=N.useMemo(()=>l,Object.values(l));return(0,aa.jsx)(t.Provider,{value:n,children:s})};o.displayName=e+"Provider";function r(u){let s=N.useContext(t);if(s)return s;if(a!==void 0)return a;throw new Error(`\`${u}\` must be used within \`${e}\``)}return[o,r]}function Va(e,a=[]){let t=[];function o(u,s){let l=N.createContext(s),n=t.length;t=[...t,s];let f=L=>{let{scope:x,children:I,...h}=L,d=x?.[e]?.[n]||l,c=N.useMemo(()=>h,Object.values(h));return(0,aa.jsx)(d.Provider,{value:c,children:I})};f.displayName=u+"Provider";function p(L,x){let I=x?.[e]?.[n]||l,h=N.useContext(I);if(h)return h;if(s!==void 0)return s;throw new Error(`\`${L}\` must be used within \`${u}\``)}return[f,p]}let r=()=>{let u=t.map(s=>N.createContext(s));return function(l){let n=l?.[e]||u;return N.useMemo(()=>({[`__scope${e}`]:{...l,[e]:n}}),[l,n])}};return r.scopeName=e,[o,Fo(r,...a)]}function Fo(...e){let a=e[0];if(e.length===1)return a;let t=()=>{let o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(u){let s=o.reduce((l,{useScope:n,scopeName:f})=>{let L=n(u)[`__scope${f}`];return{...l,...L}},{});return N.useMemo(()=>({[`__scope${a.scopeName}`]:s}),[s])}};return t.scopeName=a.scopeName,t}var We=A(require("react"),1);var _a=A(require("react"),1),se=globalThis?.document?_a.useLayoutEffect:()=>{};var To=We.useId||(()=>{}),Oo=0;function Ne(e){let[a,t]=We.useState(To());return se(()=>{e||t(o=>o??String(Oo++))},[e]),e||(a?`radix-${a}`:"")}var ue=A(require("react"),1);var Ie=A(require("react"),1);function V(e){let a=Ie.useRef(e);return Ie.useEffect(()=>{a.current=e}),Ie.useMemo(()=>(...t)=>a.current?.(...t),[])}function Xa({prop:e,defaultProp:a,onChange:t=()=>{}}){let[o,r]=Eo({defaultProp:a,onChange:t}),u=e!==void 0,s=u?e:o,l=V(t),n=ue.useCallback(f=>{if(u){let L=typeof f=="function"?f(e):f;L!==e&&l(L)}else r(f)},[u,e,r,l]);return[s,n]}function Eo({defaultProp:e,onChange:a}){let t=ue.useState(e),[o]=t,r=ue.useRef(o),u=V(a);return ue.useEffect(()=>{r.current!==o&&(u(o),r.current=o)},[o,r,u]),t}var B=A(require("react"),1);var Ka=A(require("react"),1),ja=A(require("react-dom"),1);var M=A(require("react"),1);var he=require("react/jsx-runtime"),Re=M.forwardRef((e,a)=>{let{children:t,...o}=e,r=M.Children.toArray(t),u=r.find(Uo);if(u){let s=u.props.children,l=r.map(n=>n===u?M.Children.count(s)>1?M.Children.only(null):M.isValidElement(s)?s.props.children:null:n);return(0,he.jsx)(ta,{...o,ref:a,children:M.isValidElement(s)?M.cloneElement(s,void 0,l):null})}return(0,he.jsx)(ta,{...o,ref:a,children:t})});Re.displayName="Slot";var ta=M.forwardRef((e,a)=>{let{children:t,...o}=e;if(M.isValidElement(t)){let r=Wo(t),u=Ho(o,t.props);return t.type!==M.Fragment&&(u.ref=a?ea(a,r):r),M.cloneElement(t,u)}return M.Children.count(t)>1?M.Children.only(null):null});ta.displayName="SlotClone";var qo=({children:e})=>(0,he.jsx)(he.Fragment,{children:e});function Uo(e){return M.isValidElement(e)&&e.type===qo}function Ho(e,a){let t={...a};for(let o in a){let r=e[o],u=a[o];/^on[A-Z]/.test(o)?r&&u?t[o]=(...l)=>{u(...l),r(...l)}:r&&(t[o]=r):o==="style"?t[o]={...r,...u}:o==="className"&&(t[o]=[r,u].filter(Boolean).join(" "))}return{...e,...t}}function Wo(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,t=a&&"isReactWarning"in a&&a.isReactWarning;return t?e.ref:(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,t=a&&"isReactWarning"in a&&a.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var Za=require("react/jsx-runtime"),No=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],H=No.reduce((e,a)=>{let t=Ka.forwardRef((o,r)=>{let{asChild:u,...s}=o,l=u?Re:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Za.jsx)(l,{...s,ref:r})});return t.displayName=`Primitive.${a}`,{...e,[a]:t}},{});function $a(e,a){e&&ja.flushSync(()=>e.dispatchEvent(a))}var Ja=A(require("react"),1);function Qa(e,a=globalThis?.document){let t=V(e);Ja.useEffect(()=>{let o=r=>{r.key==="Escape"&&t(r)};return a.addEventListener("keydown",o,{capture:!0}),()=>a.removeEventListener("keydown",o,{capture:!0})},[t,a])}var ra=require("react/jsx-runtime"),Go="DismissableLayer",oa="dismissableLayer.update",zo="dismissableLayer.pointerDownOutside",Vo="dismissableLayer.focusOutside",Ya,at=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ua=B.forwardRef((e,a)=>{let{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:u,onInteractOutside:s,onDismiss:l,...n}=e,f=B.useContext(at),[p,L]=B.useState(null),x=p?.ownerDocument??globalThis?.document,[,I]=B.useState({}),h=z(a,w=>L(w)),d=Array.from(f.layers),[c]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),C=d.indexOf(c),i=p?d.indexOf(p):-1,m=f.layersWithOutsidePointerEventsDisabled.size>0,v=i>=C,S=Ko(w=>{let O=w.target,T=[...f.branches].some(X=>X.contains(O));!v||T||(r?.(w),s?.(w),w.defaultPrevented||l?.())},x),b=jo(w=>{let O=w.target;[...f.branches].some(X=>X.contains(O))||(u?.(w),s?.(w),w.defaultPrevented||l?.())},x);return Qa(w=>{i===f.layers.size-1&&(o?.(w),!w.defaultPrevented&&l&&(w.preventDefault(),l()))},x),B.useEffect(()=>{if(p)return t&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Ya=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(p)),f.layers.add(p),et(),()=>{t&&f.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=Ya)}},[p,x,t,f]),B.useEffect(()=>()=>{p&&(f.layers.delete(p),f.layersWithOutsidePointerEventsDisabled.delete(p),et())},[p,f]),B.useEffect(()=>{let w=()=>I({});return document.addEventListener(oa,w),()=>document.removeEventListener(oa,w)},[]),(0,ra.jsx)(H.div,{...n,ref:h,style:{pointerEvents:m?v?"auto":"none":void 0,...e.style},onFocusCapture:$(e.onFocusCapture,b.onFocusCapture),onBlurCapture:$(e.onBlurCapture,b.onBlurCapture),onPointerDownCapture:$(e.onPointerDownCapture,S.onPointerDownCapture)})});ua.displayName=Go;var _o="DismissableLayerBranch",Xo=B.forwardRef((e,a)=>{let t=B.useContext(at),o=B.useRef(null),r=z(a,o);return B.useEffect(()=>{let u=o.current;if(u)return t.branches.add(u),()=>{t.branches.delete(u)}},[t.branches]),(0,ra.jsx)(H.div,{...e,ref:r})});Xo.displayName=_o;function Ko(e,a=globalThis?.document){let t=V(e),o=B.useRef(!1),r=B.useRef(()=>{});return B.useEffect(()=>{let u=l=>{if(l.target&&!o.current){let f=function(){tt(zo,t,p,{discrete:!0})};var n=f;let p={originalEvent:l};l.pointerType==="touch"?(a.removeEventListener("click",r.current),r.current=f,a.addEventListener("click",r.current,{once:!0})):f()}else a.removeEventListener("click",r.current);o.current=!1},s=window.setTimeout(()=>{a.addEventListener("pointerdown",u)},0);return()=>{window.clearTimeout(s),a.removeEventListener("pointerdown",u),a.removeEventListener("click",r.current)}},[a,t]),{onPointerDownCapture:()=>o.current=!0}}function jo(e,a=globalThis?.document){let t=V(e),o=B.useRef(!1);return B.useEffect(()=>{let r=u=>{u.target&&!o.current&&tt(Vo,t,{originalEvent:u},{discrete:!1})};return a.addEventListener("focusin",r),()=>a.removeEventListener("focusin",r)},[a,t]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function et(){let e=new CustomEvent(oa);document.dispatchEvent(e)}function tt(e,a,t,{discrete:o}){let r=t.originalEvent.target,u=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:t});a&&r.addEventListener(e,a,{once:!0}),o?$a(r,u):r.dispatchEvent(u)}var G=A(require("react"),1);var st=require("react/jsx-runtime"),la="focusScope.autoFocusOnMount",sa="focusScope.autoFocusOnUnmount",ot={bubbles:!1,cancelable:!0},Zo="FocusScope",da=G.forwardRef((e,a)=>{let{loop:t=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:u,...s}=e,[l,n]=G.useState(null),f=V(r),p=V(u),L=G.useRef(null),x=z(a,d=>n(d)),I=G.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;G.useEffect(()=>{if(o){let i=function(b){if(I.paused||!l)return;let w=b.target;l.contains(w)?L.current=w:le(L.current,{select:!0})},m=function(b){if(I.paused||!l)return;let w=b.relatedTarget;w!==null&&(l.contains(w)||le(L.current,{select:!0}))},v=function(b){if(document.activeElement===document.body)for(let O of b)O.removedNodes.length>0&&le(l)};var d=i,c=m,C=v;document.addEventListener("focusin",i),document.addEventListener("focusout",m);let S=new MutationObserver(v);return l&&S.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",i),document.removeEventListener("focusout",m),S.disconnect()}}},[o,l,I.paused]),G.useEffect(()=>{if(l){ut.add(I);let d=document.activeElement;if(!l.contains(d)){let C=new CustomEvent(la,ot);l.addEventListener(la,f),l.dispatchEvent(C),C.defaultPrevented||($o(ar(dt(l)),{select:!0}),document.activeElement===d&&le(l))}return()=>{l.removeEventListener(la,f),setTimeout(()=>{let C=new CustomEvent(sa,ot);l.addEventListener(sa,p),l.dispatchEvent(C),C.defaultPrevented||le(d??document.body,{select:!0}),l.removeEventListener(sa,p),ut.remove(I)},0)}}},[l,f,p,I]);let h=G.useCallback(d=>{if(!t&&!o||I.paused)return;let c=d.key==="Tab"&&!d.altKey&&!d.ctrlKey&&!d.metaKey,C=document.activeElement;if(c&&C){let i=d.currentTarget,[m,v]=Jo(i);m&&v?!d.shiftKey&&C===v?(d.preventDefault(),t&&le(m,{select:!0})):d.shiftKey&&C===m&&(d.preventDefault(),t&&le(v,{select:!0})):C===i&&d.preventDefault()}},[t,o,I.paused]);return(0,st.jsx)(H.div,{tabIndex:-1,...s,ref:x,onKeyDown:h})});da.displayName=Zo;function $o(e,{select:a=!1}={}){let t=document.activeElement;for(let o of e)if(le(o,{select:a}),document.activeElement!==t)return}function Jo(e){let a=dt(e),t=rt(a,e),o=rt(a.reverse(),e);return[t,o]}function dt(e){let a=[],t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{let r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)a.push(t.currentNode);return a}function rt(e,a){for(let t of e)if(!Qo(t,{upTo:a}))return t}function Qo(e,{upTo:a}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(a!==void 0&&e===a)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Yo(e){return e instanceof HTMLInputElement&&"select"in e}function le(e,{select:a=!1}={}){if(e&&e.focus){let t=document.activeElement;e.focus({preventScroll:!0}),e!==t&&Yo(e)&&a&&e.select()}}var ut=er();function er(){let e=[];return{add(a){let t=e[0];a!==t&&t?.pause(),e=lt(e,a),e.unshift(a)},remove(a){e=lt(e,a),e[0]?.resume()}}}function lt(e,a){let t=[...e],o=t.indexOf(a);return o!==-1&&t.splice(o,1),t}function ar(e){return e.filter(a=>a.tagName!=="A")}var Ge=A(require("react"),1),ft=A(require("react-dom"),1);var nt=require("react/jsx-runtime"),tr="Portal",fa=Ge.forwardRef((e,a)=>{let{container:t,...o}=e,[r,u]=Ge.useState(!1);se(()=>u(!0),[]);let s=t||r&&globalThis?.document?.body;return s?ft.default.createPortal((0,nt.jsx)(H.div,{...o,ref:a}),s):null});fa.displayName=tr;var q=A(require("react"),1);var it=A(require("react"),1);function or(e,a){return it.useReducer((t,o)=>a[t][o]??t,e)}var Ae=e=>{let{present:a,children:t}=e,o=rr(a),r=typeof t=="function"?t({present:o.isPresent}):q.Children.only(t),u=z(o.ref,ur(r));return typeof t=="function"||o.isPresent?q.cloneElement(r,{ref:u}):null};Ae.displayName="Presence";function rr(e){let[a,t]=q.useState(),o=q.useRef({}),r=q.useRef(e),u=q.useRef("none"),s=e?"mounted":"unmounted",[l,n]=or(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return q.useEffect(()=>{let f=ze(o.current);u.current=l==="mounted"?f:"none"},[l]),se(()=>{let f=o.current,p=r.current;if(p!==e){let x=u.current,I=ze(f);e?n("MOUNT"):I==="none"||f?.display==="none"?n("UNMOUNT"):n(p&&x!==I?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,n]),se(()=>{if(a){let f,p=a.ownerDocument.defaultView??window,L=I=>{let d=ze(o.current).includes(I.animationName);if(I.target===a&&d&&(n("ANIMATION_END"),!r.current)){let c=a.style.animationFillMode;a.style.animationFillMode="forwards",f=p.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=c)})}},x=I=>{I.target===a&&(u.current=ze(o.current))};return a.addEventListener("animationstart",x),a.addEventListener("animationcancel",L),a.addEventListener("animationend",L),()=>{p.clearTimeout(f),a.removeEventListener("animationstart",x),a.removeEventListener("animationcancel",L),a.removeEventListener("animationend",L)}}else n("ANIMATION_END")},[a,n]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:q.useCallback(f=>{f&&(o.current=getComputedStyle(f)),t(f)},[])}}function ze(e){return e?.animationName||"none"}function ur(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,t=a&&"isReactWarning"in a&&a.isReactWarning;return t?e.ref:(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,t=a&&"isReactWarning"in a&&a.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var pt=A(require("react"),1),na=0;function mt(){pt.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ct()),document.body.insertAdjacentElement("beforeend",e[1]??ct()),na++,()=>{na===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),na--}},[])}function ct(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var U=function(){return U=Object.assign||function(a){for(var t,o=1,r=arguments.length;o<r;o++){t=arguments[o];for(var u in t)Object.prototype.hasOwnProperty.call(t,u)&&(a[u]=t[u])}return a},U.apply(this,arguments)};function Ve(e,a){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&a.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)a.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]]);return t}function Lt(e,a,t){if(t||arguments.length===2)for(var o=0,r=a.length,u;o<r;o++)(u||!(o in a))&&(u||(u=Array.prototype.slice.call(a,0,o)),u[o]=a[o]);return e.concat(u||Array.prototype.slice.call(a))}var Ze=A(require("react"));var E=A(require("react"));var de="right-scroll-bar-position",fe="width-before-scroll-bar",ia="with-scroll-bars-hidden",ca="--removed-body-scroll-bar-size";function _e(e,a){return typeof e=="function"?e(a):e&&(e.current=a),e}var xt=require("react");function It(e,a){var t=(0,xt.useState)(function(){return{value:e,callback:a,facade:{get current(){return t.value},set current(o){var r=t.value;r!==o&&(t.value=o,t.callback(o,r))}}}})[0];return t.callback=a,t.facade}var Xe=A(require("react"));var lr=typeof window<"u"?Xe.useLayoutEffect:Xe.useEffect,ht=new WeakMap;function pa(e,a){var t=It(a||null,function(o){return e.forEach(function(r){return _e(r,o)})});return lr(function(){var o=ht.get(t);if(o){var r=new Set(o),u=new Set(e),s=t.current;r.forEach(function(l){u.has(l)||_e(l,null)}),u.forEach(function(l){r.has(l)||_e(l,s)})}ht.set(t,e)},[e]),t}function sr(e){return e}function dr(e,a){a===void 0&&(a=sr);var t=[],o=!1,r={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return t.length?t[t.length-1]:e},useMedium:function(u){var s=a(u,o);return t.push(s),function(){t=t.filter(function(l){return l!==s})}},assignSyncMedium:function(u){for(o=!0;t.length;){var s=t;t=[],s.forEach(u)}t={push:function(l){return u(l)},filter:function(){return t}}},assignMedium:function(u){o=!0;var s=[];if(t.length){var l=t;t=[],l.forEach(u),s=t}var n=function(){var p=s;s=[],p.forEach(u)},f=function(){return Promise.resolve().then(n)};f(),t={push:function(p){s.push(p),f()},filter:function(p){return s=s.filter(p),t}}}};return r}function ma(e){e===void 0&&(e={});var a=dr(null);return a.options=U({async:!0,ssr:!1},e),a}var gt=A(require("react")),Ct=function(e){var a=e.sideCar,t=Ve(e,["sideCar"]);if(!a)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=a.read();if(!o)throw new Error("Sidecar medium not found");return gt.createElement(o,U({},t))};Ct.isSideCarExport=!0;function La(e,a){return e.useMedium(a),Ct}var Ke=ma();var xa=function(){},De=E.forwardRef(function(e,a){var t=E.useRef(null),o=E.useState({onScrollCapture:xa,onWheelCapture:xa,onTouchMoveCapture:xa}),r=o[0],u=o[1],s=e.forwardProps,l=e.children,n=e.className,f=e.removeScrollBar,p=e.enabled,L=e.shards,x=e.sideCar,I=e.noRelative,h=e.noIsolation,d=e.inert,c=e.allowPinchZoom,C=e.as,i=C===void 0?"div":C,m=e.gapMode,v=Ve(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=x,b=pa([t,a]),w=U(U({},v),r);return E.createElement(E.Fragment,null,p&&E.createElement(S,{sideCar:Ke,removeScrollBar:f,shards:L,noRelative:I,noIsolation:h,inert:d,setCallbacks:u,allowPinchZoom:!!c,lockRef:t,gapMode:m}),s?E.cloneElement(E.Children.only(l),U(U({},w),{ref:b})):E.createElement(i,U({},w,{className:n,ref:b}),l))});De.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};De.classNames={fullWidth:fe,zeroRight:de};var D=A(require("react"));var Ce=A(require("react"));var vt=A(require("react"));var St;var wt=function(){if(St)return St;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function fr(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var a=wt();return a&&e.setAttribute("nonce",a),e}function nr(e,a){e.styleSheet?e.styleSheet.cssText=a:e.appendChild(document.createTextNode(a))}function ir(e){var a=document.head||document.getElementsByTagName("head")[0];a.appendChild(e)}var Ia=function(){var e=0,a=null;return{add:function(t){e==0&&(a=fr())&&(nr(a,t),ir(a)),e++},remove:function(){e--,!e&&a&&(a.parentNode&&a.parentNode.removeChild(a),a=null)}}};var ha=function(){var e=Ia();return function(a,t){vt.useEffect(function(){return e.add(a),function(){e.remove()}},[a&&t])}};var Be=function(){var e=ha(),a=function(t){var o=t.styles,r=t.dynamic;return e(o,r),null};return a};var cr={left:0,top:0,right:0,gap:0},ga=function(e){return parseInt(e||"",10)||0},pr=function(e){var a=window.getComputedStyle(document.body),t=a[e==="padding"?"paddingLeft":"marginLeft"],o=a[e==="padding"?"paddingTop":"marginTop"],r=a[e==="padding"?"paddingRight":"marginRight"];return[ga(t),ga(o),ga(r)]},Ca=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return cr;var a=pr(e),t=document.documentElement.clientWidth,o=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,o-t+a[2]-a[0])}};var mr=Be(),ge="data-scroll-locked",Lr=function(e,a,t,o){var r=e.left,u=e.top,s=e.right,l=e.gap;return t===void 0&&(t="margin"),`
|
|
157
158
|
.`.concat(ia,` {
|
|
158
159
|
overflow: hidden `).concat(o,`;
|
|
159
160
|
padding-right: `).concat(l,"px ").concat(o,`;
|
|
@@ -171,33 +172,33 @@ Path: {path}`,retryRegister:"Retry registration and open",cleanupCreated:"Clean
|
|
|
171
172
|
`),t==="padding"&&"padding-right: ".concat(l,"px ").concat(o,";")].filter(Boolean).join(""),`
|
|
172
173
|
}
|
|
173
174
|
|
|
174
|
-
.`).concat(
|
|
175
|
+
.`).concat(de,` {
|
|
175
176
|
right: `).concat(l,"px ").concat(o,`;
|
|
176
177
|
}
|
|
177
178
|
|
|
178
|
-
.`).concat(
|
|
179
|
+
.`).concat(fe,` {
|
|
179
180
|
margin-right: `).concat(l,"px ").concat(o,`;
|
|
180
181
|
}
|
|
181
182
|
|
|
182
|
-
.`).concat(
|
|
183
|
+
.`).concat(de," .").concat(de,` {
|
|
183
184
|
right: 0 `).concat(o,`;
|
|
184
185
|
}
|
|
185
186
|
|
|
186
|
-
.`).concat(
|
|
187
|
+
.`).concat(fe," .").concat(fe,` {
|
|
187
188
|
margin-right: 0 `).concat(o,`;
|
|
188
189
|
}
|
|
189
190
|
|
|
190
191
|
body[`).concat(ge,`] {
|
|
191
192
|
`).concat(ca,": ").concat(l,`px;
|
|
192
193
|
}
|
|
193
|
-
`)},kt=function(){var e=parseInt(document.body.getAttribute(ge)||"0",10);return isFinite(e)?e:0},xr=function(){Ce.useEffect(function(){return document.body.setAttribute(ge,(kt()+1).toString()),function(){var e=kt()-1;e<=0?document.body.removeAttribute(ge):document.body.setAttribute(ge,e.toString())}},[])},Sa=function(e){var a=e.noRelative,t=e.noImportant,o=e.gapMode,r=o===void 0?"margin":o;xr();var u=Ce.useMemo(function(){return Ca(r)},[r]);return Ce.createElement(mr,{styles:Lr(u,!a,r,t?"":"!important")})};var wa=!1;if(typeof window<"u")try{Me=Object.defineProperty({},"passive",{get:function(){return wa=!0,!0}}),window.addEventListener("test",Me,Me),window.removeEventListener("test",Me,Me)}catch{wa=!1}var Me,
|
|
194
|
+
`)},kt=function(){var e=parseInt(document.body.getAttribute(ge)||"0",10);return isFinite(e)?e:0},xr=function(){Ce.useEffect(function(){return document.body.setAttribute(ge,(kt()+1).toString()),function(){var e=kt()-1;e<=0?document.body.removeAttribute(ge):document.body.setAttribute(ge,e.toString())}},[])},Sa=function(e){var a=e.noRelative,t=e.noImportant,o=e.gapMode,r=o===void 0?"margin":o;xr();var u=Ce.useMemo(function(){return Ca(r)},[r]);return Ce.createElement(mr,{styles:Lr(u,!a,r,t?"":"!important")})};var wa=!1;if(typeof window<"u")try{Me=Object.defineProperty({},"passive",{get:function(){return wa=!0,!0}}),window.addEventListener("test",Me,Me),window.removeEventListener("test",Me,Me)}catch{wa=!1}var Me,ne=wa?{passive:!1}:!1;var Ir=function(e){return e.tagName==="TEXTAREA"},yt=function(e,a){if(!(e instanceof Element))return!1;var t=window.getComputedStyle(e);return t[a]!=="hidden"&&!(t.overflowY===t.overflowX&&!Ir(e)&&t[a]==="visible")},hr=function(e){return yt(e,"overflowY")},gr=function(e){return yt(e,"overflowX")},va=function(e,a){var t=a.ownerDocument,o=a;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var r=bt(e,o);if(r){var u=Pt(e,o),s=u[1],l=u[2];if(s>l)return!0}o=o.parentNode}while(o&&o!==t.body);return!1},Cr=function(e){var a=e.scrollTop,t=e.scrollHeight,o=e.clientHeight;return[a,t,o]},Sr=function(e){var a=e.scrollLeft,t=e.scrollWidth,o=e.clientWidth;return[a,t,o]},bt=function(e,a){return e==="v"?hr(a):gr(a)},Pt=function(e,a){return e==="v"?Cr(a):Sr(a)},wr=function(e,a){return e==="h"&&a==="rtl"?-1:1},Rt=function(e,a,t,o,r){var u=wr(e,window.getComputedStyle(a).direction),s=u*o,l=t.target,n=a.contains(l),f=!1,p=s>0,L=0,x=0;do{if(!l)break;var I=Pt(e,l),h=I[0],d=I[1],c=I[2],C=d-c-u*h;(h||C)&&bt(e,l)&&(L+=C,x+=h);var i=l.parentNode;l=i&&i.nodeType===Node.DOCUMENT_FRAGMENT_NODE?i.host:i}while(!n&&l!==document.body||n&&(a.contains(l)||a===l));return(p&&(r&&Math.abs(L)<1||!r&&s>L)||!p&&(r&&Math.abs(x)<1||!r&&-s>x))&&(f=!0),f};var je=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},At=function(e){return[e.deltaX,e.deltaY]},Dt=function(e){return e&&"current"in e?e.current:e},vr=function(e,a){return e[0]===a[0]&&e[1]===a[1]},kr=function(e){return`
|
|
194
195
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
195
196
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
196
|
-
`)},yr=0,Se=[];function Bt(e){var a=D.useRef([]),t=D.useRef([0,0]),o=D.useRef(),r=D.useState(yr++)[0],u=D.useState(Be)[0],s=D.useRef(e);D.useEffect(function(){s.current=e},[e]),D.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var d=Lt([e.lockRef.current],(e.shards||[]).map(Dt),!0).filter(Boolean);return d.forEach(function(
|
|
197
|
+
`)},yr=0,Se=[];function Bt(e){var a=D.useRef([]),t=D.useRef([0,0]),o=D.useRef(),r=D.useState(yr++)[0],u=D.useState(Be)[0],s=D.useRef(e);D.useEffect(function(){s.current=e},[e]),D.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var d=Lt([e.lockRef.current],(e.shards||[]).map(Dt),!0).filter(Boolean);return d.forEach(function(c){return c.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),d.forEach(function(c){return c.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var l=D.useCallback(function(d,c){if("touches"in d&&d.touches.length===2||d.type==="wheel"&&d.ctrlKey)return!s.current.allowPinchZoom;var C=je(d),i=t.current,m="deltaX"in d?d.deltaX:i[0]-C[0],v="deltaY"in d?d.deltaY:i[1]-C[1],S,b=d.target,w=Math.abs(m)>Math.abs(v)?"h":"v";if("touches"in d&&w==="h"&&b.type==="range")return!1;var O=window.getSelection(),T=O&&O.anchorNode,X=T?T===b||T.contains(b):!1;if(X)return!1;var pe=va(w,b);if(!pe)return!0;if(pe?S=w:(S=w==="v"?"h":"v",pe=va(w,b)),!pe)return!1;if(!o.current&&"changedTouches"in d&&(m||v)&&(o.current=S),!S)return!0;var Oe=o.current||S;return Rt(Oe,c,d,Oe==="h"?m:v,!0)},[]),n=D.useCallback(function(d){var c=d;if(!(!Se.length||Se[Se.length-1]!==u)){var C="deltaY"in c?At(c):je(c),i=a.current.filter(function(S){return S.name===c.type&&(S.target===c.target||c.target===S.shadowParent)&&vr(S.delta,C)})[0];if(i&&i.should){c.cancelable&&c.preventDefault();return}if(!i){var m=(s.current.shards||[]).map(Dt).filter(Boolean).filter(function(S){return S.contains(c.target)}),v=m.length>0?l(c,m[0]):!s.current.noIsolation;v&&c.cancelable&&c.preventDefault()}}},[]),f=D.useCallback(function(d,c,C,i){var m={name:d,delta:c,target:C,should:i,shadowParent:br(C)};a.current.push(m),setTimeout(function(){a.current=a.current.filter(function(v){return v!==m})},1)},[]),p=D.useCallback(function(d){t.current=je(d),o.current=void 0},[]),L=D.useCallback(function(d){f(d.type,At(d),d.target,l(d,e.lockRef.current))},[]),x=D.useCallback(function(d){f(d.type,je(d),d.target,l(d,e.lockRef.current))},[]);D.useEffect(function(){return Se.push(u),e.setCallbacks({onScrollCapture:L,onWheelCapture:L,onTouchMoveCapture:x}),document.addEventListener("wheel",n,ne),document.addEventListener("touchmove",n,ne),document.addEventListener("touchstart",p,ne),function(){Se=Se.filter(function(d){return d!==u}),document.removeEventListener("wheel",n,ne),document.removeEventListener("touchmove",n,ne),document.removeEventListener("touchstart",p,ne)}},[]);var I=e.removeScrollBar,h=e.inert;return D.createElement(D.Fragment,null,h?D.createElement(u,{styles:kr(r)}):null,I?D.createElement(Sa,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function br(e){for(var a=null;e!==null;)e instanceof ShadowRoot&&(a=e.host,e=e.host),e=e.parentNode;return a}var Mt=La(Ke,Bt);var Ft=Ze.forwardRef(function(e,a){return Ze.createElement(De,U({},e,{ref:a,sideCar:Mt}))});Ft.classNames=De.classNames;var ka=Ft;var Pr=function(e){if(typeof document>"u")return null;var a=Array.isArray(e)?e[0]:e;return a.ownerDocument.body},we=new WeakMap,$e=new WeakMap,Je={},ya=0,Tt=function(e){return e&&(e.host||Tt(e.parentNode))},Rr=function(e,a){return a.map(function(t){if(e.contains(t))return t;var o=Tt(t);return o&&e.contains(o)?o:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(t){return!!t})},Ar=function(e,a,t,o){var r=Rr(a,Array.isArray(e)?e:[e]);Je[t]||(Je[t]=new WeakMap);var u=Je[t],s=[],l=new Set,n=new Set(r),f=function(L){!L||l.has(L)||(l.add(L),f(L.parentNode))};r.forEach(f);var p=function(L){!L||n.has(L)||Array.prototype.forEach.call(L.children,function(x){if(l.has(x))p(x);else try{var I=x.getAttribute(o),h=I!==null&&I!=="false",d=(we.get(x)||0)+1,c=(u.get(x)||0)+1;we.set(x,d),u.set(x,c),s.push(x),d===1&&h&&$e.set(x,!0),c===1&&x.setAttribute(t,"true"),h||x.setAttribute(o,"true")}catch(C){console.error("aria-hidden: cannot operate on ",x,C)}})};return p(a),l.clear(),ya++,function(){s.forEach(function(L){var x=we.get(L)-1,I=u.get(L)-1;we.set(L,x),u.set(L,I),x||($e.has(L)||L.removeAttribute(o),$e.delete(L)),I||L.removeAttribute(t)}),ya--,ya||(we=new WeakMap,we=new WeakMap,$e=new WeakMap,Je={})}},Ot=function(e,a,t){t===void 0&&(t="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=a||Pr(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),Ar(o,r,t,"aria-hidden")):function(){return null}};var y=require("react/jsx-runtime"),ba="Dialog",[Et,Cs]=Va(ba),[Dr,_]=Et(ba),qt=e=>{let{__scopeDialog:a,children:t,open:o,defaultOpen:r,onOpenChange:u,modal:s=!0}=e,l=R.useRef(null),n=R.useRef(null),[f=!1,p]=Xa({prop:o,defaultProp:r,onChange:u});return(0,y.jsx)(Dr,{scope:a,triggerRef:l,contentRef:n,contentId:Ne(),titleId:Ne(),descriptionId:Ne(),open:f,onOpenChange:p,onOpenToggle:R.useCallback(()=>p(L=>!L),[p]),modal:s,children:t})};qt.displayName=ba;var Ut="DialogTrigger",Br=R.forwardRef((e,a)=>{let{__scopeDialog:t,...o}=e,r=_(Ut,t),u=z(a,r.triggerRef);return(0,y.jsx)(H.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Aa(r.open),...o,ref:u,onClick:$(e.onClick,r.onOpenToggle)})});Br.displayName=Ut;var Pa="DialogPortal",[Mr,Ht]=Et(Pa,{forceMount:void 0}),Wt=e=>{let{__scopeDialog:a,forceMount:t,children:o,container:r}=e,u=_(Pa,a);return(0,y.jsx)(Mr,{scope:a,forceMount:t,children:R.Children.map(o,s=>(0,y.jsx)(Ae,{present:t||u.open,children:(0,y.jsx)(fa,{asChild:!0,container:r,children:s})}))})};Wt.displayName=Pa;var Qe="DialogOverlay",Nt=R.forwardRef((e,a)=>{let t=Ht(Qe,e.__scopeDialog),{forceMount:o=t.forceMount,...r}=e,u=_(Qe,e.__scopeDialog);return u.modal?(0,y.jsx)(Ae,{present:o||u.open,children:(0,y.jsx)(Fr,{...r,ref:a})}):null});Nt.displayName=Qe;var Fr=R.forwardRef((e,a)=>{let{__scopeDialog:t,...o}=e,r=_(Qe,t);return(0,y.jsx)(ka,{as:Re,allowPinchZoom:!0,shards:[r.contentRef],children:(0,y.jsx)(H.div,{"data-state":Aa(r.open),...o,ref:a,style:{pointerEvents:"auto",...o.style}})})}),ie="DialogContent",Gt=R.forwardRef((e,a)=>{let t=Ht(ie,e.__scopeDialog),{forceMount:o=t.forceMount,...r}=e,u=_(ie,e.__scopeDialog);return(0,y.jsx)(Ae,{present:o||u.open,children:u.modal?(0,y.jsx)(Tr,{...r,ref:a}):(0,y.jsx)(Or,{...r,ref:a})})});Gt.displayName=ie;var Tr=R.forwardRef((e,a)=>{let t=_(ie,e.__scopeDialog),o=R.useRef(null),r=z(a,t.contentRef,o);return R.useEffect(()=>{let u=o.current;if(u)return Ot(u)},[]),(0,y.jsx)(zt,{...e,ref:r,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:$(e.onCloseAutoFocus,u=>{u.preventDefault(),t.triggerRef.current?.focus()}),onPointerDownOutside:$(e.onPointerDownOutside,u=>{let s=u.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0;(s.button===2||l)&&u.preventDefault()}),onFocusOutside:$(e.onFocusOutside,u=>u.preventDefault())})}),Or=R.forwardRef((e,a)=>{let t=_(ie,e.__scopeDialog),o=R.useRef(!1),r=R.useRef(!1);return(0,y.jsx)(zt,{...e,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{e.onCloseAutoFocus?.(u),u.defaultPrevented||(o.current||t.triggerRef.current?.focus(),u.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:u=>{e.onInteractOutside?.(u),u.defaultPrevented||(o.current=!0,u.detail.originalEvent.type==="pointerdown"&&(r.current=!0));let s=u.target;t.triggerRef.current?.contains(s)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&r.current&&u.preventDefault()}})}),zt=R.forwardRef((e,a)=>{let{__scopeDialog:t,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:u,...s}=e,l=_(ie,t),n=R.useRef(null),f=z(a,n);return mt(),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(da,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:u,children:(0,y.jsx)(ua,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Aa(l.open),...s,ref:f,onDismiss:()=>l.onOpenChange(!1)})}),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Er,{titleId:l.titleId}),(0,y.jsx)(Ur,{contentRef:n,descriptionId:l.descriptionId})]})]})}),Ra="DialogTitle",Vt=R.forwardRef((e,a)=>{let{__scopeDialog:t,...o}=e,r=_(Ra,t);return(0,y.jsx)(H.h2,{id:r.titleId,...o,ref:a})});Vt.displayName=Ra;var _t="DialogDescription",Xt=R.forwardRef((e,a)=>{let{__scopeDialog:t,...o}=e,r=_(_t,t);return(0,y.jsx)(H.p,{id:r.descriptionId,...o,ref:a})});Xt.displayName=_t;var Kt="DialogClose",jt=R.forwardRef((e,a)=>{let{__scopeDialog:t,...o}=e,r=_(Kt,t);return(0,y.jsx)(H.button,{type:"button",...o,ref:a,onClick:$(e.onClick,()=>r.onOpenChange(!1))})});jt.displayName=Kt;function Aa(e){return e?"open":"closed"}var Zt="DialogTitleWarning",[Ss,$t]=za(Zt,{contentName:ie,titleName:Ra,docsSlug:"dialog"}),Er=({titleId:e})=>{let a=$t(Zt),t=`\`${a.contentName}\` requires a \`${a.titleName}\` for the component to be accessible for screen reader users.
|
|
197
198
|
|
|
198
199
|
If you want to hide the \`${a.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
199
200
|
|
|
200
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return R.useEffect(()=>{e&&(document.getElementById(e)||console.error(t))},[t,e]),null},qr="DialogDescriptionWarning",Ur=({contentRef:e,descriptionId:a})=>{let o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$t(qr).contentName}}.`;return R.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");a&&r&&(document.getElementById(a)||console.warn(o))},[o,e,a]),null},Jt=qt;var Qt=Wt,Yt=Nt,eo=Gt,ao=Vt,to=Xt,oo=jt;var Q=require("react/jsx-runtime");function W({className:e="",...a}){return(0,Q.jsx)("button",{className:`dswt-button ${e}`,...a})}function ro({className:e="",...a}){return(0,Q.jsx)("input",{className:`dswt-input ${e}`,...a})}function uo({children:e,...a}){return(0,Q.jsx)(Jt,{...a,children:e})}function lo({children:e}){let a=re();return(0,Q.jsxs)(Qt,{children:[(0,Q.jsx)(Yt,{className:"dswt-dialog-overlay"}),(0,Q.jsxs)(eo,{className:"dswt-dialog-content",children:[e,(0,Q.jsx)(oo,{className:"dswt-dialog-close","aria-label":a("close"),children:(0,Q.jsx)(Pe,{size:16})})]})]})}var so=ao,fo=to;var k=require("react/jsx-runtime");function no({target:e,api:a,workspaces:t,sessions:o,defaultBaseChoice:r="current",onCreated:u,onClose:s}){let l=re(),[i,f]=(0,te.useState)(null),[c,L]=(0,te.useState)(""),[I,h]=(0,te.useState)(r),[C,d]=(0,te.useState)(""),[m,w]=(0,te.useState)(!1),[v,y]=(0,te.useState)(null);(0,te.useEffect)(()=>{let P=!0;return f(null),d(""),L(""),h(r),a.list(e.path).then(N=>{P&&f(N)}).catch(N=>{P&&d(String(N?.message??N))}),()=>{P=!1}},[a,r,e.path]);let p=i?.repoPath,x=Ha(c),n=`task/${x}`,g=p?Wa(p,x):"",M=i?.worktrees.find(P=>F(P.path)===F(e.path))?.branch??"HEAD",E=i?.defaultBranch??i?.worktrees.find(P=>P.isMain)?.branch??M,V=I==="main"?i?.defaultRef??E:M,Y=async(P,N)=>{let ee=await t.create({path:P});await t.rename(ee.workspaceId,`${e.title}/${N}`);let me=await t.connectWorkspace(ee.workspaceId);u(P),o.open(me),s()},Oe=async()=>{if(v){w(!0),d("");try{await Y(v.path,v.branch.replace(/^task\//,"")),y(null)}catch(P){d(`${l("registerFailed")} ${String(P?.message??P)}`)}finally{w(!1)}}},xo=async()=>{if(v){w(!0),d("");try{await a.remove({repoPath:v.repoPath,path:v.path}),y(null),s()}catch(P){d(ue(l("cleanupFailed"),{error:String(P?.message??P),path:v.path}))}finally{w(!1)}}},Io=async()=>{if(!p||!c.trim()){d(l("fillTaskName"));return}w(!0),d("");let P,N;try{let ee=await a.create({repoPath:p,path:g,branch:n,baseRef:V});P=ee.path,N=await t.create({path:ee.path}),await t.rename(N.workspaceId,`${e.title}/${x}`);let me=await t.connectWorkspace(N.workspaceId);u(ee.path),o.open(me),s()}catch(ee){if(N?.workspaceId)try{await t.delete(N.workspaceId)}catch(me){P&&y({repoPath:p,path:P,branch:n}),d(ue(l("cleanupFailed"),{error:String(me?.message??me),path:P??""}));return}P?(y({repoPath:p,path:P,branch:n}),d(l("registerFailed"))):d(`${l("operationFailed")}${String(ee?.message??ee)}`)}finally{w(!1)}};return(0,k.jsx)(uo,{open:!0,onOpenChange:P=>{!P&&!m&&s()},children:(0,k.jsxs)(lo,{children:[(0,k.jsx)(so,{className:"dswt-dialog-title",children:ue(l("dialogTitle"),{name:e.title})}),(0,k.jsx)(fo,{className:"dswt-visually-hidden",children:e.title}),C?(0,k.jsxs)("div",{className:"dswt-error",role:"alert",children:[(0,k.jsx)(Z,{size:14})," ",C]}):null,(0,k.jsxs)("label",{className:"dswt-field",children:[(0,k.jsx)("span",{className:"dswt-field-label",children:l("taskName")}),(0,k.jsx)(ro,{"aria-label":l("taskName"),value:c,disabled:m,onChange:P=>L(P.target.value),placeholder:l("taskNamePlaceholder"),autoFocus:!0})]}),(0,k.jsxs)("fieldset",{className:"dswt-field dswt-base-fieldset",disabled:m||!i,children:[(0,k.jsx)("legend",{className:"dswt-field-label",children:l("basedOn")}),(0,k.jsxs)("div",{className:"dswt-radio-group",role:"radiogroup","aria-label":l("basedOn"),children:[(0,k.jsxs)("label",{className:"dswt-radio-option","data-selected":I==="current"?"true":void 0,children:[(0,k.jsx)("input",{className:"dswt-radio-input",type:"radio",name:"dswt-base-branch",value:"current",checked:I==="current",onChange:()=>h("current")}),(0,k.jsxs)("span",{className:"dswt-radio-copy",children:[(0,k.jsx)("span",{className:"dswt-radio-label",children:l("currentBranch")}),(0,k.jsx)("span",{className:"dswt-radio-branch",children:M})]})]}),(0,k.jsxs)("label",{className:"dswt-radio-option","data-selected":I==="main"?"true":void 0,children:[(0,k.jsx)("input",{className:"dswt-radio-input",type:"radio",name:"dswt-base-branch",value:"main",checked:I==="main",onChange:()=>h("main")}),(0,k.jsxs)("span",{className:"dswt-radio-copy",children:[(0,k.jsx)("span",{className:"dswt-radio-label",children:l("mainBranch")}),(0,k.jsx)("span",{className:"dswt-radio-branch",children:E})]})]})]})]}),v?(0,k.jsxs)("div",{className:"dswt-dialog-actions",children:[(0,k.jsx)(W,{type:"button",disabled:m,onClick:()=>{Oe()},children:l("retryRegister")}),(0,k.jsx)(W,{type:"button",disabled:m,onClick:()=>{xo()},children:l("cleanupCreated")})]}):null,v?null:(0,k.jsxs)("div",{className:"dswt-dialog-actions",children:[(0,k.jsx)(W,{type:"button",disabled:m,onClick:s,children:l("cancel")}),(0,k.jsxs)(W,{type:"button",className:"dswt-button-primary",disabled:m||!c.trim()||!i,onClick:Io,children:[m?(0,k.jsx)($,{size:14,className:"dswt-spin"}):null,l(m?"creating":"createAndOpen")]})]})]})})}var pe=require("react/jsx-runtime");function Fe(){return(0,pe.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[(0,pe.jsx)("path",{d:"M4 2.25v8.5a2.25 2.25 0 1 0 1.5 0V7.75h4v3a2.25 2.25 0 1 0 1.5 0V6.25H5.5v-4H4Z",fill:"currentColor"}),(0,pe.jsx)("circle",{cx:"4.75",cy:"12.75",r:"1.5",fill:"currentColor"}),(0,pe.jsx)("circle",{cx:"10.25",cy:"12.75",r:"1.5",fill:"currentColor"}),(0,pe.jsx)("circle",{cx:"4.75",cy:"2.25",r:"1.5",fill:"currentColor"})]})}var Te=require("react/jsx-runtime");function io({session:e,useWorkspaces:a,onOpen:t,canCreate:o}){let r=re(),u=a(s=>s.items.find(l=>l.sessionIds?.includes(e.sessionId)));return!e.blank||!u||o&&!o(u)?null:(0,Te.jsx)("div",{className:"dswt-new-session-action",children:(0,Te.jsxs)(W,{type:"button",className:"dswt-new-session-button",onClick:()=>t(u),children:[(0,Te.jsx)(Fe,{}),r("createWorktree")]})})}var oe=require("react");var S=require("react/jsx-runtime");function co({api:e,workspaces:a,sessions:t}){let o=re(),[r,u]=(0,oe.useState)([]),[s,l]=(0,oe.useState)(!1),[i,f]=(0,oe.useState)(""),[c,L]=(0,oe.useState)(null),I=(0,oe.useCallback)(async()=>{l(!0),f("");try{let p=new Set,x=[],n=await e.scan(a.list.getSnapshot().items.map(g=>g.path));for(let g of n)try{let M=F(g.repoPath);if(M&&!p.has(M)){p.add(M);let E=await Promise.all(g.worktrees.map(async V=>{try{return{...V,...await e.status(V.path)}}catch(Y){return{...V,statusError:String(Y?.message??Y)}}}));x.push({...g,worktrees:E})}}catch{}u(x)}catch(p){f(String(p?.message??p))}finally{l(!1)}},[e,a]);(0,oe.useEffect)(()=>{I()},[I]);let h=p=>p.statusError==="worktree-unavailable"?o("unavailable"):p.statusError==="not-git-repository"?o("notGitWorkspace"):p.statusError,C=p=>p.split(/[\\/]/).filter(Boolean).pop()??p,d=(p,x)=>{let n=p.endsWith("/")?p:`${p}/`;return x.startsWith(n)?x.slice(n.length)||".":x},m=r.reduce((p,x)=>p+x.worktrees.length,0),w=async(p,x)=>{L(x.path),f("");try{let n=a.list.getSnapshot().items.find(E=>F(E.path)===F(x.path)),g=!n;if(n||(n=await a.create({path:x.path})),g){let E=x.isMain?o("mainRepository"):`${p.defaultBranch??"worktree"}/${x.branch??"detached"}`;await a.rename(n.workspaceId,E)}let M=await a.connectWorkspace(n.workspaceId);t.open(M)}catch(n){f(`${o("operationError")}${String(n?.message??n)}`)}finally{L(null)}},v=async(p,x)=>{if(x.isMain)return;let n=x.statusError?o("unavailable"):x.changedFiles?ue(o("dirty"),{count:String(x.changedFiles)}):o("clean");if(x.changedFiles||x.statusError){f(x.statusError?`${o("operationError")}${h(x)}`:o("dirtyRemoveBlocked"));return}if(window.confirm(ue(o("removeConfirm"),{path:x.path,status:n}))){L(x.path),f("");try{await e.remove({repoPath:p.repoPath,path:x.path});let g=a.list.getSnapshot().items.find(M=>F(M.path)===F(x.path));g&&await a.delete(g.workspaceId),await I()}catch(g){f(`${o("operationError")}${String(g?.message??g)}`)}finally{L(null)}}},y=async p=>{L(p.repoPath),f("");try{await e.prune(p.repoPath),await I()}catch(x){f(`${o("operationError")}${String(x?.message??x)}`)}finally{L(null)}};return(0,S.jsxs)("section",{className:"dswt-settings","aria-label":o("worktrees"),children:[(0,S.jsxs)("div",{className:"dswt-settings-header",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("h2",{children:o("worktrees")}),(0,S.jsx)("p",{className:"dswt-settings-subtitle",children:o("worktreesSubtitle")})]}),(0,S.jsx)(W,{type:"button",className:"dswt-icon-button","aria-label":o("refresh"),title:o("refresh"),disabled:s,onClick:()=>{I()},children:(0,S.jsx)(be,{size:15,className:s?"dswt-spin":void 0})})]}),r.length>0?(0,S.jsxs)("div",{className:"dswt-summary",children:[(0,S.jsx)("strong",{children:r.length})," ",o("repositories"),(0,S.jsx)("span",{children:"\xB7"}),(0,S.jsx)("strong",{children:m})," ",o("worktreeCount")]}):null,i?(0,S.jsxs)("div",{className:"dswt-error",role:"alert",children:[(0,S.jsx)(Z,{size:14})," ",i]}):null,r.length===0&&!s?(0,S.jsxs)("div",{className:"dswt-empty",children:[(0,S.jsx)("p",{children:o("noWorktrees")}),(0,S.jsx)("span",{children:o("noWorktreesHint")})]}):null,(0,S.jsx)("div",{className:"dswt-repo-list",children:r.map(p=>{let x=p.worktrees.filter(n=>n.prunable).length;return(0,S.jsxs)("article",{className:"dswt-repo",children:[(0,S.jsxs)("header",{className:"dswt-repo-header",children:[(0,S.jsxs)("div",{className:"dswt-repo-heading",children:[(0,S.jsx)("span",{className:"dswt-repo-icon",children:(0,S.jsx)(ye,{size:15})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("h3",{children:C(p.repoPath)}),(0,S.jsx)("p",{title:p.repoPath,children:p.repoPath})]})]}),x>0?(0,S.jsxs)(W,{type:"button",className:"dswt-button-secondary",disabled:c===p.repoPath,onClick:()=>{y(p)},children:[o("prune")," ",(0,S.jsx)("span",{className:"dswt-count",children:x})]}):null]}),(0,S.jsx)("div",{className:"dswt-worktree-list",children:p.worktrees.map(n=>{let g=n.statusError?"unavailable":n.changedFiles?"dirty":n.prunable?"prunable":"clean";return(0,S.jsxs)("div",{className:"dswt-worktree",children:[(0,S.jsxs)("div",{className:"dswt-worktree-info",children:[(0,S.jsxs)("div",{className:"dswt-worktree-title",children:[(0,S.jsx)("strong",{children:n.branch??o("detached")}),n.isMain?(0,S.jsx)("span",{className:"dswt-badge dswt-badge-main",children:o("mainRepository")}):(0,S.jsx)("span",{className:"dswt-badge",children:o("linkedWorktree")})]}),(0,S.jsx)("div",{className:"dswt-worktree-path",title:n.path,children:d(p.repoPath,n.path)}),(0,S.jsxs)("div",{className:`dswt-status dswt-status-${g}`,children:[n.statusError?h(n):n.changedFiles?ue(o("dirty"),{count:String(n.changedFiles)}):n.prunable?o("prunable"):o("clean"),n.locked?` \xB7 ${o("locked")}`:""]})]}),(0,S.jsxs)("div",{className:"dswt-worktree-actions",children:[(0,S.jsxs)(W,{type:"button",className:"dswt-button-primary",disabled:c===n.path||!!n.statusError,onClick:()=>{w(p,n)},children:[c===n.path?(0,S.jsx)($,{size:14,className:"dswt-spin"}):null,o("open")]}),!n.isMain&&(n.prunable||n.statusError)?(0,S.jsx)(W,{type:"button",className:"dswt-button-secondary",disabled:c===n.path,onClick:()=>{y(p)},children:o("prune")}):null,!n.isMain&&!n.prunable&&!n.statusError?(0,S.jsx)(W,{type:"button",className:"dswt-button-danger",disabled:c===n.path,onClick:()=>{v(p,n)},children:o("remove")}):null]})]},n.path)})})]},p.repoPath)})})]})}var Wr="/dsh-simple-worktree";function Nr(e,a){if(e==="not-git-repository"||/not a git repository/i.test(a))return"not-git-repository";if(e==="worktree-unavailable"||/is not a working tree|No such file or directory/i.test(a))return"worktree-unavailable"}function po(e){async function a(t,o){let r=await e.rpc.call(Wr,t,o);if(!r?.ok){let u=r?.error?.message??"worktree operation failed",s=Nr(r?.error?.code,u),l=new Error(s??u);throw l.code=s??r?.error?.code,l}return r.value}return{list:t=>a("worktree.list",{path:t}),scan:t=>a("worktree.scan",{paths:t}),classify:t=>a("worktree.classify",{path:t}),create:t=>a("worktree.create",t),remove:t=>a("worktree.remove",t),status:t=>a("worktree.status",{path:t}),prune:t=>a("worktree.prune",{path:t})}}var ve=require("react/jsx-runtime"),mo="data-dsh-simple-worktree-style";function Gr(){if(typeof document>"u"||document.querySelector(`style[${mo}]`))return;let e=document.createElement("style");return e.setAttribute(mo,""),e.textContent=Ba,document.head.appendChild(e),()=>e.remove()}var Lo={name:"@alpacachen/dsh-simple-worktree",inject:["slots","connection","locale","workspaces","sessions"],apply(e){e.effect(Gr,"dsh-simple-worktree styles"),e.effect(()=>Ua(e),"dsh-simple-worktree locale");let a=po(e.connection),t=e.workspaces,o=e.sessions,r=e.get("locale"),u=e.get("workspaceExtensions"),s=new Set;e.effect(()=>{if(!(!r||typeof r.subscribe!="function"||!u))return r.subscribe(()=>u.invalidate())},"dsh-simple-worktree locale refresh");let l=new Set,i=!0,f=()=>{},c=0,L=async()=>{let h=++c,C=t.list.getSnapshot().items,d=await Promise.all(C.map(async m=>{try{return await a.classify(m.path)}catch{return}}));if(!(!i||h!==c)){s.clear(),l.clear();for(let m of d)m?.isGit&&m.path&&s.add(F(m.path)),m?.isWorktree&&m.path&&l.add(F(m.path));u?.invalidate()}};e.effect(()=>u?u.register({id:"dsh-simple-worktree",menuItem(C){let d=F(C.path);if(!(!s.has(d)||l.has(d)))return{id:"dsh-simple-worktree.create",label:xe("createWorktree"),icon:(0,ve.jsx)(Fe,{}),order:30,onSelect:()=>f(C)}},deleteWorkspace(C){let d=F(C.path);if(l.has(d))return(async()=>{let m=await a.classify(C.path);!m.isWorktree||!m.repoPath||(await a.remove({repoPath:m.repoPath,path:C.path}),await t.delete(C.workspaceId),s.delete(d),l.delete(d),u?.invalidate())})()},icon(C){return l.has(F(C.path))?(0,ve.jsx)(Fe,{}):void 0}}):void 0,"dsh-simple-worktree workspace extensions"),e.effect(()=>{i=!0;let h=t.list.subscribe(()=>{L()});return L(),()=>{i=!1,c+=1,h()}},"dsh-simple-worktree workspace classification");function I(){let[h,C]=(0,Ye.useState)(null);return(0,Ye.useEffect)(()=>(f=(d,m="current")=>C({target:d,defaultBaseChoice:m}),()=>{f=()=>{}}),[]),h?(0,ve.jsx)(no,{target:h.target,api:a,workspaces:t,sessions:o,defaultBaseChoice:h.defaultBaseChoice,onCreated:d=>{s.add(F(d)),l.add(F(d)),u?.invalidate()},onClose:()=>C(null)}):null}e.slots.inject("conversation.input.dock",()=>e.slots.register({name:"conversation.input.dock",id:"dsh-simple-worktree-new-session",order:-30,locale:Le,label:()=>xe("createWorktree")},h=>(0,ve.jsx)(io,{session:h.session,useWorkspaces:h.useWorkspaces,canCreate:C=>s.has(F(C.path))&&!l.has(F(C.path)),onOpen:C=>f(C,"main")}))),e.slots.inject("shell.overlay",()=>e.slots.register({name:"shell.overlay",id:"dsh-simple-worktree-create",order:30,locale:Le,label:()=>xe("createWorktree")},I)),e.slots.inject("settings.section",()=>e.slots.register({name:"settings.section",id:"dsh-simple-worktree",order:45,label:()=>xe("worktrees"),locale:Le,inject:()=>({})},()=>(0,ve.jsx)(co,{api:a,workspaces:t,sessions:o})))}};var zr=Lo;
|
|
201
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return R.useEffect(()=>{e&&(document.getElementById(e)||console.error(t))},[t,e]),null},qr="DialogDescriptionWarning",Ur=({contentRef:e,descriptionId:a})=>{let o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$t(qr).contentName}}.`;return R.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");a&&r&&(document.getElementById(a)||console.warn(o))},[o,e,a]),null},Jt=qt;var Qt=Wt,Yt=Nt,eo=Gt,ao=Vt,to=Xt,oo=jt;var J=require("react/jsx-runtime");function Q({className:e="",...a}){return(0,J.jsx)("button",{className:`dswt-button ${e}`,...a})}function ro({className:e="",...a}){return(0,J.jsx)("input",{className:`dswt-input ${e}`,...a})}function uo({children:e,...a}){return(0,J.jsx)(Jt,{...a,children:e})}function lo({children:e}){let a=oe();return(0,J.jsxs)(Qt,{children:[(0,J.jsx)(Yt,{className:"dswt-dialog-overlay"}),(0,J.jsxs)(eo,{className:"dswt-dialog-content",children:[e,(0,J.jsx)(oo,{className:"dswt-dialog-close","aria-label":a("close"),children:(0,J.jsx)(Pe,{size:16})})]})]})}var so=ao,fo=to;var k=require("react/jsx-runtime");function no({target:e,api:a,workspaces:t,sessions:o,defaultBaseChoice:r="current",onCreated:u,onClose:s}){let l=oe(),[n,f]=(0,ae.useState)(null),[p,L]=(0,ae.useState)(""),[x,I]=(0,ae.useState)(r),[h,d]=(0,ae.useState)(""),[c,C]=(0,ae.useState)(!1),[i,m]=(0,ae.useState)(null);(0,ae.useEffect)(()=>{let P=!0;return f(null),d(""),L(""),I(r),a.list(e.path).then(W=>{P&&f(W)}).catch(W=>{P&&d(String(W?.message??W))}),()=>{P=!1}},[a,r,e.path]);let v=n?.repoPath,S=Ha(p),b=`task/${S}`,w=v?Wa(v,S):"",O=n?.worktrees.find(P=>F(P.path)===F(e.path))?.branch??"HEAD",T=n?.defaultBranch??n?.worktrees.find(P=>P.isMain)?.branch??O,X=x==="main"?n?.defaultRef??T:O,pe=async(P,W)=>{let Y=await t.create({path:P});await t.rename(Y.workspaceId,`${e.title}/${W}`);let me=await t.connectWorkspace(Y.workspaceId);u(P),o.open(me),s()},Oe=async()=>{if(i){C(!0),d("");try{await pe(i.path,i.branch.replace(/^task\//,"")),m(null)}catch(P){d(`${l("registerFailed")} ${String(P?.message??P)}`)}finally{C(!1)}}},xo=async()=>{if(i){C(!0),d("");try{await a.remove({repoPath:i.repoPath,path:i.path}),m(null),s()}catch(P){d(re(l("cleanupFailed"),{error:String(P?.message??P),path:i.path}))}finally{C(!1)}}},Io=async()=>{if(!v||!p.trim()){d(l("fillTaskName"));return}C(!0),d("");let P,W;try{let Y=await a.create({repoPath:v,path:w,branch:b,baseRef:X});P=Y.path,W=await t.create({path:Y.path}),await t.rename(W.workspaceId,`${e.title}/${S}`);let me=await t.connectWorkspace(W.workspaceId);u(Y.path),o.open(me),s()}catch(Y){if(W?.workspaceId)try{await t.delete(W.workspaceId)}catch(me){P&&m({repoPath:v,path:P,branch:b}),d(re(l("cleanupFailed"),{error:String(me?.message??me),path:P??""}));return}P?(m({repoPath:v,path:P,branch:b}),d(l("registerFailed"))):d(`${l("operationFailed")}${String(Y?.message??Y)}`)}finally{C(!1)}};return(0,k.jsx)(uo,{open:!0,onOpenChange:P=>{!P&&!c&&s()},children:(0,k.jsxs)(lo,{children:[(0,k.jsx)(so,{className:"dswt-dialog-title",children:re(l("dialogTitle"),{name:e.title})}),(0,k.jsx)(fo,{className:"dswt-visually-hidden",children:e.title}),h?(0,k.jsxs)("div",{className:"dswt-error",role:"alert",children:[(0,k.jsx)(j,{size:14})," ",h]}):null,(0,k.jsxs)("label",{className:"dswt-field",children:[(0,k.jsx)("span",{className:"dswt-field-label",children:l("taskName")}),(0,k.jsx)(ro,{"aria-label":l("taskName"),value:p,disabled:c,onChange:P=>L(P.target.value),placeholder:l("taskNamePlaceholder"),autoFocus:!0})]}),(0,k.jsxs)("fieldset",{className:"dswt-field dswt-base-fieldset",disabled:c||!n,children:[(0,k.jsx)("legend",{className:"dswt-field-label",children:l("basedOn")}),(0,k.jsxs)("div",{className:"dswt-radio-group",role:"radiogroup","aria-label":l("basedOn"),children:[(0,k.jsxs)("label",{className:"dswt-radio-option","data-selected":x==="current"?"true":void 0,children:[(0,k.jsx)("input",{className:"dswt-radio-input",type:"radio",name:"dswt-base-branch",value:"current",checked:x==="current",onChange:()=>I("current")}),(0,k.jsxs)("span",{className:"dswt-radio-copy",children:[(0,k.jsx)("span",{className:"dswt-radio-label",children:l("currentBranch")}),(0,k.jsx)("span",{className:"dswt-radio-branch",children:O})]})]}),(0,k.jsxs)("label",{className:"dswt-radio-option","data-selected":x==="main"?"true":void 0,children:[(0,k.jsx)("input",{className:"dswt-radio-input",type:"radio",name:"dswt-base-branch",value:"main",checked:x==="main",onChange:()=>I("main")}),(0,k.jsxs)("span",{className:"dswt-radio-copy",children:[(0,k.jsx)("span",{className:"dswt-radio-label",children:l("mainBranch")}),(0,k.jsx)("span",{className:"dswt-radio-branch",children:T})]})]})]})]}),i?(0,k.jsxs)("div",{className:"dswt-dialog-actions",children:[(0,k.jsx)(Q,{type:"button",disabled:c,onClick:()=>{Oe()},children:l("retryRegister")}),(0,k.jsx)(Q,{type:"button",disabled:c,onClick:()=>{xo()},children:l("cleanupCreated")})]}):null,i?null:(0,k.jsxs)("div",{className:"dswt-dialog-actions",children:[(0,k.jsx)(Q,{type:"button",disabled:c,onClick:s,children:l("cancel")}),(0,k.jsxs)(Q,{type:"button",className:"dswt-button-primary",disabled:c||!p.trim()||!n,onClick:Io,children:[c?(0,k.jsx)(Z,{size:14,className:"dswt-spin"}):null,l(c?"creating":"createAndOpen")]})]})]})})}var ce=require("react/jsx-runtime");function Fe(){return(0,ce.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[(0,ce.jsx)("path",{d:"M4 2.25v8.5a2.25 2.25 0 1 0 1.5 0V7.75h4v3a2.25 2.25 0 1 0 1.5 0V6.25H5.5v-4H4Z",fill:"currentColor"}),(0,ce.jsx)("circle",{cx:"4.75",cy:"12.75",r:"1.5",fill:"currentColor"}),(0,ce.jsx)("circle",{cx:"10.25",cy:"12.75",r:"1.5",fill:"currentColor"}),(0,ce.jsx)("circle",{cx:"4.75",cy:"2.25",r:"1.5",fill:"currentColor"})]})}var Te=require("react/jsx-runtime");function io({session:e,useWorkspaces:a,onOpen:t,canCreate:o}){let r=oe(),u=a(s=>s.items.find(l=>l.sessionIds?.includes(e.sessionId)));return!e.blank||!u||o&&!o(u)?null:(0,Te.jsx)("div",{className:"dswt-new-session-action",children:(0,Te.jsxs)(Q,{type:"button",className:"dswt-new-session-button",onClick:()=>t(u),children:[(0,Te.jsx)(Fe,{}),r("createWorktree")]})})}var te=require("react");var g=require("react/jsx-runtime");function co({api:e,workspaces:a,sessions:t}){let o=oe(),[r,u]=(0,te.useState)([]),[s,l]=(0,te.useState)(!1),[n,f]=(0,te.useState)(""),[p,L]=(0,te.useState)(null),x=(0,te.useCallback)(async()=>{l(!0),f("");try{let i=new Set,m=[],v=await e.scan(a.list.getSnapshot().items.map(S=>S.path));for(let S of v)try{let b=F(S.repoPath);if(b&&!i.has(b)){i.add(b);let O=(await Promise.all(S.worktrees.map(async T=>{try{return{...T,...await e.status(T.path)}}catch(X){return{...T,statusError:String(X?.message??X)}}}))).filter(T=>!T.isMain);O.length>0&&m.push({...S,currentBranch:S.worktrees.find(T=>T.isMain)?.branch,worktrees:O})}}catch{}u(m)}catch(i){f(String(i?.message??i))}finally{l(!1)}},[e,a]);(0,te.useEffect)(()=>{x()},[x]);let I=i=>i.statusError==="worktree-unavailable"?o("unavailable"):i.statusError==="not-git-repository"?o("notGitWorkspace"):i.statusError,h=i=>i.split(/[\\/]/).filter(Boolean).pop()??i,d=(i,m)=>{let v=i.endsWith("/")?i:`${i}/`;return m.startsWith(v)?m.slice(v.length)||".":m},c=r.reduce((i,m)=>i+m.worktrees.length,0),C=async(i,m)=>{let v=m.statusError?o("unavailable"):m.changedFiles?re(o("dirty"),{count:String(m.changedFiles)}):o("clean");if(m.changedFiles){f(o("dirtyRemoveBlocked"));return}if(window.confirm(re(o("removeConfirm"),{path:m.path,status:v}))){L(m.path),f("");try{await e.remove({repoPath:i.repoPath,path:m.path});let S=a.list.getSnapshot().items.find(b=>F(b.path)===F(m.path));S&&await a.delete(S.workspaceId),await x()}catch(S){f(`${o("operationError")}${String(S?.message??S)}`)}finally{L(null)}}};return(0,g.jsxs)("section",{className:"dswt-settings","aria-label":o("worktrees"),children:[(0,g.jsxs)("div",{className:"dswt-settings-header",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("h2",{children:o("worktrees")}),(0,g.jsx)("p",{className:"dswt-settings-subtitle",children:o("worktreesSubtitle")})]}),(0,g.jsx)(Q,{type:"button",className:"dswt-icon-button","aria-label":o("refresh"),title:o("refresh"),disabled:s,onClick:()=>{x()},children:(0,g.jsx)(be,{size:15,className:s?"dswt-spin":void 0})})]}),r.length>0?(0,g.jsxs)("div",{className:"dswt-summary",children:[(0,g.jsx)("strong",{children:r.length})," ",o("repositories"),(0,g.jsx)("span",{children:"\xB7"}),(0,g.jsx)("strong",{children:c})," ",o("worktreeCount")]}):null,n?(0,g.jsxs)("div",{className:"dswt-error",role:"alert",children:[(0,g.jsx)(j,{size:14})," ",n]}):null,r.length===0&&!s?(0,g.jsxs)("div",{className:"dswt-empty",children:[(0,g.jsx)("p",{children:o("noWorktrees")}),(0,g.jsx)("span",{children:o("noWorktreesHint")})]}):null,(0,g.jsx)("div",{className:"dswt-repo-list",children:r.map(i=>(0,g.jsxs)("article",{className:"dswt-repo",children:[(0,g.jsxs)("header",{className:"dswt-repo-header",children:[(0,g.jsxs)("div",{className:"dswt-repo-heading",children:[(0,g.jsx)("span",{className:"dswt-repo-icon",children:(0,g.jsx)(ye,{size:15})}),(0,g.jsxs)("div",{children:[(0,g.jsx)("h3",{children:h(i.repoPath)}),(0,g.jsx)("p",{title:i.repoPath,children:i.repoPath})]})]}),(0,g.jsxs)("div",{className:"dswt-repo-branch",children:[(0,g.jsx)("span",{children:o("currentBranchLabel")}),(0,g.jsx)("strong",{children:i.currentBranch??o("detached")})]})]}),(0,g.jsx)("div",{className:"dswt-worktree-list",children:i.worktrees.map(m=>{let v=m.statusError?"unavailable":m.changedFiles?"dirty":m.prunable?"prunable":"clean";return(0,g.jsxs)("div",{className:"dswt-worktree",children:[(0,g.jsxs)("div",{className:"dswt-worktree-info",children:[(0,g.jsx)("div",{className:"dswt-worktree-title",children:(0,g.jsx)("strong",{children:m.branch??o("detached")})}),(0,g.jsx)("div",{className:"dswt-worktree-path",title:m.path,children:d(i.repoPath,m.path)}),(0,g.jsxs)("div",{className:`dswt-status dswt-status-${v}`,children:[m.statusError?I(m):m.changedFiles?re(o("dirty"),{count:String(m.changedFiles)}):m.prunable?o("prunable"):o("clean"),m.locked?` \xB7 ${o("locked")}`:""]})]}),(0,g.jsx)("div",{className:"dswt-worktree-actions",children:(0,g.jsxs)(Q,{type:"button",className:"dswt-button-danger",disabled:p===m.path,onClick:()=>{C(i,m)},children:[p===m.path?(0,g.jsx)(Z,{size:14,className:"dswt-spin"}):null,o("remove")]})})]},m.path)})})]},i.repoPath))})]})}var Wr="/dsh-simple-worktree";function Nr(e,a){if(e==="not-git-repository"||/not a git repository/i.test(a))return"not-git-repository";if(e==="worktree-unavailable"||/is not a working tree|No such file or directory/i.test(a))return"worktree-unavailable"}function po(e){async function a(t,o){let r=await e.rpc.call(Wr,t,o);if(!r?.ok){let u=r?.error?.message??"worktree operation failed",s=Nr(r?.error?.code,u),l=new Error(s??u);throw l.code=s??r?.error?.code,l}return r.value}return{list:t=>a("worktree.list",{path:t}),scan:t=>a("worktree.scan",{paths:t}),classify:t=>a("worktree.classify",{path:t}),create:t=>a("worktree.create",t),remove:t=>a("worktree.remove",t),status:t=>a("worktree.status",{path:t}),prune:t=>a("worktree.prune",{path:t})}}var ve=require("react/jsx-runtime"),mo="data-dsh-simple-worktree-style";function Gr(){if(typeof document>"u"||document.querySelector(`style[${mo}]`))return;let e=document.createElement("style");return e.setAttribute(mo,""),e.textContent=Ba,document.head.appendChild(e),()=>e.remove()}var Lo={name:"@alpacachen/dsh-simple-worktree",inject:["slots","connection","locale","workspaces","sessions"],apply(e){e.effect(Gr,"dsh-simple-worktree styles"),e.effect(()=>Ua(e),"dsh-simple-worktree locale");let a=po(e.connection),t=e.workspaces,o=e.sessions,r=e.get("locale"),u=e.get("workspaceExtensions"),s=new Set;e.effect(()=>{if(!(!r||typeof r.subscribe!="function"||!u))return r.subscribe(()=>u.invalidate())},"dsh-simple-worktree locale refresh");let l=new Set,n=!0,f=()=>{},p=0,L=async()=>{let I=++p,h=t.list.getSnapshot().items,d=await Promise.all(h.map(async c=>{try{return await a.classify(c.path)}catch{return}}));if(!(!n||I!==p)){s.clear(),l.clear();for(let c of d)c?.isGit&&c.path&&s.add(F(c.path)),c?.isWorktree&&c.path&&l.add(F(c.path));u?.invalidate()}};e.effect(()=>u?u.register({id:"dsh-simple-worktree",menuItem(h){let d=F(h.path);if(!(!s.has(d)||l.has(d)))return{id:"dsh-simple-worktree.create",label:xe("createWorktree"),icon:(0,ve.jsx)(Fe,{}),order:30,onSelect:()=>f(h)}},deleteWorkspace(h){let d=F(h.path);if(l.has(d))return(async()=>{let c=await a.classify(h.path);!c.isWorktree||!c.repoPath||(await a.remove({repoPath:c.repoPath,path:h.path}),await t.delete(h.workspaceId),s.delete(d),l.delete(d),u?.invalidate())})()},icon(h){return l.has(F(h.path))?(0,ve.jsx)(Fe,{}):void 0}}):void 0,"dsh-simple-worktree workspace extensions"),e.effect(()=>{n=!0;let I=t.list.subscribe(()=>{L()});return L(),()=>{n=!1,p+=1,I()}},"dsh-simple-worktree workspace classification");function x(){let[I,h]=(0,Ye.useState)(null);return(0,Ye.useEffect)(()=>(f=(d,c="current")=>h({target:d,defaultBaseChoice:c}),()=>{f=()=>{}}),[]),I?(0,ve.jsx)(no,{target:I.target,api:a,workspaces:t,sessions:o,defaultBaseChoice:I.defaultBaseChoice,onCreated:d=>{s.add(F(d)),l.add(F(d)),u?.invalidate()},onClose:()=>h(null)}):null}e.slots.inject("conversation.input.dock",()=>e.slots.register({name:"conversation.input.dock",id:"dsh-simple-worktree-new-session",order:-30,locale:Le,label:()=>xe("createWorktree")},I=>(0,ve.jsx)(io,{session:I.session,useWorkspaces:I.useWorkspaces,canCreate:h=>s.has(F(h.path))&&!l.has(F(h.path)),onOpen:h=>f(h,"main")}))),e.slots.inject("shell.overlay",()=>e.slots.register({name:"shell.overlay",id:"dsh-simple-worktree-create",order:30,locale:Le,label:()=>xe("createWorktree")},x)),e.slots.inject("settings.section",()=>e.slots.register({name:"settings.section",id:"dsh-simple-worktree",order:45,label:()=>xe("worktrees"),locale:Le,inject:()=>({})},()=>(0,ve.jsx)(co,{api:a,workspaces:t,sessions:o})))}};var zr=Lo;
|
|
201
202
|
/*! Bundled license information:
|
|
202
203
|
|
|
203
204
|
lucide-react/dist/esm/shared/src/utils.js:
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { installSettingsSection, settingsNamespace } from '@deepseek-ai/dsh-settings'
|
|
2
2
|
import z from '@deepseek-ai/schemastery'
|
|
3
|
-
import { readdir } from 'node:fs/promises'
|
|
3
|
+
import { readdir, readFile, rm } from 'node:fs/promises'
|
|
4
|
+
import { existsSync } from 'node:fs'
|
|
4
5
|
|
|
5
6
|
const CHANNEL = '/dsh-simple-worktree'
|
|
6
7
|
const SETTINGS_NS = settingsNamespace('dsh-simple-worktree')
|
|
@@ -24,6 +25,16 @@ export const cleanPath = (value) => {
|
|
|
24
25
|
|
|
25
26
|
export const samePath = (left, right) => cleanPath(left) === cleanPath(right)
|
|
26
27
|
|
|
28
|
+
async function removeOrphanedWorktree(path) {
|
|
29
|
+
if (!existsSync(path)) return false
|
|
30
|
+
let marker
|
|
31
|
+
try { marker = await readFile(`${path}/.git`, 'utf8') } catch { return false }
|
|
32
|
+
const gitdir = marker.match(/^gitdir:\s*(.+)\s*$/m)?.[1]
|
|
33
|
+
if (!gitdir || existsSync(gitdir)) return false
|
|
34
|
+
await rm(path, { recursive: true, force: false })
|
|
35
|
+
return true
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
export async function runGit(subprocess, cwd, args) {
|
|
28
39
|
const handle = subprocess.spawn({
|
|
29
40
|
argv: ['git', '-C', cwd, ...args],
|
|
@@ -226,7 +237,16 @@ export function apply(ctx) {
|
|
|
226
237
|
const repoPath = typeof payload.repoPath === 'string' ? payload.repoPath.trim() : ''
|
|
227
238
|
const path = typeof payload.path === 'string' ? payload.path.trim() : ''
|
|
228
239
|
if (!repoPath || !path) throw new Error('缺少仓库路径或 Worktree 路径。')
|
|
229
|
-
|
|
240
|
+
try {
|
|
241
|
+
await runGit(ctx.subprocess, repoPath, ['worktree', 'remove', path])
|
|
242
|
+
} catch (error) {
|
|
243
|
+
if (await removeOrphanedWorktree(path)) return { removed: true, path, orphaned: true }
|
|
244
|
+
if (!existsSync(path) && existsSync(repoPath)) {
|
|
245
|
+
await runGit(ctx.subprocess, repoPath, ['worktree', 'prune'])
|
|
246
|
+
return { removed: true, path, pruned: true }
|
|
247
|
+
}
|
|
248
|
+
throw error
|
|
249
|
+
}
|
|
230
250
|
return { removed: true, path }
|
|
231
251
|
})
|
|
232
252
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alpacachen/dsh-simple-worktree",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "A Git worktree plugin for DeepSeek Harness that creates task branches, registers worktrees as DSH Workspaces, and opens isolated sessions.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|