tarsk 0.5.49 → 0.5.51
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/README.md +85 -3
- package/dist/index.js +10869 -8554
- package/dist/public/assets/{account-view-DxHV7OtO.js → account-view-CGokQA1o.js} +1 -1
- package/dist/public/assets/api-BRrGio-B.js +1 -0
- package/dist/public/assets/browser-tab-B3BybVD0.js +1 -0
- package/dist/public/assets/commit-dialog-BLzHl6oN.js +1 -0
- package/dist/public/assets/context-menu-yKNgVtVk.js +1 -0
- package/dist/public/assets/create-repo-dialog-DHFloJc3.js +1 -0
- package/dist/public/assets/{dialogs-config-BEazgV7k.js → dialogs-config-BF_RyK5j.js} +14 -14
- package/dist/public/assets/diff-view-DONeogdk.js +3 -0
- package/dist/public/assets/explorer-tab-view-C1Dex751.js +2 -0
- package/dist/public/assets/{explorer-tree-CiPMm5ck.js → explorer-tree-BmsrsMXJ.js} +1 -1
- package/dist/public/assets/explorer-view-1fAca9It.js +1 -0
- package/dist/public/assets/git-history-dialog-DXsSt3e0.js +1 -0
- package/dist/public/assets/git-ops-button-Cj3j4bvy.js +2 -0
- package/dist/public/assets/history-view-COEFPP2U.js +9 -0
- package/dist/public/assets/index-Dsj5zHdU.js +73 -0
- package/dist/public/assets/index-DzUALYN4.css +1 -0
- package/dist/public/assets/mcp-server-card-3bFOnHFO.js +1 -0
- package/dist/public/assets/merged-pr-dialog-C5vgSXwq.js +1 -0
- package/dist/public/assets/model-star-rating-GWRgO9pY.js +1 -0
- package/dist/public/assets/onboarding-B_n7I3ri.js +1 -0
- package/dist/public/assets/project-settings-view-DsVEiQM_.js +1 -0
- package/dist/public/assets/providers-list-view-BT5XZP-F.js +1 -0
- package/dist/public/assets/pull-request-dialog-BO_7fALs.js +1 -0
- package/dist/public/assets/pull-with-changes-dialog-DQSC-HUH.js +1 -0
- package/dist/public/assets/push-before-pr-dialog-B9evx_c7.js +1 -0
- package/dist/public/assets/radio-group-CNuRXtN5.js +1 -0
- package/dist/public/assets/react-vendor-D-z0br-z.js +16 -0
- package/dist/public/assets/settings-general-view-BaTUBgdM.js +1 -0
- package/dist/public/assets/settings-instructions-view-Bit7tYRh.js +1 -0
- package/dist/public/assets/settings-list-Cc_0YmxB.js +1 -0
- package/dist/public/assets/settings-mcp-servers-view-BcuuyWhI.js +5 -0
- package/dist/public/assets/{settings-models-skeleton-Cse6L-Nd.js → settings-models-skeleton-BfIx9XDs.js} +1 -1
- package/dist/public/assets/{settings-models-view-BAxf3eJq.js → settings-models-view-CNFB1Iqn.js} +1 -1
- package/dist/public/assets/settings-rules-view-BvelCH4j.js +8 -0
- package/dist/public/assets/settings-skills-view-DV-cA6cj.js +3 -0
- package/dist/public/assets/settings-slash-commands-view-CKxQnzse.js +1 -0
- package/dist/public/assets/settings-subagents-view-DAl5Db-p.js +2 -0
- package/dist/public/assets/{settings-system-prompt-view-B1vc2cgC.js → settings-system-prompt-view-BdwsxqMo.js} +1 -1
- package/dist/public/assets/settings-view-BxiazdKG.js +2 -0
- package/dist/public/assets/{skeleton-6mGMglV0.js → skeleton-DJZ5x6e0.js} +1 -1
- package/dist/public/assets/{slug-utils-BT1eqWhW.js → slug-utils-D4uxO5qv.js} +1 -1
- package/dist/public/assets/{tabs-iUSYYupj.js → tabs-TGCt-ze0.js} +1 -1
- package/dist/public/assets/{terminal-panel-DIpnKR-N.js → terminal-panel-Bh_CKydu.js} +2 -2
- package/dist/public/assets/todos-view-DDSSplmi.js +17 -0
- package/dist/public/assets/{ui-components-kSaUEA_X.js → ui-components-JEH8JAJ7.js} +1 -1
- package/dist/public/assets/{use-deferred-search-DGJskNBr.js → use-deferred-search-BZg7Bt7W.js} +1 -1
- package/dist/public/assets/{utils-CECQ_-6N.js → utils-H-1x3dmp.js} +1 -1
- package/dist/public/assets/{vosk-speech-CgILeNJR.js → vosk-speech-FJiKHPe4.js} +2 -2
- package/dist/public/assets/{web-DGalafxk.js → web-B4cuelyi.js} +1 -1
- package/dist/public/assets/{web-BD1sqxMq.js → web-CQpWcSn8.js} +1 -1
- package/dist/public/assets/{web-BWAZk7ug.js → web-Cq4yC7dg.js} +1 -1
- package/dist/public/assets/{web-Dt5YgbhM.js → web-DOZOaJlj.js} +1 -1
- package/dist/public/index.html +8 -8
- package/package.json +1 -1
- package/dist/public/assets/api-Dhzdgb40.js +0 -1
- package/dist/public/assets/browser-tab-qhf-xKwZ.js +0 -1
- package/dist/public/assets/commit-dialog-DcVXFOBP.js +0 -1
- package/dist/public/assets/context-menu-PIC-g8wy.js +0 -1
- package/dist/public/assets/create-repo-dialog-CsjpTBPU.js +0 -1
- package/dist/public/assets/diff-view-CGEl0YbC.js +0 -3
- package/dist/public/assets/explorer-tab-view--ib_BjId.js +0 -2
- package/dist/public/assets/explorer-view-odyQutTO.js +0 -1
- package/dist/public/assets/git-history-dialog-qUZ7Qsp4.js +0 -1
- package/dist/public/assets/git-ops-button-Bced-_39.js +0 -2
- package/dist/public/assets/history-view-BMVTxWTg.js +0 -9
- package/dist/public/assets/index-C7FLshNp.css +0 -1
- package/dist/public/assets/index-_SOdLUMq.js +0 -73
- package/dist/public/assets/mcp-server-card-ChdAZekt.js +0 -1
- package/dist/public/assets/merged-pr-dialog-DAXqT4Xe.js +0 -1
- package/dist/public/assets/model-star-rating-BzpXBjSo.js +0 -1
- package/dist/public/assets/onboarding-Bi5MieW-.js +0 -1
- package/dist/public/assets/project-settings-view-CHV6lJG4.js +0 -1
- package/dist/public/assets/providers-list-view-Dgid2Wui.js +0 -1
- package/dist/public/assets/pull-request-dialog-BFgRF5AH.js +0 -1
- package/dist/public/assets/pull-with-changes-dialog-oGP-j8Yw.js +0 -1
- package/dist/public/assets/push-before-pr-dialog-BQ0QC6Qu.js +0 -1
- package/dist/public/assets/radio-group-n9qyUxmu.js +0 -1
- package/dist/public/assets/react-vendor-iDwBzcYF.js +0 -16
- package/dist/public/assets/settings-general-view-Vwi9J6Tn.js +0 -1
- package/dist/public/assets/settings-instructions-view-8YIr0PO3.js +0 -1
- package/dist/public/assets/settings-list-owWkHWxE.js +0 -1
- package/dist/public/assets/settings-mcp-servers-view-CCXW_uet.js +0 -5
- package/dist/public/assets/settings-rules-view-D3KLTKVZ.js +0 -8
- package/dist/public/assets/settings-skills-view-DaqOna-w.js +0 -3
- package/dist/public/assets/settings-slash-commands-view-CN8_DTYX.js +0 -1
- package/dist/public/assets/settings-subagents-view-BIejA-ck.js +0 -2
- package/dist/public/assets/settings-view-DLBIkYoA.js +0 -2
- package/dist/public/assets/todos-view-BK6i_oPT.js +0 -17
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$ as t,$o as n,Ao as r,Fr as i,Ir as a,It as o,Ja as s,K as c,Mi as l,Mo as u,Pi as d,Qr as f,Rr as p,Wn as m,Xr as h,Zt as g,ao as _,c as v,ds as y,ei as b,es as x,fo as S,fs as C,ko as w,lt as T,mo as E,ms as D,ni as O,oo as k,st as A,ta as j,ti as ee,uo as te,wa as M}from"./dialogs-config-BF_RyK5j.js";import{N}from"./react-vendor-D-z0br-z.js";import{t as P}from"./monaco-CZnIWXyV.js";import{I as F,a as ne,l as I,n as L,o as re}from"./history-view-COEFPP2U.js";import{d as ie}from"./onboarding-B_n7I3ri.js";import{n as ae}from"./utils-H-1x3dmp.js";import{I as oe,L as se,R as ce,V as le,c as ue,d as de,f as fe,l as R,u as pe,y as me,z as he}from"./index-Dsj5zHdU.js";import{a as z,n as ge,r as _e,t as ve}from"./context-menu-yKNgVtVk.js";var B=e(D(),1),V=C(),H=y();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:j.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)(v,{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 ye(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`},be={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function G(e){return d(d(j.compact,`status-badge font-mono font-semibold`),W[e]??`text-orange-500`)}function xe(e){return be[e]??`M`}var K=F(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=F(e=>e.v0,{name:`DiffTree_1`,portals:[`v0`]}),J=F(e=>e.v0,{name:`DiffTree_2`,portals:[`v0`]}),Se=F(e=>e.v0,{name:`DiffTree_3`,portals:[`v0`]}),Ce=function(e){let t=(0,V.c)(32),{treeData:i,files:a,error:o,selectedFileIndex:c,onFileSelect:l,onRevertFile:f}=e,p;t[0]===a?p=t[1]:(p=a.reduce(Y,0),t[0]=a,t[1]=p);let m=p,h;t[2]===a?h=t[3]:(h=a.reduce(Oe,0),t[2]=a,t[3]=h);let g=h,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=d(j.compact,`text-muted-foreground`),t[4]=_):_=t[4];let v=a.length,y=a.length===1?``:`s`,b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=d(j.compact,`text-green-500`),t[5]=b):b=t[5];let x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=d(j.compact,`text-red-500`),t[6]=x):x=t[6];let S;t[7]!==a.length||t[8]!==y||t[9]!==m||t[10]!==g?(S=(0,H.jsx)(K,{v0:_,v1:v,v2:y,v3:b,v4:m,v5:x,v6:g}),t[7]=a.length,t[8]=y,t[9]=m,t[10]=g,t[11]=S):S=t[11];let C=S;if(o){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=d(j.compact,`text-destructive text-center`),t[12]=e):e=t[12];let n;t[13]===o?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:o})}),t[13]=o,t[14]=n);let r;return t[15]!==C||t[16]!==n?(r=(0,H.jsx)(q,{v0:(0,H.jsx)(U,{title:`Review Changes`,subtitle:C,children:n})}),t[15]=C,t[16]=n,t[17]=r):r=t[17],r}if(a.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:d(j.compact,j.bodyMuted,`text-center`),children:`No changes to review`})}),t[18]=e):e=t[18];let n;return t[19]===C?n=t[20]:(n=(0,H.jsx)(J,{v0:(0,H.jsx)(U,{title:`Review Changes`,subtitle:C,children:e})}),t[19]=C,t[20]=n),n}let T;t[21]!==a||t[22]!==l||t[23]!==f||t[24]!==c?(T=(e,t)=>{let{isOpen:i,toggle:o}=t,p=!!e.children,m=(0,H.jsxs)(ie,{onClick:()=>{p?o():e.fileIndex!==void 0&&l(e.fileIndex)},selected:!p&&e.fileIndex===c,className:`gap-1.5`,children:[p?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(n,{className:d(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,i&&`rotate-90`)}),i?(0,H.jsx)(r,{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)(u,{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}),!p&&e.status&&(0,H.jsx)(`span`,{className:G(e.status),children:xe(e.status)})]});return p?m:(0,H.jsxs)(ve,{children:[(0,H.jsx)(z,{asChild:!0,children:(0,H.jsx)(`div`,{children:m})}),(0,H.jsx)(ge,{children:(0,H.jsxs)(_e,{onClick:()=>{e.fileIndex!==void 0&&f?.(a[e.fileIndex])},children:[(0,H.jsx)(s,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[21]=a,t[22]=l,t[23]=f,t[24]=c,t[25]=T):T=t[25];let E;t[26]!==T||t[27]!==i?(E=(0,H.jsx)(`div`,{className:`px-1 pt-3 pb-2`,children:(0,H.jsx)(oe,{nodes:i,defaultOpen:!0,resetKey:i,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:T})}),t[26]=T,t[27]=i,t[28]=E):E=t[28];let D;return t[29]!==C||t[30]!==E?(D=(0,H.jsx)(Se,{v0:(0,H.jsx)(U,{title:`Review Changes`,subtitle:C,children:E})}),t[29]=C,t[30]=E,t[31]=D):D=t[31],D};function we(e){return e.type===`add`}function Te(e,t){return e+t.changes.filter(we).length}function Y(e,t){return e+t.hunks.reduce(Te,0)}function Ee(e){return e.type===`delete`}function De(e,t){return e+t.changes.filter(Ee).length}function Oe(e,t){return e+t.hunks.reduce(De,0)}var ke=F(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,o=Z(n,r,i),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=d(j.caption,`px-3 py-1.5 border-b text-muted-foreground bg-muted/30`),t[0]=s):s=t[0];let c=`${a} - ${r}`,l;return t[1]!==a||t[2]!==o||t[3]!==c?(l=(0,H.jsx)(ke,{v0:s,v1:a,v2:o,v3:c}),t[1]=a,t[2]=o,t[3]=c,t[4]=l):l=t[4],l};function Ae(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=Ae(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=()=>T(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 je(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)(I,{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)(I,{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)(I,{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 Me(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=d(`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 Ne(e){let t=(0,V.c)(36),{open:n,lineNumber:r,lineContent:i,initialComment:a,isEditing:o,onSave:s,onDelete:c,onClose:u}=e,[p,m]=(0,B.useState)((a===void 0?``:a)??``),g;t[0]!==s||t[1]!==p?(g=()=>{p.trim()&&s(p.trim())},t[0]=s,t[1]=p,t[2]=g):g=t[2];let _=g,v;t[3]===_?v=t[4]:(v=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),_())},t[3]=_,t[4]=v);let y=v,x;t[5]===u?x=t[6]:(x=e=>{e||u()},t[5]=u,t[6]=x);let S;t[7]===r?S=t[8]:(S=(0,H.jsx)(ee,{children:(0,H.jsxs)(O,{children:[`Comment on line `,r]})}),t[7]=r,t[8]=S);let C;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=d(j.compact,`font-mono rounded bg-muted px-3 py-2 text-muted-foreground overflow-x-auto whitespace-pre`),t[9]=C):C=t[9];let w=i||` `,T;t[10]===w?T=t[11]:(T=(0,H.jsx)(`div`,{className:C,children:w}),t[10]=w,t[11]=T);let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>m(e.target.value),t[12]=E):E=t[12];let D;t[13]!==y||t[14]!==p?(D=(0,H.jsx)(se,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:p,onChange:E,onKeyDown:y,rows:12,className:`resize-none text-base`}),t[13]=y,t[14]=p,t[15]=D):D=t[15];let k;t[16]!==o||t[17]!==c?(k=o&&c&&(0,H.jsx)(l,{variant:`destructive`,size:`sm`,onClick:c,className:`mr-auto`,children:`Delete`}),t[16]=o,t[17]=c,t[18]=k):k=t[18];let A;t[19]===p?A=t[20]:(A=p.trim(),t[19]=p,t[20]=A);let te=!A,M;t[21]!==_||t[22]!==te?(M=(0,H.jsx)(l,{size:`sm`,onClick:_,disabled:te,children:`Save`}),t[21]=_,t[22]=te,t[23]=M):M=t[23];let N;t[24]!==k||t[25]!==M?(N=(0,H.jsxs)(b,{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]!==D||t[28]!==N||t[29]!==S||t[30]!==T?(P=(0,H.jsxs)(f,{className:`max-w-2xl`,children:[S,T,D,N]}),t[27]=D,t[28]=N,t[29]=S,t[30]=T,t[31]=P):P=t[31];let F;return t[32]!==n||t[33]!==P||t[34]!==x?(F=(0,H.jsx)(h,{open:n,onOpenChange:x,children:P}),t[32]=n,t[33]=P,t[34]=x,t[35]=F):F=t[35],F}var Pe=F(e=>e.v0,{name:`ReviewLoadingFallback_1`,portals:[`v0`]}),Fe=F(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`]}),Ie=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)(Pe,{v0:(0,H.jsx)(I,{label:`Loading review changes...`})}),t[2]=e):e=t[2],e}let s;return t[3]===n?s=t[4]:(s=(0,H.jsx)(Fe,{v0:j.bodyMuted,v1:(0,H.jsx)(l,{variant:`outline`,onClick:n,children:`Retry`})}),t[3]=n,t[4]=s),s};function Le(e,t){return`git-diff:${e}:${t}`}function Q(){return Error(`Loading review changes timed out. Please try again.`)}async function Re(e,t=15e3){return Promise.race([A(e),new Promise((e,n)=>{window.setTimeout(()=>n(Q()),t)})])}function ze({threadId:e,onExit:r,loadVersion:s}){let u=ne(Le(e,s),()=>Re(e)),f=ce(),h=he(e=>e.diffComments),v=he(e=>e.projectModelSelections),{resolvedTheme:y}=ae(),b=me(),[C,w]=(0,B.useState)(u.files||[]),[T,D]=(0,B.useState)(null),[O,ee]=(0,B.useState)(0),[F,I]=(0,B.useState)(!1),[L,re]=(0,B.useState)(!1),[ie,oe]=(0,B.useState)(!1),[se,R]=(0,B.useState)(!0),z=(0,B.useRef)(null);(0,B.useEffect)(()=>{R(!0)},[e]);let ge=(0,B.useCallback)(e=>{ee(e),b&&R(!1)},[b]),_e=(0,B.useCallback)(()=>{R(!0)},[]),ve=b&&!se,V=(0,B.useMemo)(()=>h[e]??[],[h,e]),U=(0,B.useCallback)(t=>{let n=h[e]??[],r=typeof t==`function`?t(n):t;f({type:le.SetDiffComments,threadId:e,comments:r})},[f,e,h]),[W,be]=(0,B.useState)(null),[G,xe]=(0,B.useState)(null),[K,q]=(0,B.useState)(null),J=(0,B.useRef)(null),Se=(0,B.useRef)(V),we=(0,B.useRef)(W),Te=(0,B.useRef)({isFullView:F,selectedFileIndex:O,files:C}),Y=(0,B.useRef)({original:[],modified:[]}),Ee=(0,B.useRef)(!0);(0,B.useEffect)(()=>{Se.current=V},[V]),(0,B.useEffect)(()=>{we.current=W},[W]),(0,B.useEffect)(()=>{Te.current={isFullView:F,selectedFileIndex:O,files:C}},[F,O,C]);let De=(0,B.useCallback)(()=>{z.current&&(L?z.current.expand():z.current.collapse())},[L]),Oe=(0,B.useCallback)(async()=>{if(e){D(null);try{w((await A(e)).files||[]),ee(0)}catch(e){D(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),ke=(0,B.useCallback)(async t=>{try{await g(e,t.path),await Oe()}catch(e){D(e instanceof Error?e.message:`Failed to revert file`)}},[e,Oe]),X=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if((h[e]??[]).length>0){X.current=!0;return}o(e).then(t=>{t.diffComments&&t.diffComments.length>0&&f({type:le.SetDiffComments,threadId:e,comments:t.diffComments}),X.current=!0}).catch(()=>{X.current=!0})},[e]),(0,B.useEffect)(()=>{X.current&&m(e,{diffComments:V}).catch(()=>{})},[e,V]);let Ae=(0,B.useMemo)(()=>ye(C),[C]),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}},Pe=(e,t,n)=>e.split(`
|
|
2
|
+
`).slice(t-1,n).join(`
|
|
3
|
+
`),Fe=e=>{let t=Z(e);return t?t.startLine<=1:!0},Ie=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=C[O],ze=Q?.isBinary??!1,Be=Q?F?Q.oldContent:(()=>{let e=Z(Q);return e?Pe(Q.oldContent,e.startLine,e.endLine):Q.oldContent})():``,Ve=Q?F?Q.newContent:(()=>{let e=Z(Q);return e?Pe(Q.newContent,e.startLine,e.endLine):Q.newContent})():``,$=(0,B.useCallback)(()=>{if(!Ee.current)return;let e=J.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=Te.current,i=Se.current,a=we.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:P.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:P.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,O,F,Q]),(0,B.useEffect)(()=>()=>{J.current=null,Y.current={original:[],modified:[]}},[O]),(0,B.useEffect)(()=>()=>{Ee.current=!1,J.current&&=(J.current.getOriginalEditor().getModel()?.dispose(),J.current.getModifiedEditor().getModel()?.dispose(),J.current.dispose(),null),Y.current={original:[],modified:[]}},[]);let He=(0,B.useCallback)(e=>{J.current=e;let t=e=>e===P.MouseTargetType.GUTTER_GLYPH_MARGIN||e===P.MouseTargetType.GUTTER_LINE_NUMBERS||e===P.MouseTargetType.GUTTER_LINE_DECORATIONS||e===P.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}=Te.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=Se.current.find(e=>e.fileIndex===o&&e.lineNumber===u&&e.side===n);f?q(f):xe({lineNumber:u,lineContent:d,side:n})})};n(e.getOriginalEditor(),`original`),n(e.getModifiedEditor(),`modified`),setTimeout(()=>{J.current===e&&$()},150)},[$]),Ue=(0,B.useCallback)(e=>{if(G&&Q){let t={id:`comment-${Date.now()}`,filePath:Q.path,fileIndex:O,lineNumber:G.lineNumber,lineContent:G.lineContent,comment:e,side:G.side};U(e=>[...e,t]),xe(null)}else K&&(U(t=>t.map(t=>t.id===K.id?{...t,comment:e}:t)),q(null))},[G,K,Q,O,U]),We=(0,B.useCallback)(()=>{K&&(U(e=>e.filter(e=>e.id!==K.id)),q(null))},[K,U]),Ge=(0,B.useCallback)(e=>{if(V.length===0)return;let t=(e%V.length+V.length)%V.length,n=V[t];be(t),ee(n.fileIndex),b&&R(!1),setTimeout(()=>{let e=J.current;if(!e)return;let t=C[n.fileIndex];if(!t)return;let r=F?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,C,F,$,b]),Ke=(0,B.useCallback)(()=>{Ge((W??0)-1)},[Ge,W]),qe=(0,B.useCallback)(()=>{Ge((W??-1)+1)},[Ge,W]),Je=(0,B.useCallback)(async()=>{let n=v[e];if(!n)try{let e=await t(),r=Object.values(e).flat();if(r.length>0)n=r[0];else{console.error(`No models available to process comments`);return}}catch(e){console.error(`Failed to load models:`,e);return}let i=n.id,a=n.provider;try{let{prompt:t}=await c(e,V);U([]),f({type:le.SetPendingChatMessage,message:{threadId:e,message:t,model:i,provider:a}}),r()}catch(e){console.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[V,v,f,e,r,U]),Ye={readOnly:!0,renderSideBySide:!b,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:Q&&(F||Fe(Q))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0},Xe=(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)(Ce,{treeData:Ae,files:C,error:T,selectedFileIndex:O,onFileSelect:ge,onRevertFile:ke})}),Ze=(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)(ue,{className:d(`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:[ve?(0,H.jsxs)(l,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:_e,children:[(0,H.jsx)(_,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):(0,H.jsxs)(l,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:De,children:[L?(0,H.jsx)(_,{className:`h-4 w-4`}):(0,H.jsx)(k,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),(0,H.jsx)(`span`,{className:d(j.label,`text-foreground`),children:Q?Q.path:`Review Changes`})]}),(0,H.jsxs)(`div`,{className:d(`flex items-center gap-2`,L&&`ml-0`,!L&&`ml-auto`,`md:ml-auto`),children:[!ze&&(0,H.jsx)(l,{variant:`ghost`,size:`sm`,onClick:()=>I(e=>!e),disabled:!Q,className:d(j.compact,`h-8 gap-1 px-2`),children:F?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(te,{className:`h-3 w-3`}),` Show changes only`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(E,{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)(i,{children:[(0,H.jsx)(p,{asChild:!0,children:(0,H.jsx)(l,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Ke,disabled:(W??0)===0,children:(0,H.jsx)(x,{className:`h-3 w-3`})})}),(0,H.jsx)(a,{children:`Previous comment`})]}),(0,H.jsx)(`span`,{className:d(j.caption,`whitespace-nowrap`),children:V.length===1?`1 Comment`:`Comment ${(W??0)+1} of ${V.length}`}),(0,H.jsxs)(i,{children:[(0,H.jsx)(p,{asChild:!0,children:(0,H.jsx)(l,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:qe,disabled:(W??0)===V.length-1,children:(0,H.jsx)(n,{className:`h-3 w-3`})})}),(0,H.jsx)(a,{children:`Next comment`})]})]}),V.length>0&&(0,H.jsxs)(i,{children:[(0,H.jsx)(p,{asChild:!0,children:(0,H.jsxs)(l,{size:`sm`,onClick:Je,className:d(j.compact,`h-8 gap-1 px-3 bg-foreground text-background hover:bg-foreground/90`),children:[(0,H.jsx)(S,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,H.jsx)(a,{children:`Send all comments to Tarsk for resolution`})]})]})]}),(0,H.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[ze&&Q?(0,H.jsx)(je,{threadId:e,file:Q}):(0,H.jsx)(N,{height:`100%`,language:Ie(Q?.path||``),original:Be,modified:Ve,theme:y===`dark`?`vs-dark`:`vs-light`,onMount:He,options:Ye},`diff-${O}`),(0,H.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 right-4 z-20 flex flex-col items-end gap-3`,children:[ie&&(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)(l,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>oe(!1),children:[(0,H.jsx)(M,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Close chat`})]})}),(0,H.jsx)(fe,{})]}),!ie&&(0,H.jsxs)(i,{children:[(0,H.jsx)(p,{asChild:!0,children:(0,H.jsxs)(l,{size:`icon`,className:`pointer-events-auto h-12 w-12 rounded-full shadow-lg`,onClick:()=>oe(!0),children:[(0,H.jsx)(S,{className:`h-5 w-5`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Open review chat`})]})}),(0,H.jsx)(a,{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:b?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:d(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,!se&&`hidden`),children:Xe}),(0,H.jsx)(`div`,{className:d(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,se&&`hidden`),children:Ze})]}):(0,H.jsxs)(de,{direction:`horizontal`,children:[(0,H.jsx)(pe,{ref:z,defaultSize:25,minSize:12,maxSize:40,collapsible:!0,collapsedSize:0,onCollapse:()=>re(!0),onExpand:()=>re(!1),className:`border-r border-transparent`,children:Xe}),(0,H.jsx)(Me,{isOpen:!L}),(0,H.jsx)(pe,{className:`overflow-hidden border-l border-border bg-transparent`,children:Ze})]})}),(0,H.jsx)(Ne,{open:G!==null||K!==null,lineNumber:K?.lineNumber??G?.lineNumber??0,lineContent:K?.lineContent??G?.lineContent??``,initialComment:K?.comment,isEditing:K!==null,onSave:Ue,onDelete:We,onClose:()=>{xe(null),q(null)}},`${K?.id??``}-${G?.lineNumber??``}-${G?.side??``}`)]})}function Be(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=>(re(Le(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=>(re(Le(e.threadId,t)),t+1)),a(Ve))},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)(Ie,{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)(ze,{...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 Ve(e){return e+1}function $(e){return e+1}export{Be as DiffView,Be as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-BmsrsMXJ.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-Dsj5zHdU.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-COEFPP2U.js","assets/dialogs-config-BF_RyK5j.js","assets/onboarding-B_n7I3ri.js","assets/vosk-speech-FJiKHPe4.js","assets/react-vendor-D-z0br-z.js","assets/utils-H-1x3dmp.js","assets/index-DzUALYN4.css","assets/api-BRrGio-B.js","assets/context-menu-yKNgVtVk.js","assets/ui-components-JEH8JAJ7.js","assets/explorer-view-1fAca9It.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Pi as t,c as n,ds as r,fs as i,ms as a,ta as o}from"./dialogs-config-BF_RyK5j.js";import{r as s}from"./monaco-CZnIWXyV.js";import{l as c,u as l}from"./history-view-COEFPP2U.js";import{A as u,d,l as f,u as p,y as m,z as h}from"./index-Dsj5zHdU.js";var g=i(),_=e(a(),1),v=r(),y=(0,_.lazy)(()=>s(()=>import(`./explorer-tree-BmsrsMXJ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),b=(0,_.lazy)(()=>s(()=>import(`./explorer-view-1fAca9It.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function x(){let e=(0,g.c)(49),r=h(S),i=m(),[a,s]=(0,_.useState)(null),[x,C]=(0,_.useState)(!0),{pendingExplorerPath:w,setPendingExplorerPath:T,explorerClearPath:E,setExplorerClearPath:D}=u(),O;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{C(!0)},e[0]=O):O=e[0];let k;e[1]===r?k=e[2]:(k=[r],e[1]=r,e[2]=k),(0,_.useEffect)(O,k);let A;e[3]===i?A=e[4]:(A=e=>{s(e),i&&C(!1)},e[3]=i,e[4]=A);let j=A,M;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{C(!0)},e[5]=M):M=e[5];let N=M,P;e[6]===i?P=e[7]:(P=e=>{s(e),i&&C(!1)},e[6]=i,e[7]=P);let F=P,I,L;e[8]!==i||e[9]!==w||e[10]!==T?(I=()=>{w&&(s({name:w.split(`/`).pop()??w,path:w,type:`file`}),i&&C(!1),T(null))},L=[i,w,T],e[8]=i,e[9]=w,e[10]=T,e[11]=I,e[12]=L):(I=e[11],L=e[12]),(0,_.useEffect)(I,L);let R,z;e[13]!==E||e[14]!==i||e[15]!==a||e[16]!==D?(R=()=>{E&&(a&&(a.path===E||a.path.startsWith(E+`/`))&&(s(null),i&&C(!0)),D(null))},z=[E,i,a,D],e[13]=E,e[14]=i,e[15]=a,e[16]=D,e[17]=R,e[18]=z):(R=e[17],z=e[18]),(0,_.useEffect)(R,z);let B;e[19]!==j||e[20]!==a?.path||e[21]!==r?(B=(0,v.jsx)(n,{className:`h-full`,children:r?(0,v.jsx)(_.Suspense,{fallback:(0,v.jsx)(l,{}),children:(0,v.jsx)(y,{threadId:r,selectedPath:a?.path??null,onNodeSelect:j})}):(0,v.jsx)(`p`,{className:t(o.caption,`px-3 py-4 text-center`),children:`No thread selected.`})}),e[19]=j,e[20]=a?.path,e[21]=r,e[22]=B):B=e[22];let V=B,H;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,v.jsx)(c,{}),e[23]=H):H=e[23];let U=i&&!x,W;e[24]!==F||e[25]!==a||e[26]!==U?(W=(0,v.jsx)(_.Suspense,{fallback:H,children:(0,v.jsx)(b,{selectedFile:a,showTreeBackButton:U,onShowTree:N,onFileCreated:F})}),e[24]=F,e[25]=a,e[26]=U,e[27]=W):W=e[27];let G=W;if(i){let n=!x&&`hidden`,r;e[28]===n?r=e[29]:(r=t(`flex-1 min-h-0 overflow-hidden`,n),e[28]=n,e[29]=r);let i;e[30]!==V||e[31]!==r?(i=(0,v.jsx)(`div`,{className:r,children:V}),e[30]=V,e[31]=r,e[32]=i):i=e[32];let a=x&&`hidden`,o;e[33]===a?o=e[34]:(o=t(`flex-1 min-h-0 overflow-hidden`,a),e[33]=a,e[34]=o);let s;e[35]!==G||e[36]!==o?(s=(0,v.jsx)(`div`,{className:o,children:G}),e[35]=G,e[36]=o,e[37]=s):s=e[37];let c;return e[38]!==i||e[39]!==s?(c=(0,v.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 K;e[41]===V?K=e[42]:(K=(0,v.jsx)(p,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:V}),e[41]=V,e[42]=K);let q;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,v.jsx)(f,{withHandle:!0}),e[43]=q):q=e[43];let J;e[44]===G?J=e[45]:(J=(0,v.jsx)(p,{className:`overflow-hidden`,children:G}),e[44]=G,e[45]=J);let Y;return e[46]!==K||e[47]!==J?(Y=(0,v.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,v.jsxs)(d,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[K,q,J]})}),e[46]=K,e[47]=J,e[48]=Y):Y=e[48],Y}function S(e){return e.selectedThreadId}export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Do as t,Jo as n,Mi as r,To as i,Xi as a,Xo as o,ls as s,os as c,qr as l,ss as u,wo as d,za as f}from"./dialogs-config-BEazgV7k.js";import{A as p,F as m,M as h,O as g,a as _,c as v,j as y,k as b,n as x,o as S,u as C}from"./history-view-BMVTxWTg.js";import{d as w}from"./onboarding-Bi5MieW-.js";import{A as T,D as ee,O as E,P as D,k as O}from"./index-_SOdLUMq.js";import{a as k,i as A,n as j,r as M,t as N}from"./context-menu-PIC-g8wy.js";import{c as P,n as F,o as I,r as L,s as R,t as z}from"./api-Dhzdgb40.js";import{t as B}from"./ui-components-kSaUEA_X.js";var V=u(),H=e(s(),1),U=c(),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)(f,{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(a.bodyMuted,`py-6 text-center`),n[0]=i):i=n[0];let o;return n[1]!==e||n[2]!==t?(o=(0,U.jsx)(B.Empty,{ref:t,className:i,...e}),n[1]=e,n[2]=t,n[3]=o):o=n[3],o});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 Y=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});Y.displayName=B.Separator.displayName;var te=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,o;n[0]===e?(i=n[1],o=n[2]):({className:i,...o}=e,n[0]=e,n[1]=i,n[2]=o);let s;n[3]===i?s=n[4]:(s=r(r(a.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]=s);let c;return n[5]!==o||n[6]!==t||n[7]!==s?(c=(0,U.jsx)(B.Item,{ref:t,className:s,...o}),n[5]=o,n[6]=t,n[7]=s,n[8]=c):c=n[8],c});te.displayName=B.Item.displayName;var X=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 o;t[3]===n?o=t[4]:(o=r(a.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=o);let s;return t[5]!==i||t[6]!==o?(s=(0,U.jsx)(`span`,{className:o,...i}),t[5]=i,t[6]=o,t[7]=s):s=t[7],s};X.displayName=`CommandShortcut`;var ne=100,Z=500;function re(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function ie(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function ae(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(ie(n,t)&&(r.push(n.node),r.length>=Z))break;return r.sort((e,t)=>Q(e,t,n)).slice(0,ne)}function Q(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 oe(e){let n=(0,V.c)(38),{items:i,isReady:o,onRequestIndex:s,onOpenChange:c,onSelect:u}=e,f=o===void 0?!1:o,p=(0,H.useRef)(null),m=(0,H.useRef)(!1),h=(0,H.useRef)(!1),[g,_]=(0,H.useState)(!1),[v,y]=(0,H.useState)(``),b=(0,H.useDeferredValue)(v),x;n[0]===s?x=n[1]:(x=function(){h.current||(h.current=!0,s())},n[0]=s,n[1]=x);let S=x,C;n[2]!==b||n[3]!==i?(C=ae(i,re(b),b),n[2]=b,n[3]=i,n[4]=C):C=n[4];let w=C,T,D;n[5]!==c||n[6]!==v?(T=()=>{let e=v.trim().length>0;_(e),m.current!==e&&(m.current=e,c(e))},D=[c,v],n[5]=c,n[6]=v,n[7]=T,n[8]=D):(T=n[7],D=n[8]),(0,H.useEffect)(T,D);let k;n[9]===c?k=n[10]:(k=function(e){e||y(``),_(e),c(e),e&&requestAnimationFrame(()=>p.current?.focus())},n[9]=c,n[10]=k);let A=k,j;n[11]!==c||n[12]!==u?(j=function(e){u(e),_(!1),c(!1),y(``)},n[11]=c,n[12]=u,n[13]=j):j=n[13];let M=j,N;n[14]===S?N=n[15]:(N=e=>{S(),y(e.target.value)},n[14]=S,n[15]=N);let P;n[16]!==v||n[17]!==S||n[18]!==N?(P=(0,U.jsx)(O,{asChild:!0,children:(0,U.jsx)(`div`,{children:(0,U.jsx)(l,{ref:p,value:v,onPointerDown:S,onChange:N,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),n[16]=v,n[17]=S,n[18]=N,n[19]=P):P=n[19];let F;n[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=r(a.compact,`py-4`),n[20]=F):F=n[20];let I=f?`No matches found.`:`Indexing files and folders...`,L;n[21]===I?L=n[22]:(L=(0,U.jsx)(q,{className:F,children:I}),n[21]=I,n[22]=L);let R;if(n[23]!==M||n[24]!==w){let e;n[26]===M?e=n[27]:(e=e=>(0,U.jsxs)(te,{value:e.path,onSelect:()=>M(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,U.jsx)(d,{className:`h-4 w-4 text-muted-foreground`}):(0,U.jsx)(t,{className:`h-4 w-4 text-muted-foreground`}),(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(a.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),n[26]=M,n[27]=e),R=w.map(e),n[23]=M,n[24]=w,n[25]=R}else R=n[25];let z;n[28]===R?z=n[29]:(z=(0,U.jsx)(J,{children:R}),n[28]=R,n[29]=z);let B;n[30]!==L||n[31]!==z?(B=(0,U.jsx)(E,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:se,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,U.jsx)(W,{shouldFilter:!1,children:(0,U.jsxs)(K,{children:[L,z]})})}),n[30]=L,n[31]=z,n[32]=B):B=n[32];let G;return n[33]!==A||n[34]!==g||n[35]!==B||n[36]!==P?(G=(0,U.jsxs)(ee,{open:g,onOpenChange:A,children:[P,B]}),n[33]=A,n[34]=g,n[35]=B,n[36]=P,n[37]=G):G=n[37],G}function se(e){return e.preventDefault()}function ce(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function le(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=ce(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=()=>I(n,r).then($),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=_(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){return e.entries}function ue(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:de}),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)(w,{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 de(e){return e.stopPropagation()}function fe(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}var pe=(0,H.memo)(function e({node:r,level:a,threadId:s,selectedPath:c,expandedPaths:l,getDirVersion:u,renamingPath:f,newItemIn:p,onToggleFolder:m,onSelectNode:h,onStartRename:g,onCommitRename:_,onCancelRename:y,onDelete:b,onOpen:x,onNewFile:S,onNewFolder:C,onCommitNewItem:T,onCancelNewItem:ee}){let E=l.has(r.path),D=f===r.path,O=p?.dirPath===r.path&&E;return r.type===`folder`?(0,U.jsxs)(N,{children:[(0,U.jsx)(k,{asChild:!0,children:(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(w,{level:a,basePadding:10,selected:c===r.path,className:r.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),m(r)},children:[(0,U.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:E?(0,U.jsx)(o,{className:`h-3 w-3`}):(0,U.jsx)(n,{className:`h-3 w-3`})}),D?(0,U.jsxs)(U.Fragment,{children:[E?(0,U.jsx)(i,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:r.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?_(r,t):y()}else e.key===`Escape`&&y()},onBlur:e=>{let t=e.target.value.trim();t?_(r,t):y()},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:[E?(0,U.jsx)(i,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`span`,{className:`flex-1 truncate`,children:r.name})]})]}),E&&(0,U.jsx)(`div`,{children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(v,{}),children:(0,U.jsx)(le,{threadId:s,dirPath:r.path,version:u(r.path),children:n=>(0,U.jsxs)(U.Fragment,{children:[O&&(0,U.jsx)(ue,{defaultValue:``,level:a+1,basePadding:p.type===`folder`?10:22,icon:p.type===`folder`?(0,U.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:T,onCancel:ee}),n.map(t=>(0,U.jsx)(e,{node:t,level:a+1,threadId:s,selectedPath:c,expandedPaths:l,getDirVersion:u,renamingPath:f,newItemIn:p,onToggleFolder:m,onSelectNode:h,onStartRename:g,onCommitRename:_,onCancelRename:y,onDelete:b,onOpen:x,onNewFile:S,onNewFolder:C,onCommitNewItem:T,onCancelNewItem:ee},t.path))]})})})})]})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(M,{onSelect:()=>x(r),children:`Open`}),(0,U.jsx)(A,{}),(0,U.jsx)(M,{onSelect:()=>S(r.path),children:`New File...`}),(0,U.jsx)(M,{onSelect:()=>C(r.path),children:`New Folder...`}),(0,U.jsx)(A,{}),(0,U.jsx)(M,{onSelect:()=>g(r),children:`Rename...`}),(0,U.jsx)(M,{onSelect:()=>b(r),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,U.jsxs)(N,{children:[(0,U.jsx)(k,{asChild:!0,children:(0,U.jsxs)(w,{level:a,basePadding:22,selected:c===r.path,className:r.ignored?`opacity-50`:void 0,onClick:()=>h(r),children:[(0,U.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),D?(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:r.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?_(r,t):y()}else e.key===`Escape`&&y()},onBlur:e=>{let t=e.target.value.trim();t?_(r,t):y()},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:r.name})]})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(M,{onSelect:()=>x(r),children:`Open`}),(0,U.jsx)(A,{}),(0,U.jsx)(M,{onSelect:()=>g(r),children:`Rename...`}),(0,U.jsx)(M,{onSelect:()=>b(r),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),me=new Map;function he({threadId:e,selectedPath:n,onNodeSelect:r}){let[i,a]=(0,H.useState)(()=>new Map([[``,0]])),[o,s]=(0,H.useState)(new Set),[c,l]=(0,H.useState)(null),[u,f]=(0,H.useState)(null),[_,v]=(0,H.useState)(null),[w,ee]=(0,H.useState)(!1),[E,O]=(0,H.useState)([]),[A,B]=(0,H.useState)(!1),[V,W]=(0,H.useState)(!1),G=(0,H.useRef)(null),K=(0,H.useRef)(0),q=(0,H.useRef)(null),{explorerRefreshTick:J,pendingExplorerPath:Y,setExplorerClearPath:te}=T(),X=(0,H.useMemo)(()=>`${e}:${J}`,[J,e]),ne=(0,H.useCallback)(e=>{(0,H.startTransition)(()=>{ee(t=>t===e?t:e)})},[]),Z=(0,H.useCallback)(async()=>{if(!e)return;let t=me.get(X);if(t){O(t),B(!0);return}if(G.current!==X){G.current=X,O([]),B(!1);try{let t=fe((await I(e,``,!0)).entries);me.set(X,t),O(t),B(!0)}catch{O([]),B(!1)}finally{G.current===X&&(G.current=null)}}},[X,e]),re=(0,H.useCallback)(()=>{W(!0)},[]),ie=(0,H.useCallback)(()=>{me.delete(X),O([]),B(!1)},[X]),ae=(0,H.useCallback)(()=>{ie(),V&&Z()},[ie,Z,V]),Q=(0,H.useCallback)(e=>i.get(e)??0,[i]),se=(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&&(S(ce(e,t,Q(t))),se(t))},[se,Q,e]),de=(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);s(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=q.current!==null&&q.current!==e;q.current=e,t&&(a(new Map([[``,0]])),s(new Set),l(null),f(null),K.current=J)},[J,e]),(0,H.useEffect)(()=>{!e||J<=K.current||(K.current=J,a(t=>{let n=new Set([``]);for(let e of o)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;S(ce(e,i,n)),r.set(i,n+1)}return r}))},[J,o,e]),(0,H.useEffect)(()=>{O([]),B(!1),W(!1),G.current=null},[X]),(0,H.useEffect)(()=>{!V||!e||Z()},[Z,V,e]),(0,H.useEffect)(()=>{if(!Y||!e)return;let t=Y.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){s(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[Y,e]);function he(e){o.has(e.path)?s(t=>{let n=new Set(t);return n.delete(e.path),n}):(s(t=>new Set(t).add(e.path)),a(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function ge(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function _e(e){v(e)}async function ve(t){try{await R(e,t.path)}catch{D({title:`Error`,description:`Failed to open "${t.name}"`,variant:`destructive`})}}async function ye(){if(!_)return;let t=_;v(null);try{await L(e,t.path),te(t.path),$(ge(t.path)),ae(),s(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{D({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function be(e){f(null),l(e.path)}async function xe(t,n){if(n===t.name){l(null);return}l(null);try{await P(e,t.path,n),$(ge(t.path)),ae(),t.type===`folder`&&(s(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{D({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function Se(e){l(null),o.has(e)||(s(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})),f({dirPath:e,type:`file`})}function Ce(e){l(null),o.has(e)||(s(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})),f({dirPath:e,type:`folder`})}async function we(t){if(!u)return;let{dirPath:n,type:r}=u;f(null);try{r===`file`?await z(e,n,t):await F(e,n,t),$(n),ae()}catch{D({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Te(){f(null)}function Ee(e){de(e),e.type===`file`&&r(e)}let De=u?.dirPath===``?(0,U.jsx)(ue,{defaultValue:``,level:0,basePadding:u.type===`folder`?10:22,icon:u.type===`folder`?(0,U.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:we,onCancel:Te}):null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(g,{open:_!==null,onOpenChange:e=>!e&&v(null),children:(0,U.jsxs)(y,{children:[(0,U.jsx)(m,{children:`Move to Trash`}),(0,U.jsxs)(h,{children:[`Move “`,_?.name,`” to trash?`]}),(0,U.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,U.jsx)(p,{children:`Cancel`}),(0,U.jsx)(b,{onClick:()=>void ye(),children:`Move to Trash`})]})]})}),(0,U.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,U.jsx)(oe,{items:E,isReady:A,onRequestIndex:re,onOpenChange:ne,onSelect:e=>Ee(e)},X)}),(0,U.jsxs)(N,{children:[(0,U.jsx)(k,{asChild:!0,disabled:w,children:(0,U.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,U.jsx)(x,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(C,{}),children:(0,U.jsx)(le,{threadId:e,dirPath:``,version:Q(``),children:t=>(0,U.jsxs)(U.Fragment,{children:[De,t.map(t=>(0,U.jsx)(pe,{node:t,level:0,threadId:e,selectedPath:n,expandedPaths:o,getDirVersion:Q,renamingPath:c,newItemIn:u,onToggleFolder:he,onSelectNode:r,onStartRename:be,onCommitRename:xe,onCancelRename:()=>l(null),onDelete:_e,onOpen:ve,onNewFile:Se,onNewFolder:Ce,onCommitNewItem:we,onCancelNewItem:Te},t.path))]})})})})})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(M,{onSelect:()=>Se(``),children:`New File...`}),(0,U.jsx)(M,{onSelect:()=>Ce(``),children:`New Folder...`})]})]})]})}export{he as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$o as t,Ao as n,Mo as r,Pi as i,Wa as a,Yr as o,ds as s,fs as c,ko as l,ms as u,ta as d,ts as f}from"./dialogs-config-BF_RyK5j.js";import{A as p,F as m,M as h,O as g,a as _,c as v,j as y,k as b,n as x,o as S,u as C}from"./history-view-COEFPP2U.js";import{d as w}from"./onboarding-B_n7I3ri.js";import{A as T,D as ee,F as E,O as D,k as O}from"./index-Dsj5zHdU.js";import{a as k,i as A,n as j,r as M,t as N}from"./context-menu-yKNgVtVk.js";import{c as P,n as F,o as I,r as L,s as R,t as z}from"./api-BRrGio-B.js";import{t as B}from"./ui-components-JEH8JAJ7.js";var V=c(),H=e(u(),1),U=s(),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,o;n[0]===e?(r=n[1],o=n[2]):({className:r,...o}=e,n[0]=e,n[1]=r,n[2]=o);let s;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,U.jsx)(a,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=s):s=n[3];let c;n[4]===r?c=n[5]:(c=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]=c);let l;return n[6]!==o||n[7]!==t||n[8]!==c?(l=(0,U.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[s,(0,U.jsx)(B.Input,{ref:t,className:c,...o})]}),n[6]=o,n[7]=t,n[8]=c,n[9]=l):l=n[9],l});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(d.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 Y=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});Y.displayName=B.Separator.displayName;var te=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(d.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});te.displayName=B.Item.displayName;var X=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(d.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};X.displayName=`CommandShortcut`;var ne=100,Z=500;function re(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function ie(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function ae(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(ie(n,t)&&(r.push(n.node),r.length>=Z))break;return r.sort((e,t)=>Q(e,t,n)).slice(0,ne)}function Q(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 oe(e){let t=(0,V.c)(38),{items:n,isReady:a,onRequestIndex:s,onOpenChange:c,onSelect:u}=e,f=a===void 0?!1:a,p=(0,H.useRef)(null),m=(0,H.useRef)(!1),h=(0,H.useRef)(!1),[g,_]=(0,H.useState)(!1),[v,y]=(0,H.useState)(``),b=(0,H.useDeferredValue)(v),x;t[0]===s?x=t[1]:(x=function(){h.current||(h.current=!0,s())},t[0]=s,t[1]=x);let S=x,C;t[2]!==b||t[3]!==n?(C=ae(n,re(b),b),t[2]=b,t[3]=n,t[4]=C):C=t[4];let w=C,T,E;t[5]!==c||t[6]!==v?(T=()=>{let e=v.trim().length>0;_(e),m.current!==e&&(m.current=e,c(e))},E=[c,v],t[5]=c,t[6]=v,t[7]=T,t[8]=E):(T=t[7],E=t[8]),(0,H.useEffect)(T,E);let k;t[9]===c?k=t[10]:(k=function(e){e||y(``),_(e),c(e),e&&requestAnimationFrame(()=>p.current?.focus())},t[9]=c,t[10]=k);let A=k,j;t[11]!==c||t[12]!==u?(j=function(e){u(e),_(!1),c(!1),y(``)},t[11]=c,t[12]=u,t[13]=j):j=t[13];let M=j,N;t[14]===S?N=t[15]:(N=e=>{S(),y(e.target.value)},t[14]=S,t[15]=N);let P;t[16]!==v||t[17]!==S||t[18]!==N?(P=(0,U.jsx)(O,{asChild:!0,children:(0,U.jsx)(`div`,{children:(0,U.jsx)(o,{ref:p,value:v,onPointerDown:S,onChange:N,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),t[16]=v,t[17]=S,t[18]=N,t[19]=P):P=t[19];let F;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=i(d.compact,`py-4`),t[20]=F):F=t[20];let I=f?`No matches found.`:`Indexing files and folders...`,L;t[21]===I?L=t[22]:(L=(0,U.jsx)(q,{className:F,children:I}),t[21]=I,t[22]=L);let R;if(t[23]!==M||t[24]!==w){let e;t[26]===M?e=t[27]:(e=e=>(0,U.jsxs)(te,{value:e.path,onSelect:()=>M(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,U.jsx)(l,{className:`h-4 w-4 text-muted-foreground`}):(0,U.jsx)(r,{className:`h-4 w-4 text-muted-foreground`}),(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(d.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),t[26]=M,t[27]=e),R=w.map(e),t[23]=M,t[24]=w,t[25]=R}else R=t[25];let z;t[28]===R?z=t[29]:(z=(0,U.jsx)(J,{children:R}),t[28]=R,t[29]=z);let B;t[30]!==L||t[31]!==z?(B=(0,U.jsx)(D,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:se,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,U.jsx)(W,{shouldFilter:!1,children:(0,U.jsxs)(K,{children:[L,z]})})}),t[30]=L,t[31]=z,t[32]=B):B=t[32];let G;return t[33]!==A||t[34]!==g||t[35]!==B||t[36]!==P?(G=(0,U.jsxs)(ee,{open:g,onOpenChange:A,children:[P,B]}),t[33]=A,t[34]=g,t[35]=B,t[36]=P,t[37]=G):G=t[37],G}function se(e){return e.preventDefault()}function ce(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function le(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=ce(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=()=>I(n,r).then($),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=_(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){return e.entries}function ue(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:de}),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)(w,{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 de(e){return e.stopPropagation()}function fe(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}var pe=(0,H.memo)(function e({node:i,level:a,threadId:o,selectedPath:s,expandedPaths:c,getDirVersion:u,renamingPath:d,newItemIn:p,onToggleFolder:m,onSelectNode:h,onStartRename:g,onCommitRename:_,onCancelRename:y,onDelete:b,onOpen:x,onNewFile:S,onNewFolder:C,onCommitNewItem:T,onCancelNewItem:ee}){let E=c.has(i.path),D=d===i.path,O=p?.dirPath===i.path&&E;return i.type===`folder`?(0,U.jsxs)(N,{children:[(0,U.jsx)(k,{asChild:!0,children:(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(w,{level:a,basePadding:10,selected:s===i.path,className:i.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),m(i)},children:[(0,U.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:E?(0,U.jsx)(f,{className:`h-3 w-3`}):(0,U.jsx)(t,{className:`h-3 w-3`})}),D?(0,U.jsxs)(U.Fragment,{children:[E?(0,U.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:i.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?_(i,t):y()}else e.key===`Escape`&&y()},onBlur:e=>{let t=e.target.value.trim();t?_(i,t):y()},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:[E?(0,U.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`span`,{className:`flex-1 truncate`,children:i.name})]})]}),E&&(0,U.jsx)(`div`,{children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(v,{}),children:(0,U.jsx)(le,{threadId:o,dirPath:i.path,version:u(i.path),children:t=>(0,U.jsxs)(U.Fragment,{children:[O&&(0,U.jsx)(ue,{defaultValue:``,level:a+1,basePadding:p.type===`folder`?10:22,icon:p.type===`folder`?(0,U.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(r,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:T,onCancel:ee}),t.map(t=>(0,U.jsx)(e,{node:t,level:a+1,threadId:o,selectedPath:s,expandedPaths:c,getDirVersion:u,renamingPath:d,newItemIn:p,onToggleFolder:m,onSelectNode:h,onStartRename:g,onCommitRename:_,onCancelRename:y,onDelete:b,onOpen:x,onNewFile:S,onNewFolder:C,onCommitNewItem:T,onCancelNewItem:ee},t.path))]})})})})]})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(M,{onSelect:()=>x(i),children:`Open`}),(0,U.jsx)(A,{}),(0,U.jsx)(M,{onSelect:()=>S(i.path),children:`New File...`}),(0,U.jsx)(M,{onSelect:()=>C(i.path),children:`New Folder...`}),(0,U.jsx)(A,{}),(0,U.jsx)(M,{onSelect:()=>g(i),children:`Rename...`}),(0,U.jsx)(M,{onSelect:()=>b(i),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,U.jsxs)(N,{children:[(0,U.jsx)(k,{asChild:!0,children:(0,U.jsxs)(w,{level:a,basePadding:22,selected:s===i.path,className:i.ignored?`opacity-50`:void 0,onClick:()=>h(i),children:[(0,U.jsx)(r,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),D?(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:i.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?_(i,t):y()}else e.key===`Escape`&&y()},onBlur:e=>{let t=e.target.value.trim();t?_(i,t):y()},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:i.name})]})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(M,{onSelect:()=>x(i),children:`Open`}),(0,U.jsx)(A,{}),(0,U.jsx)(M,{onSelect:()=>g(i),children:`Rename...`}),(0,U.jsx)(M,{onSelect:()=>b(i),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),me=new Map;function he({threadId:e,selectedPath:t,onNodeSelect:n}){let[i,a]=(0,H.useState)(()=>new Map([[``,0]])),[o,s]=(0,H.useState)(new Set),[c,u]=(0,H.useState)(null),[d,f]=(0,H.useState)(null),[_,v]=(0,H.useState)(null),[w,ee]=(0,H.useState)(!1),[D,O]=(0,H.useState)([]),[A,B]=(0,H.useState)(!1),[V,W]=(0,H.useState)(!1),G=(0,H.useRef)(null),K=(0,H.useRef)(0),q=(0,H.useRef)(null),{explorerRefreshTick:J,pendingExplorerPath:Y,setExplorerClearPath:te}=T(),X=(0,H.useMemo)(()=>`${e}:${J}`,[J,e]),ne=(0,H.useCallback)(e=>{(0,H.startTransition)(()=>{ee(t=>t===e?t:e)})},[]),Z=(0,H.useCallback)(async()=>{if(!e)return;let t=me.get(X);if(t){O(t),B(!0);return}if(G.current!==X){G.current=X,O([]),B(!1);try{let t=fe((await I(e,``,!0)).entries);me.set(X,t),O(t),B(!0)}catch{O([]),B(!1)}finally{G.current===X&&(G.current=null)}}},[X,e]),re=(0,H.useCallback)(()=>{W(!0)},[]),ie=(0,H.useCallback)(()=>{me.delete(X),O([]),B(!1)},[X]),ae=(0,H.useCallback)(()=>{ie(),V&&Z()},[ie,Z,V]),Q=(0,H.useCallback)(e=>i.get(e)??0,[i]),se=(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&&(S(ce(e,t,Q(t))),se(t))},[se,Q,e]),de=(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);s(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=q.current!==null&&q.current!==e;q.current=e,t&&(a(new Map([[``,0]])),s(new Set),u(null),f(null),K.current=J)},[J,e]),(0,H.useEffect)(()=>{!e||J<=K.current||(K.current=J,a(t=>{let n=new Set([``]);for(let e of o)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;S(ce(e,i,n)),r.set(i,n+1)}return r}))},[J,o,e]),(0,H.useEffect)(()=>{O([]),B(!1),W(!1),G.current=null},[X]),(0,H.useEffect)(()=>{!V||!e||Z()},[Z,V,e]),(0,H.useEffect)(()=>{if(!Y||!e)return;let t=Y.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){s(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[Y,e]);function he(e){o.has(e.path)?s(t=>{let n=new Set(t);return n.delete(e.path),n}):(s(t=>new Set(t).add(e.path)),a(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function ge(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function _e(e){v(e)}async function ve(t){try{await R(e,t.path)}catch{E({title:`Error`,description:`Failed to open "${t.name}"`,variant:`destructive`})}}async function ye(){if(!_)return;let t=_;v(null);try{await L(e,t.path),te(t.path),$(ge(t.path)),ae(),s(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{E({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function be(e){f(null),u(e.path)}async function xe(t,n){if(n===t.name){u(null);return}u(null);try{await P(e,t.path,n),$(ge(t.path)),ae(),t.type===`folder`&&(s(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{E({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function Se(e){u(null),o.has(e)||(s(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})),f({dirPath:e,type:`file`})}function Ce(e){u(null),o.has(e)||(s(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})),f({dirPath:e,type:`folder`})}async function we(t){if(!d)return;let{dirPath:n,type:r}=d;f(null);try{r===`file`?await z(e,n,t):await F(e,n,t),$(n),ae()}catch{E({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Te(){f(null)}function Ee(e){de(e),e.type===`file`&&n(e)}let De=d?.dirPath===``?(0,U.jsx)(ue,{defaultValue:``,level:0,basePadding:d.type===`folder`?10:22,icon:d.type===`folder`?(0,U.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(r,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:we,onCancel:Te}):null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(g,{open:_!==null,onOpenChange:e=>!e&&v(null),children:(0,U.jsxs)(y,{children:[(0,U.jsx)(m,{children:`Move to Trash`}),(0,U.jsxs)(h,{children:[`Move “`,_?.name,`” to trash?`]}),(0,U.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,U.jsx)(p,{children:`Cancel`}),(0,U.jsx)(b,{onClick:()=>void ye(),children:`Move to Trash`})]})]})}),(0,U.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,U.jsx)(oe,{items:D,isReady:A,onRequestIndex:re,onOpenChange:ne,onSelect:e=>Ee(e)},X)}),(0,U.jsxs)(N,{children:[(0,U.jsx)(k,{asChild:!0,disabled:w,children:(0,U.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,U.jsx)(x,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(C,{}),children:(0,U.jsx)(le,{threadId:e,dirPath:``,version:Q(``),children:r=>(0,U.jsxs)(U.Fragment,{children:[De,r.map(r=>(0,U.jsx)(pe,{node:r,level:0,threadId:e,selectedPath:t,expandedPaths:o,getDirVersion:Q,renamingPath:c,newItemIn:d,onToggleFolder:he,onSelectNode:n,onStartRename:be,onCommitRename:xe,onCancelRename:()=>u(null),onDelete:_e,onOpen:ve,onNewFile:Se,onNewFolder:Ce,onCommitNewItem:we,onCancelNewItem:Te},r.path))]})})})})})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(M,{onSelect:()=>Se(``),children:`New File...`}),(0,U.jsx)(M,{onSelect:()=>Ce(``),children:`New Folder...`})]})]})]})}export{he as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Gi as t,Go as n,Ki as r,Lo as i,Mi as a,No as o,Pi as s,Po as c,Qa as l,ao as ee,at as u,ds as d,fs as f,ho as te,ms as p,ns as m,ta as h}from"./dialogs-config-BF_RyK5j.js";import{M as g}from"./react-vendor-D-z0br-z.js";import{I as _,a as v,l as y,n as b,o as x}from"./history-view-COEFPP2U.js";import{n as S}from"./utils-H-1x3dmp.js";import{A as C,C as w,E as T,F as E,N as ne,S as re,c as ie,x as ae,z as oe}from"./index-Dsj5zHdU.js";import{a as D,i as O,l as se,o as k,s as ce,t as A}from"./api-BRrGio-B.js";var j=f(),M=d(),N=e(p(),1),P=_(e=>(0,M.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[e.v0,(0,M.jsx)(`p`,{className:e.v1,children:`Select a thread to browse its files`})]}),{name:`ExplorerView_1`,portals:[`v0`]}),F=_(e=>(0,M.jsxs)(`div`,{className:`flex flex-col h-full`,children:[e.v0,(0,M.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,M.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:e.v1})}),e.v2]}),{name:`ExplorerView_2`,portals:[`v0`,`v1`,`v2`]}),I=function({selectedFile:e,showTreeBackButton:r=!1,onShowTree:i,onFileCreated:o}){let{resolvedTheme:d}=S(),f=oe(e=>e.selectedThreadId),{triggerExplorerRefresh:p}=C(),_=(0,N.useRef)(null),v=(0,N.useRef)(null),D=(0,N.useRef)(!1),O=(0,N.useRef)(!0),[k,j]=(0,N.useState)(null),[I,W]=(0,N.useState)(!1),[K,q]=(0,N.useState)(`edit`),[ue,de]=(0,N.useState)(0),[J,fe]=(0,N.useState)(null),[Y,X]=(0,N.useState)(!1);(0,N.useEffect)(()=>{f&&u(f).then(fe).catch(()=>{})},[f]);let pe=async()=>{if(!(!J||Y)){X(!0);try{await navigator.clipboard.writeText(J),E({title:`Copied`,description:`Repository folder path copied to clipboard.`})}catch{E({title:`Error`,description:`Failed to copy path to clipboard.`,variant:`destructive`})}finally{X(!1)}}},me=async()=>{if(f)try{await ce(f,`.`)}catch{E({title:`Error`,description:`Failed to open repository folder.`,variant:`destructive`})}},he=(0,N.useCallback)(async e=>{if(f)try{let t=await R(f,e);await A(f,``,t);let n={name:t,path:t,type:`file`};v.current=t,D.current=!0,o?.(n),p(),E({title:`Created`,description:`${t} created successfully.`})}catch{E({title:`Error`,description:`Failed to create file.`,variant:`destructive`})}},[f,o,p]),Z=e?t(e.path,e.name):null,Q=e?.type===`file`&&f&&!Z?e:null,$=k?.content??``,ge=k?.original??``,_e=Q?`${f}:${Q.path}:${ue}`:null;(0,N.useEffect)(()=>()=>{_.current&&=(_.current.getModel()?.dispose(),_.current.dispose(),null)},[]),(0,N.useEffect)(()=>{if(e?.type===`file`?v.current===e.path?(v.current=null,q(`edit`)):q(z(e.path)?`view`:`edit`):q(`edit`),O.current){O.current=!1;return}j(null)},[e?.path,f]);async function ve(){if(!(!f||!e)){W(!0);try{await se(f,e.path,$),j({content:$,original:$}),E({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){E({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{W(!1)}}}function ye(){!f||!Q||(x(V(f,Q.path)),j(null),de(e=>e+1))}return f?(0,M.jsx)(F,{v0:(0,M.jsxs)(ie,{className:`justify-between`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[r&&i?(0,M.jsxs)(a,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:i,children:[(0,M.jsx)(ee,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,M.jsx)(`span`,{className:s(h.label,`truncate text-foreground`),children:e?e.name:`Select a file to edit`}),(0,M.jsx)(`span`,{className:s(h.compact,`truncate text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]})]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[Q&&k?(0,M.jsxs)(M.Fragment,{children:[z(Q.path)?(0,M.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,M.jsx)(a,{size:`sm`,variant:K===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>q(`view`),children:`View`}),(0,M.jsx)(a,{size:`sm`,variant:K===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>q(`edit`),children:`Edit`})]}):null,(0,M.jsxs)(a,{size:`sm`,onClick:()=>void ve(),disabled:I||!$||$===ge,children:[I?(0,M.jsx)(te,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null,e?null:(0,M.jsxs)(ae,{children:[(0,M.jsx)(T,{asChild:!0,children:(0,M.jsxs)(a,{size:`sm`,className:`gap-1.5`,children:[(0,M.jsx)(l,{className:`h-3.5 w-3.5`}),`New file`]})}),(0,M.jsx)(re,{align:`end`,children:L.map(({label:e,ext:t,icon:n})=>(0,M.jsxs)(w,{onSelect:()=>void he(t),children:[(0,M.jsx)(n,{className:`h-4 w-4`}),e]},t))})]})]})]}),v1:Q?(0,M.jsxs)(b,{fallbackTitle:`Failed to load file`,onRetry:ye,children:[(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(y,{}),children:(0,M.jsx)(H,{threadId:f,path:Q.path,onContentReady:j},_e??void 0)}),k?z(Q.path)&&K===`view`?(0,M.jsx)(`div`,{className:`h-full overflow-auto p-6`,children:(0,M.jsx)(ne,{content:$,enableMermaid:!0})}):(0,M.jsx)(g,{height:`100%`,language:B(Q.path),value:$,onChange:e=>j(t=>t&&{...t,content:e??``}),onMount:e=>{_.current=e,D.current&&(D.current=!1,e.focus())},theme:d===`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,M.jsx)(y,{})]}):e?.type===`file`&&Z===`image`?(0,M.jsx)(b,{fallbackTitle:`Failed to load image`,onRetry:()=>{!f||!e||x(U(f,e.path))},children:(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(y,{}),children:(0,M.jsx)(G,{threadId:f,path:e.path,alt:e.name})})}):e?.type===`file`&&Z===`video`?(0,M.jsx)(b,{fallbackTitle:`Failed to load video`,onRetry:()=>{!f||!e||x(U(f,e.path))},children:(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(y,{}),children:(0,M.jsx)(le,{threadId:f,path:e.path})})}):(0,M.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,M.jsx)(`h2`,{className:s(h.pageTitle,`text-foreground`),children:`File Explorer`}),(0,M.jsx)(`p`,{className:s(h.pageSubtitle),children:`Browse and edit files`})]}),v2:e?null:(0,M.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 py-2`,children:J?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>void me(),className:s(h.compact,`min-w-0 flex-1 truncate text-left font-mono text-muted-foreground hover:text-foreground hover:underline`),title:J,children:J}),(0,M.jsxs)(a,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:()=>void pe(),disabled:Y,children:[Y?(0,M.jsx)(m,{className:`h-3.5 w-3.5`}):(0,M.jsx)(n,{className:`h-3.5 w-3.5`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Copy path`})]})]}):(0,M.jsx)(`p`,{className:s(h.compact,`text-muted-foreground/50 italic`),children:`Loading path...`})})}):(0,M.jsx)(P,{v0:(0,M.jsx)(c,{className:`h-8 w-8 text-muted-foreground`}),v1:h.bodyMuted})},L=[{label:`Markdown`,ext:`md`,icon:c},{label:`TypeScript`,ext:`ts`,icon:i},{label:`Text`,ext:`txt`,icon:o}];async function R(e,t){try{let n=await k(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 z(e){return r(e)===`md`}function B(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`}[r(e)]??`plaintext`}function V(e,t){return`explorer-file:${e}:${t}`}function H(e){let t=(0,j.c)(10),{threadId:n,path:r,onContentReady:i}=e,a;t[0]!==r||t[1]!==n?(a=V(n,r),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;t[3]!==r||t[4]!==n?(o=()=>D(n,r),t[3]=r,t[4]=n,t[5]=o):o=t[5];let s=v(a,o),c,l;return t[6]!==i||t[7]!==s.content?(c=()=>{i({content:s.content,original:s.content})},l=[i,s.content],t[6]=i,t[7]=s.content,t[8]=c,t[9]=l):(c=t[8],l=t[9]),(0,N.useLayoutEffect)(c,l),null}function U(e,t){return`explorer-media:${e}:${t}`}function W(e,t){let n=(0,j.c)(11),r;n[0]!==t||n[1]!==e?(r=U(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=()=>O(e,t),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,N.useEffect)(c,l),s}function G(e){let t=(0,j.c)(3),{threadId:n,path:r,alt:i}=e,a=W(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,M.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,M.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 le(e){let t=(0,j.c)(2),{threadId:n,path:r}=e,i=W(n,r),a;return t[0]===i?a=t[1]:(a=(0,M.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,M.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}export{I as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$r as e,Mi as t,Pi as n,Qr as r,Xr as i,ds as a,ei as o,fs as s,ho as c,ni as l,ta as u,ti as d}from"./dialogs-config-BF_RyK5j.js";var f=s(),p=a();function m(a){let s=(0,f.c)(28),{open:m,onOpenChange:g,commits:_,displayedCommits:v,isLoadingMore:y,onScroll:b,currentBranch:x}=a,S;s[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,p.jsx)(l,{children:`Commit History`}),s[0]=S):S=s[0];let C;s[1]===x?C=s[2]:(C=(0,p.jsxs)(d,{children:[S,(0,p.jsxs)(e,{children:[`Recent commits on branch `,x]})]}),s[1]=x,s[2]=C);let w;s[3]===v?w=s[4]:(w=v.length>0?v.map(h):(0,p.jsx)(`p`,{className:n(u.bodyMuted,`text-center py-8`),children:`No commits found`}),s[3]=v,s[4]=w);let T;s[5]===y?T=s[6]:(T=y&&(0,p.jsx)(`div`,{className:`p-3 text-center`,children:(0,p.jsx)(c,{className:`h-4 w-4 animate-spin inline`})}),s[5]=y,s[6]=T);let E;s[7]!==_.length||s[8]!==v.length||s[9]!==y?(E=v.length<_.length&&!y&&(0,p.jsx)(`div`,{className:n(u.caption,`p-3 text-center`),children:`Scroll to load more`}),s[7]=_.length,s[8]=v.length,s[9]=y,s[10]=E):E=s[10];let D;s[11]!==w||s[12]!==T||s[13]!==E?(D=(0,p.jsxs)(`div`,{className:`divide-y`,children:[w,T,E]}),s[11]=w,s[12]=T,s[13]=E,s[14]=D):D=s[14];let O;s[15]!==b||s[16]!==D?(O=(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto border rounded-lg`,onScroll:b,children:D}),s[15]=b,s[16]=D,s[17]=O):O=s[17];let k;s[18]===g?k=s[19]:(k=(0,p.jsx)(o,{children:(0,p.jsx)(t,{onClick:()=>g(!1),children:`Close`})}),s[18]=g,s[19]=k);let A;s[20]!==C||s[21]!==O||s[22]!==k?(A=(0,p.jsxs)(r,{className:`max-w-2xl max-h-[80vh] flex flex-col`,children:[C,O,k]}),s[20]=C,s[21]=O,s[22]=k,s[23]=A):A=s[23];let j;return s[24]!==g||s[25]!==m||s[26]!==A?(j=(0,p.jsx)(i,{open:m,onOpenChange:g,children:A}),s[24]=g,s[25]=m,s[26]=A,s[27]=j):j=s[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(u.label,`break-words`),children:e.message}),(0,p.jsxs)(`p`,{className:n(u.bodyMuted,`mt-1`),children:[(0,p.jsx)(`span`,{className:u.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-BLzHl6oN.js","assets/index-Dsj5zHdU.js","assets/rolldown-runtime-aKtaBQYM.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-COEFPP2U.js","assets/dialogs-config-BF_RyK5j.js","assets/onboarding-B_n7I3ri.js","assets/vosk-speech-FJiKHPe4.js","assets/react-vendor-D-z0br-z.js","assets/utils-H-1x3dmp.js","assets/index-DzUALYN4.css","assets/pull-request-dialog-BO_7fALs.js","assets/create-repo-dialog-DHFloJc3.js","assets/git-history-dialog-DXsSt3e0.js","assets/push-before-pr-dialog-B9evx_c7.js","assets/pull-with-changes-dialog-DQSC-HUH.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Bo as t,C as n,Ca as r,Do as i,Dt as a,Fr as o,Gt as s,Ir as c,Jt as ee,Kt as te,Lr as ne,Mi as re,Oa as ie,Pi as ae,Qt as oe,Rr as se,To as ce,Ut as le,Vo as l,Wn as u,Xa as d,Y as f,Yt as p,an as m,bo as ue,ct as de,da as fe,ds as h,dt as pe,fs as g,ho as _,ls as v,ms as me,mt as he,nn as ge,q as y,ss as _e,ta as ve,ts as ye,wo as be}from"./dialogs-config-BF_RyK5j.js";import{r as b}from"./monaco-CZnIWXyV.js";import{C as x,E as xe,F as S,M as Se,R as Ce,S as we,T as Te,V as Ee,g as De,h as Oe,w as ke,x as Ae,z as je}from"./index-Dsj5zHdU.js";var C=e(me(),1),w=h();function T(e){return!e.hasChanges&&e.defaultBranchBehind>0}function E(e){return e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits}function D(e){return e.hasUnpushedCommits&&e.prExists}function Me(e,t){return t?`Creating PR...`:e.hasChanges?`Commit`:D(e)?`Update PR`:E(e)?`Open PR`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create PR`:T(e)?`Sync`:`Commit`}function Ne(e,n,r=!1){return n||r?(0,w.jsx)(_,{className:`h-3.5 w-3.5 animate-spin`}):e.hasChanges?(0,w.jsx)(i,{className:`h-3.5 w-3.5`}):E(e)?(0,w.jsx)(t,{className:`h-3.5 w-3.5`}):T(e)?(0,w.jsx)(v,{className:`h-3.5 w-3.5`}):(0,w.jsx)(ce,{className:`h-3.5 w-3.5`})}function Pe(e){if(e.hasChanges)return e.changedFilesCount>0?`Commit ${e.changedFilesCount} changed file${e.changedFilesCount===1?``:`s`}`:`No changes to commit`;if(D(e))return`Update pull request with unpushed commits`;if(E(e))return`View pull request in GitHub`;if(e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges)return`Create pull request for committed changes`;if(T(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 Fe(e,t,n=!1){return t||n?!0:E(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges||T(e)?!1:!e.hasChanges&&!e.hasUnpushedCommits}function O(e){return e.hasChanges||E(e)||D(e)||T(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}var Ie=g();function k(e){let n=(0,Ie.c)(104),{branchStatus:i,remoteUrl:a,hasRemoteBranch:s,hasUnpushedCommits:ee,canCreateRepo:te,repoUrl:oe,isRefreshing:le,isBrandState:u,hasChanges:f,defaultBranch:p,defaultBranchAhead:m,defaultBranchBehind:de,gitUser:fe,isDirectCommitMode:h,autoGenerateCommitMessage:pe,isLoading:g,isLoadingHistory:me,isQuickCommitting:he,onFetch:ge,onPull:y,onPush:b,onOpenHistory:S,onCreatePR:Se,onCreateRepo:Ce,onViewInGitHub:Ee,onQuickCommit:De,onSyncWithDefault:Oe,onOpenChange:je,open:C,layout:T}=e,E=T===void 0?`bar`:T,D=!!p&&!!a&&de>0,Me=!f&&!g,Ne=E===`bar`&&`w-8 rounded-l-none`,Pe=E===`menu`&&`w-full justify-start gap-2 rounded-md`,Fe=u&&E===`bar`&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`,O;n[0]!==Ne||n[1]!==Pe||n[2]!==Fe?(O=ae(`h-8 px-1`,Ne,Pe,Fe),n[0]=Ne,n[1]=Pe,n[2]=Fe,n[3]=O):O=n[3];let k;n[4]===le?k=n[5]:(k=le?(0,w.jsx)(_,{className:`h-3.5 w-3.5 animate-spin`}):(0,w.jsx)(ye,{className:`h-3.5 w-3.5`}),n[4]=le,n[5]=k);let A;n[6]===E?A=n[7]:(A=E===`menu`&&(0,w.jsx)(`span`,{children:`More git actions`}),n[6]=E,n[7]=A);let j;n[8]!==g||n[9]!==O||n[10]!==k||n[11]!==A?(j=(0,w.jsx)(xe,{asChild:!0,children:(0,w.jsxs)(re,{variant:`outline`,size:`sm`,className:O,disabled:g,children:[k,A]})}),n[8]=g,n[9]=O,n[10]=k,n[11]=A,n[12]=j):j=n[12];let M;n[13]!==i||n[14]!==a?(M=i===`Behind`&&(0,w.jsxs)(`div`,{className:ae(ve.compact,`px-2 py-1 text-amber-600`),children:[`Branch is behind `,a?`origin`:`remote`]}),n[13]=i,n[14]=a,n[15]=M):M=n[15];let N;n[16]===fe?N=n[17]:(N=fe&&(0,w.jsxs)(`div`,{className:ae(ve.compact,`px-2 py-1 text-muted-foreground`),children:[(0,w.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,fe]}),n[16]=fe,n[17]=N);let Le;n[18]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,w.jsx)(ke,{}),n[18]=Le):Le=n[18];let P;n[19]!==Me||n[20]!==p||n[21]!==m||n[22]!==de||n[23]!==f||n[24]!==Oe||n[25]!==D?(P=D&&(0,w.jsx)(ne,{children:(0,w.jsxs)(o,{children:[(0,w.jsx)(se,{asChild:!0,children:(0,w.jsxs)(x,{onClick:()=>{Me&&Oe()},className:Me?``:`opacity-50 cursor-not-allowed`,children:[(0,w.jsx)(d,{className:`h-3.5 w-3.5 mr-2`}),`Sync with `,p,(0,w.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 pl-3 text-xs tabular-nums text-muted-foreground`,children:[m>0&&(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,w.jsx)(_e,{className:`h-3 w-3`}),m]}),de>0&&(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,w.jsx)(v,{className:`h-3 w-3`}),de]})]})]})}),(0,w.jsx)(c,{side:`right`,children:f?`Commit or stash changes before syncing with the default branch`:`Pull latest changes from origin/${p} onto your current branch`})]})}),n[19]=Me,n[20]=p,n[21]=m,n[22]=de,n[23]=f,n[24]=Oe,n[25]=D,n[26]=P):P=n[26];let F;n[27]!==pe||n[28]!==f||n[29]!==g||n[30]!==he||n[31]!==De?(F=f&&pe&&(0,w.jsx)(ne,{children:(0,w.jsxs)(o,{children:[(0,w.jsx)(se,{asChild:!0,children:(0,w.jsxs)(x,{onClick:De,disabled:g||he,children:[he?(0,w.jsx)(_,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,w.jsx)(r,{className:`h-3.5 w-3.5 mr-2`}),`Quick Commit`,(0,w.jsx)(Te,{children:`⌘⇧C`})]})}),(0,w.jsx)(c,{side:`right`,children:`Generate the commit message and commit`})]})}),n[27]=pe,n[28]=f,n[29]=g,n[30]=he,n[31]=De,n[32]=F):F=n[32];let Re;n[33]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,w.jsx)(l,{className:`h-3.5 w-3.5 mr-2`}),n[33]=Re):Re=n[33];let I;n[34]!==g||n[35]!==ge?(I=(0,w.jsx)(se,{asChild:!0,children:(0,w.jsxs)(x,{onClick:ge,disabled:g,children:[Re,`Fetch`]})}),n[34]=g,n[35]=ge,n[36]=I):I=n[36];let L;n[37]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,w.jsx)(c,{side:`right`,children:`Download latest information from remote without merging changes`}),n[37]=L):L=n[37];let R;n[38]===I?R=n[39]:(R=(0,w.jsx)(ne,{children:(0,w.jsxs)(o,{children:[I,L]})}),n[38]=I,n[39]=R);let z;n[40]!==s||n[41]!==g||n[42]!==y?(z=()=>{s&&!g&&y()},n[40]=s,n[41]=g,n[42]=y,n[43]=z):z=n[43];let ze=!s||g?`opacity-50 cursor-not-allowed`:``,Be;n[44]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,w.jsx)(v,{className:`h-3.5 w-3.5 mr-2`}),n[44]=Be):Be=n[44];let B;n[45]!==z||n[46]!==ze?(B=(0,w.jsx)(se,{asChild:!0,children:(0,w.jsxs)(x,{onClick:z,className:ze,children:[Be,`Pull`]})}),n[45]=z,n[46]=ze,n[47]=B):B=n[47];let Ve=s?`Pull latest changes from remote`:`No remote branch to pull from`,V;n[48]===Ve?V=n[49]:(V=(0,w.jsx)(c,{side:`right`,children:Ve}),n[48]=Ve,n[49]=V);let H;n[50]!==B||n[51]!==V?(H=(0,w.jsx)(ne,{children:(0,w.jsxs)(o,{children:[B,V]})}),n[50]=B,n[51]=V,n[52]=H):H=n[52];let U;n[53]!==s||n[54]!==g||n[55]!==b?(U=!s&&(0,w.jsx)(ne,{children:(0,w.jsxs)(o,{children:[(0,w.jsx)(se,{asChild:!0,children:(0,w.jsxs)(x,{onClick:b,disabled:g,children:[(0,w.jsx)(ie,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,w.jsx)(c,{side:`right`,children:`Create remote branch and push local commits`})]})}),n[53]=s,n[54]=g,n[55]=b,n[56]=U):U=n[56];let W;n[57]!==ee||n[58]!==g||n[59]!==b?(W=()=>{ee&&!g&&b()},n[57]=ee,n[58]=g,n[59]=b,n[60]=W):W=n[60];let He=!ee||g?`opacity-50 cursor-not-allowed`:``,Ue;n[61]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,w.jsx)(ie,{className:`h-3.5 w-3.5 mr-2`}),n[61]=Ue):Ue=n[61];let We;n[62]!==W||n[63]!==He?(We=(0,w.jsx)(se,{asChild:!0,children:(0,w.jsxs)(x,{onClick:W,className:He,children:[Ue,`Push Commits`]})}),n[62]=W,n[63]=He,n[64]=We):We=n[64];let Ge=ee?g?`Push in progress...`:`Push your uncommitted commits to the remote branch`:`No commits to push - your branch is up to date with remote`,Ke;n[65]===Ge?Ke=n[66]:(Ke=(0,w.jsx)(c,{side:`right`,children:Ge}),n[65]=Ge,n[66]=Ke);let qe;n[67]!==We||n[68]!==Ke?(qe=(0,w.jsx)(ne,{children:(0,w.jsxs)(o,{children:[We,Ke]})}),n[67]=We,n[68]=Ke,n[69]=qe):qe=n[69];let Je=g||me,G;n[70]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,w.jsx)(ue,{className:`h-3.5 w-3.5 mr-2`}),n[70]=G):G=n[70];let Ye;n[71]!==S||n[72]!==Je?(Ye=(0,w.jsxs)(x,{onClick:S,disabled:Je,children:[G,`History`]}),n[71]=S,n[72]=Je,n[73]=Ye):Ye=n[73];let K;n[74]!==h||n[75]!==g||n[76]!==Se?(K=!h&&(0,w.jsxs)(x,{onClick:Se,disabled:g,children:[(0,w.jsx)(ce,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`,(0,w.jsx)(Te,{children:`⌘⇧P`})]}),n[74]=h,n[75]=g,n[76]=Se,n[77]=K):K=n[77];let Xe;n[78]!==te||n[79]!==g||n[80]!==Ce?(Xe=te&&(0,w.jsxs)(x,{onClick:Ce,disabled:g,children:[(0,w.jsx)(be,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),n[78]=te,n[79]=g,n[80]=Ce,n[81]=Xe):Xe=n[81];let q;n[82]!==g||n[83]!==Ee||n[84]!==oe?(q=oe&&(0,w.jsxs)(x,{onClick:Ee,disabled:g,children:[(0,w.jsx)(t,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`,(0,w.jsx)(Te,{children:`⌘⇧G`})]}),n[82]=g,n[83]=Ee,n[84]=oe,n[85]=q):q=n[85];let J;n[86]!==N||n[87]!==P||n[88]!==F||n[89]!==R||n[90]!==H||n[91]!==U||n[92]!==qe||n[93]!==Ye||n[94]!==K||n[95]!==Xe||n[96]!==q||n[97]!==M?(J=(0,w.jsxs)(we,{align:`end`,children:[M,N,Le,P,F,R,H,U,qe,Ye,K,Xe,q]}),n[86]=N,n[87]=P,n[88]=F,n[89]=R,n[90]=H,n[91]=U,n[92]=qe,n[93]=Ye,n[94]=K,n[95]=Xe,n[96]=q,n[97]=M,n[98]=J):J=n[98];let Y;return n[99]!==je||n[100]!==C||n[101]!==J||n[102]!==j?(Y=(0,w.jsxs)(Ae,{open:C,onOpenChange:je,children:[j,J]}),n[99]=je,n[100]=C,n[101]=J,n[102]=j,n[103]=Y):Y=n[103],Y}function A(e){return e?!0:(S({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}function j(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}function M(e,t,n){let[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(!1),s=()=>n?.id?n.provider?{provider:n.provider,model:n.id}:j(n.id):{provider:void 0,model:void 0};return{isGeneratingMessage:r,isGeneratingPRInfo:a,generateCommitMessageWithAI:(0,C.useCallback)(async()=>{if(!e)return null;try{i(!0);let{provider:t,model:n}=s();return await y(e,n,t)}catch(e){return console.error(`Failed to generate commit message:`,e),S({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{i(!1)}},[e,n]),generatePRInfoWithAI:(0,C.useCallback)(async()=>{if(!e)return null;try{o(!0);let{provider:t,model:n}=s();return await f(e,n,t)}catch(e){return console.error(`Failed to generate PR info:`,e),S({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{o(!1)}},[e,n])}}var N=(0,C.lazy)(()=>b(()=>import(`./commit-dialog-BLzHl6oN.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),Le=(0,C.lazy)(()=>b(()=>import(`./pull-request-dialog-BO_7fALs.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),P=(0,C.lazy)(()=>b(()=>import(`./create-repo-dialog-DHFloJc3.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11]))),F=(0,C.lazy)(()=>b(()=>import(`./git-history-dialog-DXsSt3e0.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([14,6,2]))),Re=(0,C.lazy)(()=>b(()=>import(`./push-before-pr-dialog-B9evx_c7.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([15,6,2]))),I=(0,C.lazy)(()=>b(()=>import(`./pull-with-changes-dialog-DQSC-HUH.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([16,5,2,6])));function L(){return null}async function R(e,t,n,r){r&&(await u(e,{title:r}),n({type:Ee.UpdateThreadTitle,projectId:t,threadId:e,title:r}))}function z({projectId:e,threadId:t,layout:r=`bar`}){let i=Ce(),ie=je(e=>e.projectModelSelections[t]),ce=je(t=>t.projects.find(t=>t.projectId===e)),[l,u]=(0,C.useState)(!1),[d,f]=(0,C.useState)(!1),[ue,h]=(0,C.useState)(!1),[g,_]=(0,C.useState)(!1),[v,me]=(0,C.useState)(``),[y,_e]=(0,C.useState)(``),[ve,ye]=(0,C.useState)(``),[be,b]=(0,C.useState)(!1),[x,xe]=(0,C.useState)(null),we=(0,C.useRef)(!1),Te=(0,C.useRef)(!1),ke=(0,C.useRef)(y),Ae=(0,C.useRef)(ve);ke.current=y,Ae.current=ve;let[T,E]=(0,C.useState)(!1),[D,Ie]=(0,C.useState)([]),[j,z]=(0,C.useState)(!1),[ze,Be]=(0,C.useState)([]),[B,Ve]=(0,C.useState)(!1),[V,H]=(0,C.useState)(!1),[U,W]=(0,C.useState)(``),[He,Ue]=(0,C.useState)(``),[We,Ge]=(0,C.useState)(``),[Ke,qe]=(0,C.useState)(!1),[Je,G]=(0,C.useState)(!1),[Ye,K]=(0,C.useState)(!1),[Xe,q]=(0,C.useState)(!1),J=(0,C.useRef)(!1),Y=Se(),{fetchUnifiedStatus:Ze}=Y,X=M(t,e,ie),Z=(0,C.useRef)(null),Qe=(0,C.useRef)(()=>{}),$e=(0,C.useRef)(()=>{}),et=(0,C.useRef)(()=>{}),tt=(0,C.useRef)(()=>{});(0,C.useEffect)(()=>()=>{Z.current!==null&&(clearInterval(Z.current),Z.current=null)},[]);async function Q(){ge();let e=await a();i({type:Ee.SetProjects,projects:e.projects})}let[$,nt]=(0,C.useState)(()=>Oe()),rt=ce?.commitMethod===fe.Direct;(0,C.useEffect)(()=>{V&&ce?.name&&!U&&W(ce.name)},[V,ce?.name,U]),(0,C.useEffect)(()=>{De($)},[$]);function it(){Ke||(qe(!0),pe().then(e=>Ge(e)).catch(()=>{}))}function at(e){q(e),e&&(it(),Ze(!0))}(0,C.useEffect)(()=>{if(!ue){Te.current=!1;return}if(ue&&$.autoGenerateCommitMessage&&!v.trim()&&t&&!Te.current){Te.current=!0;async function e(){let e=await X.generateCommitMessageWithAI();e&&me(e)}e()}},[ue,$.autoGenerateCommitMessage,t,X.generateCommitMessageWithAI,v]),(0,C.useEffect)(()=>{if(!g){we.current=!1;return}if(g&&$.autoGeneratePRInfo&&!ke.current.trim()&&!Ae.current.trim()&&t&&!we.current){we.current=!0;async function e(){let e=await X.generatePRInfoWithAI();e&&(_e(e.title),ye(e.description),S({title:`Success`,description:`PR title and description generated`}))}e()}},[g,$.autoGeneratePRInfo,t,X.generatePRInfoWithAI]),Qe.current=ut,$e.current=()=>_(!0),et.current=Et,tt.current=()=>{l||d||at(!0)},(0,C.useEffect)(()=>{function e(e){let t=e.key.toLowerCase();if((e.metaKey||e.ctrlKey)&&e.shiftKey&&!e.altKey){if(t===`c`){Y.hasChanges&&$.autoGenerateCommitMessage&&!l&&(e.preventDefault(),Qe.current());return}if(t===`p`){Y.commitsAheadOfDefault&&!Y.prExists&&!Y.hasChanges&&!l&&!rt&&(e.preventDefault(),$e.current());return}if(t===`g`){Y.repoUrl&&!l&&(e.preventDefault(),et.current());return}t===`b`&&!l&&!d&&(e.preventDefault(),tt.current())}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Y.commitsAheadOfDefault,Y.hasChanges,Y.prExists,Y.repoUrl,$.autoGenerateCommitMessage,l,d,rt]),(0,C.useEffect)(()=>{d&&Y.prExists&&Y.prState===`OPEN`&&f(!1)},[Y.prExists,Y.prState,d]),(0,C.useEffect)(()=>{if(!d)return;let e=setTimeout(()=>{f(!1)},15e3);return()=>clearTimeout(e)},[d]),(0,C.useEffect)(()=>{let e=Y.prExists&&Y.prState===`OPEN`&&!Y.hasChanges&&!Y.hasUnpushedCommits;e&&!J.current&&Q(),J.current=e},[Y.hasChanges,Y.hasUnpushedCommits,Y.prExists,Y.prState]);async function ot(){if(v.trim()&&A(t))try{u(!0),await le(t,v),me(``),h(!1),await Y.fetchUnifiedStatus(!0),Q(),S({title:`Changes committed successfully`,description:`Your changes have been committed to '${Y.currentBranch}'.`}),Ye&&(K(!1),await mt())}catch(e){console.error(`Failed to commit:`,e),S({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{u(!1)}}async function st(){if(!A(t))return;let e=Y.prUrl;if(!e)try{e=(await he(t)).url}catch(e){console.error(`Failed to fetch pull request URL:`,e),S({title:`Could not open pull request`,description:e instanceof Error?e.message:`Failed to fetch pull request URL`,variant:`destructive`});return}if(!e){S({title:`Could not open pull request`,description:`Pull request URL is unavailable. Try refreshing git status.`,variant:`destructive`});return}try{await m(e)}catch(e){console.error(`Failed to open pull request:`,e),S({title:`Could not open pull request`,description:e instanceof Error?e.message:`Failed to open URL in browser`,variant:`destructive`})}}async function ct(){if(Y.hasChanges){h(!0);return}if(Y.hasUnpushedCommits&&Y.prExists){await ft();return}if(Y.prExists&&Y.prState===`OPEN`&&!Y.hasChanges&&!Y.hasUnpushedCommits){await st();return}if(Y.commitsAheadOfDefault&&!Y.prExists&&!Y.hasChanges){_(!0);return}if(Y.defaultBranchBehind>0){await _t();return}}async function lt(){let e=await X.generateCommitMessageWithAI();e&&me(e)}async function ut(){if(A(t))try{u(!0);let e=await X.generateCommitMessageWithAI();if(!e){S({title:`Quick Commit failed`,description:`Could not generate commit message`,variant:`destructive`});return}await le(t,e),await Y.fetchUnifiedStatus(!0),Q(),S({title:`Changes committed successfully`,description:`Committed: ${e}`})}catch(e){console.error(`Quick commit failed:`,e),S({title:`Quick Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{u(!1)}}async function dt(){if(A(t))try{u(!0),await te(t),await Y.fetchUnifiedStatus()}catch(e){console.error(`Failed to fetch:`,e)}finally{u(!1)}}async function ft(){if(A(t))try{u(!0),await p(t),await Y.fetchUnifiedStatus(!0),Q(),Y.hasRemoteBranch?S({title:`Branch pushed successfully`,description:`Your branch '${Y.currentBranch}' has been pushed to the remote.`}):S({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){console.error(`Failed to push:`,e),S({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{u(!1)}}async function pt(){if(A(t)){if(Y.hasChanges){G(!0);return}await mt()}}async function mt(){try{u(!0),await ee(t),await Y.fetchUnifiedStatus(!0),Q(),S({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){console.error(`Failed to pull:`,e),S({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{u(!1)}}function ht(){G(!1),K(!0),h(!0)}async function gt(){G(!1),await mt()}async function _t(){if(A(t))try{u(!0),await oe(t),await Y.fetchUnifiedStatus(!0),Q(),S({title:`Branch synced successfully`,description:`Your branch '${Y.currentBranch}' has been synced with the latest changes`})}catch(e){console.error(`[sync] ✗ Failed to sync branch:`,e),S({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{u(!1)}}async function vt(){if(A(t))try{u(!0),f(!0);let n=await s(t,y,ve);await R(t,e,i,n.title??y),n.prUrl&&await m(n.prUrl),_e(``),ye(``),_(!1),await Y.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 Y.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to create PR:`,e);let t=e instanceof Error?e.message:`Failed to create PR`;t.includes(`push the current branch`)||t.includes(`--head flag`)?(_(!1),xt({title:y,description:ve})):(f(!1),S({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{u(!1)}}async function yt(){if(A(t))try{u(!0);let e=await n(t,U,He,$.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{m(e.repoUrl)},3e3),W(``),Ue(``),H(!1),await Y.fetchUnifiedStatus(),Q()}catch(e){console.error(`Failed to create repo:`,e)}finally{u(!1)}}async function bt(){let e=await X.generatePRInfoWithAI();e&&(_e(e.title),ye(e.description),S({title:`Success`,description:`PR title and description generated`}))}async function xt(n){let r=n??x;if(!(!t||!r))try{u(!0),f(!0);try{await p(t)}catch(e){let n=e?.message??``;if(n.includes(`non-fast-forward`)||n.includes(`Updates were rejected because the tip of your current branch is behind`)){S({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await oe(t),await p(t)}catch{throw e}}else throw e}let n=await s(t,r.title,r.description);await R(t,e,i,n.title??r.title),n.prUrl&&await m(n.prUrl),_e(``),ye(``),xe(null),b(!1),await Y.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 Y.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to push and create PR:`,e);let t=e instanceof Error?e.message:`Failed to push and create PR`;f(!1),S({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{u(!1)}}async function St(){if(A(t))try{z(!0);let e=await de(t,100);Ie(e),Be(e.slice(0,10)),E(!0)}catch(e){console.error(`Failed to fetch git history:`,e)}finally{z(!1)}}function Ct(){B||(Ve(!0),setTimeout(()=>{let e=ze.length+10;Be(D.slice(0,e)),Ve(!1)},300))}function wt(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&ze.length<D.length&&!B&&Ct()}let Tt=O(Y);function Et(){Y.repoUrl&&m(Y.repoUrl)}function Dt(){b(!1),xe(null)}return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:ae(`flex items-center gap-0`,r===`menu`&&`w-full flex-col gap-1 [&_button]:w-full [&_button]:justify-start`),children:[(0,w.jsx)(ne,{children:(0,w.jsxs)(o,{children:[(0,w.jsx)(se,{asChild:!0,children:(0,w.jsxs)(re,{variant:`outline`,size:`sm`,className:ae(`h-8 gap-1.5`,r===`bar`&&`rounded-r-none border-r-0`,r===`menu`&&`rounded-md border`,Tt&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`),disabled:Fe(Y,l,d),onClick:ct,children:[Ne(Y,d,l),Me(Y,d)]})}),(0,w.jsx)(c,{children:Pe(Y)})]})}),(0,w.jsx)(k,{branchStatus:Y.status,remoteUrl:Y.remoteUrl,hasRemoteBranch:Y.hasRemoteBranch,hasUnpushedCommits:Y.hasUnpushedCommits,canCreateRepo:Y.canCreateRepo,repoUrl:Y.repoUrl,isRefreshing:Y.isRefreshing,isBrandState:Tt,hasChanges:Y.hasChanges,defaultBranch:Y.defaultBranch??null,defaultBranchAhead:Y.defaultBranchAhead,defaultBranchBehind:Y.defaultBranchBehind,gitUser:We,isDirectCommitMode:rt,autoGenerateCommitMessage:$.autoGenerateCommitMessage,isLoading:l||d,isLoadingHistory:j,isQuickCommitting:X.isGeneratingMessage&&l,onFetch:()=>void dt(),onPull:()=>void pt(),onPush:()=>void ft(),onOpenHistory:()=>void St(),onCreatePR:()=>_(!0),onCreateRepo:()=>H(!0),onViewInGitHub:Et,onQuickCommit:()=>void ut(),onSyncWithDefault:()=>void _t(),open:Xe,onOpenChange:at,layout:r})]}),ue&&(0,w.jsx)(C.Suspense,{fallback:(0,w.jsx)(L,{}),children:(0,w.jsx)(N,{open:ue,onOpenChange:h,commitMessage:v,onCommitMessageChange:me,autoGenerateCommitMessage:$.autoGenerateCommitMessage,onAutoGenerateChange:e=>nt(t=>({...t,autoGenerateCommitMessage:e})),isGeneratingMessage:X.isGeneratingMessage,isLoading:l,onGenerateMessage:lt,onCommit:ot,currentBranch:Y.currentBranch})}),g&&(0,w.jsx)(C.Suspense,{fallback:(0,w.jsx)(L,{}),children:(0,w.jsx)(Le,{open:g,onOpenChange:_,prTitle:y,onPrTitleChange:_e,prDescription:ve,onPrDescriptionChange:ye,isGeneratingPRInfo:X.isGeneratingPRInfo,isLoading:l,onGeneratePRInfo:bt,onCreatePR:vt,currentBranch:Y.currentBranch,autoGeneratePRInfo:$.autoGeneratePRInfo,onAutoGeneratePRInfoChange:e=>nt(t=>({...t,autoGeneratePRInfo:e}))})}),be&&(0,w.jsx)(C.Suspense,{fallback:(0,w.jsx)(L,{}),children:(0,w.jsx)(Re,{open:be,onOpenChange:b,isLoading:l,onPushAndCreatePR:xt,onCancel:Dt})}),V&&(0,w.jsx)(C.Suspense,{fallback:(0,w.jsx)(L,{}),children:(0,w.jsx)(P,{open:V,onOpenChange:H,repoName:U,onRepoNameChange:W,repoDescription:He,onRepoDescriptionChange:Ue,isPrivateRepo:$.privateRepositoryDefault,onPrivateRepoChange:e=>nt(t=>({...t,privateRepositoryDefault:e})),isLoading:l,onCreateRepo:yt})}),T&&(0,w.jsx)(C.Suspense,{fallback:(0,w.jsx)(L,{}),children:(0,w.jsx)(F,{open:T,onOpenChange:E,commits:D,displayedCommits:ze,isLoadingMore:B,onScroll:wt,currentBranch:Y.currentBranch})}),Je&&(0,w.jsx)(C.Suspense,{fallback:(0,w.jsx)(L,{}),children:(0,w.jsx)(I,{open:Je,onOpenChange:G,onCommitFirst:ht,onStashAndPull:gt,onCancel:()=>G(!1),isLoading:l})})]})}export{z as GitOpsButton};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{$o as n,Ai as r,Ci as i,Di as a,Ei as o,Fr as s,Gr as c,Hr as l,Ir as u,Lr as d,Mi as f,Ni as p,Oi as m,Pi as h,Qo as g,Rr as _,Si as v,Ti as y,Ur as b,Vr as x,Wo as S,Wr as C,_ as w,_i as T,ai as E,bi as D,c as O,ci as k,di as A,ds as j,ea as M,es as ee,fi as N,fs as P,hi as te,ho as ne,ii as re,ja as F,ji as I,ki as L,l as ie,li as ae,mi as oe,ms as se,ns as ce,oi as le,ot as ue,pi as de,ps as fe,ri as pe,s as me,si as he,ta as R,ts as ge,u as _e,ui as ve,vi as ye,wa as be,xa as z,zr as xe}from"./dialogs-config-BF_RyK5j.js";var B=P(),Se=Object,Ce=Map,we=Set,Te=we.prototype.has,Ee=we.prototype.add,De=Ce.prototype.has,Oe=Ce.prototype.get,ke=Ce.prototype.set,Ae=1,je=2,Me=4,Ne=8,Pe=16,Fe=32,V=`__t`,Ie=`__p`,Le=`__e`,Re=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ze=`http://www.w3.org/1999/xlink`,Be=`http://www.w3.org/2000/xmlns/`,Ve=120,He=new we([`href`,`list`,`form`,`tabIndex`,`download`]),Ue=new we([`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 H=document;H.createElement(`template`);var We=H.createElement(`template`),Ge=We.content,Ke=H.createElementNS(`http://www.w3.org/2000/svg`,`svg`),U=Node.prototype,qe=Element.prototype,Je=CharacterData.prototype,Ye=Se.getOwnPropertyDescriptor,Xe=U.insertBefore,Ze=U.cloneNode,Qe=U.replaceChild,$e=qe.remove,et=U.addEventListener,tt=qe.removeAttribute,nt=qe.setAttribute,rt=qe.setAttributeNS,it=Ye(U,`textContent`).set,at=Ye(U,`firstChild`).get,ot=Ye(U,`nextSibling`).get,st=Ye(Je,`data`).set,ct=(e,t)=>{let n=t?Ke:We;return n.innerHTML=e,(t?Ke:Ge).firstChild};H[Le]=new we;var lt=(e,t,n)=>{let r=t.toLowerCase(),i=!1;r.endsWith(`capture`)&&(r=r.slice(0,-7),i=!0);let a=`$$${r}`;Te.call(H[Le],r)||(et.call(H,r,e=>{let t=e.target;for(;t;){let n=t[a];n&&(Se.defineProperty(e,`currentTarget`,{configurable:!0,get(){return t}}),n(e)),t=t.parentNode}},{capture:i}),Ee.call(H[Le],r));let o=t=>{t?`key`in t&&t.key===e[a]?.key||(e[a]=t):e[a]=null};return o(n),o},ut=(e,t)=>{let n=at.call(e);if(t)for(let e=0;e<t&&n;++e)n=ot.call(n);return n},dt=new WeakSet,ft=e=>{if(dt.has(e))return;e.nodeType===8&&e.parentNode?.removeChild(e);let t=at.call(e);for(;t;)ft(t),t=t.nextSibling;dt.add(e)},pt=(e,t,n)=>{let r=H.createTextNode(t),i=ut(e,n);return Xe.call(e,r,i),r},mt=(e,t)=>{st.call(e,t)},ht=(e,t,n)=>{typeof n!=`number`||Re.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`},gt=(e,t,n)=>{t=t.replace(/xlink(?:H|:h)/,`h`).replace(/sName$/,`s`),t.startsWith(`xmlns`)?rt.call(e,Be,t,String(n)):t.startsWith(`xlink`)&&rt.call(e,ze,`href`,String(n))},_t=(e,t,n)=>{let r=n==null;if(n=r?``:n,t in e&&e[t]!==void 0&&e[t]!==null&&!(e instanceof SVGElement)&&Te.call(He,t))try{e[t]=n}catch{}else !r&&n!==``&&(n!==!1||t.includes(`-`))?nt.call(e,t,String(n)):tt.call(e,t);let i=e instanceof HTMLInputElement,a=e instanceof HTMLSelectElement,o=e instanceof HTMLTextAreaElement;t===`value`&&(i||a||o)&&(nt.call(e,t,String(n)),e.value=n)},vt=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 yt(e){return vt.get(e)||e}var bt=Object.defineProperty,xt=(e,t,n)=>t in e?bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,W=(e,t,n)=>(xt(e,typeof t==`symbol`?t:t+``,n),n),St=class{constructor(){W(this,`r`),W(this,`e`),W(this,`l`),W(this,`g`),W(this,`_u`),W(this,`_t`),W(this,`d`),W(this,`k`),W(this,`c`)}},Ct=(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:Ae,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=yt(t);if(i&&(t=i),t===`className`&&(t=`class`),t.startsWith(`on`)){`$`in n?a.e.push({t:Me,n:t.slice(2),v:null,h:n.$,i:null,l:null,p:null,b:null}):a.i.push({t:Me,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:Ne,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):t.charCodeAt(0)===Ve?a.e.push({t:Pe,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):a.e.push({t:je,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:Ne,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(Te.call(Ue,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:Ae,n:null,v:null,h:s.$,i:r,l:null,p:null,b:null});continue}if(s instanceof St){a.i.push({t:Fe,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:Ae,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+=Ct(s,t,l)}return(a.i.length||a.e.length)&&t.push(a),`<${e.type}${r}>${i}</${e.type}>`},wt=Object.defineProperty,Tt=(e,t,n)=>t in e?wt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Et=(e,t,n)=>(Tt(e,typeof t==`symbol`?t:t+``,n),n),Dt=e=>new Ot(e),Ot=class extends St{constructor(e){super(),Et(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 Mt.call(this),a;if(r===0)return At.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){Bt.call(u,d),n[s]=u,u=t[++o],d=n[++s];continue}let i=f.k,h=p.k;if(i===h){Bt.call(f,p),n[l]=f,f=t[--c],p=n[--l];continue}if(e===h){Bt.call(u,p),n[l]=u;let e=n[l+1];Vt.call(u,e,e?.l||null),u=t[++o],p=n[--l];continue}if(i===r){Bt.call(f,d),n[s]=f;let e=t[o];Vt.call(f,e,e?.l||null),f=t[--c],d=n[++s];continue}if(!m){m=new Ce;for(let e=o;e<=c;e++)ke.call(m,t[e].k,e)}let g=m.get(r);if(g===void 0)zt.call(d,a,u.l||null);else{let e=t[g];Vt.call(e,u,null),Bt.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)zt.call(n[t],a,e?e.l:null)}else for(let e=o;e<=c;++e)Ht.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];zt.call(r,e,t)}return this._t=e,e}x(){let e=this.t();if(e)it.call(e,``);else for(let e=0,t=this.b.length;e<t;++e)Ht.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}},kt=Ot.prototype,At=kt.m,jt=kt.p,Mt=kt.x,Nt=new Proxy({},{get(e,t){return{$:t}}}),Pt=(e,t,n,r)=>{let i=e(Nt),a=[],o=ct(Ct(t?t(i):i,a),r);return ft(o),(e,t,r)=>new It(o,a,e,t??e?.key??null,r??n??null,null)},Ft=(e,t)=>{if((`b`in e||`b`in t)&&jt.call(e,t),e.l||zt.call(e,void 0,null,null),e.k&&e.k===t.k||e.r===t.r)return Bt.call(e,t);let n=zt.call(t,e.t(),e.l,null);return Ht.call(e),e.k=t.k,n},It=class extends St{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??Ze.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]??Lt(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&Ae){if(o instanceof St){let e=ut(a,i.i);n?o.m(a,e,e):o.m(a,e);continue}if(a[V]||(a[V]=Array(r)),o&&typeof o==`object`&&`foreign`in o){if(n){let e=ut(a,i.i);o.reset(e)}let t=o.current;a[V][e]=t,n||Xe.call(a,t,ut(a,i.i));continue}if(n){a[V][e]=ut(a,i.i);continue}a[V][e]=pt(a,o==null||o===!1?``:String(o),i.i)}else if(i.t&Me){let e=lt(a,i.n,o);a[Ie+i.n]=e}else if(i.t&je)_t(a,i.n,o);else if(i.t&Ne)if(typeof o==`string`||typeof o==`number`)ht(a,i.n,o);else for(let e in o)ht(a,e,o[e]);else gt(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&Ae)r.v&&!n&&pt(a,r.v,r.i);else if(r.t&Me)lt(a,r.n,r.l);else{let e=ut(a,r.i);n?r.b.m(a,e,e):r.b.m(a,e)}}}return e&&!n&&Xe.call(e,r,t),this.l=r,r}p(e){let t=this.l;if(!e.d)return t;let n=this.d;if(!Ut.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]??Lt(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&Me){a[Ie+o.n](c);continue}if(o.t&Ae){if(s instanceof St){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[V][t];if(c.unstable&&s!==c){let n=c.current;a[V][t]=n,Qe.call(a,n,e)}else c.current=e;continue}mt(a[V][t],c==null||c===!1?``:String(c))}else if(o.t&je)_t(a,o.n,c);else if(o.t&Ne)if(typeof c==`string`||typeof c==`number`)ht(a,o.n,c);else for(let e in c)c[e]!==s[e]&&ht(a,e,c[e]);else gt(a,o.n,c)}}}return t}v(e=null,t=null){Xe.call(this.t(),this.l,e?e.l:t)}x(){$e.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}},Lt=(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=ut(t,r)}return a&&(n[r]=t),t},Rt=It.prototype,zt=Rt.m,Bt=Rt.p,Vt=Rt.v,Ht=Rt.x,Ut=Rt.u,G=e(se(),1),Wt={noSlot:!1},Gt=e(fe(),1),Kt=`slot`,qt=({effect:e,deps:t})=>((0,G.useEffect)(e,t||[]),null),K=new Map,Jt=(0,G.createContext)(!1),Yt=(e,t,n)=>{let r={ref:t},i=0;for(let t in e){let a=e[t];if((0,G.isValidElement)(a)||Array.isArray(a)&&a.length&&(0,G.isValidElement)(a[0])){r[t]=Zt(a,!1,n,i++);continue}r[t]=e[t]}return r},Xt=(e,t)=>(0,G.createElement)(Kt,{suppressHydrationWarning:!0,id:t},e),Zt=(e,t,n,r,i)=>{let a=n?.[r]?.current,o=(0,G.isValidElement)(e)&&typeof e.type==`function`&&`_c`in e.type,s=o&&e.type._c;if(typeof window>`u`)return o?s?e:Xt(Xt(e),i):Xt(e,i);if(s){let t=e.type(e.props);if(K.has(t.type)){let e=K.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,Gt.createPortal)((0,G.createElement)(G.Fragment,{children:e}),c,i),reset:e=>{e.childNodes.forEach(t=>e.removeChild(t))},unstable:t};return n&&(n[r]=l),l},Qt=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 Qt(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=$t(e.props.children).map(e=>Qt(e))),{type:t,props:n}},$t=e=>{if(e==null)return[];if(typeof e==`object`&&`type`in e&&e.type===G.Fragment)return $t(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(...$t(t[e]));return n},en=typeof window>`u`?G.useEffect:G.useLayoutEffect;function tn(e,t,n){if(!e||t(e))return e;let r=n?e.return:e.child;for(;r;){let e=tn(r,t,n);if(e)return e;r=n?null:r.sibling}}function nn(){let e=(0,G.useRef)();return(0,G.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 rn(e){let t=nn(),n=(0,G.useRef)({el:null,depth:0});return en(()=>{n.current.el=tn(t,t=>(n.current.depth++,typeof t.type==`string`&&(e===void 0||t.type===e)),!0)?.stateNode},[t]),n}function an(){let e=nn(),t=(0,G.useRef)({el:null,depth:0});return en(()=>{t.current.el=tn(e,e=>(t.current.depth++,e.stateNode?.containerInfo!=null),!0)?.stateNode.containerInfo},[e]),t}var on=(e,t={})=>{let n=t?.experimental_noSlot??Wt.noSlot,r=t?.block,i=t?.svg?`g`:Kt;e&&(r=Pt(e,Qt,t?.shouldUpdate,t?.svg));let a=(e,a)=>{let o=an(),s=rn(),c=e._hmr,l=(0,G.useRef)(null),u=(0,G.useRef)(null),d=(0,G.useRef)([]);e=Yt(e,a,d.current),u.current?.(e);let f=(0,G.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 \`${Ze.call(l.current).outerHTML}\` element.
|
|
3
|
+
To avoid this error, \`experimental_options.noSlot\` should be false`))),(u.current===null||c)&&(zt.call(i,l.current,null),u.current=e=>{Ft(i,r(e,e.key,t?.shouldUpdate))}),()=>{Ht.call(i)}},[]),p=(0,G.useMemo)(()=>n?null:(0,G.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,G.createElement)(G.Fragment,{},p,(0,G.createElement)(qt,{effect:f,deps:c?[c]:[]}),h)};return De.call(K,a)||ke.call(K,a,on),t?.name&&(e&&(e.displayName=`Million(Render(${t.name}))`),a.displayName=`Million(Block(${t.name}))`),a};(0,G.memo)(({each:e,children:t,memo:n,svg:r,as:i,...a})=>{let o=(0,G.useRef)(null),[s]=(0,G.useState)(()=>({current:Array(e.length)})),c=(0,G.useRef)(null),l=(0,G.useRef)({each:null,children:null,mounted:!1}),[,u]=(0,G.useState)(!1);if(c.current&&(e!==l.current.each||!n)){let r=sn(e,t,l,s,n);jt.call(c.current,Dt(r))}let d=(0,G.createElement)(G.Fragment,null,(0,G.createElement)(i??(r?`g`:`slot`),{...a,ref:o}),...s.current.map(e=>e.portal));return(0,G.useEffect)(()=>{!o.current||c.current||l.current.mounted||(c.current=Dt(sn(e,t,l,s,n)),De.call(K,d)||ke.call(K,d,c.current),At.call(c.current,o.current),l.current.mounted=!0,u(!0))},[o.current]),d});var sn=(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(De.call(K,s.type)){o.block||=Oe.call(K,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(De.call(K,e.type)){let t=Oe.call(K,e.type);if(typeof t==`function`){a[n]=t(e.props);continue}}}let c=Pt(e=>e?.scope),l=(e,t,n)=>c({scope:Zt((0,G.createElement)(s.type,e),!1,t.current,n)},s.key?String(s.key):void 0);ke.call(K,s.type,l),o.block=l,a[n]=l(s.props,r,n)}return o.each=e,o.children=a,a};function cn(e,t){return e===t||e!==e&&t!==t}function ln(e,t){for(let n in e)if(!cn(e[n],t[n]))return!0;return!1}function un(e,{portals:t,...n}){let r=`CompiledBlock(Inner(${n.name}))`,i=on(t=>e(t),{...n,scoped:void 0,name:r,shouldUpdate:ln}),a=t?.length||0,o=t&&a>0?e=>{let n=(0,G.useContext)(Jt),[r]=(0,G.useState)(()=>[]),o={...e,scoped:n};for(let e=0;e<a;e++){let n=t[e];o[n]=Zt(o[n],!1,r,e)}let s=[];for(let e=0,t=r.length;e<t;e++)s[e]=r[e].portal;return(0,G.createElement)(G.Fragment,null,(0,G.createElement)(i,o),s)}:e=>(0,G.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 q=j(),dn=`AlertDialog`,[fn,pn]=r(dn,[N]),J=N(),mn=e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,q.jsx)(k,{...r,...n,modal:!0})};mn.displayName=dn;var hn=`AlertDialogTrigger`,gn=G.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(ve,{...i,...r,ref:t})});gn.displayName=hn;var _n=`AlertDialogPortal`,vn=e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,q.jsx)(he,{...r,...n})};vn.displayName=_n;var yn=`AlertDialogOverlay`,bn=G.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(le,{...i,...r,ref:t})});bn.displayName=yn;var xn=`AlertDialogContent`,[Sn,Cn]=fn(xn),wn=o(`AlertDialogContent`),Tn=G.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=J(n),o=G.useRef(null),s=z(t,o),c=G.useRef(null);return(0,q.jsx)(A,{contentName:xn,titleName:En,docsSlug:`alert-dialog`,children:(0,q.jsx)(Sn,{scope:n,cancelRef:c,children:(0,q.jsxs)(re,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:I(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,q.jsx)(wn,{children:r}),(0,q.jsx)(Pn,{contentRef:o})]})})})});Tn.displayName=xn;var En=`AlertDialogTitle`,Dn=G.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(ae,{...i,...r,ref:t})});Dn.displayName=En;var On=`AlertDialogDescription`,kn=G.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(E,{...i,...r,ref:t})});kn.displayName=On;var An=`AlertDialogAction`,jn=G.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(pe,{...i,...r,ref:t})});jn.displayName=An;var Mn=`AlertDialogCancel`,Nn=G.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=Cn(Mn,n),a=J(n),o=z(t,i);return(0,q.jsx)(pe,{...a,...r,ref:o})});Nn.displayName=Mn;var Pn=({contentRef:e})=>{let t=`\`${xn}\` requires a description for the component to be accessible for screen reader users.
|
|
4
|
+
|
|
5
|
+
You can add a description to the \`${xn}\` by passing a \`${On}\` 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 \`${xn}\`. 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 G.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},Fn=mn,In=vn,Ln=bn,Rn=Tn,zn=jn,Bn=Nn,Vn=Dn,Hn=kn,Un=Fn,Wn=In,Gn=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,q.jsx)(Ln,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Gn.displayName=Ln.displayName;var Kn=G.forwardRef((e,t)=>{let n=(0,B.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,q.jsx)(Gn,{}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=h(`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,q.jsxs)(Wn,{children:[a,(0,q.jsx)(Rn,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});Kn.displayName=Rn.displayName;var qn=e=>{let t=(0,B.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=h(`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,q.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};qn.displayName=`AlertDialogHeader`;var Jn=e=>{let t=(0,B.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=h(`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,q.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};Jn.displayName=`AlertDialogFooter`;var Yn=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(R.dialogTitle,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(Vn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Yn.displayName=Vn.displayName;var Xn=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(R.dialogDescription,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(Hn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Xn.displayName=Hn.displayName;var Zn=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(p(),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(zn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Zn.displayName=zn.displayName;var Qn=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(p({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,q.jsx)(Bn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Qn.displayName=Bn.displayName;var $n=un(e=>(0,q.jsxs)(`div`,{className:e.v0,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:e.v1,children:e.v2}),e.v3]}),e.v4]}),{name:`PageHeader_1`,portals:[`v2`,`v3`,`v4`]}),er=function(e){let t=(0,B.c)(12),{title:n,description:r,action:i,className:a,titleClassName:o}=e,s;t[0]===a?s=t[1]:(s=h(`flex items-center justify-between mb-6`,a),t[0]=a,t[1]=s);let c;t[2]===o?c=t[3]:(c=h(R.pageTitle,o),t[2]=o,t[3]=c);let l;t[4]===r?l=t[5]:(l=r?(0,q.jsx)(`p`,{className:R.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,q.jsx)($n,{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 tr(e){let t=(0,B.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=h(M.settingsPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,q.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function nr(e){let t=(0,B.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=h(M.accountPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,q.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function rr(e){let t=(0,B.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=h(M.formPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,q.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ir(e){let t=(0,B.c)(5),{title:n,className:r}=e,i;t[0]===r?i=t[1]:(i=h(R.sectionTitle,`mb-3`,r),t[0]=r,t[1]=i);let a;return t[2]!==i||t[3]!==n?(a=(0,q.jsx)(`h2`,{className:i,children:n}),t[2]=i,t[3]=n,t[4]=a):a=t[4],a}function ar(e){let t=(0,B.c)(6),{children:n,variant:r,className:i}=e,a=r===void 0?`info`:r,o;t[0]!==i||t[1]!==a?(o=h(a===`hint`?R.hintBanner:a===`success`?h(R.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`?h(R.error,`bg-destructive/10 rounded-md px-3 py-2 mb-4`):R.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,q.jsx)(`div`,{className:o,children:n}),t[3]=n,t[4]=o,t[5]=s):s=t[5],s}function or(e){let t=(0,B.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=h(`flex-1 overflow-auto`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,q.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,B.c)(10),{children:n,title:r,action:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,q.jsx)(`h2`,{className:h(R.emptyStateTitle,`mb-2`),children:r}):null,t[0]=r,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,q.jsx)(`p`,{className:R.bodyMuted,children:n}),t[2]=n,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,q.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,q.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,q.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 cr(e){let t=(0,B.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=h(`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,q.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function lr(e){let t=(0,B.c)(14),{title:n,description:r,action:i,children:a,className:o}=e,s;t[0]===n?s=t[1]:(s=(0,q.jsx)(ir,{title:n,className:`mb-1`}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,q.jsx)(`p`,{className:R.bodyMuted,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,q.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,q.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,q.jsxs)(`div`,{className:o,children:[u,a]}),t[10]=a,t[11]=o,t[12]=u,t[13]=d):d=t[13],d}function ur(e){let t=G.useRef({value:e,previous:e});return G.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var dr=[` `,`Enter`,`ArrowUp`,`ArrowDown`],fr=[` `,`Enter`],pr=`Select`,[mr,hr,gr]=me(pr),[_r,vr]=r(pr,[gr,c]),yr=c(),[br,Y]=_r(pr),[xr,Sr]=_r(pr),Cr=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:o,value:s,defaultValue:c,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:p,required:h,form:g}=e,_=yr(t),[v,y]=G.useState(null),[b,x]=G.useState(null),[S,w]=G.useState(!1),T=_e(u),[E,D]=a({prop:r,defaultProp:i??!1,onChange:o,caller:pr}),[O,k]=a({prop:s,defaultProp:c,onChange:l,caller:pr}),A=G.useRef(null),j=v?g||!!v.closest(`form`):!0,[M,ee]=G.useState(new Set),N=Array.from(M).map(e=>e.props.value).join(`;`);return(0,q.jsx)(C,{..._,children:(0,q.jsxs)(br,{required:h,scope:t,trigger:v,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:w,contentId:m(),value:O,onValueChange:k,open:E,onOpenChange:D,dir:T,triggerPointerDownPosRef:A,disabled:p,children:[(0,q.jsx)(mr.Provider,{scope:t,children:(0,q.jsx)(xr,{scope:e.__scopeSelect,onNativeOptionAdd:G.useCallback(e=>{ee(t=>new Set(t).add(e))},[]),onNativeOptionRemove:G.useCallback(e=>{ee(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),j?(0,q.jsxs)(gi,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:f,value:O,onChange:e=>k(e.target.value),disabled:p,form:g,children:[O===void 0?(0,q.jsx)(`option`,{value:``}):null,Array.from(M)]},N):null]})})};Cr.displayName=pr;var wr=`SelectTrigger`,Tr=G.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...a}=e,o=yr(n),s=Y(wr,n),c=s.disabled||r,l=z(t,s.onTriggerChange),u=hr(n),d=G.useRef(`touch`),[f,p,m]=vi(e=>{let t=u().filter(e=>!e.disabled),n=yi(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),h=e=>{c||(s.onOpenChange(!0),m()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,q.jsx)(x,{asChild:!0,...o,children:(0,q.jsx)(i.button,{type:`button`,role:`combobox`,"aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":_i(s.value)?``:void 0,...a,ref:l,onClick:I(a.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&h(e)}),onPointerDown:I(a.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(h(e),e.preventDefault())}),onKeyDown:I(a.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&p(e.key),!(t&&e.key===` `)&&dr.includes(e.key)&&(h(),e.preventDefault())})})})});Tr.displayName=wr;var Er=`SelectValue`,Dr=G.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,children:o,placeholder:s=``,...c}=e,l=Y(Er,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=z(t,l.onValueNodeChange);return L(()=>{u(d)},[u,d]),(0,q.jsx)(i.span,{...c,ref:f,style:{pointerEvents:`none`},children:_i(l.value)?(0,q.jsx)(q.Fragment,{children:s}):o})});Dr.displayName=Er;var Or=`SelectIcon`,kr=G.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...a}=e;return(0,q.jsx)(i.span,{"aria-hidden":!0,...a,ref:t,children:r||`▼`})});kr.displayName=Or;var Ar=`SelectPortal`,jr=e=>(0,q.jsx)(T,{asChild:!0,...e});jr.displayName=Ar;var Mr=`SelectContent`,Nr=G.forwardRef((e,t)=>{let n=Y(Mr,e.__scopeSelect),[r,i]=G.useState();if(L(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Gt.createPortal((0,q.jsx)(Pr,{scope:e.__scopeSelect,children:(0,q.jsx)(mr.Slot,{scope:e.__scopeSelect,children:(0,q.jsx)(`div`,{children:e.children})})}),t):null}return(0,q.jsx)(Lr,{...e,ref:t})});Nr.displayName=Mr;var X=10,[Pr,Z]=_r(Mr),Fr=`SelectContentImpl`,Ir=y(`SelectContent.RemoveScroll`),Lr=G.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=Y(Mr,n),[y,b]=G.useState(null),[x,S]=G.useState(null),C=z(t,e=>b(e)),[w,T]=G.useState(null),[E,O]=G.useState(null),k=hr(n),[A,j]=G.useState(!1),M=G.useRef(!1);G.useEffect(()=>{if(y)return de(y)},[y]),te();let ee=G.useCallback(e=>{let[t,...n]=k().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&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,x]),N=G.useCallback(()=>ee([w,y]),[ee,w,y]);G.useEffect(()=>{A&&N()},[A,N]);let{onOpenChange:P,triggerPointerDownPosRef:ne}=v;G.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(ne.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(ne.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||P(!1),document.removeEventListener(`pointermove`,t),ne.current=null};return ne.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,P,ne]),G.useEffect(()=>{let e=()=>P(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[P]);let[re,F]=vi(e=>{let t=k().filter(e=>!e.disabled),n=yi(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),L=G.useCallback((e,t,n)=>{let r=!M.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(M.current=!0))},[v.value]),ie=G.useCallback(()=>y?.focus(),[y]),ae=G.useCallback((e,t,n)=>{let r=!M.current&&!n;(v.value!==void 0&&v.value===t||r)&&O(e)},[v.value]),se=r===`popper`?Vr:zr,ce=se===Vr?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,q.jsx)(Pr,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:L,selectedItem:w,onItemLeave:ie,itemTextRefCallback:ae,focusSelectedItem:N,selectedItemText:E,position:r,isPositioned:A,searchRef:re,children:(0,q.jsx)(oe,{as:Ir,allowPinchZoom:!0,children:(0,q.jsx)(ye,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:I(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,q.jsx)(D,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,q.jsx)(se,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...ce,onPlaced:()=>j(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:I(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&F(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().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(()=>ee(t)),e.preventDefault()}})})})})})})});Lr.displayName=Fr;var Rr=`SelectItemAlignedPosition`,zr=G.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...a}=e,o=Y(Mr,n),s=Z(Mr,n),[c,l]=G.useState(null),[u,d]=G.useState(null),f=z(t,e=>d(e)),p=hr(n),m=G.useRef(!1),h=G.useRef(!0),{viewport:g,selectedItem:_,selectedItemText:v,focusSelectedItem:y}=s,b=G.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&g&&_&&v){let e=o.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if(o.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=ie(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=ie(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=p(),s=window.innerHeight-X*2,l=g.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+h+l+b+y,S=Math.min(_.offsetHeight*5,x),C=window.getComputedStyle(g),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-X,D=s-E,O=_.offsetHeight/2,k=_.offsetTop+O,A=f+h+k,j=x-A;if(A<=E){let e=a.length>0&&_===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-g.offsetTop-g.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);c.style.height=n+`px`}else{let e=a.length>0&&_===a[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+g.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,g.scrollTop=A-E+g.offsetTop}c.style.margin=`${X}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>m.current=!0)}},[p,o.trigger,o.valueNode,c,u,g,_,v,o.dir,r]);L(()=>b(),[b]);let[x,S]=G.useState();return L(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]),(0,q.jsx)(Hr,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:G.useCallback(e=>{e&&h.current===!0&&(b(),y?.(),h.current=!1)},[b,y]),children:(0,q.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,q.jsx)(i.div,{...a,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});zr.displayName=Rr;var Br=`SelectPopperPosition`,Vr=G.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=yr(n);return(0,q.jsx)(b,{...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)`}})});Vr.displayName=Br;var[Hr,Ur]=_r(Mr,{}),Wr=`SelectViewport`,Gr=G.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...a}=e,o=Z(Wr,n),s=Ur(Wr,n),c=z(t,o.onViewportChange),l=G.useRef(0);return(0,q.jsxs)(q.Fragment,{children:[(0,q.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,q.jsx)(mr.Slot,{scope:n,children:(0,q.jsx)(i.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:I(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-X*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});Gr.displayName=Wr;var Kr=`SelectGroup`,[qr,Jr]=_r(Kr),Yr=G.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,a=m();return(0,q.jsx)(qr,{scope:n,id:a,children:(0,q.jsx)(i.div,{role:`group`,"aria-labelledby":a,...r,ref:t})})});Yr.displayName=Kr;var Xr=`SelectLabel`,Zr=G.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,a=Jr(Xr,n);return(0,q.jsx)(i.div,{id:a.id,...r,ref:t})});Zr.displayName=Xr;var Qr=`SelectItem`,[$r,ei]=_r(Qr),ti=G.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:a=!1,textValue:o,...s}=e,c=Y(Qr,n),l=Z(Qr,n),u=c.value===r,[d,f]=G.useState(o??``),[p,h]=G.useState(!1),g=z(t,e=>l.itemRefCallback?.(e,r,a)),_=m(),v=G.useRef(`touch`),y=()=>{a||(c.onValueChange(r),c.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,q.jsx)($r,{scope:n,value:r,disabled:a,textId:_,isSelected:u,onItemTextChange:G.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,q.jsx)(mr.ItemSlot,{scope:n,value:r,disabled:a,textValue:d,children:(0,q.jsx)(i.div,{role:`option`,"aria-labelledby":_,"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:g,onFocus:I(s.onFocus,()=>h(!0)),onBlur:I(s.onBlur,()=>h(!1)),onClick:I(s.onClick,()=>{v.current!==`mouse`&&y()}),onPointerUp:I(s.onPointerUp,()=>{v.current===`mouse`&&y()}),onPointerDown:I(s.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:I(s.onPointerMove,e=>{v.current=e.pointerType,a?l.onItemLeave?.():v.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:I(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:I(s.onKeyDown,e=>{l.searchRef?.current!==``&&e.key===` `||(fr.includes(e.key)&&y(),e.key===` `&&e.preventDefault())})})})})});ti.displayName=Qr;var ni=`SelectItemText`,ri=G.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,...o}=e,s=Y(ni,n),c=Z(ni,n),l=ei(ni,n),u=Sr(ni,n),[d,f]=G.useState(null),p=z(t,e=>f(e),l.onItemTextChange,e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),m=d?.textContent,h=G.useMemo(()=>(0,q.jsx)(`option`,{value:l.value,disabled:l.disabled,children:m},l.value),[l.disabled,l.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=u;return L(()=>(g(h),()=>_(h)),[g,_,h]),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(i.span,{id:l.textId,...o,ref:p}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Gt.createPortal(o.children,s.valueNode):null]})});ri.displayName=ni;var ii=`SelectItemIndicator`,ai=G.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return ei(ii,n).isSelected?(0,q.jsx)(i.span,{"aria-hidden":!0,...r,ref:t}):null});ai.displayName=ii;var oi=`SelectScrollUpButton`,si=G.forwardRef((e,t)=>{let n=Z(oi,e.__scopeSelect),r=Ur(oi,e.__scopeSelect),[i,a]=G.useState(!1),o=z(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,q.jsx)(ui,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});si.displayName=oi;var ci=`SelectScrollDownButton`,li=G.forwardRef((e,t)=>{let n=Z(ci,e.__scopeSelect),r=Ur(ci,e.__scopeSelect),[i,a]=G.useState(!1),o=z(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,q.jsx)(ui,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});li.displayName=ci;var ui=G.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...a}=e,o=Z(`SelectScrollButton`,n),s=G.useRef(null),c=hr(n),l=G.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return G.useEffect(()=>()=>l(),[l]),L(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,q.jsx)(i.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:I(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:I(a.onPointerMove,()=>{o.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:I(a.onPointerLeave,()=>{l()})})}),di=`SelectSeparator`,fi=G.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,q.jsx)(i.div,{"aria-hidden":!0,...r,ref:t})});fi.displayName=di;var pi=`SelectArrow`,mi=G.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=yr(n),a=Y(pi,n),o=Z(pi,n);return a.open&&o.position===`popper`?(0,q.jsx)(l,{...i,...r,ref:t}):null});mi.displayName=pi;var hi=`SelectBubbleInput`,gi=G.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let a=G.useRef(null),o=z(r,a),s=ur(t);return G.useEffect(()=>{let e=a.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(s!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[s,t]),(0,q.jsx)(i.select,{...n,style:{...xe,...n.style},ref:o,defaultValue:t})});gi.displayName=hi;function _i(e){return e===``||e===void 0}function vi(e){let t=v(e),n=G.useRef(``),r=G.useRef(0),i=G.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=G.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return G.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function yi(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=bi(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 bi(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var xi=Cr,Si=Tr,Ci=Dr,wi=kr,Ti=jr,Ei=Nr,Di=Gr,Oi=Zr,ki=ti,Ai=ri,ji=ai,Mi=si,Ni=li,Pi=fi,Fi=xi,Ii=Ci,Li=G.forwardRef((e,t)=>{let n=(0,B.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=h(`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,q.jsx)(wi,{asChild:!0,children:(0,q.jsx)(ge,{className:`h-4 w-4 opacity-50`})}),n[6]=s):s=n[6];let c;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(c=(0,q.jsxs)(Si,{ref:t,className:o,...a,children:[r,s]}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=c):c=n[11],c});Li.displayName=Si.displayName;var Ri=G.forwardRef((e,t)=>{let n=(0,B.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=h(`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,q.jsx)(g,{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,q.jsx)(Mi,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});Ri.displayName=Mi.displayName;var zi=G.forwardRef((e,t)=>{let n=(0,B.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=h(`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,q.jsx)(ge,{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,q.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=G.forwardRef((e,t)=>{let n=(0,B.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=h(`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,q.jsx)(Ri,{}),n[8]=u):u=n[8];let d=s===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`,f;n[9]===d?f=n[10]:(f=h(`p-1`,d),n[9]=d,n[10]=f);let p;n[11]!==r||n[12]!==f?(p=(0,q.jsx)(Di,{className:f,children:r}),n[11]=r,n[12]=f,n[13]=p):p=n[13];let m;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,q.jsx)(zi,{}),n[14]=m):m=n[14];let g;return n[15]!==s||n[16]!==a||n[17]!==t||n[18]!==l||n[19]!==p?(g=(0,q.jsx)(Ti,{children:(0,q.jsxs)(Ei,{ref:t,className:l,position:s,...a,children:[u,p,m]})}),n[15]=s,n[16]=a,n[17]=t,n[18]=l,n[19]=p,n[20]=g):g=n[20],g});Bi.displayName=Ei.displayName;var Vi=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,q.jsx)(Oi,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Vi.displayName=Oi.displayName;var Hi=G.forwardRef((e,t)=>{let n=(0,B.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=h(`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,q.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,q.jsx)(ji,{children:(0,q.jsx)(ce,{className:`h-4 w-4`})})}),n[6]=s):s=n[6];let c;n[7]===r?c=n[8]:(c=(0,q.jsx)(Ai,{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,q.jsxs)(ki,{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});Hi.displayName=ki.displayName;var Ui=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`-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,q.jsx)(Pi,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Ui.displayName=Pi.displayName;function Wi(e){let t=(0,B.c)(14),{className:n,label:r,size:i}=e,a=i===void 0?`md`:i,o=a===`sm`?`h-4 w-4`:a===`lg`?`h-8 w-8`:`h-6 w-6`,s;t[0]===n?s=t[1]:(s=h(`flex h-full items-center justify-center`,n),t[0]=n,t[1]=s);let c;t[2]===o?c=t[3]:(c=h(o,`animate-spin mx-auto text-muted-foreground`),t[2]=o,t[3]=c);let l;t[4]===c?l=t[5]:(l=(0,q.jsx)(ne,{className:c}),t[4]=c,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,q.jsx)(`p`,{className:h(R.bodyMuted,`mt-2`),children:r}):null,t[6]=r,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,q.jsxs)(`div`,{className:`text-center`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;return t[11]!==s||t[12]!==d?(f=(0,q.jsx)(`div`,{className:s,children:d}),t[11]=s,t[12]=d,t[13]=f):f=t[13],f}function Gi(){let e=(0,B.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsx)(`div`,{className:`space-y-1 px-2 py-2`,children:[1,2,3].map(Ki)}),e[0]=t):t=e[0],t}function Ki(e){return(0,q.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e)}function qi(){let e=(0,B.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded mx-4 my-1`}),e[0]=t):t=e[0],t}var Ji=new Map;function Yi(e,t){let n=Ji.get(e);return n||(n={promise:t().catch(t=>{throw Ji.delete(e),t})},Ji.set(e,n)),n.promise}function Xi(e){Ji.delete(e)}function Zi(e){for(let t of Ji.keys())t.startsWith(e)&&Ji.delete(t)}function Qi(e,t){return(0,G.use)(Yi(e,t))}var $i=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`w-full caption-bottom`,R.body,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,q.jsx)(`table`,{ref:t,className:a,...i})}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});$i.displayName=`Table`;var ea=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`[&_tr]:border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(`thead`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ea.displayName=`TableHeader`;var ta=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`[&_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,q.jsx)(`tbody`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ta.displayName=`TableBody`;var na=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,q.jsx)(`tfoot`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});na.displayName=`TableFooter`;var ra=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,q.jsx)(`tr`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ra.displayName=`TableRow`;var Q=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,q.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 $=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,q.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 ia=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(R.caption,`mt-4`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(`caption`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ia.displayName=`TableCaption`;var aa=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,q.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});aa.displayName=`Card`;var oa=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,q.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=`CardHeader`;var sa=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(R.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,q.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=`CardTitle`;var ca=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(R.bodyMuted,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.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=`CardDescription`;var la=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,q.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=`CardContent`;var ua=G.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,q.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=`CardFooter`;var da=class extends G.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`AsyncErrorBoundary caught an error:`,e,t)}handleRetry=()=>{this.setState({error:null}),this.props.onRetry?.()};render(){let{error:e}=this.state;return e?this.props.renderFallback?this.props.renderFallback(e,this.handleRetry):(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,q.jsxs)(aa,{className:`max-w-md`,children:[(0,q.jsx)(oa,{children:(0,q.jsx)(sa,{className:`text-destructive`,children:this.props.fallbackTitle??`Something went wrong`})}),(0,q.jsxs)(la,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:R.body,children:e.message}),(0,q.jsx)(f,{variant:`outline`,onClick:this.handleRetry,children:`Retry`})]})]})}):this.props.children}},fa=t({ConversationHistoryView:()=>Sa,default:()=>Sa}),pa=un(e=>(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,q.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,q.jsx)(`h3`,{className:e.v0,children:`No history`}),(0,q.jsx)(`p`,{className:e.v1,children:`No conversation history found for this thread.`})]})}),{name:`ConversationHistoryContent_1`}),ma=un(e=>(0,q.jsxs)(`slot`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between border-b py-3 px-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.v0,e.v1]}),(0,q.jsxs)(`div`,{className:e.v2,children:[e.v3,` of `,e.v4,` messages`]})]}),e.v5]}),{name:`ConversationHistoryContent_2`,portals:[`v0`,`v1`,`v3`,`v4`,`v5`]}),ha=function(e){let t=(0,B.c)(39),{scope:r,projects:i,loadVersion:a,currentPromptIndex:o,onPromptIndexChange:c}=e,l;t[0]!==a||t[1]!==r?(l=ba(r,a),t[0]=a,t[1]=r,t[2]=l):l=t[2];let p;t[3]!==i||t[4]!==r?(p=()=>xa(r,i),t[3]=i,t[4]=r,t[5]=p):p=t[5];let m=Qi(l,p),g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(e){return new Date(e).toLocaleString()},t[6]=g):g=t[6];let v=g,y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=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]=y):y=t[7];let b=y,x;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(e){return{inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0}},t[8]=x):x=t[8];let C=x,w;t[9]!==o||t[10]!==m.messages||t[11]!==c?(w=function(){m.messages&&o<m.messages.length-1&&c(o+1)},t[9]=o,t[10]=m.messages,t[11]=c,t[12]=w):w=t[12];let T=w,E;t[13]!==o||t[14]!==c?(E=function(){o>0&&c(o-1)},t[13]=o,t[14]=c,t[15]=E):E=t[15];let D=E;if(!m.messages?.length){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(pa,{v0:R.emptyStateTitle,v1:R.bodyMuted}),t[16]=e):e=t[16],e}let k=o===0,A;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,q.jsx)(ee,{className:`h-4 w-4 mr-1`}),t[17]=A):A=t[17];let j;t[18]!==D||t[19]!==k?(j=(0,q.jsx)(f,{variant:`outline`,size:`sm`,onClick:D,disabled:k,children:A}),t[18]=D,t[19]=k,t[20]=j):j=t[20];let M=o>=m.messages.length-1,N;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,q.jsx)(n,{className:`h-4 w-4 ml-1`}),t[21]=N):N=t[21];let P;t[22]!==T||t[23]!==M?(P=(0,q.jsx)(f,{variant:`outline`,size:`sm`,onClick:T,disabled:M,children:N}),t[22]=T,t[23]=M,t[24]=P):P=t[24];let te=o+1,ne=m.messages.length,re;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,q.jsx)(ea,{children:(0,q.jsxs)(ra,{children:[(0,q.jsx)(Q,{children:`Prompt`}),(0,q.jsx)(Q,{children:`Answer`}),(0,q.jsx)(Q,{className:`w-24`,children:`Model`}),(0,q.jsx)(Q,{className:`w-24 text-right`,children:`Duration`}),(0,q.jsx)(Q,{className:`w-20 text-right`,children:`Input Tokens`}),(0,q.jsx)(Q,{className:`w-20 text-right`,children:`Output Tokens`}),(0,q.jsx)(Q,{className:`w-32 text-right`,children:`Timestamp`})]})}),t[25]=re):re=t[25];let F;if(t[26]!==o||t[27]!==m.messages){let e;t[29]===o?e=t[30]:(e=(e,t)=>{let{inputTokens:n,outputTokens:r}=C(e);return(0,q.jsxs)(ra,{className:t===o?`bg-muted/50`:``,children:[(0,q.jsx)($,{className:`max-w-md`,children:(0,q.jsx)(`div`,{className:R.body,children:(0,q.jsx)(_a,{text:e.request.message})})}),(0,q.jsx)($,{className:`max-w-md`,children:e.response?(0,q.jsx)(`div`,{className:R.body,children:(0,q.jsx)(_a,{text:e.response.content})}):(0,q.jsx)(`span`,{className:h(R.bodyMuted,`italic`),children:`No response`})}),(0,q.jsx)($,{children:(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(S,{className:`h-3 w-3 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,q.jsx)($,{className:h(R.caption,`text-right`),children:e.response?(0,q.jsx)(d,{children:(0,q.jsxs)(s,{children:[(0,q.jsx)(_,{asChild:!0,children:(0,q.jsx)(`div`,{className:`cursor-help`,children:b(e.timestamp,e.response.completedAt).display})}),(0,q.jsx)(u,{children:(0,q.jsx)(`p`,{children:b(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,q.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,q.jsx)($,{className:h(R.bodyMuted,`text-right`),children:n>0?n.toLocaleString():`-`}),(0,q.jsx)($,{className:h(R.bodyMuted,`text-right`),children:r>0?r.toLocaleString():`-`}),(0,q.jsx)($,{className:h(R.bodyMuted,`text-right`),children:v(e.timestamp)})]},e.id)},t[29]=o,t[30]=e),F=m.messages.map(e),t[26]=o,t[27]=m.messages,t[28]=F}else F=t[28];let I;t[31]===F?I=t[32]:(I=(0,q.jsx)(O,{className:`h-full`,children:(0,q.jsx)(`div`,{className:`py-4`,children:(0,q.jsxs)($i,{children:[re,(0,q.jsx)(ta,{children:F})]})})}),t[31]=F,t[32]=I);let L;return t[33]!==m.messages.length||t[34]!==j||t[35]!==P||t[36]!==te||t[37]!==I?(L=(0,q.jsx)(ma,{v0:j,v1:P,v2:R.bodyMuted,v3:te,v4:ne,v5:I}),t[33]=m.messages.length,t[34]=j,t[35]=P,t[36]=te,t[37]=I,t[38]=L):L=t[38],L},ga=`__ALL_PROJECTS__`;function _a(e){let t=(0,B.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,q.jsx)(q.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,q.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,q.jsxs)(q.Fragment,{children:[a,o]}),t[6]=a,t[7]=s),s}function va(e,t){let n=`${t} - `,r=e.title??e.threadId;return r.startsWith(n)?r.slice(n.length):r}async function ya(e){let t=[],n=new Set,r=``;for(let i of e)try{let e=await ue(i.threadId);e?.messages&&(t.push(...e.messages),e.conversationIds&&e.conversationIds.forEach(e=>n.add(e)),e.lastUpdated>r&&(r=e.lastUpdated))}catch(e){console.warn(`Failed to load history for thread ${i.threadId}:`,e)}return t.sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime()),{messages:t,conversationIds:Array.from(n),lastUpdated:r??new Date().toISOString()}}function ba(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 xa(e,t){if(e.type===`thread`)return await ue(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 ya(n.threads);return{threadId:e.projectId,...r}}return{threadId:ga,...await ya(t.flatMap(e=>e.threads))}}var Sa=(0,G.memo)(function({isOpen:e,onClose:t,initialFilter:n,projects:r,inline:i}){let[a,o]=(0,G.useState)(0),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(``),[d,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(0),[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(null),S=(0,G.useMemo)(()=>l?{type:`thread`,threadId:l}:s===ga?{type:`all`}:s?{type:`project`,projectId:s}:null,[s,l]),C=S?ba(S,g):null;(0,G.useEffect)(()=>{e&&n?n.type===`thread`?(u(n.id),c(``),o(0)):n.type===`project`&&(c(n.id),u(``),o(0)):e&&!n?(c(ga),u(``),o(0)):e||(u(``),c(``),o(0),x(null),y(null))},[e,n]);let T=e=>{u(e),c(``),o(0),y(null),x(null)},E=e=>{c(e),u(``),o(0),y(null),x(null)},D=(0,G.useCallback)(()=>{if(l){let e=r.flatMap(e=>e.threads).find(e=>e.threadId===l),t=r.find(e=>e.threads.some(e=>e.threadId===l)),n=e?va(e,t?.name??t?.projectId??``):l;return{options:{threadId:l},title:`Clear Thread History`,description:`Permanently delete all conversation history for "${n}"? This cannot be undone.`}}if(s&&s!==ga){let e=r.find(e=>e.projectId===s)?.name??s;return{options:{projectId:s},title:`Clear Project History`,description:`Permanently delete all conversation history for "${e}"? This cannot be undone.`}}return{options:void 0,title:`Clear All History`,description:`Permanently delete all conversation history across every project and thread? This cannot be undone.`}},[r,s,l]),O=(0,G.useCallback)(async()=>{let e=D();h(!0),x(null);try{await w(e.options),C&&Xi(C),y(C),o(0),p(!1)}catch(e){x(e instanceof Error?e.message:`Failed to clear conversation history`)}finally{h(!1)}},[D,C]);function k(){S&&Xi(ba(S,g)),_(e=>e+1),y(null),x(null)}let A=D();if(!e)return null;let j=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(Fi,{value:s,onValueChange:E,children:[(0,q.jsx)(Li,{className:`w-48`,children:(0,q.jsx)(Ii,{placeholder:`Select project`})}),(0,q.jsxs)(Bi,{children:[(0,q.jsx)(Hi,{value:ga,children:`All Projects`}),r.map(e=>(0,q.jsx)(Hi,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]}),(0,q.jsxs)(Fi,{value:l,onValueChange:T,children:[(0,q.jsx)(Li,{className:`w-48`,children:(0,q.jsx)(Ii,{placeholder:`Select thread`})}),(0,q.jsx)(Bi,{children:r.flatMap(e=>e.threads.map(t=>(0,q.jsx)(Hi,{value:t.threadId,children:va(t,e.name??e.projectId)},t.threadId)))})]}),(0,q.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>p(!0),disabled:m,children:[(0,q.jsx)(F,{className:`h-4 w-4 mr-2`}),`Clear`]})]}),M=(0,q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,q.jsx)(`div`,{className:i?void 0:`border-b px-6 py-4`,children:(0,q.jsx)(er,{title:`History`,description:i?`View and browse conversation history across projects and threads.`:void 0,action:(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[j,i?null:(0,q.jsx)(f,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,q.jsx)(be,{})})]})})}),(0,q.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:b?(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,q.jsxs)(aa,{className:`max-w-md`,children:[(0,q.jsx)(oa,{children:(0,q.jsx)(sa,{className:`text-destructive`,children:`Error`})}),(0,q.jsxs)(la,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{children:b}),(0,q.jsx)(f,{onClick:()=>x(null),children:`Dismiss`})]})]})}):v&&v===C?(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,q.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,q.jsx)(`h3`,{className:R.emptyStateTitle,children:`No history`}),(0,q.jsx)(`p`,{className:R.bodyMuted,children:`No conversation history found for this thread.`})]})}):S?(0,q.jsx)(da,{fallbackTitle:`Failed to load conversation history`,onRetry:k,children:(0,q.jsx)(G.Suspense,{fallback:(0,q.jsx)(Wi,{label:`Loading conversation history...`,size:`lg`}),children:(0,q.jsx)(ha,{scope:S,projects:r,loadVersion:g,currentPromptIndex:a,onPromptIndexChange:o},C??void 0)})}):(0,q.jsx)(Wi,{label:`Loading conversation history...`,size:`lg`})})]});return(0,q.jsxs)(q.Fragment,{children:[i?(0,q.jsx)(or,{children:(0,q.jsx)(tr,{className:`max-w-none w-full h-full flex flex-col min-h-0`,children:M})}):(0,q.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background`,children:M}),(0,q.jsx)(Un,{open:d,onOpenChange:p,children:(0,q.jsxs)(Kn,{children:[(0,q.jsxs)(qn,{children:[(0,q.jsx)(Yn,{children:A.title}),(0,q.jsx)(Xn,{children:A.description})]}),(0,q.jsxs)(Jn,{children:[(0,q.jsx)(Qn,{disabled:m,children:`Cancel`}),(0,q.jsx)(Zn,{onClick:e=>{e.preventDefault(),O()},disabled:m,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:m?`Clearing...`:`Clear`})]})]})})]})});export{Qn as A,ir as C,or as D,tr as E,Yn as F,un as I,Xn as M,Jn as N,Un as O,qn as P,er as S,sr as T,ur as _,Qi as a,lr as b,qi as c,Fi as d,Bi as f,Ii as g,Li as h,la as i,Kn as j,Zn as k,Wi as l,Ui as m,da as n,Xi as o,Hi as p,aa as r,Zi as s,fa as t,Gi as u,nr as v,cr as w,ar as x,rr as y};
|