tarsk 0.4.9 → 0.4.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/index.js +2829 -612
  2. package/dist/public/assets/account-view-BvHnxfR-.js +1 -0
  3. package/dist/public/assets/api-BfUK32d1.js +1 -0
  4. package/dist/public/assets/browser-tab-DYDpQIZc.js +1 -0
  5. package/dist/public/assets/context-menu-CoedP3Pg.js +1 -0
  6. package/dist/public/assets/conversation-history-view-CH3HrZK9.js +1 -0
  7. package/dist/public/assets/{dialogs-config-CdogKQE6.js → dialogs-config-Ofxg1Bn0.js} +13 -13
  8. package/dist/public/assets/diff-view-BAPFEZbh.js +3 -0
  9. package/dist/public/assets/explorer-tab-view-Dxet8lje.js +2 -0
  10. package/dist/public/assets/explorer-tree-DYE9rGNc.js +1 -0
  11. package/dist/public/assets/explorer-view-DgNDIV-D.js +1 -0
  12. package/dist/public/assets/history-view-BIN8vsvx.js +1 -0
  13. package/dist/public/assets/index-BOioHxIi.js +30 -0
  14. package/dist/public/assets/index-BVLzVjoR.css +1 -0
  15. package/dist/public/assets/onboarding-QnvOtCAY.js +1 -0
  16. package/dist/public/assets/onboarding-dialog-80pqyrMv.js +1 -0
  17. package/dist/public/assets/project-settings-view-Bi5zT3_9.js +1 -0
  18. package/dist/public/assets/provider-details-view-3tvO3r6m.js +1 -0
  19. package/dist/public/assets/providers-sidebar-CFwpsg_Y.js +1 -0
  20. package/dist/public/assets/react-vendor-Bi5X_3XM.js +17 -0
  21. package/dist/public/assets/settings-view-DWnpQjWE.js +2 -0
  22. package/dist/public/assets/store-BuY90jLM.js +2 -0
  23. package/dist/public/assets/terminal-panel-CLpupIW9.js +2 -0
  24. package/dist/public/assets/textarea-CxhrnOOz.js +1 -0
  25. package/dist/public/assets/todos-view-D2xLDhsC.js +1 -0
  26. package/dist/public/assets/{utils-B7eoN2Bj.js → utils-7CkwsQJ0.js} +1 -1
  27. package/dist/public/index.html +10 -10
  28. package/package.json +1 -1
  29. package/dist/public/assets/account-view-D2dv34vY.js +0 -1
  30. package/dist/public/assets/add-agent-view-DM__lVyy.js +0 -1
  31. package/dist/public/assets/add-rule-view-BomwxNHB.js +0 -7
  32. package/dist/public/assets/add-skill-view-JiUioTS0.js +0 -1
  33. package/dist/public/assets/add-slash-command-view--JU5d22L.js +0 -1
  34. package/dist/public/assets/conversation-history-view-C2i3vP6t.js +0 -1
  35. package/dist/public/assets/diff-view-BOokQeYx.js +0 -3
  36. package/dist/public/assets/file-tree-sidebar-BXedO8ZD.js +0 -1
  37. package/dist/public/assets/files-view-BK-J3s66.js +0 -1
  38. package/dist/public/assets/history-view-DtTMEZIl.js +0 -1
  39. package/dist/public/assets/index-BR4u03pf.js +0 -17
  40. package/dist/public/assets/index-LCD_R39p.css +0 -1
  41. package/dist/public/assets/mcp-manager-BNA3V6Cy.js +0 -1
  42. package/dist/public/assets/mcp-server-edit-view-B_xPUXV1.js +0 -5
  43. package/dist/public/assets/mcp-servers-sidebar-Cv-D6sy7.js +0 -1
  44. package/dist/public/assets/mcp-view-TSM0sRuR.js +0 -1
  45. package/dist/public/assets/onboarding-dialog-C3veuByQ.js +0 -1
  46. package/dist/public/assets/onboarding-gO0dp5Em.js +0 -1
  47. package/dist/public/assets/project-settings-view-CwvIMmXu.js +0 -1
  48. package/dist/public/assets/provider-details-view-Dcm9ZdOm.js +0 -1
  49. package/dist/public/assets/providers-sidebar-B5hxgXyK.js +0 -1
  50. package/dist/public/assets/radio-group-BQ7i054U.js +0 -1
  51. package/dist/public/assets/react-vendor-BNQTbRKd.js +0 -17
  52. package/dist/public/assets/settings-view-Di5K8IgA.js +0 -2
  53. package/dist/public/assets/store-CB5vVIg-.js +0 -2
  54. package/dist/public/assets/use-toast-DCmq-wgl.js +0 -1
  55. /package/dist/public/assets/{monaco-DKN4dKR5.js → monaco-CgzMkQ7t.js} +0 -0
@@ -0,0 +1,3 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Bn as t,En as n,Fn as r,Gi as i,Gr as a,In as o,K as s,Q as c,Rn as l,Si as u,Tt as d,Vn as f,Wi as p,Xr as m,Zr as h,_n as g,br as _,it as v,jn as y,li as b,oi as x,ra as S,ri as C,si as w,ta as T,wi as E,xi as D,zn as O,zt as k}from"./dialogs-config-Ofxg1Bn0.js";import{_ as ee}from"./react-vendor-Bi5X_3XM.js";import{a as A,t as j}from"./store-BuY90jLM.js";import{t as M}from"./textarea-CxhrnOOz.js";import{c as N,s as P,u as te}from"./history-view-BIN8vsvx.js";import{n as ne}from"./utils-7CkwsQJ0.js";import"./onboarding-QnvOtCAY.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-BOioHxIi.js";import"./monaco-CgzMkQ7t.js";import{a as L,n as R,r as ce,t as z}from"./context-menu-CoedP3Pg.js";var B=e(S(),1),V=T(),H=_();function U(e){let t=(0,V.c)(17),{children:r,title:i,headerAction:a,footer:o}=e,s;t[0]===i?s=t[1]:(s=i&&(0,H.jsx)(`span`,{className:`text-sm font-semibold tracking-tight`,children:i}),t[0]=i,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]===r?d=t[10]:(d=(0,H.jsx)(n,{className:`flex-1`,children:r}),t[9]=r,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 f(`status-badge font-mono text-xs font-semibold`,W[e]??`text-orange-500`)}function ue(e){return G[e]??`M`}function de(e){let t=(0,V.c)(37),{treeData:n,files:r,isLoading:i,error:o,selectedFileIndex:s,onFileSelect:c,onRevertFile:l}=e,d;t[0]===r?d=t[1]:(d=r.reduce(pe,0),t[0]=r,t[1]=d);let m=d,h;t[2]===r?h=t[3]:(h=r.reduce(q,0),t[2]=r,t[3]=h);let g=h,_=r.length===1?``:`s`,v;t[4]!==r.length||t[5]!==_?(v=(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[r.length,` file`,_]}),t[4]=r.length,t[5]=_,t[6]=v):v=t[6];let y;t[7]===m?y=t[8]:(y=(0,H.jsxs)(`span`,{className:`text-xs text-green-500`,children:[`+`,m]}),t[7]=m,t[8]=y);let x;t[9]===g?x=t[10]:(x=(0,H.jsxs)(`span`,{className:`text-xs text-red-500`,children:[`-`,g]}),t[9]=g,t[10]=x);let S;t[11]!==v||t[12]!==y||t[13]!==x?(S=(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[v,y,x]}),t[11]=v,t[12]=y,t[13]=x,t[14]=S):S=t[14];let C=S;if(i){let e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center pt-3 pb-2`,children:(0,H.jsx)(b,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),t[15]=e):e=t[15];let n;return t[16]===C?n=t[17]:(n=(0,H.jsx)(U,{title:`Review Changes`,headerAction:C,children:e}),t[16]=C,t[17]=n),n}if(o){let e;t[18]===o?e=t[19]:(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:`text-destructive text-xs text-center`,children:o})}),t[18]=o,t[19]=e);let n;return t[20]!==C||t[21]!==e?(n=(0,H.jsx)(U,{title:`Review Changes`,headerAction:C,children:e}),t[20]=C,t[21]=e,t[22]=n):n=t[22],n}if(r.length===0){let e;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs text-center`,children:`No changes to review`})}),t[23]=e):e=t[23];let n;return t[24]===C?n=t[25]:(n=(0,H.jsx)(U,{title:`Review Changes`,headerAction:C,children:e}),t[24]=C,t[25]=n),n}let w;t[26]!==r||t[27]!==c||t[28]!==l||t[29]!==s?(w=(e,t)=>{let{isOpen:n,toggle:i}=t,o=!!e.children,d=(0,H.jsxs)(I,{onClick:()=>{o?i():e.fileIndex!==void 0&&c(e.fileIndex)},selected:!o&&e.fileIndex===s,className:`gap-1.5`,children:[o?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(p,{className:f(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,n&&`rotate-90`)}),n?(0,H.jsx)(u,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,H.jsx)(D,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,H.jsx)(E,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!o&&e.status&&(0,H.jsx)(`span`,{className:K(e.status),children:ue(e.status)})]});return o?d:(0,H.jsxs)(z,{children:[(0,H.jsx)(L,{asChild:!0,children:d}),(0,H.jsx)(R,{children:(0,H.jsxs)(ce,{onClick:()=>{e.fileIndex!==void 0&&l?.(r[e.fileIndex])},children:[(0,H.jsx)(a,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[26]=r,t[27]=c,t[28]=l,t[29]=s,t[30]=w):w=t[30];let T;t[31]!==w||t[32]!==n?(T=(0,H.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3 pb-2 px-1`,children:(0,H.jsx)(F,{nodes:n,defaultOpen:!0,resetKey:n,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:w})}),t[31]=w,t[32]=n,t[33]=T):T=t[33];let O;return t[34]!==C||t[35]!==T?(O=(0,H.jsx)(U,{title:`Review Changes`,headerAction:C,children:T}),t[34]=C,t[35]=T,t[36]=O):O=t[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 n=(0,V.c)(35),{open:i,lineNumber:a,lineContent:s,initialComment:c,isEditing:u,onSave:d,onDelete:f,onClose:p}=e,[m,h]=(0,B.useState)((c===void 0?``:c)??``),g;n[0]!==d||n[1]!==m?(g=()=>{m.trim()&&d(m.trim())},n[0]=d,n[1]=m,n[2]=g):g=n[2];let _=g,v;n[3]===_?v=n[4]:(v=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),_())},n[3]=_,n[4]=v);let b=v,x;n[5]===p?x=n[6]:(x=e=>{e||p()},n[5]=p,n[6]=x);let S;n[7]===a?S=n[8]:(S=(0,H.jsx)(O,{children:(0,H.jsxs)(t,{className:`text-sm font-medium`,children:[`Comment on line `,a]})}),n[7]=a,n[8]=S);let C=s||` `,w;n[9]===C?w=n[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}),n[9]=C,n[10]=w);let T;n[11]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>h(e.target.value),n[11]=T):T=n[11];let E;n[12]!==b||n[13]!==m?(E=(0,H.jsx)(M,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:m,onChange:T,onKeyDown:b,rows:12,className:`resize-none text-sm`}),n[12]=b,n[13]=m,n[14]=E):E=n[14];let D;n[15]!==u||n[16]!==f?(D=u&&f&&(0,H.jsx)(y,{variant:`destructive`,size:`sm`,onClick:f,className:`mr-auto`,children:`Delete`}),n[15]=u,n[16]=f,n[17]=D):D=n[17];let k;n[18]===m?k=n[19]:(k=m.trim(),n[18]=m,n[19]=k);let ee=!k,A;n[20]!==_||n[21]!==ee?(A=(0,H.jsx)(y,{size:`sm`,onClick:_,disabled:ee,children:`Save`}),n[20]=_,n[21]=ee,n[22]=A):A=n[22];let j;n[23]!==D||n[24]!==A?(j=(0,H.jsxs)(l,{className:`gap-2 sm:gap-0`,children:[D,A]}),n[23]=D,n[24]=A,n[25]=j):j=n[25];let N;n[26]!==j||n[27]!==S||n[28]!==w||n[29]!==E?(N=(0,H.jsxs)(o,{className:`max-w-2xl`,children:[S,w,E,j]}),n[26]=j,n[27]=S,n[28]=w,n[29]=E,n[30]=N):N=n[30];let P;return n[31]!==i||n[32]!==N||n[33]!==x?(P=(0,H.jsx)(r,{open:i,onOpenChange:x,children:N}),n[31]=i,n[32]=N,n[33]=x,n[34]=P):P=n[34],P}function X({threadId:e,onExit:t}){let{state:n,dispatch:r}=A(),{resolvedTheme:a}=ne(),[o,l]=(0,B.useState)([]),[u,_]=(0,B.useState)(!0),[b,S]=(0,B.useState)(null),[T,E]=(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:T,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:T,files:o}},[D,T,o]);let pe=(0,B.useCallback)(()=>{F.current&&(M?F.current.expand():F.current.collapse())},[M]),Y=(0,B.useCallback)(async()=>{if(e){_(!0),S(null);try{l((await v(e)).files||[]),E(0)}catch(e){S(e instanceof Error?e.message:`Failed to load diff`)}finally{_(!1)}}},[e]);(0,B.useEffect)(()=>{Y()},[Y]);let me=(0,B.useCallback)(async t=>{try{await k(e,t.path),await Y()}catch(e){S(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}d(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&&g(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[T],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,T,D,Q]),(0,B.useEffect)(()=>()=>{G.current=null,J.current={original:[],modified:[]}},[T]),(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:T,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,T,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),E(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 c(),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:a===`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:f(`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:f(`flex items-center gap-2`,M&&`ml-0`,!M&&`ml-auto`,`md:ml-auto`),children:[(0,H.jsx)(y,{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)(C,{className:`h-3 w-3`}),` Show changes only`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(w,{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)(y,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:De,disabled:(R??0)===0,children:(0,H.jsx)(i,{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)(y,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Oe,disabled:(R??0)===I.length-1,children:(0,H.jsx)(p,{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)(y,{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)(x,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,H.jsx)(N,{children:`Send all comments to Tarsk for resolution`})]}),(0,H.jsxs)(y,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:pe,children:[M?(0,H.jsx)(m,{className:`h-4 w-4`}):(0,H.jsx)(h,{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-${T}`),(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:b,selectedFileIndex:T,onFileSelect:E,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};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-DYE9rGNc.js","assets/rolldown-runtime-Dw2cE7zH.js","assets/index-BOioHxIi.js","assets/react-vendor-Bi5X_3XM.js","assets/history-view-BIN8vsvx.js","assets/dialogs-config-Ofxg1Bn0.js","assets/monaco-CgzMkQ7t.js","assets/onboarding-QnvOtCAY.js","assets/textarea-CxhrnOOz.js","assets/store-BuY90jLM.js","assets/utils-7CkwsQJ0.js","assets/index-BVLzVjoR.css","assets/api-BfUK32d1.js","assets/context-menu-CoedP3Pg.js","assets/explorer-view-DgNDIV-D.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{En as t,br as n,ra as r,ta as i}from"./dialogs-config-Ofxg1Bn0.js";import{_t as a}from"./react-vendor-Bi5X_3XM.js";import{a as o}from"./store-BuY90jLM.js";import{c as s,n as c,r as l,t as u}from"./index-BOioHxIi.js";var d=i(),f=e(r(),1),p=n(),m=(0,f.lazy)(()=>a(()=>import(`./explorer-tree-DYE9rGNc.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-DgNDIV-D.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{Ki as t,Si as n,Wi as r,br as i,li as a,ra as o,ta as s,wi as c,xi as l}from"./dialogs-config-Ofxg1Bn0.js";import"./react-vendor-Bi5X_3XM.js";import"./history-view-BIN8vsvx.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-BOioHxIi.js";import{a as y,i as ee,n as b,r as x,t as S}from"./context-menu-CoedP3Pg.js";import{n as C,o as w,r as T,s as E,t as D}from"./api-BfUK32d1.js";var O=s(),k=e(o(),1),A=i();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 i=(0,O.c)(101),{node:o,level:s,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;i[0]!==d||i[1]!==o.path?(F=d.has(o.path),i[0]=d,i[1]=o.path,i[2]=F):F=i[2];let I=F,L;i[3]!==p||i[4]!==o.path?(L=p.has(o.path),i[3]=p,i[4]=o.path,i[5]=L):L=i[5];let R=L,z,B;if(i[6]!==d||i[7]!==I||i[8]!==R||i[9]!==s||i[10]!==f||i[11]!==p||i[12]!==h||i[13]!==o||i[14]!==P||i[15]!==T||i[16]!==j||i[17]!==w||i[18]!==E||i[19]!==D||i[20]!==k||i[21]!==_||i[22]!==C||i[23]!==g||i[24]!==m||i[25]!==u){B=Symbol.for(`react.early_return_sentinel`);bb0:{let e=f.get(o.path)??[];z=m===o.path;let O=h?.dirPath===o.path&&I;if(o.type===`folder`){let M=o.ignored?`opacity-50`:void 0,F;i[28]!==o||i[29]!==g?(F=e=>{e.stopPropagation(),g(o)},i[28]=o,i[29]=g,i[30]=F):F=i[30];let L;i[31]!==I||i[32]!==R?(L=(0,A.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:R?(0,A.jsx)(a,{className:`h-3 w-3 animate-spin`}):I?(0,A.jsx)(t,{className:`h-3 w-3`}):(0,A.jsx)(r,{className:`h-3 w-3`})}),i[31]=I,i[32]=R,i[33]=L):L=i[33];let V;i[34]!==I||i[35]!==z||i[36]!==o||i[37]!==T||i[38]!==w?(V=z?(0,A.jsxs)(A.Fragment,{children:[I?(0,A.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}),(0,A.jsx)(`input`,{autoFocus:!0,defaultValue:o.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?w(o,t):T()}else e.key===`Escape`&&T()},onBlur:e=>{let t=e.target.value.trim();t?w(o,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)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}),(0,A.jsx)(`span`,{className:`flex-1 truncate`,children:o.name})]}),i[34]=I,i[35]=z,i[36]=o,i[37]=T,i[38]=w,i[39]=V):V=i[39];let H;i[40]!==s||i[41]!==M||i[42]!==F||i[43]!==L||i[44]!==V?(H=(0,A.jsxs)(v,{level:s,basePadding:10,className:M,onClick:F,children:[L,V]}),i[40]=s,i[41]=M,i[42]=F,i[43]=L,i[44]=V,i[45]=H):H=i[45];let U=I&&(0,A.jsx)(`div`,{children:R&&!f.has(o.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:s+1,basePadding:h.type===`folder`?10:22,icon:h.type===`folder`?(0,A.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(c,{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:s+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;i[46]!==H||i[47]!==U?(W=(0,A.jsxs)(`div`,{children:[H,U]}),i[46]=H,i[47]=U,i[48]=W):W=i[48];let G=W,K;i[49]===G?K=i[50]:(K=(0,A.jsx)(y,{asChild:!0,children:G}),i[49]=G,i[50]=K);let q;i[51]!==o.path||i[52]!==D?(q=(0,A.jsx)(x,{onSelect:()=>D(o.path),children:`New File...`}),i[51]=o.path,i[52]=D,i[53]=q):q=i[53];let J;i[54]!==o.path||i[55]!==k?(J=(0,A.jsx)(x,{onSelect:()=>k(o.path),children:`New Folder...`}),i[54]=o.path,i[55]=k,i[56]=J):J=i[56];let Y;i[57]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,A.jsx)(ee,{}),i[57]=Y):Y=i[57];let X;i[58]!==o||i[59]!==C?(X=(0,A.jsx)(x,{onSelect:()=>C(o),children:`Rename...`}),i[58]=o,i[59]=C,i[60]=X):X=i[60];let Z;i[61]!==o||i[62]!==E?(Z=(0,A.jsx)(x,{onSelect:()=>E(o),className:`text-destructive focus:text-destructive`,children:`Delete`}),i[61]=o,i[62]=E,i[63]=Z):Z=i[63];let Q;i[64]!==q||i[65]!==J||i[66]!==X||i[67]!==Z?(Q=(0,A.jsxs)(b,{children:[q,J,Y,X,Z]}),i[64]=q,i[65]=J,i[66]=X,i[67]=Z,i[68]=Q):Q=i[68];let $;i[69]!==K||i[70]!==Q?($=(0,A.jsxs)(S,{children:[K,Q]}),i[69]=K,i[70]=Q,i[71]=$):$=i[71],B=$;break bb0}}i[6]=d,i[7]=I,i[8]=R,i[9]=s,i[10]=f,i[11]=p,i[12]=h,i[13]=o,i[14]=P,i[15]=T,i[16]=j,i[17]=w,i[18]=E,i[19]=D,i[20]=k,i[21]=_,i[22]=C,i[23]=g,i[24]=m,i[25]=u,i[26]=z,i[27]=B}else z=i[26],B=i[27];if(B!==Symbol.for(`react.early_return_sentinel`))return B;let V=u===o.path,H=o.ignored?`opacity-50`:void 0,U;i[72]!==o||i[73]!==_?(U=()=>_(o),i[72]=o,i[73]=_,i[74]=U):U=i[74];let W;i[75]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,A.jsx)(c,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),i[75]=W):W=i[75];let G;i[76]!==z||i[77]!==o||i[78]!==T||i[79]!==w?(G=z?(0,A.jsx)(`input`,{autoFocus:!0,defaultValue:o.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?w(o,t):T()}else e.key===`Escape`&&T()},onBlur:e=>{let t=e.target.value.trim();t?w(o,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:o.name}),i[76]=z,i[77]=o,i[78]=T,i[79]=w,i[80]=G):G=i[80];let K;i[81]!==s||i[82]!==V||i[83]!==H||i[84]!==U||i[85]!==G?(K=(0,A.jsxs)(v,{level:s,basePadding:22,selected:V,className:H,onClick:U,children:[W,G]}),i[81]=s,i[82]=V,i[83]=H,i[84]=U,i[85]=G,i[86]=K):K=i[86];let q=K,J;i[87]===q?J=i[88]:(J=(0,A.jsx)(y,{asChild:!0,children:q}),i[87]=q,i[88]=J);let Y;i[89]!==o||i[90]!==C?(Y=(0,A.jsx)(x,{onSelect:()=>C(o),children:`Rename...`}),i[89]=o,i[90]=C,i[91]=Y):Y=i[91];let X;i[92]!==o||i[93]!==E?(X=(0,A.jsx)(x,{onSelect:()=>E(o),className:`text-destructive focus:text-destructive`,children:`Delete`}),i[92]=o,i[93]=E,i[94]=X):X=i[94];let Z;i[95]!==Y||i[96]!==X?(Z=(0,A.jsxs)(b,{children:[Y,X]}),i[95]=Y,i[96]=X,i[97]=Z):Z=i[97];let Q;return i[98]!==J||i[99]!==Z?(Q=(0,A.jsxs)(S,{children:[J,Z]}),i[98]=J,i[99]=Z,i[100]=Q):Q=i[100],Q}function M(e){return e.stopPropagation()}function N(e){return e.stopPropagation()}function P({threadId:e,selectedPath:t,onFileSelect:n}){let[r,i]=(0,k.useState)(new Map),[a,o]=(0,k.useState)(new Set),[s,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||r.has(t))){v(e=>new Set(e).add(t));try{let n=await w(e,t);i(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);i(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&&(i(new Map),o(new Set),v(new Set),O(null),M(null),L(``))},[e]),(0,k.useEffect)(()=>{if(F>0&&e){R(``);for(let e of a)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){o(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){a.has(e.path)?o(t=>{let n=new Set(t);return n.delete(e.path),n}):(o(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)),o(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),i(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{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`&&(o(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),i(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{d({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function G(e){O(null),a.has(e)||(o(t=>new Set(t).add(e)),L(e)),M({dirPath:e,type:`file`})}function K(e){O(null),a.has(e)||(o(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=r.get(``)??[],X=s.has(``),Z=j?.dirPath===``?(0,A.jsx)(te,{defaultValue:``,level:0,basePadding:j.type===`folder`?10:22,icon:j.type===`folder`?(0,A.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(c,{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:t,expandedPaths:a,loadedDirs:r,loadingPaths:s,renamingPath:ee,newItemIn:j,onToggleFolder:z,onSelectFile:n,onStartRename:U,onCommitRename:W,onCancelRename:()=>O(null),onDelete:V,onNewFile:G,onNewFolder:K,onCommitNewItem:q,onCancelNewItem:J},e.path))]})})}),(0,A.jsxs)(b,{children:[(0,A.jsx)(x,{onSelect:()=>G(``),children:`New File...`}),(0,A.jsx)(x,{onSelect:()=>K(``),children:`New Folder...`})]})]})]})}export{P as default};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Ti as t,br as n,jn as r,li as i,ra as a}from"./dialogs-config-Ofxg1Bn0.js";import{g as o}from"./react-vendor-Bi5X_3XM.js";import{a as s}from"./store-BuY90jLM.js";import{n as c}from"./utils-7CkwsQJ0.js";import{b as l,l as u}from"./index-BOioHxIi.js";import"./monaco-CgzMkQ7t.js";import{a as d,c as f,i as p}from"./api-BfUK32d1.js";var m=e(a(),1),h=n(),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:n}=s(),{resolvedTheme:a}=c(),g=n.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)(r,{size:`sm`,onClick:()=>void D(),disabled:T||!_||_===x,children:[T?(0,h.jsx)(i,{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)(i,{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)(t,{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)(t,{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{Cr as t,Dn as n,En as r,Er as i,Gi as a,Ki as o,On as s,Pi as c,Ri as l,Sr as u,Ui as d,Vn as f,Wi as p,_r as m,a as h,ar as g,br as _,dr as v,fr as y,gr as b,hr as x,i as S,ir as C,jn as w,lr as T,mr as E,n as D,na as O,nr as k,nt as A,or as j,qi as M,r as N,ra as P,rr as ee,sr as te,ta as F,u as ne,vr as I,yr as re}from"./dialogs-config-Ofxg1Bn0.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(P(),1),Yt=e(O(),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=_(),dn=`Arrow`,fn=Y.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,X.jsx)(y.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]=re(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:r,...i}=e,a=yn(xn,n),o=Y.useRef(null),s=u(t,o),c=Y.useRef(null);return Y.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,X.jsx)(y.div,{...i,ref:s})});Sn.displayName=xn;var Cn=`PopperContent`,[wn,Tn]=gn(Cn),En=Y.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:d=0,sticky:f=`partial`,hideWhenDetached:p=!1,updatePositionStrategy:m=`optimized`,onPlaced:h,...g}=e,_=yn(Cn,n),[b,x]=Y.useState(null),S=u(t,e=>x(e)),[C,w]=Y.useState(null),T=mn(C),E=T?.width??0,D=T?.height??0,O=r+(a===`center`?``:`-`+a),k=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},A=Array.isArray(l)?l:[l],j=A.length>0,M={padding:k,boundary:A.filter(An),altBoundary:j},{refs:N,floatingStyles:P,placement:ee,isPositioned:te,middlewareData:F}=tn({strategy:`fixed`,placement:O,whileElementsMounted:(...e)=>Bt(...e,{animationFrame:m===`always`}),elements:{reference:_.anchor},middleware:[rn({mainAxis:i+D,alignmentAxis:o}),c&&an({mainAxis:!0,crossAxis:!1,limiter:f===`partial`?on():void 0,...M}),c&&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`)}}),C&&un({element:C,padding:s}),jn({arrowWidth:E,arrowHeight:D}),p&&ln({strategy:`referenceHidden`,...M})]}),[ne,re]=Mn(ee),ie=v(h);I(()=>{te&&ie?.()},[te,ie]);let L=F.arrow?.x,R=F.arrow?.y,ae=F.arrow?.centerOffset!==0,[oe,z]=Y.useState();return I(()=>{b&&z(window.getComputedStyle(b).zIndex)},[b]),(0,X.jsx)(`div`,{ref:N.setFloating,"data-radix-popper-content-wrapper":``,style:{...P,transform:te?P.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,X.jsx)(wn,{scope:n,placedSide:ne,onArrowChange:w,arrowX:L,arrowY:R,shouldHideArrow:ae,children:(0,X.jsx)(y.div,{"data-side":ne,"data-align":re,...g,ref:S,style:{...g.style,animation:te?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)(y.span,{...e,ref:t,style:{...Ln,...e.style}}));zn.displayName=Rn;var Bn=zn,[Vn,Hn]=re(`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=m(),p=Y.useRef(0),h=o??c.disableHoverableContent,g=s??c.delayDuration,_=Y.useRef(!1),[v,y]=b({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Kn))):c.onClose(),a?.(e)},caller:Xn}),x=Y.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),S=Y.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_.current=!1,y(!0)},[y]),C=Y.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),w=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:x,trigger:u,onTriggerChange:d,onTriggerEnter:Y.useCallback(()=>{c.isOpenDelayedRef.current?w():S()},[c.isOpenDelayedRef,w,S]),onTriggerLeave:Y.useCallback(()=>{h?C():(window.clearTimeout(p.current),p.current=0)},[C,h]),onOpen:S,onClose:C,disableHoverableContent:h,children:n})})};$n.displayName=Xn;var er=`TooltipTrigger`,tr=Y.forwardRef((e,n)=>{let{__scopeTooltip:r,...i}=e,a=Qn(er,r),o=Jn(er,r),s=Un(r),c=u(n,Y.useRef(null),a.onTriggerChange),l=Y.useRef(!1),d=Y.useRef(!1),f=Y.useCallback(()=>l.current=!1,[]);return Y.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,X.jsx)(Pn,{asChild:!0,...s,children:(0,X.jsx)(y.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...i,ref:c,onPointerMove:t(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),d.current=!0)}),onPointerLeave:t(e.onPointerLeave,()=>{a.onTriggerLeave(),d.current=!1}),onPointerDown:t(e.onPointerDown,()=>{a.open&&a.onClose(),l.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:t(e.onFocus,()=>{l.current||a.onOpen()}),onBlur:t(e.onBlur,a.onClose),onClick:t(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)(g,{present:n||a.open,children:(0,X.jsx)(j,{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)(g,{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),r=Jn(or,e.__scopeTooltip),i=Y.useRef(null),a=u(t,i),[o,s]=Y.useState(null),{trigger:c,onClose:l}=n,d=i.current,{onPointerInTransitChange:f}=r,p=Y.useCallback(()=>{s(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());s(yr([...i,...a])),f(!0)},[f]);return Y.useEffect(()=>()=>p(),[p]),Y.useEffect(()=>{if(c&&d){let e=e=>m(e,d),t=e=>m(e,c);return c.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[c,d,m,p]),Y.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||d?.contains(t),i=!vr(n,o);r?p():i&&(p(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,d,o,l,p]),(0,X.jsx)(fr,{...e,ref:a})}),[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)(T,{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=F(),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 o=a===void 0?4:a,s;n[4]===r?s=n[5]:(s=f(`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]=s);let c;return n[6]!==i||n[7]!==t||n[8]!==o||n[9]!==s?(c=(0,X.jsx)(wr,{ref:t,sideOffset:o,className:s,...i}),n[6]=i,n[7]=t,n[8]=o,n[9]=s,n[10]=c):c=n[10],c});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=f(`w-full caption-bottom text-sm`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,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]=o):o=n[8],o});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=f(`[&_tr]:border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(`thead`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});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=f(`[&_tr:last-child]:border-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(`tbody`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});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=f(`border-t bg-muted/50 font-medium [&>tr]:last:border-b-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(`tfoot`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});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=f(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(`tr`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Pr.displayName=`TableRow`;var Q=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=f(`h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(`th`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Q.displayName=`TableHead`;var 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=f(`p-4 align-middle [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(`td`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Fr.displayName=`TableCell`;var Ir=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=f(`mt-4 text-sm text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(`caption`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Ir.displayName=`TableCaption`;var Lr=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Rr=[` `,`Enter`],zr=`Select`,[Br,Vr,Hr]=ne(zr),[Ur,Wr]=re(zr,[Hr,_n]),Gr=_n(),[Kr,qr]=Ur(zr),[Jr,Yr]=Ur(zr),Xr=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:c,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:p,required:h,form:g}=e,_=Gr(t),[v,y]=Y.useState(null),[x,S]=Y.useState(null),[C,w]=Y.useState(!1),T=s(u),[E,D]=b({prop:r,defaultProp:i??!1,onChange:a,caller:zr}),[O,k]=b({prop:o,defaultProp:c,onChange:l,caller:zr}),A=Y.useRef(null),j=v?g||!!v.closest(`form`):!0,[M,N]=Y.useState(new Set),P=Array.from(M).map(e=>e.props.value).join(`;`);return(0,X.jsx)(Nn,{..._,children:(0,X.jsxs)(Kr,{required:h,scope:t,trigger:v,onTriggerChange:y,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:m(),value:O,onValueChange:k,open:E,onOpenChange:D,dir:T,triggerPointerDownPosRef:A,disabled:p,children:[(0,X.jsx)(Br.Provider,{scope:t,children:(0,X.jsx)(Jr,{scope:e.__scopeSelect,onNativeOptionAdd:Y.useCallback(e=>{N(t=>new Set(t).add(e))},[]),onNativeOptionRemove:Y.useCallback(e=>{N(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),j?(0,X.jsxs)(Wi,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:f,value:O,onChange:e=>k(e.target.value),disabled:p,form:g,children:[O===void 0?(0,X.jsx)(`option`,{value:``}):null,Array.from(M)]},P):null]})})};Xr.displayName=zr;var Zr=`SelectTrigger`,Qr=Y.forwardRef((e,n)=>{let{__scopeSelect:r,disabled:i=!1,...a}=e,o=Gr(r),s=qr(Zr,r),c=s.disabled||i,l=u(n,s.onTriggerChange),d=Vr(r),f=Y.useRef(`touch`),[p,m,h]=Ki(e=>{let t=d().filter(e=>!e.disabled),n=qi(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),g=e=>{c||(s.onOpenChange(!0),h()),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)(y.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:t(a.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:t(a.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:t(a.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&Lr.includes(e.key)&&(g(),e.preventDefault())})})})});Qr.displayName=Zr;var $r=`SelectValue`,ei=Y.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=qr($r,n),{onValueNodeHasChildrenChange:l}=c,d=a!==void 0,f=u(t,c.onValueNodeChange);return I(()=>{l(d)},[l,d]),(0,X.jsx)(y.span,{...s,ref:f,style:{pointerEvents:`none`},children:Gi(c.value)?(0,X.jsx)(X.Fragment,{children:o}):a})});ei.displayName=$r;var ti=`SelectIcon`,ni=Y.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,X.jsx)(y.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ni.displayName=ti;var ri=`SelectPortal`,ii=e=>(0,X.jsx)(j,{asChild:!0,...e});ii.displayName=ri;var ai=`SelectContent`,oi=Y.forwardRef((e,t)=>{let n=qr(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)(Br.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]=Ur(ai),li=`SelectContentImpl`,ui=E(`SelectContent.RemoveScroll`),di=Y.forwardRef((e,n)=>{let{__scopeSelect:r,position:i=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:v,...y}=e,b=qr(ai,r),[x,S]=Y.useState(null),[w,E]=Y.useState(null),D=u(n,e=>S(e)),[O,A]=Y.useState(null),[j,M]=Y.useState(null),N=Vr(r),[P,F]=Y.useState(!1),ne=Y.useRef(!1);Y.useEffect(()=>{if(x)return k(x)},[x]),C();let I=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&&w&&(w.scrollTop=0),n===r&&w&&(w.scrollTop=w.scrollHeight),n?.focus(),document.activeElement!==i))return},[N,w]),re=Y.useCallback(()=>I([O,x]),[I,O,x]);Y.useEffect(()=>{P&&re()},[P,re]);let{onOpenChange:ie,triggerPointerDownPosRef:L}=b;Y.useEffect(()=>{if(x){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():x.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})}}},[x,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=!ne.current&&!n;(b.value!==void 0&&b.value===t||r)&&(A(e),r&&(ne.current=!0))},[b.value]),z=Y.useCallback(()=>x?.focus(),[x]),se=Y.useCallback((e,t,n)=>{let r=!ne.current&&!n;(b.value!==void 0&&b.value===t||r)&&M(e)},[b.value]),ce=i===`popper`?hi:pi,le=ce===hi?{side:c,sideOffset:l,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:v}:{};return(0,X.jsx)(si,{scope:r,content:x,viewport:w,onViewportChange:E,itemRefCallback:oe,selectedItem:O,onItemLeave:z,itemTextRefCallback:se,focusSelectedItem:re,selectedItemText:j,position:i,isPositioned:P,searchRef:R,children:(0,X.jsx)(ee,{as:ui,allowPinchZoom:!0,children:(0,X.jsx)(te,{asChild:!0,trapped:b.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:t(a,e=>{b.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,X.jsx)(T,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:(0,X.jsx)(ce,{role:`listbox`,id:b.contentId,"data-state":b.open?`open`:`closed`,dir:b.dir,onContextMenu:e=>e.preventDefault(),...y,...le,onPlaced:()=>F(!0),ref:D,style:{display:`flex`,flexDirection:`column`,outline:`none`,...y.style},onKeyDown:t(y.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(()=>I(t)),e.preventDefault()}})})})})})})});di.displayName=li;var fi=`SelectItemAlignedPosition`,pi=Y.forwardRef((e,t)=>{let{__scopeSelect:r,onPlaced:i,...a}=e,o=qr(ai,r),s=ci(ai,r),[c,l]=Y.useState(null),[d,f]=Y.useState(null),p=u(t,e=>f(e)),m=Vr(r),h=Y.useRef(!1),g=Y.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:b,focusSelectedItem:x}=s,S=Y.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&d&&_&&v&&b){let e=o.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),r=o.valueNode.getBoundingClientRect(),a=b.getBoundingClientRect();if(o.dir!==`rtl`){let i=a.left-t.left,o=r.left-i,s=e.left-o,l=e.width+s,u=Math.max(l,t.width),d=window.innerWidth-$,f=n(o,[$,Math.max($,d-u)]);c.style.minWidth=l+`px`,c.style.left=f+`px`}else{let i=t.right-a.right,o=window.innerWidth-r.right-i,s=window.innerWidth-e.right-o,l=e.width+s,u=Math.max(l,t.width),d=window.innerWidth-$,f=n(o,[$,Math.max($,d-u)]);c.style.minWidth=l+`px`,c.style.right=f+`px`}let s=m(),l=window.innerHeight-$*2,u=_.scrollHeight,f=window.getComputedStyle(d),p=parseInt(f.borderTopWidth,10),g=parseInt(f.paddingTop,10),y=parseInt(f.borderBottomWidth,10),x=parseInt(f.paddingBottom,10),S=p+g+u+x+y,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=l-D,k=v.offsetHeight/2,A=v.offsetTop+k,j=p+g+A,M=S-j;if(j<=D){let e=s.length>0&&v===s[s.length-1].ref.current;c.style.bottom=`0px`;let t=d.clientHeight-_.offsetTop-_.offsetHeight,n=j+Math.max(O,k+(e?E:0)+t+y);c.style.height=n+`px`}else{let e=s.length>0&&v===s[0].ref.current;c.style.top=`0px`;let t=Math.max(D,p+_.offsetTop+(e?T:0)+k)+M;c.style.height=t+`px`,_.scrollTop=j-D+_.offsetTop}c.style.margin=`${$}px 0`,c.style.minHeight=C+`px`,c.style.maxHeight=l+`px`,i?.(),requestAnimationFrame(()=>h.current=!0)}},[m,o.trigger,o.valueNode,c,d,_,v,b,o.dir,i]);I(()=>S(),[S]);let[C,w]=Y.useState();return I(()=>{d&&w(window.getComputedStyle(d).zIndex)},[d]),(0,X.jsx)(gi,{scope:r,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:Y.useCallback(e=>{e&&g.current===!0&&(S(),x?.(),g.current=!1)},[S,x]),children:(0,X.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,X.jsx)(y.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=Gr(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]=Ur(ai,{}),vi=`SelectViewport`,yi=Y.forwardRef((e,n)=>{let{__scopeSelect:r,nonce:i,...a}=e,o=ci(vi,r),s=_i(vi,r),c=u(n,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)(Br.Slot,{scope:r,children:(0,X.jsx)(y.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:t(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]=Ur(bi),Ci=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=m();return(0,X.jsx)(xi,{scope:n,id:i,children:(0,X.jsx)(y.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)(y.div,{id:i.id,...r,ref:t})});Ti.displayName=wi;var Ei=`SelectItem`,[Di,Oi]=Ur(Ei),ki=Y.forwardRef((e,n)=>{let{__scopeSelect:r,value:i,disabled:a=!1,textValue:o,...s}=e,c=qr(Ei,r),l=ci(Ei,r),d=c.value===i,[f,p]=Y.useState(o??``),[h,g]=Y.useState(!1),_=u(n,e=>l.itemRefCallback?.(e,i,a)),v=m(),b=Y.useRef(`touch`),x=()=>{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:r,value:i,disabled:a,textId:v,isSelected:d,onItemTextChange:Y.useCallback(e=>{p(t=>t||(e?.textContent??``).trim())},[]),children:(0,X.jsx)(Br.ItemSlot,{scope:r,value:i,disabled:a,textValue:f,children:(0,X.jsx)(y.div,{role:`option`,"aria-labelledby":v,"data-highlighted":h?``:void 0,"aria-selected":d&&h,"data-state":d?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:_,onFocus:t(s.onFocus,()=>g(!0)),onBlur:t(s.onBlur,()=>g(!1)),onClick:t(s.onClick,()=>{b.current!==`mouse`&&x()}),onPointerUp:t(s.onPointerUp,()=>{b.current===`mouse`&&x()}),onPointerDown:t(s.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:t(s.onPointerMove,e=>{b.current=e.pointerType,a?l.onItemLeave?.():b.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:t(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:t(s.onKeyDown,e=>{l.searchRef?.current!==``&&e.key===` `||(Rr.includes(e.key)&&x(),e.key===` `&&e.preventDefault())})})})})});ki.displayName=Ei;var Ai=`SelectItemText`,ji=Y.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=qr(Ai,n),s=ci(Ai,n),c=Oi(Ai,n),l=Yr(Ai,n),[d,f]=Y.useState(null),p=u(t,e=>f(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),m=d?.textContent,h=Y.useMemo(()=>(0,X.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return I(()=>(g(h),()=>_(h)),[g,_,h]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(y.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Yt.createPortal(a.children,o.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)(y.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),r=_i(Pi,e.__scopeSelect),[i,a]=Y.useState(!1),o=u(t,r.onScrollButtonChange);return I(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,X.jsx)(Ri,{...e,ref:o,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),r=_i(Ii,e.__scopeSelect),[i,a]=Y.useState(!1),o=u(t,r.onScrollButtonChange);return I(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,X.jsx)(Ri,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Li.displayName=Ii;var Ri=Y.forwardRef((e,n)=>{let{__scopeSelect:r,onAutoScroll:i,...a}=e,o=ci(`SelectScrollButton`,r),s=Y.useRef(null),c=Vr(r),l=Y.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return Y.useEffect(()=>()=>l(),[l]),I(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,X.jsx)(y.div,{"aria-hidden":!0,...a,ref:n,style:{flexShrink:0,...a.style},onPointerDown:t(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(i,50))}),onPointerMove:t(a.onPointerMove,()=>{o.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(i,50))}),onPointerLeave:t(a.onPointerLeave,()=>{l()})})}),zi=`SelectSeparator`,Bi=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,X.jsx)(y.div,{"aria-hidden":!0,...r,ref:t})});Bi.displayName=zi;var Vi=`SelectArrow`,Hi=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Gr(n),a=qr(Vi,n),o=ci(Vi,n);return a.open&&o.position===`popper`?(0,X.jsx)(In,{...i,...r,ref:t}):null});Hi.displayName=Vi;var Ui=`SelectBubbleInput`,Wi=Y.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=Y.useRef(null),a=u(r,i),o=kr(t);return Y.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,X.jsx)(y.select,{...n,style:{...Ln,...n.style},ref:a,defaultValue:t})});Wi.displayName=Ui;function Gi(e){return e===``||e===void 0}function Ki(e){let t=v(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=f(`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)(o,{className:`h-4 w-4 opacity-50`})}),n[6]=c):c=n[6];let l;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==s?(l=(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]=l):l=n[11],l});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=f(`flex cursor-default items-center justify-center py-1`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(d,{className:`h-4 w-4`}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,X.jsx)(oa,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});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=f(`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)(o,{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,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:i,children:r,position:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=o===void 0?`popper`:o,c=s===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,l;n[5]!==i||n[6]!==c?(l=f(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,c,i),n[5]=i,n[6]=c,n[7]=l):l=n[7];let u;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(fa,{}),n[8]=u):u=n[8];let d=s===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`,p;n[9]===d?p=n[10]:(p=f(`p-1`,d),n[9]=d,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]!==s||n[16]!==a||n[17]!==t||n[18]!==l||n[19]!==m?(g=(0,X.jsx)($i,{children:(0,X.jsxs)(ea,{ref:t,className:l,position:s,...a,children:[u,m,h]})}),n[15]=s,n[16]=a,n[17]=t,n[18]=l,n[19]=m,n[20]=g):g=n[20],g});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=f(`py-1.5 pl-8 pr-2 text-sm font-semibold`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(na,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ha.displayName=na.displayName;var ga=Y.forwardRef((e,t)=>{let n=(0,Z.c)(14),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=f(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,i),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(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)(M,{className:`h-4 w-4`})})}),n[6]=s):s=n[6];let c;n[7]===r?c=n[8]:(c=(0,X.jsx)(ia,{children:r}),n[7]=r,n[8]=c);let l;return n[9]!==a||n[10]!==t||n[11]!==o||n[12]!==c?(l=(0,X.jsxs)(ra,{ref:t,className:o,...a,children:[s,c]}),n[9]=a,n[10]=t,n[11]=o,n[12]=c,n[13]=l):l=n[13],l});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=f(`-mx-1 my-1 h-px bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(ca,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});_a.displayName=ca.displayName;var va=`__ALL_PROJECTS__`;function ya(e){let t=(0,Z.c)(8),{text:n,maxLength:r}=e,i=r===void 0?100:r;if(n.length<=i){let e;return t[0]===n?e=t[1]:(e=(0,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 A(i.threadId);e?.messages&&(t.push(...e.messages),e.conversationIds&&e.conversationIds.forEach(e=>n.add(e)),e.lastUpdated>r&&(r=e.lastUpdated))}catch(e){console.warn(`Failed to load history for thread ${i.threadId}:`,e)}return t.sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime()),{messages:t,conversationIds:Array.from(n),lastUpdated:r??new Date().toISOString()}}function Sa({isOpen:e,onClose:t,initialFilter:n,projects:o,inline:s}){let[u,d]=(0,Y.useState)(null),[f,m]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(0),[b,x]=(0,Y.useState)(``),[C,T]=(0,Y.useState)(``),E=(0,Y.useCallback)(async e=>{m(!0),_(null);try{d(await A(e))}catch(e){_(e instanceof Error?e.message:`Failed to load conversation history`)}finally{m(!1)}},[]),O=(0,Y.useCallback)(async e=>{if(e){m(!0),_(null);try{let t=o.find(t=>t.projectId===e);if(!t||t.threads.length===0){d({threadId:e,messages:[],lastUpdated:new Date().toISOString(),conversationIds:[]});return}d({threadId:e,...await xa(t.threads)})}catch(e){_(e instanceof Error?e.message:`Failed to load project history`)}finally{m(!1)}}},[o]),k=(0,Y.useCallback)(async()=>{m(!0),_(null);try{d({threadId:va,...await xa(o.flatMap(e=>e.threads))})}catch(e){_(e instanceof Error?e.message:`Failed to load all projects history`)}finally{m(!1)}},[o]);(0,Y.useEffect)(()=>{e&&n?n.type===`thread`?(T(n.id),x(``),y(0),E(n.id)):n.type===`project`&&(x(n.id),T(``),y(0),O(n.id)):e||(d(null),T(``),x(``),y(0),_(null))},[e,n,E,O]);let j=e=>{T(e),x(``),y(0),E(e)},M=e=>{x(e),T(``),y(0),e===va?k():O(e)},P=e=>new Date(e).toLocaleString(),ee=(e,t)=>{let n=new Date(e),r=new Date(t).getTime()-n.getTime();if(r<0)return{display:`0:00`,tooltip:`0 seconds`};let i=Math.floor(r/1e3),a=Math.floor(i/60),o=i%60,s=`${a}:${o.toString().padStart(2,`0`)}`,c;return c=a===0?`${o} second${o===1?``:`s`}`:o===0?`${a} minute${a===1?``:`s`}`:`${a} minute${a===1?``:`s`} ${o} second${o===1?``:`s`}`,{display:s,tooltip:c}},te=e=>({inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0});return e?(0,X.jsx)(`div`,{className:s?`h-full bg-background`:`fixed inset-0 z-50 bg-background`,children:(0,X.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!s&&(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`}),n?.type===`thread`&&(0,X.jsxs)(la,{value:C,onValueChange:j,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:b,onValueChange:M,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)(w,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,X.jsx)(i,{})})]}),u?.messages.length&&u.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)(w,{variant:`outline`,size:`sm`,onClick:()=>{v>0&&y(v-1)},disabled:v===0,children:(0,X.jsx)(a,{className:`h-4 w-4 mr-1`})}),(0,X.jsx)(w,{variant:`outline`,size:`sm`,onClick:()=>{u?.messages&&v<u.messages.length-1&&y(v+1)},disabled:!u||v>=u.messages.length-1,children:(0,X.jsx)(p,{className:`h-4 w-4 ml-1`})})]}),(0,X.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[v+1,` of `,u?.messages.length??0,` messages`]})]}),(0,X.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:f?(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,X.jsxs)(`div`,{className:`text-center`,children:[(0,X.jsx)(l,{className:`h-8 w-8 animate-spin mx-auto mb-2`}),(0,X.jsx)(`p`,{children:`Loading conversation history...`})]})}):g?(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)(S,{children:(0,X.jsx)(h,{className:`text-destructive`,children:`Error`})}),(0,X.jsxs)(N,{children:[(0,X.jsx)(`p`,{children:g}),(0,X.jsx)(w,{onClick:t,className:`mt-4`,children:`Close`})]})]})}):u?.messages?.length&&u.messages.length>0?(0,X.jsx)(r,{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)(Q,{children:`Prompt`}),(0,X.jsx)(Q,{children:`Answer`}),(0,X.jsx)(Q,{className:`w-24`,children:`Model`}),(0,X.jsx)(Q,{className:`w-24 text-right`,children:`Duration`}),(0,X.jsx)(Q,{className:`w-20 text-right`,children:`Input Tokens`}),(0,X.jsx)(Q,{className:`w-20 text-right`,children:`Output Tokens`}),(0,X.jsx)(Q,{className:`w-32 text-right`,children:`Timestamp`})]})}),(0,X.jsx)(Mr,{children:u.messages.map((e,t)=>{let{inputTokens:n,outputTokens:r}=te(e);return(0,X.jsxs)(Pr,{className:t===v?`bg-muted/50`:``,children:[(0,X.jsx)(Fr,{className:`max-w-md`,children:(0,X.jsx)(`div`,{className:`text-sm`,children:(0,X.jsx)(ya,{text:e.request.message})})}),(0,X.jsx)(Fr,{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)(Fr,{className:`text-sm`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(c,{className:`h-3 w-3 text-muted-foreground`}),(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,X.jsx)(Fr,{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:ee(e.timestamp,e.response.completedAt).display})}),(0,X.jsx)(Or,{children:(0,X.jsx)(`p`,{children:ee(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,X.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,X.jsx)(Fr,{className:`text-sm text-muted-foreground text-right`,children:n>0?n.toLocaleString():`-`}),(0,X.jsx)(Fr,{className:`text-sm text-muted-foreground text-right`,children:r>0?r.toLocaleString():`-`}),(0,X.jsx)(Fr,{className:`text-sm text-muted-foreground text-right`,children:P(e.timestamp)})]},e.id)})})]})})}):(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)(S,{children:(0,X.jsx)(h,{children:`No History`})}),(0,X.jsxs)(N,{children:[(0,X.jsx)(`p`,{children:`No conversation history found for this thread.`}),(0,X.jsx)(w,{onClick:t,className:`mt-4`,children:`Close`})]})]})})})]})}):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};