tarsk 0.4.13 → 0.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +643 -60
- package/dist/public/assets/{account-view-CXpwWuJZ.js → account-view-bgfCh9fD.js} +1 -1
- package/dist/public/assets/api-tXifOYo2.js +1 -0
- package/dist/public/assets/browser-tab-BqBW_AK-.js +1 -0
- package/dist/public/assets/context-menu-CmaVJQOJ.js +1 -0
- package/dist/public/assets/conversation-history-view-BU-YAZS_.js +1 -0
- package/dist/public/assets/dialogs-config-bLEt-2lj.js +46 -0
- package/dist/public/assets/diff-view-DjfyQW_j.js +3 -0
- package/dist/public/assets/{explorer-tab-view-DC8arYcw.js → explorer-tab-view-DRpNcRXM.js} +2 -2
- package/dist/public/assets/explorer-tree-z3yBekT5.js +1 -0
- package/dist/public/assets/explorer-view-CjevBGrc.js +1 -0
- package/dist/public/assets/history-view-ETKpXvpZ.js +1 -0
- package/dist/public/assets/index-CQrq9F6C.js +65 -0
- package/dist/public/assets/index-Dwos0qd5.css +1 -0
- package/dist/public/assets/onboarding-Dvaoo4rL.js +1 -0
- package/dist/public/assets/onboarding-dialog-D7LOFzso.js +1 -0
- package/dist/public/assets/{project-settings-view-CZPKYKCu.js → project-settings-view-CBW-nuLi.js} +1 -1
- package/dist/public/assets/provider-details-view-DJXhGdNI.js +1 -0
- package/dist/public/assets/{providers-sidebar-DSrnVDNy.js → providers-sidebar-Cn7XvmQ-.js} +1 -1
- package/dist/public/assets/react-vendor-CUw-HIQD.js +17 -0
- package/dist/public/assets/{settings-view-D6FAPBQP.js → settings-view-TH1bX0FR.js} +2 -2
- package/dist/public/assets/{store-BuY90jLM.js → store-CDLJd-q_.js} +1 -1
- package/dist/public/assets/{terminal-panel-Zyr6xth3.js → terminal-panel-BRdTXLkg.js} +1 -1
- package/dist/public/assets/{textarea-CxhrnOOz.js → textarea-DtvDY2H_.js} +1 -1
- package/dist/public/assets/todos-view-BHuGeR5Y.js +1 -0
- package/dist/public/assets/{utils-7CkwsQJ0.js → utils-BxHvPw5k.js} +1 -1
- package/dist/public/index.html +9 -9
- package/package.json +2 -2
- package/dist/public/assets/api-BfUK32d1.js +0 -1
- package/dist/public/assets/browser-tab-BdzIB5R4.js +0 -1
- package/dist/public/assets/context-menu-CC9JLx5B.js +0 -1
- package/dist/public/assets/conversation-history-view-C6iUsZjA.js +0 -1
- package/dist/public/assets/dialogs-config-Ofxg1Bn0.js +0 -46
- package/dist/public/assets/diff-view-C-Kz7R_T.js +0 -3
- package/dist/public/assets/explorer-tree-BwLCrdfR.js +0 -1
- package/dist/public/assets/explorer-view-CPCrOqXp.js +0 -1
- package/dist/public/assets/history-view-CAVl9GFy.js +0 -1
- package/dist/public/assets/index-BVLzVjoR.css +0 -1
- package/dist/public/assets/index-DIWoaAFy.js +0 -30
- package/dist/public/assets/onboarding-DTzcWokE.js +0 -1
- package/dist/public/assets/onboarding-dialog-BQvu_Nac.js +0 -1
- package/dist/public/assets/provider-details-view-BBvKe6Am.js +0 -1
- package/dist/public/assets/react-vendor-9yNfIRPs.js +0 -17
- package/dist/public/assets/todos-view-yiH-gaUK.js +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Ai as t,Bn as n,Di as r,Dn as i,Hn as a,In as o,K as s,Ln as c,Mn as l,Oi as u,Q as d,Tt as f,Vn as p,Xi as m,Xr as h,Zi as g,fi as _,hi as v,it as y,la as b,li as x,ni as S,pi as C,sa as w,ti as T,vn as E,xr as D,zn as O,zt as k}from"./dialogs-config-bLEt-2lj.js";import{_ as ee}from"./react-vendor-CUw-HIQD.js";import{a as A,t as j}from"./store-CDLJd-q_.js";import{t as M}from"./textarea-DtvDY2H_.js";import{c as N,s as P,u as te}from"./history-view-ETKpXvpZ.js";import{n as ne}from"./utils-BxHvPw5k.js";import{d as re,l as ie,n as ae,r as oe,t as se,x as F,y as I}from"./index-CQrq9F6C.js";import{a as L,n as R,r as ce,t as z}from"./context-menu-CmaVJQOJ.js";var B=e(b(),1),V=w(),H=D();function U(e){let t=(0,V.c)(17),{children:n,title:r,headerAction:a,footer:o}=e,s;t[0]===r?s=t[1]:(s=r&&(0,H.jsx)(`span`,{className:`text-sm font-semibold tracking-tight`,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 border-b border-sidebar-border px-4 py-6`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n?d=t[10]:(d=(0,H.jsx)(i,{className:`flex-1`,children:n}),t[9]=n,t[10]=d);let f;t[11]===o?f=t[12]:(f=o&&(0,H.jsx)(`div`,{className:`border-t border-sidebar-border`,children:o}),t[11]=o,t[12]=f);let p;return t[13]!==u||t[14]!==d||t[15]!==f?(p=(0,H.jsxs)(`div`,{className:`flex flex-col h-full`,children:[u,d,f]}),t[13]=u,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function le(e){let t=[],n={};return e.forEach((e,r)=>{let i=e.path.split(`/`),a=t,o=``;for(let e=0;e<i.length-1;e++){if(o=o?`${o}/${i[e]}`:i[e],!n[o]){let t={id:`dir:${o}`,name:i[e],children:[]};n[o]=t,a.push(t)}a=n[o].children}a.push({id:`file:${e.path}`,name:i[i.length-1],fileIndex:r,status:e.status})}),t}var W={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},G={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function K(e){return a(`status-badge font-mono text-xs font-semibold`,W[e]??`text-orange-500`)}function ue(e){return G[e]??`M`}function de(e){let n=(0,V.c)(37),{treeData:i,files:o,isLoading:s,error:c,selectedFileIndex:l,onFileSelect:d,onRevertFile:f}=e,p;n[0]===o?p=n[1]:(p=o.reduce(pe,0),n[0]=o,n[1]=p);let g=p,_;n[2]===o?_=n[3]:(_=o.reduce(q,0),n[2]=o,n[3]=_);let y=_,b=o.length===1?``:`s`,x;n[4]!==o.length||n[5]!==b?(x=(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[o.length,` file`,b]}),n[4]=o.length,n[5]=b,n[6]=x):x=n[6];let S;n[7]===g?S=n[8]:(S=(0,H.jsxs)(`span`,{className:`text-xs text-green-500`,children:[`+`,g]}),n[7]=g,n[8]=S);let C;n[9]===y?C=n[10]:(C=(0,H.jsxs)(`span`,{className:`text-xs text-red-500`,children:[`-`,y]}),n[9]=y,n[10]=C);let w;n[11]!==x||n[12]!==S||n[13]!==C?(w=(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[x,S,C]}),n[11]=x,n[12]=S,n[13]=C,n[14]=w):w=n[14];let T=w;if(s){let e;n[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center pt-3 pb-2`,children:(0,H.jsx)(v,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),n[15]=e):e=n[15];let t;return n[16]===T?t=n[17]:(t=(0,H.jsx)(U,{title:`Review Changes`,headerAction:T,children:e}),n[16]=T,n[17]=t),t}if(c){let e;n[18]===c?e=n[19]:(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:`text-destructive text-xs text-center`,children:c})}),n[18]=c,n[19]=e);let t;return n[20]!==T||n[21]!==e?(t=(0,H.jsx)(U,{title:`Review Changes`,headerAction:T,children:e}),n[20]=T,n[21]=e,n[22]=t):t=n[22],t}if(o.length===0){let e;n[23]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs text-center`,children:`No changes to review`})}),n[23]=e):e=n[23];let t;return n[24]===T?t=n[25]:(t=(0,H.jsx)(U,{title:`Review Changes`,headerAction:T,children:e}),n[24]=T,n[25]=t),t}let E;n[26]!==o||n[27]!==d||n[28]!==f||n[29]!==l?(E=(e,n)=>{let{isOpen:i,toggle:s}=n,c=!!e.children,p=(0,H.jsxs)(I,{onClick:()=>{c?s():e.fileIndex!==void 0&&d(e.fileIndex)},selected:!c&&e.fileIndex===l,className:`gap-1.5`,children:[c?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(m,{className:a(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,i&&`rotate-90`)}),i?(0,H.jsx)(u,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,H.jsx)(r,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,H.jsx)(t,{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}),!c&&e.status&&(0,H.jsx)(`span`,{className:K(e.status),children:ue(e.status)})]});return c?p:(0,H.jsxs)(z,{children:[(0,H.jsx)(L,{asChild:!0,children:p}),(0,H.jsx)(R,{children:(0,H.jsxs)(ce,{onClick:()=>{e.fileIndex!==void 0&&f?.(o[e.fileIndex])},children:[(0,H.jsx)(h,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},n[26]=o,n[27]=d,n[28]=f,n[29]=l,n[30]=E):E=n[30];let D;n[31]!==E||n[32]!==i?(D=(0,H.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3 pb-2 px-1`,children:(0,H.jsx)(F,{nodes:i,defaultOpen:!0,resetKey:i,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:E})}),n[31]=E,n[32]=i,n[33]=D):D=n[33];let O;return n[34]!==T||n[35]!==D?(O=(0,H.jsx)(U,{title:`Review Changes`,headerAction:T,children:D}),n[34]=T,n[35]=D,n[36]=O):O=n[36],O}function q(e,t){return e+t.hunks.reduce(J,0)}function J(e,t){return e+t.changes.filter(fe).length}function fe(e){return e.type===`delete`}function pe(e,t){return e+t.hunks.reduce(Y,0)}function Y(e,t){return e+t.changes.filter(me).length}function me(e){return e.type===`add`}function he(e){let t=(0,V.c)(2),{isOpen:n}=e,r=n===void 0||n?`mr-[-40px]`:``,i;return t[0]===r?i=t[1]:(i=(0,H.jsx)(se,{withHandle:!0,className:r}),t[0]=r,t[1]=i),i}function ge(e){let t=(0,V.c)(35),{open:r,lineNumber:i,lineContent:a,initialComment:s,isEditing:u,onSave:d,onDelete:f,onClose:m}=e,[h,g]=(0,B.useState)((s===void 0?``:s)??``),_;t[0]!==d||t[1]!==h?(_=()=>{h.trim()&&d(h.trim())},t[0]=d,t[1]=h,t[2]=_):_=t[2];let v=_,y;t[3]===v?y=t[4]:(y=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),v())},t[3]=v,t[4]=y);let b=y,x;t[5]===m?x=t[6]:(x=e=>{e||m()},t[5]=m,t[6]=x);let S;t[7]===i?S=t[8]:(S=(0,H.jsx)(n,{children:(0,H.jsxs)(p,{className:`text-sm font-medium`,children:[`Comment on line `,i]})}),t[7]=i,t[8]=S);let C=a||` `,w;t[9]===C?w=t[10]:(w=(0,H.jsx)(`div`,{className:`rounded bg-muted px-3 py-2 font-mono text-xs text-muted-foreground overflow-x-auto whitespace-pre`,children:C}),t[9]=C,t[10]=w);let T;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>g(e.target.value),t[11]=T):T=t[11];let E;t[12]!==b||t[13]!==h?(E=(0,H.jsx)(M,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:h,onChange:T,onKeyDown:b,rows:12,className:`resize-none text-sm`}),t[12]=b,t[13]=h,t[14]=E):E=t[14];let D;t[15]!==u||t[16]!==f?(D=u&&f&&(0,H.jsx)(l,{variant:`destructive`,size:`sm`,onClick:f,className:`mr-auto`,children:`Delete`}),t[15]=u,t[16]=f,t[17]=D):D=t[17];let k;t[18]===h?k=t[19]:(k=h.trim(),t[18]=h,t[19]=k);let ee=!k,A;t[20]!==v||t[21]!==ee?(A=(0,H.jsx)(l,{size:`sm`,onClick:v,disabled:ee,children:`Save`}),t[20]=v,t[21]=ee,t[22]=A):A=t[22];let j;t[23]!==D||t[24]!==A?(j=(0,H.jsxs)(O,{className:`gap-2 sm:gap-0`,children:[D,A]}),t[23]=D,t[24]=A,t[25]=j):j=t[25];let N;t[26]!==j||t[27]!==S||t[28]!==w||t[29]!==E?(N=(0,H.jsxs)(c,{className:`max-w-2xl`,children:[S,w,E,j]}),t[26]=j,t[27]=S,t[28]=w,t[29]=E,t[30]=N):N=t[30];let P;return t[31]!==r||t[32]!==N||t[33]!==x?(P=(0,H.jsx)(o,{open:r,onOpenChange:x,children:N}),t[31]=r,t[32]=N,t[33]=x,t[34]=P):P=t[34],P}function X({threadId:e,onExit:t}){let{state:n,dispatch:r}=A(),{resolvedTheme:i}=ne(),[o,c]=(0,B.useState)([]),[u,p]=(0,B.useState)(!0),[h,v]=(0,B.useState)(null),[b,w]=(0,B.useState)(0),[D,O]=(0,B.useState)(!1),[M,se]=(0,B.useState)(!1),F=(0,B.useRef)(null),I=(0,B.useMemo)(()=>n.diffComments[e]??[],[n.diffComments,e]),L=(0,B.useCallback)(t=>{let i=n.diffComments[e]??[],a=typeof t==`function`?t(i):t;r({type:j.SetDiffComments,threadId:e,comments:a})},[r,e,n.diffComments]),[R,ce]=(0,B.useState)(null),[z,V]=(0,B.useState)(null),[U,W]=(0,B.useState)(null),G=(0,B.useRef)(null),K=(0,B.useRef)(I),ue=(0,B.useRef)(R),q=(0,B.useRef)({isFullView:D,selectedFileIndex:b,files:o}),J=(0,B.useRef)({original:[],modified:[]}),fe=(0,B.useRef)(!0);(0,B.useEffect)(()=>{K.current=I},[I]),(0,B.useEffect)(()=>{ue.current=R},[R]),(0,B.useEffect)(()=>{q.current={isFullView:D,selectedFileIndex:b,files:o}},[D,b,o]);let pe=(0,B.useCallback)(()=>{F.current&&(M?F.current.expand():F.current.collapse())},[M]),Y=(0,B.useCallback)(async()=>{if(e){p(!0),v(null);try{c((await y(e)).files||[]),w(0)}catch(e){v(e instanceof Error?e.message:`Failed to load diff`)}finally{p(!1)}}},[e]);(0,B.useEffect)(()=>{Y()},[Y]);let me=(0,B.useCallback)(async t=>{try{await k(e,t.path),await Y()}catch(e){v(e instanceof Error?e.message:`Failed to revert file`)}},[e,Y]),X=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if((n.diffComments[e]??[]).length>0){X.current=!0;return}f(e).then(t=>{t.diffComments&&t.diffComments.length>0&&r({type:j.SetDiffComments,threadId:e,comments:t.diffComments}),X.current=!0}).catch(()=>{X.current=!0})},[e]),(0,B.useEffect)(()=>{X.current&&E(e,{diffComments:I}).catch(()=>{})},[e,I]);let _e=(0,B.useMemo)(()=>le(o),[o]),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}},ve=(e,t,n)=>e.split(`
|
|
2
|
+
`).slice(t-1,n).join(`
|
|
3
|
+
`),ye=e=>{let t=Z(e);return t?t.startLine<=1:!0},be=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=o[b],xe=Q?D?Q.oldContent:(()=>{let e=Z(Q);return e?ve(Q.oldContent,e.startLine,e.endLine):Q.oldContent})():``,Se=Q?D?Q.newContent:(()=>{let e=Z(Q);return e?ve(Q.newContent,e.startLine,e.endLine):Q.newContent})():``,$=(0,B.useCallback)(()=>{if(!fe.current)return;let e=G.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=q.current,i=K.current,a=ue.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).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`,glyphMarginHoverMessage:{value:e.comment}}}}).filter(e=>e!==null),l=r===`original`?J.current.original:J.current.modified,u=e.deltaDecorations(l,c);r===`original`?J.current.original=u:J.current.modified=u};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},[]);(0,B.useEffect)(()=>{$()},[$,I,R,b,D,Q]),(0,B.useEffect)(()=>()=>{G.current=null,J.current={original:[],modified:[]}},[b]),(0,B.useEffect)(()=>()=>{fe.current=!1,G.current=null,J.current={original:[],modified:[]}},[]);let Ce=(0,B.useCallback)(e=>{G.current=e;let t=(e,t)=>{e.onMouseDown(n=>{if(!n.target?.position)return;let r=n.target.position.lineNumber,{isFullView:i,selectedFileIndex:a,files:o}=q.current,s=o[a];if(!s)return;let c=i?null:Z(s),l=c?c.startLine+r-1:r,u=e.getModel()?.getLineContent(r)??``,d=K.current.find(e=>e.fileIndex===a&&e.lineNumber===l&&e.side===t);d?W(d):V({lineNumber:l,lineContent:u,side:t})})};t(e.getOriginalEditor(),`original`),t(e.getModifiedEditor(),`modified`),setTimeout(()=>{G.current===e&&$()},150)},[$]),we=(0,B.useCallback)(e=>{if(z&&Q){let t={id:`comment-${Date.now()}`,filePath:Q.path,fileIndex:b,lineNumber:z.lineNumber,lineContent:z.lineContent,comment:e,side:z.side};L(e=>[...e,t]),V(null)}else U&&(L(t=>t.map(t=>t.id===U.id?{...t,comment:e}:t)),W(null))},[z,U,Q,b,L]),Te=(0,B.useCallback)(()=>{U&&(L(e=>e.filter(e=>e.id!==U.id)),W(null))},[U,L]),Ee=(0,B.useCallback)(e=>{if(I.length===0)return;let t=(e%I.length+I.length)%I.length,n=I[t];ce(t),w(n.fileIndex),setTimeout(()=>{let e=G.current;if(!e)return;let t=o[n.fileIndex];if(!t)return;let r=D?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)},[I,o,D,$]),De=(0,B.useCallback)(()=>{Ee((R??0)-1)},[Ee,R]),Oe=(0,B.useCallback)(()=>{Ee((R??-1)+1)},[Ee,R]),ke=(0,B.useCallback)(async()=>{let i=n.projectModelSelections[e];if(!i)try{let e=await d(),t=Object.values(e).flat();if(t.length>0)i=t[0];else{console.error(`No models available to process comments`);return}}catch(e){console.error(`Failed to load models:`,e);return}let a=i.id,o=i.provider;try{let{prompt:n}=await s(e,I);L([]),r({type:j.SetPendingChatMessage,message:{threadId:e,message:n,model:a,provider:o}}),t()}catch(e){console.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[I,n.projectModelSelections,r,e,t,L]),Ae={readOnly:!0,renderSideBySide:!0,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,lineNumbers:Q&&(D||ye(Q))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0,theme:i===`dark`?`vs-dark`:`vs-light`};return(0,H.jsxs)(`div`,{className:`diff-view-root flex h-full flex-col`,children:[(0,H.jsx)(`div`,{className:`diff-body flex flex-1 overflow-hidden`,children:(0,H.jsxs)(oe,{direction:`horizontal`,children:[(0,H.jsx)(ae,{className:`overflow-hidden bg-transparent`,children:(0,H.jsxs)(`div`,{className:`diff-editor-panel flex h-full bg-transparent flex-col overflow-hidden`,children:[(0,H.jsxs)(ie,{className:a(`bg-transparent`,M&&`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.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,H.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:Q?Q.path:`Review Changes`})}),(0,H.jsxs)(`div`,{className:a(`flex items-center gap-2`,M&&`ml-0`,!M&&`ml-auto`,`md:ml-auto`),children:[(0,H.jsx)(l,{variant:`ghost`,size:`sm`,onClick:()=>O(e=>!e),disabled:!Q,className:`h-8 gap-1 px-2 text-xs`,children:D?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(x,{className:`h-3 w-3`}),` Show changes only`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C,{className:`h-3 w-3`}),` Show full file`]})}),I.length>0&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(P,{children:[(0,H.jsx)(te,{asChild:!0,children:(0,H.jsx)(l,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:De,disabled:(R??0)===0,children:(0,H.jsx)(g,{className:`h-3 w-3`})})}),(0,H.jsx)(N,{children:`Previous comment`})]}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:I.length===1?`1 Comment`:`Comment ${(R??0)+1} of ${I.length}`}),(0,H.jsxs)(P,{children:[(0,H.jsx)(te,{asChild:!0,children:(0,H.jsx)(l,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Oe,disabled:(R??0)===I.length-1,children:(0,H.jsx)(m,{className:`h-3 w-3`})})}),(0,H.jsx)(N,{children:`Next comment`})]})]}),I.length>0&&(0,H.jsxs)(P,{children:[(0,H.jsx)(te,{asChild:!0,children:(0,H.jsxs)(l,{size:`sm`,onClick:ke,className:`h-8 gap-1 px-3 text-xs bg-foreground text-background hover:bg-foreground/90`,children:[(0,H.jsx)(_,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,H.jsx)(N,{children:`Send all comments to Tarsk for resolution`})]}),(0,H.jsxs)(l,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:pe,children:[M?(0,H.jsx)(T,{className:`h-4 w-4`}):(0,H.jsx)(S,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]})]})]}),(0,H.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[(0,H.jsx)(ee,{height:`100%`,language:be(Q?.path||``),original:xe,modified:Se,onMount:Ce,options:Ae},`diff-${b}`),(0,H.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0`,children:(0,H.jsx)(re,{})})]})]})}),(0,H.jsx)(he,{isOpen:!M}),(0,H.jsx)(ae,{ref:F,defaultSize:25,minSize:12,maxSize:40,collapsible:!0,collapsedSize:0,onCollapse:()=>se(!0),onExpand:()=>se(!1),className:`border-l border-transparent ml-[40px]`,children:(0,H.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,H.jsx)(de,{treeData:_e,files:o,isLoading:u,error:h,selectedFileIndex:b,onFileSelect:w,onRevertFile:me})})})]})}),(0,H.jsx)(ge,{open:z!==null||U!==null,lineNumber:U?.lineNumber??z?.lineNumber??0,lineContent:U?.lineContent??z?.lineContent??``,initialComment:U?.comment,isEditing:U!==null,onSave:we,onDelete:Te,onClose:()=>{V(null),W(null)}},`${U?.id??``}-${z?.lineNumber??``}-${z?.side??``}`)]})}export{X as DiffView,X as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-
|
|
2
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-z3yBekT5.js","assets/rolldown-runtime-Dw2cE7zH.js","assets/index-CQrq9F6C.js","assets/react-vendor-CUw-HIQD.js","assets/history-view-ETKpXvpZ.js","assets/dialogs-config-bLEt-2lj.js","assets/monaco-CgzMkQ7t.js","assets/onboarding-Dvaoo4rL.js","assets/textarea-DtvDY2H_.js","assets/store-CDLJd-q_.js","assets/utils-BxHvPw5k.js","assets/index-Dwos0qd5.css","assets/api-tXifOYo2.js","assets/context-menu-CmaVJQOJ.js","assets/explorer-view-CjevBGrc.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Dn as t,la as n,sa as r,xr as i}from"./dialogs-config-bLEt-2lj.js";import{_t as a}from"./react-vendor-CUw-HIQD.js";import{a as o}from"./store-CDLJd-q_.js";import{c as s,n as c,r as l,t as u}from"./index-CQrq9F6C.js";var d=r(),f=e(n(),1),p=i(),m=(0,f.lazy)(()=>a(()=>import(`./explorer-tree-z3yBekT5.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),h=(0,f.lazy)(()=>a(()=>import(`./explorer-view-CjevBGrc.js`),__vite__mapDeps([14,1,2,3,4,5,6,7,8,9,10,11,12])));function g(){let e=(0,d.c)(17),{state:n}=o(),r=n.selectedThreadId,[i,a]=(0,f.useState)(null),{pendingExplorerPath:g,setPendingExplorerPath:v,explorerClearPath:y,setExplorerClearPath:b}=s(),x,S;e[0]!==g||e[1]!==v?(x=()=>{g&&(a({name:g.split(`/`).pop()??g,type:`file`,path:g}),v(null))},S=[g,v],e[0]=g,e[1]=v,e[2]=x,e[3]=S):(x=e[2],S=e[3]),(0,f.useEffect)(x,S);let C,w;e[4]!==y||e[5]!==b?(C=()=>{y&&(a(e=>e&&(e.path===y||e.path.startsWith(y+`/`)?null:e)),b(null))},w=[y,b],e[4]=y,e[5]=b,e[6]=C,e[7]=w):(C=e[6],w=e[7]),(0,f.useEffect)(C,w);let T;e[8]!==i?.path||e[9]!==r?(T=(0,p.jsx)(c,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:(0,p.jsx)(t,{className:`h-full`,children:r?(0,p.jsx)(f.Suspense,{fallback:(0,p.jsx)(`div`,{className:`space-y-1 px-2 py-2`,children:[1,2,3].map(_)}),children:(0,p.jsx)(m,{threadId:r,selectedPath:i?.path??null,onFileSelect:a})}):(0,p.jsx)(`p`,{className:`px-3 py-4 text-xs text-muted-foreground text-center`,children:`No thread selected.`})})}),e[8]=i?.path,e[9]=r,e[10]=T):T=e[10];let E;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,p.jsx)(u,{withHandle:!0}),e[11]=E):E=e[11];let D;e[12]===i?D=e[13]:(D=(0,p.jsx)(c,{className:`overflow-hidden`,children:(0,p.jsx)(f.Suspense,{fallback:null,children:(0,p.jsx)(h,{selectedFile:i})})}),e[12]=i,e[13]=D);let O;return e[14]!==T||e[15]!==D?(O=(0,p.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,p.jsxs)(l,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[T,E,D]})}),e[14]=T,e[15]=D,e[16]=O):O=e[16],O}function _(e){return(0,p.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e)}export{g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Ai as t,Di as n,Oi as r,Qi as i,Xi as a,hi as o,la as s,sa as c,xr as l}from"./dialogs-config-bLEt-2lj.js";import{_ as u,b as d,c as f,g as p,h as m,m as h,p as g,v as _,y as v}from"./index-CQrq9F6C.js";import{a as y,i as ee,n as b,r as x,t as S}from"./context-menu-CmaVJQOJ.js";import{n as C,o as w,r as T,s as E,t as D}from"./api-tXifOYo2.js";var O=c(),k=e(s(),1),A=l();function te(e){let t=(0,O.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,k.useRef)(null),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{c.current?.focus(),c.current?.select()},u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,k.useEffect)(l,u);let 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,A.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-sm`,onClick:j}),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,A.jsxs)(v,{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 j(e){return e.stopPropagation()}function ne(e){let s=(0,O.c)(101),{node:c,level:l,selectedPath:u,expandedPaths:d,loadedDirs:f,loadingPaths:p,renamingPath:m,newItemIn:h,onToggleFolder:g,onSelectFile:_,onStartRename:C,onCommitRename:w,onCancelRename:T,onDelete:E,onNewFile:D,onNewFolder:k,onCommitNewItem:j,onCancelNewItem:P}=e,F;s[0]!==d||s[1]!==c.path?(F=d.has(c.path),s[0]=d,s[1]=c.path,s[2]=F):F=s[2];let I=F,L;s[3]!==p||s[4]!==c.path?(L=p.has(c.path),s[3]=p,s[4]=c.path,s[5]=L):L=s[5];let R=L,z,B;if(s[6]!==d||s[7]!==I||s[8]!==R||s[9]!==l||s[10]!==f||s[11]!==p||s[12]!==h||s[13]!==c||s[14]!==P||s[15]!==T||s[16]!==j||s[17]!==w||s[18]!==E||s[19]!==D||s[20]!==k||s[21]!==_||s[22]!==C||s[23]!==g||s[24]!==m||s[25]!==u){B=Symbol.for(`react.early_return_sentinel`);bb0:{let e=f.get(c.path)??[];z=m===c.path;let O=h?.dirPath===c.path&&I;if(c.type===`folder`){let M=c.ignored?`opacity-50`:void 0,F;s[28]!==c||s[29]!==g?(F=e=>{e.stopPropagation(),g(c)},s[28]=c,s[29]=g,s[30]=F):F=s[30];let L;s[31]!==I||s[32]!==R?(L=(0,A.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:R?(0,A.jsx)(o,{className:`h-3 w-3 animate-spin`}):I?(0,A.jsx)(i,{className:`h-3 w-3`}):(0,A.jsx)(a,{className:`h-3 w-3`})}),s[31]=I,s[32]=R,s[33]=L):L=s[33];let V;s[34]!==I||s[35]!==z||s[36]!==c||s[37]!==T||s[38]!==w?(V=z?(0,A.jsxs)(A.Fragment,{children:[I?(0,A.jsx)(r,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}),(0,A.jsx)(`input`,{autoFocus:!0,defaultValue:c.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?w(c,t):T()}else e.key===`Escape`&&T()},onBlur:e=>{let t=e.target.value.trim();t?w(c,t):T()},onClick:N,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-sm`})]}):(0,A.jsxs)(A.Fragment,{children:[I?(0,A.jsx)(r,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}),(0,A.jsx)(`span`,{className:`flex-1 truncate`,children:c.name})]}),s[34]=I,s[35]=z,s[36]=c,s[37]=T,s[38]=w,s[39]=V):V=s[39];let H;s[40]!==l||s[41]!==M||s[42]!==F||s[43]!==L||s[44]!==V?(H=(0,A.jsxs)(v,{level:l,basePadding:10,className:M,onClick:F,children:[L,V]}),s[40]=l,s[41]=M,s[42]=F,s[43]=L,s[44]=V,s[45]=H):H=s[45];let U=I&&(0,A.jsx)(`div`,{children:R&&!f.has(c.path)?(0,A.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded mx-4 my-1`}):(0,A.jsxs)(A.Fragment,{children:[O&&(0,A.jsx)(te,{defaultValue:``,level:l+1,basePadding:h.type===`folder`?10:22,icon:h.type===`folder`?(0,A.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:j,onCancel:P}),e.map(e=>(0,A.jsx)(ne,{node:e,level:l+1,selectedPath:u,expandedPaths:d,loadedDirs:f,loadingPaths:p,renamingPath:m,newItemIn:h,onToggleFolder:g,onSelectFile:_,onStartRename:C,onCommitRename:w,onCancelRename:T,onDelete:E,onNewFile:D,onNewFolder:k,onCommitNewItem:j,onCancelNewItem:P},e.path))]})}),W;s[46]!==H||s[47]!==U?(W=(0,A.jsxs)(`div`,{children:[H,U]}),s[46]=H,s[47]=U,s[48]=W):W=s[48];let G=W,K;s[49]===G?K=s[50]:(K=(0,A.jsx)(y,{asChild:!0,children:G}),s[49]=G,s[50]=K);let q;s[51]!==c.path||s[52]!==D?(q=(0,A.jsx)(x,{onSelect:()=>D(c.path),children:`New File...`}),s[51]=c.path,s[52]=D,s[53]=q):q=s[53];let J;s[54]!==c.path||s[55]!==k?(J=(0,A.jsx)(x,{onSelect:()=>k(c.path),children:`New Folder...`}),s[54]=c.path,s[55]=k,s[56]=J):J=s[56];let Y;s[57]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,A.jsx)(ee,{}),s[57]=Y):Y=s[57];let X;s[58]!==c||s[59]!==C?(X=(0,A.jsx)(x,{onSelect:()=>C(c),children:`Rename...`}),s[58]=c,s[59]=C,s[60]=X):X=s[60];let Z;s[61]!==c||s[62]!==E?(Z=(0,A.jsx)(x,{onSelect:()=>E(c),className:`text-destructive focus:text-destructive`,children:`Delete`}),s[61]=c,s[62]=E,s[63]=Z):Z=s[63];let Q;s[64]!==q||s[65]!==J||s[66]!==X||s[67]!==Z?(Q=(0,A.jsxs)(b,{children:[q,J,Y,X,Z]}),s[64]=q,s[65]=J,s[66]=X,s[67]=Z,s[68]=Q):Q=s[68];let $;s[69]!==K||s[70]!==Q?($=(0,A.jsxs)(S,{children:[K,Q]}),s[69]=K,s[70]=Q,s[71]=$):$=s[71],B=$;break bb0}}s[6]=d,s[7]=I,s[8]=R,s[9]=l,s[10]=f,s[11]=p,s[12]=h,s[13]=c,s[14]=P,s[15]=T,s[16]=j,s[17]=w,s[18]=E,s[19]=D,s[20]=k,s[21]=_,s[22]=C,s[23]=g,s[24]=m,s[25]=u,s[26]=z,s[27]=B}else z=s[26],B=s[27];if(B!==Symbol.for(`react.early_return_sentinel`))return B;let V=u===c.path,H=c.ignored?`opacity-50`:void 0,U;s[72]!==c||s[73]!==_?(U=()=>_(c),s[72]=c,s[73]=_,s[74]=U):U=s[74];let W;s[75]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,A.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),s[75]=W):W=s[75];let G;s[76]!==z||s[77]!==c||s[78]!==T||s[79]!==w?(G=z?(0,A.jsx)(`input`,{autoFocus:!0,defaultValue:c.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?w(c,t):T()}else e.key===`Escape`&&T()},onBlur:e=>{let t=e.target.value.trim();t?w(c,t):T()},onClick:M,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-sm`}):(0,A.jsx)(`span`,{className:`flex-1 truncate`,children:c.name}),s[76]=z,s[77]=c,s[78]=T,s[79]=w,s[80]=G):G=s[80];let K;s[81]!==l||s[82]!==V||s[83]!==H||s[84]!==U||s[85]!==G?(K=(0,A.jsxs)(v,{level:l,basePadding:22,selected:V,className:H,onClick:U,children:[W,G]}),s[81]=l,s[82]=V,s[83]=H,s[84]=U,s[85]=G,s[86]=K):K=s[86];let q=K,J;s[87]===q?J=s[88]:(J=(0,A.jsx)(y,{asChild:!0,children:q}),s[87]=q,s[88]=J);let Y;s[89]!==c||s[90]!==C?(Y=(0,A.jsx)(x,{onSelect:()=>C(c),children:`Rename...`}),s[89]=c,s[90]=C,s[91]=Y):Y=s[91];let X;s[92]!==c||s[93]!==E?(X=(0,A.jsx)(x,{onSelect:()=>E(c),className:`text-destructive focus:text-destructive`,children:`Delete`}),s[92]=c,s[93]=E,s[94]=X):X=s[94];let Z;s[95]!==Y||s[96]!==X?(Z=(0,A.jsxs)(b,{children:[Y,X]}),s[95]=Y,s[96]=X,s[97]=Z):Z=s[97];let Q;return s[98]!==J||s[99]!==Z?(Q=(0,A.jsxs)(S,{children:[J,Z]}),s[98]=J,s[99]=Z,s[100]=Q):Q=s[100],Q}function M(e){return e.stopPropagation()}function N(e){return e.stopPropagation()}function P({threadId:e,selectedPath:r,onFileSelect:i}){let[a,o]=(0,k.useState)(new Map),[s,c]=(0,k.useState)(new Set),[l,v]=(0,k.useState)(new Set),[ee,O]=(0,k.useState)(null),[j,M]=(0,k.useState)(null),[N,P]=(0,k.useState)(null),{explorerRefreshTick:F,pendingExplorerPath:I}=f();async function L(t){if(!(!e||a.has(t))){v(e=>new Set(e).add(t));try{let n=await w(e,t);o(e=>new Map(e).set(t,n.entries))}catch{d({title:`Error`,description:`Failed to load directory`,variant:`destructive`})}finally{v(e=>{let n=new Set(e);return n.delete(t),n})}}}let R=(0,k.useCallback)(async t=>{if(e){v(e=>new Set(e).add(t));try{let n=await w(e,t);o(e=>new Map(e).set(t,n.entries))}catch{d({title:`Error`,description:`Failed to reload directory`,variant:`destructive`})}finally{v(e=>{let n=new Set(e);return n.delete(t),n})}}},[e]);(0,k.useEffect)(()=>{e&&(o(new Map),c(new Set),v(new Set),O(null),M(null),L(``))},[e]),(0,k.useEffect)(()=>{if(F>0&&e){R(``);for(let e of s)R(e)}},[F]),(0,k.useEffect)(()=>{if(!I||!e)return;let t=I.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){c(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)L(e)}},[I,e]);function z(e){s.has(e.path)?c(t=>{let n=new Set(t);return n.delete(e.path),n}):(c(t=>new Set(t).add(e.path)),L(e.path))}function B(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function V(e){P(e)}async function H(){if(!N)return;let t=N;P(null);try{await T(e,t.path),await R(B(t.path)),c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{d({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function U(e){M(null),O(e.path)}async function W(t,n){if(n===t.name){O(null);return}O(null);try{await E(e,t.path,n),await R(B(t.path)),t.type===`folder`&&(c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{d({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function G(e){O(null),s.has(e)||(c(t=>new Set(t).add(e)),L(e)),M({dirPath:e,type:`file`})}function K(e){O(null),s.has(e)||(c(t=>new Set(t).add(e)),L(e)),M({dirPath:e,type:`folder`})}async function q(t){if(!j)return;let{dirPath:n,type:r}=j;M(null);try{r===`file`?await D(e,n,t):await C(e,n,t),await R(n)}catch{d({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function J(){M(null)}let Y=a.get(``)??[],X=l.has(``),Z=j?.dirPath===``?(0,A.jsx)(te,{defaultValue:``,level:0,basePadding:j.type===`folder`?10:22,icon:j.type===`folder`?(0,A.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:q,onCancel:J}):null;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(g,{open:N!==null,onOpenChange:e=>!e&&P(null),children:(0,A.jsxs)(p,{children:[(0,A.jsx)(_,{children:`Move to Trash`}),(0,A.jsxs)(u,{children:[`Move “`,N?.name,`” to trash?`]}),(0,A.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,A.jsx)(m,{children:`Cancel`}),(0,A.jsx)(h,{onClick:()=>void H(),children:`Move to Trash`})]})]})}),(0,A.jsxs)(S,{children:[(0,A.jsx)(y,{asChild:!0,children:(0,A.jsx)(`div`,{className:`py-2 min-h-full`,children:X?(0,A.jsx)(`div`,{className:`space-y-1 px-2`,children:[1,2,3].map(e=>(0,A.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e))}):(0,A.jsxs)(A.Fragment,{children:[Z,Y.map(e=>(0,A.jsx)(ne,{node:e,level:0,selectedPath:r,expandedPaths:s,loadedDirs:a,loadingPaths:l,renamingPath:ee,newItemIn:j,onToggleFolder:z,onSelectFile:i,onStartRename:U,onCommitRename:W,onCancelRename:()=>O(null),onDelete:V,onNewFile:G,onNewFolder:K,onCommitNewItem:q,onCancelNewItem:J},e.path))]})})}),(0,A.jsxs)(b,{children:[(0,A.jsx)(x,{onSelect:()=>G(``),children:`New File...`}),(0,A.jsx)(x,{onSelect:()=>K(``),children:`New Folder...`})]})]})]})}export{P as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Mn as t,hi as n,ji as r,la as i,xr as a}from"./dialogs-config-bLEt-2lj.js";import{g as o}from"./react-vendor-CUw-HIQD.js";import{a as s}from"./store-CDLJd-q_.js";import{n as c}from"./utils-BxHvPw5k.js";import{b as l,l as u}from"./index-CQrq9F6C.js";import{a as d,c as f,i as p}from"./api-tXifOYo2.js";var m=e(i(),1),h=a(),g=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`,`bmp`,`tiff`,`tif`]),_=new Set([`mp4`,`webm`,`mov`,`avi`]);function v(e){let t=e.split(`.`).pop()?.toLowerCase()??``;return g.has(t)?`image`:_.has(t)?`video`:null}function y(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,mdc:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`}[e.split(`.`).pop()??``]??`plaintext`}function b({selectedFile:e}){let{state:i}=s(),{resolvedTheme:a}=c(),g=i.selectedThreadId,[_,b]=(0,m.useState)(``),[x,S]=(0,m.useState)(``),[C,w]=(0,m.useState)(!1),[T,E]=(0,m.useState)(!1);async function D(){if(!(!g||!e)){E(!0);try{await f(g,e.path,_),S(_),l({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){l({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{E(!1)}}}let O=(0,m.useCallback)(async e=>{if(g){w(!0);try{let t=await p(g,e.path);b(t.content),S(t.content)}catch(e){l({title:`Error`,description:e instanceof Error?e.message:`Failed to load file`,variant:`destructive`})}finally{w(!1)}}},[g]);return(0,m.useEffect)(()=>{e&&g?v(e.path)||O(e):(b(``),S(``))},[e,g,O]),g?(0,h.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,h.jsxs)(u,{className:`justify-between`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col`,children:[(0,h.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e?e.name:`Select a file to edit`}),(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e?e.path:`Browse and edit repository files`})]}),e&&!v(e.path)&&(0,h.jsx)(`div`,{className:`flex gap-1`,children:(0,h.jsxs)(t,{size:`sm`,onClick:()=>void D(),disabled:T||!_||_===x,children:[T?(0,h.jsx)(n,{className:`h-4 w-4 animate-spin`}):null,`Save`]})})]}),(0,h.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,h.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:C?(0,h.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,h.jsx)(n,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):e&&v(e.path)===`image`?(0,h.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,h.jsx)(`img`,{src:d(g,e.path),alt:e.name,className:`max-w-full max-h-full object-contain`})}):e&&v(e.path)===`video`?(0,h.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,h.jsx)(`video`,{src:d(g,e.path),controls:!0,className:`max-w-full max-h-full`})}):e?(0,h.jsx)(o,{height:`100%`,language:y(e.path),value:_,onChange:e=>b(e??``),theme:a===`dark`?`vs-dark`:`vs-light`,options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,fontSize:13,lineNumbers:`on`,renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`}}}):(0,h.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,h.jsx)(r,{className:`h-10 w-10 text-muted-foreground/50`}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`No file selected`}),(0,h.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Select a file from the tree to edit it`})]})]})})})]}):(0,h.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[(0,h.jsx)(r,{className:`h-8 w-8 text-muted-foreground`}),(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select a thread to browse its files`})]})}export{b as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{$i as t,Bi as n,Cr as r,Dn as i,Dr as a,Hn as o,Mn as s,On as c,Qi as l,Wi as u,Xi as d,Yi as f,Zi as p,_r as m,a as h,ar as g,br as _,ca as v,cr as y,fr as b,gr as x,hr as S,i as C,ir as w,kn as T,la as E,n as D,nt as O,or as k,pr as A,r as j,rr as M,sa as N,sr as ee,u as te,ur as ne,vr as P,wr as F,xr as re,yr as I}from"./dialogs-config-bLEt-2lj.js";var ie=[`top`,`right`,`bottom`,`left`],L=Math.min,R=Math.max,ae=Math.round,oe=Math.floor,z=e=>({x:e,y:e}),se={left:`right`,right:`left`,bottom:`top`,top:`bottom`},ce={start:`end`,end:`start`};function le(e,t,n){return R(e,L(t,n))}function B(e,t){return typeof e==`function`?e(t):e}function V(e){return e.split(`-`)[0]}function ue(e){return e.split(`-`)[1]}function de(e){return e===`x`?`y`:`x`}function fe(e){return e===`y`?`height`:`width`}var pe=new Set([`top`,`bottom`]);function H(e){return pe.has(V(e))?`y`:`x`}function me(e){return de(H(e))}function he(e,t,n){n===void 0&&(n=!1);let r=ue(e),i=me(e),a=fe(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=we(o)),[o,we(o)]}function ge(e){let t=we(e);return[_e(e),t,_e(t)]}function _e(e){return e.replace(/start|end/g,e=>ce[e])}var ve=[`left`,`right`],ye=[`right`,`left`],be=[`top`,`bottom`],xe=[`bottom`,`top`];function Se(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ye:ve:t?ve:ye;case`left`:case`right`:return t?be:xe;default:return[]}}function Ce(e,t,n,r){let i=ue(e),a=Se(V(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(_e)))),a}function we(e){return e.replace(/left|right|bottom|top/g,e=>se[e])}function Te(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ee(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Te(e)}function De(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Oe(e,t,n){let{reference:r,floating:i}=e,a=H(t),o=me(t),s=fe(o),c=V(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(ue(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function ke(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=B(t,e),p=Ee(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=De(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=De(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Ae=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Oe(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:{...o,detectOverflow:o.detectOverflow??ke},elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=Oe(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},je=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=B(e,t)||{};if(l==null)return{};let d=Ee(u),f={x:n,y:r},p=me(i),m=fe(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=L(d[_],T),D=L(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=le(O,A,k),M=!c.arrow&&ue(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),Me=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=B(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=V(r),_=H(o),v=V(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[we(o)]:ge(o)),x=p!==`none`;!d&&x&&b.push(...Ce(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=he(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==H(t))||T.every(e=>H(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=H(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ne(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Pe(e){return ie.some(t=>e[t]>=0)}var Fe=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=B(e,t);switch(i){case`referenceHidden`:{let e=Ne(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Pe(e)}}}case`escaped`:{let e=Ne(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Pe(e)}}}default:return{}}}}},Ie=new Set([`left`,`top`]);async function Le(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=V(n),s=ue(n),c=H(n)===`y`,l=Ie.has(o)?-1:1,u=a&&c?-1:1,d=B(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Re=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Le(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ze=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=B(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=H(V(i)),p=de(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=le(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=le(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Be=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=B(e,t),u={x:n,y:r},d=H(i),f=de(d),p=u[f],m=u[d],h=B(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ie.has(V(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Ve=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=B(e,t),u=await o.detectOverflow(t,l),d=V(i),f=ue(i),p=H(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=L(h-u[g],v),x=L(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=R(u.left,0),t=R(u.right,0),n=R(u.top,0),r=R(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:R(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:R(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function He(){return typeof window<`u`}function Ue(e){return We(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function W(e){return((We(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function We(e){return He()?e instanceof Node||e instanceof U(e).Node:!1}function G(e){return He()?e instanceof Element||e instanceof U(e).Element:!1}function K(e){return He()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function Ge(e){return!He()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}var Ke=new Set([`inline`,`contents`]);function qe(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=q(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Ke.has(i)}var Je=new Set([`table`,`td`,`th`]);function Ye(e){return Je.has(Ue(e))}var Xe=[`:popover-open`,`:modal`];function Ze(e){return Xe.some(t=>{try{return e.matches(t)}catch{return!1}})}var Qe=[`transform`,`translate`,`scale`,`rotate`,`perspective`],$e=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],et=[`paint`,`layout`,`strict`,`content`];function tt(e){let t=rt(),n=G(e)?q(e):e;return Qe.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||$e.some(e=>(n.willChange||``).includes(e))||et.some(e=>(n.contain||``).includes(e))}function nt(e){let t=J(e);for(;K(t)&&!at(t);){if(tt(t))return t;if(Ze(t))return null;t=J(t)}return null}function rt(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var it=new Set([`html`,`body`,`#document`]);function at(e){return it.has(Ue(e))}function q(e){return U(e).getComputedStyle(e)}function ot(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function J(e){if(Ue(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ge(e)&&e.host||W(e);return Ge(t)?t.host:t}function st(e){let t=J(e);return at(t)?e.ownerDocument?e.ownerDocument.body:e.body:K(t)&&qe(t)?t:st(t)}function ct(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=st(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=lt(a);return t.concat(a,a.visualViewport||[],qe(r)?r:[],e&&n?ct(e):[])}return t.concat(r,ct(r,[],n))}function lt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ut(e){let t=q(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ae(n)!==a||ae(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function dt(e){return G(e)?e:e.contextElement}function ft(e){let t=dt(e);if(!K(t))return z(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ut(t),o=(a?ae(n.width):n.width)/r,s=(a?ae(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var pt=z(0);function mt(e){let t=U(e);return!rt()||!t.visualViewport?pt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ht(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==U(e)?!1:t}function gt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=dt(e),o=z(1);t&&(r?G(r)&&(o=ft(r)):o=ft(e));let s=ht(a,n,r)?mt(a):z(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=U(a),t=r&&G(r)?U(r):r,n=e,i=lt(n);for(;i&&r&&t!==n;){let e=ft(i),t=i.getBoundingClientRect(),r=q(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=U(i),i=lt(n)}}return De({width:u,height:d,x:c,y:l})}function _t(e,t){let n=ot(e).scrollLeft;return t?t.left+n:gt(W(e)).left+n}function vt(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-_t(e,n),y:n.top+t.scrollTop}}function yt(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=W(r),s=t?Ze(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=z(1),u=z(0),d=K(r);if((d||!d&&!a)&&((Ue(r)!==`body`||qe(o))&&(c=ot(r)),K(r))){let e=gt(r);l=ft(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?vt(o,c):z(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function bt(e){return Array.from(e.getClientRects())}function xt(e){let t=W(e),n=ot(e),r=e.ownerDocument.body,i=R(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=R(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+_t(e),s=-n.scrollTop;return q(r).direction===`rtl`&&(o+=R(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var St=25;function Ct(e,t){let n=U(e),r=W(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=rt();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=_t(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=St&&(a-=o)}else l<=St&&(a+=l);return{width:a,height:o,x:s,y:c}}var wt=new Set([`absolute`,`fixed`]);function Tt(e,t){let n=gt(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=K(e)?ft(e):z(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Et(e,t,n){let r;if(t===`viewport`)r=Ct(e,n);else if(t===`document`)r=xt(W(e));else if(G(t))r=Tt(t,n);else{let n=mt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return De(r)}function Dt(e,t){let n=J(e);return n===t||!G(n)||at(n)?!1:q(n).position===`fixed`||Dt(n,t)}function Ot(e,t){let n=t.get(e);if(n)return n;let r=ct(e,[],!1).filter(e=>G(e)&&Ue(e)!==`body`),i=null,a=q(e).position===`fixed`,o=a?J(e):e;for(;G(o)&&!at(o);){let t=q(o),n=tt(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&wt.has(i.position)||qe(o)&&!n&&Dt(e,o))?r=r.filter(e=>e!==o):i=t,o=J(o)}return t.set(e,r),r}function kt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Ze(t)?[]:Ot(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Et(t,n,i);return e.top=R(r.top,e.top),e.right=L(r.right,e.right),e.bottom=L(r.bottom,e.bottom),e.left=R(r.left,e.left),e},Et(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function At(e){let{width:t,height:n}=ut(e);return{width:t,height:n}}function jt(e,t,n){let r=K(t),i=W(t),a=n===`fixed`,o=gt(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=z(0);function l(){c.x=_t(i)}if(r||!r&&!a)if((Ue(t)!==`body`||qe(i))&&(s=ot(t)),r){let e=gt(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?vt(i,s):z(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Mt(e){return q(e).position===`static`}function Nt(e,t){if(!K(e)||q(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return W(e)===n&&(n=n.ownerDocument.body),n}function Pt(e,t){let n=U(e);if(Ze(e))return n;if(!K(e)){let t=J(e);for(;t&&!at(t);){if(G(t)&&!Mt(t))return t;t=J(t)}return n}let r=Nt(e,t);for(;r&&Ye(r)&&Mt(r);)r=Nt(r,t);return r&&at(r)&&Mt(r)&&!tt(r)?n:r||nt(e)||n}var Ft=async function(e){let t=this.getOffsetParent||Pt,n=this.getDimensions,r=await n(e.floating);return{reference:jt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function It(e){return q(e).direction===`rtl`}var Lt={convertOffsetParentRelativeRectToViewportRelativeRect:yt,getDocumentElement:W,getClippingRect:kt,getOffsetParent:Pt,getElementRects:Ft,getClientRects:bt,getDimensions:At,getScale:ft,isElement:G,isRTL:It};function Rt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function zt(e,t){let n=null,r,i=W(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=oe(d),h=oe(i.clientWidth-(u+f)),g=oe(i.clientHeight-(d+p)),_=oe(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:R(0,L(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Rt(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Bt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=dt(e),u=i||a?[...l?ct(l):[],...ct(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?zt(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?gt(e):null;c&&g();function g(){let t=gt(e);h&&!Rt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Vt=Re,Ht=ze,Ut=Me,Wt=Ve,Gt=Fe,Kt=je,qt=Be,Jt=(e,t,n)=>{let r=new Map,i={platform:Lt,...n},a={...i.platform,_c:r};return Ae(e,t,{...i,platform:a})},Y=e(E(),1),Yt=e(v(),1),Xt=typeof document<`u`?Y.useLayoutEffect:function(){};function Zt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Zt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Zt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Qt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $t(e,t){let n=Qt(e);return Math.round(t*n)/n}function en(e){let t=Y.useRef(e);return Xt(()=>{t.current=e}),t}function tn(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=Y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Y.useState(r);Zt(f,r)||p(r);let[m,h]=Y.useState(null),[g,_]=Y.useState(null),v=Y.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Y.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Y.useRef(null),C=Y.useRef(null),w=Y.useRef(u),T=c!=null,E=en(c),D=en(i),O=en(l),k=Y.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Jt(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Zt(w.current,t)&&(w.current=t,Yt.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Xt(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Y.useRef(!1);Xt(()=>(A.current=!0,()=>{A.current=!1}),[]),Xt(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=Y.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Y.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Y.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=$t(M.floating,u.x),r=$t(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Qt(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Y.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var nn=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Kt({element:r.current,padding:i}).fn(n):r?Kt({element:r,padding:i}).fn(n):{}}}},rn=(e,t)=>({...Vt(e),options:[e,t]}),an=(e,t)=>({...Ht(e),options:[e,t]}),on=(e,t)=>({...qt(e),options:[e,t]}),sn=(e,t)=>({...Ut(e),options:[e,t]}),cn=(e,t)=>({...Wt(e),options:[e,t]}),ln=(e,t)=>({...Gt(e),options:[e,t]}),un=(e,t)=>({...nn(e),options:[e,t]}),X=re(),dn=`Arrow`,fn=Y.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,X.jsx)(A.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,X.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});fn.displayName=dn;var pn=fn;function mn(e){let[t,n]=Y.useState(void 0);return I(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var hn=`Popper`,[gn,_n]=_(hn),[vn,yn]=gn(hn),bn=e=>{let{__scopePopper:t,children:n}=e,[r,i]=Y.useState(null);return(0,X.jsx)(vn,{scope:t,anchor:r,onAnchorChange:i,children:n})};bn.displayName=hn;var xn=`PopperAnchor`,Sn=Y.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:i,...a}=e,o=yn(xn,n),s=Y.useRef(null),c=r(t,s),l=Y.useRef(null);return Y.useEffect(()=>{let e=l.current;l.current=i?.current||s.current,e!==l.current&&o.onAnchorChange(l.current)}),i?null:(0,X.jsx)(A.div,{...a,ref:c})});Sn.displayName=xn;var Cn=`PopperContent`,[wn,Tn]=gn(Cn),En=Y.forwardRef((e,t)=>{let{__scopePopper:n,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f=`partial`,hideWhenDetached:p=!1,updatePositionStrategy:m=`optimized`,onPlaced:h,...g}=e,_=yn(Cn,n),[v,y]=Y.useState(null),x=r(t,e=>y(e)),[S,C]=Y.useState(null),w=mn(S),T=w?.width??0,E=w?.height??0,D=i+(o===`center`?``:`-`+o),O=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},k=Array.isArray(u)?u:[u],j=k.length>0,M={padding:O,boundary:k.filter(An),altBoundary:j},{refs:N,floatingStyles:ee,placement:te,isPositioned:ne,middlewareData:P}=tn({strategy:`fixed`,placement:D,whileElementsMounted:(...e)=>Bt(...e,{animationFrame:m===`always`}),elements:{reference:_.anchor},middleware:[rn({mainAxis:a+E,alignmentAxis:s}),l&&an({mainAxis:!0,crossAxis:!1,limiter:f===`partial`?on():void 0,...M}),l&&sn({...M}),cn({...M,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),S&&un({element:S,padding:c}),jn({arrowWidth:T,arrowHeight:E}),p&&ln({strategy:`referenceHidden`,...M})]}),[F,re]=Mn(te),ie=b(h);I(()=>{ne&&ie?.()},[ne,ie]);let L=P.arrow?.x,R=P.arrow?.y,ae=P.arrow?.centerOffset!==0,[oe,z]=Y.useState();return I(()=>{v&&z(window.getComputedStyle(v).zIndex)},[v]),(0,X.jsx)(`div`,{ref:N.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:ne?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,X.jsx)(wn,{scope:n,placedSide:F,onArrowChange:C,arrowX:L,arrowY:R,shouldHideArrow:ae,children:(0,X.jsx)(A.div,{"data-side":F,"data-align":re,...g,ref:x,style:{...g.style,animation:ne?void 0:`none`}})})})});En.displayName=Cn;var Dn=`PopperArrow`,On={top:`bottom`,right:`left`,bottom:`top`,left:`right`},kn=Y.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Tn(Dn,n),a=On[i.placedSide];return(0,X.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,X.jsx)(pn,{...r,ref:t,style:{...r.style,display:`block`}})})});kn.displayName=Dn;function An(e){return e!==null}var jn=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Mn(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Mn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Nn=bn,Pn=Sn,Fn=En,In=kn,Ln=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Rn=`VisuallyHidden`,zn=Y.forwardRef((e,t)=>(0,X.jsx)(A.span,{...e,ref:t,style:{...Ln,...e.style}}));zn.displayName=Rn;var Bn=zn,[Vn,Hn]=_(`Tooltip`,[_n]),Un=_n(),Wn=`TooltipProvider`,Gn=700,Kn=`tooltip.open`,[qn,Jn]=Vn(Wn),Yn=e=>{let{__scopeTooltip:t,delayDuration:n=Gn,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=Y.useRef(!0),s=Y.useRef(!1),c=Y.useRef(0);return Y.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,X.jsx)(qn,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:Y.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:Y.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:Y.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Yn.displayName=Wn;var Xn=`Tooltip`,[Zn,Qn]=Vn(Xn),$n=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Jn(Xn,e.__scopeTooltip),l=Un(t),[u,d]=Y.useState(null),f=P(),p=Y.useRef(0),h=o??c.disableHoverableContent,g=s??c.delayDuration,_=Y.useRef(!1),[v,y]=m({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Kn))):c.onClose(),a?.(e)},caller:Xn}),b=Y.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),x=Y.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_.current=!1,y(!0)},[y]),S=Y.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),C=Y.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{_.current=!0,y(!0),p.current=0},g)},[g,y]);return Y.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,X.jsx)(Nn,{...l,children:(0,X.jsx)(Zn,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:Y.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:Y.useCallback(()=>{h?S():(window.clearTimeout(p.current),p.current=0)},[S,h]),onOpen:x,onClose:S,disableHoverableContent:h,children:n})})};$n.displayName=Xn;var er=`TooltipTrigger`,tr=Y.forwardRef((e,t)=>{let{__scopeTooltip:n,...i}=e,a=Qn(er,n),o=Jn(er,n),s=Un(n),c=r(t,Y.useRef(null),a.onTriggerChange),l=Y.useRef(!1),u=Y.useRef(!1),d=Y.useCallback(()=>l.current=!1,[]);return Y.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,X.jsx)(Pn,{asChild:!0,...s,children:(0,X.jsx)(A.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...i,ref:c,onPointerMove:F(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:F(e.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:F(e.onPointerDown,()=>{a.open&&a.onClose(),l.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:F(e.onFocus,()=>{l.current||a.onOpen()}),onBlur:F(e.onBlur,a.onClose),onClick:F(e.onClick,a.onClose)})})});tr.displayName=er;var nr=`TooltipPortal`,[rr,ir]=Vn(nr,{forceMount:void 0}),ar=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Qn(nr,t);return(0,X.jsx)(rr,{scope:t,forceMount:n,children:(0,X.jsx)(k,{present:n||a.open,children:(0,X.jsx)(ee,{asChild:!0,container:i,children:r})})})};ar.displayName=nr;var or=`TooltipContent`,sr=Y.forwardRef((e,t)=>{let n=ir(or,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Qn(or,e.__scopeTooltip);return(0,X.jsx)(k,{present:r||o.open,children:o.disableHoverableContent?(0,X.jsx)(fr,{side:i,...a,ref:t}):(0,X.jsx)(cr,{side:i,...a,ref:t})})}),cr=Y.forwardRef((e,t)=>{let n=Qn(or,e.__scopeTooltip),i=Jn(or,e.__scopeTooltip),a=Y.useRef(null),o=r(t,a),[s,c]=Y.useState(null),{trigger:l,onClose:u}=n,d=a.current,{onPointerInTransitChange:f}=i,p=Y.useCallback(()=>{c(null),f(!1)},[f]),m=Y.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=gr(r,hr(r,n.getBoundingClientRect())),a=_r(t.getBoundingClientRect());c(yr([...i,...a])),f(!0)},[f]);return Y.useEffect(()=>()=>p(),[p]),Y.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),Y.useEffect(()=>{if(s){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!vr(n,s);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,s,u,p]),(0,X.jsx)(fr,{...e,ref:o})}),[lr,ur]=Vn(Xn,{isInside:!1}),dr=x(`TooltipContent`),fr=Y.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Qn(or,n),l=Un(n),{onClose:u}=c;return Y.useEffect(()=>(document.addEventListener(Kn,u),()=>document.removeEventListener(Kn,u)),[u]),Y.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,X.jsx)(ne,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,X.jsxs)(Fn,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,X.jsx)(dr,{children:r}),(0,X.jsx)(lr,{scope:n,isInside:!0,children:(0,X.jsx)(Bn,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});sr.displayName=or;var pr=`TooltipArrow`,mr=Y.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Un(n);return ur(pr,n).isInside?null:(0,X.jsx)(In,{...i,...r,ref:t})});mr.displayName=pr;function hr(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function gr(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function _r(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function vr(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function yr(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),br(t)}function br(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var xr=Yn,Sr=$n,Cr=tr,wr=sr,Z=N(),Tr=xr,Er=Sr,Dr=Cr,Or=Y.forwardRef((e,t)=>{let n=(0,Z.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,sideOffset:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let s=a===void 0?4:a,c;n[4]===r?c=n[5]:(c=o(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,r),n[4]=r,n[5]=c);let l;return n[6]!==i||n[7]!==t||n[8]!==s||n[9]!==c?(l=(0,X.jsx)(wr,{ref:t,sideOffset:s,className:c,...i}),n[6]=i,n[7]=t,n[8]=s,n[9]=c,n[10]=l):l=n[10],l});Or.displayName=wr.displayName;function kr(e){let t=Y.useRef({value:e,previous:e});return Y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Ar=Y.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(`w-full caption-bottom text-sm`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,X.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,X.jsx)(`table`,{ref:t,className:a,...i})}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});Ar.displayName=`Table`;var jr=Y.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(`[&_tr]:border-b`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,X.jsx)(`thead`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});jr.displayName=`TableHeader`;var Mr=Y.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(`[&_tr:last-child]:border-0`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,X.jsx)(`tbody`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});Mr.displayName=`TableBody`;var Nr=Y.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(`border-t bg-muted/50 font-medium [&>tr]:last:border-b-0`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,X.jsx)(`tfoot`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});Nr.displayName=`TableFooter`;var Pr=Y.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,X.jsx)(`tr`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});Pr.displayName=`TableRow`;var Fr=Y.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(`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 s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,X.jsx)(`th`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});Fr.displayName=`TableHead`;var Ir=Y.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(`p-4 align-middle [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,X.jsx)(`td`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});Ir.displayName=`TableCell`;var Lr=Y.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(`mt-4 text-sm text-muted-foreground`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,X.jsx)(`caption`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});Lr.displayName=`TableCaption`;var Rr=[` `,`Enter`,`ArrowUp`,`ArrowDown`],zr=[` `,`Enter`],Br=`Select`,[Vr,Hr,Ur]=te(Br),[Wr,Gr]=_(Br,[Ur,_n]),Kr=_n(),[qr,Q]=Wr(Br),[Jr,Yr]=Wr(Br),Xr=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:h}=e,g=Kr(t),[_,v]=Y.useState(null),[y,b]=Y.useState(null),[x,S]=Y.useState(!1),C=T(l),[w,E]=m({prop:r,defaultProp:i??!1,onChange:a,caller:Br}),[D,O]=m({prop:o,defaultProp:s,onChange:c,caller:Br}),k=Y.useRef(null),A=_?h||!!_.closest(`form`):!0,[j,M]=Y.useState(new Set),N=Array.from(j).map(e=>e.props.value).join(`;`);return(0,X.jsx)(Nn,{...g,children:(0,X.jsxs)(qr,{required:p,scope:t,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:P(),value:D,onValueChange:O,open:w,onOpenChange:E,dir:C,triggerPointerDownPosRef:k,disabled:f,children:[(0,X.jsx)(Vr.Provider,{scope:t,children:(0,X.jsx)(Jr,{scope:e.__scopeSelect,onNativeOptionAdd:Y.useCallback(e=>{M(t=>new Set(t).add(e))},[]),onNativeOptionRemove:Y.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),A?(0,X.jsxs)(Wi,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:D,onChange:e=>O(e.target.value),disabled:f,form:h,children:[D===void 0?(0,X.jsx)(`option`,{value:``}):null,Array.from(j)]},N):null]})})};Xr.displayName=Br;var Zr=`SelectTrigger`,Qr=Y.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:i=!1,...a}=e,o=Kr(n),s=Q(Zr,n),c=s.disabled||i,l=r(t,s.onTriggerChange),u=Hr(n),d=Y.useRef(`touch`),[f,p,m]=Ki(e=>{let t=u().filter(e=>!e.disabled),n=qi(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,X.jsx)(Pn,{asChild:!0,...o,children:(0,X.jsx)(A.button,{type:`button`,role:`combobox`,"aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":Gi(s.value)?``:void 0,...a,ref:l,onClick:F(a.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&h(e)}),onPointerDown:F(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:F(a.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&p(e.key),!(t&&e.key===` `)&&Rr.includes(e.key)&&(h(),e.preventDefault())})})})});Qr.displayName=Zr;var $r=`SelectValue`,ei=Y.forwardRef((e,t)=>{let{__scopeSelect:n,className:i,style:a,children:o,placeholder:s=``,...c}=e,l=Q($r,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=r(t,l.onValueNodeChange);return I(()=>{u(d)},[u,d]),(0,X.jsx)(A.span,{...c,ref:f,style:{pointerEvents:`none`},children:Gi(l.value)?(0,X.jsx)(X.Fragment,{children:s}):o})});ei.displayName=$r;var ti=`SelectIcon`,ni=Y.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,X.jsx)(A.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ni.displayName=ti;var ri=`SelectPortal`,ii=e=>(0,X.jsx)(ee,{asChild:!0,...e});ii.displayName=ri;var ai=`SelectContent`,oi=Y.forwardRef((e,t)=>{let n=Q(ai,e.__scopeSelect),[r,i]=Y.useState();if(I(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Yt.createPortal((0,X.jsx)(si,{scope:e.__scopeSelect,children:(0,X.jsx)(Vr.Slot,{scope:e.__scopeSelect,children:(0,X.jsx)(`div`,{children:e.children})})}),t):null}return(0,X.jsx)(di,{...e,ref:t})});oi.displayName=ai;var $=10,[si,ci]=Wr(ai),li=`SelectContentImpl`,ui=S(`SelectContent.RemoveScroll`),di=Y.forwardRef((e,t)=>{let{__scopeSelect:n,position:i=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:_,avoidCollisions:v,...b}=e,x=Q(ai,n),[S,C]=Y.useState(null),[T,E]=Y.useState(null),D=r(t,e=>C(e)),[O,k]=Y.useState(null),[A,j]=Y.useState(null),N=Hr(n),[ee,te]=Y.useState(!1),P=Y.useRef(!1);Y.useEffect(()=>{if(S)return M(S)},[S]),g();let re=Y.useCallback(e=>{let[t,...n]=N().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&T&&(T.scrollTop=0),n===r&&T&&(T.scrollTop=T.scrollHeight),n?.focus(),document.activeElement!==i))return},[N,T]),I=Y.useCallback(()=>re([O,S]),[re,O,S]);Y.useEffect(()=>{ee&&I()},[ee,I]);let{onOpenChange:ie,triggerPointerDownPosRef:L}=x;Y.useEffect(()=>{if(S){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(L.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(L.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():S.contains(n.target)||ie(!1),document.removeEventListener(`pointermove`,t),L.current=null};return L.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[S,ie,L]),Y.useEffect(()=>{let e=()=>ie(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[ie]);let[R,ae]=Ki(e=>{let t=N().filter(e=>!e.disabled),n=qi(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),oe=Y.useCallback((e,t,n)=>{let r=!P.current&&!n;(x.value!==void 0&&x.value===t||r)&&(k(e),r&&(P.current=!0))},[x.value]),z=Y.useCallback(()=>S?.focus(),[S]),se=Y.useCallback((e,t,n)=>{let r=!P.current&&!n;(x.value!==void 0&&x.value===t||r)&&j(e)},[x.value]),ce=i===`popper`?hi:pi,le=ce===hi?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:_,avoidCollisions:v}:{};return(0,X.jsx)(si,{scope:n,content:S,viewport:T,onViewportChange:E,itemRefCallback:oe,selectedItem:O,onItemLeave:z,itemTextRefCallback:se,focusSelectedItem:I,selectedItemText:A,position:i,isPositioned:ee,searchRef:R,children:(0,X.jsx)(w,{as:ui,allowPinchZoom:!0,children:(0,X.jsx)(y,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:F(a,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,X.jsx)(ne,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:(0,X.jsx)(ce,{role:`listbox`,id:x.contentId,"data-state":x.open?`open`:`closed`,dir:x.dir,onContextMenu:e=>e.preventDefault(),...b,...le,onPlaced:()=>te(!0),ref:D,style:{display:`flex`,flexDirection:`column`,outline:`none`,...b.style},onKeyDown:F(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ae(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=N().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>re(t)),e.preventDefault()}})})})})})})});di.displayName=li;var fi=`SelectItemAlignedPosition`,pi=Y.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:i,...a}=e,o=Q(ai,n),s=ci(ai,n),[l,u]=Y.useState(null),[d,f]=Y.useState(null),p=r(t,e=>f(e)),m=Hr(n),h=Y.useRef(!1),g=Y.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=s,x=Y.useCallback(()=>{if(o.trigger&&o.valueNode&&l&&d&&_&&v&&y){let e=o.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),r=y.getBoundingClientRect();if(o.dir!==`rtl`){let i=r.left-t.left,a=n.left-i,o=e.left-a,s=e.width+o,u=Math.max(s,t.width),d=window.innerWidth-$,f=c(a,[$,Math.max($,d-u)]);l.style.minWidth=s+`px`,l.style.left=f+`px`}else{let i=t.right-r.right,a=window.innerWidth-n.right-i,o=window.innerWidth-e.right-a,s=e.width+o,u=Math.max(s,t.width),d=window.innerWidth-$,f=c(a,[$,Math.max($,d-u)]);l.style.minWidth=s+`px`,l.style.right=f+`px`}let a=m(),s=window.innerHeight-$*2,u=_.scrollHeight,f=window.getComputedStyle(d),p=parseInt(f.borderTopWidth,10),g=parseInt(f.paddingTop,10),b=parseInt(f.borderBottomWidth,10),x=parseInt(f.paddingBottom,10),S=p+g+u+x+b,C=Math.min(v.offsetHeight*5,S),w=window.getComputedStyle(_),T=parseInt(w.paddingTop,10),E=parseInt(w.paddingBottom,10),D=e.top+e.height/2-$,O=s-D,k=v.offsetHeight/2,A=v.offsetTop+k,j=p+g+A,M=S-j;if(j<=D){let e=a.length>0&&v===a[a.length-1].ref.current;l.style.bottom=`0px`;let t=d.clientHeight-_.offsetTop-_.offsetHeight,n=j+Math.max(O,k+(e?E:0)+t+b);l.style.height=n+`px`}else{let e=a.length>0&&v===a[0].ref.current;l.style.top=`0px`;let t=Math.max(D,p+_.offsetTop+(e?T:0)+k)+M;l.style.height=t+`px`,_.scrollTop=j-D+_.offsetTop}l.style.margin=`${$}px 0`,l.style.minHeight=C+`px`,l.style.maxHeight=s+`px`,i?.(),requestAnimationFrame(()=>h.current=!0)}},[m,o.trigger,o.valueNode,l,d,_,v,y,o.dir,i]);I(()=>x(),[x]);let[S,C]=Y.useState();return I(()=>{d&&C(window.getComputedStyle(d).zIndex)},[d]),(0,X.jsx)(gi,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:Y.useCallback(e=>{e&&g.current===!0&&(x(),b?.(),g.current=!1)},[x,b]),children:(0,X.jsx)(`div`,{ref:u,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,X.jsx)(A.div,{...a,ref:p,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});pi.displayName=fi;var mi=`SelectPopperPosition`,hi=Y.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=$,...a}=e,o=Kr(n);return(0,X.jsx)(Fn,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});hi.displayName=mi;var[gi,_i]=Wr(ai,{}),vi=`SelectViewport`,yi=Y.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:i,...a}=e,o=ci(vi,n),s=_i(vi,n),c=r(t,o.onViewportChange),l=Y.useRef(0);return(0,X.jsxs)(X.Fragment,{children:[(0,X.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:i}),(0,X.jsx)(Vr.Slot,{scope:n,children:(0,X.jsx)(A.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:F(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-$*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})})})]})});yi.displayName=vi;var bi=`SelectGroup`,[xi,Si]=Wr(bi),Ci=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=P();return(0,X.jsx)(xi,{scope:n,id:i,children:(0,X.jsx)(A.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Ci.displayName=bi;var wi=`SelectLabel`,Ti=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Si(wi,n);return(0,X.jsx)(A.div,{id:i.id,...r,ref:t})});Ti.displayName=wi;var Ei=`SelectItem`,[Di,Oi]=Wr(Ei),ki=Y.forwardRef((e,t)=>{let{__scopeSelect:n,value:i,disabled:a=!1,textValue:o,...s}=e,c=Q(Ei,n),l=ci(Ei,n),u=c.value===i,[d,f]=Y.useState(o??``),[p,m]=Y.useState(!1),h=r(t,e=>l.itemRefCallback?.(e,i,a)),g=P(),_=Y.useRef(`touch`),v=()=>{a||(c.onValueChange(i),c.onOpenChange(!1))};if(i===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,X.jsx)(Di,{scope:n,value:i,disabled:a,textId:g,isSelected:u,onItemTextChange:Y.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,X.jsx)(Vr.ItemSlot,{scope:n,value:i,disabled:a,textValue:d,children:(0,X.jsx)(A.div,{role:`option`,"aria-labelledby":g,"data-highlighted":p?``:void 0,"aria-selected":u&&p,"data-state":u?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:h,onFocus:F(s.onFocus,()=>m(!0)),onBlur:F(s.onBlur,()=>m(!1)),onClick:F(s.onClick,()=>{_.current!==`mouse`&&v()}),onPointerUp:F(s.onPointerUp,()=>{_.current===`mouse`&&v()}),onPointerDown:F(s.onPointerDown,e=>{_.current=e.pointerType}),onPointerMove:F(s.onPointerMove,e=>{_.current=e.pointerType,a?l.onItemLeave?.():_.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:F(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:F(s.onKeyDown,e=>{l.searchRef?.current!==``&&e.key===` `||(zr.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})});ki.displayName=Ei;var Ai=`SelectItemText`,ji=Y.forwardRef((e,t)=>{let{__scopeSelect:n,className:i,style:a,...o}=e,s=Q(Ai,n),c=ci(Ai,n),l=Oi(Ai,n),u=Yr(Ai,n),[d,f]=Y.useState(null),p=r(t,e=>f(e),l.onItemTextChange,e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),m=d?.textContent,h=Y.useMemo(()=>(0,X.jsx)(`option`,{value:l.value,disabled:l.disabled,children:m},l.value),[l.disabled,l.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=u;return I(()=>(g(h),()=>_(h)),[g,_,h]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A.span,{id:l.textId,...o,ref:p}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Yt.createPortal(o.children,s.valueNode):null]})});ji.displayName=Ai;var Mi=`SelectItemIndicator`,Ni=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Oi(Mi,n).isSelected?(0,X.jsx)(A.span,{"aria-hidden":!0,...r,ref:t}):null});Ni.displayName=Mi;var Pi=`SelectScrollUpButton`,Fi=Y.forwardRef((e,t)=>{let n=ci(Pi,e.__scopeSelect),i=_i(Pi,e.__scopeSelect),[a,o]=Y.useState(!1),s=r(t,i.onScrollButtonChange);return I(()=>{if(n.viewport&&n.isPositioned){let e=function(){o(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,X.jsx)(Ri,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Fi.displayName=Pi;var Ii=`SelectScrollDownButton`,Li=Y.forwardRef((e,t)=>{let n=ci(Ii,e.__scopeSelect),i=_i(Ii,e.__scopeSelect),[a,o]=Y.useState(!1),s=r(t,i.onScrollButtonChange);return I(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;o(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,X.jsx)(Ri,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Li.displayName=Ii;var Ri=Y.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=ci(`SelectScrollButton`,n),o=Y.useRef(null),s=Hr(n),c=Y.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return Y.useEffect(()=>()=>c(),[c]),I(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,X.jsx)(A.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:F(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:F(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:F(i.onPointerLeave,()=>{c()})})}),zi=`SelectSeparator`,Bi=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,X.jsx)(A.div,{"aria-hidden":!0,...r,ref:t})});Bi.displayName=zi;var Vi=`SelectArrow`,Hi=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Kr(n),a=Q(Vi,n),o=ci(Vi,n);return a.open&&o.position===`popper`?(0,X.jsx)(In,{...i,...r,ref:t}):null});Hi.displayName=Vi;var Ui=`SelectBubbleInput`,Wi=Y.forwardRef(({__scopeSelect:e,value:t,...n},i)=>{let a=Y.useRef(null),o=r(i,a),s=kr(t);return Y.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,X.jsx)(A.select,{...n,style:{...Ln,...n.style},ref:o,defaultValue:t})});Wi.displayName=Ui;function Gi(e){return e===``||e===void 0}function Ki(e){let t=b(e),n=Y.useRef(``),r=Y.useRef(0),i=Y.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=Y.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return Y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function qi(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Ji(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Ji(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Yi=Xr,Xi=Qr,Zi=ei,Qi=ni,$i=ii,ea=oi,ta=yi,na=Ti,ra=ki,ia=ji,aa=Ni,oa=Fi,sa=Li,ca=Bi,la=Yi,ua=Zi,da=Y.forwardRef((e,t)=>{let n=(0,Z.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let s;n[4]===i?s=n[5]:(s=o(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,i),n[4]=i,n[5]=s);let c;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(Qi,{asChild:!0,children:(0,X.jsx)(l,{className:`h-4 w-4 opacity-50`})}),n[6]=c):c=n[6];let u;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==s?(u=(0,X.jsxs)(Xi,{ref:t,className:s,...a,children:[r,c]}),n[7]=r,n[8]=a,n[9]=t,n[10]=s,n[11]=u):u=n[11],u});da.displayName=Xi.displayName;var fa=Y.forwardRef((e,t)=>{let n=(0,Z.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(`flex cursor-default items-center justify-center py-1`,r),n[3]=r,n[4]=a);let s;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(f,{className:`h-4 w-4`}),n[5]=s):s=n[5];let c;return n[6]!==i||n[7]!==t||n[8]!==a?(c=(0,X.jsx)(oa,{ref:t,className:a,...i,children:s}),n[6]=i,n[7]=t,n[8]=a,n[9]=c):c=n[9],c});fa.displayName=oa.displayName;var pa=Y.forwardRef((e,t)=>{let n=(0,Z.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(`flex cursor-default items-center justify-center py-1`,r),n[3]=r,n[4]=a);let s;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(l,{className:`h-4 w-4`}),n[5]=s):s=n[5];let c;return n[6]!==i||n[7]!==t||n[8]!==a?(c=(0,X.jsx)(sa,{ref:t,className:a,...i,children:s}),n[6]=i,n[7]=t,n[8]=a,n[9]=c):c=n[9],c});pa.displayName=sa.displayName;var ma=Y.forwardRef((e,t)=>{let n=(0,Z.c)(21),r,i,a,s;n[0]===e?(r=n[1],i=n[2],a=n[3],s=n[4]):({className:i,children:r,position:s,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=s);let c=s===void 0?`popper`:s,l=c===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,u;n[5]!==i||n[6]!==l?(u=o(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,l,i),n[5]=i,n[6]=l,n[7]=u):u=n[7];let d;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsx)(fa,{}),n[8]=d):d=n[8];let f=c===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`,p;n[9]===f?p=n[10]:(p=o(`p-1`,f),n[9]=f,n[10]=p);let m;n[11]!==r||n[12]!==p?(m=(0,X.jsx)(ta,{className:p,children:r}),n[11]=r,n[12]=p,n[13]=m):m=n[13];let h;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(pa,{}),n[14]=h):h=n[14];let g;return n[15]!==c||n[16]!==a||n[17]!==t||n[18]!==u||n[19]!==m?(g=(0,X.jsx)($i,{children:(0,X.jsxs)(ea,{ref:t,className:u,position:c,...a,children:[d,m,h]})}),n[15]=c,n[16]=a,n[17]=t,n[18]=u,n[19]=m,n[20]=g):g=n[20],g});ma.displayName=ea.displayName;var ha=Y.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(`py-1.5 pl-8 pr-2 text-sm font-semibold`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,X.jsx)(na,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});ha.displayName=na.displayName;var ga=Y.forwardRef((e,n)=>{let r=(0,Z.c)(14),i,a,s;r[0]===e?(i=r[1],a=r[2],s=r[3]):({className:a,children:i,...s}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=s);let c;r[4]===a?c=r[5]:(c=o(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,a),r[4]=a,r[5]=c);let l;r[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,X.jsx)(aa,{children:(0,X.jsx)(t,{className:`h-4 w-4`})})}),r[6]=l):l=r[6];let u;r[7]===i?u=r[8]:(u=(0,X.jsx)(ia,{children:i}),r[7]=i,r[8]=u);let d;return r[9]!==s||r[10]!==n||r[11]!==c||r[12]!==u?(d=(0,X.jsxs)(ra,{ref:n,className:c,...s,children:[l,u]}),r[9]=s,r[10]=n,r[11]=c,r[12]=u,r[13]=d):d=r[13],d});ga.displayName=ra.displayName;var _a=Y.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(`-mx-1 my-1 h-px bg-muted`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,X.jsx)(ca,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});_a.displayName=ca.displayName;var va=`__ALL_PROJECTS__`;function ya(e){let t=(0,Z.c)(8),{text:n,maxLength:r}=e,i=r===void 0?100:r;if(n.length<=i){let e;return t[0]===n?e=t[1]:(e=(0,X.jsx)(X.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,X.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,X.jsxs)(X.Fragment,{children:[a,o]}),t[6]=a,t[7]=s),s}function ba(e,t){let n=`${t} - `,r=e.title??e.threadId;return r.startsWith(n)?r.slice(n.length):r}async function xa(e){let t=[],n=new Set,r=``;for(let i of e)try{let e=await O(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 Sa({isOpen:e,onClose:t,initialFilter:r,projects:o,inline:c}){let[l,f]=(0,Y.useState)(null),[m,g]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(0),[x,S]=(0,Y.useState)(``),[w,T]=(0,Y.useState)(``),E=(0,Y.useCallback)(async e=>{g(!0),v(null);try{f(await O(e))}catch(e){v(e instanceof Error?e.message:`Failed to load conversation history`)}finally{g(!1)}},[]),k=(0,Y.useCallback)(async e=>{if(e){g(!0),v(null);try{let t=o.find(t=>t.projectId===e);if(!t||t.threads.length===0){f({threadId:e,messages:[],lastUpdated:new Date().toISOString(),conversationIds:[]});return}f({threadId:e,...await xa(t.threads)})}catch(e){v(e instanceof Error?e.message:`Failed to load project history`)}finally{g(!1)}}},[o]),A=(0,Y.useCallback)(async()=>{g(!0),v(null);try{f({threadId:va,...await xa(o.flatMap(e=>e.threads))})}catch(e){v(e instanceof Error?e.message:`Failed to load all projects history`)}finally{g(!1)}},[o]);(0,Y.useEffect)(()=>{e&&r?r.type===`thread`?(T(r.id),S(``),b(0),E(r.id)):r.type===`project`&&(S(r.id),T(``),b(0),k(r.id)):e||(f(null),T(``),S(``),b(0),v(null))},[e,r,E,k]);let M=e=>{T(e),S(``),b(0),E(e)},N=e=>{S(e),T(``),b(0),e===va?A():k(e)},ee=e=>new Date(e).toLocaleString(),te=(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}},ne=e=>({inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0});return e?(0,X.jsx)(`div`,{className:c?`h-full bg-background`:`fixed inset-0 z-50 bg-background`,children:(0,X.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!c&&(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-b p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Conversation History`}),r?.type===`thread`&&(0,X.jsxs)(la,{value:w,onValueChange:M,children:[(0,X.jsx)(da,{className:`w-48`,children:(0,X.jsx)(ua,{placeholder:`Select thread`})}),(0,X.jsx)(ma,{children:o.flatMap(e=>e.threads.map(t=>(0,X.jsx)(ga,{value:t.threadId,children:ba(t,e.name??e.projectId)},t.threadId)))})]}),(0,X.jsxs)(la,{value:x,onValueChange:N,children:[(0,X.jsx)(da,{className:`w-48`,children:(0,X.jsx)(ua,{placeholder:`Select project`})}),(0,X.jsxs)(ma,{children:[(0,X.jsx)(ga,{value:va,children:`All Projects`}),o.map(e=>(0,X.jsx)(ga,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]})]}),(0,X.jsx)(s,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,X.jsx)(a,{})})]}),l?.messages&&l.messages.length>0&&(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-b p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(s,{variant:`outline`,size:`sm`,onClick:()=>{y>0&&b(y-1)},disabled:y===0,children:(0,X.jsx)(p,{className:`h-4 w-4 mr-1`})}),(0,X.jsx)(s,{variant:`outline`,size:`sm`,onClick:()=>{l?.messages&&y<l.messages.length-1&&b(y+1)},disabled:!l||y>=l.messages.length-1,children:(0,X.jsx)(d,{className:`h-4 w-4 ml-1`})})]}),(0,X.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[y+1,` of `,l?.messages.length??0,` messages`]})]}),(0,X.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:m?(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,X.jsxs)(`div`,{className:`text-center`,children:[(0,X.jsx)(u,{className:`h-8 w-8 animate-spin mx-auto mb-2`}),(0,X.jsx)(`p`,{children:`Loading conversation history...`})]})}):_?(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,X.jsxs)(D,{className:`max-w-md`,children:[(0,X.jsx)(C,{children:(0,X.jsx)(h,{className:`text-destructive`,children:`Error`})}),(0,X.jsxs)(j,{children:[(0,X.jsx)(`p`,{children:_}),(0,X.jsx)(s,{onClick:t,className:`mt-4`,children:`Close`})]})]})}):l?.messages?.length&&l.messages.length>0?(0,X.jsx)(i,{className:`h-full`,children:(0,X.jsx)(`div`,{className:`p-4`,children:(0,X.jsxs)(Ar,{children:[(0,X.jsx)(jr,{children:(0,X.jsxs)(Pr,{children:[(0,X.jsx)(Fr,{children:`Prompt`}),(0,X.jsx)(Fr,{children:`Answer`}),(0,X.jsx)(Fr,{className:`w-24`,children:`Model`}),(0,X.jsx)(Fr,{className:`w-24 text-right`,children:`Duration`}),(0,X.jsx)(Fr,{className:`w-20 text-right`,children:`Input Tokens`}),(0,X.jsx)(Fr,{className:`w-20 text-right`,children:`Output Tokens`}),(0,X.jsx)(Fr,{className:`w-32 text-right`,children:`Timestamp`})]})}),(0,X.jsx)(Mr,{children:l.messages.map((e,t)=>{let{inputTokens:r,outputTokens:i}=ne(e);return(0,X.jsxs)(Pr,{className:t===y?`bg-muted/50`:``,children:[(0,X.jsx)(Ir,{className:`max-w-md`,children:(0,X.jsx)(`div`,{className:`text-sm`,children:(0,X.jsx)(ya,{text:e.request.message})})}),(0,X.jsx)(Ir,{className:`max-w-md`,children:e.response?(0,X.jsx)(`div`,{className:`text-sm`,children:(0,X.jsx)(ya,{text:e.response.content})}):(0,X.jsx)(`span`,{className:`text-muted-foreground italic`,children:`No response`})}),(0,X.jsx)(Ir,{className:`text-sm`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(n,{className:`h-3 w-3 text-muted-foreground`}),(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,X.jsx)(Ir,{className:`text-sm text-right`,children:e.response?(0,X.jsx)(Tr,{children:(0,X.jsxs)(Er,{children:[(0,X.jsx)(Dr,{asChild:!0,children:(0,X.jsx)(`div`,{className:`cursor-help`,children:te(e.timestamp,e.response.completedAt).display})}),(0,X.jsx)(Or,{children:(0,X.jsx)(`p`,{children:te(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,X.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,X.jsx)(Ir,{className:`text-sm text-muted-foreground text-right`,children:r>0?r.toLocaleString():`-`}),(0,X.jsx)(Ir,{className:`text-sm text-muted-foreground text-right`,children:i>0?i.toLocaleString():`-`}),(0,X.jsx)(Ir,{className:`text-sm text-muted-foreground text-right`,children:ee(e.timestamp)})]},e.id)})})]})})}):(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,X.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold`,children:`No History`}),(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`No conversation history found for this thread.`})]})})})]})}):null}export{mn as _,da as a,Or as c,zn as d,Pn as f,_n as g,Nn as h,ga as i,Tr as l,Fn as m,la as n,kr as o,In as p,ma as r,Er as s,Sa as t,Dr as u};
|