tarsk 0.4.30 → 0.4.31

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 (76) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/public/assets/{account-view-wqPOnMfW.js → account-view-Cdp8xegU.js} +1 -1
  3. package/dist/public/assets/alert-dialog-DAJFcjdR.js +1 -0
  4. package/dist/public/assets/api-BYFUablr.js +1 -0
  5. package/dist/public/assets/{browser-tab-BjqSmZHm.js → browser-tab-Ban23pgA.js} +1 -1
  6. package/dist/public/assets/chat-input-container-Bc7nCdKX.js +21 -0
  7. package/dist/public/assets/{context-menu-XD6khGRr.js → context-menu-D93N09Jw.js} +1 -1
  8. package/dist/public/assets/conversation-history-view-qm_qW0aD.js +1 -0
  9. package/dist/public/assets/{dialogs-config-BXDglGdB.js → dialogs-config-VlhyoYms.js} +2 -2
  10. package/dist/public/assets/diff-view-DUmzPmed.js +3 -0
  11. package/dist/public/assets/explorer-tab-view-Bbboiq-d.js +2 -0
  12. package/dist/public/assets/explorer-tree-CX03Vh31.js +1 -0
  13. package/dist/public/assets/{explorer-view-CL_9lhkq.js → explorer-view-CMcJFEtT.js} +1 -1
  14. package/dist/public/assets/history-view-Cub-F9g6.js +1 -0
  15. package/dist/public/assets/index-C-dv630o.css +1 -0
  16. package/dist/public/assets/index-DaJT5K7g.js +29 -0
  17. package/dist/public/assets/{markdown-renderer-CPSKOcqK.js → markdown-renderer-BPXg5AUu.js} +3 -3
  18. package/dist/public/assets/mcp-server-card-BCZmpcVY.js +1 -0
  19. package/dist/public/assets/onboarding-BPUo1aJX.js +1 -0
  20. package/dist/public/assets/onboarding-dialog-vqz8baom.js +1 -0
  21. package/dist/public/assets/page-toolbar-CU9dGLvm.js +1 -0
  22. package/dist/public/assets/{project-settings-view-CRRJPGNL.js → project-settings-view-BAs5RYWR.js} +1 -1
  23. package/dist/public/assets/providers-list-view-67A5O5vd.js +1 -0
  24. package/dist/public/assets/radio-group-CRwVSJCp.js +1 -0
  25. package/dist/public/assets/react-vendor-CtZx3FWA.js +22 -0
  26. package/dist/public/assets/{resizable-BLhzHL_f.js → resizable-AKojmHeo.js} +1 -1
  27. package/dist/public/assets/{run-stop-button-CIuDOHFg.js → run-stop-button-DYoC8i6e.js} +2 -2
  28. package/dist/public/assets/{settings-general-view-7Y0c9534.js → settings-general-view-mu1Qq8cl.js} +1 -1
  29. package/dist/public/assets/{settings-instructions-view-B-uTQrNZ.js → settings-instructions-view-DQRSZId7.js} +1 -1
  30. package/dist/public/assets/{settings-mcp-servers-view-nAMQQWHb.js → settings-mcp-servers-view-BqJMRVZJ.js} +4 -4
  31. package/dist/public/assets/{settings-models-skeleton-CffyGIvJ.js → settings-models-skeleton-qdDMv5hS.js} +1 -1
  32. package/dist/public/assets/settings-models-view-DSrdZZfF.js +1 -0
  33. package/dist/public/assets/settings-rules-view-Dt_lfKVv.js +8 -0
  34. package/dist/public/assets/{settings-skills-view-DBX7obT7.js → settings-skills-view-Djrk38ol.js} +2 -2
  35. package/dist/public/assets/{settings-slash-commands-view-BoT1nCir.js → settings-slash-commands-view-Cm5cy2My.js} +1 -1
  36. package/dist/public/assets/settings-subagents-view-CsGwbSvQ.js +2 -0
  37. package/dist/public/assets/{settings-view-CS-RnV6J.js → settings-view-DuTfugUO.js} +2 -2
  38. package/dist/public/assets/{side-panel-container-B33_hnhc.js → side-panel-container-Cg99BH1l.js} +2 -2
  39. package/dist/public/assets/skeleton-B1fuNMHm.js +1 -0
  40. package/dist/public/assets/{standard-list-item-BLTOBGFa.js → standard-list-item-0m99qNoa.js} +1 -1
  41. package/dist/public/assets/{store-B9rEO6q-.js → store-DUqJt-K-.js} +1 -1
  42. package/dist/public/assets/{tab-context-BUUT3x3d.js → tab-context-BYpxvaoz.js} +1 -1
  43. package/dist/public/assets/tabs-ywSKq3qp.js +1 -0
  44. package/dist/public/assets/{terminal-panel-BCHLDUbD.js → terminal-panel-C9XWZHaD.js} +2 -2
  45. package/dist/public/assets/textarea-DuuNwegn.js +1 -0
  46. package/dist/public/assets/todos-view-CRzNrsfP.js +1 -0
  47. package/dist/public/assets/use-font-size-D2A0_bAi.js +1 -0
  48. package/dist/public/assets/{use-toast-C5s-Xnwi.js → use-toast-BF5WtiOJ.js} +1 -1
  49. package/dist/public/assets/{utils-CDrGT12s.js → utils-CheqpoJ4.js} +1 -1
  50. package/dist/public/index.html +21 -21
  51. package/package.json +1 -1
  52. package/dist/public/assets/alert-dialog-Dj0hDlZC.js +0 -1
  53. package/dist/public/assets/api-RbLAI1bg.js +0 -1
  54. package/dist/public/assets/chat-input-container-BNOl7YtC.js +0 -21
  55. package/dist/public/assets/conversation-history-view-BRSNoBYn.js +0 -1
  56. package/dist/public/assets/diff-view-DiNlWcSj.js +0 -3
  57. package/dist/public/assets/explorer-tab-view-DbMBihAH.js +0 -2
  58. package/dist/public/assets/explorer-tree-D0P-HUYS.js +0 -1
  59. package/dist/public/assets/history-view-i7fGKCkc.js +0 -1
  60. package/dist/public/assets/index-BeLCtY82.css +0 -1
  61. package/dist/public/assets/index-CZZ6Jb9i.js +0 -29
  62. package/dist/public/assets/mcp-server-card-DFATg_Ie.js +0 -1
  63. package/dist/public/assets/onboarding-5CTkrfwe.js +0 -1
  64. package/dist/public/assets/onboarding-dialog-gcZ9aKKp.js +0 -1
  65. package/dist/public/assets/page-toolbar-CbwENcML.js +0 -1
  66. package/dist/public/assets/providers-list-view-D3CIB4ou.js +0 -1
  67. package/dist/public/assets/radio-group-qCcnwXV3.js +0 -1
  68. package/dist/public/assets/react-vendor-Bpg1hd5i.js +0 -22
  69. package/dist/public/assets/settings-models-view-CMZh5LlR.js +0 -1
  70. package/dist/public/assets/settings-rules-view-BaNccq1v.js +0 -8
  71. package/dist/public/assets/settings-subagents-view-Cy87X2bs.js +0 -2
  72. package/dist/public/assets/skeleton-n47_ST9G.js +0 -1
  73. package/dist/public/assets/tabs--5y6mYhG.js +0 -1
  74. package/dist/public/assets/textarea-CwXpBxom.js +0 -1
  75. package/dist/public/assets/todos-view-k0k8R9NT.js +0 -1
  76. package/dist/public/assets/use-font-size-BJl84s49.js +0 -1
@@ -43,9 +43,9 @@ import{i as e,n as t,t as n}from"./rolldown-runtime-B1FJdls4.js";var r=n((e=>{va
43
43
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
44
44
 
45
45
  For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return l.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},rF=`DialogDescriptionWarning`,iF=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${tF(rF).contentName}}.`;return l.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},aF=AP,oF=MP,sF=IP,cF=RP,lF=HP,uF=qP,dF=YP,fF=ZP,pF=aF,mF=sF,hF=l.forwardRef((e,t)=>{let n=(0,R.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=U(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(cF,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});hF.displayName=cF.displayName;var gF=l.forwardRef((e,t)=>{let n=(0,R.c)(13),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,B.jsx)(hF,{}),n[4]=o):o=n[4];let s;n[5]===i?s=n[6]:(s=U(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,i),n[5]=i,n[6]=s);let c;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,B.jsxs)(fF,{className:`absolute right-4 top-4 h-7 w-7 rounded-full flex items-center justify-center transition-colors hover:bg-foreground hover:text-background disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,B.jsx)(TA,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),n[7]=c):c=n[7];let l;return n[8]!==r||n[9]!==a||n[10]!==t||n[11]!==s?(l=(0,B.jsxs)(mF,{children:[o,(0,B.jsxs)(lF,{ref:t,className:s,...a,children:[r,c]})]}),n[8]=r,n[9]=a,n[10]=t,n[11]=s,n[12]=l):l=n[12],l});gF.displayName=lF.displayName;var _F=e=>{let t=(0,R.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 i;t[3]===n?i=t[4]:(i=U(`flex flex-col space-y-1.5 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,B.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};_F.displayName=`DialogHeader`;var vF=e=>{let t=(0,R.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 i;t[3]===n?i=t[4]:(i=U(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,B.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};vF.displayName=`DialogFooter`;var yF=l.forwardRef((e,t)=>{let n=(0,R.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=U(`text-lg font-semibold leading-none tracking-tight`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(uF,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});yF.displayName=uF.displayName;var bF=l.forwardRef((e,t)=>{let n=(0,R.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=U(`text-sm text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(dF,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});bF.displayName=dF.displayName;var xF=l.forwardRef((e,t)=>{let n=(0,R.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,type:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===r?o=n[5]:(o=U(`flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,r),n[4]=r,n[5]=o);let s;return n[6]!==i||n[7]!==t||n[8]!==o||n[9]!==a?(s=(0,B.jsx)(`input`,{type:a,className:o,ref:t,...i}),n[6]=i,n[7]=t,n[8]=o,n[9]=a,n[10]=s):s=n[10],s});xF.displayName=`Input`;var SF=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=VA(`Primitive.${t}`),r=l.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,B.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),CF=`Label`,wF=l.forwardRef((e,t)=>(0,B.jsx)(SF.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));wF.displayName=CF;var TF=wF,EF=QA(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),DF=l.forwardRef((e,t)=>{let n=(0,R.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=U(EF(),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(TF,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});DF.displayName=TF.displayName;var OF=l.createContext(void 0);function kF(e){let t=l.useContext(OF);return e||t||`ltr`}function AF(e,[t,n]){return Math.min(n,Math.max(t,e))}function jF(e,t){return l.useReducer((e,n)=>t[e][n]??e,e)}var MF=`ScrollArea`,[NF,PF]=eM(MF),[FF,q]=NF(MF),IF=l.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=l.useState(null),[u,d]=l.useState(null),[f,p]=l.useState(null),[m,h]=l.useState(null),[g,_]=l.useState(null),[v,y]=l.useState(0),[b,x]=l.useState(0),[S,C]=l.useState(!1),[w,T]=l.useState(!1),E=z(t,e=>c(e)),D=kF(i);return(0,B.jsx)(FF,{scope:n,type:r,dir:D,scrollHideDelay:a,scrollArea:s,viewport:u,onViewportChange:d,content:f,onContentChange:p,scrollbarX:m,onScrollbarXChange:h,scrollbarXEnabled:S,onScrollbarXEnabledChange:C,scrollbarY:g,onScrollbarYChange:_,scrollbarYEnabled:w,onScrollbarYEnabledChange:T,onCornerWidthChange:y,onCornerHeightChange:x,children:(0,B.jsx)(G.div,{dir:D,...o,ref:E,style:{position:`relative`,"--radix-scroll-area-corner-width":v+`px`,"--radix-scroll-area-corner-height":b+`px`,...e.style}})})});IF.displayName=MF;var LF=`ScrollAreaViewport`,RF=l.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=q(LF,n),s=z(t,l.useRef(null),o.onViewportChange);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,B.jsx)(G.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,B.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});RF.displayName=LF;var zF=`ScrollAreaScrollbar`,BF=l.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=q(zF,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return l.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,B.jsx)(VF,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,B.jsx)(HF,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,B.jsx)(UF,{...r,ref:t,forceMount:n}):i.type===`always`?(0,B.jsx)(WF,{...r,ref:t}):null});BF.displayName=zF;var VF=l.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=q(zF,e.__scopeScrollArea),[a,o]=l.useState(!1);return l.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,B.jsx)(eN,{present:n||a,children:(0,B.jsx)(UF,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),HF=l.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=q(zF,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=uI(()=>c(`SCROLL_END`),100),[s,c]=jF(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return l.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),l.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,B.jsx)(eN,{present:n||s!==`hidden`,children:(0,B.jsx)(WF,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:W(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:W(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),UF=l.forwardRef((e,t)=>{let n=q(zF,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=l.useState(!1),s=e.orientation===`horizontal`,c=uI(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return dI(n.viewport,c),dI(n.content,c),(0,B.jsx)(eN,{present:r||a,children:(0,B.jsx)(WF,{"data-state":a?`visible`:`hidden`,...i,ref:t})})}),WF=l.forwardRef((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=q(zF,e.__scopeScrollArea),a=l.useRef(null),o=l.useRef(0),[s,c]=l.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=rI(s.viewport,s.content),d={...r,sizes:s,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function f(e,t){return aI(e,o.current,s,t)}return n===`horizontal`?(0,B.jsx)(GF,{...d,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=oI(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=f(e,i.dir))}}):n===`vertical`?(0,B.jsx)(KF,{...d,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=oI(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=f(e))}}):null}),GF=l.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=q(zF,e.__scopeScrollArea),[o,s]=l.useState(),c=l.useRef(null),u=z(t,c,a.onScrollbarXChange);return l.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,B.jsx)(YF,{"data-orientation":`horizontal`,...i,ref:u,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":iI(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),cI(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:nI(o.paddingLeft),paddingEnd:nI(o.paddingRight)}})}})}),KF=l.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=q(zF,e.__scopeScrollArea),[o,s]=l.useState(),c=l.useRef(null),u=z(t,c,a.onScrollbarYChange);return l.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,B.jsx)(YF,{"data-orientation":`vertical`,...i,ref:u,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":iI(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),cI(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:nI(o.paddingTop),paddingEnd:nI(o.paddingBottom)}})}})}),[qF,JF]=NF(zF),YF=l.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...p}=e,m=q(zF,n),[h,g]=l.useState(null),_=z(t,e=>g(e)),v=l.useRef(null),y=l.useRef(``),b=m.viewport,x=r.content-r.viewport,S=K(d),C=K(c),w=uI(f,10);function T(e){v.current&&u({x:e.clientX-v.current.left,y:e.clientY-v.current.top})}return l.useEffect(()=>{let e=e=>{let t=e.target;h?.contains(t)&&S(e,x)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[b,h,x,S]),l.useEffect(C,[r,C]),dI(h,w),dI(m.content,w),(0,B.jsx)(qF,{scope:n,scrollbar:h,hasThumb:i,onThumbChange:K(a),onThumbPointerUp:K(o),onThumbPositionChange:C,onThumbPointerDown:K(s),children:(0,B.jsx)(G.div,{...p,ref:_,style:{position:`absolute`,...p.style},onPointerDown:W(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),v.current=h.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,m.viewport&&(m.viewport.style.scrollBehavior=`auto`),T(e))}),onPointerMove:W(e.onPointerMove,T),onPointerUp:W(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=y.current,m.viewport&&(m.viewport.style.scrollBehavior=``),v.current=null})})})}),XF=`ScrollAreaThumb`,ZF=l.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=JF(XF,e.__scopeScrollArea);return(0,B.jsx)(eN,{present:n||i.hasThumb,children:(0,B.jsx)(QF,{ref:t,...r})})}),QF=l.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=q(XF,n),o=JF(XF,n),{onThumbPositionChange:s}=o,c=z(t,e=>o.onThumbChange(e)),u=l.useRef(void 0),d=uI(()=>{u.current&&=(u.current(),void 0)},100);return l.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{d(),u.current||(u.current=lI(e,s),s())};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,d,s]),(0,B.jsx)(G.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:W(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:W(e.onPointerUp,o.onThumbPointerUp)})});ZF.displayName=XF;var $F=`ScrollAreaCorner`,eI=l.forwardRef((e,t)=>{let n=q($F,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,B.jsx)(tI,{...e,ref:t}):null});eI.displayName=$F;var tI=l.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=q($F,n),[a,o]=l.useState(0),[s,c]=l.useState(0),u=!!(a&&s);return dI(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),dI(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),u?(0,B.jsx)(G.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function nI(e){return e?parseInt(e,10):0}function rI(e,t){let n=e/t;return isNaN(n)?0:n}function iI(e){let t=rI(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function aI(e,t,n,r=`ltr`){let i=iI(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return sI([c,l],d)(e)}function oI(e,t,n=`ltr`){let r=iI(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=AF(e,n===`ltr`?[0,o]:[o*-1,0]);return sI([0,o],[0,s])(c)}function sI(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function cI(e,t){return e>0&&e<t}var lI=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function uI(e,t){let n=K(e),r=l.useRef(0);return l.useEffect(()=>()=>window.clearTimeout(r.current),[]),l.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function dI(e,t){let n=K(t);nM(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var fI=IF,pI=RF,mI=eI,hI=l.forwardRef((e,t)=>{let n=(0,R.c)(15),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=U(`relative overflow-hidden`,i),n[4]=i,n[5]=o);let s;n[6]===r?s=n[7]:(s=(0,B.jsx)(pI,{className:`h-full w-full rounded-[inherit]`,children:r}),n[6]=r,n[7]=s);let c,l;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,B.jsx)(gI,{}),l=(0,B.jsx)(mI,{}),n[8]=c,n[9]=l):(c=n[8],l=n[9]);let u;return n[10]!==a||n[11]!==t||n[12]!==o||n[13]!==s?(u=(0,B.jsxs)(fI,{ref:t,className:o,...a,children:[s,c,l]}),n[10]=a,n[11]=t,n[12]=o,n[13]=s,n[14]=u):u=n[14],u});hI.displayName=fI.displayName;var gI=l.forwardRef((e,t)=>{let n=(0,R.c)(14),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,orientation:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=a===void 0?`vertical`:a,s=o===`vertical`&&`h-full w-2.5 border-l border-l-transparent p-[1px]`,c=o===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent p-[1px]`,l;n[4]!==r||n[5]!==s||n[6]!==c?(l=U(`flex touch-none select-none transition-colors`,s,c,r),n[4]=r,n[5]=s,n[6]=c,n[7]=l):l=n[7];let u;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,B.jsx)(ZF,{className:`relative flex-1 rounded-full bg-border`}),n[8]=u):u=n[8];let d;return n[9]!==o||n[10]!==i||n[11]!==t||n[12]!==l?(d=(0,B.jsx)(BF,{ref:t,orientation:o,className:l,...i,children:u}),n[9]=o,n[10]=i,n[11]=t,n[12]=l,n[13]=d):d=n[13],d});gI.displayName=BF.displayName;var _I=[`462`,`8100`].includes(document.location.port)?`http://${document.location.hostname}:462`:`http://${document.location.hostname}:641`;function vI(){return _I}function yI(e){return`${_I}${e.startsWith(`/`)?e:`/${e}`}`}function bI(e){return e?typeof e.error==`string`?e.error:e.error&&typeof e.error==`object`?e.error.details??e.error.message??`Unknown error`:`Unknown error`:`Unknown error`}async function xI(e){try{return bI(await e.json())}catch{}return e.statusText||`Unknown error`}function SI(e,t,n){let r=Error(e);return n?.error&&typeof n.error==`object`&&(r.details=n.error.details,r.code=n.error.code),r}async function J(e,t){let n=await fetch(yI(e),{...t,method:`GET`});if(!n.ok){let e=await xI(n);throw Error(e)}return n.json()}async function Y(e,t,n){let r=await fetch(yI(e),{...n,method:`POST`,headers:{"Content-Type":`application/json`,...n?.headers},body:t?JSON.stringify(t):void 0});if(!r.ok){let e=await xI(r);throw Error(e)}return r.json()}async function CI(e,t,n){let r=await fetch(yI(e),{...n,method:`PUT`,headers:{"Content-Type":`application/json`,...n?.headers},body:t?JSON.stringify(t):void 0});if(!r.ok){let e=await xI(r);throw Error(e)}return r.json()}async function wI(e,t,n){let r=await fetch(yI(e),{...n,method:`PATCH`,headers:{"Content-Type":`application/json`,...n?.headers},body:t?JSON.stringify(t):void 0});if(!r.ok){let e=await xI(r);throw Error(e)}return r.json()}async function TI(e,t,n){let r=await fetch(yI(e),{...n,method:`PUT`,headers:{"Content-Type":`application/json`,...n?.headers},body:t?JSON.stringify(t):void 0});if(!r.ok){let e=await xI(r);throw Error(e)}return r.body}async function EI(e,t){let n=await fetch(yI(e),{...t,method:`DELETE`});if(!n.ok){let e=await xI(n);throw Error(e)}if(n.status!==204)return n.json()}async function DI(e,t,n){let r=await fetch(yI(e),{...n,method:`POST`,headers:{"Content-Type":`application/json`,...n?.headers},body:t?JSON.stringify(t):void 0,signal:n?.signal});if(!r.ok){let e=await xI(r);throw Error(e)}return r.body}async function OI(e,t){let n=await fetch(yI(e),{...t,method:`GET`});if(!n.ok){let e=await xI(n);throw Error(e)}return n.body}async function kI(e,t,n){let r=await fetch(yI(e),{...n,method:`POST`,headers:{"Content-Type":`application/json`,...n?.headers},body:t?JSON.stringify(t):void 0});if(!r.ok){let e;try{e=await r.json()}catch{}throw SI(bI(e)||r.statusText||`Unknown error`,r,e)}return r.json()}async function AI(e,t,n){let r=await fetch(yI(e),{...n,method:`PUT`,headers:{"Content-Type":`application/json`,...n?.headers},body:t?JSON.stringify(t):void 0});if(!r.ok){let e;try{e=await r.json()}catch{}throw SI(bI(e)||r.statusText||`Unknown error`,r,e)}return r.json()}function X(...e){return e.map(e=>encodeURIComponent(String(e))).join(`/`)}var Z=new class{cache=new Map;inFlightRequests=new Map;async get(e,t,n){let r=this.inFlightRequests.get(e);if(r)return r;let i=this.cache.get(e);if(i&&Date.now()<i.expires)return i.data;let a=t().then(t=>(this.cache.set(e,{data:t,expires:Date.now()+n}),t)).finally(()=>{this.inFlightRequests.delete(e)});return this.inFlightRequests.set(e,a),a}getSync(e){let t=this.cache.get(e);if(t&&Date.now()<t.expires)return t.data}invalidate(e){this.cache.delete(e)}invalidatePattern(e){let t=[];for(let n of this.cache.keys())e.test(n)&&t.push(n);t.forEach(e=>this.cache.delete(e))}clear(){this.cache.clear(),this.inFlightRequests.clear()}},jI=t({EmptyBalanceError:()=>MI,LOW_BALANCE_THRESHOLD:()=>50,applyAppUpdate:()=>yR,checkBalance:()=>NI,checkForAppUpdate:()=>vR,checkGitInstalled:()=>lR,checkVpInstalled:()=>FI,clearChatHistory:()=>uL,completeOnboarding:()=>uR,copyImageToClipboard:()=>OL,createGitCheckpoint:()=>GL,createGitHubRepo:()=>WL,createProject:()=>XI,createScaffoldedProject:()=>LI,createSlashCommand:()=>mR,createThread:()=>tL,createThreadAgent:()=>LR,createThreadSkill:()=>IR,deleteCommand:()=>JL,deleteMCPServer:()=>kR,deleteProject:()=>$I,deleteProjectAIFile:()=>MR,deleteSlashCommand:()=>hR,deleteThread:()=>nL,deleteThreadAIFile:()=>RR,disableImageModel:()=>EL,disableModel:()=>xL,enableImageModel:()=>TL,enableModel:()=>bL,fetchAvailableImageModels:()=>CL,fetchAvailableModels:()=>yL,fixComments:()=>iL,generateCommitMessage:()=>jL,generateImage:()=>DL,generatePRInfo:()=>IL,getAccountInfo:()=>WI,getAllEnabledImageModels:()=>wL,getAllEnabledModels:()=>SL,getAvailablePrograms:()=>GI,getChatHistory:()=>oL,getContextBreakdown:()=>_R,getConversationFolderPath:()=>sL,getConversationHistory:()=>gR,getGitDiff:()=>sR,getGitLog:()=>UL,getGitUser:()=>qI,getGitUserName:()=>JI,getMCPConfig:()=>DR,getOnboardingStatus:()=>cR,getPackageScripts:()=>YL,getPopularAgents:()=>CR,getPopularMCPServers:()=>AR,getPopularRules:()=>wR,getPopularSkills:()=>SR,getPopularSlashCommands:()=>TR,getProcessingThreads:()=>KI,getProject:()=>QI,getProjectAIFiles:()=>jR,getProjectScripts:()=>QL,getProjects:()=>YI,getProviderCredits:()=>BI,getProviderLogoUrl:()=>zI,getProviders:()=>RI,getScaffoldTemplates:()=>PI,getSlashCommands:()=>fR,getSlashCommandsAndSkills:()=>pR,getThread:()=>tR,getThreadAIFile:()=>PR,getThreadAIFiles:()=>NR,getThreadFiles:()=>ZL,getUnifiedGitStatus:()=>AL,gitCheckoutBranch:()=>VL,gitCommit:()=>ML,gitCreateBranch:()=>zL,gitCreatePR:()=>LL,gitFetch:()=>RL,gitListBranches:()=>BL,gitPull:()=>PL,gitPush:()=>NL,gitRevertFile:()=>HL,gitSyncBranch:()=>FL,installGithubFolderToThread:()=>ER,installVp:()=>II,invalidateProjectsCache:()=>eL,isDevServerRunning:()=>aR,openExternalUrl:()=>UI,openFolderProject:()=>ZI,openProjectWith:()=>mL,openThreadWith:()=>hL,parseSSEStream:()=>fL,resetOnboarding:()=>dR,restoreGitCheckpoint:()=>KL,runCommand:()=>XL,runProjectScript:()=>$L,saveCommand:()=>qL,saveImageToDownloads:()=>kL,saveMCPServer:()=>OR,saveProviderEnvironment:()=>HI,saveProviderKey:()=>VI,saveThreadAIFile:()=>FR,selectThread:()=>aL,sendChatMessage:()=>cL,startDevServer:()=>rR,stopChatGeneration:()=>dL,stopDevServer:()=>iR,stopProjectScript:()=>eR,submitAskUserAnswer:()=>bR,submitBrowserJsResult:()=>xR,subscribeToChatStream:()=>lL,suggestRunCommand:()=>nR,ttlCache:()=>Z,updateProject:()=>pL,updateProjectName:()=>vL,updateProjectOpenWith:()=>gL,updateProjectSetupScript:()=>_L,updateRunCommand:()=>oR,updateThread:()=>rL}),MI=class extends Error{constructor(){super(`No prompts remaining`),this.name=`EmptyBalanceError`}};async function NI(){let{plan:e,promptsRemaining:t}=await WI();return e===`unlimited-pro`?{isEmpty:!1,isLow:!1}:{isEmpty:t<=0,isLow:t>0&&t<=50}}async function PI(){return J(`api/scaffold/templates`)}async function FI(){return(await J(`api/scaffold/check-vp`)).installed}async function II(){return Y(`api/scaffold/install-vp`,{})}async function LI(e,t,n){return DI(`api/scaffold`,{projectName:e,templateId:t,packageManager:n})}async function RI(){return Z.get(`providers`,async()=>J(`api/providers`),6e4)}function zI(e){return`${vI()}/api/providers/${X(e)}/logo`}async function BI(e){return Z.get(`provider-credits-${e}`,async()=>J(`api/providers/${X(e)}/credits`),3e4)}async function VI(e,t){await Y(`api/providers/keys`,{providerName:e,apiKey:t}),Z.invalidate(`providers`)}async function HI(e){await Y(`api/providers/env`,{values:e}),Z.invalidate(`providers`)}async function UI(e){try{await Y(`api/providers/open-external`,{url:e})}catch(t){if(t instanceof Error&&t.message===`External URL opening not available in server mode`){window.open(e,`_blank`,`noopener,noreferrer`);return}throw t}}async function WI(){return J(`api/account/info`)}async function GI(){return Z.get(`available-programs`,async()=>(await J(`api/programs`)).programs??[],3e5)}async function KI(){return(await J(`api/threads/processing`)).processingThreadIds??[]}async function qI(){return Z.get(`git-user`,async()=>{try{let e=await J(`api/git/user`);return{name:e.name??``,email:e.email??``}}catch{return{name:``,email:``}}},6e5)}async function JI(){return(await qI()).name}async function YI(){return Z.get(`projects`,async()=>({projects:(await J(`api/projects`)||[]).map(e=>{let t=e;return{projectId:t.projectId??t.id,name:t.name,gitUrl:t.gitUrl,projectPath:t.projectPath??t.path,threads:t.threads??[],commands:t.commands??[],setupScript:t.setupScript,runCommand:t.runCommand,planPrompt:t.planPrompt,testPrompt:t.testPrompt,reviewPrompt:t.reviewPrompt}}).map(e=>{let t=(e.threads||[]).map(e=>{let t=e,n=t.threadId??t.id;return{threadId:n,title:t.title??n,path:t.path??``,currentBranch:t.currentBranch??``,isSelected:!!t.isSelected,model:t.model??void 0,modelProvider:t.modelProvider??void 0,gitStatusDot:!!t.gitStatusDot}});return{...e,threads:t}})}),3e4)}async function XI(e,t){return DI(`api/projects`,{gitUrl:e,commitMethod:t})}async function ZI(){return DI(`api/projects/open-folder`,{})}async function QI(e){return J(`api/projects/${X(e)}`)}async function $I(e){await EI(`api/projects/${X(e)}`),Z.invalidate(`projects`)}function eL(){Z.invalidate(`projects`)}async function tL(e,t){return DI(`api/threads`,{projectId:e,title:t})}async function nL(e,t){await EI(`api/threads/${X(t)}`)}async function rL(e,t){await wI(`api/threads/${X(e)}`,t),(`model`in t||`modelProvider`in t)&&Z.invalidate(`projects`)}async function iL(e,t){return Y(`api/threads/${X(e)}/fix-comments`,{comments:t})}async function aL(e,t){await Y(`api/threads/${X(t)}/select`)}async function oL(e){return{threadId:e,messages:await J(`api/threads/${X(e)}/messages`)}}async function sL(e){return(await J(`api/threads/${X(e)}/conversation-folder-path`)).path}async function cL(e,t,n,r=[],i,a,o,s){let{isEmpty:c}=await NI();if(c)throw new MI;return DI(`api/chat`,{threadId:e,content:t,model:n,provider:a,planMode:o,ralphMode:s,attachments:r.map(e=>({name:e.fileName,content:e.content.split(`,`)[1]||e.content,size:0,mimeType:e.mimeType||`application/octet-stream`}))},{signal:i})}async function lL(e,t){return OI(`api/chat/subscribe/${X(e)}`,{signal:t})}async function uL(e){return(await EI(`api/chat/${X(e)}`))?.conversationId||``}async function dL(e){try{await Y(`api/chat/stop/${X(e)}`)}catch{}}function fL(e,t,n,r,i){let a=e.getReader(),o=!1,s=()=>{o=!0,a.cancel().catch(()=>{})},c=new TextDecoder,l=``,u=e=>e?[/^Cannot read properties/i,/^Error:/i,/^TypeError:/i,/^ReferenceError:/i,/^SyntaxError:/i,/^failed to/i,/^error:/i,/forbidden/i,/unauthorized/i].some(t=>t.test(e.trim())):!1;async function d(){try{for(;!o;){let{done:e,value:s}=await a.read();if(e||o){if(!o&&e){if(l.trim())try{let e=JSON.parse(l);e.type===`error`?r(e.content??`Unknown error`):e.type===`message`?i?.({role:e.role??`assistant`,content:e.content??``,isThinking:e.isThinking}):e.type===`complete`||(e.type===`result`&&u(e.content)?r(e.content??`Unknown error`):t(e))}catch{l.trim()&&t({type:`result`,content:l})}n()}break}l+=c.decode(s,{stream:!0});let d=l.split(`
46
- `);l=d.pop()??``;for(let e of d){let a=e.trim();if(a)try{let e=JSON.parse(a);if(e.type===`error`){r(e.content??`Unknown error`),n();return}else if(e.type===`message`)i?.({role:e.role??`assistant`,content:e.content??``,isThinking:e.isThinking});else if(e.type===`complete`){n();return}else if(e.type===`result`&&u(e.content)){r(e.content??`Unknown error`),n();return}else t(e)}catch{}}}}catch(e){o||(r(e instanceof Error?e.message:`Stream error`),n())}}return d(),s}async function pL(e,t){return t.runNow&&t.setupScript?TI(`api/projects/${X(e)}`,t):(await AI(`api/projects/${X(e)}`,t),t.runNow||eL(),null)}async function mL(e,t){await kI(`api/projects/${X(e)}/open`,{program:t})}async function hL(e,t){await kI(`api/threads/${X(e)}/open`,{program:t})}async function gL(e,t){await pL(e,{program:t})}async function _L(e,t,n){return pL(e,{setupScript:t,runNow:n})}async function vL(e,t){await pL(e,{name:t})}async function yL(e,t){let n=new URLSearchParams({provider:e});t!==void 0&&n.set(`supportedTools`,t?`true`:`false`),n.set(`useCase`,`coding`);let r=`available-models-${n.toString()}`;return Z.get(r,async()=>{let e=await J(`api/models?${n.toString()}`);return{models:e.models??[],enabledModelIds:e.enabledModelIds??[]}},12e4)}async function bL(e,t){await Y(`api/models/${X(e,t)}/enable`),Z.invalidate(`enabled-models`),Z.invalidatePattern(/^available-models-/),Z.invalidatePattern(/^available-image-models-/)}async function xL(e,t){await Y(`api/models/${X(e,t)}/disable`),Z.invalidate(`enabled-models`),Z.invalidatePattern(/^available-models-/),Z.invalidatePattern(/^available-image-models-/)}async function SL(){return Z.get(`enabled-models`,async()=>(await J(`api/models/enabled?useCase=coding`)).enabledModels??{},12e4)}async function CL(e){let t=new URLSearchParams({provider:e,useCase:`image`}),n=`available-image-models-${e}`;return Z.get(n,async()=>{let e=await J(`api/models?${t.toString()}`);return{models:e.models??[],enabledModelIds:e.enabledModelIds??[]}},12e4)}async function wL(){return Z.get(`enabled-image-models`,async()=>(await J(`api/models/enabled?useCase=image`)).enabledModels??{},12e4)}async function TL(e,t){await Y(`api/models/${X(e,t)}/enable?useCase=image`),Z.invalidate(`enabled-image-models`),Z.invalidatePattern(/^available-models-/),Z.invalidatePattern(/^available-image-models-/)}async function EL(e,t){await Y(`api/models/${X(e,t)}/disable?useCase=image`),Z.invalidate(`enabled-image-models`),Z.invalidatePattern(/^available-models-/),Z.invalidatePattern(/^available-image-models-/)}async function DL(e,t,n,r){return Y(`api/image/generate`,{prompt:e,model:t,provider:n,threadId:r})}async function OL(e){await Y(`api/image/clipboard`,e)}async function kL(e){return Y(`api/image/save`,e)}async function AL(e,t=!1){return J(t?`api/git/unified-status/${X(e)}?fresh=true`:`api/git/unified-status/${X(e)}`)}async function jL(e,t,n){return(await Y(`api/git/generate-commit-message/${X(e)}`,{model:t,provider:n})).message}async function ML(e,t){await Y(`api/git/commit/${X(e)}`,{message:t})}async function NL(e){await Y(`api/git/push/${X(e)}`)}async function PL(e){await Y(`api/git/pull/${X(e)}`)}async function FL(e){return Y(`api/git/sync-branch/${X(e)}`,{})}async function IL(e,t,n){return Y(`api/git/generate-pr-info/${X(e)}`,{model:t,provider:n})}async function LL(e,t,n){return Y(`api/git/create-pr/${X(e)}`,{title:t,description:n})}async function RL(e){await Y(`api/git/fetch/${X(e)}`)}async function zL(e,t,n){return Y(`api/git/create-branch/${X(e)}`,{baseBranch:t,branchName:n})}async function BL(e){return J(`api/git/branches/${X(e)}`)}async function VL(e,t){return Y(`api/git/checkout-branch/${X(e)}`,{branchName:t})}async function HL(e,t){return Y(`api/git/revert-file/${X(e)}`,{filePath:t})}async function UL(e,t=50){return(await J(`api/git/log/${X(e)}?limit=${t}`)).commits}async function WL(e,t,n,r){return Y(`api/git/create-repo/${X(e)}`,{repoName:t,description:n,isPrivate:r})}async function GL(e,t){return Y(`api/git/checkpoint/${X(e)}`,{messageId:t})}async function KL(e,t){return Y(`api/git/checkpoint-restore/${X(e)}`,{checkpointRef:t})}async function qL(e,t){await Y(`api/projects/${X(e)}/commands`,t)}async function JL(e,t){await EI(`api/projects/${X(e)}/commands/${X(t)}`)}async function YL(e){return J(`api/projects/${X(e)}/package-scripts`)}async function XL(e,t,n,r){return DI(`api/projects/${X(e)}/threads/${X(t)}/commands/run`,{commandLine:n,cwd:r})}async function ZL(e){return J(`api/threads/${X(e)}/files`)}async function QL(e){return(await J(`api/threads/${X(e)}/project-scripts`)).scripts}async function $L(e,t,n,r){return DI(`api/threads/${X(e)}/project-scripts/run`,{scriptName:t,command:n},r)}async function eR(e,t){return Y(`api/threads/${X(e)}/project-scripts/stop`,{scriptName:t})}async function tR(e){return J(`api/threads/${e}`)}async function nR(e){return Y(`api/projects/${X(e)}/run-suggest`,{})}async function rR(e,t){return console.log(`API: startDevServer called for project:`,e,`thread:`,t),DI(`api/projects/${X(e)}/run`,{threadId:t})}async function iR(e){return Y(`api/projects/${X(e)}/stop`,{})}async function aR(e){return J(`api/projects/${X(e)}/running`)}async function oR(e,t){await pL(e,{runCommand:t})}async function sR(e){return J(`api/git/diff/${X(e)}`)}async function cR(){return J(`api/onboarding/status`)}async function lR(){return J(`api/onboarding/git-check`)}async function uR(){return Y(`api/onboarding/complete`,{})}async function dR(){return Y(`api/onboarding/reset`,{})}async function fR(e){return(await J(`api/slash-commands?threadId=${X(e)}`)).commands??[]}async function pR(e){let t=await J(`api/slash-commands?threadId=${X(e)}`);return{commands:t.commands??[],skills:t.skills??[]}}async function mR(e,t,n,r,i){return Y(`api/slash-commands`,{name:e,content:t,metadata:n,scope:r,threadId:i})}async function hR(e){let t=await fetch(`http://localhost:641/api/slash-commands`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filePath:e})});if(!t.ok)throw Error(`Failed to delete slash command: ${t.statusText}`);return t.json()}async function gR(e){return J(`api/conversations/${X(e)}`)}async function _R(e,t){return J(`api/conversations/${X(e)}/${X(t)}/context`)}async function vR(){try{return await J(`api/update/check`)}catch{return{updateAvailable:!1,supported:!1}}}async function yR(){return Y(`api/update/apply`)}async function bR(e,t){await Y(`api/ask-user/respond`,{toolCallId:e,answer:t})}async function xR(e,t){await Y(`api/browser-js/respond`,{toolCallId:e,result:t})}async function SR(){return(await J(`api/skills/popular`)).skills??[]}async function CR(){return(await J(`api/agents/popular`)).agents??[]}async function wR(){return(await J(`api/rules/popular`)).rules??[]}async function TR(){return(await J(`api/slash-commands/popular`)).commands??[]}async function ER(e,t,n,r){return Y(`api/threads/${X(e)}/ai-files/github-folder`,{gitHubRepo:t,gitHubFolder:n,destPath:r})}async function DR(e){return J(`api/mcp/config?projectPath=${encodeURIComponent(e)}`)}async function OR(e,t,n){return CI(`api/mcp/config`,{projectPath:e,serverName:t,serverConfig:n})}async function kR(e,t){return EI(`api/mcp/config/${X(t)}?projectPath=${encodeURIComponent(e)}`)}async function AR(){return(await J(`api/mcp/popular`)).servers??[]}async function jR(e){return(await J(`api/projects/${X(e)}/ai-files`)).nodes??[]}async function MR(e,t){return EI(`api/projects/${X(e)}/ai-file?path=${encodeURIComponent(t)}`)}async function NR(e){return(await J(`api/threads/${X(e)}/ai-files`)).nodes??[]}async function PR(e,t){return J(`api/threads/${X(e)}/ai-file?path=${encodeURIComponent(t)}`)}async function FR(e,t,n){return CI(`api/threads/${X(e)}/ai-file`,{path:t,content:n})}async function IR(e,t,n){return Y(`api/threads/${X(e)}/ai-files/skill`,{name:t,description:n})}async function LR(e,t,n,r){return Y(`api/threads/${X(e)}/ai-files/agent`,{name:t,description:n,tools:r})}async function RR(e,t){return EI(`api/threads/${X(e)}/ai-file?path=${encodeURIComponent(t)}`)}var Q=function(e){return e.PACKAGE_MANAGER=`tarsk.create-project.packageManager`,e.COMMIT_METHOD=`tarsk.create-project.commitMethod`,e.TEMPLATE_ID=`tarsk.create-project.templateId`,e.AUTO_GENERATE_COMMIT_MESSAGE=`autoGenerateCommitMessage`,e.AUTO_GENERATE_PR_INFO=`autoGeneratePRInfo`,e.PRIVATE_REPOSITORY_DEFAULT=`privateRepositoryDefault`,e.SELECTED_MODEL_PREFIX=`selected-model-`,e.SCROLL_POSITION_PREFIX=`scroll-position-`,e.FONT_SCALE=`tarsk.general.fontScale`,e.OPEN_WITH_PROGRAM=`tarsk.general.openWithProgram`,e}({}),zR=function(e){return e.MESSAGE_HISTORY=`chat_message_history`,e}({});function BR(e){return typeof localStorage>`u`?null:localStorage.getItem(e)}function VR(e,t){typeof localStorage>`u`||localStorage.setItem(e,t)}function HR(e){return typeof sessionStorage>`u`?null:sessionStorage.getItem(e)}function UR(e,t){typeof sessionStorage>`u`||sessionStorage.setItem(e,t)}function WR(e=`npm`){return BR(Q.PACKAGE_MANAGER)??e}function GR(e){VR(Q.PACKAGE_MANAGER,e)}function KR(e=`pull-request`){return BR(Q.COMMIT_METHOD)??e}function qR(e){VR(Q.COMMIT_METHOD,e)}function JR(e=``){return BR(Q.TEMPLATE_ID)??e}function YR(e){VR(Q.TEMPLATE_ID,e)}function XR(e=!1){let t=BR(Q.AUTO_GENERATE_COMMIT_MESSAGE);return t===null?e:t===`true`}function ZR(e){VR(Q.AUTO_GENERATE_COMMIT_MESSAGE,e.toString())}function QR(e=!1){let t=BR(Q.AUTO_GENERATE_PR_INFO);return t===null?e:t===`true`}function $R(e){VR(Q.AUTO_GENERATE_PR_INFO,e.toString())}function ez(e=!1){let t=BR(Q.PRIVATE_REPOSITORY_DEFAULT);return t===null?e:t===`true`}function tz(e){VR(Q.PRIVATE_REPOSITORY_DEFAULT,e.toString())}function nz(e){let t=BR(Q.SCROLL_POSITION_PREFIX+e),n=t===null?null:Number(t);return n!==null&&Number.isFinite(n)?n:null}function rz(e,t){VR(Q.SCROLL_POSITION_PREFIX+e,String(t))}function iz(){let e=HR(zR.MESSAGE_HISTORY);return e?JSON.parse(e):[]}function az(e){let t=iz();e.trim()&&t[t.length-1]!==e&&(t.push(e),UR(zR.MESSAGE_HISTORY,JSON.stringify(t)))}function oz(e=100){let t=BR(Q.FONT_SCALE);if(t!==null){let e=Number(t);if(Number.isFinite(e)&&e>=50&&e<=300)return e}return e}function sz(e){VR(Q.FONT_SCALE,String(e))}function cz(e=`VS Code`){return BR(Q.OPEN_WITH_PROGRAM)??e}function lz(e){VR(Q.OPEN_WITH_PROGRAM,e)}function uz(e){let t=e+`CollectionProvider`,[n,r]=eM(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=l.useRef(null),a=l.useRef(new Map).current;return(0,B.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=dM(s),u=l.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,B.jsx)(c,{ref:z(t,a(s,n).collectionRef),children:r})});u.displayName=s;let d=e+`CollectionItemSlot`,f=`data-radix-collection-item`,p=dM(d),m=l.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=l.useRef(null),s=z(t,o),c=a(d,n);return l.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,B.jsx)(p,{[f]:``,ref:s,children:r})});m.displayName=d;function h(t){let n=a(e+`CollectionConsumer`,t);return l.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:u,ItemSlot:m},h,r]}var dz=`rovingFocusGroup.onEntryFocus`,fz={bubbles:!1,cancelable:!0},pz=`RovingFocusGroup`,[mz,hz,gz]=uz(pz),[_z,vz]=eM(pz,[gz]),[yz,bz]=_z(pz),xz=l.forwardRef((e,t)=>(0,B.jsx)(mz.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(mz.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(Sz,{...e,ref:t})})}));xz.displayName=pz;var Sz=l.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,p=l.useRef(null),m=z(t,p),h=kF(a),[g,_]=sM({prop:o,defaultProp:s??null,onChange:c,caller:pz}),[v,y]=l.useState(!1),b=K(u),x=hz(n),S=l.useRef(!1),[C,w]=l.useState(0);return l.useEffect(()=>{let e=p.current;if(e)return e.addEventListener(dz,b),()=>e.removeEventListener(dz,b)},[b]),(0,B.jsx)(yz,{scope:n,orientation:r,dir:h,loop:i,currentTabStopId:g,onItemFocus:l.useCallback(e=>_(e),[_]),onItemShiftTab:l.useCallback(()=>y(!0),[]),onFocusableItemAdd:l.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:l.useCallback(()=>w(e=>e-1),[]),children:(0,B.jsx)(G.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...f,ref:m,style:{outline:`none`,...e.style},onMouseDown:W(e.onMouseDown,()=>{S.current=!0}),onFocus:W(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(dz,fz);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);Oz([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),d)}}S.current=!1}),onBlur:W(e.onBlur,()=>y(!1))})})}),Cz=`RovingFocusGroupItem`,wz=l.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=aM(),u=a||c,d=bz(Cz,n),f=d.currentTabStopId===u,p=hz(n),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:g}=d;return l.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),(0,B.jsx)(mz.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:(0,B.jsx)(G.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...s,ref:t,onMouseDown:W(e.onMouseDown,e=>{r?d.onItemFocus(u):e.preventDefault()}),onFocus:W(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:W(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){d.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Dz(e,d.orientation,d.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=p().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=d.loop?kz(n,r+1):n.slice(r+1)}setTimeout(()=>Oz(n))}}),children:typeof o==`function`?o({isCurrentTabStop:f,hasTabStop:g!=null}):o})})});wz.displayName=Cz;var Tz={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Ez(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Dz(e,t,n){let r=Ez(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Tz[r]}function Oz(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function kz(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Az=xz,jz=wz;Object.entries({"VS Code":{name:`VS Code`,appName:[`Visual Studio Code`,`code`]},Cursor:{name:`Cursor`,appName:[`Cursor`,`cursor`]},Windsurf:{name:`Windsurf`,appName:[`Windsurf`,`windsurf`]},Xcode:{name:`Xcode`,appName:`Xcode`},"Android Studio":{name:`Android Studio`,appName:[`Android Studio`,`studio`]},Kiro:{name:`Kiro`,appName:[`Kiro`,`kiro`]},Terminal:{name:`Terminal`,appName:`Terminal`},"Devin Desktop":{name:`Devin Desktop`,appName:[`Devin`,`Devin Desktop`]},Antigravity:{name:`Antigravity`,appName:[`com.google.antigravity-ide`,`Antigravity IDE`]}}).reduce((e,[t,n])=>(e[t]=n.appName,e),{});var $;(function(e){e.PullRequest=`pull-request`,e.Direct=`direct`})($||={}),$.PullRequest,$.PullRequest,$.Direct,$.Direct;var Mz={bun:{id:`bun`,label:`bun`},npm:{id:`npm`,label:`npm`},yarn:{id:`yarn`,label:`yarn`},pnpm:{id:`pnpm`,label:`pnpm`}},Nz=l.forwardRef((e,t)=>{let n=(0,R.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=U(`rounded-lg border bg-card text-card-foreground shadow-sm`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Nz.displayName=`Card`;var Pz=l.forwardRef((e,t)=>{let n=(0,R.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=U(`flex flex-col space-y-1.5 p-6`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Pz.displayName=`CardHeader`;var Fz=l.forwardRef((e,t)=>{let n=(0,R.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=U(`text-2xl font-semibold leading-none tracking-tight`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Fz.displayName=`CardTitle`;var Iz=l.forwardRef((e,t)=>{let n=(0,R.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=U(`text-sm text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Iz.displayName=`CardDescription`;var Lz=l.forwardRef((e,t)=>{let n=(0,R.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=U(`p-6 pt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Lz.displayName=`CardContent`;var Rz=l.forwardRef((e,t)=>{let n=(0,R.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=U(`flex items-center p-6 pt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Rz.displayName=`CardFooter`;var zz=`Toggle`,Bz=l.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=sM({prop:n,onChange:i,defaultProp:r??!1,caller:zz});return(0,B.jsx)(G.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:W(e.onClick,()=>{e.disabled||s(!o)})})});Bz.displayName=zz;var Vz=Bz,Hz=`ToggleGroup`,[Uz,Wz]=eM(Hz,[vz]),Gz=vz(),Kz=l.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,B.jsx)(Yz,{...r,ref:t});if(n===`multiple`)return(0,B.jsx)(Xz,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${Hz}\``)});Kz.displayName=Hz;var[qz,Jz]=Uz(Hz),Yz=l.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=sM({prop:n,defaultProp:r??``,onChange:i,caller:Hz});return(0,B.jsx)(qz,{scope:e.__scopeToggleGroup,type:`single`,value:l.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:l.useCallback(()=>s(``),[s]),children:(0,B.jsx)($z,{...a,ref:t})})}),Xz=l.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=sM({prop:n,defaultProp:r??[],onChange:i,caller:Hz}),c=l.useCallback(e=>s((t=[])=>[...t,e]),[s]),u=l.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,B.jsx)(qz,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:u,children:(0,B.jsx)($z,{...a,ref:t})})});Kz.displayName=Hz;var[Zz,Qz]=Uz(Hz),$z=l.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=Gz(n),u=kF(o),d={role:`group`,dir:u,...c};return(0,B.jsx)(Zz,{scope:n,rovingFocus:i,disabled:r,children:i?(0,B.jsx)(Az,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,B.jsx)(G.div,{...d,ref:t})}):(0,B.jsx)(G.div,{...d,ref:t})})}),eB=`ToggleGroupItem`,tB=l.forwardRef((e,t)=>{let n=Jz(eB,e.__scopeToggleGroup),r=Qz(eB,e.__scopeToggleGroup),i=Gz(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=l.useRef(null);return r.rovingFocus?(0,B.jsx)(jz,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,B.jsx)(nB,{...s,ref:t})}):(0,B.jsx)(nB,{...s,ref:t})});tB.displayName=eB;var nB=l.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=Jz(eB,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,B.jsx)(Bz,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),rB=Kz,iB=tB,aB=QA(`inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 gap-2`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-accent hover:text-accent-foreground`},size:{default:`h-10 px-3 min-w-10`,sm:`h-9 px-2.5 min-w-9`,lg:`h-11 px-5 min-w-11`}},defaultVariants:{variant:`default`,size:`default`}}),oB=l.forwardRef((e,t)=>{let n=(0,R.c)(13),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:r,variant:o,size:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s;n[5]!==r||n[6]!==a||n[7]!==o?(s=U(aB({variant:o,size:a,className:r})),n[5]=r,n[6]=a,n[7]=o,n[8]=s):s=n[8];let c;return n[9]!==i||n[10]!==t||n[11]!==s?(c=(0,B.jsx)(Vz,{ref:t,className:s,...i}),n[9]=i,n[10]=t,n[11]=s,n[12]=c):c=n[12],c});oB.displayName=Vz.displayName;var sB=l.createContext({size:`default`,variant:`default`}),cB=l.forwardRef((e,t)=>{let n=(0,R.c)(19),r,i,a,o,s;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5]):({className:i,variant:s,size:o,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s);let c;n[6]===i?c=n[7]:(c=U(`flex items-center justify-center gap-1`,i),n[6]=i,n[7]=c);let l;n[8]!==o||n[9]!==s?(l={variant:s,size:o},n[8]=o,n[9]=s,n[10]=l):l=n[10];let u;n[11]!==r||n[12]!==l?(u=(0,B.jsx)(sB.Provider,{value:l,children:r}),n[11]=r,n[12]=l,n[13]=u):u=n[13];let d;return n[14]!==a||n[15]!==t||n[16]!==c||n[17]!==u?(d=(0,B.jsx)(rB,{ref:t,className:c,...a,children:u}),n[14]=a,n[15]=t,n[16]=c,n[17]=u,n[18]=d):d=n[18],d});cB.displayName=rB.displayName;var lB=l.forwardRef((e,t)=>{let n=(0,R.c)(17),r,i,a,o,s;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5]):({className:i,children:r,variant:s,size:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s);let c=l.useContext(sB),u;n[6]!==i||n[7]!==c.size||n[8]!==c.variant||n[9]!==o||n[10]!==s?(u=U(aB({variant:c.variant||s,size:c.size||o}),i),n[6]=i,n[7]=c.size,n[8]=c.variant,n[9]=o,n[10]=s,n[11]=u):u=n[11];let d;return n[12]!==r||n[13]!==a||n[14]!==t||n[15]!==u?(d=(0,B.jsx)(iB,{ref:t,className:u,...a,children:r}),n[12]=r,n[13]=a,n[14]=t,n[15]=u,n[16]=d):d=n[16],d});lB.displayName=iB.displayName;var uB=t({CreateProjectDialog:()=>fB,default:()=>fB}),dB={"angular-standalone":`logo-angular.svg`,"custom-angular":`logo-angular.svg`,react:`logo-react.svg`,"vite-react":`logo-react.svg`,vue:`logo-vue.svg`,"vite-vue":`logo-vue.svg`,"custom-svelte":`logo-svelte.svg`,"custom-ionic-svelte":`logo-svelte.svg`,"vite-svelte":`logo-svelte.svg`,"vite-solid":`logo-solid.svg`,astro:`logo-astro.svg`,nextjs:`logo-nextjs.svg`,nuxt:`logo-nuxt.svg`,"vite-qwik":`logo-qwik.svg`,"vite-preact":`logo-preact.svg`,"vite-lit":`logo-lit.svg`,"vite-web":`logo-web.svg`,"tanstack-start":`logo-vite.svg`,waku:`logo-waku.svg`,hydrogen:`logo-hydrogen.svg`,plugin:`logo-capacitor.svg`};function fB({open:e,onOpenChange:t,initialMode:n,onSubmitClone:r,onSubmitWebApp:i,onOpenFolder:a}){let[o,s]=(0,l.useState)(n??`choice`),[c,u]=(0,l.useState)(1),[d,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(KR($.PullRequest)),[h,g]=(0,l.useState)(`My App`),[_,v]=(0,l.useState)(!1),[y,b]=(0,l.useState)(JR()),[x,S]=(0,l.useState)(WR()),[C,w]=(0,l.useState)([]),[T,E]=(0,l.useState)(!1),[D,O]=(0,l.useState)(!1),[ee,k]=(0,l.useState)(new Set),te=(0,l.useCallback)(e=>{k(t=>new Set(t).add(e))},[]),{typeNames:A,templatesByTypeName:j}=(0,l.useMemo)(()=>{let e={};if(Array.isArray(C))for(let t of C){let n=t.typeName;e[n]||(e[n]=[]),e[n].push(t)}return{typeNames:Object.keys(e).sort(),templatesByTypeName:e}},[C]),M=(0,l.useMemo)(()=>{let e={};for(let t of Object.keys(j)){let n=j[t]??[];if(n.length===0)continue;let r=n.find(e=>e.variationName===`Starter`),i=n.filter(e=>e.variationName!==`Starter`);e[t]=(r?[r,...i]:n)[0].id}return e},[j]),N=(0,l.useMemo)(()=>{if(!Array.isArray(C)||C.find(e=>e.id===y)||C.length===0)return y;let e=A[0],t=e?j[e]??[]:[];return(t.find(e=>e.variationName===`Starter`)??t[0])?.id??y},[y,C,A,j]),P=(0,l.useMemo)(()=>!N||!Array.isArray(C)||C.length===0?null:C.find(e=>e.id===N)?.typeName??null,[N,C]),F=(0,l.useMemo)(()=>{let e=P?j[P]??[]:[];if(e.length<=1)return e;let t=e.find(e=>e.variationName===`Starter`),n=e.filter(e=>e.variationName!==`Starter`);return t?[t,...n]:e},[P,j]);(0,l.useEffect)(()=>{N&&YR(N)},[N]),(0,l.useEffect)(()=>{e&&n&&setTimeout(()=>{s(n),u(2),n===`webapp`&&(g(`My App`),v(!1),k(new Set))},0)},[e,n]),(0,l.useEffect)(()=>{o===`webapp`&&e&&(!Array.isArray(C)||C.length===0)&&setTimeout(()=>{E(!0),PI().then(e=>w(e?.templates||[])).catch(()=>w([])).finally(()=>E(!1))},0)},[o,e,C]);let ne=(0,l.useMemo)(()=>_?h:P?`My ${P} App`:`My App`,[_,h,P]),re=N&&Array.isArray(C)?C.find(e=>e.id===N):null,ie=()=>{s(`webapp`),u(2),g(`My App`),v(!1),k(new Set),(!Array.isArray(C)||C.length===0)&&(E(!0),PI().then(e=>w(e?.templates||[])).catch(()=>w([])).finally(()=>E(!1)))},ae=()=>{s(`clone`),u(2)},oe=()=>{s(`choice`),u(1),f(``),g(`My App`),v(!1),k(new Set),t(!1)},se=()=>{c===2?(s(`choice`),u(1),f(``),g(`My App`),v(!1)):u(e=>e-1)},ce=o===`clone`?d.trim().length>0:P!==null,le=()=>{if(!d.trim())return;let e=d.trim();f(``),u(1),t(!1),s(`choice`),r(e,p).catch(()=>{})},ue=async()=>{if(!ne.trim()||!N||!de(ne))return;if(re?.variation===`vite-plus`){O(!0);try{if(!await FI()){if(!window.confirm(`Vite Plus is required for this template but is not installed.
46
+ `);l=d.pop()??``;for(let e of d){let a=e.trim();if(a)try{let e=JSON.parse(a);if(e.type===`error`){r(e.content??`Unknown error`),n();return}else if(e.type===`message`)i?.({role:e.role??`assistant`,content:e.content??``,isThinking:e.isThinking});else if(e.type===`complete`){n();return}else if(e.type===`result`&&u(e.content)){r(e.content??`Unknown error`),n();return}else t(e)}catch{}}}}catch(e){o||(r(e instanceof Error?e.message:`Stream error`),n())}}return d(),s}async function pL(e,t){return t.runNow&&t.setupScript?TI(`api/projects/${X(e)}`,t):(await AI(`api/projects/${X(e)}`,t),t.runNow||eL(),null)}async function mL(e,t){await kI(`api/projects/${X(e)}/open`,{program:t})}async function hL(e,t){await kI(`api/threads/${X(e)}/open`,{program:t})}async function gL(e,t){await pL(e,{program:t})}async function _L(e,t,n){return pL(e,{setupScript:t,runNow:n})}async function vL(e,t){await pL(e,{name:t})}async function yL(e,t){let n=new URLSearchParams({provider:e});t!==void 0&&n.set(`supportedTools`,t?`true`:`false`),n.set(`useCase`,`coding`);let r=`available-models-${n.toString()}`;return Z.get(r,async()=>{let e=await J(`api/models?${n.toString()}`);return{models:e.models??[],enabledModelIds:e.enabledModelIds??[]}},12e4)}async function bL(e,t){await Y(`api/models/${X(e,t)}/enable`),Z.invalidate(`enabled-models`),Z.invalidatePattern(/^available-models-/),Z.invalidatePattern(/^available-image-models-/)}async function xL(e,t){await Y(`api/models/${X(e,t)}/disable`),Z.invalidate(`enabled-models`),Z.invalidatePattern(/^available-models-/),Z.invalidatePattern(/^available-image-models-/)}async function SL(){return Z.get(`enabled-models`,async()=>(await J(`api/models/enabled?useCase=coding`)).enabledModels??{},12e4)}async function CL(e){let t=new URLSearchParams({provider:e,useCase:`image`}),n=`available-image-models-${e}`;return Z.get(n,async()=>{let e=await J(`api/models?${t.toString()}`);return{models:e.models??[],enabledModelIds:e.enabledModelIds??[]}},12e4)}async function wL(){return Z.get(`enabled-image-models`,async()=>(await J(`api/models/enabled?useCase=image`)).enabledModels??{},12e4)}async function TL(e,t){await Y(`api/models/${X(e,t)}/enable?useCase=image`),Z.invalidate(`enabled-image-models`),Z.invalidatePattern(/^available-models-/),Z.invalidatePattern(/^available-image-models-/)}async function EL(e,t){await Y(`api/models/${X(e,t)}/disable?useCase=image`),Z.invalidate(`enabled-image-models`),Z.invalidatePattern(/^available-models-/),Z.invalidatePattern(/^available-image-models-/)}async function DL(e,t,n,r){return Y(`api/image/generate`,{prompt:e,model:t,provider:n,threadId:r})}async function OL(e){await Y(`api/image/clipboard`,e)}async function kL(e){return Y(`api/image/save`,e)}async function AL(e,t=!1){return J(t?`api/git/unified-status/${X(e)}?fresh=true`:`api/git/unified-status/${X(e)}`)}async function jL(e,t,n){return(await Y(`api/git/generate-commit-message/${X(e)}`,{model:t,provider:n})).message}async function ML(e,t){await Y(`api/git/commit/${X(e)}`,{message:t})}async function NL(e){await Y(`api/git/push/${X(e)}`)}async function PL(e){await Y(`api/git/pull/${X(e)}`)}async function FL(e){return Y(`api/git/sync-branch/${X(e)}`,{})}async function IL(e,t,n){return Y(`api/git/generate-pr-info/${X(e)}`,{model:t,provider:n})}async function LL(e,t,n){return Y(`api/git/create-pr/${X(e)}`,{title:t,description:n})}async function RL(e){await Y(`api/git/fetch/${X(e)}`)}async function zL(e,t,n){return Y(`api/git/create-branch/${X(e)}`,{baseBranch:t,branchName:n})}async function BL(e){return J(`api/git/branches/${X(e)}`)}async function VL(e,t){return Y(`api/git/checkout-branch/${X(e)}`,{branchName:t})}async function HL(e,t){return Y(`api/git/revert-file/${X(e)}`,{filePath:t})}async function UL(e,t=50){return(await J(`api/git/log/${X(e)}?limit=${t}`)).commits}async function WL(e,t,n,r){return Y(`api/git/create-repo/${X(e)}`,{repoName:t,description:n,isPrivate:r})}async function GL(e,t){return Y(`api/git/checkpoint/${X(e)}`,{messageId:t})}async function KL(e,t){return Y(`api/git/checkpoint-restore/${X(e)}`,{checkpointRef:t})}async function qL(e,t){await Y(`api/projects/${X(e)}/commands`,t)}async function JL(e,t){await EI(`api/projects/${X(e)}/commands/${X(t)}`)}async function YL(e){return J(`api/projects/${X(e)}/package-scripts`)}async function XL(e,t,n,r){return DI(`api/projects/${X(e)}/threads/${X(t)}/commands/run`,{commandLine:n,cwd:r})}async function ZL(e){return J(`api/threads/${X(e)}/files`)}async function QL(e){return(await J(`api/threads/${X(e)}/project-scripts`)).scripts}async function $L(e,t,n,r){return DI(`api/threads/${X(e)}/project-scripts/run`,{scriptName:t,command:n},r)}async function eR(e,t){return Y(`api/threads/${X(e)}/project-scripts/stop`,{scriptName:t})}async function tR(e){return J(`api/threads/${e}`)}async function nR(e){return Y(`api/projects/${X(e)}/run-suggest`,{})}async function rR(e,t){return console.log(`API: startDevServer called for project:`,e,`thread:`,t),DI(`api/projects/${X(e)}/run`,{threadId:t})}async function iR(e){return Y(`api/projects/${X(e)}/stop`,{})}async function aR(e){return J(`api/projects/${X(e)}/running`)}async function oR(e,t){await pL(e,{runCommand:t})}async function sR(e){return J(`api/git/diff/${X(e)}`)}async function cR(){return J(`api/onboarding/status`)}async function lR(){return J(`api/onboarding/git-check`)}async function uR(){return Y(`api/onboarding/complete`,{})}async function dR(){return Y(`api/onboarding/reset`,{})}async function fR(e){return(await J(`api/slash-commands?threadId=${X(e)}`)).commands??[]}async function pR(e){let t=await J(`api/slash-commands?threadId=${X(e)}`);return{commands:t.commands??[],skills:t.skills??[]}}async function mR(e,t,n,r,i){return Y(`api/slash-commands`,{name:e,content:t,metadata:n,scope:r,threadId:i})}async function hR(e){let t=await fetch(`http://localhost:641/api/slash-commands`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filePath:e})});if(!t.ok)throw Error(`Failed to delete slash command: ${t.statusText}`);return t.json()}async function gR(e){return J(`api/conversations/${X(e)}`)}async function _R(e,t){return J(`api/conversations/${X(e)}/${X(t)}/context`)}async function vR(){try{return await J(`api/update/check`)}catch{return{updateAvailable:!1,supported:!1}}}async function yR(){return Y(`api/update/apply`)}async function bR(e,t){await Y(`api/ask-user/respond`,{toolCallId:e,answer:t})}async function xR(e,t){await Y(`api/browser-js/respond`,{toolCallId:e,result:t})}async function SR(){return(await J(`api/skills/popular`)).skills??[]}async function CR(){return(await J(`api/agents/popular`)).agents??[]}async function wR(){return(await J(`api/rules/popular`)).rules??[]}async function TR(){return(await J(`api/slash-commands/popular`)).commands??[]}async function ER(e,t,n,r){return Y(`api/threads/${X(e)}/ai-files/github-folder`,{gitHubRepo:t,gitHubFolder:n,destPath:r})}async function DR(e){return J(`api/mcp/config?projectPath=${encodeURIComponent(e)}`)}async function OR(e,t,n){return CI(`api/mcp/config`,{projectPath:e,serverName:t,serverConfig:n})}async function kR(e,t){return EI(`api/mcp/config/${X(t)}?projectPath=${encodeURIComponent(e)}`)}async function AR(){return(await J(`api/mcp/popular`)).servers??[]}async function jR(e){return(await J(`api/projects/${X(e)}/ai-files`)).nodes??[]}async function MR(e,t){return EI(`api/projects/${X(e)}/ai-file?path=${encodeURIComponent(t)}`)}async function NR(e){return(await J(`api/threads/${X(e)}/ai-files`)).nodes??[]}async function PR(e,t){return J(`api/threads/${X(e)}/ai-file?path=${encodeURIComponent(t)}`)}async function FR(e,t,n){return CI(`api/threads/${X(e)}/ai-file`,{path:t,content:n})}async function IR(e,t,n){return Y(`api/threads/${X(e)}/ai-files/skill`,{name:t,description:n})}async function LR(e,t,n,r){return Y(`api/threads/${X(e)}/ai-files/agent`,{name:t,description:n,tools:r})}async function RR(e,t){return EI(`api/threads/${X(e)}/ai-file?path=${encodeURIComponent(t)}`)}Object.entries({"VS Code":{name:`VS Code`,appName:[`Visual Studio Code`,`code`]},Cursor:{name:`Cursor`,appName:[`Cursor`,`cursor`]},Windsurf:{name:`Windsurf`,appName:[`Windsurf`,`windsurf`]},Xcode:{name:`Xcode`,appName:`Xcode`},"Android Studio":{name:`Android Studio`,appName:[`Android Studio`,`studio`]},Kiro:{name:`Kiro`,appName:[`Kiro`,`kiro`]},Terminal:{name:`Terminal`,appName:`Terminal`},"Devin Desktop":{name:`Devin Desktop`,appName:[`Devin`,`Devin Desktop`]},Antigravity:{name:`Antigravity`,appName:[`com.google.antigravity-ide`,`Antigravity IDE`]}}).reduce((e,[t,n])=>(e[t]=n.appName,e),{});var Q;(function(e){e.PullRequest=`pull-request`,e.Direct=`direct`})(Q||={}),Q.PullRequest,Q.PullRequest,Q.Direct,Q.Direct;var zR={bun:{id:`bun`,label:`bun`},npm:{id:`npm`,label:`npm`},yarn:{id:`yarn`,label:`yarn`},pnpm:{id:`pnpm`,label:`pnpm`}},BR=`Processing...`,VR=[`Quick as a fox...`,`Busy as a bee...`,`Steady as a rock...`,`Sharp as a tack...`,`Cool as a cucumber...`,`Bright as a button...`,`Smooth as silk...`,`Swift as the wind...`,`Solid as oak...`,`Calm as a lake...`],$=function(e){return e.PACKAGE_MANAGER=`tarsk.create-project.packageManager`,e.COMMIT_METHOD=`tarsk.create-project.commitMethod`,e.TEMPLATE_ID=`tarsk.create-project.templateId`,e.AUTO_GENERATE_COMMIT_MESSAGE=`autoGenerateCommitMessage`,e.AUTO_GENERATE_PR_INFO=`autoGeneratePRInfo`,e.PRIVATE_REPOSITORY_DEFAULT=`privateRepositoryDefault`,e.SELECTED_MODEL_PREFIX=`selected-model-`,e.SCROLL_POSITION_PREFIX=`scroll-position-`,e.FONT_SCALE=`tarsk.general.fontScale`,e.OPEN_WITH_PROGRAM=`tarsk.general.openWithProgram`,e}({}),HR=function(e){return e.MESSAGE_HISTORY=`chat_message_history`,e}({});function UR(e){return typeof localStorage>`u`?null:localStorage.getItem(e)}function WR(e,t){typeof localStorage>`u`||localStorage.setItem(e,t)}function GR(e){return typeof sessionStorage>`u`?null:sessionStorage.getItem(e)}function KR(e,t){typeof sessionStorage>`u`||sessionStorage.setItem(e,t)}function qR(e=`npm`){return UR($.PACKAGE_MANAGER)??e}function JR(e){WR($.PACKAGE_MANAGER,e)}function YR(e=`pull-request`){return UR($.COMMIT_METHOD)??e}function XR(e){WR($.COMMIT_METHOD,e)}function ZR(e=``){return UR($.TEMPLATE_ID)??e}function QR(e){WR($.TEMPLATE_ID,e)}function $R(e=!1){let t=UR($.AUTO_GENERATE_COMMIT_MESSAGE);return t===null?e:t===`true`}function ez(e){WR($.AUTO_GENERATE_COMMIT_MESSAGE,e.toString())}function tz(e=!1){let t=UR($.AUTO_GENERATE_PR_INFO);return t===null?e:t===`true`}function nz(e){WR($.AUTO_GENERATE_PR_INFO,e.toString())}function rz(e=!1){let t=UR($.PRIVATE_REPOSITORY_DEFAULT);return t===null?e:t===`true`}function iz(e){WR($.PRIVATE_REPOSITORY_DEFAULT,e.toString())}function az(e){let t=UR($.SCROLL_POSITION_PREFIX+e),n=t===null?null:Number(t);return n!==null&&Number.isFinite(n)?n:null}function oz(e,t){WR($.SCROLL_POSITION_PREFIX+e,String(t))}function sz(){let e=GR(HR.MESSAGE_HISTORY);return e?JSON.parse(e):[]}function cz(e){let t=sz();e.trim()&&t[t.length-1]!==e&&(t.push(e),KR(HR.MESSAGE_HISTORY,JSON.stringify(t)))}function lz(e=100){let t=UR($.FONT_SCALE);if(t!==null){let e=Number(t);if(Number.isFinite(e)&&e>=50&&e<=300)return e}return e}function uz(e){WR($.FONT_SCALE,String(e))}function dz(e=`VS Code`){return UR($.OPEN_WITH_PROGRAM)??e}function fz(e){WR($.OPEN_WITH_PROGRAM,e)}function pz(e){let t=e+`CollectionProvider`,[n,r]=eM(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=l.useRef(null),a=l.useRef(new Map).current;return(0,B.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=dM(s),u=l.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,B.jsx)(c,{ref:z(t,a(s,n).collectionRef),children:r})});u.displayName=s;let d=e+`CollectionItemSlot`,f=`data-radix-collection-item`,p=dM(d),m=l.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=l.useRef(null),s=z(t,o),c=a(d,n);return l.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,B.jsx)(p,{[f]:``,ref:s,children:r})});m.displayName=d;function h(t){let n=a(e+`CollectionConsumer`,t);return l.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:u,ItemSlot:m},h,r]}var mz=`rovingFocusGroup.onEntryFocus`,hz={bubbles:!1,cancelable:!0},gz=`RovingFocusGroup`,[_z,vz,yz]=pz(gz),[bz,xz]=eM(gz,[yz]),[Sz,Cz]=bz(gz),wz=l.forwardRef((e,t)=>(0,B.jsx)(_z.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(_z.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(Tz,{...e,ref:t})})}));wz.displayName=gz;var Tz=l.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,p=l.useRef(null),m=z(t,p),h=kF(a),[g,_]=sM({prop:o,defaultProp:s??null,onChange:c,caller:gz}),[v,y]=l.useState(!1),b=K(u),x=vz(n),S=l.useRef(!1),[C,w]=l.useState(0);return l.useEffect(()=>{let e=p.current;if(e)return e.addEventListener(mz,b),()=>e.removeEventListener(mz,b)},[b]),(0,B.jsx)(Sz,{scope:n,orientation:r,dir:h,loop:i,currentTabStopId:g,onItemFocus:l.useCallback(e=>_(e),[_]),onItemShiftTab:l.useCallback(()=>y(!0),[]),onFocusableItemAdd:l.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:l.useCallback(()=>w(e=>e-1),[]),children:(0,B.jsx)(G.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...f,ref:m,style:{outline:`none`,...e.style},onMouseDown:W(e.onMouseDown,()=>{S.current=!0}),onFocus:W(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(mz,hz);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);jz([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),d)}}S.current=!1}),onBlur:W(e.onBlur,()=>y(!1))})})}),Ez=`RovingFocusGroupItem`,Dz=l.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=aM(),u=a||c,d=Cz(Ez,n),f=d.currentTabStopId===u,p=vz(n),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:g}=d;return l.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),(0,B.jsx)(_z.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:(0,B.jsx)(G.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...s,ref:t,onMouseDown:W(e.onMouseDown,e=>{r?d.onItemFocus(u):e.preventDefault()}),onFocus:W(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:W(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){d.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Az(e,d.orientation,d.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=p().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=d.loop?Mz(n,r+1):n.slice(r+1)}setTimeout(()=>jz(n))}}),children:typeof o==`function`?o({isCurrentTabStop:f,hasTabStop:g!=null}):o})})});Dz.displayName=Ez;var Oz={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function kz(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Az(e,t,n){let r=kz(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Oz[r]}function jz(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Mz(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Nz=wz,Pz=Dz,Fz=l.forwardRef((e,t)=>{let n=(0,R.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=U(`rounded-lg border bg-card text-card-foreground shadow-sm`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Fz.displayName=`Card`;var Iz=l.forwardRef((e,t)=>{let n=(0,R.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=U(`flex flex-col space-y-1.5 p-6`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Iz.displayName=`CardHeader`;var Lz=l.forwardRef((e,t)=>{let n=(0,R.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=U(`text-2xl font-semibold leading-none tracking-tight`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Lz.displayName=`CardTitle`;var Rz=l.forwardRef((e,t)=>{let n=(0,R.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=U(`text-sm text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Rz.displayName=`CardDescription`;var zz=l.forwardRef((e,t)=>{let n=(0,R.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=U(`p-6 pt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});zz.displayName=`CardContent`;var Bz=l.forwardRef((e,t)=>{let n=(0,R.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=U(`flex items-center p-6 pt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Bz.displayName=`CardFooter`;var Vz=`Toggle`,Hz=l.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=sM({prop:n,onChange:i,defaultProp:r??!1,caller:Vz});return(0,B.jsx)(G.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:W(e.onClick,()=>{e.disabled||s(!o)})})});Hz.displayName=Vz;var Uz=Hz,Wz=`ToggleGroup`,[Gz,Kz]=eM(Wz,[xz]),qz=xz(),Jz=l.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,B.jsx)(Zz,{...r,ref:t});if(n===`multiple`)return(0,B.jsx)(Qz,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${Wz}\``)});Jz.displayName=Wz;var[Yz,Xz]=Gz(Wz),Zz=l.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=sM({prop:n,defaultProp:r??``,onChange:i,caller:Wz});return(0,B.jsx)(Yz,{scope:e.__scopeToggleGroup,type:`single`,value:l.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:l.useCallback(()=>s(``),[s]),children:(0,B.jsx)(tB,{...a,ref:t})})}),Qz=l.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=sM({prop:n,defaultProp:r??[],onChange:i,caller:Wz}),c=l.useCallback(e=>s((t=[])=>[...t,e]),[s]),u=l.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,B.jsx)(Yz,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:u,children:(0,B.jsx)(tB,{...a,ref:t})})});Jz.displayName=Wz;var[$z,eB]=Gz(Wz),tB=l.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=qz(n),u=kF(o),d={role:`group`,dir:u,...c};return(0,B.jsx)($z,{scope:n,rovingFocus:i,disabled:r,children:i?(0,B.jsx)(Nz,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,B.jsx)(G.div,{...d,ref:t})}):(0,B.jsx)(G.div,{...d,ref:t})})}),nB=`ToggleGroupItem`,rB=l.forwardRef((e,t)=>{let n=Xz(nB,e.__scopeToggleGroup),r=eB(nB,e.__scopeToggleGroup),i=qz(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=l.useRef(null);return r.rovingFocus?(0,B.jsx)(Pz,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,B.jsx)(iB,{...s,ref:t})}):(0,B.jsx)(iB,{...s,ref:t})});rB.displayName=nB;var iB=l.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=Xz(nB,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,B.jsx)(Hz,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),aB=Jz,oB=rB,sB=QA(`inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 gap-2`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-accent hover:text-accent-foreground`},size:{default:`h-10 px-3 min-w-10`,sm:`h-9 px-2.5 min-w-9`,lg:`h-11 px-5 min-w-11`}},defaultVariants:{variant:`default`,size:`default`}}),cB=l.forwardRef((e,t)=>{let n=(0,R.c)(13),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:r,variant:o,size:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s;n[5]!==r||n[6]!==a||n[7]!==o?(s=U(sB({variant:o,size:a,className:r})),n[5]=r,n[6]=a,n[7]=o,n[8]=s):s=n[8];let c;return n[9]!==i||n[10]!==t||n[11]!==s?(c=(0,B.jsx)(Uz,{ref:t,className:s,...i}),n[9]=i,n[10]=t,n[11]=s,n[12]=c):c=n[12],c});cB.displayName=Uz.displayName;var lB=l.createContext({size:`default`,variant:`default`}),uB=l.forwardRef((e,t)=>{let n=(0,R.c)(19),r,i,a,o,s;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5]):({className:i,variant:s,size:o,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s);let c;n[6]===i?c=n[7]:(c=U(`flex items-center justify-center gap-1`,i),n[6]=i,n[7]=c);let l;n[8]!==o||n[9]!==s?(l={variant:s,size:o},n[8]=o,n[9]=s,n[10]=l):l=n[10];let u;n[11]!==r||n[12]!==l?(u=(0,B.jsx)(lB.Provider,{value:l,children:r}),n[11]=r,n[12]=l,n[13]=u):u=n[13];let d;return n[14]!==a||n[15]!==t||n[16]!==c||n[17]!==u?(d=(0,B.jsx)(aB,{ref:t,className:c,...a,children:u}),n[14]=a,n[15]=t,n[16]=c,n[17]=u,n[18]=d):d=n[18],d});uB.displayName=aB.displayName;var dB=l.forwardRef((e,t)=>{let n=(0,R.c)(17),r,i,a,o,s;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5]):({className:i,children:r,variant:s,size:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s);let c=l.useContext(lB),u;n[6]!==i||n[7]!==c.size||n[8]!==c.variant||n[9]!==o||n[10]!==s?(u=U(sB({variant:c.variant||s,size:c.size||o}),i),n[6]=i,n[7]=c.size,n[8]=c.variant,n[9]=o,n[10]=s,n[11]=u):u=n[11];let d;return n[12]!==r||n[13]!==a||n[14]!==t||n[15]!==u?(d=(0,B.jsx)(oB,{ref:t,className:u,...a,children:r}),n[12]=r,n[13]=a,n[14]=t,n[15]=u,n[16]=d):d=n[16],d});dB.displayName=oB.displayName;var fB=t({CreateProjectDialog:()=>mB,default:()=>mB}),pB={"angular-standalone":`logo-angular.svg`,"custom-angular":`logo-angular.svg`,react:`logo-react.svg`,"vite-react":`logo-react.svg`,vue:`logo-vue.svg`,"vite-vue":`logo-vue.svg`,"custom-svelte":`logo-svelte.svg`,"custom-ionic-svelte":`logo-svelte.svg`,"vite-svelte":`logo-svelte.svg`,"vite-solid":`logo-solid.svg`,astro:`logo-astro.svg`,nextjs:`logo-nextjs.svg`,nuxt:`logo-nuxt.svg`,"vite-qwik":`logo-qwik.svg`,"vite-preact":`logo-preact.svg`,"vite-lit":`logo-lit.svg`,"vite-web":`logo-web.svg`,"tanstack-start":`logo-vite.svg`,waku:`logo-waku.svg`,hydrogen:`logo-hydrogen.svg`,plugin:`logo-capacitor.svg`};function mB({open:e,onOpenChange:t,initialMode:n,onSubmitClone:r,onSubmitWebApp:i,onOpenFolder:a}){let[o,s]=(0,l.useState)(n??`choice`),[c,u]=(0,l.useState)(1),[d,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(YR(Q.PullRequest)),[h,g]=(0,l.useState)(`My App`),[_,v]=(0,l.useState)(!1),[y,b]=(0,l.useState)(ZR()),[x,S]=(0,l.useState)(qR()),[C,w]=(0,l.useState)([]),[T,E]=(0,l.useState)(!1),[D,O]=(0,l.useState)(!1),[ee,k]=(0,l.useState)(new Set),te=(0,l.useCallback)(e=>{k(t=>new Set(t).add(e))},[]),{typeNames:A,templatesByTypeName:j}=(0,l.useMemo)(()=>{let e={};if(Array.isArray(C))for(let t of C){let n=t.typeName;e[n]||(e[n]=[]),e[n].push(t)}return{typeNames:Object.keys(e).sort(),templatesByTypeName:e}},[C]),M=(0,l.useMemo)(()=>{let e={};for(let t of Object.keys(j)){let n=j[t]??[];if(n.length===0)continue;let r=n.find(e=>e.variationName===`Starter`),i=n.filter(e=>e.variationName!==`Starter`);e[t]=(r?[r,...i]:n)[0].id}return e},[j]),N=(0,l.useMemo)(()=>{if(!Array.isArray(C)||C.find(e=>e.id===y)||C.length===0)return y;let e=A[0],t=e?j[e]??[]:[];return(t.find(e=>e.variationName===`Starter`)??t[0])?.id??y},[y,C,A,j]),P=(0,l.useMemo)(()=>!N||!Array.isArray(C)||C.length===0?null:C.find(e=>e.id===N)?.typeName??null,[N,C]),F=(0,l.useMemo)(()=>{let e=P?j[P]??[]:[];if(e.length<=1)return e;let t=e.find(e=>e.variationName===`Starter`),n=e.filter(e=>e.variationName!==`Starter`);return t?[t,...n]:e},[P,j]);(0,l.useEffect)(()=>{N&&QR(N)},[N]),(0,l.useEffect)(()=>{e&&n&&setTimeout(()=>{s(n),u(2),n===`webapp`&&(g(`My App`),v(!1),k(new Set))},0)},[e,n]),(0,l.useEffect)(()=>{o===`webapp`&&e&&(!Array.isArray(C)||C.length===0)&&setTimeout(()=>{E(!0),PI().then(e=>w(e?.templates||[])).catch(()=>w([])).finally(()=>E(!1))},0)},[o,e,C]);let ne=(0,l.useMemo)(()=>_?h:P?`My ${P} App`:`My App`,[_,h,P]),re=N&&Array.isArray(C)?C.find(e=>e.id===N):null,ie=()=>{s(`webapp`),u(2),g(`My App`),v(!1),k(new Set),(!Array.isArray(C)||C.length===0)&&(E(!0),PI().then(e=>w(e?.templates||[])).catch(()=>w([])).finally(()=>E(!1)))},ae=()=>{s(`clone`),u(2)},oe=()=>{s(`choice`),u(1),f(``),g(`My App`),v(!1),k(new Set),t(!1)},se=()=>{c===2?(s(`choice`),u(1),f(``),g(`My App`),v(!1)):u(e=>e-1)},ce=o===`clone`?d.trim().length>0:P!==null,le=()=>{if(!d.trim())return;let e=d.trim();f(``),u(1),t(!1),s(`choice`),r(e,p).catch(()=>{})},ue=async()=>{if(!ne.trim()||!N||!de(ne))return;if(re?.variation===`vite-plus`){O(!0);try{if(!await FI()){if(!window.confirm(`Vite Plus is required for this template but is not installed.
47
47
 
48
48
  Is it ok to install Vite Plus using the following command?
49
49
 
50
50
  macOS / Linux: curl -fsSL https://vite.plus | bash
51
- Windows: irm https://vite.plus/ps1 | iex`)){O(!1);return}let{success:e,error:t}=await II();if(!e){window.alert(`Failed to install Vite Plus:\n${t||`Unknown error`}`),O(!1);return}}}catch(e){console.error(`Vite Plus check/install failed:`,e)}finally{O(!1)}}let e=ne.trim();g(``),v(!1),u(1),t(!1),s(`choice`),i(e,N,x).catch(()=>{})},de=e=>e.trim().toLowerCase().replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``),I=o===`choice`?1:c,fe=e=>e===1?I>1:e===2?I>=2:e===3?I>=2&&(o===`clone`?d.trim().length>0:ce):!1,pe=e=>{e===1?(s(`choice`),u(1),f(``),g(``)):u(e)};return(0,B.jsx)(pF,{open:e,onOpenChange:e=>!e&&oe(),children:(0,B.jsxs)(gF,{className:`max-w-2xl h-[min(42rem,90dvh)] flex flex-col p-0 overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`px-6 pt-6 pb-2`,children:[(0,B.jsxs)(`div`,{className:`mx-auto flex items-center gap-1 mb-6 w-2/3`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>fe(1)&&pe(1),className:U(`flex items-center justify-center h-8 w-8 rounded-full text-sm font-medium shrink-0 transition-colors transition-transform duration-300 ease-out`,I===1?`bg-primary text-primary-foreground scale-110`:I>1?`bg-brand text-brand-foreground`:`bg-muted text-muted-foreground`,fe(1)&&`cursor-pointer hover:opacity-90`),"aria-label":`Go to step 1`,children:`1`}),(0,B.jsx)(`div`,{className:`h-0.5 flex-1 min-w-0 relative rounded-full overflow-hidden bg-muted`,children:(0,B.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-brand transition-[width] duration-300 ease-out rounded-full`,style:{width:I>=2?`100%`:`0%`}})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>fe(2)&&pe(2),className:U(`flex items-center justify-center h-8 w-8 rounded-full text-sm font-medium shrink-0 transition-colors transition-transform duration-300 ease-out`,I===2?`bg-primary text-primary-foreground scale-110`:I>2?`bg-brand text-brand-foreground`:`bg-muted text-muted-foreground`,fe(2)&&`cursor-pointer hover:opacity-90`),"aria-label":`Go to step 2`,children:`2`}),(0,B.jsx)(`div`,{className:`h-0.5 flex-1 min-w-0 relative rounded-full overflow-hidden bg-muted`,children:(0,B.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-brand transition-[width] duration-300 ease-out rounded-full`,style:{width:I>=3?`100%`:`0%`}})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>fe(3)&&pe(3),className:U(`flex items-center justify-center h-8 w-8 rounded-full text-sm font-medium shrink-0 transition-colors transition-transform duration-300 ease-out`,I===3?`bg-primary text-primary-foreground scale-110`:`bg-muted text-muted-foreground`,fe(3)&&`cursor-pointer hover:opacity-90`),"aria-label":`Go to step 3`,children:`3`})]}),(0,B.jsxs)(_F,{children:[(0,B.jsxs)(yF,{children:[I===1&&`New Project`,I===2&&o===`clone`&&`Clone Repository`,I===2&&o===`webapp`&&`Create App`,I===3&&o===`clone`&&`Clone Repository`,I===3&&o===`webapp`&&(P===`Capacitor Plugin`?`Create Capacitor Plugin`:P?`Create ${P} App`:`Create App`)]}),(0,B.jsxs)(bF,{children:[I===1&&`Choose how to add a new project.`,I===2&&o===`clone`&&`Enter a git repository URL to clone.`,I===2&&o===`webapp`&&`Choose a template type.`,I===3&&o===`clone`&&`Choose commit workflow.`,I===3&&o===`webapp`&&`Name your project and choose variation, package manager, and commit workflow.`]})]})]}),I===1&&(0,B.jsx)(hI,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,B.jsx)(`div`,{className:`px-6 py-4`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(Nz,{role:`button`,tabIndex:0,className:`cursor-pointer transition-colors hover:border-primary/50 hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:ae,onKeyDown:e=>e.key===`Enter`&&ae(),children:(0,B.jsxs)(Lz,{className:`flex items-start gap-4 p-4`,children:[(0,B.jsx)(`div`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-brand text-brand-foreground`,children:(0,B.jsx)(sp,{className:`h-6 w-6`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,B.jsx)(`p`,{className:`font-semibold`,children:`Clone repo`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect an existing repository by URL`})]})]})}),(0,B.jsx)(Nz,{role:`button`,tabIndex:0,className:`cursor-pointer transition-colors hover:border-primary/50 hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:ie,onKeyDown:e=>e.key===`Enter`&&ie(),children:(0,B.jsxs)(Lz,{className:`flex items-start gap-4 p-4`,children:[(0,B.jsx)(`div`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-brand text-brand-foreground`,children:(0,B.jsx)(ub,{className:`h-6 w-6`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,B.jsx)(`p`,{className:`font-semibold`,children:`Create App`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Scaffold a new React, Vue, Next.js, or other template`})]})]})}),(0,B.jsx)(Nz,{role:`button`,tabIndex:0,className:`cursor-pointer transition-colors hover:border-primary/50 hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>{oe(),a()},onKeyDown:e=>{e.key===`Enter`&&(oe(),a())},children:(0,B.jsxs)(Lz,{className:`flex items-start gap-4 p-4`,children:[(0,B.jsx)(`div`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-brand text-brand-foreground`,children:(0,B.jsx)(yf,{className:`h-6 w-6`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,B.jsx)(`p`,{className:`font-semibold`,children:`Open Folder`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create a project from an existing local folder`})]})]})})]})})}),I===2&&o===`clone`&&(0,B.jsx)(hI,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,B.jsx)(`div`,{className:`px-6 py-4`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(DF,{htmlFor:`gitUrl`,children:`Repository URL`}),(0,B.jsx)(xF,{id:`gitUrl`,placeholder:`https://github.com/user/repo.git`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>e.key===`Enter`&&ce&&u(3),autoFocus:!0})]})})}),I===2&&o===`webapp`&&(0,B.jsx)(`div`,{className:`flex flex-col flex-1 min-h-0 px-6 pb-4`,children:(0,B.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col py-2`,children:(0,B.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto -mx-1`,children:(0,B.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2 p-1 mr-2`,children:T?(0,B.jsx)(`p`,{className:`col-span-full p-4 text-sm text-muted-foreground`,children:`Loading…`}):A.map(e=>{let t=j[e]?.[0]?.type,n=t?dB[t]:null;return(0,B.jsxs)(`button`,{type:`button`,onClick:()=>b(M[e]??``),onDoubleClick:()=>{b(M[e]??``),u(3)},className:U(`flex flex-col items-center gap-2 rounded-lg border px-3 py-3 text-center transition-colors`,P===e?`border-primary bg-accent text-accent-foreground`:`border-border bg-card hover:bg-muted/50 hover:border-muted-foreground/30 shadow-sm`),children:[n?(0,B.jsx)(`img`,{src:`/template-types/${n}`,alt:``,className:U(`size-8 shrink-0 transition-opacity duration-300`,ee.has(n)?`opacity-100`:`opacity-0`),onLoad:()=>te(n),"aria-hidden":!0}):null,(0,B.jsx)(`span`,{className:`font-medium text-sm truncate w-full`,children:e})]},e)})})})})}),I===3&&o===`webapp`&&(0,B.jsx)(hI,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,B.jsxs)(`div`,{className:`px-6 py-4 flex flex-col gap-6`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(DF,{htmlFor:`projectName`,children:`Project name`}),(0,B.jsx)(xF,{id:`projectName`,placeholder:`My App`,value:ne,onChange:e=>{g(e.target.value),v(!0)},className:`max-w-xs`})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[F.length>1&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(DF,{className:`text-sm font-medium`,children:`Variation`}),(0,B.jsx)(cB,{type:`single`,value:N,onValueChange:e=>e&&b(e),variant:`outline`,className:`flex flex-wrap gap-0 justify-start [&>button]:rounded-none [&>button:first-child]:rounded-l-md [&>button:last-child]:rounded-r-md [&>button:not(:first-child)]:-ml-px`,children:F.map(e=>(0,B.jsx)(lB,{value:e.id,className:`text-sm`,children:e.variationName},e.id))})]}),(0,B.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[re?.description??F[0]?.description??``,re?.url&&(0,B.jsxs)(B.Fragment,{children:[` `,(0,B.jsxs)(`a`,{href:re.url,target:`_blank`,rel:`noreferrer`,className:`text-brand hover:underline hover:text-brand/80 inline-flex items-center gap-0.5`,children:[`Documentation `,(0,B.jsx)(mu,{className:`h-3 w-3`})]})]})]})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(DF,{className:`text-sm font-medium`,children:`Package manager`}),(0,B.jsx)(cB,{type:`single`,value:x,onValueChange:e=>{e&&(S(e),GR(e))},variant:`outline`,className:`flex flex-wrap gap-0 justify-start [&>button]:rounded-none [&>button:first-child]:rounded-l-md [&>button:last-child]:rounded-r-md [&>button:not(:first-child)]:-ml-px`,children:Object.values(Mz).map(e=>(0,B.jsx)(lB,{value:e.id,className:`text-sm`,children:e.label},e.id))})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(DF,{className:`text-sm font-medium`,children:`Commit method`}),(0,B.jsxs)(cB,{type:`single`,value:p,onValueChange:e=>{(e===$.PullRequest||e===$.Direct)&&(m(e),qR(e))},variant:`outline`,className:`flex flex-wrap gap-0 justify-start [&>button]:rounded-none [&>button:first-child]:rounded-l-md [&>button:last-child]:rounded-r-md [&>button:not(:first-child)]:-ml-px`,children:[(0,B.jsx)(lB,{value:$.PullRequest,className:`text-sm`,children:`Pull Requests`}),(0,B.jsx)(lB,{value:$.Direct,className:`text-sm`,children:`Direct Commits`})]}),(0,B.jsx)(`p`,{className:`text-xs text-slate-600 dark:text-slate-400`,children:p===$.PullRequest?`Creates a feature branch and allows you to create pull requests.`:`Commits directly to the main branch without creating feature branches.`})]})]})}),I===3&&o===`clone`&&(0,B.jsx)(hI,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,B.jsx)(`div`,{className:`px-6 py-4 flex flex-col gap-6`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(DF,{className:`text-sm font-medium`,children:`Commit method`}),(0,B.jsxs)(cB,{type:`single`,value:p,onValueChange:e=>{(e===$.PullRequest||e===$.Direct)&&(m(e),qR(e))},variant:`outline`,className:`flex flex-wrap gap-0 justify-start [&>button]:rounded-none [&>button:first-child]:rounded-l-md [&>button:last-child]:rounded-r-md [&>button:not(:first-child)]:-ml-px`,children:[(0,B.jsx)(lB,{value:$.PullRequest,className:`text-sm`,children:`Pull Requests`}),(0,B.jsx)(lB,{value:$.Direct,className:`text-sm`,children:`Direct Commits`})]}),(0,B.jsx)(`p`,{className:`text-xs text-slate-600 dark:text-slate-400`,children:p===$.PullRequest?`Creates a feature branch and allows you to create pull requests.`:`Commits directly to the main branch without creating feature branches.`})]})})}),(0,B.jsx)(`div`,{className:`px-6 py-4 border-t border-border bg-muted/10 min-h-[4.5rem] flex flex-col justify-end`,children:(0,B.jsxs)(vF,{children:[I>1&&(0,B.jsx)(Qj,{variant:`ghost`,onClick:se,children:`Back`}),I===2&&(0,B.jsx)(Qj,{onClick:()=>u(3),disabled:!ce,children:`Next`}),I===3&&o===`clone`&&(0,B.jsx)(Qj,{onClick:le,children:`Clone Repository`}),I===3&&o===`webapp`&&(0,B.jsx)(Qj,{onClick:ue,disabled:!ne.trim()||D,children:D?`Preparing...`:`Create App`})]})})]})})}export{yL as $,Qo as $i,sF as $n,Ow as $r,ZI as $t,uL as A,zp as Ai,EI as An,Jj as Ar,zI as At,IR as B,Ed as Bi,DF as Bn,_k as Br,ML as Bt,tz as C,Og as Ci,pL as Cn,W as Cr,TR as Ct,yR as D,Xm as Di,oR as Dn,Xj as Dr,QL as Dt,jI as E,vh as Ei,_L as En,U as Er,jR as Et,XI as F,cp as Fi,Y as Fn,z as Fr,PR as Ft,hR as G,mu as Gi,bF as Gn,lO as Gr,PL as Gt,kR as H,Bu as Hi,xF as Hn,YO as Hr,LL as Ht,LI as I,sp as Ii,CI as In,MA as Ir,NR as It,EL as J,Xc as Ji,yF as Jn,QE as Jr,FL as Jt,nL as K,Rl as Ki,vF as Kn,UD as Kr,NL as Kt,mR as L,Af as Li,hI as Ln,OA as Lr,ZL as Lt,OL as M,xp as Mi,J as Mn,HA as Mr,fR as Mt,GL as N,bp as Ni,vI as Nn,IA as Nr,pR as Nt,vR as O,Mm as Oi,rL as On,qj as Or,YI as Ot,WL as P,dp as Pi,wI as Pn,PA as Pr,tR as Pt,CL as Q,Ms as Qi,cF as Qn,Rw as Qr,UI as Qt,tL as R,yf as Ri,AF as Rn,TA as Rr,AL as Rt,lz as S,y_ as Si,nR as Sn,eM as Sr,SR as St,MI as T,sg as Ti,gL as Tn,Zj as Tr,QI as Tt,$I as U,_u as Ui,pF as Un,yO as Ur,RL as Ut,JL as V,_d as Vi,SF as Vn,mk as Vr,zL as Vt,MR as W,gu as Wi,gF as Wn,vO as Wr,BL as Wt,TL as X,Ic as Xi,lF as Xn,_E as Xr,eL as Xt,xL as Y,Wc as Yi,fF as Yn,NE as Yr,ER as Yt,bL as Z,Pc as Zi,dF as Zn,oE as Zr,aR as Zt,ez as _,i as _a,Ov as _i,iR as _n,dM as _r,cR as _t,Fz as a,Wa as aa,DS as ai,XL as an,wP as ar,wL as at,$R as b,rv as bi,xR as bn,aM as br,AR as bt,Az as c,Kr as ca,ix as ci,kL as cn,eN as cr,oL as ct,az as d,xt as da,ub as di,VI as dn,PM as dr,gR as dt,Uo as ea,AC as ei,mL as en,aF as er,iL as et,XR as f,st as fa,lb as fi,FR as fn,EM as fr,sR as ft,cz as g,o as ga,kv as gi,dL as gn,vM as gr,DR as gt,iz as h,c as ha,Iy as hi,rR as hn,G as hr,JI as ht,Pz as i,Ga as ia,pC as ii,KL as in,DP as ir,WI as it,uR as j,Dp as ji,X as jn,QA as jr,RI as jt,lR as k,Gp as ki,Z as kn,Yj as kr,BI as kt,vz as l,Br as la,ex as li,OR as ln,QM as lr,_R as lt,oz as m,We as ma,qy as mi,cL as mn,K as mr,qI as mt,Nz as n,oo as na,OC as ni,fL as nn,oF as nr,DL as nt,$ as o,Va as oa,TS as oi,$L as on,hP as or,SL as ot,QR as p,et as pa,Zy as pi,aL as pn,NM as pr,UL as pt,RR as q,Ml as qi,_F as qn,fD as qr,HL as qt,Lz as r,Ka as ra,vC as ri,dR as rn,eF as rr,IL as rt,jz as s,Ma as sa,dS as si,qL as sn,aN as sr,GI as st,uB as t,_o as ta,kC as ti,hL as tn,uF as tr,jL as tt,uz as u,vr as ua,wb as ui,HI as un,zM as ur,sL as ut,nz as v,mv as vi,eR as vn,mM as vr,YL as vt,rz as w,Sg as wi,vL as wn,Qj as wr,KI as wt,sz as x,ev as xi,lL as xn,nM as xr,wR as xt,ZR as y,dv as yi,bR as yn,sM as yr,CR as yt,LR as z,uf as zi,kF as zn,Kk as zr,VL as zt};
51
+ Windows: irm https://vite.plus/ps1 | iex`)){O(!1);return}let{success:e,error:t}=await II();if(!e){window.alert(`Failed to install Vite Plus:\n${t||`Unknown error`}`),O(!1);return}}}catch(e){console.error(`Vite Plus check/install failed:`,e)}finally{O(!1)}}let e=ne.trim();g(``),v(!1),u(1),t(!1),s(`choice`),i(e,N,x).catch(()=>{})},de=e=>e.trim().toLowerCase().replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``),I=o===`choice`?1:c,fe=e=>e===1?I>1:e===2?I>=2:e===3?I>=2&&(o===`clone`?d.trim().length>0:ce):!1,pe=e=>{e===1?(s(`choice`),u(1),f(``),g(``)):u(e)};return(0,B.jsx)(pF,{open:e,onOpenChange:e=>!e&&oe(),children:(0,B.jsxs)(gF,{className:`max-w-2xl h-[min(42rem,90dvh)] flex flex-col p-0 overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`px-6 pt-6 pb-2`,children:[(0,B.jsxs)(`div`,{className:`mx-auto flex items-center gap-1 mb-6 w-2/3`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>fe(1)&&pe(1),className:U(`flex items-center justify-center h-8 w-8 rounded-full text-sm font-medium shrink-0 transition-colors transition-transform duration-300 ease-out`,I===1?`bg-primary text-primary-foreground scale-110`:I>1?`bg-brand text-brand-foreground`:`bg-muted text-muted-foreground`,fe(1)&&`cursor-pointer hover:opacity-90`),"aria-label":`Go to step 1`,children:`1`}),(0,B.jsx)(`div`,{className:`h-0.5 flex-1 min-w-0 relative rounded-full overflow-hidden bg-muted`,children:(0,B.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-brand transition-[width] duration-300 ease-out rounded-full`,style:{width:I>=2?`100%`:`0%`}})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>fe(2)&&pe(2),className:U(`flex items-center justify-center h-8 w-8 rounded-full text-sm font-medium shrink-0 transition-colors transition-transform duration-300 ease-out`,I===2?`bg-primary text-primary-foreground scale-110`:I>2?`bg-brand text-brand-foreground`:`bg-muted text-muted-foreground`,fe(2)&&`cursor-pointer hover:opacity-90`),"aria-label":`Go to step 2`,children:`2`}),(0,B.jsx)(`div`,{className:`h-0.5 flex-1 min-w-0 relative rounded-full overflow-hidden bg-muted`,children:(0,B.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-brand transition-[width] duration-300 ease-out rounded-full`,style:{width:I>=3?`100%`:`0%`}})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>fe(3)&&pe(3),className:U(`flex items-center justify-center h-8 w-8 rounded-full text-sm font-medium shrink-0 transition-colors transition-transform duration-300 ease-out`,I===3?`bg-primary text-primary-foreground scale-110`:`bg-muted text-muted-foreground`,fe(3)&&`cursor-pointer hover:opacity-90`),"aria-label":`Go to step 3`,children:`3`})]}),(0,B.jsxs)(_F,{children:[(0,B.jsxs)(yF,{children:[I===1&&`New Project`,I===2&&o===`clone`&&`Clone Repository`,I===2&&o===`webapp`&&`Create App`,I===3&&o===`clone`&&`Clone Repository`,I===3&&o===`webapp`&&(P===`Capacitor Plugin`?`Create Capacitor Plugin`:P?`Create ${P} App`:`Create App`)]}),(0,B.jsxs)(bF,{children:[I===1&&`Choose how to add a new project.`,I===2&&o===`clone`&&`Enter a git repository URL to clone.`,I===2&&o===`webapp`&&`Choose a template type.`,I===3&&o===`clone`&&`Choose commit workflow.`,I===3&&o===`webapp`&&`Name your project and choose variation, package manager, and commit workflow.`]})]})]}),I===1&&(0,B.jsx)(hI,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,B.jsx)(`div`,{className:`px-6 py-4`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(Fz,{role:`button`,tabIndex:0,className:`cursor-pointer transition-colors hover:border-primary/50 hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:ae,onKeyDown:e=>e.key===`Enter`&&ae(),children:(0,B.jsxs)(zz,{className:`flex items-start gap-4 p-4`,children:[(0,B.jsx)(`div`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-brand text-brand-foreground`,children:(0,B.jsx)(sp,{className:`h-6 w-6`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,B.jsx)(`p`,{className:`font-semibold`,children:`Clone repo`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect an existing repository by URL`})]})]})}),(0,B.jsx)(Fz,{role:`button`,tabIndex:0,className:`cursor-pointer transition-colors hover:border-primary/50 hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:ie,onKeyDown:e=>e.key===`Enter`&&ie(),children:(0,B.jsxs)(zz,{className:`flex items-start gap-4 p-4`,children:[(0,B.jsx)(`div`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-brand text-brand-foreground`,children:(0,B.jsx)(ub,{className:`h-6 w-6`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,B.jsx)(`p`,{className:`font-semibold`,children:`Create App`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Scaffold a new React, Vue, Next.js, or other template`})]})]})}),(0,B.jsx)(Fz,{role:`button`,tabIndex:0,className:`cursor-pointer transition-colors hover:border-primary/50 hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>{oe(),a()},onKeyDown:e=>{e.key===`Enter`&&(oe(),a())},children:(0,B.jsxs)(zz,{className:`flex items-start gap-4 p-4`,children:[(0,B.jsx)(`div`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-brand text-brand-foreground`,children:(0,B.jsx)(yf,{className:`h-6 w-6`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,B.jsx)(`p`,{className:`font-semibold`,children:`Open Folder`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create a project from an existing local folder`})]})]})})]})})}),I===2&&o===`clone`&&(0,B.jsx)(hI,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,B.jsx)(`div`,{className:`px-6 py-4`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(DF,{htmlFor:`gitUrl`,children:`Repository URL`}),(0,B.jsx)(xF,{id:`gitUrl`,placeholder:`https://github.com/user/repo.git`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>e.key===`Enter`&&ce&&u(3),autoFocus:!0})]})})}),I===2&&o===`webapp`&&(0,B.jsx)(`div`,{className:`flex flex-col flex-1 min-h-0 px-6 pb-4`,children:(0,B.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col py-2`,children:(0,B.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto -mx-1`,children:(0,B.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2 p-1 mr-2`,children:T?(0,B.jsx)(`p`,{className:`col-span-full p-4 text-sm text-muted-foreground`,children:`Loading…`}):A.map(e=>{let t=j[e]?.[0]?.type,n=t?pB[t]:null;return(0,B.jsxs)(`button`,{type:`button`,onClick:()=>b(M[e]??``),onDoubleClick:()=>{b(M[e]??``),u(3)},className:U(`flex flex-col items-center gap-2 rounded-lg border px-3 py-3 text-center transition-colors`,P===e?`border-primary bg-accent text-accent-foreground`:`border-border bg-card hover:bg-muted/50 hover:border-muted-foreground/30 shadow-sm`),children:[n?(0,B.jsx)(`img`,{src:`/template-types/${n}`,alt:``,className:U(`size-8 shrink-0 transition-opacity duration-300`,ee.has(n)?`opacity-100`:`opacity-0`),onLoad:()=>te(n),"aria-hidden":!0}):null,(0,B.jsx)(`span`,{className:`font-medium text-sm truncate w-full`,children:e})]},e)})})})})}),I===3&&o===`webapp`&&(0,B.jsx)(hI,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,B.jsxs)(`div`,{className:`px-6 py-4 flex flex-col gap-6`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(DF,{htmlFor:`projectName`,children:`Project name`}),(0,B.jsx)(xF,{id:`projectName`,placeholder:`My App`,value:ne,onChange:e=>{g(e.target.value),v(!0)},className:`max-w-xs`})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[F.length>1&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(DF,{className:`text-sm font-medium`,children:`Variation`}),(0,B.jsx)(uB,{type:`single`,value:N,onValueChange:e=>e&&b(e),variant:`outline`,className:`flex flex-wrap gap-0 justify-start [&>button]:rounded-none [&>button:first-child]:rounded-l-md [&>button:last-child]:rounded-r-md [&>button:not(:first-child)]:-ml-px`,children:F.map(e=>(0,B.jsx)(dB,{value:e.id,className:`text-sm`,children:e.variationName},e.id))})]}),(0,B.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[re?.description??F[0]?.description??``,re?.url&&(0,B.jsxs)(B.Fragment,{children:[` `,(0,B.jsxs)(`a`,{href:re.url,target:`_blank`,rel:`noreferrer`,className:`text-brand hover:underline hover:text-brand/80 inline-flex items-center gap-0.5`,children:[`Documentation `,(0,B.jsx)(mu,{className:`h-3 w-3`})]})]})]})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(DF,{className:`text-sm font-medium`,children:`Package manager`}),(0,B.jsx)(uB,{type:`single`,value:x,onValueChange:e=>{e&&(S(e),JR(e))},variant:`outline`,className:`flex flex-wrap gap-0 justify-start [&>button]:rounded-none [&>button:first-child]:rounded-l-md [&>button:last-child]:rounded-r-md [&>button:not(:first-child)]:-ml-px`,children:Object.values(zR).map(e=>(0,B.jsx)(dB,{value:e.id,className:`text-sm`,children:e.label},e.id))})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(DF,{className:`text-sm font-medium`,children:`Commit method`}),(0,B.jsxs)(uB,{type:`single`,value:p,onValueChange:e=>{(e===Q.PullRequest||e===Q.Direct)&&(m(e),XR(e))},variant:`outline`,className:`flex flex-wrap gap-0 justify-start [&>button]:rounded-none [&>button:first-child]:rounded-l-md [&>button:last-child]:rounded-r-md [&>button:not(:first-child)]:-ml-px`,children:[(0,B.jsx)(dB,{value:Q.PullRequest,className:`text-sm`,children:`Pull Requests`}),(0,B.jsx)(dB,{value:Q.Direct,className:`text-sm`,children:`Direct Commits`})]}),(0,B.jsx)(`p`,{className:`text-xs text-slate-600 dark:text-slate-400`,children:p===Q.PullRequest?`Creates a feature branch and allows you to create pull requests.`:`Commits directly to the main branch without creating feature branches.`})]})]})}),I===3&&o===`clone`&&(0,B.jsx)(hI,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,B.jsx)(`div`,{className:`px-6 py-4 flex flex-col gap-6`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(DF,{className:`text-sm font-medium`,children:`Commit method`}),(0,B.jsxs)(uB,{type:`single`,value:p,onValueChange:e=>{(e===Q.PullRequest||e===Q.Direct)&&(m(e),XR(e))},variant:`outline`,className:`flex flex-wrap gap-0 justify-start [&>button]:rounded-none [&>button:first-child]:rounded-l-md [&>button:last-child]:rounded-r-md [&>button:not(:first-child)]:-ml-px`,children:[(0,B.jsx)(dB,{value:Q.PullRequest,className:`text-sm`,children:`Pull Requests`}),(0,B.jsx)(dB,{value:Q.Direct,className:`text-sm`,children:`Direct Commits`})]}),(0,B.jsx)(`p`,{className:`text-xs text-slate-600 dark:text-slate-400`,children:p===Q.PullRequest?`Creates a feature branch and allows you to create pull requests.`:`Commits directly to the main branch without creating feature branches.`})]})})}),(0,B.jsx)(`div`,{className:`px-6 py-4 border-t border-border bg-muted/10 min-h-[4.5rem] flex flex-col justify-end`,children:(0,B.jsxs)(vF,{children:[I>1&&(0,B.jsx)(Qj,{variant:`ghost`,onClick:se,children:`Back`}),I===2&&(0,B.jsx)(Qj,{onClick:()=>u(3),disabled:!ce,children:`Next`}),I===3&&o===`clone`&&(0,B.jsx)(Qj,{onClick:le,children:`Clone Repository`}),I===3&&o===`webapp`&&(0,B.jsx)(Qj,{onClick:ue,disabled:!ne.trim()||D,children:D?`Preparing...`:`Create App`})]})})]})})}export{bL as $,Pc as $i,dF as $n,oE as $r,aR as $t,vR as A,Mm as Ai,rL as An,qj as Ar,YI as At,tL as B,yf as Bi,AF as Bn,TA as Br,AL as Bt,oz as C,ev as Ci,lL as Cn,nM as Cr,wR as Ct,MI as D,sg as Di,gL as Dn,Zj as Dr,QI as Dt,Q as E,Sg as Ei,vL as En,Qj as Er,KI as Et,GL as F,bp as Fi,vI as Fn,IA as Fr,pR as Ft,$I as G,_u as Gi,pF as Gn,yO as Gr,RL as Gt,IR as H,Ed as Hi,DF as Hn,_k as Hr,ML as Ht,WL as I,dp as Ii,wI as In,PA as Ir,tR as It,nL as J,Rl as Ji,vF as Jn,UD as Jr,NL as Jt,MR as K,gu as Ki,gF as Kn,vO as Kr,BL as Kt,XI as L,cp as Li,Y as Ln,z as Lr,PR as Lt,uL as M,zp as Mi,EI as Mn,Jj as Mr,zI as Mt,uR as N,Dp as Ni,X as Nn,QA as Nr,RI as Nt,jI as O,vh as Oi,_L as On,U as Or,jR as Ot,OL as P,xp as Pi,J as Pn,HA as Pr,fR as Pt,TL as Q,Ic as Qi,lF as Qn,_E as Qr,eL as Qt,LI as R,sp as Ri,CI as Rn,MA as Rr,NR as Rt,iz as S,rv as Si,xR as Sn,aM as Sr,AR as St,VR as T,Og as Ti,pL as Tn,W as Tr,TR as Tt,JL as U,_d as Ui,SF as Un,mk as Ur,zL as Ut,LR as V,uf as Vi,kF as Vn,Kk as Vr,VL as Vt,kR as W,Bu as Wi,xF as Wn,YO as Wr,LL as Wt,EL as X,Xc as Xi,yF as Xn,QE as Xr,FL as Xt,RR as Y,Ml as Yi,_F as Yn,fD as Yr,HL as Yt,xL as Z,Wc as Zi,fF as Zn,NE as Zr,ER as Zt,az as _,c as _a,Iy as _i,rR as _n,G as _r,JI as _t,Lz as a,Ka as aa,vC as ai,dR as an,eF as ar,IL as at,uz as b,mv as bi,eR as bn,mM as br,YL as bt,xz as c,Va as ca,TS as ci,$L as cn,hP as cr,SL as ct,$R as d,Br as da,ex as di,OR as dn,QM as dr,_R as dt,Ms as ea,Rw as ei,UI as en,cF as er,CL as et,tz as f,vr as fa,wb as fi,HI as fn,zM as fr,sL as ft,rz as g,We as ga,qy as gi,cL as gn,K as gr,qI as gt,dz as h,et as ha,Zy as hi,aL as hn,NM as hr,UL as ht,Iz as i,oo as ia,OC as ii,fL as in,oF as ir,DL as it,lR as j,Gp as ji,Z as jn,Yj as jr,BI as jt,yR as k,Xm as ki,oR as kn,Xj as kr,QL as kt,pz as l,Ma as la,dS as li,qL as ln,aN as lr,GI as lt,sz as m,st as ma,lb as mi,FR as mn,EM as mr,sR as mt,Fz as n,Uo as na,AC as ni,mL as nn,aF as nr,iL as nt,Pz as o,Ga as oa,pC as oi,KL as on,DP as or,WI as ot,lz as p,xt as pa,ub as pi,VI as pn,PM as pr,gR as pt,hR as q,mu as qi,bF as qn,lO as qr,PL as qt,zz as r,_o as ra,kC as ri,hL as rn,uF as rr,jL as rt,Nz as s,Wa as sa,DS as si,XL as sn,wP as sr,wL as st,fB as t,Qo as ta,Ow as ti,ZI as tn,sF as tr,yL as tt,cz as u,Kr as ua,ix as ui,kL as un,eN as ur,oL as ut,ez as v,o as va,kv as vi,dL as vn,vM as vr,DR as vt,BR as w,y_ as wi,nR as wn,eM as wr,SR as wt,fz as x,dv as xi,bR as xn,sM as xr,CR as xt,nz as y,i as ya,Ov as yi,iR as yn,dM as yr,cR as yt,mR as z,Af as zi,hI as zn,OA as zr,ZL as zt};
@@ -0,0 +1,3 @@
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{An as t,Bi as n,Ci as r,Er as i,Fr as a,Gn as o,Hi as s,It as c,Jn as l,Kn as u,Or as d,Ti as f,Xn as p,Yn as m,Yt as h,_a as g,ci as _,ct as v,gi as y,hi as b,mt as x,nt as S,oa as C,sa as w,wi as T,xi as E,ya as D,zi as O,zn as k}from"./dialogs-config-VlhyoYms.js";import{D as ee}from"./react-vendor-CtZx3FWA.js";import{Mt as A}from"./monaco-BGyhgQtx.js";import{a as j,t as M}from"./store-DUqJt-K-.js";import{t as N}from"./textarea-DuuNwegn.js";import{c as P,s as te,u as ne}from"./history-view-Cub-F9g6.js";import{b as re,t as ie}from"./chat-input-container-Bc7nCdKX.js";import{t as F}from"./standard-list-item-0m99qNoa.js";import{n as ae}from"./utils-CheqpoJ4.js";import{t as oe}from"./page-toolbar-CU9dGLvm.js";import{n as se,r as ce,t as I}from"./resizable-AKojmHeo.js";import{a as L,n as R,r as le,t as z}from"./context-menu-D93N09Jw.js";var B=e(D(),1),V=g(),H=a();function U(e){let t=(0,V.c)(17),{children:n,title:r,headerAction:i,footer:a}=e,o;t[0]===r?o=t[1]:(o=r&&(0,H.jsx)(`span`,{className:`text-sm font-semibold tracking-tight`,children:r}),t[0]=r,t[1]=o);let s;t[2]===o?s=t[3]:(s=(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:o}),t[2]=o,t[3]=s);let c;t[4]===i?c=t[5]:(c=i&&(0,H.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-sidebar-border px-4 py-6`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=(0,H.jsx)(k,{className:`flex-1`,children:n}),t[9]=n,t[10]=u);let d;t[11]===a?d=t[12]:(d=a&&(0,H.jsx)(`div`,{className:`border-t border-sidebar-border`,children:a}),t[11]=a,t[12]=d);let f;return t[13]!==l||t[14]!==u||t[15]!==d?(f=(0,H.jsxs)(`div`,{className:`flex flex-col h-full`,children:[l,u,d]}),t[13]=l,t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function ue(e){let t=[],n={};return e.forEach((e,r)=>{let i=e.path.split(`/`),a=t,o=``;for(let e=0;e<i.length-1;e++){if(o=o?`${o}/${i[e]}`:i[e],!n[o]){let t={id:`dir:${o}`,name:i[e],children:[]};n[o]=t,a.push(t)}a=n[o].children}a.push({id:`file:${e.path}`,name:i[i.length-1],fileIndex:r,status:e.status})}),t}var W={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},G={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function K(e){return d(`status-badge font-mono text-xs font-semibold`,W[e]??`text-orange-500`)}function de(e){return G[e]??`M`}function fe(e){let t=(0,V.c)(37),{treeData:r,files:i,isLoading:a,error:o,selectedFileIndex:c,onFileSelect:l,onRevertFile:u}=e,p;t[0]===i?p=t[1]:(p=i.reduce(he,0),t[0]=i,t[1]=p);let m=p,h;t[2]===i?h=t[3]:(h=i.reduce(pe,0),t[2]=i,t[3]=h);let g=h,v=i.length===1?``:`s`,y;t[4]!==i.length||t[5]!==v?(y=(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[i.length,` file`,v]}),t[4]=i.length,t[5]=v,t[6]=y):y=t[6];let b;t[7]===m?b=t[8]:(b=(0,H.jsxs)(`span`,{className:`text-xs text-green-500`,children:[`+`,m]}),t[7]=m,t[8]=b);let x;t[9]===g?x=t[10]:(x=(0,H.jsxs)(`span`,{className:`text-xs text-red-500`,children:[`-`,g]}),t[9]=g,t[10]=x);let S;t[11]!==y||t[12]!==b||t[13]!==x?(S=(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[y,b,x]}),t[11]=y,t[12]=b,t[13]=x,t[14]=S):S=t[14];let w=S;if(a){let e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center pt-3 pb-2`,children:(0,H.jsx)(f,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),t[15]=e):e=t[15];let n;return t[16]===w?n=t[17]:(n=(0,H.jsx)(U,{title:`Review Changes`,headerAction:w,children:e}),t[16]=w,t[17]=n),n}if(o){let e;t[18]===o?e=t[19]:(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:`text-destructive text-xs text-center`,children:o})}),t[18]=o,t[19]=e);let n;return t[20]!==w||t[21]!==e?(n=(0,H.jsx)(U,{title:`Review Changes`,headerAction:w,children:e}),t[20]=w,t[21]=e,t[22]=n):n=t[22],n}if(i.length===0){let e;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs text-center`,children:`No changes to review`})}),t[23]=e):e=t[23];let n;return t[24]===w?n=t[25]:(n=(0,H.jsx)(U,{title:`Review Changes`,headerAction:w,children:e}),t[24]=w,t[25]=n),n}let T;t[26]!==i||t[27]!==l||t[28]!==u||t[29]!==c?(T=(e,t)=>{let{isOpen:r,toggle:a}=t,o=!!e.children,f=(0,H.jsxs)(F,{onClick:()=>{o?a():e.fileIndex!==void 0&&l(e.fileIndex)},selected:!o&&e.fileIndex===c,className:`gap-1.5`,children:[o?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C,{className:d(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,r&&`rotate-90`)}),r?(0,H.jsx)(n,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,H.jsx)(O,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,H.jsx)(s,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!o&&e.status&&(0,H.jsx)(`span`,{className:K(e.status),children:de(e.status)})]});return o?f:(0,H.jsxs)(z,{children:[(0,H.jsx)(L,{asChild:!0,children:f}),(0,H.jsx)(R,{children:(0,H.jsxs)(le,{onClick:()=>{e.fileIndex!==void 0&&u?.(i[e.fileIndex])},children:[(0,H.jsx)(_,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[26]=i,t[27]=l,t[28]=u,t[29]=c,t[30]=T):T=t[30];let E;t[31]!==T||t[32]!==r?(E=(0,H.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3 pb-2 px-1`,children:(0,H.jsx)(re,{nodes:r,defaultOpen:!0,resetKey:r,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:T})}),t[31]=T,t[32]=r,t[33]=E):E=t[33];let D;return t[34]!==w||t[35]!==E?(D=(0,H.jsx)(U,{title:`Review Changes`,headerAction:w,children:E}),t[34]=w,t[35]=E,t[36]=D):D=t[36],D}function pe(e,t){return e+t.hunks.reduce(q,0)}function q(e,t){return e+t.changes.filter(me).length}function me(e){return e.type===`delete`}function he(e,t){return e+t.hunks.reduce(J,0)}function J(e,t){return e+t.changes.filter(ge).length}function ge(e){return e.type===`add`}function _e(e){let t=(0,V.c)(2),{isOpen:n}=e,r=n===void 0||n?`ml-[-40px]`:``,i;return t[0]===r?i=t[1]:(i=(0,H.jsx)(I,{withHandle:!0,className:r}),t[0]=r,t[1]=i),i}function ve(e){let t=(0,V.c)(35),{open:n,lineNumber:r,lineContent:a,initialComment:s,isEditing:c,onSave:d,onDelete:f,onClose:h}=e,[g,_]=(0,B.useState)((s===void 0?``:s)??``),v;t[0]!==d||t[1]!==g?(v=()=>{g.trim()&&d(g.trim())},t[0]=d,t[1]=g,t[2]=v):v=t[2];let y=v,b;t[3]===y?b=t[4]:(b=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),y())},t[3]=y,t[4]=b);let x=b,S;t[5]===h?S=t[6]:(S=e=>{e||h()},t[5]=h,t[6]=S);let C;t[7]===r?C=t[8]:(C=(0,H.jsx)(m,{children:(0,H.jsxs)(p,{className:`text-sm font-medium`,children:[`Comment on line `,r]})}),t[7]=r,t[8]=C);let w=a||` `,T;t[9]===w?T=t[10]:(T=(0,H.jsx)(`div`,{className:`rounded bg-muted px-3 py-2 font-mono text-xs text-muted-foreground overflow-x-auto whitespace-pre`,children:w}),t[9]=w,t[10]=T);let E;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>_(e.target.value),t[11]=E):E=t[11];let D;t[12]!==x||t[13]!==g?(D=(0,H.jsx)(N,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:g,onChange:E,onKeyDown:x,rows:12,className:`resize-none text-sm`}),t[12]=x,t[13]=g,t[14]=D):D=t[14];let O;t[15]!==c||t[16]!==f?(O=c&&f&&(0,H.jsx)(i,{variant:`destructive`,size:`sm`,onClick:f,className:`mr-auto`,children:`Delete`}),t[15]=c,t[16]=f,t[17]=O):O=t[17];let k;t[18]===g?k=t[19]:(k=g.trim(),t[18]=g,t[19]=k);let ee=!k,A;t[20]!==y||t[21]!==ee?(A=(0,H.jsx)(i,{size:`sm`,onClick:y,disabled:ee,children:`Save`}),t[20]=y,t[21]=ee,t[22]=A):A=t[22];let j;t[23]!==O||t[24]!==A?(j=(0,H.jsxs)(l,{className:`gap-2 sm:gap-0`,children:[O,A]}),t[23]=O,t[24]=A,t[25]=j):j=t[25];let M;t[26]!==j||t[27]!==C||t[28]!==T||t[29]!==D?(M=(0,H.jsxs)(u,{className:`max-w-2xl`,children:[C,T,D,j]}),t[26]=j,t[27]=C,t[28]=T,t[29]=D,t[30]=M):M=t[30];let P;return t[31]!==n||t[32]!==M||t[33]!==S?(P=(0,H.jsx)(o,{open:n,onOpenChange:S,children:M}),t[31]=n,t[32]=M,t[33]=S,t[34]=P):P=t[34],P}function Y({threadId:e,onExit:n}){let{state:a,dispatch:o}=j(),{resolvedTheme:s}=ae(),[l,u]=(0,B.useState)([]),[f,p]=(0,B.useState)(!0),[m,g]=(0,B.useState)(null),[_,D]=(0,B.useState)(0),[O,k]=(0,B.useState)(!1),[N,re]=(0,B.useState)(!1),F=(0,B.useRef)(null),I=(0,B.useMemo)(()=>a.diffComments[e]??[],[a.diffComments,e]),L=(0,B.useCallback)(t=>{let n=a.diffComments[e]??[],r=typeof t==`function`?t(n):t;o({type:M.SetDiffComments,threadId:e,comments:r})},[o,e,a.diffComments]),[R,le]=(0,B.useState)(null),[z,V]=(0,B.useState)(null),[U,W]=(0,B.useState)(null),G=(0,B.useRef)(null),K=(0,B.useRef)(I),de=(0,B.useRef)(R),pe=(0,B.useRef)({isFullView:O,selectedFileIndex:_,files:l}),q=(0,B.useRef)({original:[],modified:[]}),me=(0,B.useRef)(!0);(0,B.useEffect)(()=>{K.current=I},[I]),(0,B.useEffect)(()=>{de.current=R},[R]),(0,B.useEffect)(()=>{pe.current={isFullView:O,selectedFileIndex:_,files:l}},[O,_,l]);let he=(0,B.useCallback)(()=>{F.current&&(N?F.current.expand():F.current.collapse())},[N]),J=(0,B.useCallback)(async()=>{if(e){p(!0),g(null);try{u((await x(e)).files||[]),D(0)}catch(e){g(e instanceof Error?e.message:`Failed to load diff`)}finally{p(!1)}}},[e]);(0,B.useEffect)(()=>{J()},[J]);let ge=(0,B.useCallback)(async t=>{try{await h(e,t.path),await J()}catch(e){g(e instanceof Error?e.message:`Failed to revert file`)}},[e,J]),Y=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if((a.diffComments[e]??[]).length>0){Y.current=!0;return}c(e).then(t=>{t.diffComments&&t.diffComments.length>0&&o({type:M.SetDiffComments,threadId:e,comments:t.diffComments}),Y.current=!0}).catch(()=>{Y.current=!0})},[e]),(0,B.useEffect)(()=>{Y.current&&t(e,{diffComments:I}).catch(()=>{})},[e,I]);let ye=(0,B.useMemo)(()=>ue(l),[l]),X=e=>{if(e.hunks.length===0)return null;let t=1/0,n=0;return e.hunks.forEach(e=>{let r=Math.min(e.oldStart,e.newStart),i=e.oldStart+e.oldLines,a=e.newStart+e.newLines,o=Math.max(i,a);t=Math.min(t,r),n=Math.max(n,o)}),t===1/0?null:{startLine:Math.max(1,t-2),endLine:n+2}},be=(e,t,n)=>e.split(`
2
+ `).slice(t-1,n).join(`
3
+ `),xe=e=>{let t=X(e);return t?t.startLine<=1:!0},Se=e=>({ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`})[e.split(`.`).pop()??``]||`plaintext`,Z=l[_],Ce=Z?O?Z.oldContent:(()=>{let e=X(Z);return e?be(Z.oldContent,e.startLine,e.endLine):Z.oldContent})():``,we=Z?O?Z.newContent:(()=>{let e=X(Z);return e?be(Z.newContent,e.startLine,e.endLine):Z.newContent})():``,Q=(0,B.useCallback)(()=>{if(!me.current)return;let e=G.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=pe.current,i=K.current,a=de.current,o=r[n];if(!o)return;let s=(e,r)=>{let s=t?null:X(o),c=i.filter(e=>e.fileIndex===n&&e.side===r),l=new Set(c.map(e=>s?e.lineNumber-s.startLine+1:e.lineNumber)),u=e.getModel()?.getLineCount()??0,d=[];for(let e=1;e<=u;e++)l.has(e)||d.push({range:{startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1},options:{isWholeLine:!0,glyphMarginClassName:`diff-gutter-add-comment`,glyphMarginHoverMessage:{value:`$(add) Click to add a comment`},stickiness:A.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}});let f=c.map(e=>{let t=s?e.lineNumber-s.startLine+1:e.lineNumber;if(t<1)return null;let n=i.indexOf(e)===a;return{range:{startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1},options:{isWholeLine:!0,className:n?`diff-comment-active-line`:`diff-comment-marked-line`,glyphMarginClassName:n?`diff-comment-glyph-active`:`diff-comment-glyph`,glyphMarginHoverMessage:{value:e.comment},stickiness:A.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}}).filter(e=>e!==null);d.push(...f);let p=r===`original`?q.current.original:q.current.modified,m=e.deltaDecorations(p,d);r===`original`?q.current.original=m:q.current.modified=m};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},[]);(0,B.useEffect)(()=>{Q()},[Q,I,R,_,O,Z]),(0,B.useEffect)(()=>()=>{G.current=null,q.current={original:[],modified:[]}},[_]),(0,B.useEffect)(()=>()=>{me.current=!1,G.current&&=(G.current.getOriginalEditor().getModel()?.dispose(),G.current.getModifiedEditor().getModel()?.dispose(),G.current.dispose(),null),q.current={original:[],modified:[]}},[]);let Te=(0,B.useCallback)(e=>{G.current=e;let t=e=>e===A.MouseTargetType.GUTTER_GLYPH_MARGIN||e===A.MouseTargetType.GUTTER_LINE_NUMBERS||e===A.MouseTargetType.GUTTER_LINE_DECORATIONS||e===A.MouseTargetType.GUTTER_VIEW_ZONE,n=(e,n)=>{e.onMouseDown(r=>{if(!r.target?.position||!t(r.target.type))return;let i=r.target.position.lineNumber,{isFullView:a,selectedFileIndex:o,files:s}=pe.current,c=s[o];if(!c)return;let l=a?null:X(c),u=l?l.startLine+i-1:i,d=e.getModel()?.getLineContent(i)??``,f=K.current.find(e=>e.fileIndex===o&&e.lineNumber===u&&e.side===n);f?W(f):V({lineNumber:u,lineContent:d,side:n})})};n(e.getOriginalEditor(),`original`),n(e.getModifiedEditor(),`modified`),setTimeout(()=>{G.current===e&&Q()},150)},[Q]),Ee=(0,B.useCallback)(e=>{if(z&&Z){let t={id:`comment-${Date.now()}`,filePath:Z.path,fileIndex:_,lineNumber:z.lineNumber,lineContent:z.lineContent,comment:e,side:z.side};L(e=>[...e,t]),V(null)}else U&&(L(t=>t.map(t=>t.id===U.id?{...t,comment:e}:t)),W(null))},[z,U,Z,_,L]),De=(0,B.useCallback)(()=>{U&&(L(e=>e.filter(e=>e.id!==U.id)),W(null))},[U,L]),$=(0,B.useCallback)(e=>{if(I.length===0)return;let t=(e%I.length+I.length)%I.length,n=I[t];le(t),D(n.fileIndex),setTimeout(()=>{let e=G.current;if(!e)return;let t=l[n.fileIndex];if(!t)return;let r=O?null:X(t),i=r?n.lineNumber-r.startLine+1:n.lineNumber;(n.side===`original`?e.getOriginalEditor():e.getModifiedEditor()).revealLineInCenter(Math.max(1,i)),Q()},100)},[I,l,O,Q]),Oe=(0,B.useCallback)(()=>{$((R??0)-1)},[$,R]),ke=(0,B.useCallback)(()=>{$((R??-1)+1)},[$,R]),Ae=(0,B.useCallback)(async()=>{let t=a.projectModelSelections[e];if(!t)try{let e=await v(),n=Object.values(e).flat();if(n.length>0)t=n[0];else{console.error(`No models available to process comments`);return}}catch(e){console.error(`Failed to load models:`,e);return}let r=t.id,i=t.provider;try{let{prompt:t}=await S(e,I);L([]),o({type:M.SetPendingChatMessage,message:{threadId:e,message:t,model:r,provider:i}}),n()}catch(e){console.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[I,a.projectModelSelections,o,e,n,L]),je={readOnly:!0,renderSideBySide:!0,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:Z&&(O||xe(Z))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0};return(0,H.jsxs)(`div`,{className:`diff-view-root flex h-full flex-col`,children:[(0,H.jsx)(`div`,{className:`diff-body flex flex-1 overflow-hidden`,children:(0,H.jsxs)(ce,{direction:`horizontal`,children:[(0,H.jsx)(se,{ref:F,defaultSize:25,minSize:12,maxSize:40,collapsible:!0,collapsedSize:0,onCollapse:()=>re(!0),onExpand:()=>re(!1),className:`border-r border-transparent`,children:(0,H.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,H.jsx)(fe,{treeData:ye,files:l,isLoading:f,error:m,selectedFileIndex:_,onFileSelect:D,onRevertFile:ge})})}),(0,H.jsx)(_e,{isOpen:!N}),(0,H.jsx)(se,{className:`overflow-hidden bg-transparent`,children:(0,H.jsxs)(`div`,{className:`diff-editor-panel flex h-full bg-transparent flex-col overflow-hidden`,children:[(0,H.jsxs)(oe,{className:d(`bg-transparent`,N&&`h-auto py-3 flex-col items-start gap-3 md:flex-row md:items-center md:h-[71px] md:py-0 md:gap-2 justify-between`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(i,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:he,children:[N?(0,H.jsx)(b,{className:`h-4 w-4`}):(0,H.jsx)(y,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),(0,H.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:Z?Z.path:`Review Changes`})]}),(0,H.jsxs)(`div`,{className:d(`flex items-center gap-2`,N&&`ml-0`,!N&&`ml-auto`,`md:ml-auto`),children:[(0,H.jsx)(i,{variant:`ghost`,size:`sm`,onClick:()=>k(e=>!e),disabled:!Z,className:`h-8 gap-1 px-2 text-xs`,children:O?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(E,{className:`h-3 w-3`}),` Show changes only`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(T,{className:`h-3 w-3`}),` Show full file`]})}),I.length>0&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(te,{children:[(0,H.jsx)(ne,{asChild:!0,children:(0,H.jsx)(i,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Oe,disabled:(R??0)===0,children:(0,H.jsx)(w,{className:`h-3 w-3`})})}),(0,H.jsx)(P,{children:`Previous comment`})]}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:I.length===1?`1 Comment`:`Comment ${(R??0)+1} of ${I.length}`}),(0,H.jsxs)(te,{children:[(0,H.jsx)(ne,{asChild:!0,children:(0,H.jsx)(i,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:ke,disabled:(R??0)===I.length-1,children:(0,H.jsx)(C,{className:`h-3 w-3`})})}),(0,H.jsx)(P,{children:`Next comment`})]})]}),I.length>0&&(0,H.jsxs)(te,{children:[(0,H.jsx)(ne,{asChild:!0,children:(0,H.jsxs)(i,{size:`sm`,onClick:Ae,className:`h-8 gap-1 px-3 text-xs bg-foreground text-background hover:bg-foreground/90`,children:[(0,H.jsx)(r,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,H.jsx)(P,{children:`Send all comments to Tarsk for resolution`})]})]})]}),(0,H.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[(0,H.jsx)(ee,{height:`100%`,language:Se(Z?.path||``),original:Ce,modified:we,theme:s===`dark`?`vs-dark`:`vs-light`,onMount:Te,options:je},`diff-${_}`),(0,H.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0`,children:(0,H.jsx)(ie,{})})]})]})})]})}),(0,H.jsx)(ve,{open:z!==null||U!==null,lineNumber:U?.lineNumber??z?.lineNumber??0,lineContent:U?.lineContent??z?.lineContent??``,initialComment:U?.comment,isEditing:U!==null,onSave:Ee,onDelete:De,onClose:()=>{V(null),W(null)}},`${U?.id??``}-${z?.lineNumber??``}-${z?.side??``}`)]})}export{Y as DiffView,Y as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-CX03Vh31.js","assets/rolldown-runtime-B1FJdls4.js","assets/dialogs-config-VlhyoYms.js","assets/api-BYFUablr.js","assets/alert-dialog-DAJFcjdR.js","assets/react-vendor-CtZx3FWA.js","assets/monaco-BGyhgQtx.js","assets/monaco-Br_kD0ds.css","assets/history-view-Cub-F9g6.js","assets/context-menu-D93N09Jw.js","assets/standard-list-item-0m99qNoa.js","assets/use-toast-BF5WtiOJ.js","assets/tab-context-BYpxvaoz.js","assets/explorer-view-CMcJFEtT.js","assets/markdown-renderer-BPXg5AUu.js","assets/page-toolbar-CU9dGLvm.js","assets/store-DUqJt-K-.js","assets/utils-CheqpoJ4.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Fr as t,_a as n,ya as r,zn as i}from"./dialogs-config-VlhyoYms.js";import{Pt as a}from"./monaco-BGyhgQtx.js";import{a as o}from"./store-DUqJt-K-.js";import{n as s}from"./tab-context-BYpxvaoz.js";import{n as c,r as l,t as u}from"./resizable-AKojmHeo.js";var d=n(),f=e(r(),1),p=t(),m=(0,f.lazy)(()=>a(()=>import(`./explorer-tree-CX03Vh31.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),h=(0,f.lazy)(()=>a(()=>import(`./explorer-view-CMcJFEtT.js`),__vite__mapDeps([13,1,2,3,14,6,7,8,15,11,16,5,17])));function g(){let e=(0,d.c)(17),{state:t}=o(),n=t.selectedThreadId,[r,a]=(0,f.useState)(null),{pendingExplorerPath:g,setPendingExplorerPath:v,explorerClearPath:y,setExplorerClearPath:b}=s(),x,S;e[0]!==g||e[1]!==v?(x=()=>{g&&(a({name:g.split(`/`).pop()??g,type:`file`,path:g}),v(null))},S=[g,v],e[0]=g,e[1]=v,e[2]=x,e[3]=S):(x=e[2],S=e[3]),(0,f.useEffect)(x,S);let C,w;e[4]!==y||e[5]!==b?(C=()=>{y&&(a(e=>e&&(e.path===y||e.path.startsWith(y+`/`)?null:e)),b(null))},w=[y,b],e[4]=y,e[5]=b,e[6]=C,e[7]=w):(C=e[6],w=e[7]),(0,f.useEffect)(C,w);let T;e[8]!==r?.path||e[9]!==n?(T=(0,p.jsx)(c,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:(0,p.jsx)(i,{className:`h-full`,children:n?(0,p.jsx)(f.Suspense,{fallback:(0,p.jsx)(`div`,{className:`space-y-1 px-2 py-2`,children:[1,2,3].map(_)}),children:(0,p.jsx)(m,{threadId:n,selectedPath:r?.path??null,onFileSelect:a})}):(0,p.jsx)(`p`,{className:`px-3 py-4 text-xs text-muted-foreground text-center`,children:`No thread selected.`})})}),e[8]=r?.path,e[9]=n,e[10]=T):T=e[10];let E;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,p.jsx)(u,{withHandle:!0}),e[11]=E):E=e[11];let D;e[12]===r?D=e[13]:(D=(0,p.jsx)(c,{className:`overflow-hidden`,children:(0,p.jsx)(f.Suspense,{fallback:null,children:(0,p.jsx)(h,{selectedFile:r})})}),e[12]=r,e[13]=D);let O;return e[14]!==T||e[15]!==D?(O=(0,p.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,p.jsxs)(l,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[T,E,D]})}),e[14]=T,e[15]=D,e[16]=O):O=e[16],O}function _(e){return(0,p.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e)}export{g as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Bi as t,Fr as n,Hi as r,Ti as i,_a as a,ca as o,oa as s,ya as c,zi as l}from"./dialogs-config-VlhyoYms.js";import{t as u}from"./use-toast-BF5WtiOJ.js";import{t as d}from"./standard-list-item-0m99qNoa.js";import{a as f,c as p,i as m,n as h,r as g,t as _}from"./alert-dialog-DAJFcjdR.js";import{n as v}from"./tab-context-BYpxvaoz.js";import{a as y,i as ee,n as b,r as x,t as S}from"./context-menu-D93N09Jw.js";import{n as C,o as w,r as T,s as E,t as D}from"./api-BYFUablr.js";var O=a(),k=e(c(),1),A=n();function te(e){let t=(0,O.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,k.useRef)(null),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{c.current?.focus(),c.current?.select()},u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,k.useEffect)(l,u);let f;t[2]!==i||t[3]!==r?(f=function(e){if(e.key===`Enter`){let e=c.current?.value.trim()??``;e?r(e):i()}else e.key===`Escape`&&i()},t[2]=i,t[3]=r,t[4]=f):f=t[4];let p=f,m;t[5]!==i||t[6]!==r?(m=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=m):m=t[7];let h=m,g;t[8]!==n||t[9]!==h||t[10]!==p?(g=(0,A.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:p,onBlur:h,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-sm`,onClick:j}),t[8]=n,t[9]=h,t[10]=p,t[11]=g):g=t[11];let _;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==g?(_=(0,A.jsxs)(d,{level:a,basePadding:o,children:[s,g]}),t[12]=o,t[13]=s,t[14]=a,t[15]=g,t[16]=_):_=t[16],_}function j(e){return e.stopPropagation()}function ne(e){let n=(0,O.c)(101),{node:a,level:c,selectedPath:u,expandedPaths:f,loadedDirs:p,loadingPaths:m,renamingPath:h,newItemIn:g,onToggleFolder:_,onSelectFile:v,onStartRename:C,onCommitRename:w,onCancelRename:T,onDelete:E,onNewFile:D,onNewFolder:k,onCommitNewItem:j,onCancelNewItem:P}=e,F;n[0]!==f||n[1]!==a.path?(F=f.has(a.path),n[0]=f,n[1]=a.path,n[2]=F):F=n[2];let I=F,L;n[3]!==m||n[4]!==a.path?(L=m.has(a.path),n[3]=m,n[4]=a.path,n[5]=L):L=n[5];let R=L,z,B;if(n[6]!==f||n[7]!==I||n[8]!==R||n[9]!==c||n[10]!==p||n[11]!==m||n[12]!==g||n[13]!==a||n[14]!==P||n[15]!==T||n[16]!==j||n[17]!==w||n[18]!==E||n[19]!==D||n[20]!==k||n[21]!==v||n[22]!==C||n[23]!==_||n[24]!==h||n[25]!==u){B=Symbol.for(`react.early_return_sentinel`);bb0:{let e=p.get(a.path)??[];z=h===a.path;let O=g?.dirPath===a.path&&I;if(a.type===`folder`){let M=a.ignored?`opacity-50`:void 0,F;n[28]!==a||n[29]!==_?(F=e=>{e.stopPropagation(),_(a)},n[28]=a,n[29]=_,n[30]=F):F=n[30];let L;n[31]!==I||n[32]!==R?(L=(0,A.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:R?(0,A.jsx)(i,{className:`h-3 w-3 animate-spin`}):I?(0,A.jsx)(o,{className:`h-3 w-3`}):(0,A.jsx)(s,{className:`h-3 w-3`})}),n[31]=I,n[32]=R,n[33]=L):L=n[33];let V;n[34]!==I||n[35]!==z||n[36]!==a||n[37]!==T||n[38]!==w?(V=z?(0,A.jsxs)(A.Fragment,{children:[I?(0,A.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}),(0,A.jsx)(`input`,{autoFocus:!0,defaultValue:a.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?w(a,t):T()}else e.key===`Escape`&&T()},onBlur:e=>{let t=e.target.value.trim();t?w(a,t):T()},onClick:N,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-sm`})]}):(0,A.jsxs)(A.Fragment,{children:[I?(0,A.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}),(0,A.jsx)(`span`,{className:`flex-1 truncate`,children:a.name})]}),n[34]=I,n[35]=z,n[36]=a,n[37]=T,n[38]=w,n[39]=V):V=n[39];let H;n[40]!==c||n[41]!==M||n[42]!==F||n[43]!==L||n[44]!==V?(H=(0,A.jsxs)(d,{level:c,basePadding:10,className:M,onClick:F,children:[L,V]}),n[40]=c,n[41]=M,n[42]=F,n[43]=L,n[44]=V,n[45]=H):H=n[45];let U=I&&(0,A.jsx)(`div`,{children:R&&!p.has(a.path)?(0,A.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded mx-4 my-1`}):(0,A.jsxs)(A.Fragment,{children:[O&&(0,A.jsx)(te,{defaultValue:``,level:c+1,basePadding:g.type===`folder`?10:22,icon:g.type===`folder`?(0,A.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(r,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:j,onCancel:P}),e.map(e=>(0,A.jsx)(ne,{node:e,level:c+1,selectedPath:u,expandedPaths:f,loadedDirs:p,loadingPaths:m,renamingPath:h,newItemIn:g,onToggleFolder:_,onSelectFile:v,onStartRename:C,onCommitRename:w,onCancelRename:T,onDelete:E,onNewFile:D,onNewFolder:k,onCommitNewItem:j,onCancelNewItem:P},e.path))]})}),W;n[46]!==H||n[47]!==U?(W=(0,A.jsxs)(`div`,{children:[H,U]}),n[46]=H,n[47]=U,n[48]=W):W=n[48];let G=W,K;n[49]===G?K=n[50]:(K=(0,A.jsx)(y,{asChild:!0,children:G}),n[49]=G,n[50]=K);let q;n[51]!==a.path||n[52]!==D?(q=(0,A.jsx)(x,{onSelect:()=>D(a.path),children:`New File...`}),n[51]=a.path,n[52]=D,n[53]=q):q=n[53];let J;n[54]!==a.path||n[55]!==k?(J=(0,A.jsx)(x,{onSelect:()=>k(a.path),children:`New Folder...`}),n[54]=a.path,n[55]=k,n[56]=J):J=n[56];let Y;n[57]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,A.jsx)(ee,{}),n[57]=Y):Y=n[57];let X;n[58]!==a||n[59]!==C?(X=(0,A.jsx)(x,{onSelect:()=>C(a),children:`Rename...`}),n[58]=a,n[59]=C,n[60]=X):X=n[60];let Z;n[61]!==a||n[62]!==E?(Z=(0,A.jsx)(x,{onSelect:()=>E(a),className:`text-destructive focus:text-destructive`,children:`Delete`}),n[61]=a,n[62]=E,n[63]=Z):Z=n[63];let Q;n[64]!==q||n[65]!==J||n[66]!==X||n[67]!==Z?(Q=(0,A.jsxs)(b,{children:[q,J,Y,X,Z]}),n[64]=q,n[65]=J,n[66]=X,n[67]=Z,n[68]=Q):Q=n[68];let $;n[69]!==K||n[70]!==Q?($=(0,A.jsxs)(S,{children:[K,Q]}),n[69]=K,n[70]=Q,n[71]=$):$=n[71],B=$;break bb0}}n[6]=f,n[7]=I,n[8]=R,n[9]=c,n[10]=p,n[11]=m,n[12]=g,n[13]=a,n[14]=P,n[15]=T,n[16]=j,n[17]=w,n[18]=E,n[19]=D,n[20]=k,n[21]=v,n[22]=C,n[23]=_,n[24]=h,n[25]=u,n[26]=z,n[27]=B}else z=n[26],B=n[27];if(B!==Symbol.for(`react.early_return_sentinel`))return B;let V=u===a.path,H=a.ignored?`opacity-50`:void 0,U;n[72]!==a||n[73]!==v?(U=()=>v(a),n[72]=a,n[73]=v,n[74]=U):U=n[74];let W;n[75]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,A.jsx)(r,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),n[75]=W):W=n[75];let G;n[76]!==z||n[77]!==a||n[78]!==T||n[79]!==w?(G=z?(0,A.jsx)(`input`,{autoFocus:!0,defaultValue:a.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?w(a,t):T()}else e.key===`Escape`&&T()},onBlur:e=>{let t=e.target.value.trim();t?w(a,t):T()},onClick:M,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-sm`}):(0,A.jsx)(`span`,{className:`flex-1 truncate`,children:a.name}),n[76]=z,n[77]=a,n[78]=T,n[79]=w,n[80]=G):G=n[80];let K;n[81]!==c||n[82]!==V||n[83]!==H||n[84]!==U||n[85]!==G?(K=(0,A.jsxs)(d,{level:c,basePadding:22,selected:V,className:H,onClick:U,children:[W,G]}),n[81]=c,n[82]=V,n[83]=H,n[84]=U,n[85]=G,n[86]=K):K=n[86];let q=K,J;n[87]===q?J=n[88]:(J=(0,A.jsx)(y,{asChild:!0,children:q}),n[87]=q,n[88]=J);let Y;n[89]!==a||n[90]!==C?(Y=(0,A.jsx)(x,{onSelect:()=>C(a),children:`Rename...`}),n[89]=a,n[90]=C,n[91]=Y):Y=n[91];let X;n[92]!==a||n[93]!==E?(X=(0,A.jsx)(x,{onSelect:()=>E(a),className:`text-destructive focus:text-destructive`,children:`Delete`}),n[92]=a,n[93]=E,n[94]=X):X=n[94];let Z;n[95]!==Y||n[96]!==X?(Z=(0,A.jsxs)(b,{children:[Y,X]}),n[95]=Y,n[96]=X,n[97]=Z):Z=n[97];let Q;return n[98]!==J||n[99]!==Z?(Q=(0,A.jsxs)(S,{children:[J,Z]}),n[98]=J,n[99]=Z,n[100]=Q):Q=n[100],Q}function M(e){return e.stopPropagation()}function N(e){return e.stopPropagation()}function P({threadId:e,selectedPath:t,onFileSelect:n}){let[i,a]=(0,k.useState)(new Map),[o,s]=(0,k.useState)(new Set),[c,d]=(0,k.useState)(new Set),[ee,O]=(0,k.useState)(null),[j,M]=(0,k.useState)(null),[N,P]=(0,k.useState)(null),{explorerRefreshTick:F,pendingExplorerPath:I}=v();async function L(t){if(!(!e||i.has(t))){d(e=>new Set(e).add(t));try{let n=await w(e,t);a(e=>new Map(e).set(t,n.entries))}catch{u({title:`Error`,description:`Failed to load directory`,variant:`destructive`})}finally{d(e=>{let n=new Set(e);return n.delete(t),n})}}}let R=(0,k.useCallback)(async t=>{if(e){d(e=>new Set(e).add(t));try{let n=await w(e,t);a(e=>new Map(e).set(t,n.entries))}catch{u({title:`Error`,description:`Failed to reload directory`,variant:`destructive`})}finally{d(e=>{let n=new Set(e);return n.delete(t),n})}}},[e]);(0,k.useEffect)(()=>{e&&(a(new Map),s(new Set),d(new Set),O(null),M(null),L(``))},[e]),(0,k.useEffect)(()=>{if(F>0&&e){R(``);for(let e of o)R(e)}},[F]),(0,k.useEffect)(()=>{if(!I||!e)return;let t=I.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){s(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)L(e)}},[I,e]);function z(e){o.has(e.path)?s(t=>{let n=new Set(t);return n.delete(e.path),n}):(s(t=>new Set(t).add(e.path)),L(e.path))}function B(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function V(e){P(e)}async function H(){if(!N)return;let t=N;P(null);try{await T(e,t.path),await R(B(t.path)),s(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(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{u({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function U(e){M(null),O(e.path)}async function W(t,n){if(n===t.name){O(null);return}O(null);try{await E(e,t.path,n),await R(B(t.path)),t.type===`folder`&&(s(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(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{u({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function G(e){O(null),o.has(e)||(s(t=>new Set(t).add(e)),L(e)),M({dirPath:e,type:`file`})}function K(e){O(null),o.has(e)||(s(t=>new Set(t).add(e)),L(e)),M({dirPath:e,type:`folder`})}async function q(t){if(!j)return;let{dirPath:n,type:r}=j;M(null);try{r===`file`?await D(e,n,t):await C(e,n,t),await R(n)}catch{u({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function J(){M(null)}let Y=i.get(``)??[],X=c.has(``),Z=j?.dirPath===``?(0,A.jsx)(te,{defaultValue:``,level:0,basePadding:j.type===`folder`?10:22,icon:j.type===`folder`?(0,A.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(r,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:q,onCancel:J}):null;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(_,{open:N!==null,onOpenChange:e=>!e&&P(null),children:(0,A.jsxs)(m,{children:[(0,A.jsx)(p,{children:`Move to Trash`}),(0,A.jsxs)(f,{children:[`Move “`,N?.name,`” to trash?`]}),(0,A.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,A.jsx)(g,{children:`Cancel`}),(0,A.jsx)(h,{onClick:()=>void H(),children:`Move to Trash`})]})]})}),(0,A.jsxs)(S,{children:[(0,A.jsx)(y,{asChild:!0,children:(0,A.jsx)(`div`,{className:`py-2 min-h-full`,children:X?(0,A.jsx)(`div`,{className:`space-y-1 px-2`,children:[1,2,3].map(e=>(0,A.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e))}):(0,A.jsxs)(A.Fragment,{children:[Z,Y.map(e=>(0,A.jsx)(ne,{node:e,level:0,selectedPath:t,expandedPaths:o,loadedDirs:i,loadingPaths:c,renamingPath:ee,newItemIn:j,onToggleFolder:z,onSelectFile:n,onStartRename:U,onCommitRename:W,onCancelRename:()=>O(null),onDelete:V,onNewFile:G,onNewFolder:K,onCommitNewItem:q,onCancelNewItem:J},e.path))]})})}),(0,A.jsxs)(b,{children:[(0,A.jsx)(x,{onSelect:()=>G(``),children:`New File...`}),(0,A.jsx)(x,{onSelect:()=>K(``),children:`New Folder...`})]})]})]})}export{P as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Ci as t,Nr as n,Vi as r,_a as i,wr as a}from"./dialogs-config-BXDglGdB.js";import{E as o}from"./react-vendor-Bpg1hd5i.js";import{a as s}from"./store-B9rEO6q-.js";import{t as c}from"./use-toast-C5s-Xnwi.js";import{t as l}from"./markdown-renderer-CPSKOcqK.js";import{n as u}from"./utils-CDrGT12s.js";import{t as d}from"./page-toolbar-CbwENcML.js";import{a as f,c as p,i as m}from"./api-RbLAI1bg.js";var h=e(i(),1),g=n(),_=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`,`bmp`,`tiff`,`tif`]),v=new Set([`mp4`,`webm`,`mov`,`avi`]);function y(e){let t=e.split(`.`).pop()?.toLowerCase()??``;return _.has(t)?`image`:v.has(t)?`video`:null}function b(e){return(e.split(`.`).pop()?.toLowerCase()??``)===`md`}function x(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`}[e.split(`.`).pop()??``]??`plaintext`}function S({selectedFile:e}){let{state:n}=s(),{resolvedTheme:i}=u(),_=n.selectedThreadId,v=(0,h.useRef)(null),[S,C]=(0,h.useState)(``),[w,T]=(0,h.useState)(``),[E,D]=(0,h.useState)(!1),[O,k]=(0,h.useState)(!1),[A,j]=(0,h.useState)(`edit`);(0,h.useEffect)(()=>()=>{v.current&&=(v.current.getModel()?.dispose(),v.current.dispose(),null)},[]);async function M(){if(!(!_||!e)){k(!0);try{await p(_,e.path,S),T(S),c({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){c({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{k(!1)}}}let N=(0,h.useCallback)(async e=>{if(_){D(!0);try{let t=await m(_,e.path);C(t.content),T(t.content)}catch(e){c({title:`Error`,description:e instanceof Error?e.message:`Failed to load file`,variant:`destructive`})}finally{D(!1)}}},[_]);return(0,h.useEffect)(()=>{e&&_?(j(b(e.path)?`view`:`edit`),y(e.path)||N(e)):(j(`edit`),C(``),T(``))},[e,_,N]),_?(0,g.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,g.jsxs)(d,{className:`justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col`,children:[(0,g.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e?e.name:`Select a file to edit`}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e?e.path:`Browse and edit repository files`})]}),e&&!y(e.path)&&(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[b(e.path)?(0,g.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,g.jsx)(a,{size:`sm`,variant:A===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>j(`view`),children:`View`}),(0,g.jsx)(a,{size:`sm`,variant:A===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>j(`edit`),children:`Edit`})]}):null,(0,g.jsxs)(a,{size:`sm`,onClick:()=>void M(),disabled:O||!S||S===w,children:[O?(0,g.jsx)(t,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]})]}),(0,g.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,g.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:E?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,g.jsx)(t,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):e&&y(e.path)===`image`?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,g.jsx)(`img`,{src:f(_,e.path),alt:e.name,className:`max-w-full max-h-full object-contain`})}):e&&y(e.path)===`video`?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,g.jsx)(`video`,{src:f(_,e.path),controls:!0,className:`max-w-full max-h-full`})}):e&&b(e.path)&&A===`view`?(0,g.jsx)(`div`,{className:`h-full overflow-auto p-6`,children:(0,g.jsx)(l,{content:S,enableMermaid:!0})}):e?(0,g.jsx)(o,{height:`100%`,language:x(e.path),value:S,onChange:e=>C(e??``),onMount:e=>{v.current=e},theme:i===`dark`?`vs-dark`:`vs-light`,options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,fontSize:13,lineNumbers:`on`,renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`}}}):(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,g.jsx)(r,{className:`h-10 w-10 text-muted-foreground/50`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`No file selected`}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Select a file from the tree to edit it`})]})]})})})]}):(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[(0,g.jsx)(r,{className:`h-8 w-8 text-muted-foreground`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select a thread to browse its files`})]})}export{S as default};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Er as t,Fr as n,Ti as r,Ui as i,ya as a}from"./dialogs-config-VlhyoYms.js";import{E as o}from"./react-vendor-CtZx3FWA.js";import{a as s}from"./store-DUqJt-K-.js";import{t as c}from"./use-toast-BF5WtiOJ.js";import{t as l}from"./markdown-renderer-BPXg5AUu.js";import{n as u}from"./utils-CheqpoJ4.js";import{t as d}from"./page-toolbar-CU9dGLvm.js";import{a as f,c as p,i as m}from"./api-BYFUablr.js";var h=e(a(),1),g=n(),_=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`,`bmp`,`tiff`,`tif`]),v=new Set([`mp4`,`webm`,`mov`,`avi`]);function y(e){let t=e.split(`.`).pop()?.toLowerCase()??``;return _.has(t)?`image`:v.has(t)?`video`:null}function b(e){return(e.split(`.`).pop()?.toLowerCase()??``)===`md`}function x(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`}[e.split(`.`).pop()??``]??`plaintext`}function S({selectedFile:e}){let{state:n}=s(),{resolvedTheme:a}=u(),_=n.selectedThreadId,v=(0,h.useRef)(null),[S,C]=(0,h.useState)(``),[w,T]=(0,h.useState)(``),[E,D]=(0,h.useState)(!1),[O,k]=(0,h.useState)(!1),[A,j]=(0,h.useState)(`edit`);(0,h.useEffect)(()=>()=>{v.current&&=(v.current.getModel()?.dispose(),v.current.dispose(),null)},[]);async function M(){if(!(!_||!e)){k(!0);try{await p(_,e.path,S),T(S),c({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){c({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{k(!1)}}}let N=(0,h.useCallback)(async e=>{if(_){D(!0);try{let t=await m(_,e.path);C(t.content),T(t.content)}catch(e){c({title:`Error`,description:e instanceof Error?e.message:`Failed to load file`,variant:`destructive`})}finally{D(!1)}}},[_]);return(0,h.useEffect)(()=>{e&&_?(j(b(e.path)?`view`:`edit`),y(e.path)||N(e)):(j(`edit`),C(``),T(``))},[e,_,N]),_?(0,g.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,g.jsxs)(d,{className:`justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col`,children:[(0,g.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e?e.name:`Select a file to edit`}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e?e.path:`Browse and edit repository files`})]}),e&&!y(e.path)&&(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[b(e.path)?(0,g.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,g.jsx)(t,{size:`sm`,variant:A===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>j(`view`),children:`View`}),(0,g.jsx)(t,{size:`sm`,variant:A===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>j(`edit`),children:`Edit`})]}):null,(0,g.jsxs)(t,{size:`sm`,onClick:()=>void M(),disabled:O||!S||S===w,children:[O?(0,g.jsx)(r,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]})]}),(0,g.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,g.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:E?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,g.jsx)(r,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):e&&y(e.path)===`image`?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,g.jsx)(`img`,{src:f(_,e.path),alt:e.name,className:`max-w-full max-h-full object-contain`})}):e&&y(e.path)===`video`?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,g.jsx)(`video`,{src:f(_,e.path),controls:!0,className:`max-w-full max-h-full`})}):e&&b(e.path)&&A===`view`?(0,g.jsx)(`div`,{className:`h-full overflow-auto p-6`,children:(0,g.jsx)(l,{content:S,enableMermaid:!0})}):e?(0,g.jsx)(o,{height:`100%`,language:x(e.path),value:S,onChange:e=>C(e??``),onMount:e=>{v.current=e},theme:a===`dark`?`vs-dark`:`vs-light`,options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,fontSize:13,lineNumbers:`on`,renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`}}}):(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,g.jsx)(i,{className:`h-10 w-10 text-muted-foreground/50`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`No file selected`}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Select a file from the tree to edit it`})]})]})})})]}):(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[(0,g.jsx)(i,{className:`h-8 w-8 text-muted-foreground`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select a thread to browse its files`})]})}export{S as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Bn as t,Br as n,Cr as r,Er as i,Fr as a,Lr as o,Or as s,Sr as c,Tr as l,Vn as u,Zi as d,_a as f,_r as p,a as m,aa as h,br as g,ca as _,cr as v,dr as y,ea as b,fr as x,gr as S,i as C,l as w,la as T,lr as E,mr as D,n as O,oa as k,pt as A,r as j,sa as M,sr as N,ur as ee,va as P,wr as te,xr as F,ya as I,yr as ne,zn as re}from"./dialogs-config-VlhyoYms.js";var L=e(I(),1),R=e(P(),1),z=f(),B=a(),ie=[`top`,`right`,`bottom`,`left`],V=Math.min,H=Math.max,ae=Math.round,oe=Math.floor,U=e=>({x:e,y:e}),se={left:`right`,right:`left`,bottom:`top`,top:`bottom`},ce={start:`end`,end:`start`};function le(e,t,n){return H(e,V(t,n))}function W(e,t){return typeof e==`function`?e(t):e}function G(e){return e.split(`-`)[0]}function ue(e){return e.split(`-`)[1]}function de(e){return e===`x`?`y`:`x`}function fe(e){return e===`y`?`height`:`width`}var pe=new Set([`top`,`bottom`]);function K(e){return pe.has(G(e))?`y`:`x`}function me(e){return de(K(e))}function he(e,t,n){n===void 0&&(n=!1);let r=ue(e),i=me(e),a=fe(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=we(o)),[o,we(o)]}function ge(e){let t=we(e);return[_e(e),t,_e(t)]}function _e(e){return e.replace(/start|end/g,e=>ce[e])}var ve=[`left`,`right`],ye=[`right`,`left`],be=[`top`,`bottom`],xe=[`bottom`,`top`];function Se(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ye:ve:t?ve:ye;case`left`:case`right`:return t?be:xe;default:return[]}}function Ce(e,t,n,r){let i=ue(e),a=Se(G(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(_e)))),a}function we(e){return e.replace(/left|right|bottom|top/g,e=>se[e])}function Te(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ee(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Te(e)}function De(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Oe(e,t,n){let{reference:r,floating:i}=e,a=K(t),o=me(t),s=fe(o),c=G(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(ue(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function ke(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=W(t,e),p=Ee(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=De(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=De(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Ae=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Oe(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:{...o,detectOverflow:o.detectOverflow??ke},elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=Oe(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},je=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=W(e,t)||{};if(l==null)return{};let d=Ee(u),f={x:n,y:r},p=me(i),m=fe(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=V(d[_],T),D=V(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=le(O,A,k),M=!c.arrow&&ue(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),Me=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=W(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=G(r),_=K(o),v=G(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[we(o)]:ge(o)),x=p!==`none`;!d&&x&&b.push(...Ce(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=he(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==K(t))||T.every(e=>K(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=K(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ne(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Pe(e){return ie.some(t=>e[t]>=0)}var Fe=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=W(e,t);switch(i){case`referenceHidden`:{let e=Ne(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Pe(e)}}}case`escaped`:{let e=Ne(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Pe(e)}}}default:return{}}}}},Ie=new Set([`left`,`top`]);async function Le(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=G(n),s=ue(n),c=K(n)===`y`,l=Ie.has(o)?-1:1,u=a&&c?-1:1,d=W(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Re=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Le(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ze=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=W(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=K(G(i)),p=de(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=le(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=le(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Be=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=W(e,t),u={x:n,y:r},d=K(i),f=de(d),p=u[f],m=u[d],h=W(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ie.has(G(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Ve=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=W(e,t),u=await o.detectOverflow(t,l),d=G(i),f=ue(i),p=K(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=V(h-u[g],v),x=V(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=H(u.left,0),t=H(u.right,0),n=H(u.top,0),r=H(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:H(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:H(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function He(){return typeof window<`u`}function Ue(e){return We(e)?(e.nodeName||``).toLowerCase():`#document`}function q(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function J(e){return((We(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function We(e){return He()?e instanceof Node||e instanceof q(e).Node:!1}function Y(e){return He()?e instanceof Element||e instanceof q(e).Element:!1}function X(e){return He()?e instanceof HTMLElement||e instanceof q(e).HTMLElement:!1}function Ge(e){return!He()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof q(e).ShadowRoot}var Ke=new Set([`inline`,`contents`]);function qe(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Z(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Ke.has(i)}var Je=new Set([`table`,`td`,`th`]);function Ye(e){return Je.has(Ue(e))}var Xe=[`:popover-open`,`:modal`];function Ze(e){return Xe.some(t=>{try{return e.matches(t)}catch{return!1}})}var Qe=[`transform`,`translate`,`scale`,`rotate`,`perspective`],$e=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],et=[`paint`,`layout`,`strict`,`content`];function tt(e){let t=rt(),n=Y(e)?Z(e):e;return Qe.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||$e.some(e=>(n.willChange||``).includes(e))||et.some(e=>(n.contain||``).includes(e))}function nt(e){let t=Q(e);for(;X(t)&&!at(t);){if(tt(t))return t;if(Ze(t))return null;t=Q(t)}return null}function rt(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var it=new Set([`html`,`body`,`#document`]);function at(e){return it.has(Ue(e))}function Z(e){return q(e).getComputedStyle(e)}function ot(e){return Y(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Q(e){if(Ue(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ge(e)&&e.host||J(e);return Ge(t)?t.host:t}function st(e){let t=Q(e);return at(t)?e.ownerDocument?e.ownerDocument.body:e.body:X(t)&&qe(t)?t:st(t)}function ct(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=st(e),i=r===e.ownerDocument?.body,a=q(r);if(i){let e=lt(a);return t.concat(a,a.visualViewport||[],qe(r)?r:[],e&&n?ct(e):[])}return t.concat(r,ct(r,[],n))}function lt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ut(e){let t=Z(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=X(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ae(n)!==a||ae(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function dt(e){return Y(e)?e:e.contextElement}function ft(e){let t=dt(e);if(!X(t))return U(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ut(t),o=(a?ae(n.width):n.width)/r,s=(a?ae(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var pt=U(0);function mt(e){let t=q(e);return!rt()||!t.visualViewport?pt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ht(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==q(e)?!1:t}function gt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=dt(e),o=U(1);t&&(r?Y(r)&&(o=ft(r)):o=ft(e));let s=ht(a,n,r)?mt(a):U(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=q(a),t=r&&Y(r)?q(r):r,n=e,i=lt(n);for(;i&&r&&t!==n;){let e=ft(i),t=i.getBoundingClientRect(),r=Z(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=q(i),i=lt(n)}}return De({width:u,height:d,x:c,y:l})}function _t(e,t){let n=ot(e).scrollLeft;return t?t.left+n:gt(J(e)).left+n}function vt(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-_t(e,n),y:n.top+t.scrollTop}}function yt(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=J(r),s=t?Ze(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=U(1),u=U(0),d=X(r);if((d||!d&&!a)&&((Ue(r)!==`body`||qe(o))&&(c=ot(r)),X(r))){let e=gt(r);l=ft(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?vt(o,c):U(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function bt(e){return Array.from(e.getClientRects())}function xt(e){let t=J(e),n=ot(e),r=e.ownerDocument.body,i=H(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=H(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+_t(e),s=-n.scrollTop;return Z(r).direction===`rtl`&&(o+=H(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var St=25;function Ct(e,t){let n=q(e),r=J(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=rt();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=_t(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=St&&(a-=o)}else l<=St&&(a+=l);return{width:a,height:o,x:s,y:c}}var wt=new Set([`absolute`,`fixed`]);function Tt(e,t){let n=gt(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=X(e)?ft(e):U(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Et(e,t,n){let r;if(t===`viewport`)r=Ct(e,n);else if(t===`document`)r=xt(J(e));else if(Y(t))r=Tt(t,n);else{let n=mt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return De(r)}function Dt(e,t){let n=Q(e);return n===t||!Y(n)||at(n)?!1:Z(n).position===`fixed`||Dt(n,t)}function Ot(e,t){let n=t.get(e);if(n)return n;let r=ct(e,[],!1).filter(e=>Y(e)&&Ue(e)!==`body`),i=null,a=Z(e).position===`fixed`,o=a?Q(e):e;for(;Y(o)&&!at(o);){let t=Z(o),n=tt(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&wt.has(i.position)||qe(o)&&!n&&Dt(e,o))?r=r.filter(e=>e!==o):i=t,o=Q(o)}return t.set(e,r),r}function kt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Ze(t)?[]:Ot(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Et(t,n,i);return e.top=H(r.top,e.top),e.right=V(r.right,e.right),e.bottom=V(r.bottom,e.bottom),e.left=H(r.left,e.left),e},Et(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function At(e){let{width:t,height:n}=ut(e);return{width:t,height:n}}function jt(e,t,n){let r=X(t),i=J(t),a=n===`fixed`,o=gt(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=U(0);function l(){c.x=_t(i)}if(r||!r&&!a)if((Ue(t)!==`body`||qe(i))&&(s=ot(t)),r){let e=gt(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?vt(i,s):U(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Mt(e){return Z(e).position===`static`}function Nt(e,t){if(!X(e)||Z(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return J(e)===n&&(n=n.ownerDocument.body),n}function Pt(e,t){let n=q(e);if(Ze(e))return n;if(!X(e)){let t=Q(e);for(;t&&!at(t);){if(Y(t)&&!Mt(t))return t;t=Q(t)}return n}let r=Nt(e,t);for(;r&&Ye(r)&&Mt(r);)r=Nt(r,t);return r&&at(r)&&Mt(r)&&!tt(r)?n:r||nt(e)||n}var Ft=async function(e){let t=this.getOffsetParent||Pt,n=this.getDimensions,r=await n(e.floating);return{reference:jt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function It(e){return Z(e).direction===`rtl`}var Lt={convertOffsetParentRelativeRectToViewportRelativeRect:yt,getDocumentElement:J,getClippingRect:kt,getOffsetParent:Pt,getElementRects:Ft,getClientRects:bt,getDimensions:At,getScale:ft,isElement:Y,isRTL:It};function Rt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function zt(e,t){let n=null,r,i=J(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=oe(d),h=oe(i.clientWidth-(u+f)),g=oe(i.clientHeight-(d+p)),_=oe(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:H(0,V(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Rt(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Bt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=dt(e),u=i||a?[...l?ct(l):[],...ct(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?zt(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?gt(e):null;c&&g();function g(){let t=gt(e);h&&!Rt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Vt=Re,Ht=ze,Ut=Me,Wt=Ve,Gt=Fe,Kt=je,qt=Be,Jt=(e,t,n)=>{let r=new Map,i={platform:Lt,...n},a={...i.platform,_c:r};return Ae(e,t,{...i,platform:a})},Yt=typeof document<`u`?L.useLayoutEffect:function(){};function Xt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Xt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Xt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Zt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qt(e,t){let n=Zt(e);return Math.round(t*n)/n}function $t(e){let t=L.useRef(e);return Yt(()=>{t.current=e}),t}function en(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=L.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=L.useState(r);Xt(f,r)||p(r);let[m,h]=L.useState(null),[g,_]=L.useState(null),v=L.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=L.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=L.useRef(null),C=L.useRef(null),w=L.useRef(u),T=c!=null,E=$t(c),D=$t(i),O=$t(l),k=L.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Jt(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Xt(w.current,t)&&(w.current=t,R.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Yt(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=L.useRef(!1);Yt(()=>(A.current=!0,()=>{A.current=!1}),[]),Yt(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=L.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=L.useMemo(()=>({reference:b,floating:x}),[b,x]),N=L.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Qt(M.floating,u.x),r=Qt(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Zt(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return L.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var tn=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Kt({element:r.current,padding:i}).fn(n):r?Kt({element:r,padding:i}).fn(n):{}}}},nn=(e,t)=>({...Vt(e),options:[e,t]}),rn=(e,t)=>({...Ht(e),options:[e,t]}),an=(e,t)=>({...qt(e),options:[e,t]}),on=(e,t)=>({...Ut(e),options:[e,t]}),sn=(e,t)=>({...Wt(e),options:[e,t]}),cn=(e,t)=>({...Gt(e),options:[e,t]}),ln=(e,t)=>({...tn(e),options:[e,t]}),un=`Arrow`,dn=L.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,B.jsx)(p.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,B.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});dn.displayName=un;var fn=dn;function pn(e){let[t,n]=L.useState(void 0);return r(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var mn=`Popper`,[hn,gn]=te(mn),[_n,vn]=hn(mn),yn=e=>{let{__scopePopper:t,children:n}=e,[r,i]=L.useState(null);return(0,B.jsx)(_n,{scope:t,anchor:r,onAnchorChange:i,children:n})};yn.displayName=mn;var bn=`PopperAnchor`,xn=L.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=vn(bn,n),s=L.useRef(null),c=o(t,s),l=L.useRef(null);return L.useEffect(()=>{let e=l.current;l.current=r?.current||s.current,e!==l.current&&a.onAnchorChange(l.current)}),r?null:(0,B.jsx)(p.div,{...i,ref:c})});xn.displayName=bn;var Sn=`PopperContent`,[Cn,wn]=hn(Sn),Tn=L.forwardRef((e,t)=>{let{__scopePopper:n,side:i=`bottom`,sideOffset:a=0,align:s=`center`,alignOffset:c=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:m=`partial`,hideWhenDetached:h=!1,updatePositionStrategy:g=`optimized`,onPlaced:_,...v}=e,y=vn(Sn,n),[b,x]=L.useState(null),C=o(t,e=>x(e)),[w,T]=L.useState(null),E=pn(w),D=E?.width??0,O=E?.height??0,k=i+(s===`center`?``:`-`+s),A=typeof f==`number`?f:{top:0,right:0,bottom:0,left:0,...f},j=Array.isArray(d)?d:[d],M=j.length>0,N={padding:A,boundary:j.filter(kn),altBoundary:M},{refs:ee,floatingStyles:P,placement:te,isPositioned:F,middlewareData:I}=en({strategy:`fixed`,placement:k,whileElementsMounted:(...e)=>Bt(...e,{animationFrame:g===`always`}),elements:{reference:y.anchor},middleware:[nn({mainAxis:a+O,alignmentAxis:c}),u&&rn({mainAxis:!0,crossAxis:!1,limiter:m===`partial`?an():void 0,...N}),u&&on({...N}),sn({...N,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),w&&ln({element:w,padding:l}),An({arrowWidth:D,arrowHeight:O}),h&&cn({strategy:`referenceHidden`,...N})]}),[ne,re]=jn(te),R=S(_);r(()=>{F&&R?.()},[F,R]);let z=I.arrow?.x,ie=I.arrow?.y,V=I.arrow?.centerOffset!==0,[H,ae]=L.useState();return r(()=>{b&&ae(window.getComputedStyle(b).zIndex)},[b]),(0,B.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...P,transform:F?P.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:H,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(` `),...I.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,B.jsx)(Cn,{scope:n,placedSide:ne,onArrowChange:T,arrowX:z,arrowY:ie,shouldHideArrow:V,children:(0,B.jsx)(p.div,{"data-side":ne,"data-align":re,...v,ref:C,style:{...v.style,animation:F?void 0:`none`}})})})});Tn.displayName=Sn;var En=`PopperArrow`,Dn={top:`bottom`,right:`left`,bottom:`top`,left:`right`},On=L.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=wn(En,n),a=Dn[i.placedSide];return(0,B.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,B.jsx)(fn,{...r,ref:t,style:{...r.style,display:`block`}})})});On.displayName=En;function kn(e){return e!==null}var An=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=jn(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function jn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Mn=yn,Nn=xn,Pn=Tn,Fn=On,In=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Ln=`VisuallyHidden`,Rn=L.forwardRef((e,t)=>(0,B.jsx)(p.span,{...e,ref:t,style:{...In,...e.style}}));Rn.displayName=Ln;var zn=Rn,[Bn,Vn]=te(`Tooltip`,[gn]),Hn=gn(),Un=`TooltipProvider`,Wn=700,Gn=`tooltip.open`,[Kn,qn]=Bn(Un),Jn=e=>{let{__scopeTooltip:t,delayDuration:n=Wn,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=L.useRef(!0),s=L.useRef(!1),c=L.useRef(0);return L.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,B.jsx)(Kn,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:L.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:L.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:L.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Jn.displayName=Un;var Yn=`Tooltip`,[Xn,Zn]=Bn(Yn),Qn=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,l=qn(Yn,e.__scopeTooltip),u=Hn(t),[d,f]=L.useState(null),p=c(),m=L.useRef(0),h=o??l.disableHoverableContent,g=s??l.delayDuration,_=L.useRef(!1),[v,y]=F({prop:r,defaultProp:i??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(Gn))):l.onClose(),a?.(e)},caller:Yn}),b=L.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),x=L.useCallback(()=>{window.clearTimeout(m.current),m.current=0,_.current=!1,y(!0)},[y]),S=L.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),C=L.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{_.current=!0,y(!0),m.current=0},g)},[g,y]);return L.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,B.jsx)(Mn,{...u,children:(0,B.jsx)(Xn,{scope:t,contentId:p,open:v,stateAttribute:b,trigger:d,onTriggerChange:f,onTriggerEnter:L.useCallback(()=>{l.isOpenDelayedRef.current?C():x()},[l.isOpenDelayedRef,C,x]),onTriggerLeave:L.useCallback(()=>{h?S():(window.clearTimeout(m.current),m.current=0)},[S,h]),onOpen:x,onClose:S,disableHoverableContent:h,children:n})})};Qn.displayName=Yn;var $n=`TooltipTrigger`,er=L.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Zn($n,n),a=qn($n,n),s=Hn(n),c=o(t,L.useRef(null),i.onTriggerChange),u=L.useRef(!1),d=L.useRef(!1),f=L.useCallback(()=>u.current=!1,[]);return L.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,B.jsx)(Nn,{asChild:!0,...s,children:(0,B.jsx)(p.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:l(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:l(e.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:l(e.onPointerDown,()=>{i.open&&i.onClose(),u.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:l(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:l(e.onBlur,i.onClose),onClick:l(e.onClick,i.onClose)})})});er.displayName=$n;var tr=`TooltipPortal`,[nr,rr]=Bn(tr,{forceMount:void 0}),ir=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Zn(tr,t);return(0,B.jsx)(nr,{scope:t,forceMount:n,children:(0,B.jsx)(ee,{present:n||a.open,children:(0,B.jsx)(y,{asChild:!0,container:i,children:r})})})};ir.displayName=tr;var ar=`TooltipContent`,or=L.forwardRef((e,t)=>{let n=rr(ar,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Zn(ar,e.__scopeTooltip);return(0,B.jsx)(ee,{present:r||o.open,children:o.disableHoverableContent?(0,B.jsx)(dr,{side:i,...a,ref:t}):(0,B.jsx)(sr,{side:i,...a,ref:t})})}),sr=L.forwardRef((e,t)=>{let n=Zn(ar,e.__scopeTooltip),r=qn(ar,e.__scopeTooltip),i=L.useRef(null),a=o(t,i),[s,c]=L.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,p=L.useCallback(()=>{c(null),f(!1)},[f]),m=L.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=hr(r,mr(r,n.getBoundingClientRect())),a=gr(t.getBoundingClientRect());c(vr([...i,...a])),f(!0)},[f]);return L.useEffect(()=>()=>p(),[p]),L.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),L.useEffect(()=>{if(s){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!_r(n,s);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,s,u,p]),(0,B.jsx)(dr,{...e,ref:a})}),[cr,lr]=Bn(Yn,{isInside:!1}),ur=g(`TooltipContent`),dr=L.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Zn(ar,n),l=Hn(n),{onClose:u}=c;return L.useEffect(()=>(document.addEventListener(Gn,u),()=>document.removeEventListener(Gn,u)),[u]),L.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,B.jsx)(D,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,B.jsxs)(Pn,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,B.jsx)(ur,{children:r}),(0,B.jsx)(cr,{scope:n,isInside:!0,children:(0,B.jsx)(zn,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});or.displayName=ar;var fr=`TooltipArrow`,pr=L.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Hn(n);return lr(fr,n).isInside?null:(0,B.jsx)(Fn,{...i,...r,ref:t})});pr.displayName=fr;function mr(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function hr(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function gr(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function _r(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function vr(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),yr(t)}function yr(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var br=Jn,xr=Qn,Sr=er,Cr=or,wr=br,Tr=xr,Er=Sr,Dr=L.forwardRef((e,t)=>{let n=(0,z.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,sideOffset:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=a===void 0?4:a,c;n[4]===r?c=n[5]:(c=s(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,r),n[4]=r,n[5]=c);let l;return n[6]!==i||n[7]!==t||n[8]!==o||n[9]!==c?(l=(0,B.jsx)(Cr,{ref:t,sideOffset:o,className:c,...i}),n[6]=i,n[7]=t,n[8]=o,n[9]=c,n[10]=l):l=n[10],l});Dr.displayName=Cr.displayName;function Or(e){let t=L.useRef({value:e,previous:e});return L.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var kr=L.forwardRef((e,t)=>{let n=(0,z.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(`w-full caption-bottom text-sm`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,B.jsx)(`table`,{ref:t,className:a,...i})}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});kr.displayName=`Table`;var Ar=L.forwardRef((e,t)=>{let n=(0,z.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(`[&_tr]:border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`thead`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Ar.displayName=`TableHeader`;var jr=L.forwardRef((e,t)=>{let n=(0,z.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(`[&_tr:last-child]:border-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`tbody`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});jr.displayName=`TableBody`;var Mr=L.forwardRef((e,t)=>{let n=(0,z.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(`border-t bg-muted/50 font-medium [&>tr]:last:border-b-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`tfoot`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Mr.displayName=`TableFooter`;var Nr=L.forwardRef((e,t)=>{let n=(0,z.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(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`tr`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Nr.displayName=`TableRow`;var Pr=L.forwardRef((e,t)=>{let n=(0,z.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(`h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`th`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Pr.displayName=`TableHead`;var Fr=L.forwardRef((e,t)=>{let n=(0,z.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(`p-4 align-middle [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`td`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Fr.displayName=`TableCell`;var Ir=L.forwardRef((e,t)=>{let n=(0,z.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(`mt-4 text-sm text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(`caption`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Ir.displayName=`TableCaption`;var Lr=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Rr=[` `,`Enter`],zr=`Select`,[Br,Vr,Hr]=w(zr),[Ur,Wr]=te(zr,[Hr,gn]),Gr=gn(),[Kr,qr]=Ur(zr),[Jr,Yr]=Ur(zr),Xr=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:l,dir:d,name:f,autoComplete:p,disabled:m,required:h,form:g}=e,_=Gr(t),[v,y]=L.useState(null),[b,x]=L.useState(null),[S,C]=L.useState(!1),w=u(d),[T,E]=F({prop:r,defaultProp:i??!1,onChange:a,caller:zr}),[D,O]=F({prop:o,defaultProp:s,onChange:l,caller:zr}),k=L.useRef(null),A=v?g||!!v.closest(`form`):!0,[j,M]=L.useState(new Set),N=Array.from(j).map(e=>e.props.value).join(`;`);return(0,B.jsx)(Mn,{..._,children:(0,B.jsxs)(Kr,{required:h,scope:t,trigger:v,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:c(),value:D,onValueChange:O,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:k,disabled:m,children:[(0,B.jsx)(Br.Provider,{scope:t,children:(0,B.jsx)(Jr,{scope:e.__scopeSelect,onNativeOptionAdd:L.useCallback(e=>{M(t=>new Set(t).add(e))},[]),onNativeOptionRemove:L.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),A?(0,B.jsxs)(Wi,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:D,onChange:e=>O(e.target.value),disabled:m,form:g,children:[D===void 0?(0,B.jsx)(`option`,{value:``}):null,Array.from(j)]},N):null]})})};Xr.displayName=zr;var Zr=`SelectTrigger`,Qr=L.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Gr(n),s=qr(Zr,n),c=s.disabled||r,u=o(t,s.onTriggerChange),d=Vr(n),f=L.useRef(`touch`),[m,h,g]=Ki(e=>{let t=d().filter(e=>!e.disabled),n=qi(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),_=e=>{c||(s.onOpenChange(!0),g()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,B.jsx)(Nn,{asChild:!0,...a,children:(0,B.jsx)(p.button,{type:`button`,role:`combobox`,"aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":Gi(s.value)?``:void 0,...i,ref:u,onClick:l(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&_(e)}),onPointerDown:l(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:l(i.onKeyDown,e=>{let t=m.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&h(e.key),!(t&&e.key===` `)&&Lr.includes(e.key)&&(_(),e.preventDefault())})})})});Qr.displayName=Zr;var $r=`SelectValue`,ei=L.forwardRef((e,t)=>{let{__scopeSelect:n,className:i,style:a,children:s,placeholder:c=``,...l}=e,u=qr($r,n),{onValueNodeHasChildrenChange:d}=u,f=s!==void 0,m=o(t,u.onValueNodeChange);return r(()=>{d(f)},[d,f]),(0,B.jsx)(p.span,{...l,ref:m,style:{pointerEvents:`none`},children:Gi(u.value)?(0,B.jsx)(B.Fragment,{children:c}):s})});ei.displayName=$r;var ti=`SelectIcon`,ni=L.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,B.jsx)(p.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ni.displayName=ti;var ri=`SelectPortal`,ii=e=>(0,B.jsx)(y,{asChild:!0,...e});ii.displayName=ri;var ai=`SelectContent`,oi=L.forwardRef((e,t)=>{let n=qr(ai,e.__scopeSelect),[i,a]=L.useState();if(r(()=>{a(new DocumentFragment)},[]),!n.open){let t=i;return t?R.createPortal((0,B.jsx)(si,{scope:e.__scopeSelect,children:(0,B.jsx)(Br.Slot,{scope:e.__scopeSelect,children:(0,B.jsx)(`div`,{children:e.children})})}),t):null}return(0,B.jsx)(di,{...e,ref:t})});oi.displayName=ai;var $=10,[si,ci]=Ur(ai),li=`SelectContentImpl`,ui=ne(`SelectContent.RemoveScroll`),di=L.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:s,side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:y,...b}=e,S=qr(ai,n),[C,w]=L.useState(null),[T,O]=L.useState(null),k=o(t,e=>w(e)),[A,j]=L.useState(null),[M,ee]=L.useState(null),P=Vr(n),[te,F]=L.useState(!1),I=L.useRef(!1);L.useEffect(()=>{if(C)return N(C)},[C]),E();let ne=L.useCallback(e=>{let[t,...n]=P().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&T&&(T.scrollTop=0),n===r&&T&&(T.scrollTop=T.scrollHeight),n?.focus(),document.activeElement!==i))return},[P,T]),re=L.useCallback(()=>ne([A,C]),[ne,A,C]);L.useEffect(()=>{te&&re()},[te,re]);let{onOpenChange:R,triggerPointerDownPosRef:z}=S;L.useEffect(()=>{if(C){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(z.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(z.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():C.contains(n.target)||R(!1),document.removeEventListener(`pointermove`,t),z.current=null};return z.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[C,R,z]),L.useEffect(()=>{let e=()=>R(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[R]);let[ie,V]=Ki(e=>{let t=P().filter(e=>!e.disabled),n=qi(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),H=L.useCallback((e,t,n)=>{let r=!I.current&&!n;(S.value!==void 0&&S.value===t||r)&&(j(e),r&&(I.current=!0))},[S.value]),ae=L.useCallback(()=>C?.focus(),[C]),oe=L.useCallback((e,t,n)=>{let r=!I.current&&!n;(S.value!==void 0&&S.value===t||r)&&ee(e)},[S.value]),U=r===`popper`?hi:pi,se=U===hi?{side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:y}:{};return(0,B.jsx)(si,{scope:n,content:C,viewport:T,onViewportChange:O,itemRefCallback:H,selectedItem:A,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:re,selectedItemText:M,position:r,isPositioned:te,searchRef:ie,children:(0,B.jsx)(v,{as:ui,allowPinchZoom:!0,children:(0,B.jsx)(x,{asChild:!0,trapped:S.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:l(i,e=>{S.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,B.jsx)(D,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>S.onOpenChange(!1),children:(0,B.jsx)(U,{role:`listbox`,id:S.contentId,"data-state":S.open?`open`:`closed`,dir:S.dir,onContextMenu:e=>e.preventDefault(),...b,...se,onPlaced:()=>F(!0),ref:k,style:{display:`flex`,flexDirection:`column`,outline:`none`,...b.style},onKeyDown:l(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&V(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=P().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>ne(t)),e.preventDefault()}})})})})})})});di.displayName=li;var fi=`SelectItemAlignedPosition`,pi=L.forwardRef((e,n)=>{let{__scopeSelect:i,onPlaced:a,...s}=e,c=qr(ai,i),l=ci(ai,i),[u,d]=L.useState(null),[f,m]=L.useState(null),h=o(n,e=>m(e)),g=Vr(i),_=L.useRef(!1),v=L.useRef(!0),{viewport:y,selectedItem:b,selectedItemText:x,focusSelectedItem:S}=l,C=L.useCallback(()=>{if(c.trigger&&c.valueNode&&u&&f&&y&&b&&x){let e=c.trigger.getBoundingClientRect(),n=f.getBoundingClientRect(),r=c.valueNode.getBoundingClientRect(),i=x.getBoundingClientRect();if(c.dir!==`rtl`){let a=i.left-n.left,o=r.left-a,s=e.left-o,c=e.width+s,l=Math.max(c,n.width),d=window.innerWidth-$,f=t(o,[$,Math.max($,d-l)]);u.style.minWidth=c+`px`,u.style.left=f+`px`}else{let a=n.right-i.right,o=window.innerWidth-r.right-a,s=window.innerWidth-e.right-o,c=e.width+s,l=Math.max(c,n.width),d=window.innerWidth-$,f=t(o,[$,Math.max($,d-l)]);u.style.minWidth=c+`px`,u.style.right=f+`px`}let o=g(),s=window.innerHeight-$*2,l=y.scrollHeight,d=window.getComputedStyle(f),p=parseInt(d.borderTopWidth,10),m=parseInt(d.paddingTop,10),h=parseInt(d.borderBottomWidth,10),v=parseInt(d.paddingBottom,10),S=p+m+l+v+h,C=Math.min(b.offsetHeight*5,S),w=window.getComputedStyle(y),T=parseInt(w.paddingTop,10),E=parseInt(w.paddingBottom,10),D=e.top+e.height/2-$,O=s-D,k=b.offsetHeight/2,A=b.offsetTop+k,j=p+m+A,M=S-j;if(j<=D){let e=o.length>0&&b===o[o.length-1].ref.current;u.style.bottom=`0px`;let t=f.clientHeight-y.offsetTop-y.offsetHeight,n=j+Math.max(O,k+(e?E:0)+t+h);u.style.height=n+`px`}else{let e=o.length>0&&b===o[0].ref.current;u.style.top=`0px`;let t=Math.max(D,p+y.offsetTop+(e?T:0)+k)+M;u.style.height=t+`px`,y.scrollTop=j-D+y.offsetTop}u.style.margin=`${$}px 0`,u.style.minHeight=C+`px`,u.style.maxHeight=s+`px`,a?.(),requestAnimationFrame(()=>_.current=!0)}},[g,c.trigger,c.valueNode,u,f,y,b,x,c.dir,a]);r(()=>C(),[C]);let[w,T]=L.useState();return r(()=>{f&&T(window.getComputedStyle(f).zIndex)},[f]),(0,B.jsx)(gi,{scope:i,contentWrapper:u,shouldExpandOnScrollRef:_,onScrollButtonChange:L.useCallback(e=>{e&&v.current===!0&&(C(),S?.(),v.current=!1)},[C,S]),children:(0,B.jsx)(`div`,{ref:d,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:w},children:(0,B.jsx)(p.div,{...s,ref:h,style:{boxSizing:`border-box`,maxHeight:`100%`,...s.style}})})})});pi.displayName=fi;var mi=`SelectPopperPosition`,hi=L.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=$,...a}=e,o=Gr(n);return(0,B.jsx)(Pn,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});hi.displayName=mi;var[gi,_i]=Ur(ai,{}),vi=`SelectViewport`,yi=L.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=ci(vi,n),s=_i(vi,n),c=o(t,a.onViewportChange),u=L.useRef(0);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,B.jsx)(Br.Slot,{scope:n,children:(0,B.jsx)(p.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:l(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(u.current-t.scrollTop);if(e>0){let r=window.innerHeight-$*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}u.current=t.scrollTop})})})]})});yi.displayName=vi;var bi=`SelectGroup`,[xi,Si]=Ur(bi),Ci=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=c();return(0,B.jsx)(xi,{scope:n,id:i,children:(0,B.jsx)(p.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Ci.displayName=bi;var wi=`SelectLabel`,Ti=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Si(wi,n);return(0,B.jsx)(p.div,{id:i.id,...r,ref:t})});Ti.displayName=wi;var Ei=`SelectItem`,[Di,Oi]=Ur(Ei),ki=L.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...s}=e,u=qr(Ei,n),d=ci(Ei,n),f=u.value===r,[m,h]=L.useState(a??``),[g,_]=L.useState(!1),v=o(t,e=>d.itemRefCallback?.(e,r,i)),y=c(),b=L.useRef(`touch`),x=()=>{i||(u.onValueChange(r),u.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,B.jsx)(Di,{scope:n,value:r,disabled:i,textId:y,isSelected:f,onItemTextChange:L.useCallback(e=>{h(t=>t||(e?.textContent??``).trim())},[]),children:(0,B.jsx)(Br.ItemSlot,{scope:n,value:r,disabled:i,textValue:m,children:(0,B.jsx)(p.div,{role:`option`,"aria-labelledby":y,"data-highlighted":g?``:void 0,"aria-selected":f&&g,"data-state":f?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...s,ref:v,onFocus:l(s.onFocus,()=>_(!0)),onBlur:l(s.onBlur,()=>_(!1)),onClick:l(s.onClick,()=>{b.current!==`mouse`&&x()}),onPointerUp:l(s.onPointerUp,()=>{b.current===`mouse`&&x()}),onPointerDown:l(s.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:l(s.onPointerMove,e=>{b.current=e.pointerType,i?d.onItemLeave?.():b.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:l(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:l(s.onKeyDown,e=>{d.searchRef?.current!==``&&e.key===` `||(Rr.includes(e.key)&&x(),e.key===` `&&e.preventDefault())})})})})});ki.displayName=Ei;var Ai=`SelectItemText`,ji=L.forwardRef((e,t)=>{let{__scopeSelect:n,className:i,style:a,...s}=e,c=qr(Ai,n),l=ci(Ai,n),u=Oi(Ai,n),d=Yr(Ai,n),[f,m]=L.useState(null),h=o(t,e=>m(e),u.onItemTextChange,e=>l.itemTextRefCallback?.(e,u.value,u.disabled)),g=f?.textContent,_=L.useMemo(()=>(0,B.jsx)(`option`,{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=d;return r(()=>(v(_),()=>y(_)),[v,y,_]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(p.span,{id:u.textId,...s,ref:h}),u.isSelected&&c.valueNode&&!c.valueNodeHasChildren?R.createPortal(s.children,c.valueNode):null]})});ji.displayName=Ai;var Mi=`SelectItemIndicator`,Ni=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Oi(Mi,n).isSelected?(0,B.jsx)(p.span,{"aria-hidden":!0,...r,ref:t}):null});Ni.displayName=Mi;var Pi=`SelectScrollUpButton`,Fi=L.forwardRef((e,t)=>{let n=ci(Pi,e.__scopeSelect),i=_i(Pi,e.__scopeSelect),[a,s]=L.useState(!1),c=o(t,i.onScrollButtonChange);return r(()=>{if(n.viewport&&n.isPositioned){let e=function(){s(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,B.jsx)(Ri,{...e,ref:c,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Fi.displayName=Pi;var Ii=`SelectScrollDownButton`,Li=L.forwardRef((e,t)=>{let n=ci(Ii,e.__scopeSelect),i=_i(Ii,e.__scopeSelect),[a,s]=L.useState(!1),c=o(t,i.onScrollButtonChange);return r(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;s(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,B.jsx)(Ri,{...e,ref:c,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Li.displayName=Ii;var Ri=L.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:i,...a}=e,o=ci(`SelectScrollButton`,n),s=L.useRef(null),c=Vr(n),u=L.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return L.useEffect(()=>()=>u(),[u]),r(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,B.jsx)(p.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:l(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(i,50))}),onPointerMove:l(a.onPointerMove,()=>{o.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(i,50))}),onPointerLeave:l(a.onPointerLeave,()=>{u()})})}),zi=`SelectSeparator`,Bi=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,B.jsx)(p.div,{"aria-hidden":!0,...r,ref:t})});Bi.displayName=zi;var Vi=`SelectArrow`,Hi=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Gr(n),a=qr(Vi,n),o=ci(Vi,n);return a.open&&o.position===`popper`?(0,B.jsx)(Fn,{...i,...r,ref:t}):null});Hi.displayName=Vi;var Ui=`SelectBubbleInput`,Wi=L.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=L.useRef(null),a=o(r,i),s=Or(t);return L.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(s!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[s,t]),(0,B.jsx)(p.select,{...n,style:{...In,...n.style},ref:a,defaultValue:t})});Wi.displayName=Ui;function Gi(e){return e===``||e===void 0}function Ki(e){let t=S(e),n=L.useRef(``),r=L.useRef(0),i=L.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=L.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return L.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function qi(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Ji(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Ji(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Yi=Xr,Xi=Qr,Zi=ei,Qi=ni,$i=ii,ea=oi,ta=yi,na=Ti,ra=ki,ia=ji,aa=Ni,oa=Fi,sa=Li,ca=Bi,la=Yi,ua=Zi,da=L.forwardRef((e,t)=>{let n=(0,z.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=s(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,i),n[4]=i,n[5]=o);let c;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,B.jsx)(Qi,{asChild:!0,children:(0,B.jsx)(_,{className:`h-4 w-4 opacity-50`})}),n[6]=c):c=n[6];let l;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(l=(0,B.jsxs)(Xi,{ref:t,className:o,...a,children:[r,c]}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=l):l=n[11],l});da.displayName=Xi.displayName;var fa=L.forwardRef((e,t)=>{let n=(0,z.c)(10),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 cursor-default items-center justify-center py-1`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,B.jsx)(h,{className:`h-4 w-4`}),n[5]=o):o=n[5];let c;return n[6]!==i||n[7]!==t||n[8]!==a?(c=(0,B.jsx)(oa,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=c):c=n[9],c});fa.displayName=oa.displayName;var pa=L.forwardRef((e,t)=>{let n=(0,z.c)(10),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 cursor-default items-center justify-center py-1`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,B.jsx)(_,{className:`h-4 w-4`}),n[5]=o):o=n[5];let c;return n[6]!==i||n[7]!==t||n[8]!==a?(c=(0,B.jsx)(sa,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=c):c=n[9],c});pa.displayName=sa.displayName;var ma=L.forwardRef((e,t)=>{let n=(0,z.c)(21),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:i,children:r,position:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let c=o===void 0?`popper`:o,l=c===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,u;n[5]!==i||n[6]!==l?(u=s(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,l,i),n[5]=i,n[6]=l,n[7]=u):u=n[7];let d;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,B.jsx)(fa,{}),n[8]=d):d=n[8];let f=c===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`,p;n[9]===f?p=n[10]:(p=s(`p-1`,f),n[9]=f,n[10]=p);let m;n[11]!==r||n[12]!==p?(m=(0,B.jsx)(ta,{className:p,children:r}),n[11]=r,n[12]=p,n[13]=m):m=n[13];let h;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,B.jsx)(pa,{}),n[14]=h):h=n[14];let g;return n[15]!==c||n[16]!==a||n[17]!==t||n[18]!==u||n[19]!==m?(g=(0,B.jsx)($i,{children:(0,B.jsxs)(ea,{ref:t,className:u,position:c,...a,children:[d,m,h]})}),n[15]=c,n[16]=a,n[17]=t,n[18]=u,n[19]=m,n[20]=g):g=n[20],g});ma.displayName=ea.displayName;var ha=L.forwardRef((e,t)=>{let n=(0,z.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(`py-1.5 pl-8 pr-2 text-sm font-semibold`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(na,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ha.displayName=na.displayName;var ga=L.forwardRef((e,t)=>{let n=(0,z.c)(14),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=s(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,i),n[4]=i,n[5]=o);let c;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,B.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,B.jsx)(aa,{children:(0,B.jsx)(T,{className:`h-4 w-4`})})}),n[6]=c):c=n[6];let l;n[7]===r?l=n[8]:(l=(0,B.jsx)(ia,{children:r}),n[7]=r,n[8]=l);let u;return n[9]!==a||n[10]!==t||n[11]!==o||n[12]!==l?(u=(0,B.jsxs)(ra,{ref:t,className:o,...a,children:[c,l]}),n[9]=a,n[10]=t,n[11]=o,n[12]=l,n[13]=u):u=n[13],u});ga.displayName=ra.displayName;var _a=L.forwardRef((e,t)=>{let n=(0,z.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 my-1 h-px bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,B.jsx)(ca,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});_a.displayName=ca.displayName;var va=`__ALL_PROJECTS__`;function ya(e){let t=(0,z.c)(8),{text:n,maxLength:r}=e,i=r===void 0?100:r;if(n.length<=i){let e;return t[0]===n?e=t[1]:(e=(0,B.jsx)(B.Fragment,{children:n}),t[0]=n,t[1]=e),e}let a;t[2]!==i||t[3]!==n?(a=n.substring(0,i),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,B.jsx)(`span`,{className:`text-muted-foreground ml-2`,children:`...`}),t[5]=o):o=t[5];let s;return t[6]===a?s=t[7]:(s=(0,B.jsxs)(B.Fragment,{children:[a,o]}),t[6]=a,t[7]=s),s}function ba(e,t){let n=`${t} - `,r=e.title??e.threadId;return r.startsWith(n)?r.slice(n.length):r}async function xa(e){let t=[],n=new Set,r=``;for(let i of e)try{let e=await A(i.threadId);e?.messages&&(t.push(...e.messages),e.conversationIds&&e.conversationIds.forEach(e=>n.add(e)),e.lastUpdated>r&&(r=e.lastUpdated))}catch(e){console.warn(`Failed to load history for thread ${i.threadId}:`,e)}return t.sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime()),{messages:t,conversationIds:Array.from(n),lastUpdated:r??new Date().toISOString()}}var Sa=(0,L.memo)(function({isOpen:e,onClose:t,initialFilter:r,projects:a,inline:o}){let[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(!1),[f,p]=(0,L.useState)(null),[h,g]=(0,L.useState)(0),[_,v]=(0,L.useState)(``),[y,x]=(0,L.useState)(``),S=(0,L.useCallback)(async e=>{u(!0),p(null);try{c(await A(e))}catch(e){p(e instanceof Error?e.message:`Failed to load conversation history`)}finally{u(!1)}},[]),w=(0,L.useCallback)(async e=>{if(e){u(!0),p(null);try{let t=a.find(t=>t.projectId===e);if(!t||t.threads.length===0){c({threadId:e,messages:[],lastUpdated:new Date().toISOString(),conversationIds:[]});return}c({threadId:e,...await xa(t.threads)})}catch(e){p(e instanceof Error?e.message:`Failed to load project history`)}finally{u(!1)}}},[a]),T=(0,L.useCallback)(async()=>{u(!0),p(null);try{c({threadId:va,...await xa(a.flatMap(e=>e.threads))})}catch(e){p(e instanceof Error?e.message:`Failed to load all projects history`)}finally{u(!1)}},[a]);(0,L.useEffect)(()=>{e&&r?r.type===`thread`?(x(r.id),v(``),g(0),S(r.id)):r.type===`project`&&(v(r.id),x(``),g(0),w(r.id)):e&&!r?(v(va),x(``),g(0),T()):e||(c(null),x(``),v(``),g(0),p(null))},[e,r,S,w,T]);let E=e=>{x(e),v(``),g(0),S(e)},D=e=>{v(e),x(``),g(0),e===va?T():w(e)},N=e=>new Date(e).toLocaleString(),ee=(e,t)=>{let n=new Date(e),r=new Date(t).getTime()-n.getTime();if(r<0)return{display:`0:00`,tooltip:`0 seconds`};let i=Math.floor(r/1e3),a=Math.floor(i/60),o=i%60,s=`${a}:${o.toString().padStart(2,`0`)}`,c;return c=a===0?`${o} second${o===1?``:`s`}`:o===0?`${a} minute${a===1?``:`s`}`:`${a} minute${a===1?``:`s`} ${o} second${o===1?``:`s`}`,{display:s,tooltip:c}},P=e=>({inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0});return e?(0,B.jsx)(`div`,{className:o?`h-full bg-background`:`fixed inset-0 z-50 bg-background`,children:(0,B.jsxs)(`div`,{className:`flex h-full flex-col`,children:[o?(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-6 px-6 pt-6`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`text-2xl font-bold`,children:`History`}),(0,B.jsx)(`p`,{className:`text-muted-foreground`,children:`View and browse conversation history across projects and threads.`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(la,{value:_,onValueChange:D,children:[(0,B.jsx)(da,{className:`w-48`,children:(0,B.jsx)(ua,{placeholder:`Select project`})}),(0,B.jsxs)(ma,{children:[(0,B.jsx)(ga,{value:va,children:`All Projects`}),a.map(e=>(0,B.jsx)(ga,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]}),(0,B.jsxs)(la,{value:y,onValueChange:E,children:[(0,B.jsx)(da,{className:`w-48`,children:(0,B.jsx)(ua,{placeholder:`Select thread`})}),(0,B.jsx)(ma,{children:a.flatMap(e=>e.threads.map(t=>(0,B.jsx)(ga,{value:t.threadId,children:ba(t,e.name??e.projectId)},t.threadId)))})]})]})]}):(0,B.jsxs)(`div`,{className:`flex items-center justify-between border-b p-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Conversation History`}),(0,B.jsxs)(la,{value:y,onValueChange:E,children:[(0,B.jsx)(da,{className:`w-48`,children:(0,B.jsx)(ua,{placeholder:`Select thread`})}),(0,B.jsx)(ma,{children:a.flatMap(e=>e.threads.map(t=>(0,B.jsx)(ga,{value:t.threadId,children:ba(t,e.name??e.projectId)},t.threadId)))})]}),(0,B.jsxs)(la,{value:_,onValueChange:D,children:[(0,B.jsx)(da,{className:`w-48`,children:(0,B.jsx)(ua,{placeholder:`Select project`})}),(0,B.jsxs)(ma,{children:[(0,B.jsx)(ga,{value:va,children:`All Projects`}),a.map(e=>(0,B.jsx)(ga,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]})]}),(0,B.jsx)(i,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,B.jsx)(n,{})})]}),s?.messages&&s.messages.length>0&&(0,B.jsxs)(`div`,{className:`flex items-center justify-between border-b ${o?`px-6 py-3`:`p-4`}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>{h>0&&g(h-1)},disabled:h===0,children:(0,B.jsx)(M,{className:`h-4 w-4 mr-1`})}),(0,B.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>{s?.messages&&h<s.messages.length-1&&g(h+1)},disabled:!s||h>=s.messages.length-1,children:(0,B.jsx)(k,{className:`h-4 w-4 ml-1`})})]}),(0,B.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[h+1,` of `,s?.messages.length??0,` messages`]})]}),(0,B.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:l?(0,B.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,B.jsxs)(`div`,{className:`text-center`,children:[(0,B.jsx)(b,{className:`h-8 w-8 animate-spin mx-auto mb-2`}),(0,B.jsx)(`p`,{children:`Loading conversation history...`})]})}):f?(0,B.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,B.jsxs)(O,{className:`max-w-md`,children:[(0,B.jsx)(C,{children:(0,B.jsx)(m,{className:`text-destructive`,children:`Error`})}),(0,B.jsxs)(j,{children:[(0,B.jsx)(`p`,{children:f}),(0,B.jsx)(i,{onClick:t,className:`mt-4`,children:`Close`})]})]})}):s?.messages?.length&&s.messages.length>0?(0,B.jsx)(re,{className:`h-full`,children:(0,B.jsx)(`div`,{className:o?`px-6 py-4`:`p-4`,children:(0,B.jsxs)(kr,{children:[(0,B.jsx)(Ar,{children:(0,B.jsxs)(Nr,{children:[(0,B.jsx)(Pr,{children:`Prompt`}),(0,B.jsx)(Pr,{children:`Answer`}),(0,B.jsx)(Pr,{className:`w-24`,children:`Model`}),(0,B.jsx)(Pr,{className:`w-24 text-right`,children:`Duration`}),(0,B.jsx)(Pr,{className:`w-20 text-right`,children:`Input Tokens`}),(0,B.jsx)(Pr,{className:`w-20 text-right`,children:`Output Tokens`}),(0,B.jsx)(Pr,{className:`w-32 text-right`,children:`Timestamp`})]})}),(0,B.jsx)(jr,{children:s.messages.map((e,t)=>{let{inputTokens:n,outputTokens:r}=P(e);return(0,B.jsxs)(Nr,{className:t===h?`bg-muted/50`:``,children:[(0,B.jsx)(Fr,{className:`max-w-md`,children:(0,B.jsx)(`div`,{className:`text-sm`,children:(0,B.jsx)(ya,{text:e.request.message})})}),(0,B.jsx)(Fr,{className:`max-w-md`,children:e.response?(0,B.jsx)(`div`,{className:`text-sm`,children:(0,B.jsx)(ya,{text:e.response.content})}):(0,B.jsx)(`span`,{className:`text-muted-foreground italic`,children:`No response`})}),(0,B.jsx)(Fr,{className:`text-sm`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(d,{className:`h-3 w-3 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,B.jsx)(Fr,{className:`text-sm text-right`,children:e.response?(0,B.jsx)(wr,{children:(0,B.jsxs)(Tr,{children:[(0,B.jsx)(Er,{asChild:!0,children:(0,B.jsx)(`div`,{className:`cursor-help`,children:ee(e.timestamp,e.response.completedAt).display})}),(0,B.jsx)(Dr,{children:(0,B.jsx)(`p`,{children:ee(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,B.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,B.jsx)(Fr,{className:`text-sm text-muted-foreground text-right`,children:n>0?n.toLocaleString():`-`}),(0,B.jsx)(Fr,{className:`text-sm text-muted-foreground text-right`,children:r>0?r.toLocaleString():`-`}),(0,B.jsx)(Fr,{className:`text-sm text-muted-foreground text-right`,children:N(e.timestamp)})]},e.id)})})]})})}):(0,B.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,B.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold`,children:`No History`}),(0,B.jsx)(`p`,{className:`text-muted-foreground`,children:`No conversation history found for this thread.`})]})})})]})}):null});export{pn as _,da as a,Dr as c,Rn as d,Nn as f,gn as g,Mn as h,ga as i,wr as l,Pn as m,la as n,Or as o,Fn as p,ma as r,Tr as s,Sa as t,Er as u};