tarsk 0.5.32 → 0.5.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +13411 -10600
- package/dist/public/assets/account-view-DgURa9wO.js +1 -0
- package/dist/public/assets/api-D20-ChK5.js +1 -0
- package/dist/public/assets/browser-tab-BkZ-W0ZU.js +1 -0
- package/dist/public/assets/commit-dialog-Dn3lBJf0.js +1 -0
- package/dist/public/assets/context-menu-giUOZqlU.js +1 -0
- package/dist/public/assets/create-repo-dialog-BHhIaWtq.js +1 -0
- package/dist/public/assets/{css.worker-DyDu5ynT.js → css.worker-CvXBzhp8.js} +2 -2
- package/dist/public/assets/dialogs-config-BReFb9pA.js +51 -0
- package/dist/public/assets/diff-view-qJIWYnSg.js +3 -0
- package/dist/public/assets/{dist-2eORHB3M.js → dist-oojFghRi.js} +5 -5
- package/dist/public/assets/explorer-tab-view-CSpFjb8v.js +2 -0
- package/dist/public/assets/explorer-tree-S9YsaOi1.js +1 -0
- package/dist/public/assets/explorer-view-C32uZDo3.js +1 -0
- package/dist/public/assets/git-history-dialog-CnX8jrlL.js +1 -0
- package/dist/public/assets/git-ops-button-Dq1NZf8p.js +2 -0
- package/dist/public/assets/history-view-B1NGR99Z.js +7 -0
- package/dist/public/assets/{html.worker-IWNXhnIC.js → html.worker-BO6WuOEO.js} +3 -3
- package/dist/public/assets/index-DX9uRO2S.js +65 -0
- package/dist/public/assets/index-sEZ3wJXu.css +1 -0
- package/dist/public/assets/{json.worker-c4h5s80L.js → json.worker-BkJRGcCJ.js} +2 -2
- package/dist/public/assets/mcp-server-card-r8x3YTUE.js +1 -0
- package/dist/public/assets/merged-pr-dialog-BeaCU-cQ.js +1 -0
- package/dist/public/assets/{monaco-BGyhgQtx.js → monaco-CZnIWXyV.js} +198 -198
- package/dist/public/assets/onboarding-9wyCVSx6.js +1 -0
- package/dist/public/assets/project-settings-view-DwUXGwcb.js +1 -0
- package/dist/public/assets/providers-list-view-DdvOkSba.js +1 -0
- package/dist/public/assets/pull-request-dialog-BoA7LHwC.js +1 -0
- package/dist/public/assets/pull-with-changes-dialog-DfDvKsSR.js +1 -0
- package/dist/public/assets/push-before-pr-dialog-z1phrgYb.js +1 -0
- package/dist/public/assets/radio-group-e2jZNm68.js +1 -0
- package/dist/public/assets/react-vendor-cnJwz5mh.js +16 -0
- package/dist/public/assets/rolldown-runtime-aKtaBQYM.js +1 -0
- package/dist/public/assets/settings-general-view-CZoJOG1f.js +1 -0
- package/dist/public/assets/settings-instructions-view-D5odL4cH.js +1 -0
- package/dist/public/assets/settings-list-BhAfkmpG.js +1 -0
- package/dist/public/assets/settings-mcp-servers-view-DSMMy7pg.js +5 -0
- package/dist/public/assets/settings-models-skeleton-B0vP0b-h.js +1 -0
- package/dist/public/assets/settings-models-view-Djs9jnlA.js +1 -0
- package/dist/public/assets/settings-rules-view-3lAnmzYN.js +8 -0
- package/dist/public/assets/settings-skills-view-DFToylEA.js +2 -0
- package/dist/public/assets/settings-slash-commands-view-BONEHaAi.js +1 -0
- package/dist/public/assets/settings-subagents-view-CvaI24Ea.js +2 -0
- package/dist/public/assets/settings-system-prompt-view-B6uGSpHt.js +1 -0
- package/dist/public/assets/settings-view-DrU8V_JV.js +2 -0
- package/dist/public/assets/{skeleton-DNfHG6mv.js → skeleton-Bq1upmHV.js} +1 -1
- package/dist/public/assets/terminal-panel-BtGdCcZb.js +2 -0
- package/dist/public/assets/{ts.worker-BwM5Ha3L.js → ts.worker-B0J26iPs.js} +33 -18
- package/dist/public/assets/ui-components-D9PkwrkK.js +1 -0
- package/dist/public/assets/{utils-Dt4Hs5eF.js → utils-Bz2-ir6I.js} +1 -1
- package/dist/public/assets/{whisper-wasm-BCJQtWoU.js → whisper-wasm-Cq5Ofwpd.js} +1 -1
- package/dist/public/index.html +10 -24
- package/dist/recommended-models.txt +13 -0
- package/package.json +8 -7
- package/dist/public/assets/account-view-DjLjq8T6.js +0 -1
- package/dist/public/assets/alert-dialog-BWqb8ENe.js +0 -1
- package/dist/public/assets/api-BbUzw5rb.js +0 -1
- package/dist/public/assets/browser-tab-BVsBMyo3.js +0 -1
- package/dist/public/assets/chat-input-container-Dh5eJPNP.js +0 -22
- package/dist/public/assets/commit-dialog-CfjW1f6P.js +0 -1
- package/dist/public/assets/context-menu-D_gX85jr.js +0 -1
- package/dist/public/assets/conversation-history-view-CKiv8CxD.js +0 -1
- package/dist/public/assets/create-repo-dialog-ByvOv7em.js +0 -1
- package/dist/public/assets/dialogs-config-CV8HzCCA.js +0 -51
- package/dist/public/assets/diff-view-CuEdnFtI.js +0 -3
- package/dist/public/assets/explorer-tab-view-CiDUcvE2.js +0 -2
- package/dist/public/assets/explorer-tree-cxPx2HiW.js +0 -1
- package/dist/public/assets/explorer-view-BCQNEBOZ.js +0 -1
- package/dist/public/assets/git-history-dialog-DKey5IQa.js +0 -1
- package/dist/public/assets/history-view-DDpROJvQ.js +0 -1
- package/dist/public/assets/index-BZwvl9X4.js +0 -29
- package/dist/public/assets/index-CihB-pLh.css +0 -1
- package/dist/public/assets/markdown-renderer-B1teF28W.js +0 -10
- package/dist/public/assets/mcp-server-card-CY-VLPhS.js +0 -1
- package/dist/public/assets/merged-pr-dialog-BfwdsytN.js +0 -1
- package/dist/public/assets/onboarding-BEy4bi0g.js +0 -1
- package/dist/public/assets/onboarding-dialog-GjczsXqi.js +0 -1
- package/dist/public/assets/page-toolbar-rWocuukR.js +0 -1
- package/dist/public/assets/project-settings-view-wlaXVds9.js +0 -1
- package/dist/public/assets/providers-list-view-BJsp9sta.js +0 -1
- package/dist/public/assets/pull-request-dialog-DDxX2W8n.js +0 -1
- package/dist/public/assets/pull-with-changes-dialog-BtXHWQ3k.js +0 -1
- package/dist/public/assets/push-before-pr-dialog-Cs54Vb76.js +0 -1
- package/dist/public/assets/radio-group-D2kNbZM6.js +0 -1
- package/dist/public/assets/react-vendor-DV_DP0Qd.js +0 -22
- package/dist/public/assets/resizable-jxPFsLog.js +0 -1
- package/dist/public/assets/rolldown-runtime-B1FJdls4.js +0 -1
- package/dist/public/assets/run-stop-button-N1JNjOlD.js +0 -2
- package/dist/public/assets/settings-general-view-BKcgxF5z.js +0 -1
- package/dist/public/assets/settings-instructions-view-DbQ3c3f1.js +0 -1
- package/dist/public/assets/settings-mcp-servers-view-D2_Brac1.js +0 -5
- package/dist/public/assets/settings-models-skeleton-BSV1GmZQ.js +0 -1
- package/dist/public/assets/settings-models-view-BhFuBHAE.js +0 -1
- package/dist/public/assets/settings-rules-view-qL__Zcav.js +0 -8
- package/dist/public/assets/settings-skills-view-Ccj8tTR9.js +0 -2
- package/dist/public/assets/settings-slash-commands-view-DyXAbQIp.js +0 -1
- package/dist/public/assets/settings-subagents-view-LcaON0Dq.js +0 -2
- package/dist/public/assets/settings-view-cLrxaSw4.js +0 -2
- package/dist/public/assets/side-panel-container-CCaF3ZtX.js +0 -2
- package/dist/public/assets/standard-list-item-PWOXi212.js +0 -1
- package/dist/public/assets/store-9Wm6Zyve.js +0 -4
- package/dist/public/assets/tab-context-BdML89mQ.js +0 -1
- package/dist/public/assets/tabs-BVcV8raO.js +0 -1
- package/dist/public/assets/terminal-panel-BG8UFUSX.js +0 -2
- package/dist/public/assets/textarea-CU-XhvgE.js +0 -1
- package/dist/public/assets/todos-view-DLC_0wx_.js +0 -1
- package/dist/public/assets/use-font-size-Bqn2rvp_.js +0 -1
- package/dist/public/assets/use-toast-CGSBJJb0.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-S9YsaOi1.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-DX9uRO2S.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-B1NGR99Z.js","assets/dialogs-config-BReFb9pA.js","assets/onboarding-9wyCVSx6.js","assets/whisper-wasm-Cq5Ofwpd.js","assets/react-vendor-cnJwz5mh.js","assets/utils-Bz2-ir6I.js","assets/index-sEZ3wJXu.css","assets/api-D20-ChK5.js","assets/context-menu-giUOZqlU.js","assets/ui-components-D9PkwrkK.js","assets/explorer-view-C32uZDo3.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Qa as t,Zr as n,ai as r,cr as i,eo as a,fi as o}from"./dialogs-config-BReFb9pA.js";import{r as s}from"./monaco-CZnIWXyV.js";import{l as c,u as l}from"./history-view-B1NGR99Z.js";import{A as u,S as d,i as f,n as p,r as m}from"./index-DX9uRO2S.js";var h=t(),g=e(a(),1),_=o(),v=(0,g.lazy)(()=>s(()=>import(`./explorer-tree-S9YsaOi1.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),y=(0,g.lazy)(()=>s(()=>import(`./explorer-view-C32uZDo3.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function b(){let e=(0,h.c)(18),t=u(x),[a,o]=(0,g.useState)(null),{pendingExplorerPath:s,setPendingExplorerPath:b,explorerClearPath:S,setExplorerClearPath:C}=d(),w,T;e[0]!==s||e[1]!==b?(w=()=>{s&&b(null)},T=[s,b],e[0]=s,e[1]=b,e[2]=w,e[3]=T):(w=e[2],T=e[3]),(0,g.useEffect)(w,T);let E,D;e[4]!==S||e[5]!==C?(E=()=>{S&&(o(e=>e&&(e.path===S||e.path.startsWith(S+`/`)?null:e)),C(null))},D=[S,C],e[4]=S,e[5]=C,e[6]=E,e[7]=D):(E=e[6],D=e[7]),(0,g.useEffect)(E,D);let O;e[8]!==a?.path||e[9]!==t?(O=(0,_.jsx)(m,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:(0,_.jsx)(i,{className:`h-full`,children:t?(0,_.jsx)(g.Suspense,{fallback:(0,_.jsx)(l,{}),children:(0,_.jsx)(v,{threadId:t,selectedPath:a?.path??null,onNodeSelect:o})}):(0,_.jsx)(`p`,{className:n(r.caption,`px-3 py-4 text-center`),children:`No thread selected.`})})}),e[8]=a?.path,e[9]=t,e[10]=O):O=e[10];let k;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,_.jsx)(p,{withHandle:!0}),e[11]=k):k=e[11];let A;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,_.jsx)(c,{}),e[12]=A):A=e[12];let j;e[13]===a?j=e[14]:(j=(0,_.jsx)(m,{className:`overflow-hidden`,children:(0,_.jsx)(g.Suspense,{fallback:A,children:(0,_.jsx)(y,{selectedFile:a})})}),e[13]=a,e[14]=j);let M;return e[15]!==O||e[16]!==j?(M=(0,_.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,_.jsxs)(f,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[O,k,j]})}),e[15]=O,e[16]=j,e[17]=M):M=e[17],M}function x(e){return e.selectedThreadId}export{b as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,Ha as n,Qa as r,Ri as i,Sa as a,Zr as o,ai as s,ba as c,eo as l,fi as u,pr as d,ya as f}from"./dialogs-config-BReFb9pA.js";import{u as p}from"./onboarding-9wyCVSx6.js";import{A as m,F as h,M as g,O as _,a as v,c as y,j as b,k as x,n as S,o as C,u as w}from"./history-view-B1NGR99Z.js";import{S as T,T as E,b as D,v as ee,y as O}from"./index-DX9uRO2S.js";import{a as k,i as A,n as j,r as M,t as N}from"./context-menu-giUOZqlU.js";import{n as P,o as F,r as I,s as L,t as R}from"./api-D20-ChK5.js";import{t as z}from"./ui-components-D9PkwrkK.js";var B=r(),V=e(l(),1),H=u(),U=V.forwardRef((e,t)=>{let n=(0,B.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=o(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,H.jsx)(z,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});U.displayName=z.displayName;var W=V.forwardRef((e,t)=>{let n=(0,B.c)(10),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let s;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,H.jsx)(i,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=s):s=n[3];let c;n[4]===r?c=n[5]:(c=o(`flex h-11 w-full rounded-md bg-transparent py-3 text-base outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,r),n[4]=r,n[5]=c);let l;return n[6]!==a||n[7]!==t||n[8]!==c?(l=(0,H.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[s,(0,H.jsx)(z.Input,{ref:t,className:c,...a})]}),n[6]=a,n[7]=t,n[8]=c,n[9]=l):l=n[9],l});W.displayName=z.Input.displayName;var G=V.forwardRef((e,t)=>{let n=(0,B.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=o(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,H.jsx)(z.List,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});G.displayName=z.List.displayName;var K=V.forwardRef((e,t)=>{let n=(0,B.c)(4),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=o(s.bodyMuted,`py-6 text-center`),n[0]=r):r=n[0];let i;return n[1]!==e||n[2]!==t?(i=(0,H.jsx)(z.Empty,{ref:t,className:r,...e}),n[1]=e,n[2]=t,n[3]=i):i=n[3],i});K.displayName=z.Empty.displayName;var q=V.forwardRef((e,t)=>{let n=(0,B.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=o(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,H.jsx)(z.Group,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});q.displayName=z.Group.displayName;var J=V.forwardRef((e,t)=>{let n=(0,B.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=o(`-mx-1 h-px bg-border`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,H.jsx)(z.Separator,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});J.displayName=z.Separator.displayName;var Y=V.forwardRef((e,t)=>{let n=(0,B.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=o(o(s.body,`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`),r),n[3]=r,n[4]=a);let c;return n[5]!==i||n[6]!==t||n[7]!==a?(c=(0,H.jsx)(z.Item,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=c):c=n[8],c});Y.displayName=z.Item.displayName;var te=e=>{let t=(0,B.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=o(s.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,H.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};te.displayName=`CommandShortcut`;var X=100,ne=500;function re(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function Z(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function Q(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(Z(n,t)&&(r.push(n.node),r.length>=ne))break;return r.sort((e,t)=>ie(e,t,n)).slice(0,X)}function ie(e,t,n){let r=n.trim().toLowerCase(),i=e.name.toLowerCase(),a=t.name.toLowerCase(),o=r?i.startsWith(r):!1;return o===(r?a.startsWith(r):!1)?e.type===t.type?e.path.localeCompare(t.path):e.type===`folder`?-1:1:o?-1:1}function ae(e){let t=(0,B.c)(38),{items:n,isReady:r,onRequestIndex:i,onOpenChange:c,onSelect:l}=e,u=r===void 0?!1:r,p=(0,V.useRef)(null),m=(0,V.useRef)(!1),h=(0,V.useRef)(!1),[g,_]=(0,V.useState)(!1),[v,y]=(0,V.useState)(``),b=(0,V.useDeferredValue)(v),x;t[0]===i?x=t[1]:(x=function(){h.current||(h.current=!0,i())},t[0]=i,t[1]=x);let S=x,C;t[2]!==b||t[3]!==n?(C=Q(n,re(b),b),t[2]=b,t[3]=n,t[4]=C):C=t[4];let w=C,T,E;t[5]!==c||t[6]!==v?(T=()=>{let e=v.trim().length>0;_(e),m.current!==e&&(m.current=e,c(e))},E=[c,v],t[5]=c,t[6]=v,t[7]=T,t[8]=E):(T=t[7],E=t[8]),(0,V.useEffect)(T,E);let k;t[9]===c?k=t[10]:(k=function(e){e||y(``),_(e),c(e),e&&requestAnimationFrame(()=>p.current?.focus())},t[9]=c,t[10]=k);let A=k,j;t[11]!==c||t[12]!==l?(j=function(e){l(e),_(!1),c(!1),y(``)},t[11]=c,t[12]=l,t[13]=j):j=t[13];let M=j,N;t[14]===S?N=t[15]:(N=e=>{S(),y(e.target.value)},t[14]=S,t[15]=N);let P;t[16]!==v||t[17]!==S||t[18]!==N?(P=(0,H.jsx)(D,{asChild:!0,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(d,{ref:p,value:v,onPointerDown:S,onChange:N,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),t[16]=v,t[17]=S,t[18]=N,t[19]=P):P=t[19];let F;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=o(s.compact,`py-4`),t[20]=F):F=t[20];let I=u?`No matches found.`:`Indexing files and folders...`,L;t[21]===I?L=t[22]:(L=(0,H.jsx)(K,{className:F,children:I}),t[21]=I,t[22]=L);let R;if(t[23]!==M||t[24]!==w){let e;t[26]===M?e=t[27]:(e=e=>(0,H.jsxs)(Y,{value:e.path,onSelect:()=>M(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,H.jsx)(f,{className:`h-4 w-4 text-muted-foreground`}):(0,H.jsx)(a,{className:`h-4 w-4 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate`,children:e.name}),(0,H.jsx)(`div`,{className:o(s.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),t[26]=M,t[27]=e),R=w.map(e),t[23]=M,t[24]=w,t[25]=R}else R=t[25];let z;t[28]===R?z=t[29]:(z=(0,H.jsx)(q,{children:R}),t[28]=R,t[29]=z);let W;t[30]!==L||t[31]!==z?(W=(0,H.jsx)(O,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:$,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,H.jsx)(U,{shouldFilter:!1,children:(0,H.jsxs)(G,{children:[L,z]})})}),t[30]=L,t[31]=z,t[32]=W):W=t[32];let J;return t[33]!==A||t[34]!==g||t[35]!==W||t[36]!==P?(J=(0,H.jsxs)(ee,{open:g,onOpenChange:A,children:[P,W]}),t[33]=A,t[34]=g,t[35]=W,t[36]=P,t[37]=J):J=t[37],J}function $(e){return e.preventDefault()}function oe(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function se(e){let t=(0,B.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=oe(n,r,i),t[0]=r,t[1]=n,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==n?(s=()=>F(n,r).then(ce),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=v(o,s),l;t[7]!==a||t[8]!==c?(l=a(c),t[7]=a,t[8]=c,t[9]=l):l=t[9];let u;return t[10]===l?u=t[11]:(u=(0,H.jsx)(H.Fragment,{children:l}),t[10]=l,t[11]=u),u}function ce(e){return e.entries}function le(e){let t=(0,B.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,V.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,V.useEffect)(l,u);let d;t[2]!==i||t[3]!==r?(d=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]=d):d=t[4];let f=d,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]!==f?(g=(0,H.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:h,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:ue}),t[8]=n,t[9]=h,t[10]=f,t[11]=g):g=t[11];let _;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==g?(_=(0,H.jsxs)(p,{level:a,basePadding:o,children:[s,g]}),t[12]=o,t[13]=s,t[14]=a,t[15]=g,t[16]=_):_=t[16],_}function ue(e){return e.stopPropagation()}function de(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}var fe=(0,V.memo)(function e({node:r,level:i,threadId:o,selectedPath:s,expandedPaths:l,getDirVersion:u,renamingPath:d,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onNewFile:S,onNewFolder:C,onCommitNewItem:w,onCancelNewItem:T}){let E=l.has(r.path),D=d===r.path,ee=m?.dirPath===r.path&&E;return r.type===`folder`?(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(p,{level:i,basePadding:10,selected:s===r.path,className:r.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),h(r)},children:[(0,H.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:E?(0,H.jsx)(n,{className:`h-3 w-3`}):(0,H.jsx)(t,{className:`h-3 w-3`})}),D?(0,H.jsxs)(H.Fragment,{children:[E?(0,H.jsx)(c,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}),(0,H.jsx)(`input`,{autoFocus:!0,defaultValue:r.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(r,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(r,t):b()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,H.jsxs)(H.Fragment,{children:[E?(0,H.jsx)(c,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}),(0,H.jsx)(`span`,{className:`flex-1 truncate`,children:r.name})]})]}),E&&(0,H.jsx)(`div`,{children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(y,{}),children:(0,H.jsx)(se,{threadId:o,dirPath:r.path,version:u(r.path),children:t=>(0,H.jsxs)(H.Fragment,{children:[ee&&(0,H.jsx)(le,{defaultValue:``,level:i+1,basePadding:m.type===`folder`?10:22,icon:m.type===`folder`?(0,H.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(a,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:w,onCancel:T}),t.map(t=>(0,H.jsx)(e,{node:t,level:i+1,threadId:o,selectedPath:s,expandedPaths:l,getDirVersion:u,renamingPath:d,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onNewFile:S,onNewFolder:C,onCommitNewItem:w,onCancelNewItem:T},t.path))]})})})})]})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>S(r.path),children:`New File...`}),(0,H.jsx)(M,{onSelect:()=>C(r.path),children:`New Folder...`}),(0,H.jsx)(A,{}),(0,H.jsx)(M,{onSelect:()=>_(r),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(r),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsxs)(p,{level:i,basePadding:22,selected:s===r.path,className:r.ignored?`opacity-50`:void 0,onClick:()=>g(r),children:[(0,H.jsx)(a,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),D?(0,H.jsx)(`input`,{autoFocus:!0,defaultValue:r.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(r,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(r,t):b()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,H.jsx)(`span`,{className:`flex-1 truncate`,children:r.name})]})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>_(r),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(r),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),pe=new Map;function me({threadId:e,selectedPath:t,onNodeSelect:n}){let[r,i]=(0,V.useState)(()=>new Map([[``,0]])),[o,s]=(0,V.useState)(new Set),[c,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(null),[p,v]=(0,V.useState)(null),[y,D]=(0,V.useState)(!1),[ee,O]=(0,V.useState)([]),[A,z]=(0,V.useState)(!1),[B,U]=(0,V.useState)(!1),W=(0,V.useRef)(null),G=(0,V.useRef)(0),K=(0,V.useRef)(null),{explorerRefreshTick:q,pendingExplorerPath:J}=T(),Y=(0,V.useMemo)(()=>`${e}:${q}`,[q,e]),te=(0,V.useCallback)(e=>{(0,V.startTransition)(()=>{D(t=>t===e?t:e)})},[]),X=(0,V.useCallback)(async()=>{if(!e)return;let t=pe.get(Y);if(t){O(t),z(!0);return}if(W.current!==Y){W.current=Y,O([]),z(!1);try{let t=de((await F(e,``,!0)).entries);pe.set(Y,t),O(t),z(!0)}catch{O([]),z(!1)}finally{W.current===Y&&(W.current=null)}}},[Y,e]),ne=(0,V.useCallback)(()=>{U(!0)},[]),re=(0,V.useCallback)(()=>{pe.delete(Y),O([]),z(!1)},[Y]),Z=(0,V.useCallback)(()=>{re(),B&&X()},[re,X,B]),Q=(0,V.useCallback)(e=>r.get(e)??0,[r]),ie=(0,V.useCallback)(e=>{i(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,V.useCallback)(t=>{e&&(C(oe(e,t,Q(t))),ie(t))},[ie,Q,e]),ce=(0,V.useCallback)(t=>{if(!e)return;let n=t.path.split(`/`);t.type===`file`&&n.pop();let r=[],i=``;for(let e of n)i=i?`${i}/${e}`:e,r.push(i);s(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,V.useEffect)(()=>{if(!e)return;let t=K.current!==null&&K.current!==e;K.current=e,t&&(i(new Map([[``,0]])),s(new Set),l(null),d(null),G.current=q)},[q,e]),(0,V.useEffect)(()=>{!e||q<=G.current||(G.current=q,i(t=>{let n=new Set([``]);for(let e of o)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;C(oe(e,i,n)),r.set(i,n+1)}return r}))},[q,o,e]),(0,V.useEffect)(()=>{O([]),z(!1),U(!1),W.current=null},[Y]),(0,V.useEffect)(()=>{!B||!e||X()},[X,B,e]),(0,V.useEffect)(()=>{if(!J||!e)return;let t=J.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)i(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[J,e]);function ue(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)),i(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function me(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function he(e){v(e)}async function ge(){if(!p)return;let t=p;v(null);try{await I(e,t.path),$(me(t.path)),Z(),s(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),i(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{E({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function _e(e){d(null),l(e.path)}async function ve(t,n){if(n===t.name){l(null);return}l(null);try{await L(e,t.path,n),$(me(t.path)),Z(),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}),i(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{E({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function ye(e){l(null),o.has(e)||(s(t=>new Set(t).add(e)),i(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),d({dirPath:e,type:`file`})}function be(e){l(null),o.has(e)||(s(t=>new Set(t).add(e)),i(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),d({dirPath:e,type:`folder`})}async function xe(t){if(!u)return;let{dirPath:n,type:r}=u;d(null);try{r===`file`?await R(e,n,t):await P(e,n,t),$(n),Z()}catch{E({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Se(){d(null)}function Ce(e){ce(e),e.type===`file`&&n(e)}let we=u?.dirPath===``?(0,H.jsx)(le,{defaultValue:``,level:0,basePadding:u.type===`folder`?10:22,icon:u.type===`folder`?(0,H.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(a,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:xe,onCancel:Se}):null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_,{open:p!==null,onOpenChange:e=>!e&&v(null),children:(0,H.jsxs)(b,{children:[(0,H.jsx)(h,{children:`Move to Trash`}),(0,H.jsxs)(g,{children:[`Move “`,p?.name,`” to trash?`]}),(0,H.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,H.jsx)(m,{children:`Cancel`}),(0,H.jsx)(x,{onClick:()=>void ge(),children:`Move to Trash`})]})]})}),(0,H.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,H.jsx)(ae,{items:ee,isReady:A,onRequestIndex:ne,onOpenChange:te,onSelect:e=>Ce(e)},Y)}),(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,disabled:y,children:(0,H.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,H.jsx)(S,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(w,{}),children:(0,H.jsx)(se,{threadId:e,dirPath:``,version:Q(``),children:r=>(0,H.jsxs)(H.Fragment,{children:[we,r.map(r=>(0,H.jsx)(fe,{node:r,level:0,threadId:e,selectedPath:t,expandedPaths:o,getDirVersion:Q,renamingPath:c,newItemIn:u,onToggleFolder:ue,onSelectNode:n,onStartRename:_e,onCommitRename:ve,onCancelRename:()=>l(null),onDelete:he,onNewFile:ye,onNewFolder:be,onCommitNewItem:xe,onCancelNewItem:Se},r.path))]})})})})})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>ye(``),children:`New File...`}),(0,H.jsx)(M,{onSelect:()=>be(``),children:`New Folder...`})]})]})]})}export{me as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ca as t,Qa as n,Yr as r,Zr as i,aa as a,ai as o,eo as s,fi as c}from"./dialogs-config-BReFb9pA.js";import{S as l}from"./react-vendor-cnJwz5mh.js";import{a as u,l as d,n as f,o as p}from"./history-view-B1NGR99Z.js";import{n as m}from"./utils-Bz2-ir6I.js";import{A as h,C as g,T as _,o as v}from"./index-DX9uRO2S.js";import{a as y,c as b,i as x}from"./api-D20-ChK5.js";var S=n(),C=e(s(),1),w=c(),T=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`,`bmp`,`tiff`,`tif`]),E=new Set([`mp4`,`webm`,`mov`,`avi`]);function D(e){let t=e.split(`.`).pop()?.toLowerCase()??``;return T.has(t)?`image`:E.has(t)?`video`:null}function O(e){return(e.split(`.`).pop()?.toLowerCase()??``)===`md`}function k(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 A(e,t){return`explorer-file:${e}:${t}`}function j(e){let t=(0,S.c)(10),{threadId:n,path:r,onContentReady:i}=e,a;t[0]!==r||t[1]!==n?(a=A(n,r),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;t[3]!==r||t[4]!==n?(o=()=>x(n,r),t[3]=r,t[4]=n,t[5]=o):o=t[5];let s=u(a,o),c,l;return t[6]!==i||t[7]!==s.content?(c=()=>{i({content:s.content,original:s.content})},l=[i,s.content],t[6]=i,t[7]=s.content,t[8]=c,t[9]=l):(c=t[8],l=t[9]),(0,C.useLayoutEffect)(c,l),null}function M({selectedFile:e}){let{resolvedTheme:n}=m(),s=h(e=>e.selectedThreadId),c=(0,C.useRef)(null),[u,x]=(0,C.useState)(null),[S,T]=(0,C.useState)(!1),[E,M]=(0,C.useState)(`edit`),[N,P]=(0,C.useState)(0),F=e?.type===`file`&&s&&!D(e.path)?e:null,I=u?.content??``,L=u?.original??``,R=F?`${s}:${F.path}:${N}`:null;(0,C.useEffect)(()=>()=>{c.current&&=(c.current.getModel()?.dispose(),c.current.dispose(),null)},[]),(0,C.useEffect)(()=>{e?.type===`file`?M(O(e.path)?`view`:`edit`):M(`edit`),x(null)},[e?.path,s]);async function z(){if(!(!s||!e)){T(!0);try{await b(s,e.path,I),x({content:I,original:I}),_({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){_({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{T(!1)}}}function B(){!s||!F||(p(A(s,F.path)),x(null),P(e=>e+1))}return s?(0,w.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,w.jsxs)(v,{className:`justify-between`,children:[(0,w.jsxs)(`div`,{className:`flex flex-col`,children:[(0,w.jsx)(`span`,{className:i(o.label,`text-foreground`),children:e?e.name:`Select a file to edit`}),(0,w.jsx)(`span`,{className:i(o.compact,`text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]}),F&&u?(0,w.jsxs)(`div`,{className:`flex gap-2`,children:[O(F.path)?(0,w.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,w.jsx)(r,{size:`sm`,variant:E===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>M(`view`),children:`View`}),(0,w.jsx)(r,{size:`sm`,variant:E===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>M(`edit`),children:`Edit`})]}):null,(0,w.jsxs)(r,{size:`sm`,onClick:()=>void z(),disabled:S||!I||I===L,children:[S?(0,w.jsx)(a,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null]}),(0,w.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:F?(0,w.jsxs)(f,{fallbackTitle:`Failed to load file`,onRetry:B,children:[(0,w.jsx)(C.Suspense,{fallback:(0,w.jsx)(d,{}),children:(0,w.jsx)(j,{threadId:s,path:F.path,onContentReady:x},R??void 0)}),u?O(F.path)&&E===`view`?(0,w.jsx)(`div`,{className:`h-full overflow-auto p-6`,children:(0,w.jsx)(g,{content:I,enableMermaid:!0})}):(0,w.jsx)(l,{height:`100%`,language:k(F.path),value:I,onChange:e=>x(t=>t&&{...t,content:e??``}),onMount:e=>{c.current=e},theme:n===`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,w.jsx)(d,{})]}):e?.type===`file`&&D(e.path)===`image`?(0,w.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,w.jsx)(`img`,{src:y(s,e.path),alt:e.name,className:`max-w-full max-h-full object-contain`})}):e?.type===`file`&&D(e.path)===`video`?(0,w.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,w.jsx)(`video`,{src:y(s,e.path),controls:!0,className:`max-w-full max-h-full`})}):(0,w.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,w.jsx)(t,{className:`h-10 w-10 text-muted-foreground/50`}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:i(o.label,`text-muted-foreground`),children:`No file selected`}),(0,w.jsx)(`p`,{className:i(o.bodyMuted,`mt-1`),children:`Select a file from the tree to edit it`})]})]})})})]}):(0,w.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[(0,w.jsx)(t,{className:`h-8 w-8 text-muted-foreground`}),(0,w.jsx)(`p`,{className:o.bodyMuted,children:`Select a thread to browse its files`})]})}export{M as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Qa as e,Yr as t,Zr as n,_r as r,aa as i,ai as a,fi as o,gr as s,hr as c,mr as l,vr as u,yr as d}from"./dialogs-config-BReFb9pA.js";var f=e(),p=o();function m(e){let o=(0,f.c)(28),{open:m,onOpenChange:g,commits:_,displayedCommits:v,isLoadingMore:y,onScroll:b,currentBranch:x}=e,S;o[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,p.jsx)(d,{children:`Commit History`}),o[0]=S):S=o[0];let C;o[1]===x?C=o[2]:(C=(0,p.jsxs)(u,{children:[S,(0,p.jsxs)(s,{children:[`Recent commits on branch `,x]})]}),o[1]=x,o[2]=C);let w;o[3]===v?w=o[4]:(w=v.length>0?v.map(h):(0,p.jsx)(`p`,{className:n(a.bodyMuted,`text-center py-8`),children:`No commits found`}),o[3]=v,o[4]=w);let T;o[5]===y?T=o[6]:(T=y&&(0,p.jsx)(`div`,{className:`p-3 text-center`,children:(0,p.jsx)(i,{className:`h-4 w-4 animate-spin inline`})}),o[5]=y,o[6]=T);let E;o[7]!==_.length||o[8]!==v.length||o[9]!==y?(E=v.length<_.length&&!y&&(0,p.jsx)(`div`,{className:n(a.caption,`p-3 text-center`),children:`Scroll to load more`}),o[7]=_.length,o[8]=v.length,o[9]=y,o[10]=E):E=o[10];let D;o[11]!==w||o[12]!==T||o[13]!==E?(D=(0,p.jsxs)(`div`,{className:`divide-y`,children:[w,T,E]}),o[11]=w,o[12]=T,o[13]=E,o[14]=D):D=o[14];let O;o[15]!==b||o[16]!==D?(O=(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto border rounded-lg`,onScroll:b,children:D}),o[15]=b,o[16]=D,o[17]=O):O=o[17];let k;o[18]===g?k=o[19]:(k=(0,p.jsx)(r,{children:(0,p.jsx)(t,{onClick:()=>g(!1),children:`Close`})}),o[18]=g,o[19]=k);let A;o[20]!==C||o[21]!==O||o[22]!==k?(A=(0,p.jsxs)(c,{className:`max-w-2xl max-h-[80vh] flex flex-col`,children:[C,O,k]}),o[20]=C,o[21]=O,o[22]=k,o[23]=A):A=o[23];let j;return o[24]!==g||o[25]!==m||o[26]!==A?(j=(0,p.jsx)(l,{open:m,onOpenChange:g,children:A}),o[24]=g,o[25]=m,o[26]=A,o[27]=j):j=o[27],j}function h(e){return(0,p.jsxs)(`div`,{className:`p-3 hover:bg-muted/50 transition-colors`,children:[(0,p.jsx)(`p`,{className:n(a.label,`break-words`),children:e.message}),(0,p.jsxs)(`p`,{className:n(a.bodyMuted,`mt-1`),children:[(0,p.jsx)(`span`,{className:a.mono,children:e.hash.substring(0,7)}),` •`,` `,e.author,` • `,new Date(e.date).toLocaleDateString()]})]},e.hash)}export{m as GitHistoryDialog};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/commit-dialog-Dn3lBJf0.js","assets/index-DX9uRO2S.js","assets/rolldown-runtime-aKtaBQYM.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-B1NGR99Z.js","assets/dialogs-config-BReFb9pA.js","assets/onboarding-9wyCVSx6.js","assets/whisper-wasm-Cq5Ofwpd.js","assets/react-vendor-cnJwz5mh.js","assets/utils-Bz2-ir6I.js","assets/index-sEZ3wJXu.css","assets/pull-request-dialog-BoA7LHwC.js","assets/create-repo-dialog-BHhIaWtq.js","assets/git-history-dialog-CnX8jrlL.js","assets/push-before-pr-dialog-z1phrgYb.js","assets/pull-with-changes-dialog-DfDvKsSR.js","assets/merged-pr-dialog-BeaCU-cQ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$n as t,$t as n,C as r,Ct as i,Da as a,Ha as ee,Lt as o,Oa as te,Qa as s,Qn as ne,Qt as re,Xa as c,Xn as ie,Yr as ae,Zn as oe,Zr as l,Zt as se,_a as u,aa as d,ai as f,an as ce,b as p,ct as m,d as h,en as le,eo as g,fi as _,h as v,ha as y,ln as b,ma as ue,nn as de,rn as x,sn as fe,u as S,ua as pe,ui as me,ut as C,xi as he,xt as w,y as T,z as E}from"./dialogs-config-BReFb9pA.js";import{r as D}from"./monaco-CZnIWXyV.js";import{A as ge,O,T as k,_ as _e,f as A,g as ve,h as j,k as M,m as ye,p as be}from"./index-DX9uRO2S.js";var N=e(g(),1),P=_();function xe(e,t){return t?`Creating PR...`:e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?`Sync`:e.hasChanges?`Commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`Open PR`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create PR`:e.hasUnpushedCommits&&e.prExists?`Update PR`:`Commit`}function F(e,t){return t?(0,P.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}):e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,P.jsx)(c,{className:`h-3.5 w-3.5`}):e.hasChanges?(0,P.jsx)(u,{className:`h-3.5 w-3.5`}):e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,P.jsx)(a,{className:`h-3.5 w-3.5`}):(0,P.jsx)(y,{className:`h-3.5 w-3.5`})}function Se(e){if(e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits){let t=e.defaultBranch??`main`;return e.currentBranch===e.defaultBranch?`Your branch is behind the remote. This will pull the latest changes from origin/${t}`:`Your branch "${e.currentBranch}" is behind "${t}". This will rebase and sync with the latest changes`}return e.hasChanges?e.changedFilesCount>0?`Commit ${e.changedFilesCount} changed file${e.changedFilesCount===1?``:`s`}`:`No changes to commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`View pull request in GitHub`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create pull request for committed changes`:e.hasUnpushedCommits&&e.prExists?`Update pull request with unpushed commits`:`No actions available`}function I(e,t,n=!1){return t||n?!0:e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?!1:!e.hasChanges&&!e.hasUnpushedCommits}function L(e){return e.hasChanges||e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}var Ce=s();function R(e){let n=(0,Ce.c)(80),{branchStatus:r,remoteUrl:i,hasRemoteBranch:o,hasUnpushedCommits:s,canCreateRepo:re,repoUrl:se,isRefreshing:u,isBrandState:ce,gitUser:p,isDirectCommitMode:m,isLoading:h,isLoadingHistory:le,onFetch:g,onPull:_,onPush:v,onOpenHistory:b,onCreatePR:de,onCreateRepo:x,onViewInGitHub:fe,onOpenChange:S}=e,me=`h-8 w-8 rounded-l-none px-1${ce?` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`:``}`,C;n[0]===u?C=n[1]:(C=u?(0,P.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}):(0,P.jsx)(ee,{className:`h-3.5 w-3.5`}),n[0]=u,n[1]=C);let w;n[2]!==h||n[3]!==me||n[4]!==C?(w=(0,P.jsx)(_e,{asChild:!0,children:(0,P.jsx)(ae,{variant:`outline`,size:`sm`,className:me,disabled:h,children:C})}),n[2]=h,n[3]=me,n[4]=C,n[5]=w):w=n[5];let T;n[6]!==r||n[7]!==i?(T=r===`Behind`&&(0,P.jsxs)(`div`,{className:l(f.compact,`px-2 py-1 text-amber-600`),children:[`Branch is behind `,i?`origin`:`remote`]}),n[6]=r,n[7]=i,n[8]=T):T=n[8];let E;n[9]===p?E=n[10]:(E=p&&(0,P.jsxs)(`div`,{className:l(f.compact,`px-2 py-1 text-muted-foreground`),children:[(0,P.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,p]}),n[9]=p,n[10]=E);let D;n[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,P.jsx)(ve,{}),n[11]=D):D=n[11];let ge;n[12]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,P.jsx)(te,{className:`h-3.5 w-3.5 mr-2`}),n[12]=ge):ge=n[12];let O;n[13]!==h||n[14]!==g?(O=(0,P.jsx)(t,{asChild:!0,children:(0,P.jsxs)(j,{onClick:g,disabled:h,children:[ge,`Fetch`]})}),n[13]=h,n[14]=g,n[15]=O):O=n[15];let k;n[16]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,P.jsx)(oe,{side:`right`,children:`Download latest information from remote without merging changes`}),n[16]=k):k=n[16];let A;n[17]===O?A=n[18]:(A=(0,P.jsx)(ne,{children:(0,P.jsxs)(ie,{children:[O,k]})}),n[17]=O,n[18]=A);let M;n[19]!==o||n[20]!==h||n[21]!==_?(M=()=>{o&&!h&&_()},n[19]=o,n[20]=h,n[21]=_,n[22]=M):M=n[22];let N=!o||h?`opacity-50 cursor-not-allowed`:``,xe;n[23]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,P.jsx)(c,{className:`h-3.5 w-3.5 mr-2`}),n[23]=xe):xe=n[23];let F;n[24]!==M||n[25]!==N?(F=(0,P.jsx)(t,{asChild:!0,children:(0,P.jsxs)(j,{onClick:M,className:N,children:[xe,`Pull`]})}),n[24]=M,n[25]=N,n[26]=F):F=n[26];let Se=o?`Pull latest changes from remote`:`No remote branch to pull from`,I;n[27]===Se?I=n[28]:(I=(0,P.jsx)(oe,{side:`right`,children:Se}),n[27]=Se,n[28]=I);let L;n[29]!==F||n[30]!==I?(L=(0,P.jsx)(ne,{children:(0,P.jsxs)(ie,{children:[F,I]})}),n[29]=F,n[30]=I,n[31]=L):L=n[31];let R;n[32]!==o||n[33]!==h||n[34]!==v?(R=!o&&(0,P.jsx)(ne,{children:(0,P.jsxs)(ie,{children:[(0,P.jsx)(t,{asChild:!0,children:(0,P.jsxs)(j,{onClick:v,disabled:h,children:[(0,P.jsx)(he,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,P.jsx)(oe,{side:`right`,children:`Create remote branch and push local commits`})]})}),n[32]=o,n[33]=h,n[34]=v,n[35]=R):R=n[35];let z;n[36]!==s||n[37]!==h||n[38]!==v?(z=()=>{s&&!h&&v()},n[36]=s,n[37]=h,n[38]=v,n[39]=z):z=n[39];let we=!s||h?`opacity-50 cursor-not-allowed`:``,B;n[40]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,P.jsx)(he,{className:`h-3.5 w-3.5 mr-2`}),n[40]=B):B=n[40];let V;n[41]!==z||n[42]!==we?(V=(0,P.jsx)(t,{asChild:!0,children:(0,P.jsxs)(j,{onClick:z,className:we,children:[B,`Push Commits`]})}),n[41]=z,n[42]=we,n[43]=V):V=n[43];let Te=s?h?`Push in progress...`:`Push your uncommitted commits to the remote branch`:`No commits to push - your branch is up to date with remote`,H;n[44]===Te?H=n[45]:(H=(0,P.jsx)(oe,{side:`right`,children:Te}),n[44]=Te,n[45]=H);let U;n[46]!==V||n[47]!==H?(U=(0,P.jsx)(ne,{children:(0,P.jsxs)(ie,{children:[V,H]})}),n[46]=V,n[47]=H,n[48]=U):U=n[48];let Ee=h||le,De;n[49]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,P.jsx)(pe,{className:`h-3.5 w-3.5 mr-2`}),n[49]=De):De=n[49];let W;n[50]!==b||n[51]!==Ee?(W=(0,P.jsxs)(j,{onClick:b,disabled:Ee,children:[De,`History`]}),n[50]=b,n[51]=Ee,n[52]=W):W=n[52];let G;n[53]!==m||n[54]!==h||n[55]!==de?(G=!m&&(0,P.jsxs)(j,{onClick:de,disabled:h,children:[(0,P.jsx)(y,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`]}),n[53]=m,n[54]=h,n[55]=de,n[56]=G):G=n[56];let K;n[57]!==re||n[58]!==h||n[59]!==x?(K=re&&(0,P.jsxs)(j,{onClick:x,disabled:h,children:[(0,P.jsx)(ue,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),n[57]=re,n[58]=h,n[59]=x,n[60]=K):K=n[60];let q;n[61]!==h||n[62]!==fe||n[63]!==se?(q=se&&(0,P.jsxs)(j,{onClick:fe,disabled:h,children:[(0,P.jsx)(a,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`]}),n[61]=h,n[62]=fe,n[63]=se,n[64]=q):q=n[64];let J;n[65]!==A||n[66]!==L||n[67]!==R||n[68]!==U||n[69]!==W||n[70]!==G||n[71]!==K||n[72]!==q||n[73]!==T||n[74]!==E?(J=(0,P.jsxs)(ye,{align:`end`,children:[T,E,D,A,L,R,U,W,G,K,q]}),n[65]=A,n[66]=L,n[67]=R,n[68]=U,n[69]=W,n[70]=G,n[71]=K,n[72]=q,n[73]=T,n[74]=E,n[75]=J):J=n[75];let Y;return n[76]!==S||n[77]!==w||n[78]!==J?(Y=(0,P.jsxs)(be,{onOpenChange:S,children:[w,J]}),n[76]=S,n[77]=w,n[78]=J,n[79]=Y):Y=n[79],Y}function z(){return{autoGenerateCommitMessage:S(),autoGeneratePRInfo:h(),privateRepositoryDefault:v()}}function we(e){e.autoGenerateCommitMessage!==void 0&&T(e.autoGenerateCommitMessage),e.autoGeneratePRInfo!==void 0&&p(e.autoGeneratePRInfo),e.privateRepositoryDefault!==void 0&&r(e.privateRepositoryDefault)}function B(e){return e?!0:(k({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}function V(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}function Te(e,t,n){let[r,i]=(0,N.useState)(!1),[a,ee]=(0,N.useState)(!1),o=()=>n?.id?n.provider?{provider:n.provider,model:n.id}:V(n.id):{provider:void 0,model:void 0};return{isGeneratingMessage:r,isGeneratingPRInfo:a,generateCommitMessageWithAI:(0,N.useCallback)(async()=>{if(!e)return null;try{i(!0);let{provider:t,model:n}=o();return await m(e,n,t)}catch(e){return console.error(`Failed to generate commit message:`,e),k({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{i(!1)}},[e,n]),generatePRInfoWithAI:(0,N.useCallback)(async()=>{if(!e)return null;try{ee(!0);let{provider:t,model:n}=o();return await C(e,n,t)}catch(e){return console.error(`Failed to generate PR info:`,e),k({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{ee(!1)}},[e,n])}}var H=(0,N.lazy)(()=>D(()=>import(`./commit-dialog-Dn3lBJf0.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),U=(0,N.lazy)(()=>D(()=>import(`./pull-request-dialog-BoA7LHwC.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),Ee=(0,N.lazy)(()=>D(()=>import(`./create-repo-dialog-BHhIaWtq.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11]))),De=(0,N.lazy)(()=>D(()=>import(`./git-history-dialog-CnX8jrlL.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([14,6,2]))),W=(0,N.lazy)(()=>D(()=>import(`./push-before-pr-dialog-z1phrgYb.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([15,6,2]))),G=(0,N.lazy)(()=>D(()=>import(`./pull-with-changes-dialog-DfDvKsSR.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([16,5,2,6]))),K=(0,N.lazy)(()=>D(()=>import(`./merged-pr-dialog-BeaCU-cQ.js`).then(e=>({default:e.MergedPRDialog})),__vite__mapDeps([17,6,2])));function q(){return null}function J({projectId:e,threadId:r}){let a=M(),ee=ge(e=>e.projectModelSelections[r]),te=ge(t=>t.projects.find(t=>t.projectId===e)),[s,c]=(0,N.useState)(!1),[l,u]=(0,N.useState)(!1),[d,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(!1),[h,g]=(0,N.useState)(``),[_,v]=(0,N.useState)(``),[y,ue]=(0,N.useState)(``),[S,pe]=(0,N.useState)(!1),[C,he]=(0,N.useState)(null),T=(0,N.useRef)(!1),D=(0,N.useRef)(!1),_e=(0,N.useRef)(_),ve=(0,N.useRef)(y);_e.current=_,ve.current=y;let[j,ye]=(0,N.useState)(!1),[be,Ce]=(0,N.useState)([]),[V,J]=(0,N.useState)(!1),[Y,Oe]=(0,N.useState)([]),[ke,Ae]=(0,N.useState)(!1),[je,Me]=(0,N.useState)(!1),[Ne,Pe]=(0,N.useState)(``),[Fe,Ie]=(0,N.useState)(``),[Le,Re]=(0,N.useState)(``),[ze,Be]=(0,N.useState)(!1),[Ve,He]=(0,N.useState)(!1),[Ue,We]=(0,N.useState)(!1),[Ge,Ke]=(0,N.useState)(!1),X=A(),{fetchUnifiedStatus:qe}=X,Z=Te(r,e,ee);async function Q(){fe();let e=await o();a({type:O.SetProjects,projects:e.projects})}let[$,Je]=(0,N.useState)(()=>z()),Ye=te?.commitMethod===me.Direct;(0,N.useEffect)(()=>{je&&te?.name&&!Ne&&Pe(te.name)},[je,te?.name,Ne]),(0,N.useEffect)(()=>{we($)},[$]);function Xe(){ze||(Be(!0),i().then(e=>Re(e)).catch(()=>{}))}(0,N.useEffect)(()=>{if(!d){D.current=!1;return}if(d&&$.autoGenerateCommitMessage&&!h.trim()&&r&&!D.current){D.current=!0;async function e(){let e=await Z.generateCommitMessageWithAI();e&&g(e)}e()}},[d,$.autoGenerateCommitMessage,r,Z.generateCommitMessageWithAI,h]),(0,N.useEffect)(()=>{if(!p){T.current=!1;return}if(p&&$.autoGeneratePRInfo&&!_e.current.trim()&&!ve.current.trim()&&r&&!T.current){T.current=!0;async function e(){let e=await Z.generatePRInfoWithAI();e&&(v(e.title),ue(e.description),k({title:`Success`,description:`PR title and description generated`}))}e()}},[p,$.autoGeneratePRInfo,r,Z.generatePRInfoWithAI]),(0,N.useEffect)(()=>{X.prExists&&X.prState===`MERGED`&&Ke(!0),l&&X.prExists&&X.prState===`OPEN`&&u(!1)},[X.prExists,X.prState,r,l]),(0,N.useEffect)(()=>{if(!l)return;let e=setTimeout(()=>{u(!1)},15e3);return()=>clearTimeout(e)},[l]);async function Ze(){if(h.trim()&&B(r))try{c(!0),await se(r,h),g(``),f(!1),await X.fetchUnifiedStatus(!0),Q(),k({title:`Changes committed successfully`,description:`Your changes have been committed to '${X.currentBranch}'.`}),Ue&&(We(!1),await rt())}catch(e){console.error(`Failed to commit:`,e),k({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{c(!1)}}async function Qe(){if(X.status===`Behind`&&!X.hasChanges&&!X.hasUnpushedCommits){await st();return}if(X.hasChanges){f(!0);return}if(X.prExists&&X.prState===`OPEN`&&!X.hasChanges&&!X.hasUnpushedCommits){X.prUrl&&await b(X.prUrl);return}if(X.commitsAheadOfDefault&&!X.prExists&&!X.hasChanges){m(!0);return}if(X.hasUnpushedCommits&&X.prExists){await tt();return}}async function $e(){let e=await Z.generateCommitMessageWithAI();e&&g(e)}async function et(){if(B(r))try{c(!0),await le(r),await X.fetchUnifiedStatus()}catch(e){console.error(`Failed to fetch:`,e)}finally{c(!1)}}async function tt(){if(B(r))try{c(!0),await x(r),await X.fetchUnifiedStatus(!0),Q(),X.hasRemoteBranch?k({title:`Branch pushed successfully`,description:`Your branch '${X.currentBranch}' has been pushed to the remote.`}):k({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){console.error(`Failed to push:`,e),k({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{c(!1)}}async function nt(){if(B(r)){if(X.hasChanges){He(!0);return}await rt()}}async function rt(){try{c(!0),await de(r),await X.fetchUnifiedStatus(!0),Q(),k({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){console.error(`Failed to pull:`,e),k({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{c(!1)}}function it(){He(!1),We(!0),f(!0)}async function at(){He(!1),await rt()}async function ot(){if(r)try{c(!0);let e=await re(r);fe();let t=await o();a({type:O.SetProjects,projects:t.projects}),k({title:`New branch created`,description:`Created new branch "${e.branchName}" on current thread`}),Ke(!1),await X.fetchUnifiedStatus(!0),setTimeout(()=>void X.fetchUnifiedStatus(!0),1500)}catch(e){console.error(`Failed to create new branch:`,e),k({title:`Failed to create new branch`,description:e instanceof Error?e.message:`Unknown error occurred`,variant:`destructive`})}finally{c(!1)}}async function st(){if(B(r))try{c(!0),await ce(r),await X.fetchUnifiedStatus(!0),Q(),k({title:`Branch synced successfully`,description:`Your branch '${X.currentBranch}' has been synced with the latest changes`})}catch(e){console.error(`[sync] ✗ Failed to sync branch:`,e),k({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{c(!1)}}async function ct(){if(B(r))try{c(!0),u(!0);let e=await n(r,_,y);e.prUrl&&await b(e.prUrl),v(``),ue(``),m(!1),await X.fetchUnifiedStatus(!0),Q();let t=0,i=setInterval(async()=>{if(t++,t>=6){clearInterval(i);return}await X.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to create PR:`,e);let t=e instanceof Error?e.message:`Failed to create PR`;t.includes(`push the current branch`)||t.includes(`--head flag`)?(m(!1),dt({title:_,description:y})):(u(!1),k({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{c(!1)}}async function lt(){if(B(r))try{c(!0);let e=await E(r,Ne,Fe,$.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{b(e.repoUrl)},3e3),Pe(``),Ie(``),Me(!1),await X.fetchUnifiedStatus(),Q()}catch(e){console.error(`Failed to create repo:`,e)}finally{c(!1)}}async function ut(){let e=await Z.generatePRInfoWithAI();e&&(v(e.title),ue(e.description),k({title:`Success`,description:`PR title and description generated`}))}async function dt(e){let t=e??C;if(!(!r||!t))try{c(!0),u(!0);try{await x(r)}catch(e){let t=e?.message??``;if(t.includes(`non-fast-forward`)||t.includes(`Updates were rejected because the tip of your current branch is behind`)){k({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await ce(r),await x(r)}catch{throw e}}else throw e}let e=await n(r,t.title,t.description);e.prUrl&&await b(e.prUrl),v(``),ue(``),he(null),pe(!1),await X.fetchUnifiedStatus(!0),Q();let i=0,a=setInterval(async()=>{if(i++,i>=6){clearInterval(a);return}await X.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to push and create PR:`,e);let t=e instanceof Error?e.message:`Failed to push and create PR`;u(!1),k({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{c(!1)}}async function ft(){if(B(r))try{J(!0);let e=await w(r,100);Ce(e),Oe(e.slice(0,10)),ye(!0)}catch(e){console.error(`Failed to fetch git history:`,e)}finally{J(!1)}}function pt(){ke||(Ae(!0),setTimeout(()=>{let e=Y.length+10;Oe(be.slice(0,e)),Ae(!1)},300))}function mt(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&Y.length<be.length&&!ke&&pt()}let ht=L(X);function gt(){X.repoUrl&&b(X.repoUrl)}function _t(){pe(!1),he(null)}function vt(){Ke(!1),X.fetchUnifiedStatus(!0)}return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-0`,children:[(0,P.jsx)(ne,{children:(0,P.jsxs)(ie,{children:[(0,P.jsx)(t,{asChild:!0,children:(0,P.jsxs)(ae,{variant:`outline`,size:`sm`,className:`h-8 rounded-r-none border-r-0 gap-1.5${ht?` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`:``}`,disabled:I(X,s,l),onClick:Qe,children:[F(X,l),xe(X,l)]})}),(0,P.jsx)(oe,{children:Se(X)})]})}),(0,P.jsx)(R,{branchStatus:X.status,remoteUrl:X.remoteUrl,hasRemoteBranch:X.hasRemoteBranch,hasUnpushedCommits:X.hasUnpushedCommits,canCreateRepo:X.canCreateRepo,repoUrl:X.repoUrl,isRefreshing:X.isRefreshing,isBrandState:ht,gitUser:Le,isDirectCommitMode:Ye,isLoading:s||l,isLoadingHistory:V,onFetch:()=>void et(),onPull:()=>void nt(),onPush:()=>void tt(),onOpenHistory:()=>void ft(),onCreatePR:()=>m(!0),onCreateRepo:()=>Me(!0),onViewInGitHub:gt,onOpenChange:e=>{e&&(Xe(),qe(!0))}})]}),d&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(H,{open:d,onOpenChange:f,commitMessage:h,onCommitMessageChange:g,autoGenerateCommitMessage:$.autoGenerateCommitMessage,onAutoGenerateChange:e=>Je(t=>({...t,autoGenerateCommitMessage:e})),isGeneratingMessage:Z.isGeneratingMessage,isLoading:s,onGenerateMessage:$e,onCommit:Ze,currentBranch:X.currentBranch})}),p&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(U,{open:p,onOpenChange:m,prTitle:_,onPrTitleChange:v,prDescription:y,onPrDescriptionChange:ue,isGeneratingPRInfo:Z.isGeneratingPRInfo,isLoading:s,onGeneratePRInfo:ut,onCreatePR:ct,currentBranch:X.currentBranch,autoGeneratePRInfo:$.autoGeneratePRInfo,onAutoGeneratePRInfoChange:e=>Je(t=>({...t,autoGeneratePRInfo:e}))})}),S&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(W,{open:S,onOpenChange:pe,isLoading:s,onPushAndCreatePR:dt,onCancel:_t})}),je&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(Ee,{open:je,onOpenChange:Me,repoName:Ne,onRepoNameChange:Pe,repoDescription:Fe,onRepoDescriptionChange:Ie,isPrivateRepo:$.privateRepositoryDefault,onPrivateRepoChange:e=>Je(t=>({...t,privateRepositoryDefault:e})),isLoading:s,onCreateRepo:lt})}),j&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(De,{open:j,onOpenChange:ye,commits:be,displayedCommits:Y,isLoadingMore:ke,onScroll:mt,currentBranch:X.currentBranch})}),Ve&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(G,{open:Ve,onOpenChange:He,onCommitFirst:it,onStashAndPull:at,onCancel:()=>He(!1),isLoading:s})}),Ge&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(K,{open:Ge,onOpenChange:Ke,onNewBranch:ot,onJustOpen:vt,isLoading:s})})]})}export{J as GitOpsButton};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{$a as n,$n as r,Ar as i,Ba as a,Br as o,Cr as s,Dr as c,Er as l,Fr as u,Gr as d,Ha as f,Hr as p,Jr as m,Kr as h,Lr as g,Mr as _,N as v,Or as y,Pr as b,Qa as x,Qn as S,Sr as C,Tr as w,Ua as T,Ur as E,Va as D,Wr as O,Xn as k,Xr as A,Yr as j,Zn as M,Zr as N,_i as P,aa as ee,ai as F,ar as I,br as L,cr as te,eo as R,er as z,fi as B,ii as V,ir as ne,ja as re,jr as ie,kr as ae,lr as oe,mi as H,nr as se,or as ce,qr as le,rr as ue,s as de,ur as fe,wi as pe,wr as me,xr as he,yt as ge,za as _e,zr as ve}from"./dialogs-config-BReFb9pA.js";var U=x(),W=e(R(),1),G=B(),ye=`AlertDialog`,[be,xe]=le(ye,[ae]),K=ae(),Se=e=>{let{__scopeAlertDialog:t,...n}=e,r=K(t);return(0,G.jsx)(w,{...r,...n,modal:!0})};Se.displayName=ye;var Ce=`AlertDialogTrigger`,we=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(c,{...i,...r,ref:t})});we.displayName=Ce;var Te=`AlertDialogPortal`,Ee=e=>{let{__scopeAlertDialog:t,...n}=e,r=K(t);return(0,G.jsx)(me,{...r,...n})};Ee.displayName=Te;var De=`AlertDialogOverlay`,Oe=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(s,{...i,...r,ref:t})});Oe.displayName=De;var ke=`AlertDialogContent`,[Ae,je]=be(ke),Me=E(`AlertDialogContent`),Ne=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=K(n),o=W.useRef(null),s=H(t,o),c=W.useRef(null);return(0,G.jsx)(y,{contentName:ke,titleName:Pe,docsSlug:`alert-dialog`,children:(0,G.jsx)(Ae,{scope:n,cancelRef:c,children:(0,G.jsxs)(he,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:m(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,G.jsx)(Me,{children:r}),(0,G.jsx)(He,{contentRef:o})]})})})});Ne.displayName=ke;var Pe=`AlertDialogTitle`,Fe=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(l,{...i,...r,ref:t})});Fe.displayName=Pe;var Ie=`AlertDialogDescription`,Le=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(C,{...i,...r,ref:t})});Le.displayName=Ie;var Re=`AlertDialogAction`,ze=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(L,{...i,...r,ref:t})});ze.displayName=Re;var Be=`AlertDialogCancel`,Ve=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=je(Be,n),a=K(n),o=H(t,i);return(0,G.jsx)(L,{...a,...r,ref:o})});Ve.displayName=Be;var He=({contentRef:e})=>{let t=`\`${ke}\` requires a description for the component to be accessible for screen reader users.
|
|
2
|
+
|
|
3
|
+
You can add a description to the \`${ke}\` by passing a \`${Ie}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
4
|
+
|
|
5
|
+
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${ke}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
6
|
+
|
|
7
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return W.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},Ue=Se,We=Ee,Ge=Oe,Ke=Ne,qe=ze,Je=Ve,Ye=Fe,Xe=Le,Ze=Ue,Qe=We,$e=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(`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,G.jsx)(Ge,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});$e.displayName=Ge.displayName;var et=W.forwardRef((e,t)=>{let n=(0,U.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]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsx)($e,{}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=N(`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`,r),n[4]=r,n[5]=o);let s;return n[6]!==i||n[7]!==t||n[8]!==o?(s=(0,G.jsxs)(Qe,{children:[a,(0,G.jsx)(Ke,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});et.displayName=Ke.displayName;var tt=e=>{let t=(0,U.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=N(`flex flex-col space-y-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};tt.displayName=`AlertDialogHeader`;var nt=e=>{let t=(0,U.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=N(`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,G.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};nt.displayName=`AlertDialogFooter`;var rt=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(F.dialogTitle,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(Ye,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});rt.displayName=Ye.displayName;var it=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(F.dialogDescription,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(Xe,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});it.displayName=Xe.displayName;var at=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(A(),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(qe,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});at.displayName=qe.displayName;var ot=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(A({variant:`outline`}),`mt-2 sm:mt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(Je,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ot.displayName=Je.displayName;function st(e){let t=(0,U.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=N(V.settingsPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,G.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ct(e){let t=(0,U.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=N(V.accountPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,G.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function lt(e){let t=(0,U.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=N(V.formPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,G.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ut(e){let t=(0,U.c)(16),{title:n,description:r,action:i,className:a,titleClassName:o}=e,s;t[0]===a?s=t[1]:(s=N(`flex items-center justify-between mb-6`,a),t[0]=a,t[1]=s);let c;t[2]===o?c=t[3]:(c=N(F.pageTitle,o),t[2]=o,t[3]=c);let l;t[4]!==c||t[5]!==n?(l=(0,G.jsx)(`h1`,{className:c,children:n}),t[4]=c,t[5]=n,t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=r?(0,G.jsx)(`p`,{className:F.pageSubtitle,children:r}):null,t[7]=r,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,G.jsxs)(`div`,{children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;return t[12]!==i||t[13]!==s||t[14]!==d?(f=(0,G.jsxs)(`div`,{className:s,children:[d,i]}),t[12]=i,t[13]=s,t[14]=d,t[15]=f):f=t[15],f}function dt(e){let t=(0,U.c)(5),{title:n,className:r}=e,i;t[0]===r?i=t[1]:(i=N(F.sectionTitle,`mb-3`,r),t[0]=r,t[1]=i);let a;return t[2]!==i||t[3]!==n?(a=(0,G.jsx)(`h2`,{className:i,children:n}),t[2]=i,t[3]=n,t[4]=a):a=t[4],a}function ft(e){let t=(0,U.c)(6),{children:n,variant:r,className:i}=e,a=r===void 0?`info`:r,o;t[0]!==i||t[1]!==a?(o=N(a===`hint`?F.hintBanner:a===`success`?N(F.body,`text-green-700 bg-green-50 dark:text-green-400 dark:bg-green-950/30 rounded-md px-3 py-2 mb-4`):a===`error`?N(F.error,`bg-destructive/10 rounded-md px-3 py-2 mb-4`):F.infoBanner,i),t[0]=i,t[1]=a,t[2]=o):o=t[2];let s;return t[3]!==n||t[4]!==o?(s=(0,G.jsx)(`div`,{className:o,children:n}),t[3]=n,t[4]=o,t[5]=s):s=t[5],s}function pt(e){let t=(0,U.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=N(`flex-1 overflow-auto`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,G.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function mt(e){let t=(0,U.c)(10),{children:n,title:r,action:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,G.jsx)(`h2`,{className:N(F.emptyStateTitle,`mb-2`),children:r}):null,t[0]=r,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,G.jsx)(`p`,{className:F.bodyMuted,children:n}),t[2]=n,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,G.jsx)(`div`,{className:`mt-4`,children:i}):null,t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,G.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,G.jsxs)(`div`,{className:`text-center`,children:[a,o,s]})}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function ht(e){let t=(0,U.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=N(`h-full flex flex-col overflow-hidden`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,G.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function gt(e){let t=(0,U.c)(14),{title:n,description:r,action:i,children:a,className:o}=e,s;t[0]===n?s=t[1]:(s=(0,G.jsx)(dt,{title:n,className:`mb-1`}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,G.jsx)(`p`,{className:F.bodyMuted,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]!==i||t[8]!==l?(u=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4 mb-3`,children:[l,i]}),t[7]=i,t[8]=l,t[9]=u):u=t[9];let d;return t[10]!==a||t[11]!==o||t[12]!==u?(d=(0,G.jsxs)(`div`,{className:o,children:[u,a]}),t[10]=a,t[11]=o,t[12]=u,t[13]=d):d=t[13],d}var _t=e(n(),1);function vt(e){let t=W.useRef({value:e,previous:e});return W.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var yt=[` `,`Enter`,`ArrowUp`,`ArrowDown`],bt=[` `,`Enter`],q=`Select`,[xt,St,Ct]=de(q),[wt,Tt]=le(q,[Ct,ce]),Et=ce(),[Dt,J]=wt(q),[Ot,kt]=wt(q),At=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:f,disabled:p,required:m,form:h}=e,g=Et(t),[_,v]=W.useState(null),[y,b]=W.useState(null),[x,S]=W.useState(!1),C=fe(l),[w,T]=O({prop:r,defaultProp:i??!1,onChange:a,caller:q}),[E,D]=O({prop:o,defaultProp:s,onChange:c,caller:q}),k=W.useRef(null),A=_?h||!!_.closest(`form`):!0,[j,M]=W.useState(new Set),N=Array.from(j).map(e=>e.props.value).join(`;`);return(0,G.jsx)(I,{...g,children:(0,G.jsxs)(Dt,{required:m,scope:t,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:d(),value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:k,disabled:p,children:[(0,G.jsx)(xt.Provider,{scope:t,children:(0,G.jsx)(Ot,{scope:e.__scopeSelect,onNativeOptionAdd:W.useCallback(e=>{M(t=>new Set(t).add(e))},[]),onNativeOptionRemove:W.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),A?(0,G.jsxs)(Cn,{"aria-hidden":!0,required:m,tabIndex:-1,name:u,autoComplete:f,value:E,onChange:e=>D(e.target.value),disabled:p,form:h,children:[E===void 0?(0,G.jsx)(`option`,{value:``}):null,Array.from(j)]},N):null]})})};At.displayName=q;var jt=`SelectTrigger`,Mt=W.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Et(n),s=J(jt,n),c=s.disabled||r,l=H(t,s.onTriggerChange),u=St(n),d=W.useRef(`touch`),[f,p,h]=Tn(e=>{let t=u().filter(e=>!e.disabled),n=En(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),g=e=>{c||(s.onOpenChange(!0),h()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,G.jsx)(se,{asChild:!0,...a,children:(0,G.jsx)(o.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":wn(s.value)?``:void 0,...i,ref:l,onClick:m(i.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&g(e)}),onPointerDown:m(i.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:m(i.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&p(e.key),!(t&&e.key===` `)&&yt.includes(e.key)&&(g(),e.preventDefault())})})})});Mt.displayName=jt;var Nt=`SelectValue`,Pt=W.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:s=``,...c}=e,l=J(Nt,n),{onValueNodeHasChildrenChange:u}=l,d=a!==void 0,f=H(t,l.onValueNodeChange);return h(()=>{u(d)},[u,d]),(0,G.jsx)(o.span,{...c,ref:f,style:{pointerEvents:`none`},children:wn(l.value)?(0,G.jsx)(G.Fragment,{children:s}):a})});Pt.displayName=Nt;var Ft=`SelectIcon`,It=W.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,G.jsx)(o.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});It.displayName=Ft;var Lt=`SelectPortal`,Rt=e=>(0,G.jsx)(b,{asChild:!0,...e});Rt.displayName=Lt;var Y=`SelectContent`,zt=W.forwardRef((e,t)=>{let n=J(Y,e.__scopeSelect),[r,i]=W.useState();if(h(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?_t.createPortal((0,G.jsx)(Bt,{scope:e.__scopeSelect,children:(0,G.jsx)(xt.Slot,{scope:e.__scopeSelect,children:(0,G.jsx)(`div`,{children:e.children})})}),t):null}return(0,G.jsx)(Ut,{...e,ref:t})});zt.displayName=Y;var X=10,[Bt,Z]=wt(Y),Vt=`SelectContentImpl`,Ht=p(`SelectContent.RemoveScroll`),Ut=W.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:h,collisionPadding:v,sticky:y,hideWhenDetached:b,avoidCollisions:x,...S}=e,C=J(Y,n),[w,T]=W.useState(null),[E,D]=W.useState(null),O=H(t,e=>T(e)),[k,A]=W.useState(null),[j,M]=W.useState(null),N=St(n),[P,ee]=W.useState(!1),F=W.useRef(!1);W.useEffect(()=>{if(w)return i(w)},[w]),_();let I=W.useCallback(e=>{let[t,...n]=N().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&&E&&(E.scrollTop=0),n===r&&E&&(E.scrollTop=E.scrollHeight),n?.focus(),document.activeElement!==i))return},[N,E]),L=W.useCallback(()=>I([k,w]),[I,k,w]);W.useEffect(()=>{P&&L()},[P,L]);let{onOpenChange:te,triggerPointerDownPosRef:R}=C;W.useEffect(()=>{if(w){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(R.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(R.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():w.contains(n.target)||te(!1),document.removeEventListener(`pointermove`,t),R.current=null};return R.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[w,te,R]),W.useEffect(()=>{let e=()=>te(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[te]);let[z,B]=Tn(e=>{let t=N().filter(e=>!e.disabled),n=En(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),V=W.useCallback((e,t,n)=>{let r=!F.current&&!n;(C.value!==void 0&&C.value===t||r)&&(A(e),r&&(F.current=!0))},[C.value]),ne=W.useCallback(()=>w?.focus(),[w]),re=W.useCallback((e,t,n)=>{let r=!F.current&&!n;(C.value!==void 0&&C.value===t||r)&&M(e)},[C.value]),ae=r===`popper`?qt:Gt,oe=ae===qt?{side:c,sideOffset:l,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:h,collisionPadding:v,sticky:y,hideWhenDetached:b,avoidCollisions:x}:{};return(0,G.jsx)(Bt,{scope:n,content:w,viewport:E,onViewportChange:D,itemRefCallback:V,selectedItem:k,onItemLeave:ne,itemTextRefCallback:re,focusSelectedItem:L,selectedItemText:j,position:r,isPositioned:P,searchRef:z,children:(0,G.jsx)(ie,{as:Ht,allowPinchZoom:!0,children:(0,G.jsx)(u,{asChild:!0,trapped:C.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:m(a,e=>{C.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,G.jsx)(g,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:(0,G.jsx)(ae,{role:`listbox`,id:C.contentId,"data-state":C.open?`open`:`closed`,dir:C.dir,onContextMenu:e=>e.preventDefault(),...S,...oe,onPlaced:()=>ee(!0),ref:O,style:{display:`flex`,flexDirection:`column`,outline:`none`,...S.style},onKeyDown:m(S.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&B(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=N().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(()=>I(t)),e.preventDefault()}})})})})})})});Ut.displayName=Vt;var Wt=`SelectItemAlignedPosition`,Gt=W.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=J(Y,n),s=Z(Y,n),[c,l]=W.useState(null),[u,d]=W.useState(null),f=H(t,e=>d(e)),p=St(n),m=W.useRef(!1),g=W.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=s,x=W.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&u&&_&&v&&y){let e=a.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=y.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=oe(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=oe(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let o=p(),s=window.innerHeight-X*2,l=_.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+h+l+b+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-X,D=s-E,O=v.offsetHeight/2,k=v.offsetTop+O,A=f+h+k,j=x-A;if(A<=E){let e=o.length>0&&v===o[o.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-_.offsetTop-_.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+g);c.style.height=n+`px`}else{let e=o.length>0&&v===o[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+_.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,_.scrollTop=A-E+_.offsetTop}c.style.margin=`${X}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>m.current=!0)}},[p,a.trigger,a.valueNode,c,u,_,v,y,a.dir,r]);h(()=>x(),[x]);let[S,C]=W.useState();return h(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]),(0,G.jsx)(Jt,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:W.useCallback(e=>{e&&g.current===!0&&(x(),b?.(),g.current=!1)},[x,b]),children:(0,G.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,G.jsx)(o.div,{...i,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Gt.displayName=Wt;var Kt=`SelectPopperPosition`,qt=W.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=Et(n);return(0,G.jsx)(ne,{...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)`}})});qt.displayName=Kt;var[Jt,Yt]=wt(Y,{}),Xt=`SelectViewport`,Zt=W.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Z(Xt,n),s=Yt(Xt,n),c=H(t,a.onViewportChange),l=W.useRef(0);return(0,G.jsxs)(G.Fragment,{children:[(0,G.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,G.jsx)(xt.Slot,{scope:n,children:(0,G.jsx)(o.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:m(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-X*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`)}}}l.current=t.scrollTop})})})]})});Zt.displayName=Xt;var Qt=`SelectGroup`,[$t,en]=wt(Qt),tn=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=d();return(0,G.jsx)($t,{scope:n,id:i,children:(0,G.jsx)(o.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});tn.displayName=Qt;var nn=`SelectLabel`,rn=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=en(nn,n);return(0,G.jsx)(o.div,{id:i.id,...r,ref:t})});rn.displayName=nn;var an=`SelectItem`,[on,sn]=wt(an),cn=W.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...s}=e,c=J(an,n),l=Z(an,n),u=c.value===r,[f,p]=W.useState(a??``),[h,g]=W.useState(!1),_=H(t,e=>l.itemRefCallback?.(e,r,i)),v=d(),y=W.useRef(`touch`),b=()=>{i||(c.onValueChange(r),c.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,G.jsx)(on,{scope:n,value:r,disabled:i,textId:v,isSelected:u,onItemTextChange:W.useCallback(e=>{p(t=>t||(e?.textContent??``).trim())},[]),children:(0,G.jsx)(xt.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:(0,G.jsx)(o.div,{role:`option`,"aria-labelledby":v,"data-highlighted":h?``:void 0,"aria-selected":u&&h,"data-state":u?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...s,ref:_,onFocus:m(s.onFocus,()=>g(!0)),onBlur:m(s.onBlur,()=>g(!1)),onClick:m(s.onClick,()=>{y.current!==`mouse`&&b()}),onPointerUp:m(s.onPointerUp,()=>{y.current===`mouse`&&b()}),onPointerDown:m(s.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:m(s.onPointerMove,e=>{y.current=e.pointerType,i?l.onItemLeave?.():y.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:m(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:m(s.onKeyDown,e=>{l.searchRef?.current!==``&&e.key===` `||(bt.includes(e.key)&&b(),e.key===` `&&e.preventDefault())})})})})});cn.displayName=an;var ln=`SelectItemText`,un=W.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,s=J(ln,n),c=Z(ln,n),l=sn(ln,n),u=kt(ln,n),[d,f]=W.useState(null),p=H(t,e=>f(e),l.onItemTextChange,e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),m=d?.textContent,g=W.useMemo(()=>(0,G.jsx)(`option`,{value:l.value,disabled:l.disabled,children:m},l.value),[l.disabled,l.value,m]),{onNativeOptionAdd:_,onNativeOptionRemove:v}=u;return h(()=>(_(g),()=>v(g)),[_,v,g]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(o.span,{id:l.textId,...a,ref:p}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?_t.createPortal(a.children,s.valueNode):null]})});un.displayName=ln;var dn=`SelectItemIndicator`,fn=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return sn(dn,n).isSelected?(0,G.jsx)(o.span,{"aria-hidden":!0,...r,ref:t}):null});fn.displayName=dn;var pn=`SelectScrollUpButton`,mn=W.forwardRef((e,t)=>{let n=Z(pn,e.__scopeSelect),r=Yt(pn,e.__scopeSelect),[i,a]=W.useState(!1),o=H(t,r.onScrollButtonChange);return h(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,G.jsx)(_n,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});mn.displayName=pn;var hn=`SelectScrollDownButton`,gn=W.forwardRef((e,t)=>{let n=Z(hn,e.__scopeSelect),r=Yt(hn,e.__scopeSelect),[i,a]=W.useState(!1),o=H(t,r.onScrollButtonChange);return h(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,G.jsx)(_n,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});gn.displayName=hn;var _n=W.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Z(`SelectScrollButton`,n),s=W.useRef(null),c=St(n),l=W.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return W.useEffect(()=>()=>l(),[l]),h(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,G.jsx)(o.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:m(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:m(i.onPointerMove,()=>{a.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:m(i.onPointerLeave,()=>{l()})})}),vn=`SelectSeparator`,yn=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,G.jsx)(o.div,{"aria-hidden":!0,...r,ref:t})});yn.displayName=vn;var bn=`SelectArrow`,xn=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Et(n),a=J(bn,n),o=Z(bn,n);return a.open&&o.position===`popper`?(0,G.jsx)(ue,{...i,...r,ref:t}):null});xn.displayName=bn;var Sn=`SelectBubbleInput`,Cn=W.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=W.useRef(null),a=H(r,i),s=vt(t);return W.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,G.jsx)(o.select,{...n,style:{...z,...n.style},ref:a,defaultValue:t})});Cn.displayName=Sn;function wn(e){return e===``||e===void 0}function Tn(e){let t=ve(e),n=W.useRef(``),r=W.useRef(0),i=W.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=W.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return W.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function En(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=Dn(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 Dn(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var On=At,kn=Mt,An=Pt,jn=It,Mn=Rt,Nn=zt,Pn=Zt,Fn=rn,In=cn,Ln=un,Rn=fn,zn=mn,Bn=gn,Vn=yn,Hn=On,Un=An,Wn=W.forwardRef((e,t)=>{let n=(0,U.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=N(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-base 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 s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(jn,{asChild:!0,children:(0,G.jsx)(f,{className:`h-4 w-4 opacity-50`})}),n[6]=s):s=n[6];let c;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(c=(0,G.jsxs)(kn,{ref:t,className:o,...a,children:[r,s]}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=c):c=n[11],c});Wn.displayName=kn.displayName;var Gn=W.forwardRef((e,t)=>{let n=(0,U.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=N(`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,G.jsx)(_e,{className:`h-4 w-4`}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,G.jsx)(zn,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});Gn.displayName=zn.displayName;var Kn=W.forwardRef((e,t)=>{let n=(0,U.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=N(`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,G.jsx)(f,{className:`h-4 w-4`}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,G.jsx)(Bn,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});Kn.displayName=Bn.displayName;var qn=W.forwardRef((e,t)=>{let n=(0,U.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 s=o===void 0?`popper`:o,c=s===`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`,l;n[5]!==i||n[6]!==c?(l=N(`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`,c,i),n[5]=i,n[6]=c,n[7]=l):l=n[7];let u;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,G.jsx)(Gn,{}),n[8]=u):u=n[8];let d=s===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`,f;n[9]===d?f=n[10]:(f=N(`p-1`,d),n[9]=d,n[10]=f);let p;n[11]!==r||n[12]!==f?(p=(0,G.jsx)(Pn,{className:f,children:r}),n[11]=r,n[12]=f,n[13]=p):p=n[13];let m;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,G.jsx)(Kn,{}),n[14]=m):m=n[14];let h;return n[15]!==s||n[16]!==a||n[17]!==t||n[18]!==l||n[19]!==p?(h=(0,G.jsx)(Mn,{children:(0,G.jsxs)(Nn,{ref:t,className:l,position:s,...a,children:[u,p,m]})}),n[15]=s,n[16]=a,n[17]=t,n[18]=l,n[19]=p,n[20]=h):h=n[20],h});qn.displayName=Nn.displayName;var Jn=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(`py-1.5 pl-8 pr-2 text-base font-semibold`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(Fn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Jn.displayName=Fn.displayName;var Yn=W.forwardRef((e,t)=>{let n=(0,U.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=N(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-base 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 s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,G.jsx)(Rn,{children:(0,G.jsx)(T,{className:`h-4 w-4`})})}),n[6]=s):s=n[6];let c;n[7]===r?c=n[8]:(c=(0,G.jsx)(Ln,{children:r}),n[7]=r,n[8]=c);let l;return n[9]!==a||n[10]!==t||n[11]!==o||n[12]!==c?(l=(0,G.jsxs)(In,{ref:t,className:o,...a,children:[s,c]}),n[9]=a,n[10]=t,n[11]=o,n[12]=c,n[13]=l):l=n[13],l});Yn.displayName=In.displayName;var Xn=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(`-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,G.jsx)(Vn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Xn.displayName=Vn.displayName;function Zn(e){let t=(0,U.c)(14),{className:n,label:r,size:i}=e,a=i===void 0?`md`:i,o=a===`sm`?`h-4 w-4`:a===`lg`?`h-8 w-8`:`h-6 w-6`,s;t[0]===n?s=t[1]:(s=N(`flex h-full items-center justify-center`,n),t[0]=n,t[1]=s);let c;t[2]===o?c=t[3]:(c=N(o,`animate-spin mx-auto text-muted-foreground`),t[2]=o,t[3]=c);let l;t[4]===c?l=t[5]:(l=(0,G.jsx)(ee,{className:c}),t[4]=c,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,G.jsx)(`p`,{className:N(F.bodyMuted,`mt-2`),children:r}):null,t[6]=r,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,G.jsxs)(`div`,{className:`text-center`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;return t[11]!==s||t[12]!==d?(f=(0,G.jsx)(`div`,{className:s,children:d}),t[11]=s,t[12]=d,t[13]=f):f=t[13],f}function Qn(){let e=(0,U.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(`div`,{className:`space-y-1 px-2 py-2`,children:[1,2,3].map($n)}),e[0]=t):t=e[0],t}function $n(e){return(0,G.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e)}function er(){let e=(0,U.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded mx-4 my-1`}),e[0]=t):t=e[0],t}var tr=new Map;function nr(e,t){let n=tr.get(e);return n||(n={promise:t().catch(t=>{throw tr.delete(e),t})},tr.set(e,n)),n.promise}function rr(e){tr.delete(e)}function ir(e){for(let t of tr.keys())t.startsWith(e)&&tr.delete(t)}function ar(e,t){return(0,W.use)(nr(e,t))}var or=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(`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,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});or.displayName=`Card`;var sr=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(`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,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});sr.displayName=`CardHeader`;var cr=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(F.sectionTitle,`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,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});cr.displayName=`CardTitle`;var lr=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(F.bodyMuted,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});lr.displayName=`CardDescription`;var ur=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(`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,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ur.displayName=`CardContent`;var dr=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(`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,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});dr.displayName=`CardFooter`;var fr=class extends W.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`AsyncErrorBoundary caught an error:`,e,t)}handleRetry=()=>{this.setState({error:null}),this.props.onRetry?.()};render(){let{error:e}=this.state;return e?this.props.renderFallback?this.props.renderFallback(e,this.handleRetry):(0,G.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,G.jsxs)(or,{className:`max-w-md`,children:[(0,G.jsx)(sr,{children:(0,G.jsx)(cr,{className:`text-destructive`,children:this.props.fallbackTitle??`Something went wrong`})}),(0,G.jsxs)(ur,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:F.body,children:e.message}),(0,G.jsx)(j,{variant:`outline`,onClick:this.handleRetry,children:`Retry`})]})]})}):this.props.children}},pr=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(`w-full caption-bottom`,F.body,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,G.jsx)(`table`,{ref:t,className:a,...i})}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});pr.displayName=`Table`;var mr=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(`[&_tr]:border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`thead`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});mr.displayName=`TableHeader`;var hr=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(`[&_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,G.jsx)(`tbody`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});hr.displayName=`TableBody`;var gr=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(`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,G.jsx)(`tfoot`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});gr.displayName=`TableFooter`;var _r=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(`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,G.jsx)(`tr`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});_r.displayName=`TableRow`;var Q=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(`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,G.jsx)(`th`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Q.displayName=`TableHead`;var $=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(`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,G.jsx)(`td`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});$.displayName=`TableCell`;var vr=W.forwardRef((e,t)=>{let n=(0,U.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=N(F.caption,`mt-4`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`caption`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});vr.displayName=`TableCaption`;var yr=t({ConversationHistoryView:()=>Dr,default:()=>Dr}),br=`__ALL_PROJECTS__`;function xr(e){let t=(0,U.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,G.jsx)(G.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,G.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,G.jsxs)(G.Fragment,{children:[a,o]}),t[6]=a,t[7]=s),s}function Sr(e,t){let n=`${t} - `,r=e.title??e.threadId;return r.startsWith(n)?r.slice(n.length):r}async function Cr(e){let t=[],n=new Set,r=``;for(let i of e)try{let e=await ge(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()}}function wr(e,t){return e.type===`thread`?`conversation-history:thread:${e.threadId}:${t}`:e.type===`project`?`conversation-history:project:${e.projectId}:${t}`:`conversation-history:all:${t}`}async function Tr(e,t){if(e.type===`thread`)return await ge(e.threadId);if(e.type===`project`){let n=t.find(t=>t.projectId===e.projectId);if(!n||n.threads.length===0)return{threadId:e.projectId,messages:[],lastUpdated:new Date().toISOString(),conversationIds:[]};let r=await Cr(n.threads);return{threadId:e.projectId,...r}}return{threadId:br,...await Cr(t.flatMap(e=>e.threads))}}function Er(e){let t=(0,U.c)(45),{scope:n,projects:i,loadVersion:o,currentPromptIndex:s,onPromptIndexChange:c}=e,l;t[0]!==o||t[1]!==n?(l=wr(n,o),t[0]=o,t[1]=n,t[2]=l):l=t[2];let u;t[3]!==i||t[4]!==n?(u=()=>Tr(n,i),t[3]=i,t[4]=n,t[5]=u):u=t[5];let d=ar(l,u),f;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=function(e){return new Date(e).toLocaleString()},t[6]=f):f=t[6];let p=f,m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=function(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}},t[7]=m):m=t[7];let h=m,g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(e){return{inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0}},t[8]=g):g=t[8];let _=g,v;t[9]!==s||t[10]!==d.messages||t[11]!==c?(v=function(){d.messages&&s<d.messages.length-1&&c(s+1)},t[9]=s,t[10]=d.messages,t[11]=c,t[12]=v):v=t[12];let y=v,b;t[13]!==s||t[14]!==c?(b=function(){s>0&&c(s-1)},t[13]=s,t[14]=c,t[15]=b):b=t[15];let x=b;if(!d.messages?.length){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,G.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,G.jsx)(`h3`,{className:F.emptyStateTitle,children:`No history`}),(0,G.jsx)(`p`,{className:F.bodyMuted,children:`No conversation history found for this thread.`})]})}),t[16]=e):e=t[16],e}let C=s===0,w;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,G.jsx)(D,{className:`h-4 w-4 mr-1`}),t[17]=w):w=t[17];let T;t[18]!==x||t[19]!==C?(T=(0,G.jsx)(j,{variant:`outline`,size:`sm`,onClick:x,disabled:C,children:w}),t[18]=x,t[19]=C,t[20]=T):T=t[20];let E=s>=d.messages.length-1,O;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,G.jsx)(a,{className:`h-4 w-4 ml-1`}),t[21]=O):O=t[21];let A;t[22]!==y||t[23]!==E?(A=(0,G.jsx)(j,{variant:`outline`,size:`sm`,onClick:y,disabled:E,children:O}),t[22]=y,t[23]=E,t[24]=A):A=t[24];let P;t[25]!==T||t[26]!==A?(P=(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[T,A]}),t[25]=T,t[26]=A,t[27]=P):P=t[27];let ee=s+1,I;t[28]!==d.messages.length||t[29]!==ee?(I=(0,G.jsxs)(`div`,{className:F.bodyMuted,children:[ee,` of `,d.messages.length,` messages`]}),t[28]=d.messages.length,t[29]=ee,t[30]=I):I=t[30];let L;t[31]!==P||t[32]!==I?(L=(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-b py-3 px-0`,children:[P,I]}),t[31]=P,t[32]=I,t[33]=L):L=t[33];let R;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,G.jsx)(mr,{children:(0,G.jsxs)(_r,{children:[(0,G.jsx)(Q,{children:`Prompt`}),(0,G.jsx)(Q,{children:`Answer`}),(0,G.jsx)(Q,{className:`w-24`,children:`Model`}),(0,G.jsx)(Q,{className:`w-24 text-right`,children:`Duration`}),(0,G.jsx)(Q,{className:`w-20 text-right`,children:`Input Tokens`}),(0,G.jsx)(Q,{className:`w-20 text-right`,children:`Output Tokens`}),(0,G.jsx)(Q,{className:`w-32 text-right`,children:`Timestamp`})]})}),t[34]=R):R=t[34];let z;if(t[35]!==s||t[36]!==d.messages){let e;t[38]===s?e=t[39]:(e=(e,t)=>{let{inputTokens:n,outputTokens:i}=_(e);return(0,G.jsxs)(_r,{className:t===s?`bg-muted/50`:``,children:[(0,G.jsx)($,{className:`max-w-md`,children:(0,G.jsx)(`div`,{className:F.body,children:(0,G.jsx)(xr,{text:e.request.message})})}),(0,G.jsx)($,{className:`max-w-md`,children:e.response?(0,G.jsx)(`div`,{className:F.body,children:(0,G.jsx)(xr,{text:e.response.content})}):(0,G.jsx)(`span`,{className:N(F.bodyMuted,`italic`),children:`No response`})}),(0,G.jsx)($,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(re,{className:`h-3 w-3 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,G.jsx)($,{className:N(F.caption,`text-right`),children:e.response?(0,G.jsx)(S,{children:(0,G.jsxs)(k,{children:[(0,G.jsx)(r,{asChild:!0,children:(0,G.jsx)(`div`,{className:`cursor-help`,children:h(e.timestamp,e.response.completedAt).display})}),(0,G.jsx)(M,{children:(0,G.jsx)(`p`,{children:h(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,G.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,G.jsx)($,{className:N(F.bodyMuted,`text-right`),children:n>0?n.toLocaleString():`-`}),(0,G.jsx)($,{className:N(F.bodyMuted,`text-right`),children:i>0?i.toLocaleString():`-`}),(0,G.jsx)($,{className:N(F.bodyMuted,`text-right`),children:p(e.timestamp)})]},e.id)},t[38]=s,t[39]=e),z=d.messages.map(e),t[35]=s,t[36]=d.messages,t[37]=z}else z=t[37];let B;t[40]===z?B=t[41]:(B=(0,G.jsx)(te,{className:`h-full`,children:(0,G.jsx)(`div`,{className:`py-4`,children:(0,G.jsxs)(pr,{children:[R,(0,G.jsx)(hr,{children:z})]})})}),t[40]=z,t[41]=B);let V;return t[42]!==L||t[43]!==B?(V=(0,G.jsxs)(G.Fragment,{children:[L,B]}),t[42]=L,t[43]=B,t[44]=V):V=t[44],V}var Dr=(0,W.memo)(function({isOpen:e,onClose:t,initialFilter:n,projects:r,inline:i}){let[a,o]=(0,W.useState)(0),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(``),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)(0),[_,y]=(0,W.useState)(null),[b,x]=(0,W.useState)(null),S=(0,W.useMemo)(()=>l?{type:`thread`,threadId:l}:s===br?{type:`all`}:s?{type:`project`,projectId:s}:null,[s,l]),C=S?wr(S,h):null;(0,W.useEffect)(()=>{e&&n?n.type===`thread`?(u(n.id),c(``),o(0)):n.type===`project`&&(c(n.id),u(``),o(0)):e&&!n?(c(br),u(``),o(0)):e||(u(``),c(``),o(0),x(null),y(null))},[e,n]);let w=e=>{u(e),c(``),o(0),y(null),x(null)},T=e=>{c(e),u(``),o(0),y(null),x(null)},E=(0,W.useCallback)(()=>{if(l){let e=r.flatMap(e=>e.threads).find(e=>e.threadId===l),t=r.find(e=>e.threads.some(e=>e.threadId===l)),n=e?Sr(e,t?.name??t?.projectId??``):l;return{options:{threadId:l},title:`Clear Thread History`,description:`Permanently delete all conversation history for "${n}"? This cannot be undone.`}}if(s&&s!==br){let e=r.find(e=>e.projectId===s)?.name??s;return{options:{projectId:s},title:`Clear Project History`,description:`Permanently delete all conversation history for "${e}"? This cannot be undone.`}}return{options:void 0,title:`Clear All History`,description:`Permanently delete all conversation history across every project and thread? This cannot be undone.`}},[r,s,l]),D=(0,W.useCallback)(async()=>{let e=E();m(!0),x(null);try{await v(e.options),C&&rr(C),y(C),o(0),f(!1)}catch(e){x(e instanceof Error?e.message:`Failed to clear conversation history`)}finally{m(!1)}},[E,C]);function O(){S&&rr(wr(S,h)),g(e=>e+1),y(null),x(null)}let k=E();if(!e)return null;let A=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Hn,{value:s,onValueChange:T,children:[(0,G.jsx)(Wn,{className:`w-48`,children:(0,G.jsx)(Un,{placeholder:`Select project`})}),(0,G.jsxs)(qn,{children:[(0,G.jsx)(Yn,{value:br,children:`All Projects`}),r.map(e=>(0,G.jsx)(Yn,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]}),(0,G.jsxs)(Hn,{value:l,onValueChange:w,children:[(0,G.jsx)(Wn,{className:`w-48`,children:(0,G.jsx)(Un,{placeholder:`Select thread`})}),(0,G.jsx)(qn,{children:r.flatMap(e=>e.threads.map(t=>(0,G.jsx)(Yn,{value:t.threadId,children:Sr(t,e.name??e.projectId)},t.threadId)))})]}),(0,G.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>f(!0),disabled:p,children:[(0,G.jsx)(pe,{className:`h-4 w-4 mr-2`}),`Clear`]})]}),M=(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsx)(`div`,{className:i?void 0:`border-b px-6 py-4`,children:(0,G.jsx)(ut,{title:`History`,description:i?`View and browse conversation history across projects and threads.`:void 0,action:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[A,i?null:(0,G.jsx)(j,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,G.jsx)(P,{})})]})})}),(0,G.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:b?(0,G.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,G.jsxs)(or,{className:`max-w-md`,children:[(0,G.jsx)(sr,{children:(0,G.jsx)(cr,{className:`text-destructive`,children:`Error`})}),(0,G.jsxs)(ur,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{children:b}),(0,G.jsx)(j,{onClick:()=>x(null),children:`Dismiss`})]})]})}):_&&_===C?(0,G.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,G.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,G.jsx)(`h3`,{className:F.emptyStateTitle,children:`No history`}),(0,G.jsx)(`p`,{className:F.bodyMuted,children:`No conversation history found for this thread.`})]})}):S?(0,G.jsx)(fr,{fallbackTitle:`Failed to load conversation history`,onRetry:O,children:(0,G.jsx)(W.Suspense,{fallback:(0,G.jsx)(Zn,{label:`Loading conversation history...`,size:`lg`}),children:(0,G.jsx)(Er,{scope:S,projects:r,loadVersion:h,currentPromptIndex:a,onPromptIndexChange:o},C??void 0)})}):(0,G.jsx)(Zn,{label:`Loading conversation history...`,size:`lg`})})]});return(0,G.jsxs)(G.Fragment,{children:[i?(0,G.jsx)(pt,{children:(0,G.jsx)(st,{className:`max-w-none w-full h-full flex flex-col min-h-0`,children:M})}):(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background`,children:M}),(0,G.jsx)(Ze,{open:d,onOpenChange:f,children:(0,G.jsxs)(et,{children:[(0,G.jsxs)(tt,{children:[(0,G.jsx)(rt,{children:k.title}),(0,G.jsx)(it,{children:k.description})]}),(0,G.jsxs)(nt,{children:[(0,G.jsx)(ot,{disabled:p,children:`Cancel`}),(0,G.jsx)(at,{onClick:e=>{e.preventDefault(),D()},disabled:p,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:p?`Clearing...`:`Clear`})]})]})})]})});export{ot as A,dt as C,pt as D,st as E,rt as F,it as M,nt as N,Ze as O,tt as P,ut as S,mt as T,vt as _,ar as a,gt as b,er as c,Hn as d,qn as f,Un as g,Wn as h,ur as i,et as j,at as k,Zn as l,Xn as m,fr as n,rr as o,Yn as p,or as r,ir as s,yr as t,Qn as u,ct as v,ht as w,ft as x,lt as y};
|