tarsk 0.5.67 → 0.5.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/index.js +3 -2
  2. package/dist/public/assets/{account-view-BlK6g38q.js → account-view-Chzj6v7a.js} +1 -1
  3. package/dist/public/assets/{alert-dialog-B6An1LDY.js → alert-dialog-CLYxQdrK.js} +1 -1
  4. package/dist/public/assets/{async-error-boundary-Rf-s2_Ez.js → async-error-boundary-CM6LU7nT.js} +1 -1
  5. package/dist/public/assets/{browser-tab-BJxPUVJi.js → browser-tab--1iEoJGu.js} +1 -1
  6. package/dist/public/assets/{chat-dock-context-DyKjqpND.js → chat-dock-context-Gg1jpamu.js} +1 -1
  7. package/dist/public/assets/{commit-dialog-CYb1kJCq.js → commit-dialog-BfdxNX_T.js} +1 -1
  8. package/dist/public/assets/{commit-error-dialog-DvxaNRcH.js → commit-error-dialog-DrsDKL-B.js} +1 -1
  9. package/dist/public/assets/{commit-method-fields-Dijc502F.js → commit-method-fields-o-xw2faT.js} +1 -1
  10. package/dist/public/assets/{context-menu-C51M1WGZ.js → context-menu-BLvLpqq7.js} +1 -1
  11. package/dist/public/assets/{conversation-history-view-w_6Jd3d-.js → conversation-history-view-ukfe_7qw.js} +1 -1
  12. package/dist/public/assets/{create-project-dialog-CSVkngnF.js → create-project-dialog-DrXo61FQ.js} +1 -1
  13. package/dist/public/assets/{create-repo-dialog-CcFA8pXz.js → create-repo-dialog-CkFACtMf.js} +1 -1
  14. package/dist/public/assets/{delete-confirm-dialog-uTSX_x-i.js → delete-confirm-dialog-D1zjctrX.js} +1 -1
  15. package/dist/public/assets/{diff-view-XN5G5F6E.js → diff-view-Cxf7v9t1.js} +1 -1
  16. package/dist/public/assets/{explorer-tab-view-A2ICDFPB.js → explorer-tab-view-LkT0bDcR.js} +2 -2
  17. package/dist/public/assets/{explorer-tree-B04Ba59E.js → explorer-tree-B6EZUVTn.js} +1 -1
  18. package/dist/public/assets/{explorer-view-CofaKFiu.js → explorer-view-D5y8Uxoi.js} +1 -1
  19. package/dist/public/assets/{git-history-dialog-V3kaff2G.js → git-history-dialog-X6sVwgPT.js} +1 -1
  20. package/dist/public/assets/{index-B0xy4BkI.js → index-CJCQ4bTo.js} +32 -33
  21. package/dist/public/assets/{mcp-server-card-DOsP-SQ8.js → mcp-server-card-DPakHrG9.js} +1 -1
  22. package/dist/public/assets/{merged-pr-dialog-BerRzLlh.js → merged-pr-dialog-C3euJvCu.js} +1 -1
  23. package/dist/public/assets/{model-list-controls-Dw98tMn7.js → model-list-controls-2JtkzWsp.js} +1 -1
  24. package/dist/public/assets/{monaco-setup-C87kBr4u.js → monaco-setup-b-rhUj5t.js} +1 -1
  25. package/dist/public/assets/{onboarding-DVc9-yKJ.js → onboarding-KBcwP-kU.js} +1 -1
  26. package/dist/public/assets/{project-env-vars-view-BQwUd7y6.js → project-env-vars-view-D60J_-qQ.js} +1 -1
  27. package/dist/public/assets/{project-model-aliases-view-CobSp09z.js → project-model-aliases-view-EClnOgBH.js} +1 -1
  28. package/dist/public/assets/{project-settings-view-CPTd5lEi.js → project-settings-view-Cb0iiyad.js} +1 -1
  29. package/dist/public/assets/{project-tools-view-DShQghoz.js → project-tools-view-B_WnVICB.js} +1 -1
  30. package/dist/public/assets/{providers-list-view-Da9VMcuP.js → providers-list-view-CYy82_hl.js} +1 -1
  31. package/dist/public/assets/{pull-request-dialog-BAarT9EM.js → pull-request-dialog-CitbRcub.js} +1 -1
  32. package/dist/public/assets/{pull-with-changes-dialog-BcF25mjQ.js → pull-with-changes-dialog-CpgHqvKf.js} +1 -1
  33. package/dist/public/assets/{push-before-pr-dialog-BF0NzV2u.js → push-before-pr-dialog-CrcNZDLb.js} +1 -1
  34. package/dist/public/assets/{react-vendor-B7jFrulV.js → react-vendor-7n7LyU5o.js} +1 -1
  35. package/dist/public/assets/{settings-general-view-DT4nElcL.js → settings-general-view-72s5xgPj.js} +1 -1
  36. package/dist/public/assets/{settings-instructions-view-Bsr8wRMf.js → settings-instructions-view-DN4-73KP.js} +1 -1
  37. package/dist/public/assets/{settings-list-B9wyVzKw.js → settings-list-CWdsaJKC.js} +1 -1
  38. package/dist/public/assets/{settings-logs-view-CyaGqUKH.js → settings-logs-view-CkkVgGvv.js} +1 -1
  39. package/dist/public/assets/{settings-mcp-servers-view-BTUWHB5K.js → settings-mcp-servers-view-B8_vnfl6.js} +1 -1
  40. package/dist/public/assets/{settings-models-view-DFwkVdt3.js → settings-models-view-xIRY7PvW.js} +1 -1
  41. package/dist/public/assets/{settings-rules-view-BhA9tjVh.js → settings-rules-view-DIk0ghSW.js} +1 -1
  42. package/dist/public/assets/{settings-skills-view-BFoO9oZk.js → settings-skills-view-qWbr0Vl2.js} +1 -1
  43. package/dist/public/assets/{settings-slack-view-D4mrQ9C9.js → settings-slack-view-RFLP0USW.js} +1 -1
  44. package/dist/public/assets/{settings-slash-commands-view-BLKPDUVG.js → settings-slash-commands-view-zFWoR_R7.js} +1 -1
  45. package/dist/public/assets/{settings-statistics-view-fa6iBiP8.js → settings-statistics-view-BgrzVn4R.js} +1 -1
  46. package/dist/public/assets/{settings-storage-view-LaiAi5gv.js → settings-storage-view-BS2k7E74.js} +1 -1
  47. package/dist/public/assets/{settings-subagents-view-BjMz2Ri_.js → settings-subagents-view-BZr1NkVp.js} +1 -1
  48. package/dist/public/assets/{settings-system-prompt-view-DNh1yqZh.js → settings-system-prompt-view-mQErde93.js} +1 -1
  49. package/dist/public/assets/{settings-view-BoC66Wji.js → settings-view-D4-XZz2V.js} +2 -2
  50. package/dist/public/assets/{tasks-view-B049aXpC.js → tasks-view-DgkXglqW.js} +2 -2
  51. package/dist/public/assets/{terminal-panel-Pv5xqCpm.js → terminal-panel-DCaBWV04.js} +1 -1
  52. package/dist/public/assets/{ui-components-DJLsrr5e.js → ui-components-1WsgZqWa.js} +1 -1
  53. package/dist/public/assets/{use-active-dock-panel-instance-BlRDPUlZ.js → use-active-dock-panel-instance-B9ao_JH2.js} +1 -1
  54. package/dist/public/assets/{use-installed-ai-files-DmLnugpj.js → use-installed-ai-files-GpG9ZL8U.js} +1 -1
  55. package/dist/public/assets/{web-BidDZaMC.js → web-BuYdGVW8.js} +1 -1
  56. package/dist/public/assets/{web-DHUv7oQP.js → web-CEfF0992.js} +1 -1
  57. package/dist/public/assets/{web-JMCxQg4N.js → web-D7CwlITA.js} +1 -1
  58. package/dist/public/assets/{web-C_HuLxHj.js → web-yeAPC2wm.js} +1 -1
  59. package/dist/public/index.html +5 -5
  60. package/package.json +1 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{B as t,Di as n,Oi as r,Rr as i,Rt as a,Vt as o,i as s,ki as c,xn as l,yn as u,zt as d}from"./interactive-BrHVRHmQ.js";import{f,x as p,xt as m,yt as h}from"./onboarding-DVc9-yKJ.js";import{t as g}from"./use-toast-hxHsVv6a.js";import{a as _,c as v,i as y,n as b,r as x,t as S}from"./alert-dialog-B6An1LDY.js";import{n as C}from"./explorer-tab-context-BdjTEbFh.js";import{n as w,t as T}from"./use-suspense-resource-CExc4Svq.js";import{$ as E,At as D,Ft as O,Q as k,at as A,ct as j,et as M,jt as ee,kt as N,nt as P,ot as F,pt as I,tt as L}from"./index-B0xy4BkI.js";import{a as R,i as z,n as B,r as V,t as te}from"./context-menu-C51M1WGZ.js";import{t as ne}from"./async-error-boundary-Rf-s2_Ez.js";import{t as H}from"./ui-components-DJLsrr5e.js";var U=r(),W=e(c(),1),G=n(),re=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(H,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});re.displayName=H.displayName;var K=W.forwardRef((e,n)=>{let r=(0,U.c)(10),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,G.jsx)(t,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),r[3]=o):o=r[3];let c;r[4]===i?c=r[5]:(c=s(`flex h-11 w-full rounded-md bg-transparent py-3 text-base outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),r[4]=i,r[5]=c);let l;return r[6]!==a||r[7]!==n||r[8]!==c?(l=(0,G.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[o,(0,G.jsx)(H.Input,{ref:n,className:c,...a})]}),r[6]=a,r[7]=n,r[8]=c,r[9]=l):l=r[9],l});K.displayName=H.Input.displayName;var q=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(H.List,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});q.displayName=H.List.displayName;var J=W.forwardRef((e,t)=>{let n=(0,U.c)(4),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=s(i.bodyMuted,`py-6 text-center`),n[0]=r):r=n[0];let a;return n[1]!==e||n[2]!==t?(a=(0,G.jsx)(H.Empty,{ref:t,className:r,...e}),n[1]=e,n[2]=t,n[3]=a):a=n[3],a});J.displayName=H.Empty.displayName;var Y=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(H.Group,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Y.displayName=H.Group.displayName;var ie=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`-mx-1 h-px bg-divider`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(H.Separator,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ie.displayName=H.Separator.displayName;var ae=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=s(s(i.body,`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`),r),n[3]=r,n[4]=o);let c;return n[5]!==a||n[6]!==t||n[7]!==o?(c=(0,G.jsx)(H.Item,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=c):c=n[8],c});ae.displayName=H.Item.displayName;var oe=e=>{let t=(0,U.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let a;t[3]===n?a=t[4]:(a=s(i.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==r||t[6]!==a?(o=(0,G.jsx)(`span`,{className:a,...r}),t[5]=r,t[6]=a,t[7]=o):o=t[7],o};oe.displayName=`CommandShortcut`;var X=100,se=500;function Z(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function ce(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function le(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(ce(n,t)&&(r.push(n.node),r.length>=se))break;return r.sort((e,t)=>ue(e,t,n)).slice(0,X)}function ue(e,t,n){let r=n.trim().toLowerCase(),i=e.name.toLowerCase(),a=t.name.toLowerCase(),o=r?i.startsWith(r):!1;return o===(r?a.startsWith(r):!1)?e.type===t.type?e.path.localeCompare(t.path):e.type===`folder`?-1:1:o?-1:1}function de(e){let t=(0,U.c)(38),{items:n,isReady:r,onRequestIndex:o,onOpenChange:c,onSelect:l}=e,u=r===void 0?!1:r,d=(0,W.useRef)(null),f=(0,W.useRef)(!1),m=(0,W.useRef)(!1),[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(``),y=(0,W.useDeferredValue)(_),b;t[0]===o?b=t[1]:(b=function(){m.current||(m.current=!0,o())},t[0]=o,t[1]=b);let x=b,S;t[2]!==y||t[3]!==n?(S=le(n,Z(y),y),t[2]=y,t[3]=n,t[4]=S):S=t[4];let C=S,w,T;t[5]!==c||t[6]!==_?(w=()=>{let e=_.trim().length>0;g(e),f.current!==e&&(f.current=e,c(e))},T=[c,_],t[5]=c,t[6]=_,t[7]=w,t[8]=T):(w=t[7],T=t[8]),(0,W.useEffect)(w,T);let E;t[9]===c?E=t[10]:(E=function(e){e||v(``),g(e),c(e),e&&requestAnimationFrame(()=>d.current?.focus())},t[9]=c,t[10]=E);let O=E,k;t[11]!==c||t[12]!==l?(k=function(e){l(e),g(!1),c(!1),v(``)},t[11]=c,t[12]=l,t[13]=k):k=t[13];let A=k,j;t[14]===x?j=t[15]:(j=e=>{x(),v(e.target.value)},t[14]=x,t[15]=j);let M;t[16]!==_||t[17]!==x||t[18]!==j?(M=(0,G.jsx)(ee,{asChild:!0,children:(0,G.jsx)(`div`,{className:`bg-transparent`,children:(0,G.jsx)(p,{ref:d,value:_,onPointerDown:x,onChange:j,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),t[16]=_,t[17]=x,t[18]=j,t[19]=M):M=t[19];let P;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(P=s(i.compact,`py-4`),t[20]=P):P=t[20];let F=u?`No matches found.`:`Indexing files and folders...`,L;t[21]===F?L=t[22]:(L=(0,G.jsx)(J,{className:P,children:F}),t[21]=F,t[22]=L);let R;if(t[23]!==A||t[24]!==C){let e;t[26]===A?e=t[27]:(e=e=>(0,G.jsxs)(ae,{value:e.path,onSelect:()=>A(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,G.jsx)(a,{className:`h-4 w-4 text-muted-foreground`}):(0,G.jsx)(I,{filename:e.name}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate`,children:e.name}),(0,G.jsx)(`div`,{className:s(i.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),t[26]=A,t[27]=e),R=C.map(e),t[23]=A,t[24]=C,t[25]=R}else R=t[25];let z;t[28]===R?z=t[29]:(z=(0,G.jsx)(Y,{children:R}),t[28]=R,t[29]=z);let B;t[30]!==L||t[31]!==z?(B=(0,G.jsx)(D,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:Q,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,G.jsx)(re,{shouldFilter:!1,children:(0,G.jsxs)(q,{children:[L,z]})})}),t[30]=L,t[31]=z,t[32]=B):B=t[32];let V;return t[33]!==O||t[34]!==h||t[35]!==B||t[36]!==M?(V=(0,G.jsxs)(N,{open:h,onOpenChange:O,children:[M,B]}),t[33]=O,t[34]=h,t[35]=B,t[36]=M,t[37]=V):V=t[37],V}function Q(e){return e.preventDefault()}function fe(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function pe(e){let t=(0,U.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=fe(n,r,i),t[0]=r,t[1]=n,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==n?(s=()=>A(n,r).then(me),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=T(o,s),l;t[7]!==a||t[8]!==c?(l=a(c),t[7]=a,t[8]=c,t[9]=l):l=t[9];let u;return t[10]===l?u=t[11]:(u=(0,G.jsx)(G.Fragment,{children:l}),t[10]=l,t[11]=u),u}function me(e){return e.entries}function he(e){let t=(0,U.c)(17),{defaultValue:n,onCommit:r,onCancel:a,level:o,basePadding:s,icon:c}=e,l=(0,W.useRef)(null),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{l.current?.focus(),l.current?.select()},d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),(0,W.useEffect)(u,d);let p;t[2]!==a||t[3]!==r?(p=function(e){if(e.key===`Enter`){let e=l.current?.value.trim()??``;e?r(e):a()}else e.key===`Escape`&&a()},t[2]=a,t[3]=r,t[4]=p):p=t[4];let m=p,h;t[5]!==a||t[6]!==r?(h=function(){let e=l.current?.value.trim()??``;e?r(e):a()},t[5]=a,t[6]=r,t[7]=h):h=t[7];let g=h,_;t[8]!==n||t[9]!==g||t[10]!==m?(_=(0,G.jsx)(`input`,{ref:l,defaultValue:n,onKeyDown:m,onBlur:g,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:$}),t[8]=n,t[9]=g,t[10]=m,t[11]=_):_=t[11];let v;return t[12]!==s||t[13]!==c||t[14]!==o||t[15]!==_?(v=(0,G.jsxs)(f,{level:o,basePadding:s,className:i.conversationBody,children:[c,_]}),t[12]=s,t[13]=c,t[14]=o,t[15]=_,t[16]=v):v=t[16],v}function $(e){return e.stopPropagation()}function ge(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}function _e(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}var ve=(0,W.memo)(function e({node:t,level:n,threadId:r,selectedPath:c,expandedPaths:p,getDirVersion:m,renamingPath:_,newItemIn:v,onToggleFolder:y,onSelectNode:b,onStartRename:x,onCommitRename:S,onCancelRename:C,onDelete:w,onOpen:T,onCopyReference:D,onNewFile:O,onNewFolder:A,onCommitNewItem:j,onCancelNewItem:M,dropTargetPath:ee,onFolderDropTargetChange:N,onFilesDrop:P}){let F=p.has(t.path),L=_===t.path,ne=v?.dirPath===t.path&&F,H=ee===t.path;return t.type===`folder`?(0,G.jsxs)(te,{children:[(0,G.jsx)(R,{asChild:!0,children:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(f,{level:n,basePadding:10,selected:c===t.path,className:s(i.conversationBody,t.ignored&&`opacity-50`,H&&`bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-primary`),onClick:e=>{e.stopPropagation(),y(t)},onDragOver:e=>{E(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,H||N(t.path))},onDragLeave:e=>{E(e.dataTransfer)&&(e.currentTarget.contains(e.relatedTarget)||H&&N(null))},onDrop:e=>{if(!E(e.dataTransfer))return;e.preventDefault(),e.stopPropagation(),N(null);let{files:n,skippedFolders:r}=k(e.dataTransfer);r>0&&g({title:`Folders skipped`,description:`Only files can be copied. Drop individual files instead of folders.`}),n.length>0&&P(n,t.path)},children:[(0,G.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:F?(0,G.jsx)(l,{className:`h-3 w-3`}):(0,G.jsx)(u,{className:`h-3 w-3`})}),L?(0,G.jsxs)(G.Fragment,{children:[F?(0,G.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}):(0,G.jsx)(a,{className:`h-4 w-4 flex-shrink-0`}),(0,G.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?S(t,n):C()}else e.key===`Escape`&&C()},onBlur:e=>{let n=e.target.value.trim();n?S(t,n):C()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,G.jsxs)(G.Fragment,{children:[F?(0,G.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}):(0,G.jsx)(a,{className:`h-4 w-4 flex-shrink-0`}),(0,G.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})]}),F&&(0,G.jsx)(`div`,{children:(0,G.jsx)(W.Suspense,{fallback:(0,G.jsx)(h,{}),children:(0,G.jsx)(pe,{threadId:r,dirPath:t.path,version:m(t.path),children:t=>(0,G.jsxs)(G.Fragment,{children:[ne&&(0,G.jsx)(he,{defaultValue:``,level:n+1,basePadding:v.type===`folder`?10:22,icon:v.type===`folder`?(0,G.jsx)(a,{className:`h-4 w-4 flex-shrink-0`}):(0,G.jsx)(o,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:j,onCancel:M}),t.map(t=>(0,G.jsx)(e,{node:t,level:n+1,threadId:r,selectedPath:c,expandedPaths:p,getDirVersion:m,renamingPath:_,newItemIn:v,onToggleFolder:y,onSelectNode:b,onStartRename:x,onCommitRename:S,onCancelRename:C,onDelete:w,onOpen:T,onCopyReference:D,onNewFile:O,onNewFolder:A,onCommitNewItem:j,onCancelNewItem:M,dropTargetPath:ee,onFolderDropTargetChange:N,onFilesDrop:P},t.path))]})})})})]})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(V,{onSelect:()=>T(t),children:`Open`}),(0,G.jsx)(z,{}),(0,G.jsx)(V,{onSelect:()=>O(t.path),children:`New File...`}),(0,G.jsx)(V,{onSelect:()=>A(t.path),children:`New Folder...`}),(0,G.jsx)(z,{}),(0,G.jsx)(V,{onSelect:()=>D(t),children:`Copy Reference`}),(0,G.jsx)(V,{onSelect:()=>x(t),children:`Rename...`}),(0,G.jsx)(V,{onSelect:()=>w(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,G.jsxs)(te,{children:[(0,G.jsx)(R,{asChild:!0,children:(0,G.jsxs)(f,{level:n,basePadding:22,selected:c===t.path,className:s(i.conversationBody,t.ignored&&`opacity-50`),onClick:()=>b(t),children:[(0,G.jsx)(I,{filename:t.name}),L?(0,G.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?S(t,n):C()}else e.key===`Escape`&&C()},onBlur:e=>{let n=e.target.value.trim();n?S(t,n):C()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,G.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(V,{onSelect:()=>T(t),children:`Open`}),(0,G.jsx)(z,{}),(0,G.jsx)(V,{onSelect:()=>O(_e(t.path)),children:`New File...`}),(0,G.jsx)(V,{onSelect:()=>A(_e(t.path)),children:`New Folder...`}),(0,G.jsx)(z,{}),(0,G.jsx)(V,{onSelect:()=>D(t),children:`Copy Reference`}),(0,G.jsx)(V,{onSelect:()=>x(t),children:`Rename...`}),(0,G.jsx)(V,{onSelect:()=>w(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),ye=new Map;function be({threadId:e,selectedPath:t,onNodeSelect:n,onFilesDrop:r}){let[i,s]=(0,W.useState)(()=>new Map([[``,0]])),[c,l]=(0,W.useState)(new Set),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(null),[h,T]=(0,W.useState)(null),[E,D]=(0,W.useState)(null),[k,ee]=(0,W.useState)(!1),[N,I]=(0,W.useState)([]),[z,H]=(0,W.useState)(!1),[U,re]=(0,W.useState)(!1),K=(0,W.useRef)(null),q=(0,W.useRef)(0),J=(0,W.useRef)(null),{explorerRefreshTick:Y,pendingExplorerPath:ie,setExplorerClearPath:ae}=C(),{fetchUnifiedStatus:oe}=O(),X=(0,W.useMemo)(()=>`${e}:${Y}`,[Y,e]),se=(0,W.useCallback)(e=>{(0,W.startTransition)(()=>{ee(t=>t===e?t:e)})},[]),Z=(0,W.useCallback)(async()=>{if(!e)return;let t=ye.get(X);if(t){I(t),H(!0);return}if(K.current!==X){K.current=X,I([]),H(!1);try{let t=ge((await A(e,``,!0)).entries);ye.set(X,t),I(t),H(!0)}catch{I([]),H(!1)}finally{K.current===X&&(K.current=null)}}},[X,e]),ce=(0,W.useCallback)(()=>{re(!0)},[]),le=(0,W.useCallback)(()=>{ye.delete(X),I([]),H(!1)},[X]),ue=(0,W.useCallback)(()=>{le(),U&&Z()},[le,Z,U]),Q=(0,W.useCallback)(e=>i.get(e)??0,[i]),me=(0,W.useCallback)(e=>{s(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,W.useCallback)(t=>{e&&(w(fe(e,t,Q(t))),me(t))},[me,Q,e]),be=(0,W.useCallback)(t=>{if(!e)return;let n=t.path.split(`/`);t.type===`file`&&n.pop();let r=[],i=``;for(let e of n)i=i?`${i}/${e}`:e,r.push(i);l(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,W.useEffect)(()=>{if(!e)return;let t=J.current!==null&&J.current!==e;J.current=e,t&&(s(new Map([[``,0]])),l(new Set),d(null),p(null),q.current=Y)},[Y,e]),(0,W.useEffect)(()=>{!e||Y<=q.current||(q.current=Y,s(t=>{let n=new Set([``]);for(let e of c)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;w(fe(e,i,n)),r.set(i,n+1)}return r}))},[Y,c,e]),(0,W.useEffect)(()=>{I([]),H(!1),re(!1),K.current=null},[X]),(0,W.useEffect)(()=>{!U||!e||Z()},[Z,U,e]),(0,W.useEffect)(()=>{if(!ie||!e)return;let t=ie.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){l(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)s(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[ie,e]);function xe(e){c.has(e.path)?l(t=>{let n=new Set(t);return n.delete(e.path),n}):(l(t=>new Set(t).add(e.path)),s(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function Se(e){T(e)}async function Ce(t){try{await F(e,t.path)}catch{g({title:`Error`,description:`Failed to open "${t.name}"`,variant:`destructive`})}}async function we(e){try{await navigator.clipboard.writeText(e.path);let t=g({title:`Copied`,description:`Reference copied to clipboard.`});window.setTimeout(()=>{t.dismiss()},2e3)}catch{g({title:`Error`,description:`Failed to copy reference for "${e.name}"`,variant:`destructive`})}}async function Te(){if(!h)return;let t=h;T(null);try{await P(e,t.path),ae(t.path),$(_e(t.path)),ue(),oe(!0),l(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),s(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{g({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function Ee(e){p(null),d(e.path)}async function De(t,n){if(n===t.name){d(null);return}d(null);try{await j(e,t.path,n),$(_e(t.path)),ue(),oe(!0),t.type===`folder`&&(l(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),s(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{g({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function Oe(e){d(null),c.has(e)||(l(t=>new Set(t).add(e)),s(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),p({dirPath:e,type:`file`})}function ke(e){d(null),c.has(e)||(l(t=>new Set(t).add(e)),s(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),p({dirPath:e,type:`folder`})}async function Ae(t){if(!f)return;let{dirPath:n,type:r}=f;p(null);try{r===`file`?await M(e,n,t):await L(e,n,t),$(n),ue(),oe(!0)}catch{g({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function je(){p(null)}let Me=(0,W.useCallback)((e,t)=>{r?.(e,t)},[r]);function Ne(e){be(e),e.type===`file`&&n(e)}let Pe=f?.dirPath===``?(0,G.jsx)(he,{defaultValue:``,level:0,basePadding:f.type===`folder`?10:22,icon:f.type===`folder`?(0,G.jsx)(a,{className:`h-4 w-4 flex-shrink-0`}):(0,G.jsx)(o,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:Ae,onCancel:je}):null;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(S,{open:h!==null,onOpenChange:e=>!e&&T(null),children:(0,G.jsxs)(y,{children:[(0,G.jsx)(v,{children:`Move to Trash`}),(0,G.jsxs)(_,{children:[`Move “`,h?.name,`” to trash?`]}),(0,G.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,G.jsx)(x,{children:`Cancel`}),(0,G.jsx)(b,{onClick:()=>void Te(),children:`Move to Trash`})]})]})}),(0,G.jsx)(`div`,{className:`border-b border-border px-2 py-2`,children:(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsx)(de,{items:N,isReady:z,onRequestIndex:ce,onOpenChange:se,onSelect:e=>Ne(e)},X)})})}),(0,G.jsxs)(te,{children:[(0,G.jsx)(R,{asChild:!0,disabled:k,children:(0,G.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,G.jsx)(ne,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,G.jsx)(W.Suspense,{fallback:(0,G.jsx)(m,{}),children:(0,G.jsx)(pe,{threadId:e,dirPath:``,version:Q(``),children:r=>(0,G.jsxs)(G.Fragment,{children:[Pe,r.map(r=>(0,G.jsx)(ve,{node:r,level:0,threadId:e,selectedPath:t,expandedPaths:c,getDirVersion:Q,renamingPath:u,newItemIn:f,onToggleFolder:xe,onSelectNode:n,onStartRename:Ee,onCommitRename:De,onCancelRename:()=>d(null),onDelete:Se,onOpen:Ce,onCopyReference:we,onNewFile:Oe,onNewFolder:ke,onCommitNewItem:Ae,onCancelNewItem:je,dropTargetPath:E,onFolderDropTargetChange:D,onFilesDrop:Me},r.path))]})})})})})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(V,{onSelect:()=>Oe(``),children:`New File...`}),(0,G.jsx)(V,{onSelect:()=>ke(``),children:`New Folder...`})]})]})]})}export{be as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{B as t,Di as n,Oi as r,Rr as i,Rt as a,Vt as o,i as s,ki as c,xn as l,yn as u,zt as d}from"./interactive-BrHVRHmQ.js";import{f,x as p,xt as m,yt as h}from"./onboarding-KBcwP-kU.js";import{t as g}from"./use-toast-hxHsVv6a.js";import{a as _,c as v,i as y,n as b,r as x,t as S}from"./alert-dialog-CLYxQdrK.js";import{n as C}from"./explorer-tab-context-BdjTEbFh.js";import{n as w,t as T}from"./use-suspense-resource-CExc4Svq.js";import{$ as E,At as D,Ft as O,Q as k,at as A,ct as j,et as M,jt as ee,kt as N,nt as P,ot as F,pt as I,tt as L}from"./index-CJCQ4bTo.js";import{a as R,i as z,n as B,r as V,t as te}from"./context-menu-BLvLpqq7.js";import{t as ne}from"./async-error-boundary-CM6LU7nT.js";import{t as H}from"./ui-components-1WsgZqWa.js";var U=r(),W=e(c(),1),G=n(),re=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(H,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});re.displayName=H.displayName;var K=W.forwardRef((e,n)=>{let r=(0,U.c)(10),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,G.jsx)(t,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),r[3]=o):o=r[3];let c;r[4]===i?c=r[5]:(c=s(`flex h-11 w-full rounded-md bg-transparent py-3 text-base outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),r[4]=i,r[5]=c);let l;return r[6]!==a||r[7]!==n||r[8]!==c?(l=(0,G.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[o,(0,G.jsx)(H.Input,{ref:n,className:c,...a})]}),r[6]=a,r[7]=n,r[8]=c,r[9]=l):l=r[9],l});K.displayName=H.Input.displayName;var q=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(H.List,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});q.displayName=H.List.displayName;var J=W.forwardRef((e,t)=>{let n=(0,U.c)(4),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=s(i.bodyMuted,`py-6 text-center`),n[0]=r):r=n[0];let a;return n[1]!==e||n[2]!==t?(a=(0,G.jsx)(H.Empty,{ref:t,className:r,...e}),n[1]=e,n[2]=t,n[3]=a):a=n[3],a});J.displayName=H.Empty.displayName;var Y=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(H.Group,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Y.displayName=H.Group.displayName;var ie=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`-mx-1 h-px bg-divider`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(H.Separator,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ie.displayName=H.Separator.displayName;var ae=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=s(s(i.body,`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`),r),n[3]=r,n[4]=o);let c;return n[5]!==a||n[6]!==t||n[7]!==o?(c=(0,G.jsx)(H.Item,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=c):c=n[8],c});ae.displayName=H.Item.displayName;var oe=e=>{let t=(0,U.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let a;t[3]===n?a=t[4]:(a=s(i.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==r||t[6]!==a?(o=(0,G.jsx)(`span`,{className:a,...r}),t[5]=r,t[6]=a,t[7]=o):o=t[7],o};oe.displayName=`CommandShortcut`;var X=100,se=500;function Z(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function ce(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function le(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(ce(n,t)&&(r.push(n.node),r.length>=se))break;return r.sort((e,t)=>ue(e,t,n)).slice(0,X)}function ue(e,t,n){let r=n.trim().toLowerCase(),i=e.name.toLowerCase(),a=t.name.toLowerCase(),o=r?i.startsWith(r):!1;return o===(r?a.startsWith(r):!1)?e.type===t.type?e.path.localeCompare(t.path):e.type===`folder`?-1:1:o?-1:1}function de(e){let t=(0,U.c)(38),{items:n,isReady:r,onRequestIndex:o,onOpenChange:c,onSelect:l}=e,u=r===void 0?!1:r,d=(0,W.useRef)(null),f=(0,W.useRef)(!1),m=(0,W.useRef)(!1),[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(``),y=(0,W.useDeferredValue)(_),b;t[0]===o?b=t[1]:(b=function(){m.current||(m.current=!0,o())},t[0]=o,t[1]=b);let x=b,S;t[2]!==y||t[3]!==n?(S=le(n,Z(y),y),t[2]=y,t[3]=n,t[4]=S):S=t[4];let C=S,w,T;t[5]!==c||t[6]!==_?(w=()=>{let e=_.trim().length>0;g(e),f.current!==e&&(f.current=e,c(e))},T=[c,_],t[5]=c,t[6]=_,t[7]=w,t[8]=T):(w=t[7],T=t[8]),(0,W.useEffect)(w,T);let E;t[9]===c?E=t[10]:(E=function(e){e||v(``),g(e),c(e),e&&requestAnimationFrame(()=>d.current?.focus())},t[9]=c,t[10]=E);let O=E,k;t[11]!==c||t[12]!==l?(k=function(e){l(e),g(!1),c(!1),v(``)},t[11]=c,t[12]=l,t[13]=k):k=t[13];let A=k,j;t[14]===x?j=t[15]:(j=e=>{x(),v(e.target.value)},t[14]=x,t[15]=j);let M;t[16]!==_||t[17]!==x||t[18]!==j?(M=(0,G.jsx)(ee,{asChild:!0,children:(0,G.jsx)(`div`,{className:`bg-transparent`,children:(0,G.jsx)(p,{ref:d,value:_,onPointerDown:x,onChange:j,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),t[16]=_,t[17]=x,t[18]=j,t[19]=M):M=t[19];let P;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(P=s(i.compact,`py-4`),t[20]=P):P=t[20];let F=u?`No matches found.`:`Indexing files and folders...`,L;t[21]===F?L=t[22]:(L=(0,G.jsx)(J,{className:P,children:F}),t[21]=F,t[22]=L);let R;if(t[23]!==A||t[24]!==C){let e;t[26]===A?e=t[27]:(e=e=>(0,G.jsxs)(ae,{value:e.path,onSelect:()=>A(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,G.jsx)(a,{className:`h-4 w-4 text-muted-foreground`}):(0,G.jsx)(I,{filename:e.name}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate`,children:e.name}),(0,G.jsx)(`div`,{className:s(i.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),t[26]=A,t[27]=e),R=C.map(e),t[23]=A,t[24]=C,t[25]=R}else R=t[25];let z;t[28]===R?z=t[29]:(z=(0,G.jsx)(Y,{children:R}),t[28]=R,t[29]=z);let B;t[30]!==L||t[31]!==z?(B=(0,G.jsx)(D,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:Q,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,G.jsx)(re,{shouldFilter:!1,children:(0,G.jsxs)(q,{children:[L,z]})})}),t[30]=L,t[31]=z,t[32]=B):B=t[32];let V;return t[33]!==O||t[34]!==h||t[35]!==B||t[36]!==M?(V=(0,G.jsxs)(N,{open:h,onOpenChange:O,children:[M,B]}),t[33]=O,t[34]=h,t[35]=B,t[36]=M,t[37]=V):V=t[37],V}function Q(e){return e.preventDefault()}function fe(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function pe(e){let t=(0,U.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=fe(n,r,i),t[0]=r,t[1]=n,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==n?(s=()=>A(n,r).then(me),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=T(o,s),l;t[7]!==a||t[8]!==c?(l=a(c),t[7]=a,t[8]=c,t[9]=l):l=t[9];let u;return t[10]===l?u=t[11]:(u=(0,G.jsx)(G.Fragment,{children:l}),t[10]=l,t[11]=u),u}function me(e){return e.entries}function he(e){let t=(0,U.c)(17),{defaultValue:n,onCommit:r,onCancel:a,level:o,basePadding:s,icon:c}=e,l=(0,W.useRef)(null),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{l.current?.focus(),l.current?.select()},d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),(0,W.useEffect)(u,d);let p;t[2]!==a||t[3]!==r?(p=function(e){if(e.key===`Enter`){let e=l.current?.value.trim()??``;e?r(e):a()}else e.key===`Escape`&&a()},t[2]=a,t[3]=r,t[4]=p):p=t[4];let m=p,h;t[5]!==a||t[6]!==r?(h=function(){let e=l.current?.value.trim()??``;e?r(e):a()},t[5]=a,t[6]=r,t[7]=h):h=t[7];let g=h,_;t[8]!==n||t[9]!==g||t[10]!==m?(_=(0,G.jsx)(`input`,{ref:l,defaultValue:n,onKeyDown:m,onBlur:g,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:$}),t[8]=n,t[9]=g,t[10]=m,t[11]=_):_=t[11];let v;return t[12]!==s||t[13]!==c||t[14]!==o||t[15]!==_?(v=(0,G.jsxs)(f,{level:o,basePadding:s,className:i.conversationBody,children:[c,_]}),t[12]=s,t[13]=c,t[14]=o,t[15]=_,t[16]=v):v=t[16],v}function $(e){return e.stopPropagation()}function ge(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}function _e(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}var ve=(0,W.memo)(function e({node:t,level:n,threadId:r,selectedPath:c,expandedPaths:p,getDirVersion:m,renamingPath:_,newItemIn:v,onToggleFolder:y,onSelectNode:b,onStartRename:x,onCommitRename:S,onCancelRename:C,onDelete:w,onOpen:T,onCopyReference:D,onNewFile:O,onNewFolder:A,onCommitNewItem:j,onCancelNewItem:M,dropTargetPath:ee,onFolderDropTargetChange:N,onFilesDrop:P}){let F=p.has(t.path),L=_===t.path,ne=v?.dirPath===t.path&&F,H=ee===t.path;return t.type===`folder`?(0,G.jsxs)(te,{children:[(0,G.jsx)(R,{asChild:!0,children:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(f,{level:n,basePadding:10,selected:c===t.path,className:s(i.conversationBody,t.ignored&&`opacity-50`,H&&`bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-primary`),onClick:e=>{e.stopPropagation(),y(t)},onDragOver:e=>{E(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,H||N(t.path))},onDragLeave:e=>{E(e.dataTransfer)&&(e.currentTarget.contains(e.relatedTarget)||H&&N(null))},onDrop:e=>{if(!E(e.dataTransfer))return;e.preventDefault(),e.stopPropagation(),N(null);let{files:n,skippedFolders:r}=k(e.dataTransfer);r>0&&g({title:`Folders skipped`,description:`Only files can be copied. Drop individual files instead of folders.`}),n.length>0&&P(n,t.path)},children:[(0,G.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:F?(0,G.jsx)(l,{className:`h-3 w-3`}):(0,G.jsx)(u,{className:`h-3 w-3`})}),L?(0,G.jsxs)(G.Fragment,{children:[F?(0,G.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}):(0,G.jsx)(a,{className:`h-4 w-4 flex-shrink-0`}),(0,G.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?S(t,n):C()}else e.key===`Escape`&&C()},onBlur:e=>{let n=e.target.value.trim();n?S(t,n):C()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,G.jsxs)(G.Fragment,{children:[F?(0,G.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}):(0,G.jsx)(a,{className:`h-4 w-4 flex-shrink-0`}),(0,G.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})]}),F&&(0,G.jsx)(`div`,{children:(0,G.jsx)(W.Suspense,{fallback:(0,G.jsx)(h,{}),children:(0,G.jsx)(pe,{threadId:r,dirPath:t.path,version:m(t.path),children:t=>(0,G.jsxs)(G.Fragment,{children:[ne&&(0,G.jsx)(he,{defaultValue:``,level:n+1,basePadding:v.type===`folder`?10:22,icon:v.type===`folder`?(0,G.jsx)(a,{className:`h-4 w-4 flex-shrink-0`}):(0,G.jsx)(o,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:j,onCancel:M}),t.map(t=>(0,G.jsx)(e,{node:t,level:n+1,threadId:r,selectedPath:c,expandedPaths:p,getDirVersion:m,renamingPath:_,newItemIn:v,onToggleFolder:y,onSelectNode:b,onStartRename:x,onCommitRename:S,onCancelRename:C,onDelete:w,onOpen:T,onCopyReference:D,onNewFile:O,onNewFolder:A,onCommitNewItem:j,onCancelNewItem:M,dropTargetPath:ee,onFolderDropTargetChange:N,onFilesDrop:P},t.path))]})})})})]})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(V,{onSelect:()=>T(t),children:`Open`}),(0,G.jsx)(z,{}),(0,G.jsx)(V,{onSelect:()=>O(t.path),children:`New File...`}),(0,G.jsx)(V,{onSelect:()=>A(t.path),children:`New Folder...`}),(0,G.jsx)(z,{}),(0,G.jsx)(V,{onSelect:()=>D(t),children:`Copy Reference`}),(0,G.jsx)(V,{onSelect:()=>x(t),children:`Rename...`}),(0,G.jsx)(V,{onSelect:()=>w(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,G.jsxs)(te,{children:[(0,G.jsx)(R,{asChild:!0,children:(0,G.jsxs)(f,{level:n,basePadding:22,selected:c===t.path,className:s(i.conversationBody,t.ignored&&`opacity-50`),onClick:()=>b(t),children:[(0,G.jsx)(I,{filename:t.name}),L?(0,G.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?S(t,n):C()}else e.key===`Escape`&&C()},onBlur:e=>{let n=e.target.value.trim();n?S(t,n):C()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,G.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(V,{onSelect:()=>T(t),children:`Open`}),(0,G.jsx)(z,{}),(0,G.jsx)(V,{onSelect:()=>O(_e(t.path)),children:`New File...`}),(0,G.jsx)(V,{onSelect:()=>A(_e(t.path)),children:`New Folder...`}),(0,G.jsx)(z,{}),(0,G.jsx)(V,{onSelect:()=>D(t),children:`Copy Reference`}),(0,G.jsx)(V,{onSelect:()=>x(t),children:`Rename...`}),(0,G.jsx)(V,{onSelect:()=>w(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),ye=new Map;function be({threadId:e,selectedPath:t,onNodeSelect:n,onFilesDrop:r}){let[i,s]=(0,W.useState)(()=>new Map([[``,0]])),[c,l]=(0,W.useState)(new Set),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(null),[h,T]=(0,W.useState)(null),[E,D]=(0,W.useState)(null),[k,ee]=(0,W.useState)(!1),[N,I]=(0,W.useState)([]),[z,H]=(0,W.useState)(!1),[U,re]=(0,W.useState)(!1),K=(0,W.useRef)(null),q=(0,W.useRef)(0),J=(0,W.useRef)(null),{explorerRefreshTick:Y,pendingExplorerPath:ie,setExplorerClearPath:ae}=C(),{fetchUnifiedStatus:oe}=O(),X=(0,W.useMemo)(()=>`${e}:${Y}`,[Y,e]),se=(0,W.useCallback)(e=>{(0,W.startTransition)(()=>{ee(t=>t===e?t:e)})},[]),Z=(0,W.useCallback)(async()=>{if(!e)return;let t=ye.get(X);if(t){I(t),H(!0);return}if(K.current!==X){K.current=X,I([]),H(!1);try{let t=ge((await A(e,``,!0)).entries);ye.set(X,t),I(t),H(!0)}catch{I([]),H(!1)}finally{K.current===X&&(K.current=null)}}},[X,e]),ce=(0,W.useCallback)(()=>{re(!0)},[]),le=(0,W.useCallback)(()=>{ye.delete(X),I([]),H(!1)},[X]),ue=(0,W.useCallback)(()=>{le(),U&&Z()},[le,Z,U]),Q=(0,W.useCallback)(e=>i.get(e)??0,[i]),me=(0,W.useCallback)(e=>{s(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,W.useCallback)(t=>{e&&(w(fe(e,t,Q(t))),me(t))},[me,Q,e]),be=(0,W.useCallback)(t=>{if(!e)return;let n=t.path.split(`/`);t.type===`file`&&n.pop();let r=[],i=``;for(let e of n)i=i?`${i}/${e}`:e,r.push(i);l(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,W.useEffect)(()=>{if(!e)return;let t=J.current!==null&&J.current!==e;J.current=e,t&&(s(new Map([[``,0]])),l(new Set),d(null),p(null),q.current=Y)},[Y,e]),(0,W.useEffect)(()=>{!e||Y<=q.current||(q.current=Y,s(t=>{let n=new Set([``]);for(let e of c)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;w(fe(e,i,n)),r.set(i,n+1)}return r}))},[Y,c,e]),(0,W.useEffect)(()=>{I([]),H(!1),re(!1),K.current=null},[X]),(0,W.useEffect)(()=>{!U||!e||Z()},[Z,U,e]),(0,W.useEffect)(()=>{if(!ie||!e)return;let t=ie.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){l(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)s(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[ie,e]);function xe(e){c.has(e.path)?l(t=>{let n=new Set(t);return n.delete(e.path),n}):(l(t=>new Set(t).add(e.path)),s(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function Se(e){T(e)}async function Ce(t){try{await F(e,t.path)}catch{g({title:`Error`,description:`Failed to open "${t.name}"`,variant:`destructive`})}}async function we(e){try{await navigator.clipboard.writeText(e.path);let t=g({title:`Copied`,description:`Reference copied to clipboard.`});window.setTimeout(()=>{t.dismiss()},2e3)}catch{g({title:`Error`,description:`Failed to copy reference for "${e.name}"`,variant:`destructive`})}}async function Te(){if(!h)return;let t=h;T(null);try{await P(e,t.path),ae(t.path),$(_e(t.path)),ue(),oe(!0),l(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),s(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{g({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function Ee(e){p(null),d(e.path)}async function De(t,n){if(n===t.name){d(null);return}d(null);try{await j(e,t.path,n),$(_e(t.path)),ue(),oe(!0),t.type===`folder`&&(l(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),s(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{g({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function Oe(e){d(null),c.has(e)||(l(t=>new Set(t).add(e)),s(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),p({dirPath:e,type:`file`})}function ke(e){d(null),c.has(e)||(l(t=>new Set(t).add(e)),s(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),p({dirPath:e,type:`folder`})}async function Ae(t){if(!f)return;let{dirPath:n,type:r}=f;p(null);try{r===`file`?await M(e,n,t):await L(e,n,t),$(n),ue(),oe(!0)}catch{g({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function je(){p(null)}let Me=(0,W.useCallback)((e,t)=>{r?.(e,t)},[r]);function Ne(e){be(e),e.type===`file`&&n(e)}let Pe=f?.dirPath===``?(0,G.jsx)(he,{defaultValue:``,level:0,basePadding:f.type===`folder`?10:22,icon:f.type===`folder`?(0,G.jsx)(a,{className:`h-4 w-4 flex-shrink-0`}):(0,G.jsx)(o,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:Ae,onCancel:je}):null;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(S,{open:h!==null,onOpenChange:e=>!e&&T(null),children:(0,G.jsxs)(y,{children:[(0,G.jsx)(v,{children:`Move to Trash`}),(0,G.jsxs)(_,{children:[`Move “`,h?.name,`” to trash?`]}),(0,G.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,G.jsx)(x,{children:`Cancel`}),(0,G.jsx)(b,{onClick:()=>void Te(),children:`Move to Trash`})]})]})}),(0,G.jsx)(`div`,{className:`border-b border-border px-2 py-2`,children:(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsx)(de,{items:N,isReady:z,onRequestIndex:ce,onOpenChange:se,onSelect:e=>Ne(e)},X)})})}),(0,G.jsxs)(te,{children:[(0,G.jsx)(R,{asChild:!0,disabled:k,children:(0,G.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,G.jsx)(ne,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,G.jsx)(W.Suspense,{fallback:(0,G.jsx)(m,{}),children:(0,G.jsx)(pe,{threadId:e,dirPath:``,version:Q(``),children:r=>(0,G.jsxs)(G.Fragment,{children:[Pe,r.map(r=>(0,G.jsx)(ve,{node:r,level:0,threadId:e,selectedPath:t,expandedPaths:c,getDirVersion:Q,renamingPath:u,newItemIn:f,onToggleFolder:xe,onSelectNode:n,onStartRename:Ee,onCommitRename:De,onCancelRename:()=>d(null),onDelete:Se,onOpen:Ce,onCopyReference:we,onNewFile:Oe,onNewFolder:ke,onCommitNewItem:Ae,onCancelNewItem:je,dropTargetPath:E,onFolderDropTargetChange:D,onFilesDrop:Me},r.path))]})})})})})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(V,{onSelect:()=>Oe(``),children:`New File...`}),(0,G.jsx)(V,{onSelect:()=>ke(``),children:`New Folder...`})]})]})]})}export{be as default};
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Di as t,J as n,Oi as r,Qt as i,Rr as a,Sn as o,Ut as s,Wt as c,X as l,_r as u,dn as ee,i as d,it as te,ki as f,tr as p,vr as m,yt as h}from"./interactive-BrHVRHmQ.js";import{d as ne}from"./react-vendor-B7jFrulV.js";import{Ca as re,Eo as g,Yn as ie,bt as _}from"./onboarding-DVc9-yKJ.js";import{r as ae}from"./store-B_cK-gsT.js";import{t as v}from"./use-toast-hxHsVv6a.js";import{n as oe}from"./explorer-tab-context-BdjTEbFh.js";import{n as y,t as b}from"./use-suspense-resource-CExc4Svq.js";import{n as se}from"./utils-SsF94Pkg.js";import{Bt as x,It as S,Kt as C,Lt as w,at as T,et as ce,it as E,lt as le,ot as ue,qt as de,rt as D,st as fe,zt as pe}from"./index-B0xy4BkI.js";import{t as O}from"./async-error-boundary-Rf-s2_Ez.js";import"./monaco-setup-C87kBr4u.js";var k=r(),A=e(f(),1),j=t(),M=p(`explorer.preview`),N=[{label:`Markdown`,ext:`md`,icon:c},{label:`TypeScript`,ext:`ts`,icon:i},{label:`Text`,ext:`txt`,icon:s}];async function P(e,t){try{let n=await T(e,``),r=new Set(n.entries.map(e=>e.name)),i=`untitled`,a=`${i}.${t}`,o=2;for(;r.has(a);)a=`${i}${o}.${t}`,o++;return a}catch{return`untitled.${t}`}}function F(e){return m(e)===`md`}function I(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,mdc:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`}[m(e)]??`plaintext`}function L(e,t){return`explorer-file:${e}:${t}`}function R(e){let t=(0,k.c)(11),{threadId:n,path:r,contentKey:i,onContentReady:a}=e,o;t[0]!==r||t[1]!==n?(o=L(n,r),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s;t[3]!==r||t[4]!==n?(s=async()=>{try{return await E(n,r)}catch(e){let t=e;throw z(`Failed to load explorer file preview`,{threadId:n,path:r},t),t}},t[3]=r,t[4]=n,t[5]=s):s=t[5];let c=b(o,s),l,u;return t[6]!==i||t[7]!==a||t[8]!==c.content?(l=()=>{a({key:i,content:c.content,original:c.content})},u=[a,c.content,i],t[6]=i,t[7]=a,t[8]=c.content,t[9]=l,t[10]=u):(l=t[9],u=t[10]),(0,A.useLayoutEffect)(l,u),null}function z(e,t,n){M.error(e,{...t,error:n})}function B(e,t){return`explorer-media:${e}:${t}`}function V(e,t){let n=(0,k.c)(11),r;n[0]!==t||n[1]!==e?(r=B(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=async()=>{try{return await D(e,t)}catch(n){let r=n;throw z(`Failed to load explorer media preview`,{threadId:e,path:t},r),r}},n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=b(r,i),o;n[6]===a?o=n[7]:(o=URL.createObjectURL(a),n[6]=a,n[7]=o);let s=o,c,l;return n[8]===s?(c=n[9],l=n[10]):(c=()=>()=>{URL.revokeObjectURL(s)},l=[s],n[8]=s,n[9]=c,n[10]=l),(0,A.useEffect)(c,l),s}function me(e){let t=(0,k.c)(3),{threadId:n,path:r,alt:i}=e,a=V(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,j.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,j.jsx)(`img`,{src:a,alt:i,className:`max-w-full max-h-full object-contain`})}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function he(e){let t=(0,k.c)(2),{threadId:n,path:r}=e,i=V(n,r),a;return t[0]===i?a=t[1]:(a=(0,j.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,j.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}function H({selectedFile:e,showTreeBackButton:t=!1,onShowTree:r,onFileCreated:i}){let{resolvedTheme:s}=se(),f=ae(e=>e.selectedThreadId),{triggerExplorerRefresh:p}=oe(),m=(0,A.useRef)(null),b=(0,A.useRef)(null),T=(0,A.useRef)(!1),[E,D]=(0,A.useState)(null),[k,M]=(0,A.useState)(!1),[V,H]=(0,A.useState)(!1),[U,W]=(0,A.useState)(`edit`),[ge,_e]=(0,A.useState)(0),[G,ve]=(0,A.useState)(null),[K,q]=(0,A.useState)(!1),ye=e?.path??null;(0,A.useEffect)(()=>{f&&ie(f).then(ve).catch(()=>{})},[f]);let be=async()=>{if(!(!G||K)){q(!0);try{await navigator.clipboard.writeText(G),v({title:`Copied`,description:`Repository folder path copied to clipboard.`})}catch(e){z(`Failed to copy explorer folder path`,{threadId:f,folderPath:G},e),v({title:`Error`,description:`Failed to copy path to clipboard.`,variant:`destructive`})}finally{q(!1)}}},xe=async()=>{if(f)try{await ue(f,`.`)}catch(e){z(`Failed to open explorer repository folder`,{threadId:f,folderPath:G},e),v({title:`Error`,description:`Failed to open repository folder.`,variant:`destructive`})}},Se=(0,A.useCallback)(async e=>{if(f)try{let t=await P(f,e);await ce(f,``,t);let n={name:t,path:t,type:`file`};b.current=t,T.current=!0,i?.(n),p(),v({title:`Created`,description:`${t} created successfully.`})}catch(t){z(`Failed to create explorer file`,{threadId:f,extension:e},t),v({title:`Error`,description:`Failed to create file.`,variant:`destructive`})}},[f,i,p]),J=e?u(e.path,e.name):null,Y=e?.type===`file`&&f&&!J?e:null,X=Y?`${f}:${Y.path}:${ge}`:null,Z=E&&E.key===X?E:null,Q=Z?.content??``,Ce=Z?.original??``;(0,A.useEffect)(()=>()=>{m.current&&=(m.current.getModel()?.dispose(),m.current.dispose(),null)},[]),(0,A.useEffect)(()=>{e?.type===`file`?b.current===e.path?(b.current=null,W(`edit`)):W(F(e.path)?`view`:`edit`):W(`edit`)},[ye,f]);async function $(){if(!(!f||!e||!X)){M(!0);try{await le(f,e.path,Q),D({key:X,content:Q,original:Q}),v({title:`Saved`,description:`${e.name} saved successfully.`})}catch(t){z(`Failed to save explorer file`,{threadId:f,path:e.path},t),v({title:`Error`,description:t instanceof Error?t.message:`Failed to save file`,variant:`destructive`})}finally{M(!1)}}}async function we(){if(!(!f||!e||V)){H(!0);try{if(!re()){if(typeof window>`u`)return;let t=document.querySelector(`[data-markdown-print-content]`);if(!(t instanceof HTMLElement)){v({title:`Print unavailable`,description:`Couldn't find the markdown preview to print.`,variant:`destructive`});return}let n=`<!doctype html>
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Di as t,J as n,Oi as r,Qt as i,Rr as a,Sn as o,Ut as s,Wt as c,X as l,_r as u,dn as ee,i as d,it as te,ki as f,tr as p,vr as m,yt as h}from"./interactive-BrHVRHmQ.js";import{d as ne}from"./react-vendor-7n7LyU5o.js";import{Ca as re,Eo as g,Yn as ie,bt as _}from"./onboarding-KBcwP-kU.js";import{r as ae}from"./store-B_cK-gsT.js";import{t as v}from"./use-toast-hxHsVv6a.js";import{n as oe}from"./explorer-tab-context-BdjTEbFh.js";import{n as y,t as b}from"./use-suspense-resource-CExc4Svq.js";import{n as se}from"./utils-SsF94Pkg.js";import{Bt as x,It as S,Kt as C,Lt as w,at as T,et as ce,it as E,lt as le,ot as ue,qt as de,rt as D,st as fe,zt as pe}from"./index-CJCQ4bTo.js";import{t as O}from"./async-error-boundary-CM6LU7nT.js";import"./monaco-setup-b-rhUj5t.js";var k=r(),A=e(f(),1),j=t(),M=p(`explorer.preview`),N=[{label:`Markdown`,ext:`md`,icon:c},{label:`TypeScript`,ext:`ts`,icon:i},{label:`Text`,ext:`txt`,icon:s}];async function P(e,t){try{let n=await T(e,``),r=new Set(n.entries.map(e=>e.name)),i=`untitled`,a=`${i}.${t}`,o=2;for(;r.has(a);)a=`${i}${o}.${t}`,o++;return a}catch{return`untitled.${t}`}}function F(e){return m(e)===`md`}function I(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,mdc:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`}[m(e)]??`plaintext`}function L(e,t){return`explorer-file:${e}:${t}`}function R(e){let t=(0,k.c)(11),{threadId:n,path:r,contentKey:i,onContentReady:a}=e,o;t[0]!==r||t[1]!==n?(o=L(n,r),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s;t[3]!==r||t[4]!==n?(s=async()=>{try{return await E(n,r)}catch(e){let t=e;throw z(`Failed to load explorer file preview`,{threadId:n,path:r},t),t}},t[3]=r,t[4]=n,t[5]=s):s=t[5];let c=b(o,s),l,u;return t[6]!==i||t[7]!==a||t[8]!==c.content?(l=()=>{a({key:i,content:c.content,original:c.content})},u=[a,c.content,i],t[6]=i,t[7]=a,t[8]=c.content,t[9]=l,t[10]=u):(l=t[9],u=t[10]),(0,A.useLayoutEffect)(l,u),null}function z(e,t,n){M.error(e,{...t,error:n})}function B(e,t){return`explorer-media:${e}:${t}`}function V(e,t){let n=(0,k.c)(11),r;n[0]!==t||n[1]!==e?(r=B(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=async()=>{try{return await D(e,t)}catch(n){let r=n;throw z(`Failed to load explorer media preview`,{threadId:e,path:t},r),r}},n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=b(r,i),o;n[6]===a?o=n[7]:(o=URL.createObjectURL(a),n[6]=a,n[7]=o);let s=o,c,l;return n[8]===s?(c=n[9],l=n[10]):(c=()=>()=>{URL.revokeObjectURL(s)},l=[s],n[8]=s,n[9]=c,n[10]=l),(0,A.useEffect)(c,l),s}function me(e){let t=(0,k.c)(3),{threadId:n,path:r,alt:i}=e,a=V(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,j.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,j.jsx)(`img`,{src:a,alt:i,className:`max-w-full max-h-full object-contain`})}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function he(e){let t=(0,k.c)(2),{threadId:n,path:r}=e,i=V(n,r),a;return t[0]===i?a=t[1]:(a=(0,j.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,j.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}function H({selectedFile:e,showTreeBackButton:t=!1,onShowTree:r,onFileCreated:i}){let{resolvedTheme:s}=se(),f=ae(e=>e.selectedThreadId),{triggerExplorerRefresh:p}=oe(),m=(0,A.useRef)(null),b=(0,A.useRef)(null),T=(0,A.useRef)(!1),[E,D]=(0,A.useState)(null),[k,M]=(0,A.useState)(!1),[V,H]=(0,A.useState)(!1),[U,W]=(0,A.useState)(`edit`),[ge,_e]=(0,A.useState)(0),[G,ve]=(0,A.useState)(null),[K,q]=(0,A.useState)(!1),ye=e?.path??null;(0,A.useEffect)(()=>{f&&ie(f).then(ve).catch(()=>{})},[f]);let be=async()=>{if(!(!G||K)){q(!0);try{await navigator.clipboard.writeText(G),v({title:`Copied`,description:`Repository folder path copied to clipboard.`})}catch(e){z(`Failed to copy explorer folder path`,{threadId:f,folderPath:G},e),v({title:`Error`,description:`Failed to copy path to clipboard.`,variant:`destructive`})}finally{q(!1)}}},xe=async()=>{if(f)try{await ue(f,`.`)}catch(e){z(`Failed to open explorer repository folder`,{threadId:f,folderPath:G},e),v({title:`Error`,description:`Failed to open repository folder.`,variant:`destructive`})}},Se=(0,A.useCallback)(async e=>{if(f)try{let t=await P(f,e);await ce(f,``,t);let n={name:t,path:t,type:`file`};b.current=t,T.current=!0,i?.(n),p(),v({title:`Created`,description:`${t} created successfully.`})}catch(t){z(`Failed to create explorer file`,{threadId:f,extension:e},t),v({title:`Error`,description:`Failed to create file.`,variant:`destructive`})}},[f,i,p]),J=e?u(e.path,e.name):null,Y=e?.type===`file`&&f&&!J?e:null,X=Y?`${f}:${Y.path}:${ge}`:null,Z=E&&E.key===X?E:null,Q=Z?.content??``,Ce=Z?.original??``;(0,A.useEffect)(()=>()=>{m.current&&=(m.current.getModel()?.dispose(),m.current.dispose(),null)},[]),(0,A.useEffect)(()=>{e?.type===`file`?b.current===e.path?(b.current=null,W(`edit`)):W(F(e.path)?`view`:`edit`):W(`edit`)},[ye,f]);async function $(){if(!(!f||!e||!X)){M(!0);try{await le(f,e.path,Q),D({key:X,content:Q,original:Q}),v({title:`Saved`,description:`${e.name} saved successfully.`})}catch(t){z(`Failed to save explorer file`,{threadId:f,path:e.path},t),v({title:`Error`,description:t instanceof Error?t.message:`Failed to save file`,variant:`destructive`})}finally{M(!1)}}}async function we(){if(!(!f||!e||V)){H(!0);try{if(!re()){if(typeof window>`u`)return;let t=document.querySelector(`[data-markdown-print-content]`);if(!(t instanceof HTMLElement)){v({title:`Print unavailable`,description:`Couldn't find the markdown preview to print.`,variant:`destructive`});return}let n=`<!doctype html>
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="utf-8" />
@@ -1 +1 @@
1
- import{Di as e,Oi as t,Rr as n,i as r,yt as i}from"./interactive-BrHVRHmQ.js";import{A as a,D as o,Eo as s,O as c,T as l,j as u,k as d}from"./onboarding-DVc9-yKJ.js";var f=t(),p=e();function m(e){let t=(0,f.c)(28),{open:m,onOpenChange:g,commits:_,displayedCommits:v,isLoadingMore:y,onScroll:b,currentBranch:x}=e,S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,p.jsx)(u,{children:`Commit History`}),t[0]=S):S=t[0];let C;t[1]===x?C=t[2]:(C=(0,p.jsxs)(a,{children:[S,(0,p.jsxs)(c,{children:[`Recent commits on branch `,x]})]}),t[1]=x,t[2]=C);let w;t[3]===v?w=t[4]:(w=v.length>0?v.map(h):(0,p.jsx)(`p`,{className:r(n.bodyMuted,`text-center py-8`),children:`No commits found`}),t[3]=v,t[4]=w);let T;t[5]===y?T=t[6]:(T=y&&(0,p.jsx)(`div`,{className:`p-3 text-center`,children:(0,p.jsx)(i,{className:`h-4 w-4 animate-spin inline`})}),t[5]=y,t[6]=T);let E;t[7]!==_.length||t[8]!==v.length||t[9]!==y?(E=v.length<_.length&&!y&&(0,p.jsx)(`div`,{className:r(n.caption,`p-3 text-center`),children:`Scroll to load more`}),t[7]=_.length,t[8]=v.length,t[9]=y,t[10]=E):E=t[10];let D;t[11]!==w||t[12]!==T||t[13]!==E?(D=(0,p.jsxs)(`div`,{className:`divide-y`,children:[w,T,E]}),t[11]=w,t[12]=T,t[13]=E,t[14]=D):D=t[14];let O;t[15]!==b||t[16]!==D?(O=(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto border rounded-lg`,onScroll:b,children:D}),t[15]=b,t[16]=D,t[17]=O):O=t[17];let k;t[18]===g?k=t[19]:(k=(0,p.jsx)(d,{children:(0,p.jsx)(s,{onClick:()=>g(!1),children:`Close`})}),t[18]=g,t[19]=k);let A;t[20]!==C||t[21]!==O||t[22]!==k?(A=(0,p.jsxs)(o,{className:`max-w-2xl max-h-[80vh] flex flex-col`,children:[C,O,k]}),t[20]=C,t[21]=O,t[22]=k,t[23]=A):A=t[23];let j;return t[24]!==g||t[25]!==m||t[26]!==A?(j=(0,p.jsx)(l,{open:m,onOpenChange:g,children:A}),t[24]=g,t[25]=m,t[26]=A,t[27]=j):j=t[27],j}function h(e){return(0,p.jsxs)(`div`,{className:`p-3 hover:bg-muted/50 transition-colors`,children:[(0,p.jsx)(`p`,{className:r(n.label,`break-words`),children:e.message}),(0,p.jsxs)(`p`,{className:r(n.bodyMuted,`mt-1`),children:[(0,p.jsx)(`span`,{className:n.mono,children:e.hash.substring(0,7)}),` •`,` `,e.author,` • `,new Date(e.date).toLocaleDateString()]})]},e.hash)}export{m as GitHistoryDialog};
1
+ import{Di as e,Oi as t,Rr as n,i as r,yt as i}from"./interactive-BrHVRHmQ.js";import{A as a,D as o,Eo as s,O as c,T as l,j as u,k as d}from"./onboarding-KBcwP-kU.js";var f=t(),p=e();function m(e){let t=(0,f.c)(28),{open:m,onOpenChange:g,commits:_,displayedCommits:v,isLoadingMore:y,onScroll:b,currentBranch:x}=e,S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,p.jsx)(u,{children:`Commit History`}),t[0]=S):S=t[0];let C;t[1]===x?C=t[2]:(C=(0,p.jsxs)(a,{children:[S,(0,p.jsxs)(c,{children:[`Recent commits on branch `,x]})]}),t[1]=x,t[2]=C);let w;t[3]===v?w=t[4]:(w=v.length>0?v.map(h):(0,p.jsx)(`p`,{className:r(n.bodyMuted,`text-center py-8`),children:`No commits found`}),t[3]=v,t[4]=w);let T;t[5]===y?T=t[6]:(T=y&&(0,p.jsx)(`div`,{className:`p-3 text-center`,children:(0,p.jsx)(i,{className:`h-4 w-4 animate-spin inline`})}),t[5]=y,t[6]=T);let E;t[7]!==_.length||t[8]!==v.length||t[9]!==y?(E=v.length<_.length&&!y&&(0,p.jsx)(`div`,{className:r(n.caption,`p-3 text-center`),children:`Scroll to load more`}),t[7]=_.length,t[8]=v.length,t[9]=y,t[10]=E):E=t[10];let D;t[11]!==w||t[12]!==T||t[13]!==E?(D=(0,p.jsxs)(`div`,{className:`divide-y`,children:[w,T,E]}),t[11]=w,t[12]=T,t[13]=E,t[14]=D):D=t[14];let O;t[15]!==b||t[16]!==D?(O=(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto border rounded-lg`,onScroll:b,children:D}),t[15]=b,t[16]=D,t[17]=O):O=t[17];let k;t[18]===g?k=t[19]:(k=(0,p.jsx)(d,{children:(0,p.jsx)(s,{onClick:()=>g(!1),children:`Close`})}),t[18]=g,t[19]=k);let A;t[20]!==C||t[21]!==O||t[22]!==k?(A=(0,p.jsxs)(o,{className:`max-w-2xl max-h-[80vh] flex flex-col`,children:[C,O,k]}),t[20]=C,t[21]=O,t[22]=k,t[23]=A):A=t[23];let j;return t[24]!==g||t[25]!==m||t[26]!==A?(j=(0,p.jsx)(l,{open:m,onOpenChange:g,children:A}),t[24]=g,t[25]=m,t[26]=A,t[27]=j):j=t[27],j}function h(e){return(0,p.jsxs)(`div`,{className:`p-3 hover:bg-muted/50 transition-colors`,children:[(0,p.jsx)(`p`,{className:r(n.label,`break-words`),children:e.message}),(0,p.jsxs)(`p`,{className:r(n.bodyMuted,`mt-1`),children:[(0,p.jsx)(`span`,{className:n.mono,children:e.hash.substring(0,7)}),` •`,` `,e.author,` • `,new Date(e.date).toLocaleDateString()]})]},e.hash)}export{m as GitHistoryDialog};