tarsk 0.5.53 → 0.5.55
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 +2305 -1255
- package/dist/public/assets/{account-view-5qdPli2O.js → account-view-CkhRveFm.js} +1 -1
- package/dist/public/assets/{api-DM6LtnPA.js → api-BUjKoVUu.js} +1 -1
- package/dist/public/assets/browser-tab-DbT2QjH_.js +8 -0
- package/dist/public/assets/commit-dialog-DRMKciNP.js +1 -0
- package/dist/public/assets/context-menu-DO3hiSAo.js +1 -0
- package/dist/public/assets/create-repo-dialog-CXiWjkFb.js +1 -0
- package/dist/public/assets/dialogs-config-86QTDk4G.js +51 -0
- package/dist/public/assets/{diff-view-DxSswxah.js → diff-view-D_xoUbUb.js} +2 -2
- package/dist/public/assets/{explorer-tab-view-DMt-0Zcl.js → explorer-tab-view-JIMdE8cA.js} +2 -2
- package/dist/public/assets/{explorer-tree-D3nyQX1f.js → explorer-tree-B60M0QAV.js} +1 -1
- package/dist/public/assets/{explorer-view-BRBtKxsw.js → explorer-view-BBaEk8i9.js} +2 -2
- package/dist/public/assets/git-history-dialog-DfzFi0Nx.js +1 -0
- package/dist/public/assets/git-ops-button-C_4iUio-.js +2 -0
- package/dist/public/assets/history-view-BsN806ip.js +9 -0
- package/dist/public/assets/index-C2iIghSR.js +81 -0
- package/dist/public/assets/mcp-server-card-DUJUtQq-.js +1 -0
- package/dist/public/assets/merged-pr-dialog-DVNtED4V.js +1 -0
- package/dist/public/assets/model-star-rating-DrR6jzjq.js +1 -0
- package/dist/public/assets/onboarding-DCrFdRM5.js +1 -0
- package/dist/public/assets/{project-settings-view-XGHhtLr_.js → project-settings-view-DRL5CTSQ.js} +1 -1
- package/dist/public/assets/{providers-list-view-Cbndeobz.js → providers-list-view-DkmgzncX.js} +1 -1
- package/dist/public/assets/pull-request-dialog-CPjzwrdo.js +1 -0
- package/dist/public/assets/pull-with-changes-dialog-DLfDpEEX.js +1 -0
- package/dist/public/assets/push-before-pr-dialog-v-3J53Hw.js +1 -0
- package/dist/public/assets/radio-group-C7-1cZ2t.js +1 -0
- package/dist/public/assets/{react-vendor-U9lUQswz.js → react-vendor-DK2COBjg.js} +5 -5
- package/dist/public/assets/settings-general-view-BZZs0t0d.js +1 -0
- package/dist/public/assets/{settings-instructions-view-CRUCeWUk.js → settings-instructions-view-CE-ugC91.js} +1 -1
- package/dist/public/assets/{settings-list-BapKAJV3.js → settings-list-CICo_cz2.js} +1 -1
- package/dist/public/assets/settings-mcp-servers-view-DKviDm0q.js +5 -0
- package/dist/public/assets/{settings-models-skeleton-B7TMwjxe.js → settings-models-skeleton-MXSIpmT8.js} +1 -1
- package/dist/public/assets/{settings-models-view-ObE_ktqH.js → settings-models-view-DWqPx-2m.js} +1 -1
- package/dist/public/assets/settings-rules-view-Cq-60UOT.js +8 -0
- package/dist/public/assets/{settings-skills-view-MZQjnD_g.js → settings-skills-view-B6srjIvU.js} +3 -3
- package/dist/public/assets/settings-slash-commands-view-j8NdZX1V.js +1 -0
- package/dist/public/assets/settings-subagents-view-4LusGYrq.js +2 -0
- package/dist/public/assets/{settings-system-prompt-view-CZe9uYNN.js → settings-system-prompt-view-DPMiLsrM.js} +1 -1
- package/dist/public/assets/{settings-view-BQL9vEvw.js → settings-view-0Idf-mDz.js} +2 -2
- package/dist/public/assets/skeleton-BvvAbfo4.js +1 -0
- package/dist/public/assets/slug-utils-jE4NOx-f.js +1 -0
- package/dist/public/assets/tabs-0fGgot48.js +1 -0
- package/dist/public/assets/tasks-view-DD03SZ7R.js +3 -0
- package/dist/public/assets/{terminal-panel-CrBP1KEj.js → terminal-panel-D6RjOZfD.js} +2 -2
- package/dist/public/assets/{ui-components-BPFbmhJA.js → ui-components-BJRW2LJq.js} +1 -1
- package/dist/public/assets/{use-deferred-search-Bi99md6l.js → use-deferred-search-DOfdC3JO.js} +1 -1
- package/dist/public/assets/{utils-C-7eVelM.js → utils-DPYK-CSn.js} +1 -1
- package/dist/public/assets/{vosk-speech-DC3I453R.js → vosk-speech-Ce0kC8Ck.js} +1 -1
- package/dist/public/assets/{web-CHeXRjkl.js → web-BFYPtzjF.js} +1 -1
- package/dist/public/assets/{web-DbVs7vzI.js → web-Cp_I5n5Z.js} +1 -1
- package/dist/public/assets/{web-GowI_ZaX.js → web-DGEc3VyT.js} +1 -1
- package/dist/public/assets/{web-t7m2rd8w.js → web-DLSR_y_6.js} +1 -1
- package/dist/public/index.html +7 -7
- package/package.json +2 -1
- package/dist/public/assets/browser-tab-B9KCHZ2L.js +0 -8
- package/dist/public/assets/commit-dialog-DeVXqj1Z.js +0 -1
- package/dist/public/assets/context-menu-CHJI6MbC.js +0 -1
- package/dist/public/assets/create-repo-dialog-ByIjJnh7.js +0 -1
- package/dist/public/assets/dialogs-config-DAMqiy-4.js +0 -51
- package/dist/public/assets/git-history-dialog-DJfkffd6.js +0 -1
- package/dist/public/assets/git-ops-button-0DrfLBkC.js +0 -2
- package/dist/public/assets/history-view-lvvTzW7O.js +0 -9
- package/dist/public/assets/index-C_iiobDl.js +0 -81
- package/dist/public/assets/mcp-server-card-DPMxJJU6.js +0 -1
- package/dist/public/assets/merged-pr-dialog-BC9NMIet.js +0 -1
- package/dist/public/assets/model-star-rating-C4Ugsik_.js +0 -1
- package/dist/public/assets/onboarding-dys9Rwb5.js +0 -1
- package/dist/public/assets/pull-request-dialog-kuaKjUle.js +0 -1
- package/dist/public/assets/pull-with-changes-dialog-CoxkFsGu.js +0 -1
- package/dist/public/assets/push-before-pr-dialog-C4cbgPuA.js +0 -1
- package/dist/public/assets/radio-group-C6EDTFov.js +0 -1
- package/dist/public/assets/settings-general-view-BHj9qn0K.js +0 -1
- package/dist/public/assets/settings-mcp-servers-view-M2DQPcpo.js +0 -5
- package/dist/public/assets/settings-rules-view-BhRBowk9.js +0 -8
- package/dist/public/assets/settings-slash-commands-view-BYHthCEM.js +0 -1
- package/dist/public/assets/settings-subagents-view-CmrFQcUF.js +0 -2
- package/dist/public/assets/skeleton-rEPpLCqo.js +0 -1
- package/dist/public/assets/slug-utils-DZ59sTAJ.js +0 -1
- package/dist/public/assets/tabs-D57g7ER1.js +0 -1
- package/dist/public/assets/tasks-view-Bn9GiPNp.js +0 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$ as t,Aa as n,Br as r,Fa as i,Ii as a,Is as o,K as s,Ki as c,Kn as l,Ko as u,La as d,Lr as f,Lt as p,No as m,Ns as h,Pi as g,Po as _,Ps as v,Qr as y,Qt as b,Rr as x,c as S,ei as C,eo as w,fs as T,ga as E,ii as D,ka as O,lt as k,ni as ee,ri as te,ro as A,st as j,to as M,za as N}from"./dialogs-config-DAMqiy-4.js";import{N as P}from"./react-vendor-U9lUQswz.js";import{t as F}from"./monaco-CZnIWXyV.js";import{I,a as ne,l as re,n as L,o as ie}from"./history-view-lvvTzW7O.js";import{d as ae}from"./onboarding-dys9Rwb5.js";import{n as oe}from"./utils-C-7eVelM.js";import{C as se,H as ce,I as le,K as ue,U as de,V as fe,W as pe,d as me,f as R,h as he,m as ge,p as _e}from"./index-C_iiobDl.js";import{a as z,n as ve,r as ye,t as be}from"./context-menu-CHJI6MbC.js";var B=e(o(),1),V=v(),H=h();function U(e){let t=(0,V.c)(20),{children:n,title:r,subtitle:i,headerAction:a,footer:o}=e,s;t[0]===r?s=t[1]:(s=r&&(0,H.jsx)(`span`,{className:T.sectionTitle,children:r}),t[0]=r,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:s}),t[2]=s,t[3]=c);let l;t[4]===a?l=t[5]:(l=a&&(0,H.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:a}),t[4]=a,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]!==i||t[10]!==u?(d=(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-b border-sidebar-border px-4 py-6`,children:[u,i]}),t[9]=i,t[10]=u,t[11]=d):d=t[11];let f;t[12]===n?f=t[13]:(f=(0,H.jsx)(S,{className:`min-h-0 flex-1`,children:n}),t[12]=n,t[13]=f);let p;t[14]===o?p=t[15]:(p=o&&(0,H.jsx)(`div`,{className:`border-t border-sidebar-border`,children:o}),t[14]=o,t[15]=p);let m;return t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-col`,children:[d,f,p]}),t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function xe(e){let t=[],n={};return e.forEach((e,r)=>{let i=e.path.split(`/`),a=t,o=``;for(let e=0;e<i.length-1;e++){if(o=o?`${o}/${i[e]}`:i[e],!n[o]){let t={id:`dir:${o}`,name:i[e],children:[]};n[o]=t,a.push(t)}a=n[o].children}a.push({id:`file:${e.path}`,name:i[i.length-1],fileIndex:r,status:e.status})}),t}var W={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},Se={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function G(e){return a(a(T.compact,`status-badge font-mono font-semibold`),W[e]??`text-orange-500`)}function Ce(e){return Se[e]??`M`}var K=I(e=>(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsxs)(`span`,{className:e.v0,children:[e.v1,` file`,e.v2]}),(0,H.jsxs)(`span`,{className:e.v3,children:[`+`,e.v4]}),(0,H.jsxs)(`span`,{className:e.v5,children:[`-`,e.v6]})]}),{name:`JSX_stats_1`,portals:[`v1`,`v2`,`v4`,`v6`]}),q=I(e=>e.v0,{name:`DiffTree_1`,portals:[`v0`]}),J=I(e=>e.v0,{name:`DiffTree_2`,portals:[`v0`]}),we=I(e=>e.v0,{name:`DiffTree_3`,portals:[`v0`]}),Te=function(e){let t=(0,V.c)(32),{treeData:n,files:r,error:i,selectedFileIndex:o,onFileSelect:s,onRevertFile:c}=e,l;t[0]===r?l=t[1]:(l=r.reduce(Y,0),t[0]=r,t[1]=l);let u=l,d;t[2]===r?d=t[3]:(d=r.reduce(Ae,0),t[2]=r,t[3]=d);let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=a(T.compact,`text-muted-foreground`),t[4]=p):p=t[4];let h=r.length,g=r.length===1?``:`s`,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=a(T.compact,`text-green-500`),t[5]=_):_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=a(T.compact,`text-red-500`),t[6]=v):v=t[6];let y;t[7]!==r.length||t[8]!==g||t[9]!==u||t[10]!==f?(y=(0,H.jsx)(K,{v0:p,v1:h,v2:g,v3:_,v4:u,v5:v,v6:f}),t[7]=r.length,t[8]=g,t[9]=u,t[10]=f,t[11]=y):y=t[11];let b=y;if(i){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=a(T.compact,`text-destructive text-center`),t[12]=e):e=t[12];let n;t[13]===i?n=t[14]:(n=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:e,children:i})}),t[13]=i,t[14]=n);let r;return t[15]!==b||t[16]!==n?(r=(0,H.jsx)(q,{v0:(0,H.jsx)(U,{title:`Review Changes`,subtitle:b,children:n})}),t[15]=b,t[16]=n,t[17]=r):r=t[17],r}if(r.length===0){let e;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:a(T.compact,T.bodyMuted,`text-center`),children:`No changes to review`})}),t[18]=e):e=t[18];let n;return t[19]===b?n=t[20]:(n=(0,H.jsx)(J,{v0:(0,H.jsx)(U,{title:`Review Changes`,subtitle:b,children:e})}),t[19]=b,t[20]=n),n}let x;t[21]!==r||t[22]!==s||t[23]!==c||t[24]!==o?(x=(e,t)=>{let{isOpen:n,toggle:i}=t,l=!!e.children,u=(0,H.jsxs)(ae,{onClick:()=>{l?i():e.fileIndex!==void 0&&s(e.fileIndex)},selected:!l&&e.fileIndex===o,className:`gap-1.5`,children:[l?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(m,{className:a(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,n&&`rotate-90`)}),n?(0,H.jsx)(M,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,H.jsx)(w,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,H.jsx)(A,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!l&&e.status&&(0,H.jsx)(`span`,{className:G(e.status),children:Ce(e.status)})]});return l?u:(0,H.jsxs)(be,{children:[(0,H.jsx)(z,{asChild:!0,children:(0,H.jsx)(`div`,{children:u})}),(0,H.jsx)(ve,{children:(0,H.jsxs)(ye,{onClick:()=>{e.fileIndex!==void 0&&c?.(r[e.fileIndex])},children:[(0,H.jsx)(E,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[21]=r,t[22]=s,t[23]=c,t[24]=o,t[25]=x):x=t[25];let S;t[26]!==x||t[27]!==n?(S=(0,H.jsx)(`div`,{className:`px-1 pt-3 pb-2`,children:(0,H.jsx)(fe,{nodes:n,defaultOpen:!0,resetKey:n,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:x})}),t[26]=x,t[27]=n,t[28]=S):S=t[28];let C;return t[29]!==b||t[30]!==S?(C=(0,H.jsx)(we,{v0:(0,H.jsx)(U,{title:`Review Changes`,subtitle:b,children:S})}),t[29]=b,t[30]=S,t[31]=C):C=t[31],C};function Ee(e){return e.type===`add`}function De(e,t){return e+t.changes.filter(Ee).length}function Y(e,t){return e+t.hunks.reduce(De,0)}function Oe(e){return e.type===`delete`}function ke(e,t){return e+t.changes.filter(Oe).length}function Ae(e,t){return e+t.hunks.reduce(ke,0)}var je=I(e=>(0,H.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,H.jsx)(`div`,{className:e.v0,children:e.v1}),(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 overflow-auto bg-background`,children:(0,H.jsx)(`img`,{src:e.v2,alt:e.v3,className:`max-w-full max-h-full object-contain`})})]}),{name:`DiffImageSingle_1`,portals:[`v1`]}),X=function(e){let t=(0,V.c)(5),{threadId:n,filePath:r,version:i,label:o}=e,s=Z(n,r,i),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=a(T.caption,`px-3 py-1.5 border-b text-muted-foreground bg-muted/30`),t[0]=c):c=t[0];let l=`${o} - ${r}`,u;return t[1]!==o||t[2]!==s||t[3]!==l?(u=(0,H.jsx)(je,{v0:c,v1:o,v2:s,v3:l}),t[1]=o,t[2]=s,t[3]=l,t[4]=u):u=t[4],u};function Me(e,t,n){return`git-media:${e}:${t}:${n}`}function Z(e,t,n){let r=(0,V.c)(13),i;r[0]!==t||r[1]!==e||r[2]!==n?(i=Me(e,t,n),r[0]=t,r[1]=e,r[2]=n,r[3]=i):i=r[3];let a;r[4]!==t||r[5]!==e||r[6]!==n?(a=()=>k(e,t,n),r[4]=t,r[5]=e,r[6]=n,r[7]=a):a=r[7];let o=ne(i,a),s;r[8]===o?s=r[9]:(s=URL.createObjectURL(o),r[8]=o,r[9]=s);let c=s,l,u;return r[10]===c?(l=r[11],u=r[12]):(l=()=>()=>{URL.revokeObjectURL(c)},u=[c],r[10]=c,r[11]=l,r[12]=u),(0,B.useEffect)(l,u),c}function Ne(e){let t=(0,V.c)(23),{threadId:n,file:r}=e,i=r.status===`modified`||r.status===`deleted`||r.status===`renamed`,a=r.status===`modified`||r.status===`added`||r.status===`untracked`||r.status===`renamed`;if(i&&a){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(re,{label:`Loading before...`}),t[0]=e):e=t[0];let i=r.status===`renamed`&&r.oldPath?r.oldPath:r.path,a;t[1]!==i||t[2]!==n?(a=(0,H.jsx)(`div`,{className:`flex-1 border-r border-border`,children:(0,H.jsx)(B.Suspense,{fallback:e,children:(0,H.jsx)(X,{threadId:n,filePath:i,version:`old`,label:`Before`})})}),t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,H.jsx)(re,{label:`Loading after...`}),t[4]=o):o=t[4];let s;t[5]!==r.path||t[6]!==n?(s=(0,H.jsx)(`div`,{className:`flex-1`,children:(0,H.jsx)(B.Suspense,{fallback:o,children:(0,H.jsx)(X,{threadId:n,filePath:r.path,version:`new`,label:`After`})})}),t[5]=r.path,t[6]=n,t[7]=s):s=t[7];let c;return t[8]!==a||t[9]!==s?(c=(0,H.jsxs)(`div`,{className:`flex h-full`,children:[a,s]}),t[8]=a,t[9]=s,t[10]=c):c=t[10],c}let o=a?`new`:`old`,s=a?`Added`:`Deleted`,c;t[11]===s?c=t[12]:(c=s.toLowerCase(),t[11]=s,t[12]=c);let l=`Loading ${c} image...`,u;t[13]===l?u=t[14]:(u=(0,H.jsx)(re,{label:l}),t[13]=l,t[14]=u);let d;t[15]!==r.path||t[16]!==s||t[17]!==n||t[18]!==o?(d=(0,H.jsx)(X,{threadId:n,filePath:r.path,version:o,label:s}),t[15]=r.path,t[16]=s,t[17]=n,t[18]=o,t[19]=d):d=t[19];let f;return t[20]!==u||t[21]!==d?(f=(0,H.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,H.jsx)(B.Suspense,{fallback:u,children:d})}),t[20]=u,t[21]=d,t[22]=f):f=t[22],f}function Pe(e){let t=(0,V.c)(4),{isOpen:n}=e,r=(n===void 0?!0:n)&&`ml-[-40px]`,i;t[0]===r?i=t[1]:(i=a(`z-10 shrink-0`,r),t[0]=r,t[1]=i);let o;return t[2]===i?o=t[3]:(o=(0,H.jsx)(R,{withHandle:!0,className:i}),t[2]=i,t[3]=o),o}function Fe(e){let t=(0,V.c)(36),{open:n,lineNumber:r,lineContent:i,initialComment:o,isEditing:s,onSave:c,onDelete:l,onClose:u}=e,[d,f]=(0,B.useState)((o===void 0?``:o)??``),p;t[0]!==c||t[1]!==d?(p=()=>{d.trim()&&c(d.trim())},t[0]=c,t[1]=d,t[2]=p):p=t[2];let m=p,h;t[3]===m?h=t[4]:(h=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),m())},t[3]=m,t[4]=h);let _=h,v;t[5]===u?v=t[6]:(v=e=>{e||u()},t[5]=u,t[6]=v);let b;t[7]===r?b=t[8]:(b=(0,H.jsx)(te,{children:(0,H.jsxs)(D,{children:[`Comment on line `,r]})}),t[7]=r,t[8]=b);let x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=a(T.compact,`font-mono rounded bg-muted px-3 py-2 text-muted-foreground overflow-x-auto whitespace-pre`),t[9]=x):x=t[9];let S=i||` `,w;t[10]===S?w=t[11]:(w=(0,H.jsx)(`div`,{className:x,children:S}),t[10]=S,t[11]=w);let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>f(e.target.value),t[12]=E):E=t[12];let O;t[13]!==_||t[14]!==d?(O=(0,H.jsx)(ce,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:d,onChange:E,onKeyDown:_,rows:12,className:`resize-none text-base`}),t[13]=_,t[14]=d,t[15]=O):O=t[15];let k;t[16]!==s||t[17]!==l?(k=s&&l&&(0,H.jsx)(g,{variant:`destructive`,size:`sm`,onClick:l,className:`mr-auto`,children:`Delete`}),t[16]=s,t[17]=l,t[18]=k):k=t[18];let A;t[19]===d?A=t[20]:(A=d.trim(),t[19]=d,t[20]=A);let j=!A,M;t[21]!==m||t[22]!==j?(M=(0,H.jsx)(g,{size:`sm`,onClick:m,disabled:j,children:`Save`}),t[21]=m,t[22]=j,t[23]=M):M=t[23];let N;t[24]!==k||t[25]!==M?(N=(0,H.jsxs)(ee,{className:`gap-2 sm:gap-0`,children:[k,M]}),t[24]=k,t[25]=M,t[26]=N):N=t[26];let P;t[27]!==O||t[28]!==N||t[29]!==b||t[30]!==w?(P=(0,H.jsxs)(C,{className:`max-w-2xl`,children:[b,w,O,N]}),t[27]=O,t[28]=N,t[29]=b,t[30]=w,t[31]=P):P=t[31];let F;return t[32]!==n||t[33]!==P||t[34]!==v?(F=(0,H.jsx)(y,{open:n,onOpenChange:v,children:P}),t[32]=n,t[33]=P,t[34]=v,t[35]=F):F=t[35],F}var Ie=I(e=>e.v0,{name:`ReviewLoadingFallback_1`,portals:[`v0`]}),Le=I(e=>(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,H.jsxs)(`div`,{className:`space-y-4 text-center`,children:[(0,H.jsx)(`p`,{className:e.v0,children:`Loading review changes is taking longer than expected.`}),e.v1]})}),{name:`ReviewLoadingFallback_2`,portals:[`v1`]}),Re=function(e){let t=(0,V.c)(5),{onRetry:n}=e,[r,i]=(0,B.useState)(!1),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=window.setTimeout(()=>{i(!0)},15e3);return()=>{window.clearTimeout(e)}},o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,B.useEffect)(a,o),!r){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(Ie,{v0:(0,H.jsx)(re,{label:`Loading review changes...`})}),t[2]=e):e=t[2],e}let s;return t[3]===n?s=t[4]:(s=(0,H.jsx)(Le,{v0:T.bodyMuted,v1:(0,H.jsx)(g,{variant:`outline`,onClick:n,children:`Retry`})}),t[3]=n,t[4]=s),s},ze=u(`app.diff-view.ui`);function Be(e,t){return`git-diff:${e}:${t}`}function Q(){return Error(`Loading review changes timed out. Please try again.`)}async function Ve(e,t=15e3){return Promise.race([j(e),new Promise((e,n)=>{window.setTimeout(()=>n(Q()),t)})])}function He({threadId:e,onExit:o,loadVersion:u}){let h=ne(Be(e,u),()=>Ve(e)),v=de(),y=pe(e=>e.diffComments),S=pe(e=>e.projectModelSelections),{resolvedTheme:C}=oe(),w=se(),{fetchUnifiedStatus:E}=le(),[D,k]=(0,B.useState)(h.files||[]),[ee,te]=(0,B.useState)(null),[A,M]=(0,B.useState)(0),[I,re]=(0,B.useState)(!1),[L,ie]=(0,B.useState)(!1),[ae,ce]=(0,B.useState)(!1),[fe,R]=(0,B.useState)(!0),z=(0,B.useRef)(null);(0,B.useEffect)(()=>{R(!0)},[e]);let ve=(0,B.useCallback)(e=>{M(e),w&&R(!1)},[w]),ye=(0,B.useCallback)(()=>{R(!0)},[]),be=w&&!fe,V=(0,B.useMemo)(()=>y[e]??[],[y,e]),U=(0,B.useCallback)(t=>{let n=y[e]??[],r=typeof t==`function`?t(n):t;v({type:ue.SetDiffComments,threadId:e,comments:r})},[v,e,y]),[W,Se]=(0,B.useState)(null),[G,Ce]=(0,B.useState)(null),[K,q]=(0,B.useState)(null),J=(0,B.useRef)(null),we=(0,B.useRef)(V),Ee=(0,B.useRef)(W),De=(0,B.useRef)({isFullView:I,selectedFileIndex:A,files:D}),Y=(0,B.useRef)({original:[],modified:[]}),Oe=(0,B.useRef)(!0);(0,B.useEffect)(()=>{we.current=V},[V]),(0,B.useEffect)(()=>{Ee.current=W},[W]),(0,B.useEffect)(()=>{De.current={isFullView:I,selectedFileIndex:A,files:D}},[I,A,D]);let ke=(0,B.useCallback)(()=>{z.current&&(L?z.current.expand():z.current.collapse())},[L]),Ae=(0,B.useCallback)(async()=>{if(e){te(null);try{k((await j(e)).files||[]),M(0)}catch(e){te(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),je=(0,B.useCallback)(async t=>{try{await b(e,t.path),await Promise.all([Ae(),E(!0)])}catch(e){te(e instanceof Error?e.message:`Failed to revert file`)}},[e,Ae,E]),X=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if((y[e]??[]).length>0){X.current=!0;return}p(e).then(t=>{t.diffComments&&t.diffComments.length>0&&v({type:ue.SetDiffComments,threadId:e,comments:t.diffComments}),X.current=!0}).catch(()=>{X.current=!0})},[e]),(0,B.useEffect)(()=>{X.current&&l(e,{diffComments:V}).catch(()=>{})},[e,V]);let Me=(0,B.useMemo)(()=>xe(D),[D]),Z=e=>{if(e.hunks.length===0)return null;let t=1/0,n=0;return e.hunks.forEach(e=>{let r=Math.min(e.oldStart,e.newStart),i=e.oldStart+e.oldLines,a=e.newStart+e.newLines,o=Math.max(i,a);t=Math.min(t,r),n=Math.max(n,o)}),t===1/0?null:{startLine:Math.max(1,t-2),endLine:n+2}},Ie=(e,t,n)=>e.split(`
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$ as t,Aa as n,Br as r,Fa as i,Fs as a,Ii as o,Is as s,K as c,Ki as l,Kn as u,Ko as d,La as f,Lr as p,Lt as m,No as h,Pi as g,Po as _,Qr as v,Qt as y,Rr as b,Rs as x,c as S,ei as C,eo as w,fs as T,ga as E,ii as D,ka as O,lt as k,ni as ee,ri as te,ro as A,st as j,to as M,za as N}from"./dialogs-config-86QTDk4G.js";import{N as P}from"./react-vendor-DK2COBjg.js";import{t as F}from"./monaco-CZnIWXyV.js";import{I,a as ne,l as re,n as L,o as ie}from"./history-view-BsN806ip.js";import{d as ae}from"./onboarding-DCrFdRM5.js";import{n as oe}from"./utils-DPYK-CSn.js";import{C as se,H as ce,I as le,K as ue,U as de,V as fe,W as pe,d as me,f as R,h as he,m as ge,p as _e}from"./index-C2iIghSR.js";import{a as z,n as ve,r as ye,t as be}from"./context-menu-DO3hiSAo.js";var B=e(x(),1),V=s(),H=a();function U(e){let t=(0,V.c)(20),{children:n,title:r,subtitle:i,headerAction:a,footer:o}=e,s;t[0]===r?s=t[1]:(s=r&&(0,H.jsx)(`span`,{className:T.sectionTitle,children:r}),t[0]=r,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:s}),t[2]=s,t[3]=c);let l;t[4]===a?l=t[5]:(l=a&&(0,H.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:a}),t[4]=a,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]!==i||t[10]!==u?(d=(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-b border-sidebar-border px-4 py-6`,children:[u,i]}),t[9]=i,t[10]=u,t[11]=d):d=t[11];let f;t[12]===n?f=t[13]:(f=(0,H.jsx)(S,{className:`min-h-0 flex-1`,children:n}),t[12]=n,t[13]=f);let p;t[14]===o?p=t[15]:(p=o&&(0,H.jsx)(`div`,{className:`border-t border-sidebar-border`,children:o}),t[14]=o,t[15]=p);let m;return t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-col`,children:[d,f,p]}),t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function xe(e){let t=[],n={};return e.forEach((e,r)=>{let i=e.path.split(`/`),a=t,o=``;for(let e=0;e<i.length-1;e++){if(o=o?`${o}/${i[e]}`:i[e],!n[o]){let t={id:`dir:${o}`,name:i[e],children:[]};n[o]=t,a.push(t)}a=n[o].children}a.push({id:`file:${e.path}`,name:i[i.length-1],fileIndex:r,status:e.status})}),t}var W={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},Se={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function G(e){return o(o(T.compact,`status-badge font-mono font-semibold`),W[e]??`text-orange-500`)}function Ce(e){return Se[e]??`M`}var K=I(e=>(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsxs)(`span`,{className:e.v0,children:[e.v1,` file`,e.v2]}),(0,H.jsxs)(`span`,{className:e.v3,children:[`+`,e.v4]}),(0,H.jsxs)(`span`,{className:e.v5,children:[`-`,e.v6]})]}),{name:`JSX_stats_1`,portals:[`v1`,`v2`,`v4`,`v6`]}),q=I(e=>e.v0,{name:`DiffTree_1`,portals:[`v0`]}),J=I(e=>e.v0,{name:`DiffTree_2`,portals:[`v0`]}),we=I(e=>e.v0,{name:`DiffTree_3`,portals:[`v0`]}),Te=function(e){let t=(0,V.c)(32),{treeData:n,files:r,error:i,selectedFileIndex:a,onFileSelect:s,onRevertFile:c}=e,l;t[0]===r?l=t[1]:(l=r.reduce(Y,0),t[0]=r,t[1]=l);let u=l,d;t[2]===r?d=t[3]:(d=r.reduce(Ae,0),t[2]=r,t[3]=d);let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=o(T.compact,`text-muted-foreground`),t[4]=p):p=t[4];let m=r.length,g=r.length===1?``:`s`,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=o(T.compact,`text-green-500`),t[5]=_):_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=o(T.compact,`text-red-500`),t[6]=v):v=t[6];let y;t[7]!==r.length||t[8]!==g||t[9]!==u||t[10]!==f?(y=(0,H.jsx)(K,{v0:p,v1:m,v2:g,v3:_,v4:u,v5:v,v6:f}),t[7]=r.length,t[8]=g,t[9]=u,t[10]=f,t[11]=y):y=t[11];let b=y;if(i){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=o(T.compact,`text-destructive text-center`),t[12]=e):e=t[12];let n;t[13]===i?n=t[14]:(n=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:e,children:i})}),t[13]=i,t[14]=n);let r;return t[15]!==b||t[16]!==n?(r=(0,H.jsx)(q,{v0:(0,H.jsx)(U,{title:`Review Changes`,subtitle:b,children:n})}),t[15]=b,t[16]=n,t[17]=r):r=t[17],r}if(r.length===0){let e;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:o(T.compact,T.bodyMuted,`text-center`),children:`No changes to review`})}),t[18]=e):e=t[18];let n;return t[19]===b?n=t[20]:(n=(0,H.jsx)(J,{v0:(0,H.jsx)(U,{title:`Review Changes`,subtitle:b,children:e})}),t[19]=b,t[20]=n),n}let x;t[21]!==r||t[22]!==s||t[23]!==c||t[24]!==a?(x=(e,t)=>{let{isOpen:n,toggle:i}=t,l=!!e.children,u=(0,H.jsxs)(ae,{onClick:()=>{l?i():e.fileIndex!==void 0&&s(e.fileIndex)},selected:!l&&e.fileIndex===a,className:`gap-1.5`,children:[l?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(h,{className:o(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,n&&`rotate-90`)}),n?(0,H.jsx)(M,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,H.jsx)(w,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,H.jsx)(A,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!l&&e.status&&(0,H.jsx)(`span`,{className:G(e.status),children:Ce(e.status)})]});return l?u:(0,H.jsxs)(be,{children:[(0,H.jsx)(z,{asChild:!0,children:(0,H.jsx)(`div`,{children:u})}),(0,H.jsx)(ve,{children:(0,H.jsxs)(ye,{onClick:()=>{e.fileIndex!==void 0&&c?.(r[e.fileIndex])},children:[(0,H.jsx)(E,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[21]=r,t[22]=s,t[23]=c,t[24]=a,t[25]=x):x=t[25];let S;t[26]!==x||t[27]!==n?(S=(0,H.jsx)(`div`,{className:`px-1 pt-3 pb-2`,children:(0,H.jsx)(fe,{nodes:n,defaultOpen:!0,resetKey:n,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:x})}),t[26]=x,t[27]=n,t[28]=S):S=t[28];let C;return t[29]!==b||t[30]!==S?(C=(0,H.jsx)(we,{v0:(0,H.jsx)(U,{title:`Review Changes`,subtitle:b,children:S})}),t[29]=b,t[30]=S,t[31]=C):C=t[31],C};function Ee(e){return e.type===`add`}function De(e,t){return e+t.changes.filter(Ee).length}function Y(e,t){return e+t.hunks.reduce(De,0)}function Oe(e){return e.type===`delete`}function ke(e,t){return e+t.changes.filter(Oe).length}function Ae(e,t){return e+t.hunks.reduce(ke,0)}var je=I(e=>(0,H.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,H.jsx)(`div`,{className:e.v0,children:e.v1}),(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 overflow-auto bg-background`,children:(0,H.jsx)(`img`,{src:e.v2,alt:e.v3,className:`max-w-full max-h-full object-contain`})})]}),{name:`DiffImageSingle_1`,portals:[`v1`]}),X=function(e){let t=(0,V.c)(5),{threadId:n,filePath:r,version:i,label:a}=e,s=Z(n,r,i),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=o(T.caption,`px-3 py-1.5 border-b text-muted-foreground bg-muted/30`),t[0]=c):c=t[0];let l=`${a} - ${r}`,u;return t[1]!==a||t[2]!==s||t[3]!==l?(u=(0,H.jsx)(je,{v0:c,v1:a,v2:s,v3:l}),t[1]=a,t[2]=s,t[3]=l,t[4]=u):u=t[4],u};function Me(e,t,n){return`git-media:${e}:${t}:${n}`}function Z(e,t,n){let r=(0,V.c)(13),i;r[0]!==t||r[1]!==e||r[2]!==n?(i=Me(e,t,n),r[0]=t,r[1]=e,r[2]=n,r[3]=i):i=r[3];let a;r[4]!==t||r[5]!==e||r[6]!==n?(a=()=>k(e,t,n),r[4]=t,r[5]=e,r[6]=n,r[7]=a):a=r[7];let o=ne(i,a),s;r[8]===o?s=r[9]:(s=URL.createObjectURL(o),r[8]=o,r[9]=s);let c=s,l,u;return r[10]===c?(l=r[11],u=r[12]):(l=()=>()=>{URL.revokeObjectURL(c)},u=[c],r[10]=c,r[11]=l,r[12]=u),(0,B.useEffect)(l,u),c}function Ne(e){let t=(0,V.c)(23),{threadId:n,file:r}=e,i=r.status===`modified`||r.status===`deleted`||r.status===`renamed`,a=r.status===`modified`||r.status===`added`||r.status===`untracked`||r.status===`renamed`;if(i&&a){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(re,{label:`Loading before...`}),t[0]=e):e=t[0];let i=r.status===`renamed`&&r.oldPath?r.oldPath:r.path,a;t[1]!==i||t[2]!==n?(a=(0,H.jsx)(`div`,{className:`flex-1 border-r border-border`,children:(0,H.jsx)(B.Suspense,{fallback:e,children:(0,H.jsx)(X,{threadId:n,filePath:i,version:`old`,label:`Before`})})}),t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,H.jsx)(re,{label:`Loading after...`}),t[4]=o):o=t[4];let s;t[5]!==r.path||t[6]!==n?(s=(0,H.jsx)(`div`,{className:`flex-1`,children:(0,H.jsx)(B.Suspense,{fallback:o,children:(0,H.jsx)(X,{threadId:n,filePath:r.path,version:`new`,label:`After`})})}),t[5]=r.path,t[6]=n,t[7]=s):s=t[7];let c;return t[8]!==a||t[9]!==s?(c=(0,H.jsxs)(`div`,{className:`flex h-full`,children:[a,s]}),t[8]=a,t[9]=s,t[10]=c):c=t[10],c}let o=a?`new`:`old`,s=a?`Added`:`Deleted`,c;t[11]===s?c=t[12]:(c=s.toLowerCase(),t[11]=s,t[12]=c);let l=`Loading ${c} image...`,u;t[13]===l?u=t[14]:(u=(0,H.jsx)(re,{label:l}),t[13]=l,t[14]=u);let d;t[15]!==r.path||t[16]!==s||t[17]!==n||t[18]!==o?(d=(0,H.jsx)(X,{threadId:n,filePath:r.path,version:o,label:s}),t[15]=r.path,t[16]=s,t[17]=n,t[18]=o,t[19]=d):d=t[19];let f;return t[20]!==u||t[21]!==d?(f=(0,H.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,H.jsx)(B.Suspense,{fallback:u,children:d})}),t[20]=u,t[21]=d,t[22]=f):f=t[22],f}function Pe(e){let t=(0,V.c)(4),{isOpen:n}=e,r=(n===void 0?!0:n)&&`ml-[-40px]`,i;t[0]===r?i=t[1]:(i=o(`z-10 shrink-0`,r),t[0]=r,t[1]=i);let a;return t[2]===i?a=t[3]:(a=(0,H.jsx)(R,{withHandle:!0,className:i}),t[2]=i,t[3]=a),a}function Fe(e){let t=(0,V.c)(36),{open:n,lineNumber:r,lineContent:i,initialComment:a,isEditing:s,onSave:c,onDelete:l,onClose:u}=e,[d,f]=(0,B.useState)((a===void 0?``:a)??``),p;t[0]!==c||t[1]!==d?(p=()=>{d.trim()&&c(d.trim())},t[0]=c,t[1]=d,t[2]=p):p=t[2];let m=p,h;t[3]===m?h=t[4]:(h=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),m())},t[3]=m,t[4]=h);let _=h,y;t[5]===u?y=t[6]:(y=e=>{e||u()},t[5]=u,t[6]=y);let b;t[7]===r?b=t[8]:(b=(0,H.jsx)(te,{children:(0,H.jsxs)(D,{children:[`Comment on line `,r]})}),t[7]=r,t[8]=b);let x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=o(T.compact,`font-mono rounded bg-muted px-3 py-2 text-muted-foreground overflow-x-auto whitespace-pre`),t[9]=x):x=t[9];let S=i||` `,w;t[10]===S?w=t[11]:(w=(0,H.jsx)(`div`,{className:x,children:S}),t[10]=S,t[11]=w);let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>f(e.target.value),t[12]=E):E=t[12];let O;t[13]!==_||t[14]!==d?(O=(0,H.jsx)(ce,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:d,onChange:E,onKeyDown:_,rows:12,className:`resize-none text-base`}),t[13]=_,t[14]=d,t[15]=O):O=t[15];let k;t[16]!==s||t[17]!==l?(k=s&&l&&(0,H.jsx)(g,{variant:`destructive`,size:`sm`,onClick:l,className:`mr-auto`,children:`Delete`}),t[16]=s,t[17]=l,t[18]=k):k=t[18];let A;t[19]===d?A=t[20]:(A=d.trim(),t[19]=d,t[20]=A);let j=!A,M;t[21]!==m||t[22]!==j?(M=(0,H.jsx)(g,{size:`sm`,onClick:m,disabled:j,children:`Save`}),t[21]=m,t[22]=j,t[23]=M):M=t[23];let N;t[24]!==k||t[25]!==M?(N=(0,H.jsxs)(ee,{className:`gap-2 sm:gap-0`,children:[k,M]}),t[24]=k,t[25]=M,t[26]=N):N=t[26];let P;t[27]!==O||t[28]!==N||t[29]!==b||t[30]!==w?(P=(0,H.jsxs)(C,{className:`max-w-2xl`,children:[b,w,O,N]}),t[27]=O,t[28]=N,t[29]=b,t[30]=w,t[31]=P):P=t[31];let F;return t[32]!==n||t[33]!==P||t[34]!==y?(F=(0,H.jsx)(v,{open:n,onOpenChange:y,children:P}),t[32]=n,t[33]=P,t[34]=y,t[35]=F):F=t[35],F}var Ie=I(e=>e.v0,{name:`ReviewLoadingFallback_1`,portals:[`v0`]}),Le=I(e=>(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,H.jsxs)(`div`,{className:`space-y-4 text-center`,children:[(0,H.jsx)(`p`,{className:e.v0,children:`Loading review changes is taking longer than expected.`}),e.v1]})}),{name:`ReviewLoadingFallback_2`,portals:[`v1`]}),Re=function(e){let t=(0,V.c)(5),{onRetry:n}=e,[r,i]=(0,B.useState)(!1),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=window.setTimeout(()=>{i(!0)},15e3);return()=>{window.clearTimeout(e)}},o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,B.useEffect)(a,o),!r){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(Ie,{v0:(0,H.jsx)(re,{label:`Loading review changes...`})}),t[2]=e):e=t[2],e}let s;return t[3]===n?s=t[4]:(s=(0,H.jsx)(Le,{v0:T.bodyMuted,v1:(0,H.jsx)(g,{variant:`outline`,onClick:n,children:`Retry`})}),t[3]=n,t[4]=s),s},ze=d(`app.diff-view.ui`);function Be(e,t){return`git-diff:${e}:${t}`}function Q(){return Error(`Loading review changes timed out. Please try again.`)}async function Ve(e,t=15e3){return Promise.race([j(e),new Promise((e,n)=>{window.setTimeout(()=>n(Q()),t)})])}function He({threadId:e,onExit:a,loadVersion:s}){let d=ne(Be(e,s),()=>Ve(e)),v=de(),x=pe(e=>e.diffComments),S=pe(e=>e.projectModelSelections),{resolvedTheme:C}=oe(),w=se(),{fetchUnifiedStatus:E}=le(),[D,k]=(0,B.useState)(d.files||[]),[ee,te]=(0,B.useState)(null),[A,M]=(0,B.useState)(0),[I,re]=(0,B.useState)(!1),[L,ie]=(0,B.useState)(!1),[ae,ce]=(0,B.useState)(!1),[fe,R]=(0,B.useState)(!0),z=(0,B.useRef)(null);(0,B.useEffect)(()=>{R(!0)},[e]);let ve=(0,B.useCallback)(e=>{M(e),w&&R(!1)},[w]),ye=(0,B.useCallback)(()=>{R(!0)},[]),be=w&&!fe,V=(0,B.useMemo)(()=>x[e]??[],[x,e]),U=(0,B.useCallback)(t=>{let n=x[e]??[],r=typeof t==`function`?t(n):t;v({type:ue.SetDiffComments,threadId:e,comments:r})},[v,e,x]),[W,Se]=(0,B.useState)(null),[G,Ce]=(0,B.useState)(null),[K,q]=(0,B.useState)(null),J=(0,B.useRef)(null),we=(0,B.useRef)(V),Ee=(0,B.useRef)(W),De=(0,B.useRef)({isFullView:I,selectedFileIndex:A,files:D}),Y=(0,B.useRef)({original:[],modified:[]}),Oe=(0,B.useRef)(!0);(0,B.useEffect)(()=>{we.current=V},[V]),(0,B.useEffect)(()=>{Ee.current=W},[W]),(0,B.useEffect)(()=>{De.current={isFullView:I,selectedFileIndex:A,files:D}},[I,A,D]);let ke=(0,B.useCallback)(()=>{z.current&&(L?z.current.expand():z.current.collapse())},[L]),Ae=(0,B.useCallback)(async()=>{if(e){te(null);try{k((await j(e)).files||[]),M(0)}catch(e){te(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),je=(0,B.useCallback)(async t=>{try{await y(e,t.path),await Promise.all([Ae(),E(!0)])}catch(e){te(e instanceof Error?e.message:`Failed to revert file`)}},[e,Ae,E]),X=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if((x[e]??[]).length>0){X.current=!0;return}m(e).then(t=>{t.diffComments&&t.diffComments.length>0&&v({type:ue.SetDiffComments,threadId:e,comments:t.diffComments}),X.current=!0}).catch(()=>{X.current=!0})},[e]),(0,B.useEffect)(()=>{X.current&&u(e,{diffComments:V}).catch(()=>{})},[e,V]);let Me=(0,B.useMemo)(()=>xe(D),[D]),Z=e=>{if(e.hunks.length===0)return null;let t=1/0,n=0;return e.hunks.forEach(e=>{let r=Math.min(e.oldStart,e.newStart),i=e.oldStart+e.oldLines,a=e.newStart+e.newLines,o=Math.max(i,a);t=Math.min(t,r),n=Math.max(n,o)}),t===1/0?null:{startLine:Math.max(1,t-2),endLine:n+2}},Ie=(e,t,n)=>e.split(`
|
|
2
2
|
`).slice(t-1,n).join(`
|
|
3
|
-
`),Le=e=>{let t=Z(e);return t?t.startLine<=1:!0},Re=e=>({ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`})[e.split(`.`).pop()??``]||`plaintext`,Q=D[A],He=Q?.isBinary??!1,Ue=Q?I?Q.oldContent:(()=>{let e=Z(Q);return e?Ie(Q.oldContent,e.startLine,e.endLine):Q.oldContent})():``,We=Q?I?Q.newContent:(()=>{let e=Z(Q);return e?Ie(Q.newContent,e.startLine,e.endLine):Q.newContent})():``,$=(0,B.useCallback)(()=>{if(!Oe.current)return;let e=J.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=De.current,i=we.current,a=Ee.current,o=r[n];if(!o)return;let s=(e,r)=>{let s=t?null:Z(o),c=i.filter(e=>e.fileIndex===n&&e.side===r),l=new Set(c.map(e=>s?e.lineNumber-s.startLine+1:e.lineNumber)),u=e.getModel()?.getLineCount()??0,d=[];for(let e=1;e<=u;e++)l.has(e)||d.push({range:{startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1},options:{isWholeLine:!0,glyphMarginClassName:`diff-gutter-add-comment`,glyphMarginHoverMessage:{value:`$(add) Click to add a comment`},stickiness:F.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}});let f=c.map(e=>{let t=s?e.lineNumber-s.startLine+1:e.lineNumber;if(t<1)return null;let n=i.indexOf(e)===a;return{range:{startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1},options:{isWholeLine:!0,className:n?`diff-comment-active-line`:`diff-comment-marked-line`,glyphMarginClassName:n?`diff-comment-glyph-active`:`diff-comment-glyph`,glyphMarginHoverMessage:{value:e.comment},stickiness:F.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}}).filter(e=>e!==null);d.push(...f);let p=r===`original`?Y.current.original:Y.current.modified,m=e.deltaDecorations(p,d);r===`original`?Y.current.original=m:Y.current.modified=m};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},[]);(0,B.useEffect)(()=>{$()},[$,V,W,A,I,Q]),(0,B.useEffect)(()=>()=>{J.current=null,Y.current={original:[],modified:[]}},[A]),(0,B.useEffect)(()=>()=>{Oe.current=!1,J.current&&=(J.current.getOriginalEditor().getModel()?.dispose(),J.current.getModifiedEditor().getModel()?.dispose(),J.current.dispose(),null),Y.current={original:[],modified:[]}},[]);let Ge=(0,B.useCallback)(e=>{J.current=e;let t=e=>e===F.MouseTargetType.GUTTER_GLYPH_MARGIN||e===F.MouseTargetType.GUTTER_LINE_NUMBERS||e===F.MouseTargetType.GUTTER_LINE_DECORATIONS||e===F.MouseTargetType.GUTTER_VIEW_ZONE,n=(e,n)=>{e.onMouseDown(r=>{if(!r.target?.position||!t(r.target.type))return;let i=r.target.position.lineNumber,{isFullView:a,selectedFileIndex:o,files:s}=De.current,c=s[o];if(!c)return;let l=a?null:Z(c),u=l?l.startLine+i-1:i,d=e.getModel()?.getLineContent(i)??``,f=we.current.find(e=>e.fileIndex===o&&e.lineNumber===u&&e.side===n);f?q(f):Ce({lineNumber:u,lineContent:d,side:n})})};n(e.getOriginalEditor(),`original`),n(e.getModifiedEditor(),`modified`),setTimeout(()=>{J.current===e&&$()},150)},[$]),Ke=(0,B.useCallback)(e=>{if(G&&Q){let t={id:`comment-${Date.now()}`,filePath:Q.path,fileIndex:A,lineNumber:G.lineNumber,lineContent:G.lineContent,comment:e,side:G.side};U(e=>[...e,t]),Ce(null)}else K&&(U(t=>t.map(t=>t.id===K.id?{...t,comment:e}:t)),q(null))},[G,K,Q,A,U]),qe=(0,B.useCallback)(()=>{K&&(U(e=>e.filter(e=>e.id!==K.id)),q(null))},[K,U]),Je=(0,B.useCallback)(e=>{if(V.length===0)return;let t=(e%V.length+V.length)%V.length,n=V[t];Se(t),M(n.fileIndex),w&&R(!1),setTimeout(()=>{let e=J.current;if(!e)return;let t=D[n.fileIndex];if(!t)return;let r=I?null:Z(t),i=r?n.lineNumber-r.startLine+1:n.lineNumber;(n.side===`original`?e.getOriginalEditor():e.getModifiedEditor()).revealLineInCenter(Math.max(1,i)),$()},100)},[V,D,I,$,w]),Ye=(0,B.useCallback)(()=>{Je((W??0)-1)},[Je,W]),Xe=(0,B.useCallback)(()=>{Je((W??-1)+1)},[Je,W]),Ze=(0,B.useCallback)(async()=>{let n=S[e];if(!n)try{let e=await t(),r=Object.values(e).flat();if(r.length>0)n=r[0];else{ze.error(`No models available to process comments`);return}}catch(e){ze.error(`Failed to load models:`,e);return}let r=n.id,i=n.provider;try{let{prompt:t}=await s(e,V);U([]),v({type:ue.SetPendingChatMessage,message:{threadId:e,message:t,model:r,provider:i}}),o()}catch(e){ze.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[V,S,v,e,o,U]),Qe={readOnly:!0,renderSideBySide:!w,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:Q&&(I||Le(Q))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0},$e=(0,H.jsx)(`div`,{className:`flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,children:(0,H.jsx)(Te,{treeData:Me,files:D,error:ee,selectedFileIndex:A,onFileSelect:ve,onRevertFile:je})}),et=(0,H.jsxs)(`div`,{className:`diff-editor-panel flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden bg-transparent`,children:[(0,H.jsxs)(me,{className:a(`bg-transparent`,L&&`h-auto py-3 flex-col items-start gap-3 md:flex-row md:items-center md:h-[71px] md:py-0 md:gap-2 justify-between`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[be?(0,H.jsxs)(g,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:ye,children:[(0,H.jsx)(O,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):(0,H.jsxs)(g,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:ke,children:[L?(0,H.jsx)(O,{className:`h-4 w-4`}):(0,H.jsx)(n,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),(0,H.jsx)(`span`,{className:a(T.label,`text-foreground`),children:Q?Q.path:`Review Changes`})]}),(0,H.jsxs)(`div`,{className:a(`flex items-center gap-2`,L&&`ml-0`,!L&&`ml-auto`,`md:ml-auto`),children:[!He&&(0,H.jsx)(g,{variant:`ghost`,size:`sm`,onClick:()=>re(e=>!e),disabled:!Q,className:a(T.compact,`h-8 gap-1 px-2`),children:I?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(i,{className:`h-3 w-3`}),` Show changes only`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(N,{className:`h-3 w-3`}),` Show full file`]})}),V.length>0&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(f,{children:[(0,H.jsx)(r,{asChild:!0,children:(0,H.jsx)(g,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Ye,disabled:(W??0)===0,children:(0,H.jsx)(_,{className:`h-3 w-3`})})}),(0,H.jsx)(x,{children:`Previous comment`})]}),(0,H.jsx)(`span`,{className:a(T.caption,`whitespace-nowrap`),children:V.length===1?`1 Comment`:`Comment ${(W??0)+1} of ${V.length}`}),(0,H.jsxs)(f,{children:[(0,H.jsx)(r,{asChild:!0,children:(0,H.jsx)(g,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Xe,disabled:(W??0)===V.length-1,children:(0,H.jsx)(m,{className:`h-3 w-3`})})}),(0,H.jsx)(x,{children:`Next comment`})]})]}),V.length>0&&(0,H.jsxs)(f,{children:[(0,H.jsx)(r,{asChild:!0,children:(0,H.jsxs)(g,{size:`sm`,onClick:Ze,className:a(T.compact,`h-8 gap-1 px-3 bg-foreground text-background hover:bg-foreground/90`),children:[(0,H.jsx)(d,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,H.jsx)(x,{children:`Send all comments to Tarsk for resolution`})]})]})]}),(0,H.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[He&&Q?(0,H.jsx)(Ne,{threadId:e,file:Q}):(0,H.jsx)(P,{height:`100%`,language:Re(Q?.path||``),original:Ue,modified:We,theme:C===`dark`?`vs-dark`:`vs-light`,onMount:Ge,options:Qe},`diff-${A}`),(0,H.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 right-4 z-20 flex flex-col items-end gap-3`,children:[ae&&(0,H.jsxs)(`div`,{className:`pointer-events-auto w-[min(100%,48rem)] rounded-2xl bg-background/50 p-4 backdrop-blur-md`,children:[(0,H.jsx)(`div`,{className:`mb-3 flex items-center justify-end`,children:(0,H.jsxs)(g,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>ce(!1),children:[(0,H.jsx)(c,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Close chat`})]})}),(0,H.jsx)(he,{})]}),!ae&&(0,H.jsxs)(f,{children:[(0,H.jsx)(r,{asChild:!0,children:(0,H.jsxs)(g,{size:`icon`,className:`pointer-events-auto h-12 w-12 rounded-full shadow-lg`,onClick:()=>ce(!0),children:[(0,H.jsx)(d,{className:`h-5 w-5`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Open review chat`})]})}),(0,H.jsx)(x,{children:`Chat about this diff`})]})]})]})]});return(0,H.jsxs)(`div`,{className:`diff-view-root flex h-full min-h-0 w-full flex-col`,children:[(0,H.jsx)(`div`,{className:`diff-body flex min-h-0 w-full flex-1 overflow-hidden`,children:w?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:a(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,!fe&&`hidden`),children:$e}),(0,H.jsx)(`div`,{className:a(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,fe&&`hidden`),children:et})]}):(0,H.jsxs)(ge,{direction:`horizontal`,children:[(0,H.jsx)(_e,{ref:z,defaultSize:25,minSize:12,maxSize:40,collapsible:!0,collapsedSize:0,onCollapse:()=>ie(!0),onExpand:()=>ie(!1),className:`border-r border-transparent`,children:$e}),(0,H.jsx)(Pe,{isOpen:!L}),(0,H.jsx)(_e,{className:`overflow-hidden border-l border-border bg-transparent`,children:et})]})}),(0,H.jsx)(Fe,{open:G!==null||K!==null,lineNumber:K?.lineNumber??G?.lineNumber??0,lineContent:K?.lineContent??G?.lineContent??``,initialComment:K?.comment,isEditing:K!==null,onSave:Ke,onDelete:qe,onClose:()=>{Ce(null),q(null)}},`${K?.id??``}-${G?.lineNumber??``}-${G?.side??``}`)]})}function Ue(e){let t=(0,V.c)(22),[n,r]=(0,B.useState)(0),[i,a]=(0,B.useState)(0),o=(0,B.useRef)(0),s;t[0]===e.threadId?s=t[1]:(s=()=>{r(t=>(ie(Be(e.threadId,t)),t+1)),a($)},t[0]=e.threadId,t[1]=s);let c=s,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(0),r(0),o.current=0},t[2]=l):l=t[2];let u;t[3]===e.threadId?u=t[4]:(u=[e.threadId],t[3]=e.threadId,t[4]=u),(0,B.useEffect)(l,u);let d,f;t[5]!==e.refreshTrigger||t[6]!==e.threadId?(d=()=>{!e.refreshTrigger||e.refreshTrigger<=o.current||(o.current=e.refreshTrigger,r(t=>(ie(Be(e.threadId,t)),t+1)),a(We))},f=[e.refreshTrigger,e.threadId],t[5]=e.refreshTrigger,t[6]=e.threadId,t[7]=d,t[8]=f):(d=t[7],f=t[8]),(0,B.useEffect)(d,f);let p=`${e.threadId}:${i}`,m;t[9]===c?m=t[10]:(m=(0,H.jsx)(Re,{onRetry:c}),t[9]=c,t[10]=m);let h=`${e.threadId}:${n}`,g;t[11]!==n||t[12]!==e||t[13]!==h?(g=(0,H.jsx)(He,{...e,loadVersion:n},h),t[11]=n,t[12]=e,t[13]=h,t[14]=g):g=t[14];let _;t[15]!==m||t[16]!==g?(_=(0,H.jsx)(B.Suspense,{fallback:m,children:g}),t[15]=m,t[16]=g,t[17]=_):_=t[17];let v;return t[18]!==c||t[19]!==p||t[20]!==_?(v=(0,H.jsx)(L,{fallbackTitle:`Failed to load review changes`,onRetry:c,children:_},p),t[18]=c,t[19]=p,t[20]=_,t[21]=v):v=t[21],v}function We(e){return e+1}function $(e){return e+1}export{Ue as DiffView,Ue as default};
|
|
3
|
+
`),Le=e=>{let t=Z(e);return t?t.startLine<=1:!0},Re=e=>({ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`})[e.split(`.`).pop()??``]||`plaintext`,Q=D[A],He=Q?.isBinary??!1,Ue=Q?I?Q.oldContent:(()=>{let e=Z(Q);return e?Ie(Q.oldContent,e.startLine,e.endLine):Q.oldContent})():``,We=Q?I?Q.newContent:(()=>{let e=Z(Q);return e?Ie(Q.newContent,e.startLine,e.endLine):Q.newContent})():``,$=(0,B.useCallback)(()=>{if(!Oe.current)return;let e=J.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=De.current,i=we.current,a=Ee.current,o=r[n];if(!o)return;let s=(e,r)=>{let s=t?null:Z(o),c=i.filter(e=>e.fileIndex===n&&e.side===r),l=new Set(c.map(e=>s?e.lineNumber-s.startLine+1:e.lineNumber)),u=e.getModel()?.getLineCount()??0,d=[];for(let e=1;e<=u;e++)l.has(e)||d.push({range:{startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1},options:{isWholeLine:!0,glyphMarginClassName:`diff-gutter-add-comment`,glyphMarginHoverMessage:{value:`$(add) Click to add a comment`},stickiness:F.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}});let f=c.map(e=>{let t=s?e.lineNumber-s.startLine+1:e.lineNumber;if(t<1)return null;let n=i.indexOf(e)===a;return{range:{startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1},options:{isWholeLine:!0,className:n?`diff-comment-active-line`:`diff-comment-marked-line`,glyphMarginClassName:n?`diff-comment-glyph-active`:`diff-comment-glyph`,glyphMarginHoverMessage:{value:e.comment},stickiness:F.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}}).filter(e=>e!==null);d.push(...f);let p=r===`original`?Y.current.original:Y.current.modified,m=e.deltaDecorations(p,d);r===`original`?Y.current.original=m:Y.current.modified=m};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},[]);(0,B.useEffect)(()=>{$()},[$,V,W,A,I,Q]),(0,B.useEffect)(()=>()=>{J.current=null,Y.current={original:[],modified:[]}},[A]),(0,B.useEffect)(()=>()=>{Oe.current=!1,J.current&&=(J.current.getOriginalEditor().getModel()?.dispose(),J.current.getModifiedEditor().getModel()?.dispose(),J.current.dispose(),null),Y.current={original:[],modified:[]}},[]);let Ge=(0,B.useCallback)(e=>{J.current=e;let t=e=>e===F.MouseTargetType.GUTTER_GLYPH_MARGIN||e===F.MouseTargetType.GUTTER_LINE_NUMBERS||e===F.MouseTargetType.GUTTER_LINE_DECORATIONS||e===F.MouseTargetType.GUTTER_VIEW_ZONE,n=(e,n)=>{e.onMouseDown(r=>{if(!r.target?.position||!t(r.target.type))return;let i=r.target.position.lineNumber,{isFullView:a,selectedFileIndex:o,files:s}=De.current,c=s[o];if(!c)return;let l=a?null:Z(c),u=l?l.startLine+i-1:i,d=e.getModel()?.getLineContent(i)??``,f=we.current.find(e=>e.fileIndex===o&&e.lineNumber===u&&e.side===n);f?q(f):Ce({lineNumber:u,lineContent:d,side:n})})};n(e.getOriginalEditor(),`original`),n(e.getModifiedEditor(),`modified`),setTimeout(()=>{J.current===e&&$()},150)},[$]),Ke=(0,B.useCallback)(e=>{if(G&&Q){let t={id:`comment-${Date.now()}`,filePath:Q.path,fileIndex:A,lineNumber:G.lineNumber,lineContent:G.lineContent,comment:e,side:G.side};U(e=>[...e,t]),Ce(null)}else K&&(U(t=>t.map(t=>t.id===K.id?{...t,comment:e}:t)),q(null))},[G,K,Q,A,U]),qe=(0,B.useCallback)(()=>{K&&(U(e=>e.filter(e=>e.id!==K.id)),q(null))},[K,U]),Je=(0,B.useCallback)(e=>{if(V.length===0)return;let t=(e%V.length+V.length)%V.length,n=V[t];Se(t),M(n.fileIndex),w&&R(!1),setTimeout(()=>{let e=J.current;if(!e)return;let t=D[n.fileIndex];if(!t)return;let r=I?null:Z(t),i=r?n.lineNumber-r.startLine+1:n.lineNumber;(n.side===`original`?e.getOriginalEditor():e.getModifiedEditor()).revealLineInCenter(Math.max(1,i)),$()},100)},[V,D,I,$,w]),Ye=(0,B.useCallback)(()=>{Je((W??0)-1)},[Je,W]),Xe=(0,B.useCallback)(()=>{Je((W??-1)+1)},[Je,W]),Ze=(0,B.useCallback)(async()=>{let n=S[e];if(!n)try{let e=await t(),r=Object.values(e).flat();if(r.length>0)n=r[0];else{ze.error(`No models available to process comments`);return}}catch(e){ze.error(`Failed to load models:`,e);return}let r=n.id,i=n.provider;try{let{prompt:t}=await c(e,V);U([]),v({type:ue.SetPendingChatMessage,message:{threadId:e,message:t,model:r,provider:i}}),a()}catch(e){ze.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[V,S,v,e,a,U]),Qe={readOnly:!0,renderSideBySide:!w,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:Q&&(I||Le(Q))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0},$e=(0,H.jsx)(`div`,{className:`flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,children:(0,H.jsx)(Te,{treeData:Me,files:D,error:ee,selectedFileIndex:A,onFileSelect:ve,onRevertFile:je})}),et=(0,H.jsxs)(`div`,{className:`diff-editor-panel flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden bg-transparent`,children:[(0,H.jsxs)(me,{className:o(`bg-transparent`,L&&`h-auto py-3 flex-col items-start gap-3 md:flex-row md:items-center md:h-[71px] md:py-0 md:gap-2 justify-between`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[be?(0,H.jsxs)(g,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:ye,children:[(0,H.jsx)(O,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):(0,H.jsxs)(g,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:ke,children:[L?(0,H.jsx)(O,{className:`h-4 w-4`}):(0,H.jsx)(n,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),(0,H.jsx)(`span`,{className:o(T.label,`text-foreground`),children:Q?Q.path:`Review Changes`})]}),(0,H.jsxs)(`div`,{className:o(`flex items-center gap-2`,L&&`ml-0`,!L&&`ml-auto`,`md:ml-auto`),children:[!He&&(0,H.jsx)(g,{variant:`ghost`,size:`sm`,onClick:()=>re(e=>!e),disabled:!Q,className:o(T.compact,`h-8 gap-1 px-2`),children:I?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(i,{className:`h-3 w-3`}),` Show changes only`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(N,{className:`h-3 w-3`}),` Show full file`]})}),V.length>0&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(p,{children:[(0,H.jsx)(r,{asChild:!0,children:(0,H.jsx)(g,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Ye,disabled:(W??0)===0,children:(0,H.jsx)(_,{className:`h-3 w-3`})})}),(0,H.jsx)(b,{children:`Previous comment`})]}),(0,H.jsx)(`span`,{className:o(T.caption,`whitespace-nowrap`),children:V.length===1?`1 Comment`:`Comment ${(W??0)+1} of ${V.length}`}),(0,H.jsxs)(p,{children:[(0,H.jsx)(r,{asChild:!0,children:(0,H.jsx)(g,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Xe,disabled:(W??0)===V.length-1,children:(0,H.jsx)(h,{className:`h-3 w-3`})})}),(0,H.jsx)(b,{children:`Next comment`})]})]}),V.length>0&&(0,H.jsxs)(p,{children:[(0,H.jsx)(r,{asChild:!0,children:(0,H.jsxs)(g,{size:`sm`,onClick:Ze,className:o(T.compact,`h-8 gap-1 px-3 bg-foreground text-background hover:bg-foreground/90`),children:[(0,H.jsx)(f,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,H.jsx)(b,{children:`Send all comments to Tarsk for resolution`})]})]})]}),(0,H.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[He&&Q?(0,H.jsx)(Ne,{threadId:e,file:Q}):(0,H.jsx)(P,{height:`100%`,language:Re(Q?.path||``),original:Ue,modified:We,theme:C===`dark`?`vs-dark`:`vs-light`,onMount:Ge,options:Qe},`diff-${A}`),(0,H.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 right-4 z-20 flex flex-col items-end gap-3`,children:[ae&&(0,H.jsxs)(`div`,{className:`pointer-events-auto w-[min(100%,48rem)] rounded-2xl bg-background/50 p-4 backdrop-blur-md`,children:[(0,H.jsx)(`div`,{className:`mb-3 flex items-center justify-end`,children:(0,H.jsxs)(g,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>ce(!1),children:[(0,H.jsx)(l,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Close chat`})]})}),(0,H.jsx)(he,{})]}),!ae&&(0,H.jsxs)(p,{children:[(0,H.jsx)(r,{asChild:!0,children:(0,H.jsxs)(g,{size:`icon`,className:`pointer-events-auto h-12 w-12 rounded-full shadow-lg`,onClick:()=>ce(!0),children:[(0,H.jsx)(f,{className:`h-5 w-5`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Open review chat`})]})}),(0,H.jsx)(b,{children:`Chat about this diff`})]})]})]})]});return(0,H.jsxs)(`div`,{className:`diff-view-root flex h-full min-h-0 w-full flex-col`,children:[(0,H.jsx)(`div`,{className:`diff-body flex min-h-0 w-full flex-1 overflow-hidden`,children:w?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:o(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,!fe&&`hidden`),children:$e}),(0,H.jsx)(`div`,{className:o(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,fe&&`hidden`),children:et})]}):(0,H.jsxs)(ge,{direction:`horizontal`,children:[(0,H.jsx)(_e,{ref:z,defaultSize:25,minSize:12,maxSize:40,collapsible:!0,collapsedSize:0,onCollapse:()=>ie(!0),onExpand:()=>ie(!1),className:`border-r border-transparent`,children:$e}),(0,H.jsx)(Pe,{isOpen:!L}),(0,H.jsx)(_e,{className:`overflow-hidden border-l border-border bg-transparent`,children:et})]})}),(0,H.jsx)(Fe,{open:G!==null||K!==null,lineNumber:K?.lineNumber??G?.lineNumber??0,lineContent:K?.lineContent??G?.lineContent??``,initialComment:K?.comment,isEditing:K!==null,onSave:Ke,onDelete:qe,onClose:()=>{Ce(null),q(null)}},`${K?.id??``}-${G?.lineNumber??``}-${G?.side??``}`)]})}function Ue(e){let t=(0,V.c)(22),[n,r]=(0,B.useState)(0),[i,a]=(0,B.useState)(0),o=(0,B.useRef)(0),s;t[0]===e.threadId?s=t[1]:(s=()=>{r(t=>(ie(Be(e.threadId,t)),t+1)),a($)},t[0]=e.threadId,t[1]=s);let c=s,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(0),r(0),o.current=0},t[2]=l):l=t[2];let u;t[3]===e.threadId?u=t[4]:(u=[e.threadId],t[3]=e.threadId,t[4]=u),(0,B.useEffect)(l,u);let d,f;t[5]!==e.refreshTrigger||t[6]!==e.threadId?(d=()=>{!e.refreshTrigger||e.refreshTrigger<=o.current||(o.current=e.refreshTrigger,r(t=>(ie(Be(e.threadId,t)),t+1)),a(We))},f=[e.refreshTrigger,e.threadId],t[5]=e.refreshTrigger,t[6]=e.threadId,t[7]=d,t[8]=f):(d=t[7],f=t[8]),(0,B.useEffect)(d,f);let p=`${e.threadId}:${i}`,m;t[9]===c?m=t[10]:(m=(0,H.jsx)(Re,{onRetry:c}),t[9]=c,t[10]=m);let h=`${e.threadId}:${n}`,g;t[11]!==n||t[12]!==e||t[13]!==h?(g=(0,H.jsx)(He,{...e,loadVersion:n},h),t[11]=n,t[12]=e,t[13]=h,t[14]=g):g=t[14];let _;t[15]!==m||t[16]!==g?(_=(0,H.jsx)(B.Suspense,{fallback:m,children:g}),t[15]=m,t[16]=g,t[17]=_):_=t[17];let v;return t[18]!==c||t[19]!==p||t[20]!==_?(v=(0,H.jsx)(L,{fallbackTitle:`Failed to load review changes`,onRetry:c,children:_},p),t[18]=c,t[19]=p,t[20]=_,t[21]=v):v=t[21],v}function We(e){return e+1}function $(e){return e+1}export{Ue as DiffView,Ue as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-B60M0QAV.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-C2iIghSR.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-BsN806ip.js","assets/dialogs-config-86QTDk4G.js","assets/onboarding-DCrFdRM5.js","assets/vosk-speech-Ce0kC8Ck.js","assets/react-vendor-DK2COBjg.js","assets/utils-DPYK-CSn.js","assets/index-DhnUeGIU.css","assets/api-BUjKoVUu.js","assets/context-menu-DO3hiSAo.js","assets/ui-components-BJRW2LJq.js","assets/explorer-view-BBaEk8i9.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Fs as t,Ii as n,Is as r,Rs as i,c as a,fs as o}from"./dialogs-config-86QTDk4G.js";import{r as s}from"./monaco-CZnIWXyV.js";import{l as c,n as l,u}from"./history-view-BsN806ip.js";import{C as d,F as f,P as p,W as m,f as h,m as g,p as _}from"./index-C2iIghSR.js";var v=r(),y=e(i(),1),b=t(),x=(0,y.lazy)(()=>s(()=>import(`./explorer-tree-B60M0QAV.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),S=(0,y.lazy)(()=>s(()=>import(`./explorer-view-BBaEk8i9.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function C(){let e=(0,v.c)(49),t=m(w),r=d(),[i,s]=(0,y.useState)(null),[C,T]=(0,y.useState)(!0),{pendingExplorerPath:E,setPendingExplorerPath:D,explorerClearPath:O,setExplorerClearPath:k}=p(),A;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{T(!0)},e[0]=A):A=e[0];let j;e[1]===t?j=e[2]:(j=[t],e[1]=t,e[2]=j),(0,y.useEffect)(A,j);let M;e[3]===r?M=e[4]:(M=e=>{s(e),r&&T(!1)},e[3]=r,e[4]=M);let N=M,P;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{T(!0)},e[5]=P):P=e[5];let F=P,I;e[6]===r?I=e[7]:(I=e=>{s(e),r&&T(!1)},e[6]=r,e[7]=I);let L=I,R,z;e[8]!==r||e[9]!==E||e[10]!==D?(R=()=>{E&&(s({name:E.split(`/`).pop()??E,path:E,type:`file`}),r&&T(!1),D(null))},z=[r,E,D],e[8]=r,e[9]=E,e[10]=D,e[11]=R,e[12]=z):(R=e[11],z=e[12]),(0,y.useEffect)(R,z);let B,V;e[13]!==O||e[14]!==r||e[15]!==i||e[16]!==k?(B=()=>{O&&(i&&(i.path===O||i.path.startsWith(O+`/`))&&(s(null),r&&T(!0)),k(null))},V=[O,r,i,k],e[13]=O,e[14]=r,e[15]=i,e[16]=k,e[17]=B,e[18]=V):(B=e[17],V=e[18]),(0,y.useEffect)(B,V);let H;e[19]!==N||e[20]!==i?.path||e[21]!==t?(H=(0,b.jsx)(a,{className:`h-full`,children:t?(0,b.jsx)(f,{threadId:t,children:(0,b.jsx)(l,{fallbackTitle:`Failed to load files`,children:(0,b.jsx)(y.Suspense,{fallback:(0,b.jsx)(u,{}),children:(0,b.jsx)(x,{threadId:t,selectedPath:i?.path??null,onNodeSelect:N})})})}):(0,b.jsx)(`p`,{className:n(o.caption,`px-3 py-4 text-center`),children:`No thread selected.`})}),e[19]=N,e[20]=i?.path,e[21]=t,e[22]=H):H=e[22];let U=H,W;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,b.jsx)(c,{}),e[23]=W):W=e[23];let G=r&&!C,K;e[24]!==L||e[25]!==i||e[26]!==G?(K=(0,b.jsx)(y.Suspense,{fallback:W,children:(0,b.jsx)(S,{selectedFile:i,showTreeBackButton:G,onShowTree:F,onFileCreated:L})}),e[24]=L,e[25]=i,e[26]=G,e[27]=K):K=e[27];let q=K;if(r){let t=!C&&`hidden`,r;e[28]===t?r=e[29]:(r=n(`flex-1 min-h-0 overflow-hidden`,t),e[28]=t,e[29]=r);let i;e[30]!==U||e[31]!==r?(i=(0,b.jsx)(`div`,{className:r,children:U}),e[30]=U,e[31]=r,e[32]=i):i=e[32];let a=C&&`hidden`,o;e[33]===a?o=e[34]:(o=n(`flex-1 min-h-0 overflow-hidden`,a),e[33]=a,e[34]=o);let s;e[35]!==q||e[36]!==o?(s=(0,b.jsx)(`div`,{className:o,children:q}),e[35]=q,e[36]=o,e[37]=s):s=e[37];let c;return e[38]!==i||e[39]!==s?(c=(0,b.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[i,s]}),e[38]=i,e[39]=s,e[40]=c):c=e[40],c}let J;e[41]===U?J=e[42]:(J=(0,b.jsx)(_,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:U}),e[41]=U,e[42]=J);let Y;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,b.jsx)(h,{withHandle:!0}),e[43]=Y):Y=e[43];let X;e[44]===q?X=e[45]:(X=(0,b.jsx)(_,{className:`overflow-hidden`,children:q}),e[44]=q,e[45]=X);let Z;return e[46]!==J||e[47]!==X?(Z=(0,b.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,b.jsxs)(g,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[J,Y,X]})}),e[46]=J,e[47]=X,e[48]=Z):Z=e[48],Z}function w(e){return e.selectedThreadId}export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Br as t,Fo as n,Ii as r,Is as i,Lr as a,No as o,Ns as s,Pi as c,Ps as l,Rr as u,Zr as d,eo as f,fa as p,fs as m,ro as h,to as g,va as _}from"./dialogs-config-DAMqiy-4.js";import{A as v,F as y,M as b,O as x,a as S,c as C,j as w,k as T,n as E,o as D,u as O}from"./history-view-lvvTzW7O.js";import{d as k}from"./onboarding-dys9Rwb5.js";import{B as A,I as j,M as ee,N as te,P as M,S as N,j as ne}from"./index-C_iiobDl.js";import{a as P,i as F,n as I,r as L,t as R}from"./context-menu-CHJI6MbC.js";import{l as z,n as re,o as ie,r as ae,s as oe,t as se}from"./api-DM6LtnPA.js";import{t as B}from"./ui-components-BPFbmhJA.js";var V=l(),H=e(i(),1),U=s(),W=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});W.displayName=B.displayName;var G=H.forwardRef((e,t)=>{let n=(0,V.c)(10),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(p,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=o):o=n[3];let s;n[4]===i?s=n[5]:(s=r(`flex h-11 w-full rounded-md bg-transparent py-3 text-base outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),n[4]=i,n[5]=s);let c;return n[6]!==a||n[7]!==t||n[8]!==s?(c=(0,U.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[o,(0,U.jsx)(B.Input,{ref:t,className:s,...a})]}),n[6]=a,n[7]=t,n[8]=s,n[9]=c):c=n[9],c});G.displayName=B.Input.displayName;var K=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`max-h-[300px] overflow-y-auto overflow-x-hidden`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.List,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});K.displayName=B.List.displayName;var q=H.forwardRef((e,t)=>{let n=(0,V.c)(4),i;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=r(m.bodyMuted,`py-6 text-center`),n[0]=i):i=n[0];let a;return n[1]!==e||n[2]!==t?(a=(0,U.jsx)(B.Empty,{ref:t,className:i,...e}),n[1]=e,n[2]=t,n[3]=a):a=n[3],a});q.displayName=B.Empty.displayName;var J=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`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`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Group,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});J.displayName=B.Group.displayName;var ce=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`-mx-1 h-px bg-border`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Separator,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});ce.displayName=B.Separator.displayName;var le=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(r(m.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`),i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Item,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});le.displayName=B.Item.displayName;var Y=e=>{let t=(0,V.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let a;t[3]===n?a=t[4]:(a=r(m.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,U.jsx)(`span`,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o};Y.displayName=`CommandShortcut`;var X=100,ue=500;function Z(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function de(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function fe(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(de(n,t)&&(r.push(n.node),r.length>=ue))break;return r.sort((e,t)=>pe(e,t,n)).slice(0,X)}function pe(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 me(e){let t=(0,V.c)(38),{items:n,isReady:i,onRequestIndex:a,onOpenChange:o,onSelect:s}=e,c=i===void 0?!1:i,l=(0,H.useRef)(null),u=(0,H.useRef)(!1),p=(0,H.useRef)(!1),[h,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(``),y=(0,H.useDeferredValue)(_),b;t[0]===a?b=t[1]:(b=function(){p.current||(p.current=!0,a())},t[0]=a,t[1]=b);let x=b,S;t[2]!==y||t[3]!==n?(S=fe(n,Z(y),y),t[2]=y,t[3]=n,t[4]=S):S=t[4];let C=S,w,T;t[5]!==o||t[6]!==_?(w=()=>{let e=_.trim().length>0;g(e),u.current!==e&&(u.current=e,o(e))},T=[o,_],t[5]=o,t[6]=_,t[7]=w,t[8]=T):(w=t[7],T=t[8]),(0,H.useEffect)(w,T);let E;t[9]===o?E=t[10]:(E=function(e){e||v(``),g(e),o(e),e&&requestAnimationFrame(()=>l.current?.focus())},t[9]=o,t[10]=E);let D=E,O;t[11]!==o||t[12]!==s?(O=function(e){s(e),g(!1),o(!1),v(``)},t[11]=o,t[12]=s,t[13]=O):O=t[13];let k=O,A;t[14]===x?A=t[15]:(A=e=>{x(),v(e.target.value)},t[14]=x,t[15]=A);let j;t[16]!==_||t[17]!==x||t[18]!==A?(j=(0,U.jsx)(te,{asChild:!0,children:(0,U.jsx)(`div`,{children:(0,U.jsx)(d,{ref:l,value:_,onPointerDown:x,onChange:A,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),t[16]=_,t[17]=x,t[18]=A,t[19]=j):j=t[19];let M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=r(m.compact,`py-4`),t[20]=M):M=t[20];let P=c?`No matches found.`:`Indexing files and folders...`,F;t[21]===P?F=t[22]:(F=(0,U.jsx)(q,{className:M,children:P}),t[21]=P,t[22]=F);let I;if(t[23]!==k||t[24]!==C){let e;t[26]===k?e=t[27]:(e=e=>(0,U.jsxs)(le,{value:e.path,onSelect:()=>k(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,U.jsx)(f,{className:`h-4 w-4 text-muted-foreground`}):(0,U.jsx)(N,{filename:e.name}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate`,children:e.name}),(0,U.jsx)(`div`,{className:r(m.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),t[26]=k,t[27]=e),I=C.map(e),t[23]=k,t[24]=C,t[25]=I}else I=t[25];let L;t[28]===I?L=t[29]:(L=(0,U.jsx)(J,{children:I}),t[28]=I,t[29]=L);let R;t[30]!==F||t[31]!==L?(R=(0,U.jsx)(ee,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:Q,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,U.jsx)(W,{shouldFilter:!1,children:(0,U.jsxs)(K,{children:[F,L]})})}),t[30]=F,t[31]=L,t[32]=R):R=t[32];let z;return t[33]!==D||t[34]!==h||t[35]!==R||t[36]!==j?(z=(0,U.jsxs)(ne,{open:h,onOpenChange:D,children:[j,R]}),t[33]=D,t[34]=h,t[35]=R,t[36]=j,t[37]=z):z=t[37],z}function Q(e){return e.preventDefault()}function he(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function ge(e){let t=(0,V.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=he(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=()=>ie(n,r).then(_e),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=S(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,U.jsx)(U.Fragment,{children:l}),t[10]=l,t[11]=u),u}function _e(e){return e.entries}function ve(e){let t=(0,V.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,H.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,H.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,p;t[5]!==i||t[6]!==r?(p=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=p):p=t[7];let m=p,h;t[8]!==n||t[9]!==m||t[10]!==f?(h=(0,U.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:m,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:$}),t[8]=n,t[9]=m,t[10]=f,t[11]=h):h=t[11];let g;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==h?(g=(0,U.jsxs)(k,{level:a,basePadding:o,children:[s,h]}),t[12]=o,t[13]=s,t[14]=a,t[15]=h,t[16]=g):g=t[16],g}function $(e){return e.stopPropagation()}function ye(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}function be(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}var xe=(0,H.memo)(function e({node:t,level:r,threadId:i,selectedPath:a,expandedPaths:s,getDirVersion:c,renamingPath:l,newItemIn:u,onToggleFolder:d,onSelectNode:p,onStartRename:m,onCommitRename:_,onCancelRename:v,onDelete:y,onOpen:b,onCopyReference:x,onNewFile:S,onNewFolder:w,onCommitNewItem:T,onCancelNewItem:E}){let D=s.has(t.path),O=l===t.path,A=u?.dirPath===t.path&&D;return t.type===`folder`?(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(k,{level:r,basePadding:10,selected:a===t.path,className:t.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),d(t)},children:[(0,U.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:D?(0,U.jsx)(n,{className:`h-3 w-3`}):(0,U.jsx)(o,{className:`h-3 w-3`})}),O?(0,U.jsxs)(U.Fragment,{children:[D?(0,U.jsx)(g,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?_(t,n):v()}else e.key===`Escape`&&v()},onBlur:e=>{let n=e.target.value.trim();n?_(t,n):v()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,U.jsxs)(U.Fragment,{children:[D?(0,U.jsx)(g,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})]}),D&&(0,U.jsx)(`div`,{children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(C,{}),children:(0,U.jsx)(ge,{threadId:i,dirPath:t.path,version:c(t.path),children:t=>(0,U.jsxs)(U.Fragment,{children:[A&&(0,U.jsx)(ve,{defaultValue:``,level:r+1,basePadding:u.type===`folder`?10:22,icon:u.type===`folder`?(0,U.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(h,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:T,onCancel:E}),t.map(t=>(0,U.jsx)(e,{node:t,level:r+1,threadId:i,selectedPath:a,expandedPaths:s,getDirVersion:c,renamingPath:l,newItemIn:u,onToggleFolder:d,onSelectNode:p,onStartRename:m,onCommitRename:_,onCancelRename:v,onDelete:y,onOpen:b,onCopyReference:x,onNewFile:S,onNewFolder:w,onCommitNewItem:T,onCancelNewItem:E},t.path))]})})})})]})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{onSelect:()=>b(t),children:`Open`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>S(t.path),children:`New File...`}),(0,U.jsx)(L,{onSelect:()=>w(t.path),children:`New Folder...`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>x(t),children:`Copy Reference`}),(0,U.jsx)(L,{onSelect:()=>m(t),children:`Rename...`}),(0,U.jsx)(L,{onSelect:()=>y(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(k,{level:r,basePadding:22,selected:a===t.path,className:t.ignored?`opacity-50`:void 0,onClick:()=>p(t),children:[(0,U.jsx)(N,{filename:t.name}),O?(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?_(t,n):v()}else e.key===`Escape`&&v()},onBlur:e=>{let n=e.target.value.trim();n?_(t,n):v()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,U.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{onSelect:()=>b(t),children:`Open`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>S(be(t.path)),children:`New File...`}),(0,U.jsx)(L,{onSelect:()=>w(be(t.path)),children:`New Folder...`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>x(t),children:`Copy Reference`}),(0,U.jsx)(L,{onSelect:()=>m(t),children:`Rename...`}),(0,U.jsx)(L,{onSelect:()=>y(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),Se=new Map;function Ce({threadId:e,selectedPath:n,onNodeSelect:r}){let[i,o]=(0,H.useState)(()=>new Map([[``,0]])),[s,l]=(0,H.useState)(new Set),[d,p]=(0,H.useState)(null),[m,g]=(0,H.useState)(null),[S,C]=(0,H.useState)(null),[k,ee]=(0,H.useState)(!1),[te,N]=(0,H.useState)([]),[ne,F]=(0,H.useState)(!1),[B,V]=(0,H.useState)(!1),W=(0,H.useRef)(null),G=(0,H.useRef)(0),K=(0,H.useRef)(null),{explorerRefreshTick:q,pendingExplorerPath:J,setExplorerClearPath:ce,triggerExplorerRefresh:le}=M(),{fetchUnifiedStatus:Y}=j(),X=(0,H.useMemo)(()=>`${e}:${q}`,[q,e]),ue=(0,H.useCallback)(e=>{(0,H.startTransition)(()=>{ee(t=>t===e?t:e)})},[]),Z=(0,H.useCallback)(async()=>{if(!e)return;let t=Se.get(X);if(t){N(t),F(!0);return}if(W.current!==X){W.current=X,N([]),F(!1);try{let t=ye((await ie(e,``,!0)).entries);Se.set(X,t),N(t),F(!0)}catch{N([]),F(!1)}finally{W.current===X&&(W.current=null)}}},[X,e]),de=(0,H.useCallback)(()=>{V(!0)},[]),fe=(0,H.useCallback)(()=>{Se.delete(X),N([]),F(!1)},[X]),pe=(0,H.useCallback)(()=>{fe(),B&&Z()},[fe,Z,B]),Q=(0,H.useCallback)(e=>i.get(e)??0,[i]),_e=(0,H.useCallback)(e=>{o(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,H.useCallback)(t=>{e&&(D(he(e,t,Q(t))),_e(t))},[_e,Q,e]),Ce=(0,H.useCallback)(t=>{if(!e)return;let n=t.path.split(`/`);t.type===`file`&&n.pop();let r=[],i=``;for(let e of n)i=i?`${i}/${e}`:e,r.push(i);l(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,H.useEffect)(()=>{if(!e)return;let t=K.current!==null&&K.current!==e;K.current=e,t&&(o(new Map([[``,0]])),l(new Set),p(null),g(null),G.current=q)},[q,e]),(0,H.useEffect)(()=>{!e||q<=G.current||(G.current=q,o(t=>{let n=new Set([``]);for(let e of s)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;D(he(e,i,n)),r.set(i,n+1)}return r}))},[q,s,e]),(0,H.useEffect)(()=>{N([]),F(!1),V(!1),W.current=null},[X]),(0,H.useEffect)(()=>{!B||!e||Z()},[Z,B,e]),(0,H.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){l(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[J,e]);function we(e){s.has(e.path)?l(t=>{let n=new Set(t);return n.delete(e.path),n}):(l(t=>new Set(t).add(e.path)),o(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function Te(e){C(e)}async function Ee(t){try{await oe(e,t.path)}catch{A({title:`Error`,description:`Failed to open "${t.name}"`,variant:`destructive`})}}async function De(e){try{await navigator.clipboard.writeText(e.path);let t=A({title:`Copied`,description:`Reference copied to clipboard.`});window.setTimeout(()=>{t.dismiss()},2e3)}catch{A({title:`Error`,description:`Failed to copy reference for "${e.name}"`,variant:`destructive`})}}async function Oe(){if(!S)return;let t=S;C(null);try{await ae(e,t.path),ce(t.path),$(be(t.path)),pe(),Y(!0),l(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(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{A({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function ke(e){g(null),p(e.path)}async function Ae(t,n){if(n===t.name){p(null);return}p(null);try{await z(e,t.path,n),$(be(t.path)),pe(),Y(!0),t.type===`folder`&&(l(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(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{A({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function je(e){p(null),s.has(e)||(l(t=>new Set(t).add(e)),o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),g({dirPath:e,type:`file`})}function Me(e){p(null),s.has(e)||(l(t=>new Set(t).add(e)),o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),g({dirPath:e,type:`folder`})}async function Ne(t){if(!m)return;let{dirPath:n,type:r}=m;g(null);try{r===`file`?await se(e,n,t):await re(e,n,t),$(n),pe(),Y(!0)}catch{A({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Pe(){g(null)}function Fe(e){Ce(e),e.type===`file`&&r(e)}let Ie=m?.dirPath===``?(0,U.jsx)(ve,{defaultValue:``,level:0,basePadding:m.type===`folder`?10:22,icon:m.type===`folder`?(0,U.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(h,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:Ne,onCancel:Pe}):null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(x,{open:S!==null,onOpenChange:e=>!e&&C(null),children:(0,U.jsxs)(w,{children:[(0,U.jsx)(y,{children:`Move to Trash`}),(0,U.jsxs)(b,{children:[`Move “`,S?.name,`” to trash?`]}),(0,U.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,U.jsx)(v,{children:`Cancel`}),(0,U.jsx)(T,{onClick:()=>void Oe(),children:`Move to Trash`})]})]})}),(0,U.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(me,{items:te,isReady:ne,onRequestIndex:de,onOpenChange:ue,onSelect:e=>Fe(e)},X)}),(0,U.jsxs)(a,{children:[(0,U.jsx)(t,{asChild:!0,children:(0,U.jsx)(c,{variant:`ghost`,size:`icon-sm`,onClick:le,"aria-label":`Refresh file listing`,children:(0,U.jsx)(_,{className:`h-4 w-4`})})}),(0,U.jsx)(u,{children:`Refresh`})]})]})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{asChild:!0,disabled:k,children:(0,U.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,U.jsx)(E,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(O,{}),children:(0,U.jsx)(ge,{threadId:e,dirPath:``,version:Q(``),children:t=>(0,U.jsxs)(U.Fragment,{children:[Ie,t.map(t=>(0,U.jsx)(xe,{node:t,level:0,threadId:e,selectedPath:n,expandedPaths:s,getDirVersion:Q,renamingPath:d,newItemIn:m,onToggleFolder:we,onSelectNode:r,onStartRename:ke,onCommitRename:Ae,onCancelRename:()=>p(null),onDelete:Te,onOpen:Ee,onCopyReference:De,onNewFile:je,onNewFolder:Me,onCommitNewItem:Ne,onCancelNewItem:Pe},t.path))]})})})})})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{onSelect:()=>je(``),children:`New File...`}),(0,U.jsx)(L,{onSelect:()=>Me(``),children:`New Folder...`})]})]})]})}export{Ce as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Br as t,Fo as n,Fs as r,Ii as i,Is as a,Lr as o,No as s,Pi as c,Rr as l,Rs as u,Zr as d,eo as f,fa as p,fs as m,ro as h,to as g,va as _}from"./dialogs-config-86QTDk4G.js";import{A as v,F as y,M as b,O as x,a as S,c as C,j as w,k as T,n as E,o as D,u as O}from"./history-view-BsN806ip.js";import{d as k}from"./onboarding-DCrFdRM5.js";import{B as A,I as j,M as ee,N as te,P as M,S as N,j as ne}from"./index-C2iIghSR.js";import{a as P,i as F,n as I,r as L,t as R}from"./context-menu-DO3hiSAo.js";import{l as z,n as re,o as ie,r as ae,s as oe,t as se}from"./api-BUjKoVUu.js";import{t as B}from"./ui-components-BJRW2LJq.js";var V=a(),H=e(u(),1),U=r(),W=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});W.displayName=B.displayName;var G=H.forwardRef((e,t)=>{let n=(0,V.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 o;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(p,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=o):o=n[3];let s;n[4]===r?s=n[5]:(s=i(`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]=s);let c;return n[6]!==a||n[7]!==t||n[8]!==s?(c=(0,U.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[o,(0,U.jsx)(B.Input,{ref:t,className:s,...a})]}),n[6]=a,n[7]=t,n[8]=s,n[9]=c):c=n[9],c});G.displayName=B.Input.displayName;var K=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.List,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});K.displayName=B.List.displayName;var q=H.forwardRef((e,t)=>{let n=(0,V.c)(4),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=i(m.bodyMuted,`py-6 text-center`),n[0]=r):r=n[0];let a;return n[1]!==e||n[2]!==t?(a=(0,U.jsx)(B.Empty,{ref:t,className:r,...e}),n[1]=e,n[2]=t,n[3]=a):a=n[3],a});q.displayName=B.Empty.displayName;var J=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`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]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Group,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});J.displayName=B.Group.displayName;var ce=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`-mx-1 h-px bg-border`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Separator,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});ce.displayName=B.Separator.displayName;var le=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(i(m.body,`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`),r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Item,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});le.displayName=B.Item.displayName;var Y=e=>{let t=(0,V.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let a;t[3]===n?a=t[4]:(a=i(m.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==r||t[6]!==a?(o=(0,U.jsx)(`span`,{className:a,...r}),t[5]=r,t[6]=a,t[7]=o):o=t[7],o};Y.displayName=`CommandShortcut`;var X=100,ue=500;function Z(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function de(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function fe(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(de(n,t)&&(r.push(n.node),r.length>=ue))break;return r.sort((e,t)=>pe(e,t,n)).slice(0,X)}function pe(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 me(e){let t=(0,V.c)(38),{items:n,isReady:r,onRequestIndex:a,onOpenChange:o,onSelect:s}=e,c=r===void 0?!1:r,l=(0,H.useRef)(null),u=(0,H.useRef)(!1),p=(0,H.useRef)(!1),[h,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(``),y=(0,H.useDeferredValue)(_),b;t[0]===a?b=t[1]:(b=function(){p.current||(p.current=!0,a())},t[0]=a,t[1]=b);let x=b,S;t[2]!==y||t[3]!==n?(S=fe(n,Z(y),y),t[2]=y,t[3]=n,t[4]=S):S=t[4];let C=S,w,T;t[5]!==o||t[6]!==_?(w=()=>{let e=_.trim().length>0;g(e),u.current!==e&&(u.current=e,o(e))},T=[o,_],t[5]=o,t[6]=_,t[7]=w,t[8]=T):(w=t[7],T=t[8]),(0,H.useEffect)(w,T);let E;t[9]===o?E=t[10]:(E=function(e){e||v(``),g(e),o(e),e&&requestAnimationFrame(()=>l.current?.focus())},t[9]=o,t[10]=E);let D=E,O;t[11]!==o||t[12]!==s?(O=function(e){s(e),g(!1),o(!1),v(``)},t[11]=o,t[12]=s,t[13]=O):O=t[13];let k=O,A;t[14]===x?A=t[15]:(A=e=>{x(),v(e.target.value)},t[14]=x,t[15]=A);let j;t[16]!==_||t[17]!==x||t[18]!==A?(j=(0,U.jsx)(te,{asChild:!0,children:(0,U.jsx)(`div`,{children:(0,U.jsx)(d,{ref:l,value:_,onPointerDown:x,onChange:A,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),t[16]=_,t[17]=x,t[18]=A,t[19]=j):j=t[19];let M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=i(m.compact,`py-4`),t[20]=M):M=t[20];let P=c?`No matches found.`:`Indexing files and folders...`,F;t[21]===P?F=t[22]:(F=(0,U.jsx)(q,{className:M,children:P}),t[21]=P,t[22]=F);let I;if(t[23]!==k||t[24]!==C){let e;t[26]===k?e=t[27]:(e=e=>(0,U.jsxs)(le,{value:e.path,onSelect:()=>k(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,U.jsx)(f,{className:`h-4 w-4 text-muted-foreground`}):(0,U.jsx)(N,{filename:e.name}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate`,children:e.name}),(0,U.jsx)(`div`,{className:i(m.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),t[26]=k,t[27]=e),I=C.map(e),t[23]=k,t[24]=C,t[25]=I}else I=t[25];let L;t[28]===I?L=t[29]:(L=(0,U.jsx)(J,{children:I}),t[28]=I,t[29]=L);let R;t[30]!==F||t[31]!==L?(R=(0,U.jsx)(ee,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:Q,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,U.jsx)(W,{shouldFilter:!1,children:(0,U.jsxs)(K,{children:[F,L]})})}),t[30]=F,t[31]=L,t[32]=R):R=t[32];let z;return t[33]!==D||t[34]!==h||t[35]!==R||t[36]!==j?(z=(0,U.jsxs)(ne,{open:h,onOpenChange:D,children:[j,R]}),t[33]=D,t[34]=h,t[35]=R,t[36]=j,t[37]=z):z=t[37],z}function Q(e){return e.preventDefault()}function he(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function ge(e){let t=(0,V.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=he(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=()=>ie(n,r).then(_e),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=S(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,U.jsx)(U.Fragment,{children:l}),t[10]=l,t[11]=u),u}function _e(e){return e.entries}function ve(e){let t=(0,V.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,H.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,H.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,p;t[5]!==i||t[6]!==r?(p=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=p):p=t[7];let m=p,h;t[8]!==n||t[9]!==m||t[10]!==f?(h=(0,U.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:m,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:$}),t[8]=n,t[9]=m,t[10]=f,t[11]=h):h=t[11];let g;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==h?(g=(0,U.jsxs)(k,{level:a,basePadding:o,children:[s,h]}),t[12]=o,t[13]=s,t[14]=a,t[15]=h,t[16]=g):g=t[16],g}function $(e){return e.stopPropagation()}function ye(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}function be(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}var xe=(0,H.memo)(function e({node:t,level:r,threadId:i,selectedPath:a,expandedPaths:o,getDirVersion:c,renamingPath:l,newItemIn:u,onToggleFolder:d,onSelectNode:p,onStartRename:m,onCommitRename:_,onCancelRename:v,onDelete:y,onOpen:b,onCopyReference:x,onNewFile:S,onNewFolder:w,onCommitNewItem:T,onCancelNewItem:E}){let D=o.has(t.path),O=l===t.path,A=u?.dirPath===t.path&&D;return t.type===`folder`?(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(k,{level:r,basePadding:10,selected:a===t.path,className:t.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),d(t)},children:[(0,U.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:D?(0,U.jsx)(n,{className:`h-3 w-3`}):(0,U.jsx)(s,{className:`h-3 w-3`})}),O?(0,U.jsxs)(U.Fragment,{children:[D?(0,U.jsx)(g,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?_(t,n):v()}else e.key===`Escape`&&v()},onBlur:e=>{let n=e.target.value.trim();n?_(t,n):v()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,U.jsxs)(U.Fragment,{children:[D?(0,U.jsx)(g,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})]}),D&&(0,U.jsx)(`div`,{children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(C,{}),children:(0,U.jsx)(ge,{threadId:i,dirPath:t.path,version:c(t.path),children:t=>(0,U.jsxs)(U.Fragment,{children:[A&&(0,U.jsx)(ve,{defaultValue:``,level:r+1,basePadding:u.type===`folder`?10:22,icon:u.type===`folder`?(0,U.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(h,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:T,onCancel:E}),t.map(t=>(0,U.jsx)(e,{node:t,level:r+1,threadId:i,selectedPath:a,expandedPaths:o,getDirVersion:c,renamingPath:l,newItemIn:u,onToggleFolder:d,onSelectNode:p,onStartRename:m,onCommitRename:_,onCancelRename:v,onDelete:y,onOpen:b,onCopyReference:x,onNewFile:S,onNewFolder:w,onCommitNewItem:T,onCancelNewItem:E},t.path))]})})})})]})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{onSelect:()=>b(t),children:`Open`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>S(t.path),children:`New File...`}),(0,U.jsx)(L,{onSelect:()=>w(t.path),children:`New Folder...`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>x(t),children:`Copy Reference`}),(0,U.jsx)(L,{onSelect:()=>m(t),children:`Rename...`}),(0,U.jsx)(L,{onSelect:()=>y(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(k,{level:r,basePadding:22,selected:a===t.path,className:t.ignored?`opacity-50`:void 0,onClick:()=>p(t),children:[(0,U.jsx)(N,{filename:t.name}),O?(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?_(t,n):v()}else e.key===`Escape`&&v()},onBlur:e=>{let n=e.target.value.trim();n?_(t,n):v()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,U.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{onSelect:()=>b(t),children:`Open`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>S(be(t.path)),children:`New File...`}),(0,U.jsx)(L,{onSelect:()=>w(be(t.path)),children:`New Folder...`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>x(t),children:`Copy Reference`}),(0,U.jsx)(L,{onSelect:()=>m(t),children:`Rename...`}),(0,U.jsx)(L,{onSelect:()=>y(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),Se=new Map;function Ce({threadId:e,selectedPath:n,onNodeSelect:r}){let[i,a]=(0,H.useState)(()=>new Map([[``,0]])),[s,u]=(0,H.useState)(new Set),[d,p]=(0,H.useState)(null),[m,g]=(0,H.useState)(null),[S,C]=(0,H.useState)(null),[k,ee]=(0,H.useState)(!1),[te,N]=(0,H.useState)([]),[ne,F]=(0,H.useState)(!1),[B,V]=(0,H.useState)(!1),W=(0,H.useRef)(null),G=(0,H.useRef)(0),K=(0,H.useRef)(null),{explorerRefreshTick:q,pendingExplorerPath:J,setExplorerClearPath:ce,triggerExplorerRefresh:le}=M(),{fetchUnifiedStatus:Y}=j(),X=(0,H.useMemo)(()=>`${e}:${q}`,[q,e]),ue=(0,H.useCallback)(e=>{(0,H.startTransition)(()=>{ee(t=>t===e?t:e)})},[]),Z=(0,H.useCallback)(async()=>{if(!e)return;let t=Se.get(X);if(t){N(t),F(!0);return}if(W.current!==X){W.current=X,N([]),F(!1);try{let t=ye((await ie(e,``,!0)).entries);Se.set(X,t),N(t),F(!0)}catch{N([]),F(!1)}finally{W.current===X&&(W.current=null)}}},[X,e]),de=(0,H.useCallback)(()=>{V(!0)},[]),fe=(0,H.useCallback)(()=>{Se.delete(X),N([]),F(!1)},[X]),pe=(0,H.useCallback)(()=>{fe(),B&&Z()},[fe,Z,B]),Q=(0,H.useCallback)(e=>i.get(e)??0,[i]),_e=(0,H.useCallback)(e=>{a(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,H.useCallback)(t=>{e&&(D(he(e,t,Q(t))),_e(t))},[_e,Q,e]),Ce=(0,H.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);u(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,H.useEffect)(()=>{if(!e)return;let t=K.current!==null&&K.current!==e;K.current=e,t&&(a(new Map([[``,0]])),u(new Set),p(null),g(null),G.current=q)},[q,e]),(0,H.useEffect)(()=>{!e||q<=G.current||(G.current=q,a(t=>{let n=new Set([``]);for(let e of s)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;D(he(e,i,n)),r.set(i,n+1)}return r}))},[q,s,e]),(0,H.useEffect)(()=>{N([]),F(!1),V(!1),W.current=null},[X]),(0,H.useEffect)(()=>{!B||!e||Z()},[Z,B,e]),(0,H.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){u(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[J,e]);function we(e){s.has(e.path)?u(t=>{let n=new Set(t);return n.delete(e.path),n}):(u(t=>new Set(t).add(e.path)),a(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function Te(e){C(e)}async function Ee(t){try{await oe(e,t.path)}catch{A({title:`Error`,description:`Failed to open "${t.name}"`,variant:`destructive`})}}async function De(e){try{await navigator.clipboard.writeText(e.path);let t=A({title:`Copied`,description:`Reference copied to clipboard.`});window.setTimeout(()=>{t.dismiss()},2e3)}catch{A({title:`Error`,description:`Failed to copy reference for "${e.name}"`,variant:`destructive`})}}async function Oe(){if(!S)return;let t=S;C(null);try{await ae(e,t.path),ce(t.path),$(be(t.path)),pe(),Y(!0),u(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{A({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function ke(e){g(null),p(e.path)}async function Ae(t,n){if(n===t.name){p(null);return}p(null);try{await z(e,t.path,n),$(be(t.path)),pe(),Y(!0),t.type===`folder`&&(u(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{A({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function je(e){p(null),s.has(e)||(u(t=>new Set(t).add(e)),a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),g({dirPath:e,type:`file`})}function Me(e){p(null),s.has(e)||(u(t=>new Set(t).add(e)),a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),g({dirPath:e,type:`folder`})}async function Ne(t){if(!m)return;let{dirPath:n,type:r}=m;g(null);try{r===`file`?await se(e,n,t):await re(e,n,t),$(n),pe(),Y(!0)}catch{A({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Pe(){g(null)}function Fe(e){Ce(e),e.type===`file`&&r(e)}let Ie=m?.dirPath===``?(0,U.jsx)(ve,{defaultValue:``,level:0,basePadding:m.type===`folder`?10:22,icon:m.type===`folder`?(0,U.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(h,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:Ne,onCancel:Pe}):null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(x,{open:S!==null,onOpenChange:e=>!e&&C(null),children:(0,U.jsxs)(w,{children:[(0,U.jsx)(y,{children:`Move to Trash`}),(0,U.jsxs)(b,{children:[`Move “`,S?.name,`” to trash?`]}),(0,U.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,U.jsx)(v,{children:`Cancel`}),(0,U.jsx)(T,{onClick:()=>void Oe(),children:`Move to Trash`})]})]})}),(0,U.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(me,{items:te,isReady:ne,onRequestIndex:de,onOpenChange:ue,onSelect:e=>Fe(e)},X)}),(0,U.jsxs)(o,{children:[(0,U.jsx)(t,{asChild:!0,children:(0,U.jsx)(c,{variant:`ghost`,size:`icon-sm`,onClick:le,"aria-label":`Refresh file listing`,children:(0,U.jsx)(_,{className:`h-4 w-4`})})}),(0,U.jsx)(l,{children:`Refresh`})]})]})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{asChild:!0,disabled:k,children:(0,U.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,U.jsx)(E,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(O,{}),children:(0,U.jsx)(ge,{threadId:e,dirPath:``,version:Q(``),children:t=>(0,U.jsxs)(U.Fragment,{children:[Ie,t.map(t=>(0,U.jsx)(xe,{node:t,level:0,threadId:e,selectedPath:n,expandedPaths:s,getDirVersion:Q,renamingPath:d,newItemIn:m,onToggleFolder:we,onSelectNode:r,onStartRename:ke,onCommitRename:Ae,onCancelRename:()=>p(null),onDelete:Te,onOpen:Ee,onCopyReference:De,onNewFile:je,onNewFolder:Me,onCommitNewItem:Ne,onCancelNewItem:Pe},t.path))]})})})})})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{onSelect:()=>je(``),children:`New File...`}),(0,U.jsx)(L,{onSelect:()=>Me(``),children:`New Folder...`})]})]})]})}export{Ce as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,Fs as n,Ii as r,Io as i,Is as a,Ko as o,Pi as s,Rs as c,Sa as l,To as u,ao as d,at as ee,ba as f,fs as p,ka as te,mo as m,ns as ne,oo as h,rr as re,rs as g}from"./dialogs-config-86QTDk4G.js";import{M as ie}from"./react-vendor-DK2COBjg.js";import{I as _,a as v,l as y,n as b,o as x}from"./history-view-BsN806ip.js";import{n as ae}from"./utils-DPYK-CSn.js";import{A as oe,B as S,D as C,E as w,P as T,R as se,T as ce,W as le,d as ue}from"./index-C2iIghSR.js";import{a as E,c as de,i as D,o as O,s as fe,t as pe,u as me}from"./api-BUjKoVUu.js";var k=a(),A=n(),j=e(c(),1),M=_(e=>(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[e.v0,(0,A.jsx)(`p`,{className:e.v1,children:`Select a thread to browse its files`})]}),{name:`ExplorerView_1`,portals:[`v0`]}),N=_(e=>(0,A.jsxs)(`div`,{className:`explorer-view-root flex flex-col h-full print:block print:h-auto`,children:[e.v0,(0,A.jsx)(`div`,{className:`flex-1 overflow-hidden print:overflow-visible print:flex-none`,children:(0,A.jsx)(`div`,{className:`h-full relative overflow-hidden print:h-auto print:overflow-visible`,children:e.v1})}),e.v2]}),{name:`ExplorerView_2`,portals:[`v0`,`v1`,`v2`]}),P=function({selectedFile:e,showTreeBackButton:n=!1,onShowTree:a,onFileCreated:o}){let{resolvedTheme:c}=ae(),d=le(e=>e.selectedThreadId),{triggerExplorerRefresh:m}=T(),g=(0,j.useRef)(null),_=(0,j.useRef)(null),v=(0,j.useRef)(!1),[E,D]=(0,j.useState)(null),[O,k]=(0,j.useState)(!1),[P,F]=(0,j.useState)(!1),[U,W]=(0,j.useState)(`edit`),[ve,ye]=(0,j.useState)(0),[G,be]=(0,j.useState)(null),[K,q]=(0,j.useState)(!1),xe=e?.path??null;(0,j.useEffect)(()=>{d&&ee(d).then(be).catch(()=>{})},[d]);let Se=async()=>{if(!(!G||K)){q(!0);try{await navigator.clipboard.writeText(G),S({title:`Copied`,description:`Repository folder path copied to clipboard.`})}catch(e){V(`Failed to copy explorer folder path`,{threadId:d,folderPath:G},e),S({title:`Error`,description:`Failed to copy path to clipboard.`,variant:`destructive`})}finally{q(!1)}}},Ce=async()=>{if(d)try{await fe(d,`.`)}catch(e){V(`Failed to open explorer repository folder`,{threadId:d,folderPath:G},e),S({title:`Error`,description:`Failed to open repository folder.`,variant:`destructive`})}},we=(0,j.useCallback)(async e=>{if(d)try{let t=await L(d,e);await pe(d,``,t);let n={name:t,path:t,type:`file`};_.current=t,v.current=!0,o?.(n),m(),S({title:`Created`,description:`${t} created successfully.`})}catch(t){V(`Failed to create explorer file`,{threadId:d,extension:e},t),S({title:`Error`,description:`Failed to create file.`,variant:`destructive`})}},[d,o,m]),J=e?ne(e.path,e.name):null,Y=e?.type===`file`&&d&&!J?e:null,X=Y?`${d}:${Y.path}:${ve}`:null,Z=E&&E.key===X?E:null,Q=Z?.content??``,Te=Z?.original??``;(0,j.useEffect)(()=>()=>{g.current&&=(g.current.getModel()?.dispose(),g.current.dispose(),null)},[]),(0,j.useEffect)(()=>{e?.type===`file`?_.current===e.path?(_.current=null,W(`edit`)):W(R(e.path)?`view`:`edit`):W(`edit`)},[xe,d]);async function $(){if(!(!d||!e||!X)){k(!0);try{await me(d,e.path,Q),D({key:X,content:Q,original:Q}),S({title:`Saved`,description:`${e.name} saved successfully.`})}catch(t){V(`Failed to save explorer file`,{threadId:d,path:e.path},t),S({title:`Error`,description:t instanceof Error?t.message:`Failed to save file`,variant:`destructive`})}finally{k(!1)}}}async function Ee(){if(!(!d||!e||P)){F(!0);try{if(!re()){if(typeof window>`u`)return;let t=document.querySelector(`[data-markdown-print-content]`);if(!(t instanceof HTMLElement)){S({title:`Print unavailable`,description:`Couldn't find the markdown preview to print.`,variant:`destructive`});return}let n=`<!doctype html>
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
@@ -72,4 +72,4 @@ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,Ii as n,Io as
|
|
|
72
72
|
}, { once: true });
|
|
73
73
|
<\/script>
|
|
74
74
|
</body>
|
|
75
|
-
</html>`,r=window.open(``,`_blank`,`noopener,noreferrer`);if(!r){S({title:`Print blocked`,description:`Allow pop-ups to print this file.`,variant:`destructive`});return}r.document.open(),r.document.write(n),r.document.close();return}S({title:`PDF created`,description:`Opened ${(await de(d,e.path)).outputPath.split(/[\\/]/).pop()??`the PDF`} in your default app.`})}catch(t){V(`Failed to print markdown file as PDF`,{threadId:d,path:e.path},t),S({title:`PDF export failed`,description:t instanceof Error?t.message:`Failed to convert this markdown file to PDF.`,variant:`destructive`})}finally{F(!1)}}}function De(){!d||!Y||(x(B(d,Y.path)),ye(e=>e+1))}return d?(0,A.jsx)(N,{v0:(0,A.jsxs)(ue,{className:`justify-between print:hidden`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[
|
|
75
|
+
</html>`,r=window.open(``,`_blank`,`noopener,noreferrer`);if(!r){S({title:`Print blocked`,description:`Allow pop-ups to print this file.`,variant:`destructive`});return}r.document.open(),r.document.write(n),r.document.close();return}S({title:`PDF created`,description:`Opened ${(await de(d,e.path)).outputPath.split(/[\\/]/).pop()??`the PDF`} in your default app.`})}catch(t){V(`Failed to print markdown file as PDF`,{threadId:d,path:e.path},t),S({title:`PDF export failed`,description:t instanceof Error?t.message:`Failed to convert this markdown file to PDF.`,variant:`destructive`})}finally{F(!1)}}}function De(){!d||!Y||(x(B(d,Y.path)),ye(e=>e+1))}return d?(0,A.jsx)(N,{v0:(0,A.jsxs)(ue,{className:`justify-between print:hidden`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[n&&a?(0,A.jsxs)(s,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:a,children:[(0,A.jsx)(te,{className:`h-4 w-4`}),(0,A.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,A.jsx)(`span`,{className:r(p.label,`truncate text-foreground`),children:e?e.name:`Select a file to edit`}),(0,A.jsx)(`span`,{className:r(p.compact,`truncate text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]})]}),(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[Y&&Z?(0,A.jsxs)(A.Fragment,{children:[R(Y.path)?(0,A.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,A.jsx)(s,{size:`sm`,variant:U===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>W(`view`),children:`View`}),(0,A.jsx)(s,{size:`sm`,variant:U===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>W(`edit`),children:`Edit`})]}):null,R(Y.path)&&U===`view`?(0,A.jsxs)(s,{size:`sm`,variant:`outline`,onClick:()=>void Ee(),disabled:P,children:[P?(0,A.jsx)(t,{className:`h-4 w-4 animate-spin`}):(0,A.jsx)(f,{className:`h-4 w-4`}),P?`Printing…`:`Print`]}):null,(0,A.jsxs)(s,{size:`sm`,onClick:()=>void $(),disabled:O||!Q||Q===Te,children:[O?(0,A.jsx)(t,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null,e?null:(0,A.jsxs)(ce,{children:[(0,A.jsx)(oe,{asChild:!0,children:(0,A.jsxs)(s,{size:`sm`,className:`gap-1.5`,children:[(0,A.jsx)(l,{className:`h-3.5 w-3.5`}),`New file`]})}),(0,A.jsx)(w,{align:`end`,children:I.map(({label:e,ext:t,icon:n})=>(0,A.jsxs)(C,{onSelect:()=>void we(t),children:[(0,A.jsx)(n,{className:`h-4 w-4`}),e]},t))})]})]})]}),v1:Y?(0,A.jsxs)(b,{fallbackTitle:`Failed to load file`,onRetry:De,children:[(0,A.jsx)(j.Suspense,{fallback:(0,A.jsx)(y,{}),children:(0,A.jsx)(he,{threadId:d,path:Y.path,contentKey:X??``,onContentReady:D},X??void 0)}),Z?R(Y.path)&&U===`view`?(0,A.jsx)(`div`,{className:`h-full overflow-auto p-6 print:h-auto print:overflow-visible print:p-0`,children:(0,A.jsx)(`div`,{className:`mx-auto max-w-4xl print:max-w-none`,"data-markdown-print-content":!0,children:(0,A.jsx)(se,{content:Q,enableMermaid:!0})})}):(0,A.jsx)(ie,{height:`100%`,language:z(Y.path),value:Q,onChange:e=>D(t=>t&&{...t,content:e??``}),onMount:e=>{g.current=e,v.current&&(v.current=!1,e.focus())},theme:c===`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,A.jsx)(y,{})]},X??void 0):e?.type===`file`&&J===`image`?(0,A.jsx)(b,{fallbackTitle:`Failed to load image`,onRetry:()=>{!d||!e||x(H(d,e.path))},children:(0,A.jsx)(j.Suspense,{fallback:(0,A.jsx)(y,{}),children:(0,A.jsx)(ge,{threadId:d,path:e.path,alt:e.name})})},e.path):e?.type===`file`&&J===`video`?(0,A.jsx)(b,{fallbackTitle:`Failed to load video`,onRetry:()=>{!d||!e||x(H(d,e.path))},children:(0,A.jsx)(j.Suspense,{fallback:(0,A.jsx)(y,{}),children:(0,A.jsx)(_e,{threadId:d,path:e.path})})},e.path):(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,A.jsx)(`h2`,{className:r(p.pageTitle,`text-foreground`),children:`File Explorer`}),(0,A.jsx)(`p`,{className:r(p.pageSubtitle),children:`Browse and edit files`})]}),v2:e?null:(0,A.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 py-2`,children:G?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>void Ce(),className:r(p.compact,`min-w-0 flex-1 truncate text-left font-mono text-muted-foreground hover:text-foreground hover:underline`),title:G,children:G}),(0,A.jsxs)(s,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:()=>void Se(),disabled:K,children:[K?(0,A.jsx)(i,{className:`h-3.5 w-3.5`}):(0,A.jsx)(u,{className:`h-3.5 w-3.5`}),(0,A.jsx)(`span`,{className:`sr-only`,children:`Copy path`})]})]}):(0,A.jsx)(`p`,{className:r(p.compact,`text-muted-foreground/50 italic`),children:`Loading path...`})})}):(0,A.jsx)(M,{v0:(0,A.jsx)(h,{className:`h-8 w-8 text-muted-foreground`}),v1:p.bodyMuted})},F=o(`explorer.preview`),I=[{label:`Markdown`,ext:`md`,icon:h},{label:`TypeScript`,ext:`ts`,icon:m},{label:`Text`,ext:`txt`,icon:d}];async function L(e,t){try{let n=await O(e,``),r=new Set(n.entries.map(e=>e.name)),i=`untitled`,a=`${i}.${t}`,o=2;for(;r.has(a);)a=`${i}${o}.${t}`,o++;return a}catch{return`untitled.${t}`}}function R(e){return g(e)===`md`}function z(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`}[g(e)]??`plaintext`}function B(e,t){return`explorer-file:${e}:${t}`}function he(e){let t=(0,k.c)(11),{threadId:n,path:r,contentKey:i,onContentReady:a}=e,o;t[0]!==r||t[1]!==n?(o=B(n,r),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s;t[3]!==r||t[4]!==n?(s=async()=>{try{return await E(n,r)}catch(e){let t=e;throw V(`Failed to load explorer file preview`,{threadId:n,path:r},t),t}},t[3]=r,t[4]=n,t[5]=s):s=t[5];let c=v(o,s),l,u;return t[6]!==i||t[7]!==a||t[8]!==c.content?(l=()=>{a({key:i,content:c.content,original:c.content})},u=[a,c.content,i],t[6]=i,t[7]=a,t[8]=c.content,t[9]=l,t[10]=u):(l=t[9],u=t[10]),(0,j.useLayoutEffect)(l,u),null}function V(e,t,n){F.error(e,{...t,error:n})}function H(e,t){return`explorer-media:${e}:${t}`}function U(e,t){let n=(0,k.c)(11),r;n[0]!==t||n[1]!==e?(r=H(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=async()=>{try{return await D(e,t)}catch(n){let r=n;throw V(`Failed to load explorer media preview`,{threadId:e,path:t},r),r}},n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=v(r,i),o;n[6]===a?o=n[7]:(o=URL.createObjectURL(a),n[6]=a,n[7]=o);let s=o,c,l;return n[8]===s?(c=n[9],l=n[10]):(c=()=>()=>{URL.revokeObjectURL(s)},l=[s],n[8]=s,n[9]=c,n[10]=l),(0,j.useEffect)(c,l),s}function ge(e){let t=(0,k.c)(3),{threadId:n,path:r,alt:i}=e,a=U(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,A.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,A.jsx)(`img`,{src:a,alt:i,className:`max-w-full max-h-full object-contain`})}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function _e(e){let t=(0,k.c)(2),{threadId:n,path:r}=e,i=U(n,r),a;return t[0]===i?a=t[1]:(a=(0,A.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,A.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}export{P as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ba as e,Fs as t,Ii as n,Is as r,Pi as i,Qr as a,ei as o,fs as s,ii as c,ni as l,ri as u,ti as d}from"./dialogs-config-86QTDk4G.js";var f=r(),p=t();function m(t){let r=(0,f.c)(28),{open:m,onOpenChange:g,commits:_,displayedCommits:v,isLoadingMore:y,onScroll:b,currentBranch:x}=t,S;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,p.jsx)(c,{children:`Commit History`}),r[0]=S):S=r[0];let C;r[1]===x?C=r[2]:(C=(0,p.jsxs)(u,{children:[S,(0,p.jsxs)(d,{children:[`Recent commits on branch `,x]})]}),r[1]=x,r[2]=C);let w;r[3]===v?w=r[4]:(w=v.length>0?v.map(h):(0,p.jsx)(`p`,{className:n(s.bodyMuted,`text-center py-8`),children:`No commits found`}),r[3]=v,r[4]=w);let T;r[5]===y?T=r[6]:(T=y&&(0,p.jsx)(`div`,{className:`p-3 text-center`,children:(0,p.jsx)(e,{className:`h-4 w-4 animate-spin inline`})}),r[5]=y,r[6]=T);let E;r[7]!==_.length||r[8]!==v.length||r[9]!==y?(E=v.length<_.length&&!y&&(0,p.jsx)(`div`,{className:n(s.caption,`p-3 text-center`),children:`Scroll to load more`}),r[7]=_.length,r[8]=v.length,r[9]=y,r[10]=E):E=r[10];let D;r[11]!==w||r[12]!==T||r[13]!==E?(D=(0,p.jsxs)(`div`,{className:`divide-y`,children:[w,T,E]}),r[11]=w,r[12]=T,r[13]=E,r[14]=D):D=r[14];let O;r[15]!==b||r[16]!==D?(O=(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto border rounded-lg`,onScroll:b,children:D}),r[15]=b,r[16]=D,r[17]=O):O=r[17];let k;r[18]===g?k=r[19]:(k=(0,p.jsx)(l,{children:(0,p.jsx)(i,{onClick:()=>g(!1),children:`Close`})}),r[18]=g,r[19]=k);let A;r[20]!==C||r[21]!==O||r[22]!==k?(A=(0,p.jsxs)(o,{className:`max-w-2xl max-h-[80vh] flex flex-col`,children:[C,O,k]}),r[20]=C,r[21]=O,r[22]=k,r[23]=A):A=r[23];let j;return r[24]!==g||r[25]!==m||r[26]!==A?(j=(0,p.jsx)(a,{open:m,onOpenChange:g,children:A}),r[24]=g,r[25]=m,r[26]=A,r[27]=j):j=r[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(s.label,`break-words`),children:e.message}),(0,p.jsxs)(`p`,{className:n(s.bodyMuted,`mt-1`),children:[(0,p.jsx)(`span`,{className:s.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-DRMKciNP.js","assets/index-C2iIghSR.js","assets/rolldown-runtime-aKtaBQYM.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-BsN806ip.js","assets/dialogs-config-86QTDk4G.js","assets/onboarding-DCrFdRM5.js","assets/vosk-speech-Ce0kC8Ck.js","assets/react-vendor-DK2COBjg.js","assets/utils-DPYK-CSn.js","assets/index-DhnUeGIU.css","assets/pull-request-dialog-CPjzwrdo.js","assets/create-repo-dialog-CXiWjkFb.js","assets/git-history-dialog-DfzFi0Nx.js","assets/push-before-pr-dialog-v-3J53Hw.js","assets/pull-with-changes-dialog-DLfDpEEX.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$t as t,Ba as n,Br as r,C as i,Ds as a,Dt as o,Fo as ee,Fs as s,Gi as te,Ii as ne,Is as c,Ka as l,Kn as u,Ko as d,Kt as re,Lr as f,Pi as ie,Rr as ae,Rs as p,Uo as m,Vo as oe,Wt as h,Xa as se,Xi as g,Xt as ce,Y as _,Yt as le,Za as ue,bo as v,ct as de,dt as fe,fs as y,mt as pe,on as b,q as x,qt as S,rn as me,va as he,xo as ge,zr as _e}from"./dialogs-config-86QTDk4G.js";import{r as C}from"./monaco-CZnIWXyV.js";import{A as ve,B as w,D as T,E as ye,I as be,K as E,O as xe,T as Se,U as Ce,W as we,k as Te,v as Ee,y as De}from"./index-C2iIghSR.js";var D=e(p(),1),O=s();function k(e){return!e.hasChanges&&e.defaultBranchBehind>0}function A(e){return e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits}function j(e){return e.hasUnpushedCommits&&e.prExists}function Oe(e,t){return t?`Creating PR...`:e.hasChanges?`Commit`:j(e)?`Update PR`:A(e)?`Open PR`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create PR`:k(e)?`Sync`:`Commit`}function ke(e,t,n=!1){return t||n||e.hasChanges||j(e)||A(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges||!e.hasChanges&&!e.hasUnpushedCommits&&!k(e)?null:k(e)?(0,O.jsx)(m,{className:`h-3.5 w-3.5`}):(0,O.jsx)(ue,{className:`h-3.5 w-3.5`})}function Ae(e){if(e.hasChanges)return e.changedFilesCount>0?`Commit ${e.changedFilesCount} changed file${e.changedFilesCount===1?``:`s`}`:`No changes to commit`;if(j(e))return`Update pull request with unpushed commits`;if(A(e))return`View pull request in GitHub`;if(e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges)return`Create pull request for committed changes`;if(k(e)){let t=e.defaultBranch??`main`,n=`${e.defaultBranchBehind} commit${e.defaultBranchBehind===1?``:`s`} behind origin/${t}`,r=e.defaultBranchAhead>0?`, ${e.defaultBranchAhead} commit${e.defaultBranchAhead===1?``:`s`} ahead`:``;return e.currentBranch===e.defaultBranch?`Your branch is ${n}${r}. Click to pull the latest changes.`:`Your branch "${e.currentBranch}" is ${n}${r}. Click to rebase onto the latest ${t}.`}return`No actions available`}function je(e,t,n=!1){return t||n?!0:A(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges||k(e)?!1:!e.hasChanges&&!e.hasUnpushedCommits}function Me(e){return e.hasChanges||A(e)||j(e)||k(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}var Ne=c();function Pe(e){let t=(0,Ne.c)(108),{branchStatus:i,remoteUrl:a,hasRemoteBranch:o,hasUnpushedCommits:s,canCreateRepo:c,repoUrl:u,isRefreshing:d,isCreatingPR:re,isBrandState:p,hasChanges:h,commitsAheadOfDefault:ce,prExists:_,defaultBranch:le,defaultBranchAhead:de,defaultBranchBehind:fe,gitUser:pe,isDirectCommitMode:b,autoGenerateCommitMessage:x,isLoading:S,isLoadingHistory:me,isQuickCommitting:C,onFetch:w,onPull:be,onPush:E,onOpenHistory:Ce,onCreatePR:we,onCreateRepo:Ee,onViewInGitHub:De,onQuickCommit:D,onSyncWithDefault:k,onOpenChange:A,open:j,layout:Oe}=e,ke=re===void 0?!1:re,Ae=Oe===void 0?`bar`:Oe,je=!!le&&!!a&&fe>0,Me=!h&&!S,Pe=Ae===`bar`&&`w-8 rounded-l-none`,M=Ae===`menu`&&`w-full justify-start gap-2 rounded-md`,Fe=p&&Ae===`bar`&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`,N;t[0]!==Pe||t[1]!==M||t[2]!==Fe?(N=ne(`h-8 px-1`,Pe,M,Fe),t[0]=Pe,t[1]=M,t[2]=Fe,t[3]=N):N=t[3];let Ie=S||ke,Le;t[4]===Ae?Le=t[5]:(Le=Ae===`menu`&&(0,O.jsx)(`span`,{children:`More git actions`}),t[4]=Ae,t[5]=Le);let Re;t[6]!==ke||t[7]!==d?(Re=ke||d?(0,O.jsx)(n,{className:`h-3.5 w-3.5 animate-spin`}):(0,O.jsx)(ee,{className:`h-3.5 w-3.5`}),t[6]=ke,t[7]=d,t[8]=Re):Re=t[8];let ze;t[9]!==N||t[10]!==Ie||t[11]!==Le||t[12]!==Re?(ze=(0,O.jsx)(ve,{asChild:!0,children:(0,O.jsxs)(ie,{variant:`outline`,size:`sm`,className:N,disabled:Ie,children:[Le,Re]})}),t[9]=N,t[10]=Ie,t[11]=Le,t[12]=Re,t[13]=ze):ze=t[13];let Be;t[14]!==i||t[15]!==a?(Be=i===`Behind`&&(0,O.jsxs)(`div`,{className:ne(y.compact,`px-2 py-1 text-amber-600`),children:[`Branch is behind `,a?`origin`:`remote`]}),t[14]=i,t[15]=a,t[16]=Be):Be=t[16];let Ve;t[17]===pe?Ve=t[18]:(Ve=pe&&(0,O.jsxs)(`div`,{className:ne(y.compact,`px-2 py-1 text-muted-foreground`),children:[(0,O.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,pe]}),t[17]=pe,t[18]=Ve);let He;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,O.jsx)(xe,{}),t[19]=He):He=t[19];let P;t[20]!==Me||t[21]!==le||t[22]!==de||t[23]!==fe||t[24]!==h||t[25]!==k||t[26]!==je?(P=je&&(0,O.jsx)(_e,{children:(0,O.jsxs)(f,{children:[(0,O.jsx)(r,{asChild:!0,children:(0,O.jsxs)(T,{onClick:()=>{Me&&k()},className:Me?``:`opacity-50 cursor-not-allowed`,children:[(0,O.jsx)(he,{className:`h-3.5 w-3.5 mr-2`}),`Sync with `,le,(0,O.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 pl-3 text-xs tabular-nums text-muted-foreground`,children:[de>0&&(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,O.jsx)(oe,{className:`h-3 w-3`}),de]}),fe>0&&(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,O.jsx)(m,{className:`h-3 w-3`}),fe]})]})]})}),(0,O.jsx)(ae,{side:`right`,children:h?`Commit or stash changes before syncing with the default branch`:`Pull latest changes from origin/${le} onto your current branch`})]})}),t[20]=Me,t[21]=le,t[22]=de,t[23]=fe,t[24]=h,t[25]=k,t[26]=je,t[27]=P):P=t[27];let F;t[28]!==x||t[29]!==h||t[30]!==S||t[31]!==C||t[32]!==D?(F=h&&x&&(0,O.jsx)(_e,{children:(0,O.jsxs)(f,{children:[(0,O.jsx)(r,{asChild:!0,children:(0,O.jsxs)(T,{onClick:D,disabled:S||C,children:[C?(0,O.jsx)(n,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,O.jsx)(te,{className:`h-3.5 w-3.5 mr-2`}),`Quick Commit`,(0,O.jsx)(Te,{children:`⌘⇧C`})]})}),(0,O.jsx)(ae,{side:`right`,children:`Generate the commit message and commit`})]})}),t[28]=x,t[29]=h,t[30]=S,t[31]=C,t[32]=D,t[33]=F):F=t[33];let Ue;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,O.jsx)(ge,{className:`h-3.5 w-3.5 mr-2`}),t[34]=Ue):Ue=t[34];let I;t[35]!==S||t[36]!==w?(I=(0,O.jsx)(r,{asChild:!0,children:(0,O.jsxs)(T,{onClick:w,disabled:S,children:[Ue,`Fetch`]})}),t[35]=S,t[36]=w,t[37]=I):I=t[37];let We;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,O.jsx)(ae,{side:`right`,children:`Download latest information from remote without merging changes`}),t[38]=We):We=t[38];let L;t[39]===I?L=t[40]:(L=(0,O.jsx)(_e,{children:(0,O.jsxs)(f,{children:[I,We]})}),t[39]=I,t[40]=L);let R;t[41]!==o||t[42]!==S||t[43]!==be?(R=()=>{o&&!S&&be()},t[41]=o,t[42]=S,t[43]=be,t[44]=R):R=t[44];let z=!o||S?`opacity-50 cursor-not-allowed`:``,B;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,O.jsx)(m,{className:`h-3.5 w-3.5 mr-2`}),t[45]=B):B=t[45];let V;t[46]!==R||t[47]!==z?(V=(0,O.jsx)(r,{asChild:!0,children:(0,O.jsxs)(T,{onClick:R,className:z,children:[B,`Pull`]})}),t[46]=R,t[47]=z,t[48]=V):V=t[48];let Ge=o?`Pull latest changes from remote`:`No remote branch to pull from`,H;t[49]===Ge?H=t[50]:(H=(0,O.jsx)(ae,{side:`right`,children:Ge}),t[49]=Ge,t[50]=H);let U;t[51]!==V||t[52]!==H?(U=(0,O.jsx)(_e,{children:(0,O.jsxs)(f,{children:[V,H]})}),t[51]=V,t[52]=H,t[53]=U):U=t[53];let Ke;t[54]!==o||t[55]!==S||t[56]!==E?(Ke=!o&&(0,O.jsx)(_e,{children:(0,O.jsxs)(f,{children:[(0,O.jsx)(r,{asChild:!0,children:(0,O.jsxs)(T,{onClick:E,disabled:S,children:[(0,O.jsx)(g,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,O.jsx)(ae,{side:`right`,children:`Create remote branch and push local commits`})]})}),t[54]=o,t[55]=S,t[56]=E,t[57]=Ke):Ke=t[57];let qe;t[58]!==s||t[59]!==S||t[60]!==E?(qe=()=>{s&&!S&&E()},t[58]=s,t[59]=S,t[60]=E,t[61]=qe):qe=t[61];let Je=!s||S?`opacity-50 cursor-not-allowed`:``,Ye;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,O.jsx)(g,{className:`h-3.5 w-3.5 mr-2`}),t[62]=Ye):Ye=t[62];let W;t[63]!==qe||t[64]!==Je?(W=(0,O.jsx)(r,{asChild:!0,children:(0,O.jsxs)(T,{onClick:qe,className:Je,children:[Ye,`Push Commits`]})}),t[63]=qe,t[64]=Je,t[65]=W):W=t[65];let G=s?S?`Push in progress...`:`Push your uncommitted commits to the remote branch`:`No commits to push - your branch is up to date with remote`,Xe;t[66]===G?Xe=t[67]:(Xe=(0,O.jsx)(ae,{side:`right`,children:G}),t[66]=G,t[67]=Xe);let K;t[68]!==W||t[69]!==Xe?(K=(0,O.jsx)(_e,{children:(0,O.jsxs)(f,{children:[W,Xe]})}),t[68]=W,t[69]=Xe,t[70]=K):K=t[70];let Ze=S||me,Qe;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,O.jsx)(l,{className:`h-3.5 w-3.5 mr-2`}),t[71]=Qe):Qe=t[71];let q;t[72]!==Ce||t[73]!==Ze?(q=(0,O.jsxs)(T,{onClick:Ce,disabled:Ze,children:[Qe,`History`]}),t[72]=Ce,t[73]=Ze,t[74]=q):q=t[74];let J;t[75]!==ce||t[76]!==h||t[77]!==b||t[78]!==S||t[79]!==we||t[80]!==_?(J=!b&&ce&&!_&&!h&&(0,O.jsxs)(T,{onClick:we,disabled:S,children:[(0,O.jsx)(ue,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`,(0,O.jsx)(Te,{children:`⌘⇧P`})]}),t[75]=ce,t[76]=h,t[77]=b,t[78]=S,t[79]=we,t[80]=_,t[81]=J):J=t[81];let Y;t[82]!==c||t[83]!==S||t[84]!==Ee?(Y=c&&(0,O.jsxs)(T,{onClick:Ee,disabled:S,children:[(0,O.jsx)(se,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),t[82]=c,t[83]=S,t[84]=Ee,t[85]=Y):Y=t[85];let X;t[86]!==S||t[87]!==De||t[88]!==u?(X=u&&(0,O.jsxs)(T,{onClick:De,disabled:S,children:[(0,O.jsx)(v,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`,(0,O.jsx)(Te,{children:`⌘⇧G`})]}),t[86]=S,t[87]=De,t[88]=u,t[89]=X):X=t[89];let Z;t[90]!==Be||t[91]!==Ve||t[92]!==P||t[93]!==F||t[94]!==L||t[95]!==U||t[96]!==Ke||t[97]!==K||t[98]!==q||t[99]!==J||t[100]!==Y||t[101]!==X?(Z=(0,O.jsxs)(ye,{align:`end`,children:[Be,Ve,He,P,F,L,U,Ke,K,q,J,Y,X]}),t[90]=Be,t[91]=Ve,t[92]=P,t[93]=F,t[94]=L,t[95]=U,t[96]=Ke,t[97]=K,t[98]=q,t[99]=J,t[100]=Y,t[101]=X,t[102]=Z):Z=t[102];let $e;return t[103]!==A||t[104]!==j||t[105]!==ze||t[106]!==Z?($e=(0,O.jsxs)(Se,{open:j,onOpenChange:A,children:[ze,Z]}),t[103]=A,t[104]=j,t[105]=ze,t[106]=Z,t[107]=$e):$e=t[107],$e}function M(e){return e?!0:(w({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}function Fe(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}var N=d(`app.use-ai-generation.hook`);function Ie(e,t,n){let[r,i]=(0,D.useState)(!1),[a,o]=(0,D.useState)(!1),ee=()=>n?.id?n.provider?{provider:n.provider,model:n.id}:Fe(n.id):{provider:void 0,model:void 0};return{isGeneratingMessage:r,isGeneratingPRInfo:a,generateCommitMessageWithAI:(0,D.useCallback)(async()=>{if(!e)return null;try{i(!0);let{provider:t,model:n}=ee();return await x(e,n,t)}catch(e){return N.error(`Failed to generate commit message:`,e),w({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{i(!1)}},[e,n]),generatePRInfoWithAI:(0,D.useCallback)(async()=>{if(!e)return null;try{o(!0);let{provider:t,model:n}=ee();return await _(e,n,t)}catch(e){return N.error(`Failed to generate PR info:`,e),w({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{o(!1)}},[e,n])}}var Le=(0,D.lazy)(()=>C(()=>import(`./commit-dialog-DRMKciNP.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),Re=(0,D.lazy)(()=>C(()=>import(`./pull-request-dialog-CPjzwrdo.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),ze=(0,D.lazy)(()=>C(()=>import(`./create-repo-dialog-CXiWjkFb.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11]))),Be=(0,D.lazy)(()=>C(()=>import(`./git-history-dialog-DfzFi0Nx.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([14,6,2]))),Ve=(0,D.lazy)(()=>C(()=>import(`./push-before-pr-dialog-v-3J53Hw.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([15,6,2]))),He=(0,D.lazy)(()=>C(()=>import(`./pull-with-changes-dialog-DLfDpEEX.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([16,5,2,6]))),P=d(`app.git-ops-button.ui`);function F(){return null}async function Ue(e,t,n,r){r&&(await u(e,{title:r}),n({type:E.UpdateThreadTitle,projectId:t,threadId:e,title:r}))}function I({projectId:e,threadId:n,layout:ee=`bar`}){let s=Ce(),te=we(e=>e.projectModelSelections[n]),c=we(t=>t.projects.find(t=>t.projectId===e)),[l,u]=(0,D.useState)(!1),[d,p]=(0,D.useState)(!1),[m,oe]=(0,D.useState)(!1),[se,g]=(0,D.useState)(!1),[_,ue]=(0,D.useState)(``),[v,y]=(0,D.useState)(``),[x,he]=(0,D.useState)(``),[ge,C]=(0,D.useState)(!1),[ve,T]=(0,D.useState)(null),ye=(0,D.useRef)(!1),xe=(0,D.useRef)(!1),Se=(0,D.useRef)(v),Te=(0,D.useRef)(x);Se.current=v,Te.current=x;let[k,A]=(0,D.useState)(!1),[j,Ne]=(0,D.useState)([]),[Fe,N]=(0,D.useState)(!1),[I,We]=(0,D.useState)([]),[L,R]=(0,D.useState)(!1),[z,B]=(0,D.useState)(!1),[V,Ge]=(0,D.useState)(``),[H,U]=(0,D.useState)(``),[Ke,qe]=(0,D.useState)(``),[Je,Ye]=(0,D.useState)(!1),[W,G]=(0,D.useState)(!1),[Xe,K]=(0,D.useState)(!1),[Ze,Qe]=(0,D.useState)(!1),q=(0,D.useRef)(!1),J=be(),{fetchUnifiedStatus:Y}=J,X=Ie(n,e,te),Z=(0,D.useRef)(null),$e=(0,D.useRef)(()=>{}),et=(0,D.useRef)(()=>{}),tt=(0,D.useRef)(()=>{}),nt=(0,D.useRef)(()=>{});(0,D.useEffect)(()=>()=>{Z.current!==null&&(clearInterval(Z.current),Z.current=null)},[]);async function Q(){me();let e=await o();s({type:E.SetProjects,projects:e.projects})}let[$,rt]=(0,D.useState)(()=>Ee()),it=c?.commitMethod===a.Direct;(0,D.useEffect)(()=>{z&&c?.name&&!V&&Ge(c.name)},[z,c?.name,V]),(0,D.useEffect)(()=>{De($)},[$]);function at(){Je||(Ye(!0),fe().then(e=>qe(e)).catch(()=>{}))}function ot(e){Qe(e),e&&(at(),Y(!0))}(0,D.useEffect)(()=>{if(!m){xe.current=!1;return}if(m&&$.autoGenerateCommitMessage&&!_.trim()&&n&&!xe.current){xe.current=!0;async function e(){let e=await X.generateCommitMessageWithAI();e&&ue(e)}e()}},[m,$.autoGenerateCommitMessage,n,X.generateCommitMessageWithAI,_]),(0,D.useEffect)(()=>{if(!se){ye.current=!1;return}if(se&&$.autoGeneratePRInfo&&!Se.current.trim()&&!Te.current.trim()&&n&&!ye.current){ye.current=!0;async function e(){let e=await X.generatePRInfoWithAI();e&&(y(e.title),he(e.description),w({title:`Success`,description:`PR title and description generated`}))}e()}},[se,$.autoGeneratePRInfo,n,X.generatePRInfoWithAI]),$e.current=dt,et.current=()=>g(!0),tt.current=Dt,nt.current=()=>{l||d||ot(!0)},(0,D.useEffect)(()=>{function e(e){let t=e.key.toLowerCase();if((e.metaKey||e.ctrlKey)&&e.shiftKey&&!e.altKey){if(t===`c`){J.hasChanges&&$.autoGenerateCommitMessage&&!l&&(e.preventDefault(),$e.current());return}if(t===`p`){J.commitsAheadOfDefault&&!J.prExists&&!J.hasChanges&&!l&&!it&&(e.preventDefault(),et.current());return}if(t===`g`){J.repoUrl&&!l&&(e.preventDefault(),tt.current());return}t===`b`&&!l&&!d&&(e.preventDefault(),nt.current())}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[J.commitsAheadOfDefault,J.hasChanges,J.prExists,J.repoUrl,$.autoGenerateCommitMessage,l,d,it]),(0,D.useEffect)(()=>{d&&J.prExists&&J.prState===`OPEN`&&p(!1)},[J.prExists,J.prState,d]),(0,D.useEffect)(()=>{if(!d)return;let e=setTimeout(()=>{p(!1)},15e3);return()=>clearTimeout(e)},[d]),(0,D.useEffect)(()=>{let e=J.prExists&&J.prState===`OPEN`&&!J.hasChanges&&!J.hasUnpushedCommits;e&&!q.current&&Q(),q.current=e},[J.hasChanges,J.hasUnpushedCommits,J.prExists,J.prState]);async function st(){if(_.trim()&&M(n))try{u(!0),await h(n,_),ue(``),oe(!1),await J.fetchUnifiedStatus(!0),Q(),w({title:`Changes committed successfully`,description:`Your changes have been committed to '${J.currentBranch}'.`}),Xe&&(K(!1),await ht())}catch(e){P.error(`Failed to commit:`,e),w({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{u(!1)}}async function ct(){if(!M(n))return;let e=J.prUrl;if(!e)try{e=(await pe(n)).url}catch(e){P.error(`Failed to fetch pull request URL:`,e),w({title:`Could not open pull request`,description:e instanceof Error?e.message:`Failed to fetch pull request URL`,variant:`destructive`});return}if(!e){w({title:`Could not open pull request`,description:`Pull request URL is unavailable. Try refreshing git status.`,variant:`destructive`});return}try{await b(e)}catch(e){P.error(`Failed to open pull request:`,e),w({title:`Could not open pull request`,description:e instanceof Error?e.message:`Failed to open URL in browser`,variant:`destructive`})}}async function lt(){if(J.hasChanges){oe(!0);return}if(J.hasUnpushedCommits&&J.prExists){await pt();return}if(J.prExists&&J.prState===`OPEN`&&!J.hasChanges&&!J.hasUnpushedCommits){await ct();return}if(J.commitsAheadOfDefault&&!J.prExists&&!J.hasChanges){g(!0);return}if(J.defaultBranchBehind>0){await vt();return}}async function ut(){let e=await X.generateCommitMessageWithAI();e&&ue(e)}async function dt(){if(M(n))try{u(!0);let e=await X.generateCommitMessageWithAI();if(!e){w({title:`Quick Commit failed`,description:`Could not generate commit message`,variant:`destructive`});return}await h(n,e),await J.fetchUnifiedStatus(!0),Q(),w({title:`Changes committed successfully`,description:`Committed: ${e}`})}catch(e){P.error(`Quick commit failed:`,e),w({title:`Quick Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{u(!1)}}async function ft(){if(M(n))try{u(!0),await S(n),await J.fetchUnifiedStatus()}catch(e){P.error(`Failed to fetch:`,e)}finally{u(!1)}}async function pt(){if(M(n))try{u(!0),await ce(n),await J.fetchUnifiedStatus(!0),Q(),J.hasRemoteBranch?w({title:`Branch pushed successfully`,description:`Your branch '${J.currentBranch}' has been pushed to the remote.`}):w({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){P.error(`Failed to push:`,e),w({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{u(!1)}}async function mt(){if(M(n)){if(J.hasChanges){G(!0);return}await ht()}}async function ht(){try{u(!0),await le(n),await J.fetchUnifiedStatus(!0),Q(),w({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){P.error(`Failed to pull:`,e),w({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{u(!1)}}function gt(){G(!1),K(!0),oe(!0)}async function _t(){G(!1),await ht()}async function vt(){if(M(n))try{u(!0),await t(n),await J.fetchUnifiedStatus(!0),Q(),w({title:`Branch synced successfully`,description:`Your branch '${J.currentBranch}' has been synced with the latest changes`})}catch(e){P.error(`[sync] ✗ Failed to sync branch:`,e),w({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{u(!1)}}async function yt(){if(M(n))try{u(!0),p(!0);let t=await re(n,v,x);await Ue(n,e,s,t.title??v),t.prUrl&&await b(t.prUrl),y(``),he(``),g(!1),await J.fetchUnifiedStatus(!0),Q();let r=0;Z.current!==null&&clearInterval(Z.current),Z.current=setInterval(async()=>{if(r++,r>=6){Z.current!==null&&(clearInterval(Z.current),Z.current=null);return}await J.fetchUnifiedStatus(!0)},2e3)}catch(e){P.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`)?(g(!1),St({title:v,description:x})):(p(!1),w({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{u(!1)}}async function bt(){if(M(n))try{u(!0);let e=await i(n,V,H,$.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{b(e.repoUrl)},3e3),Ge(``),U(``),B(!1),await J.fetchUnifiedStatus(),Q()}catch(e){P.error(`Failed to create repo:`,e)}finally{u(!1)}}async function xt(){let e=await X.generatePRInfoWithAI();e&&(y(e.title),he(e.description),w({title:`Success`,description:`PR title and description generated`}))}async function St(r){let i=r??ve;if(!(!n||!i))try{u(!0),p(!0);try{await ce(n)}catch(e){let r=e?.message??``;if(r.includes(`non-fast-forward`)||r.includes(`Updates were rejected because the tip of your current branch is behind`)){w({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await t(n),await ce(n)}catch{throw e}}else throw e}let r=await re(n,i.title,i.description);await Ue(n,e,s,r.title??i.title),r.prUrl&&await b(r.prUrl),y(``),he(``),T(null),C(!1),await J.fetchUnifiedStatus(!0),Q();let a=0;Z.current!==null&&clearInterval(Z.current),Z.current=setInterval(async()=>{if(a++,a>=6){Z.current!==null&&(clearInterval(Z.current),Z.current=null);return}await J.fetchUnifiedStatus(!0)},2e3)}catch(e){P.error(`Failed to push and create PR:`,e);let t=e instanceof Error?e.message:`Failed to push and create PR`;p(!1),w({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{u(!1)}}async function Ct(){if(M(n))try{N(!0);let e=await de(n,100);Ne(e),We(e.slice(0,10)),A(!0)}catch(e){P.error(`Failed to fetch git history:`,e)}finally{N(!1)}}function wt(){L||(R(!0),setTimeout(()=>{let e=I.length+10;We(j.slice(0,e)),R(!1)},300))}function Tt(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&I.length<j.length&&!L&&wt()}let Et=Me(J);function Dt(){J.repoUrl&&b(J.repoUrl)}function Ot(){C(!1),T(null)}return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:ne(`flex items-center gap-0`,ee===`menu`&&`w-full flex-col gap-1 [&_button]:w-full [&_button]:justify-start`),children:[(0,O.jsx)(_e,{children:(0,O.jsxs)(f,{children:[(0,O.jsx)(r,{asChild:!0,children:(0,O.jsxs)(ie,{variant:`outline`,size:`sm`,className:ne(`h-8 gap-1.5`,ee===`bar`&&`rounded-r-none border-r-0`,ee===`menu`&&`rounded-md border`,Et&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`),disabled:je(J,l,d),onClick:lt,children:[ke(J,d,l),Oe(J,d)]})}),(0,O.jsx)(ae,{children:Ae(J)})]})}),(0,O.jsx)(Pe,{branchStatus:J.status,remoteUrl:J.remoteUrl,hasRemoteBranch:J.hasRemoteBranch,hasUnpushedCommits:J.hasUnpushedCommits,canCreateRepo:J.canCreateRepo,repoUrl:J.repoUrl,isRefreshing:J.isRefreshing,isCreatingPR:d,isBrandState:Et,hasChanges:J.hasChanges,commitsAheadOfDefault:J.commitsAheadOfDefault,prExists:J.prExists,defaultBranch:J.defaultBranch??null,defaultBranchAhead:J.defaultBranchAhead,defaultBranchBehind:J.defaultBranchBehind,gitUser:Ke,isDirectCommitMode:it,autoGenerateCommitMessage:$.autoGenerateCommitMessage,isLoading:l,isLoadingHistory:Fe,isQuickCommitting:X.isGeneratingMessage&&l,onFetch:()=>void ft(),onPull:()=>void mt(),onPush:()=>void pt(),onOpenHistory:()=>void Ct(),onCreatePR:()=>g(!0),onCreateRepo:()=>B(!0),onViewInGitHub:Dt,onQuickCommit:()=>void dt(),onSyncWithDefault:()=>void vt(),open:Ze,onOpenChange:ot,layout:ee})]}),m&&(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(F,{}),children:(0,O.jsx)(Le,{open:m,onOpenChange:oe,commitMessage:_,onCommitMessageChange:ue,autoGenerateCommitMessage:$.autoGenerateCommitMessage,onAutoGenerateChange:e=>rt(t=>({...t,autoGenerateCommitMessage:e})),isGeneratingMessage:X.isGeneratingMessage,isLoading:l,onGenerateMessage:ut,onCommit:st,currentBranch:J.currentBranch})}),se&&(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(F,{}),children:(0,O.jsx)(Re,{open:se,onOpenChange:g,prTitle:v,onPrTitleChange:y,prDescription:x,onPrDescriptionChange:he,isGeneratingPRInfo:X.isGeneratingPRInfo,isLoading:l,onGeneratePRInfo:xt,onCreatePR:yt,currentBranch:J.currentBranch,autoGeneratePRInfo:$.autoGeneratePRInfo,onAutoGeneratePRInfoChange:e=>rt(t=>({...t,autoGeneratePRInfo:e}))})}),ge&&(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(F,{}),children:(0,O.jsx)(Ve,{open:ge,onOpenChange:C,isLoading:l,onPushAndCreatePR:St,onCancel:Ot})}),z&&(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(F,{}),children:(0,O.jsx)(ze,{open:z,onOpenChange:B,repoName:V,onRepoNameChange:Ge,repoDescription:H,onRepoDescriptionChange:U,isPrivateRepo:$.privateRepositoryDefault,onPrivateRepoChange:e=>rt(t=>({...t,privateRepositoryDefault:e})),isLoading:l,onCreateRepo:bt})}),k&&(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(F,{}),children:(0,O.jsx)(Be,{open:k,onOpenChange:A,commits:j,displayedCommits:I,isLoadingMore:L,onScroll:Tt,currentBranch:J.currentBranch})}),W&&(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(F,{}),children:(0,O.jsx)(He,{open:W,onOpenChange:G,onCommitFirst:gt,onStashAndPull:_t,onCancel:()=>G(!1),isLoading:l})})]})}export{I as GitOpsButton};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{$i as n,Ai as r,Ba as i,Br as a,Di as o,Fi as s,Fo as c,Fs as l,Gr as u,Ii as d,Io as f,Is as p,Ki as m,Ko as h,Kr as g,Lr as _,Ls as v,Mi as y,Mo as b,Ni as x,No as S,Oi as C,Pi as w,Po as T,Rr as E,Rs as D,Si as O,Ti as k,Ui as A,Ur as j,Vr as M,Wr as N,_ as ee,_i as te,ai as P,bi as ne,c as re,ci as F,di as ie,ds as ae,fi as oe,fs as I,gi as se,hi as ce,ji as L,ki as le,l as ue,li as de,mi as fe,oi as pe,ot as me,pi as he,qr as ge,s as _e,si as ve,u as ye,ui as be,wi as xe,wo as Se,yi as Ce,zr as we}from"./dialogs-config-86QTDk4G.js";var R=p(),Te=Object,Ee=Map,De=Set,Oe=De.prototype.has,ke=De.prototype.add,Ae=Ee.prototype.has,je=Ee.prototype.get,Me=Ee.prototype.set,Ne=1,Pe=2,Fe=4,Ie=8,Le=16,Re=32,z=`__t`,ze=`__p`,Be=`__e`,Ve=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,He=`http://www.w3.org/1999/xlink`,Ue=`http://www.w3.org/2000/xmlns/`,We=120,Ge=new De([`href`,`list`,`form`,`tabIndex`,`download`]),Ke=new De([`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`isindex`,`keygen`,`link`,`menuitem`,`meta`,`nextid`,`param`,`source`,`track`,`wbr`]);if(typeof window>`u`)throw Error(`See http://million.dev/docs/install to install the compiler.`);var B=document;B.createElement(`template`);var qe=B.createElement(`template`),Je=qe.content,Ye=B.createElementNS(`http://www.w3.org/2000/svg`,`svg`),V=Node.prototype,Xe=Element.prototype,Ze=CharacterData.prototype,Qe=Te.getOwnPropertyDescriptor,$e=V.insertBefore,et=V.cloneNode,tt=V.replaceChild,nt=Xe.remove,rt=V.addEventListener,it=Xe.removeAttribute,at=Xe.setAttribute,ot=Xe.setAttributeNS,st=Qe(V,`textContent`).set,ct=Qe(V,`firstChild`).get,lt=Qe(V,`nextSibling`).get,ut=Qe(Ze,`data`).set,dt=(e,t)=>{let n=t?Ye:qe;return n.innerHTML=e,(t?Ye:Je).firstChild};B[Be]=new De;var ft=(e,t,n)=>{let r=t.toLowerCase(),i=!1;r.endsWith(`capture`)&&(r=r.slice(0,-7),i=!0);let a=`$$${r}`;Oe.call(B[Be],r)||(rt.call(B,r,e=>{let t=e.target;for(;t;){let n=t[a];n&&(Te.defineProperty(e,`currentTarget`,{configurable:!0,get(){return t}}),n(e)),t=t.parentNode}},{capture:i}),ke.call(B[Be],r));let o=t=>{t?`key`in t&&t.key===e[a]?.key||(e[a]=t):e[a]=null};return o(n),o},pt=(e,t)=>{let n=ct.call(e);if(t)for(let e=0;e<t&&n;++e)n=lt.call(n);return n},mt=new WeakSet,ht=e=>{if(mt.has(e))return;e.nodeType===8&&e.parentNode?.removeChild(e);let t=ct.call(e);for(;t;)ht(t),t=t.nextSibling;mt.add(e)},gt=(e,t,n)=>{let r=B.createTextNode(t),i=pt(e,n);return $e.call(e,r,i),r},_t=(e,t)=>{ut.call(e,t)},vt=(e,t,n)=>{typeof n!=`number`||Ve.test(t)?e.style[t]=n:typeof n==`string`?e.style.cssText=n:t.startsWith(`-`)?e.style.setProperty(t,String(n)):n==null?e.style[t]=``:e.style[t]=`${String(n)}px`},yt=(e,t,n)=>{t=t.replace(/xlink(?:H|:h)/,`h`).replace(/sName$/,`s`),t.startsWith(`xmlns`)?ot.call(e,Ue,t,String(n)):t.startsWith(`xlink`)&&ot.call(e,He,`href`,String(n))},bt=(e,t,n)=>{let r=n==null;if(n=r?``:n,t in e&&e[t]!==void 0&&e[t]!==null&&!(e instanceof SVGElement)&&Oe.call(Ge,t))try{e[t]=n}catch{}else !r&&n!==``&&(n!==!1||t.includes(`-`))?at.call(e,t,String(n)):it.call(e,t);let i=e instanceof HTMLInputElement,a=e instanceof HTMLSelectElement,o=e instanceof HTMLTextAreaElement;t===`value`&&(i||a||o)&&(at.call(e,t,String(n)),e.value=n)},xt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]);function St(e){return xt.get(e)||e}var Ct=Object.defineProperty,wt=(e,t,n)=>t in e?Ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,H=(e,t,n)=>(wt(e,typeof t==`symbol`?t:t+``,n),n),Tt=class{constructor(){H(this,`r`),H(this,`e`),H(this,`l`),H(this,`g`),H(this,`_u`),H(this,`_t`),H(this,`d`),H(this,`k`),H(this,`c`)}},Et=(e,t=[],n=[])=>{if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`bigint`||e===!0)return String(e);if(e==null||e===!1)return``;if(typeof e==`object`&&`$`in e)return t.push({p:n,e:[{t:Ne,n:null,v:null,h:e.$,i:0,l:null,p:null,b:null}],i:[]}),`<slot/>`;let r=``,i=``,a={p:n,e:[],i:[]};for(let t in e.props){let n=e.props[t];if(t===`key`||t===`ref`||t===`children`)continue;let i=St(t);if(i&&(t=i),t===`className`&&(t=`class`),t.startsWith(`on`)){`$`in n?a.e.push({t:Fe,n:t.slice(2),v:null,h:n.$,i:null,l:null,p:null,b:null}):a.i.push({t:Fe,n:t.slice(2),v:null,h:null,i:null,l:n,p:null,b:null});continue}if(n){if(typeof n==`object`&&`$`in n){t===`style`?a.e.push({t:Ie,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):t.charCodeAt(0)===We?a.e.push({t:Le,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):a.e.push({t:Pe,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null});continue}if(t===`style`&&typeof n==`object`){let e=``;for(let t in n){if(typeof n[t]==`object`){a.e.push({t:Ie,n:t,v:null,h:n[t].$,i:null,l:null,p:null,b:null});continue}let r=``;for(let e=0,n=t.length;e<n;++e){let n=t.charCodeAt(e);n<97?r+=`-${String.fromCharCode(n+32)}`:r+=t[e]}e+=`${r}:${String(n[t])};`}r+=` style="${e}"`;continue}r+=` ${t}="${String(n)}"`}}if(Oe.call(Ke,e.type))return a.e.length&&t.push(a),`<${e.type}${r} />`;let o=!1;for(let r=0,s=e.props.children?.length||0,c=0;r<s;++r){let s=e.props.children?.[r];if(s==null||s===!1)continue;if(typeof s==`object`&&`$`in s){a.e.push({t:Ne,n:null,v:null,h:s.$,i:r,l:null,p:null,b:null});continue}if(s instanceof Tt){a.i.push({t:Re,n:null,v:null,h:null,i:r,l:null,p:null,b:s});continue}if(typeof s==`string`||typeof s==`number`||typeof s==`bigint`){let e=typeof s==`number`||typeof s==`bigint`?String(s):s;if(o){a.i.push({t:Ne,n:null,v:e,h:null,i:r,l:null,p:null,b:null});continue}o=!0,i+=e,c++;continue}o=!1;let l=n.slice();l.push(c++),i+=Et(s,t,l)}return(a.i.length||a.e.length)&&t.push(a),`<${e.type}${r}>${i}</${e.type}>`},Dt=Object.defineProperty,Ot=(e,t,n)=>t in e?Dt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kt=(e,t,n)=>(Ot(e,typeof t==`symbol`?t:t+``,n),n),At=e=>new jt(e),jt=class extends Tt{constructor(e){super(),kt(this,`b`),this.b=e}v(){}p(e){let t=this.b,n=e.b,r=t.length,i=n.length,a=this.t();if(this===e||i===0&&r===0)return a;if(this.b=n,i===0)return Ft.call(this),a;if(r===0)return Nt.call(e,a),a;let o=0,s=0,c=r-1,l=i-1,u=t[0],d=n[0],f=t[c],p=n[l],m;for(;o<=c&&s<=l;){if(!u){u=t[++o];continue}if(!f){f=t[--c];continue}let e=u.k,r=d.k;if(e===r){Ut.call(u,d),n[s]=u,u=t[++o],d=n[++s];continue}let i=f.k,h=p.k;if(i===h){Ut.call(f,p),n[l]=f,f=t[--c],p=n[--l];continue}if(e===h){Ut.call(u,p),n[l]=u;let e=n[l+1];Wt.call(u,e,e?.l||null),u=t[++o],p=n[--l];continue}if(i===r){Ut.call(f,d),n[s]=f;let e=t[o];Wt.call(f,e,e?.l||null),f=t[--c],d=n[++s];continue}if(!m){m=new Ee;for(let e=o;e<=c;e++)Me.call(m,t[e].k,e)}let g=m.get(r);if(g===void 0)Ht.call(d,a,u.l||null);else{let e=t[g];Wt.call(e,u,null),Ut.call(e,d),n[s]=e,t[g]=null}d=n[++s]}if(o<=c||s<=l)if(o>c){let e=n[l+1];for(let t=s;t<=l;++t)Ht.call(n[t],a,e?e.l:null)}else for(let e=o;e<=c;++e)Gt.call(t[e]);return a}m(e,t=null){if(this._t)return this._t;for(let n=0,r=this.b.length;n<r;++n){let r=this.b[n];Ht.call(r,e,t)}return this._t=e,e}x(){let e=this.t();if(e)st.call(e,``);else for(let e=0,t=this.b.length;e<t;++e)Gt.call(this.b[e]);this.b=[]}u(){return!0}s(){return this.b.map(e=>e.s()).join(``)}t(){return this._t||=this.b[0].t(),this._t}},Mt=jt.prototype,Nt=Mt.m,Pt=Mt.p,Ft=Mt.x,It=new Proxy({},{get(e,t){return{$:t}}}),Lt=(e,t,n,r)=>{let i=e(It),a=[],o=dt(Et(t?t(i):i,a),r);return ht(o),(e,t,r)=>new zt(o,a,e,t??e?.key??null,r??n??null,null)},Rt=(e,t)=>{if((`b`in e||`b`in t)&&Pt.call(e,t),e.l||Ht.call(e,void 0,null,null),e.k&&e.k===t.k||e.r===t.r)return Ut.call(e,t);let n=Ht.call(t,e.t(),e.l,null);return Gt.call(e),e.k=t.k,n},zt=class extends Tt{constructor(e,t,n,r,i,a){super(),this.r=e,this.d=n,this.e=t,this.k=r,this.c=Array(t.length),i?this._u=i:this._u=null,a?this.g=a:this.g=null}m(e,t=null,n){if(this.l)return this.l;let r=n??et.call(this.r,!0),i=this.g?.(r);i&&(this.c=i);for(let e=0,t=this.e.length;e<t;++e){let t=this.e[e],a=i?.[e]??Bt(t.p,r,this.c,e);for(let e=0,r=t.e.length;e<r;++e){let i=t.e[e],o=this.d[i.h];if(i.t&Ne){if(o instanceof Tt){let e=pt(a,i.i);n?o.m(a,e,e):o.m(a,e);continue}if(a[z]||(a[z]=Array(r)),o&&typeof o==`object`&&`foreign`in o){if(n){let e=pt(a,i.i);o.reset(e)}let t=o.current;a[z][e]=t,n||$e.call(a,t,pt(a,i.i));continue}if(n){a[z][e]=pt(a,i.i);continue}a[z][e]=gt(a,o==null||o===!1?``:String(o),i.i)}else if(i.t&Fe){let e=ft(a,i.n,o);a[ze+i.n]=e}else if(i.t&Pe)bt(a,i.n,o);else if(i.t&Ie)if(typeof o==`string`||typeof o==`number`)vt(a,i.n,o);else for(let e in o)vt(a,e,o[e]);else yt(a,i.n,o)}let o=t.i?.length;if(o)for(let e=0;e<o;++e){let r=t.i[e];if(r.t&Ne)r.v&&!n&>(a,r.v,r.i);else if(r.t&Fe)ft(a,r.n,r.l);else{let e=pt(a,r.i);n?r.b.m(a,e,e):r.b.m(a,e)}}}return e&&!n&&$e.call(e,r,t),this.l=r,r}p(e){let t=this.l;if(!e.d)return t;let n=this.d;if(!Kt.call(this,n,e.d))return t;this.d=e.d;for(let r=0,i=this.e.length;r<i;++r){let i=this.e[r],a=this.c[r]??Bt(i.p,t,this.c,r);for(let t=0,o=i.e.length;t<o;++t){let o=i.e[t],s=n[o.h],c=e.d[o.h];if(c!==s){if(o.t&Fe){a[ze+o.n](c);continue}if(o.t&Ne){if(s instanceof Tt){let n=e.e?.[r]?.e[t],i=e.d[n.h];s.p(i);continue}if(c&&typeof c==`object`&&`foreign`in c){let e=a[z][t];if(c.unstable&&s!==c){let n=c.current;a[z][t]=n,tt.call(a,n,e)}else c.current=e;continue}_t(a[z][t],c==null||c===!1?``:String(c))}else if(o.t&Pe)bt(a,o.n,c);else if(o.t&Ie)if(typeof c==`string`||typeof c==`number`)vt(a,o.n,c);else for(let e in c)c[e]!==s[e]&&vt(a,e,c[e]);else yt(a,o.n,c)}}}return t}v(e=null,t=null){$e.call(this.t(),this.l,e?e.l:t)}x(){nt.call(this.l),this.l=null}u(e,t){return this._u?this._u(e,t):!0}s(){return String(this.l?.outerHTML)}t(){return this._t||=this.l?.parentElement,this._t}},Bt=(e,t,n,r)=>{let i=e.length;if(!i)return t;let a=n&&r!==void 0;if(a&&n[r])return n[r];for(let n=0;n<i;++n){let r=e[n];t=pt(t,r)}return a&&(n[r]=t),t},Vt=zt.prototype,Ht=Vt.m,Ut=Vt.p,Wt=Vt.v,Gt=Vt.x,Kt=Vt.u,U=e(D(),1),qt={noSlot:!1},Jt=e(v(),1),Yt=`slot`,Xt=({effect:e,deps:t})=>((0,U.useEffect)(e,t||[]),null),W=new Map,Zt=(0,U.createContext)(!1),Qt=(e,t,n)=>{let r={ref:t},i=0;for(let t in e){let a=e[t];if((0,U.isValidElement)(a)||Array.isArray(a)&&a.length&&(0,U.isValidElement)(a[0])){r[t]=en(a,!1,n,i++);continue}r[t]=e[t]}return r},$t=(e,t)=>(0,U.createElement)(Yt,{suppressHydrationWarning:!0,id:t},e),en=(e,t,n,r,i)=>{let a=n?.[r]?.current,o=(0,U.isValidElement)(e)&&typeof e.type==`function`&&`_c`in e.type,s=o&&e.type._c;if(typeof window>`u`)return o?s?e:$t($t(e),i):$t(e,i);if(s){let t=e.type(e.props);if(W.has(t.type)){let e=W.get(t.type);if(typeof e==`function`)return e(t.props)}}let c=a??(i?document.getElementById(i):null)??document.createElement(`slot`),l={foreign:!0,current:c,portal:(0,Jt.createPortal)((0,U.createElement)(U.Fragment,{children:e}),c,i),reset:e=>{e.childNodes.forEach(t=>e.removeChild(t))},unstable:t};return n&&(n[r]=l),l},tn=e=>{if(typeof e!=`object`||!e||!(`type`in e))return typeof e==`number`?String(e):e;let t=e.type;if(typeof t==`function`)return tn(t(e.props??{}));if(typeof t==`object`&&`$`in t)return t;let n={...e.props};return`css`in n&&`__EMOTION_TYPE_PLEASE_DO_NOT_USE__`in n&&(n.style=n.css.styles,t=n.__EMOTION_TYPE_PLEASE_DO_NOT_USE__,delete n.__EMOTION_TYPE_PLEASE_DO_NOT_USE__,delete n.css),e.props?.children!=null&&(n.children=nn(e.props.children).map(e=>tn(e))),{type:t,props:n}},nn=e=>{if(e==null)return[];if(typeof e==`object`&&`type`in e&&e.type===U.Fragment)return nn(e.props.children);if(!Array.isArray(e)||typeof e==`object`&&`$`in e)return[e];let t=e.flat(1/0),n=[];for(let e=0,r=t.length;e<r;++e)n.push(...nn(t[e]));return n},rn=typeof window>`u`?U.useEffect:U.useLayoutEffect;function an(e,t,n){if(!e||t(e))return e;let r=n?e.return:e.child;for(;r;){let e=an(r,t,n);if(e)return e;r=n?null:r.sibling}}function on(){let e=(0,U.useRef)();return(0,U.useState)(()=>{let t=Function.prototype.bind;Function.prototype.bind=function(n,r){return n===null&&typeof r?.type==`function`&&(e.current=r,Function.prototype.bind=t),t.apply(this,arguments)}}),e.current}function sn(e){let t=on(),n=(0,U.useRef)({el:null,depth:0});return rn(()=>{n.current.el=an(t,t=>(n.current.depth++,typeof t.type==`string`&&(e===void 0||t.type===e)),!0)?.stateNode},[t]),n}function cn(){let e=on(),t=(0,U.useRef)({el:null,depth:0});return rn(()=>{t.current.el=an(e,e=>(t.current.depth++,e.stateNode?.containerInfo!=null),!0)?.stateNode.containerInfo},[e]),t}var ln=(e,t={})=>{let n=t?.experimental_noSlot??qt.noSlot,r=t?.block,i=t?.svg?`g`:Yt;e&&(r=Lt(e,tn,t?.shouldUpdate,t?.svg));let a=(e,a)=>{let o=cn(),s=sn(),c=e._hmr,l=(0,U.useRef)(null),u=(0,U.useRef)(null),d=(0,U.useRef)([]);e=Qt(e,a,d.current),u.current?.(e);let f=(0,U.useCallback)(()=>{if(!l.current&&!n)return;let i=r(e,e.key);return c&&l.current?.textContent&&(l.current.textContent=``),n&&(l.current=s.current?.el??o.current?.el,(e.scoped||s.current&&o.current&&s.current.depth>o.current.depth)&&(l.current=o.current.el),l.current.childNodes.length&&console.error(Error(`\`experimental_options.noSlot\` does not support having siblings at the moment.
|
|
2
|
+
The block element should be the only child of the \`${et.call(l.current).outerHTML}\` element.
|
|
3
|
+
To avoid this error, \`experimental_options.noSlot\` should be false`))),(u.current===null||c)&&(Ht.call(i,l.current,null),u.current=e=>{Rt(i,r(e,e.key,t?.shouldUpdate))}),()=>{Gt.call(i)}},[]),p=(0,U.useMemo)(()=>n?null:(0,U.createElement)(t?.as??i,{ref:l}),[]),m=d.current.length,h=Array(m);for(let e=0;e<m;++e)h[e]=d.current[e]?.portal;return(0,U.createElement)(U.Fragment,{},p,(0,U.createElement)(Xt,{effect:f,deps:c?[c]:[]}),h)};return Ae.call(W,a)||Me.call(W,a,ln),t?.name&&(e&&(e.displayName=`Million(Render(${t.name}))`),a.displayName=`Million(Block(${t.name}))`),a};(0,U.memo)(({each:e,children:t,memo:n,svg:r,as:i,...a})=>{let o=(0,U.useRef)(null),[s]=(0,U.useState)(()=>({current:Array(e.length)})),c=(0,U.useRef)(null),l=(0,U.useRef)({each:null,children:null,mounted:!1}),[,u]=(0,U.useState)(!1);if(c.current&&(e!==l.current.each||!n)){let r=un(e,t,l,s,n);Pt.call(c.current,At(r))}let d=(0,U.createElement)(U.Fragment,null,(0,U.createElement)(i??(r?`g`:`slot`),{...a,ref:o}),...s.current.map(e=>e.portal));return(0,U.useEffect)(()=>{!o.current||c.current||l.current.mounted||(c.current=At(un(e,t,l,s,n)),Ae.call(W,d)||Me.call(W,d,c.current),Nt.call(c.current,o.current),l.current.mounted=!0,u(!0))},[o.current]),d});var un=(e,t,n,r,i)=>{let a=Array(e.length),o=n.current;for(let n=0,s=e.length;n<s;++n){if(i&&o.each&&o.each[n]===e[n]){a[n]=o.children?.[n];continue}let s=t(e[n],n);if(Ae.call(W,s.type)){o.block||=je.call(W,s.type),a[n]=o.block(s.props,r,n);continue}if(typeof s.type==`function`&&`_c`in s.type){let e=s.type(s.props);if(Ae.call(W,e.type)){let t=je.call(W,e.type);if(typeof t==`function`){a[n]=t(e.props);continue}}}let c=Lt(e=>e?.scope),l=(e,t,n)=>c({scope:en((0,U.createElement)(s.type,e),!1,t.current,n)},s.key?String(s.key):void 0);Me.call(W,s.type,l),o.block=l,a[n]=l(s.props,r,n)}return o.each=e,o.children=a,a};function dn(e,t){return e===t||e!==e&&t!==t}function fn(e,t){for(let n in e)if(!dn(e[n],t[n]))return!0;return!1}function pn(e,{portals:t,...n}){let r=`CompiledBlock(Inner(${n.name}))`,i=ln(t=>e(t),{...n,scoped:void 0,name:r,shouldUpdate:fn}),a=t?.length||0,o=t&&a>0?e=>{let n=(0,U.useContext)(Zt),[r]=(0,U.useState)(()=>[]),o={...e,scoped:n};for(let e=0;e<a;e++){let n=t[e];o[n]=en(o[n],!1,r,e)}let s=[];for(let e=0,t=r.length;e<t;e++)s[e]=r[e].portal;return(0,U.createElement)(U.Fragment,null,(0,U.createElement)(i,o),s)}:e=>(0,U.createElement)(i,e);return n.name&&(o.displayName=`Million(CompiledBlock(Outer(${n.name})))`),o}typeof window<`u`&&(window.__MILLION_DATA__={version:`3.1.11`});var G=l(),mn=`AlertDialog`,[hn,gn]=y(mn,[fe]),K=fe(),_n=e=>{let{__scopeAlertDialog:t,...n}=e,r=K(t);return(0,G.jsx)(be,{...r,...n,modal:!0})};_n.displayName=mn;var vn=`AlertDialogTrigger`,yn=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(oe,{...i,...r,ref:t})});yn.displayName=vn;var bn=`AlertDialogPortal`,xn=e=>{let{__scopeAlertDialog:t,...n}=e,r=K(t);return(0,G.jsx)(de,{...r,...n})};xn.displayName=bn;var Sn=`AlertDialogOverlay`,Cn=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(F,{...i,...r,ref:t})});Cn.displayName=Sn;var wn=`AlertDialogContent`,[Tn,En]=hn(wn),Dn=C(`AlertDialogContent`),On=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=K(n),o=U.useRef(null),s=A(t,o),c=U.useRef(null);return(0,G.jsx)(he,{contentName:wn,titleName:kn,docsSlug:`alert-dialog`,children:(0,G.jsx)(Tn,{scope:n,cancelRef:c,children:(0,G.jsxs)(pe,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:x(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,G.jsx)(Dn,{children:r}),(0,G.jsx)(Ln,{contentRef:o})]})})})});On.displayName=wn;var kn=`AlertDialogTitle`,An=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(ie,{...i,...r,ref:t})});An.displayName=kn;var jn=`AlertDialogDescription`,Mn=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(ve,{...i,...r,ref:t})});Mn.displayName=jn;var Nn=`AlertDialogAction`,Pn=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(P,{...i,...r,ref:t})});Pn.displayName=Nn;var Fn=`AlertDialogCancel`,In=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=En(Fn,n),a=K(n),o=A(t,i);return(0,G.jsx)(P,{...a,...r,ref:o})});In.displayName=Fn;var Ln=({contentRef:e})=>{let t=`\`${wn}\` requires a description for the component to be accessible for screen reader users.
|
|
4
|
+
|
|
5
|
+
You can add a description to the \`${wn}\` by passing a \`${jn}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
6
|
+
|
|
7
|
+
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 \`${wn}\`. 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.
|
|
8
|
+
|
|
9
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return U.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},Rn=_n,zn=xn,Bn=Cn,Vn=On,Hn=Pn,Un=In,Wn=An,Gn=Mn,Kn=Rn,qn=zn,Jn=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`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)(Bn,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Jn.displayName=Bn.displayName;var Yn=U.forwardRef((e,t)=>{let n=(0,R.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)(Jn,{}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=d(`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)(qn,{children:[a,(0,G.jsx)(Vn,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});Yn.displayName=Vn.displayName;var Xn=e=>{let t=(0,R.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=d(`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};Xn.displayName=`AlertDialogHeader`;var Zn=e=>{let t=(0,R.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=d(`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};Zn.displayName=`AlertDialogFooter`;var Qn=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(I.dialogTitle,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(Wn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Qn.displayName=Wn.displayName;var $n=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(I.dialogDescription,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(Gn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});$n.displayName=Gn.displayName;var er=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(s(),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(Hn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});er.displayName=Hn.displayName;var tr=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(s({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)(Un,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});tr.displayName=Un.displayName;var nr=pn(e=>(0,G.jsxs)(`div`,{className:e.v0,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:e.v1,children:e.v2}),e.v3]}),e.v4]}),{name:`PageHeader_1`,portals:[`v2`,`v3`,`v4`]}),rr=function(e){let t=(0,R.c)(12),{title:n,description:r,action:i,className:a,titleClassName:o}=e,s;t[0]===a?s=t[1]:(s=d(`flex items-center justify-between mb-6`,a),t[0]=a,t[1]=s);let c;t[2]===o?c=t[3]:(c=d(I.pageTitle,o),t[2]=o,t[3]=c);let l;t[4]===r?l=t[5]:(l=r?(0,G.jsx)(`p`,{className:I.pageSubtitle,children:r}):null,t[4]=r,t[5]=l);let u;return t[6]!==i||t[7]!==s||t[8]!==c||t[9]!==l||t[10]!==n?(u=(0,G.jsx)(nr,{v0:s,v1:c,v2:n,v3:l,v4:i}),t[6]=i,t[7]=s,t[8]=c,t[9]=l,t[10]=n,t[11]=u):u=t[11],u};function ir(e){let t=(0,R.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=d(ae.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 ar(e){let t=(0,R.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=d(ae.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 or(e){let t=(0,R.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=d(ae.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 sr(e){let t=(0,R.c)(5),{title:n,className:r}=e,i;t[0]===r?i=t[1]:(i=d(I.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 cr(e){let t=(0,R.c)(6),{children:n,variant:r,className:i}=e,a=r===void 0?`info`:r,o;t[0]!==i||t[1]!==a?(o=d(a===`hint`?I.hintBanner:a===`success`?d(I.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`?d(I.error,`bg-destructive/10 rounded-md px-3 py-2 mb-4`):I.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 lr(e){let t=(0,R.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=d(`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 ur(e){let t=(0,R.c)(10),{children:n,title:r,action:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,G.jsx)(`h2`,{className:d(I.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:I.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 dr(e){let t=(0,R.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=d(`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 fr(e){let t=(0,R.c)(14),{title:n,description:r,action:i,children:a,className:o}=e,s;t[0]===n?s=t[1]:(s=(0,G.jsx)(sr,{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:I.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}function pr(e){let t=U.useRef({value:e,previous:e});return U.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var mr=[` `,`Enter`,`ArrowUp`,`ArrowDown`],hr=[` `,`Enter`],q=`Select`,[gr,_r,vr]=_e(q),[yr,br]=y(q,[vr,ge]),xr=ge(),[Sr,J]=yr(q),[Cr,wr]=yr(q),Tr=e=>{let{__scopeSelect:t,children:n,open:i,defaultOpen:a,onOpenChange:o,value:s,defaultValue:c,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:p,required:m,form:h}=e,_=xr(t),[v,y]=U.useState(null),[b,x]=U.useState(null),[S,C]=U.useState(!1),w=ye(u),[T,E]=le({prop:i,defaultProp:a??!1,onChange:o,caller:q}),[D,O]=le({prop:s,defaultProp:c,onChange:l,caller:q}),k=U.useRef(null),A=v?h||!!v.closest(`form`):!0,[j,M]=U.useState(new Set),N=Array.from(j).map(e=>e.props.value).join(`;`);return(0,G.jsx)(g,{..._,children:(0,G.jsxs)(Sr,{required:m,scope:t,trigger:v,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:r(),value:D,onValueChange:O,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:k,disabled:p,children:[(0,G.jsx)(gr.Provider,{scope:t,children:(0,G.jsx)(Cr,{scope:e.__scopeSelect,onNativeOptionAdd:U.useCallback(e=>{M(t=>new Set(t).add(e))},[]),onNativeOptionRemove:U.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),A?(0,G.jsxs)(_i,{"aria-hidden":!0,required:m,tabIndex:-1,name:d,autoComplete:f,value:D,onChange:e=>O(e.target.value),disabled:p,form:h,children:[D===void 0?(0,G.jsx)(`option`,{value:``}):null,Array.from(j)]},N):null]})})};Tr.displayName=q;var Er=`SelectTrigger`,Dr=U.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=xr(n),o=J(Er,n),s=o.disabled||r,c=A(t,o.onTriggerChange),l=_r(n),u=U.useRef(`touch`),[d,f,p]=yi(e=>{let t=l().filter(e=>!e.disabled),n=bi(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,G.jsx)(j,{asChild:!0,...a,children:(0,G.jsx)(k.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":vi(o.value)?``:void 0,...i,ref:c,onClick:x(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:x(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:x(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&mr.includes(e.key)&&(m(),e.preventDefault())})})})});Dr.displayName=Er;var Or=`SelectValue`,kr=U.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=J(Or,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=A(t,c.onValueNodeChange);return L(()=>{l(u)},[l,u]),(0,G.jsx)(k.span,{...s,ref:d,style:{pointerEvents:`none`},children:vi(c.value)?(0,G.jsx)(G.Fragment,{children:o}):a})});kr.displayName=Or;var Ar=`SelectIcon`,jr=U.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,G.jsx)(k.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});jr.displayName=Ar;var Mr=`SelectPortal`,Nr=e=>(0,G.jsx)(Ce,{asChild:!0,...e});Nr.displayName=Mr;var Y=`SelectContent`,Pr=U.forwardRef((e,t)=>{let n=J(Y,e.__scopeSelect),[r,i]=U.useState();if(L(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Jt.createPortal((0,G.jsx)(Fr,{scope:e.__scopeSelect,children:(0,G.jsx)(gr.Slot,{scope:e.__scopeSelect,children:(0,G.jsx)(`div`,{children:e.children})})}),t):null}return(0,G.jsx)(Rr,{...e,ref:t})});Pr.displayName=Y;var X=10,[Fr,Z]=yr(Y),Ir=`SelectContentImpl`,Lr=o(`SelectContent.RemoveScroll`),Rr=U.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=J(Y,n),[y,b]=U.useState(null),[S,C]=U.useState(null),w=A(t,e=>b(e)),[T,E]=U.useState(null),[D,k]=U.useState(null),j=_r(n),[M,N]=U.useState(!1),ee=U.useRef(!1);U.useEffect(()=>{if(y)return ce(y)},[y]),te();let P=U.useCallback(e=>{let[t,...n]=j().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&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[j,S]),re=U.useCallback(()=>P([T,y]),[P,T,y]);U.useEffect(()=>{M&&re()},[M,re]);let{onOpenChange:F,triggerPointerDownPosRef:ie}=v;U.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(ie.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(ie.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||F(!1),document.removeEventListener(`pointermove`,t),ie.current=null};return ie.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,F,ie]),U.useEffect(()=>{let e=()=>F(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[ae,oe]=yi(e=>{let t=j().filter(e=>!e.disabled),n=bi(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),I=U.useCallback((e,t,n)=>{let r=!ee.current&&!n;(v.value!==void 0&&v.value===t||r)&&(E(e),r&&(ee.current=!0))},[v.value]),L=U.useCallback(()=>y?.focus(),[y]),le=U.useCallback((e,t,n)=>{let r=!ee.current&&!n;(v.value!==void 0&&v.value===t||r)&&k(e)},[v.value]),ue=r===`popper`?Hr:Br,de=ue===Hr?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,G.jsx)(Fr,{scope:n,content:y,viewport:S,onViewportChange:C,itemRefCallback:I,selectedItem:T,onItemLeave:L,itemTextRefCallback:le,focusSelectedItem:re,selectedItemText:D,position:r,isPositioned:M,searchRef:ae,children:(0,G.jsx)(se,{as:Lr,allowPinchZoom:!0,children:(0,G.jsx)(ne,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:x(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,G.jsx)(O,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,G.jsx)(ue,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...de,onPlaced:()=>N(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:x(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&oe(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=j().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(()=>P(t)),e.preventDefault()}})})})})})})});Rr.displayName=Ir;var zr=`SelectItemAlignedPosition`,Br=U.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=J(Y,n),o=Z(Y,n),[s,c]=U.useState(null),[l,u]=U.useState(null),d=A(t,e=>u(e)),f=_r(n),p=U.useRef(!1),m=U.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=U.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-X,d=ue(a,[X,Math.max(X,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-X,d=ue(a,[X,Math.max(X,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-X*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-X,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${X}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);L(()=>y(),[y]);let[b,x]=U.useState();return L(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,G.jsx)(Ur,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:U.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,G.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,G.jsx)(k.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Br.displayName=zr;var Vr=`SelectPopperPosition`,Hr=U.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=xr(n);return(0,G.jsx)(u,{...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)`}})});Hr.displayName=Vr;var[Ur,Wr]=yr(Y,{}),Gr=`SelectViewport`,Kr=U.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Z(Gr,n),o=Wr(Gr,n),s=A(t,a.onViewportChange),c=U.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)(gr.Slot,{scope:n,children:(0,G.jsx)(k.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:x(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.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`)}}}c.current=t.scrollTop})})})]})});Kr.displayName=Gr;var qr=`SelectGroup`,[Jr,Yr]=yr(qr),Xr=U.forwardRef((e,t)=>{let{__scopeSelect:n,...i}=e,a=r();return(0,G.jsx)(Jr,{scope:n,id:a,children:(0,G.jsx)(k.div,{role:`group`,"aria-labelledby":a,...i,ref:t})})});Xr.displayName=qr;var Zr=`SelectLabel`,Qr=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Yr(Zr,n);return(0,G.jsx)(k.div,{id:i.id,...r,ref:t})});Qr.displayName=Zr;var $r=`SelectItem`,[ei,ti]=yr($r),ni=U.forwardRef((e,t)=>{let{__scopeSelect:n,value:i,disabled:a=!1,textValue:o,...s}=e,c=J($r,n),l=Z($r,n),u=c.value===i,[d,f]=U.useState(o??``),[p,m]=U.useState(!1),h=A(t,e=>l.itemRefCallback?.(e,i,a)),g=r(),_=U.useRef(`touch`),v=()=>{a||(c.onValueChange(i),c.onOpenChange(!1))};if(i===``)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)(ei,{scope:n,value:i,disabled:a,textId:g,isSelected:u,onItemTextChange:U.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,G.jsx)(gr.ItemSlot,{scope:n,value:i,disabled:a,textValue:d,children:(0,G.jsx)(k.div,{role:`option`,"aria-labelledby":g,"data-highlighted":p?``:void 0,"aria-selected":u&&p,"data-state":u?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:h,onFocus:x(s.onFocus,()=>m(!0)),onBlur:x(s.onBlur,()=>m(!1)),onClick:x(s.onClick,()=>{_.current!==`mouse`&&v()}),onPointerUp:x(s.onPointerUp,()=>{_.current===`mouse`&&v()}),onPointerDown:x(s.onPointerDown,e=>{_.current=e.pointerType}),onPointerMove:x(s.onPointerMove,e=>{_.current=e.pointerType,a?l.onItemLeave?.():_.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:x(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:x(s.onKeyDown,e=>{l.searchRef?.current!==``&&e.key===` `||(hr.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})});ni.displayName=$r;var ri=`SelectItemText`,ii=U.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=J(ri,n),s=Z(ri,n),c=ti(ri,n),l=wr(ri,n),[u,d]=U.useState(null),f=A(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=U.useMemo(()=>(0,G.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return L(()=>(h(m),()=>g(m)),[h,g,m]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(k.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Jt.createPortal(a.children,o.valueNode):null]})});ii.displayName=ri;var ai=`SelectItemIndicator`,oi=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return ti(ai,n).isSelected?(0,G.jsx)(k.span,{"aria-hidden":!0,...r,ref:t}):null});oi.displayName=ai;var si=`SelectScrollUpButton`,ci=U.forwardRef((e,t)=>{let n=Z(si,e.__scopeSelect),r=Wr(si,e.__scopeSelect),[i,a]=U.useState(!1),o=A(t,r.onScrollButtonChange);return L(()=>{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)(di,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});ci.displayName=si;var li=`SelectScrollDownButton`,ui=U.forwardRef((e,t)=>{let n=Z(li,e.__scopeSelect),r=Wr(li,e.__scopeSelect),[i,a]=U.useState(!1),o=A(t,r.onScrollButtonChange);return L(()=>{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)(di,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});ui.displayName=li;var di=U.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Z(`SelectScrollButton`,n),o=U.useRef(null),s=_r(n),c=U.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return U.useEffect(()=>()=>c(),[c]),L(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,G.jsx)(k.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:x(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:x(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:x(i.onPointerLeave,()=>{c()})})}),fi=`SelectSeparator`,pi=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,G.jsx)(k.div,{"aria-hidden":!0,...r,ref:t})});pi.displayName=fi;var mi=`SelectArrow`,hi=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=xr(n),a=J(mi,n),o=Z(mi,n);return a.open&&o.position===`popper`?(0,G.jsx)(N,{...i,...r,ref:t}):null});hi.displayName=mi;var gi=`SelectBubbleInput`,_i=U.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=U.useRef(null),a=A(r,i),o=pr(t);return U.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,G.jsx)(k.select,{...n,style:{...M,...n.style},ref:a,defaultValue:t})});_i.displayName=gi;function vi(e){return e===``||e===void 0}function yi(e){let t=xe(e),n=U.useRef(``),r=U.useRef(0),i=U.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=U.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return U.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function bi(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=xi(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 xi(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Si=Tr,Ci=Dr,wi=kr,Ti=jr,Ei=Nr,Di=Pr,Oi=Kr,ki=Qr,Ai=ni,ji=ii,Mi=oi,Ni=ci,Pi=ui,Fi=pi,Ii=Si,Li=wi,Ri=U.forwardRef((e,t)=>{let n=(0,R.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=d(`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)(Ti,{asChild:!0,children:(0,G.jsx)(c,{className:`h-4 w-4 opacity-50`})}),n[6]=s):s=n[6];let l;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(l=(0,G.jsxs)(Ci,{ref:t,className:o,...a,children:[r,s]}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=l):l=n[11],l});Ri.displayName=Ci.displayName;var zi=U.forwardRef((e,t)=>{let n=(0,R.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=d(`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)(b,{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)(Ni,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});zi.displayName=Ni.displayName;var Bi=U.forwardRef((e,t)=>{let n=(0,R.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=d(`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)(c,{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)(Pi,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});Bi.displayName=Pi.displayName;var Vi=U.forwardRef((e,t)=>{let n=(0,R.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=d(`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)(zi,{}),n[8]=u):u=n[8];let f=s===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`,p;n[9]===f?p=n[10]:(p=d(`p-1`,f),n[9]=f,n[10]=p);let m;n[11]!==r||n[12]!==p?(m=(0,G.jsx)(Oi,{className:p,children:r}),n[11]=r,n[12]=p,n[13]=m):m=n[13];let h;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,G.jsx)(Bi,{}),n[14]=h):h=n[14];let g;return n[15]!==s||n[16]!==a||n[17]!==t||n[18]!==l||n[19]!==m?(g=(0,G.jsx)(Ei,{children:(0,G.jsxs)(Di,{ref:t,className:l,position:s,...a,children:[u,m,h]})}),n[15]=s,n[16]=a,n[17]=t,n[18]=l,n[19]=m,n[20]=g):g=n[20],g});Vi.displayName=Di.displayName;var Hi=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`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)(ki,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Hi.displayName=ki.displayName;var Ui=U.forwardRef((e,t)=>{let n=(0,R.c)(14),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className: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=d(`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)(Mi,{children:(0,G.jsx)(f,{className:`h-4 w-4`})})}),n[6]=s):s=n[6];let c;n[7]===r?c=n[8]:(c=(0,G.jsx)(ji,{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)(Ai,{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});Ui.displayName=Ai.displayName;var Wi=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`-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)(Fi,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Wi.displayName=Fi.displayName;function Gi(e){let t=(0,R.c)(14),{className:n,label:r,size:a}=e,o=a===void 0?`md`:a,s=o===`sm`?`h-4 w-4`:o===`lg`?`h-8 w-8`:`h-6 w-6`,c;t[0]===n?c=t[1]:(c=d(`flex h-full items-center justify-center`,n),t[0]=n,t[1]=c);let l;t[2]===s?l=t[3]:(l=d(s,`animate-spin mx-auto text-muted-foreground`),t[2]=s,t[3]=l);let u;t[4]===l?u=t[5]:(u=(0,G.jsx)(i,{className:l}),t[4]=l,t[5]=u);let f;t[6]===r?f=t[7]:(f=r?(0,G.jsx)(`p`,{className:d(I.bodyMuted,`mt-2`),children:r}):null,t[6]=r,t[7]=f);let p;t[8]!==u||t[9]!==f?(p=(0,G.jsxs)(`div`,{className:`text-center`,children:[u,f]}),t[8]=u,t[9]=f,t[10]=p):p=t[10];let m;return t[11]!==c||t[12]!==p?(m=(0,G.jsx)(`div`,{className:c,children:p}),t[11]=c,t[12]=p,t[13]=m):m=t[13],m}function Ki(){let e=(0,R.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(qi)}),e[0]=t):t=e[0],t}function qi(e){return(0,G.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e)}function Ji(){let e=(0,R.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 Yi=new Map;function Xi(e,t){let n=Yi.get(e);return n||(n={promise:t().catch(t=>{throw Yi.delete(e),t})},Yi.set(e,n)),n.promise}function Zi(e){Yi.delete(e)}function Qi(e){for(let t of Yi.keys())t.startsWith(e)&&Yi.delete(t)}function $i(e,t){return(0,U.use)(Xi(e,t))}var ea=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`w-full caption-bottom`,I.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});ea.displayName=`Table`;var ta=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`[&_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});ta.displayName=`TableHeader`;var na=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`[&_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});na.displayName=`TableBody`;var ra=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`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});ra.displayName=`TableFooter`;var ia=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`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});ia.displayName=`TableRow`;var Q=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`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 $=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`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 aa=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(I.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});aa.displayName=`TableCaption`;var oa=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`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});oa.displayName=`Card`;var sa=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`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});sa.displayName=`CardHeader`;var ca=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(I.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});ca.displayName=`CardTitle`;var la=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(I.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});la.displayName=`CardDescription`;var ua=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`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});ua.displayName=`CardContent`;var da=U.forwardRef((e,t)=>{let n=(0,R.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`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});da.displayName=`CardFooter`;var fa=h(`app.async-error-boundary.ui`),pa=class extends U.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){fa.error(`AsyncErrorBoundary caught an error`,{error:e,info: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)(oa,{className:`max-w-md`,children:[(0,G.jsx)(sa,{children:(0,G.jsx)(ca,{className:`text-destructive`,children:this.props.fallbackTitle??`Something went wrong`})}),(0,G.jsxs)(ua,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:I.body,children:e.message}),(0,G.jsx)(w,{variant:`outline`,onClick:this.handleRetry,children:`Retry`})]})]})}):this.props.children}},ma=t({ConversationHistoryView:()=>Ta,default:()=>Ta}),ha=pn(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:e.v0,children:`No history`}),(0,G.jsx)(`p`,{className:e.v1,children:`No conversation history found for this thread.`})]})}),{name:`ConversationHistoryContent_1`}),ga=pn(e=>(0,G.jsxs)(`slot`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-b py-3 px-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.v0,e.v1]}),(0,G.jsxs)(`div`,{className:e.v2,children:[e.v3,` of `,e.v4,` messages`]})]}),e.v5]}),{name:`ConversationHistoryContent_2`,portals:[`v0`,`v1`,`v3`,`v4`,`v5`]}),_a=function(e){let t=(0,R.c)(39),{scope:n,projects:r,loadVersion:i,currentPromptIndex:o,onPromptIndexChange:s}=e,c;t[0]!==i||t[1]!==n?(c=Ca(n,i),t[0]=i,t[1]=n,t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==n?(l=()=>wa(n,r),t[3]=r,t[4]=n,t[5]=l):l=t[5];let u=$i(c,l),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 v=g,y;t[9]!==o||t[10]!==u.messages||t[11]!==s?(y=function(){u.messages&&o<u.messages.length-1&&s(o+1)},t[9]=o,t[10]=u.messages,t[11]=s,t[12]=y):y=t[12];let b=y,x;t[13]!==o||t[14]!==s?(x=function(){o>0&&s(o-1)},t[13]=o,t[14]=s,t[15]=x):x=t[15];let C=x;if(!u.messages?.length){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(ha,{v0:I.emptyStateTitle,v1:I.bodyMuted}),t[16]=e):e=t[16],e}let D=o===0,O;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,G.jsx)(T,{className:`h-4 w-4 mr-1`}),t[17]=O):O=t[17];let k;t[18]!==C||t[19]!==D?(k=(0,G.jsx)(w,{variant:`outline`,size:`sm`,onClick:C,disabled:D,children:O}),t[18]=C,t[19]=D,t[20]=k):k=t[20];let A=o>=u.messages.length-1,j;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,G.jsx)(S,{className:`h-4 w-4 ml-1`}),t[21]=j):j=t[21];let M;t[22]!==b||t[23]!==A?(M=(0,G.jsx)(w,{variant:`outline`,size:`sm`,onClick:b,disabled:A,children:j}),t[22]=b,t[23]=A,t[24]=M):M=t[24];let N=o+1,ee=u.messages.length,te;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,G.jsx)(ta,{children:(0,G.jsxs)(ia,{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[25]=te):te=t[25];let P;if(t[26]!==o||t[27]!==u.messages){let e;t[29]===o?e=t[30]:(e=(e,t)=>{let{inputTokens:n,outputTokens:r}=v(e);return(0,G.jsxs)(ia,{className:t===o?`bg-muted/50`:``,children:[(0,G.jsx)($,{className:`max-w-md`,children:(0,G.jsx)(`div`,{className:I.body,children:(0,G.jsx)(ba,{text:e.request.message})})}),(0,G.jsx)($,{className:`max-w-md`,children:e.response?(0,G.jsx)(`div`,{className:I.body,children:(0,G.jsx)(ba,{text:e.response.content})}):(0,G.jsx)(`span`,{className:d(I.bodyMuted,`italic`),children:`No response`})}),(0,G.jsx)($,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(Se,{className:`h-3 w-3 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,G.jsx)($,{className:d(I.caption,`text-right`),children:e.response?(0,G.jsx)(we,{children:(0,G.jsxs)(_,{children:[(0,G.jsx)(a,{asChild:!0,children:(0,G.jsx)(`div`,{className:`cursor-help`,children:h(e.timestamp,e.response.completedAt).display})}),(0,G.jsx)(E,{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:d(I.bodyMuted,`text-right`),children:n>0?n.toLocaleString():`-`}),(0,G.jsx)($,{className:d(I.bodyMuted,`text-right`),children:r>0?r.toLocaleString():`-`}),(0,G.jsx)($,{className:d(I.bodyMuted,`text-right`),children:p(e.timestamp)})]},e.id)},t[29]=o,t[30]=e),P=u.messages.map(e),t[26]=o,t[27]=u.messages,t[28]=P}else P=t[28];let ne;t[31]===P?ne=t[32]:(ne=(0,G.jsx)(re,{className:`h-full`,children:(0,G.jsx)(`div`,{className:`py-4`,children:(0,G.jsxs)(ea,{children:[te,(0,G.jsx)(na,{children:P})]})})}),t[31]=P,t[32]=ne);let F;return t[33]!==u.messages.length||t[34]!==k||t[35]!==M||t[36]!==N||t[37]!==ne?(F=(0,G.jsx)(ga,{v0:k,v1:M,v2:I.bodyMuted,v3:N,v4:ee,v5:ne}),t[33]=u.messages.length,t[34]=k,t[35]=M,t[36]=N,t[37]=ne,t[38]=F):F=t[38],F},va=h(`app.conversation-history-view.ui`),ya=`__ALL_PROJECTS__`;function ba(e){let t=(0,R.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 xa(e,t){let n=`${t} - `,r=e.title??e.threadId;return r.startsWith(n)?r.slice(n.length):r}async function Sa(e){let t=[],n=new Set,r=``;for(let i of e)try{let e=await me(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){va.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 Ca(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 wa(e,t){if(e.type===`thread`)return await me(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 Sa(n.threads);return{threadId:e.projectId,...r}}return{threadId:ya,...await Sa(t.flatMap(e=>e.threads))}}var Ta=(0,U.memo)(function({isOpen:e,onClose:t,initialFilter:r,projects:i,inline:a}){let[o,s]=(0,U.useState)(0),[c,l]=(0,U.useState)(``),[u,d]=(0,U.useState)(``),[f,p]=(0,U.useState)(!1),[h,g]=(0,U.useState)(!1),[_,v]=(0,U.useState)(0),[y,b]=(0,U.useState)(null),[x,S]=(0,U.useState)(null),C=(0,U.useMemo)(()=>u?{type:`thread`,threadId:u}:c===ya?{type:`all`}:c?{type:`project`,projectId:c}:null,[c,u]),T=C?Ca(C,_):null;(0,U.useEffect)(()=>{e&&r?r.type===`thread`?(d(r.id),l(``),s(0)):r.type===`project`&&(l(r.id),d(``),s(0)):e&&!r?(l(ya),d(``),s(0)):e||(d(``),l(``),s(0),S(null),b(null))},[e,r]);let E=e=>{d(e),l(``),s(0),b(null),S(null)},D=e=>{l(e),d(``),s(0),b(null),S(null)},O=(0,U.useCallback)(()=>{if(u){let e=i.flatMap(e=>e.threads).find(e=>e.threadId===u),t=i.find(e=>e.threads.some(e=>e.threadId===u)),n=e?xa(e,t?.name??t?.projectId??``):u;return{options:{threadId:u},title:`Clear Thread History`,description:`Permanently delete all conversation history for "${n}"? This cannot be undone.`}}if(c&&c!==ya){let e=i.find(e=>e.projectId===c)?.name??c;return{options:{projectId:c},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.`}},[i,c,u]),k=(0,U.useCallback)(async()=>{let e=O();g(!0),S(null);try{await ee(e.options),T&&Zi(T),b(T),s(0),p(!1)}catch(e){S(e instanceof Error?e.message:`Failed to clear conversation history`)}finally{g(!1)}},[O,T]);function A(){C&&Zi(Ca(C,_)),v(e=>e+1),b(null),S(null)}let j=O();if(!e)return null;let M=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Ii,{value:c,onValueChange:D,children:[(0,G.jsx)(Ri,{className:`w-48`,children:(0,G.jsx)(Li,{placeholder:`Select project`})}),(0,G.jsxs)(Vi,{children:[(0,G.jsx)(Ui,{value:ya,children:`All Projects`}),i.map(e=>(0,G.jsx)(Ui,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]}),(0,G.jsxs)(Ii,{value:u,onValueChange:E,children:[(0,G.jsx)(Ri,{className:`w-48`,children:(0,G.jsx)(Li,{placeholder:`Select thread`})}),(0,G.jsx)(Vi,{children:i.flatMap(e=>e.threads.map(t=>(0,G.jsx)(Ui,{value:t.threadId,children:xa(t,e.name??e.projectId)},t.threadId)))})]}),(0,G.jsxs)(w,{variant:`outline`,size:`sm`,onClick:()=>p(!0),disabled:h,children:[(0,G.jsx)(n,{className:`h-4 w-4 mr-2`}),`Clear`]})]}),N=(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsx)(`div`,{className:a?void 0:`border-b px-6 py-4`,children:(0,G.jsx)(rr,{title:`History`,description:a?`View and browse conversation history across projects and threads.`:void 0,action:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[M,a?null:(0,G.jsx)(w,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,G.jsx)(m,{})})]})})}),(0,G.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:x?(0,G.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,G.jsxs)(oa,{className:`max-w-md`,children:[(0,G.jsx)(sa,{children:(0,G.jsx)(ca,{className:`text-destructive`,children:`Error`})}),(0,G.jsxs)(ua,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{children:x}),(0,G.jsx)(w,{onClick:()=>S(null),children:`Dismiss`})]})]})}):y&&y===T?(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:I.emptyStateTitle,children:`No history`}),(0,G.jsx)(`p`,{className:I.bodyMuted,children:`No conversation history found for this thread.`})]})}):C?(0,G.jsx)(pa,{fallbackTitle:`Failed to load conversation history`,onRetry:A,children:(0,G.jsx)(U.Suspense,{fallback:(0,G.jsx)(Gi,{label:`Loading conversation history...`,size:`lg`}),children:(0,G.jsx)(_a,{scope:C,projects:i,loadVersion:_,currentPromptIndex:o,onPromptIndexChange:s},T??void 0)})}):(0,G.jsx)(Gi,{label:`Loading conversation history...`,size:`lg`})})]});return(0,G.jsxs)(G.Fragment,{children:[a?(0,G.jsx)(lr,{children:(0,G.jsx)(ir,{className:`max-w-none w-full h-full flex flex-col min-h-0`,children:N})}):(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background`,children:N}),(0,G.jsx)(Kn,{open:f,onOpenChange:p,children:(0,G.jsxs)(Yn,{children:[(0,G.jsxs)(Xn,{children:[(0,G.jsx)(Qn,{children:j.title}),(0,G.jsx)($n,{children:j.description})]}),(0,G.jsxs)(Zn,{children:[(0,G.jsx)(tr,{disabled:h,children:`Cancel`}),(0,G.jsx)(er,{onClick:e=>{e.preventDefault(),k()},disabled:h,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:h?`Clearing...`:`Clear`})]})]})})]})});export{tr as A,sr as C,lr as D,ir as E,Qn as F,pn as I,$n as M,Zn as N,Kn as O,Xn as P,rr as S,ur as T,pr as _,$i as a,fr as b,Ji as c,Ii as d,Vi as f,Li as g,Ri as h,ua as i,Yn as j,er as k,Gi as l,Wi as m,pa as n,Zi as o,Ui as p,oa as r,Qi as s,ma as t,Ki as u,ar as v,dr as w,cr as x,or as y};
|