tarsk 0.5.75 → 0.5.76

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 (66) hide show
  1. package/dist/public/assets/{account-view-DvyhZGLB.js → account-view-CWtpznW2.js} +1 -1
  2. package/dist/public/assets/browser-tab-D_5MLhxE.js +12 -0
  3. package/dist/public/assets/chat-dock-context-8K8Ikjgy.js +1 -0
  4. package/dist/public/assets/{commit-dialog-BUfbvG6F.js → commit-dialog-CSXPoomw.js} +1 -1
  5. package/dist/public/assets/{commit-error-dialog-D1XRPBOc.js → commit-error-dialog-CdcGI69P.js} +1 -1
  6. package/dist/public/assets/{commit-method-fields-CVQjrJ_O.js → commit-method-fields-BtEHb0_G.js} +1 -1
  7. package/dist/public/assets/{conversation-history-view-CzRrC6cJ.js → conversation-history-view-CuzU9qF6.js} +1 -1
  8. package/dist/public/assets/{create-project-dialog-Bqm_qC2v.js → create-project-dialog-a6Wgq-Z8.js} +1 -1
  9. package/dist/public/assets/{create-repo-dialog-D2H1eZic.js → create-repo-dialog-BTIQ5Nw4.js} +1 -1
  10. package/dist/public/assets/{diff-view-zXlCXzER.js → diff-view-DA1uT9tc.js} +2 -2
  11. package/dist/public/assets/{explorer-tab-view-BOc5FPFg.js → explorer-tab-view-CewTYYOm.js} +2 -2
  12. package/dist/public/assets/explorer-tree-C0VDhihz.js +1 -0
  13. package/dist/public/assets/{explorer-view-DFjt0DXO.js → explorer-view-RCfDm3p5.js} +2 -2
  14. package/dist/public/assets/{git-history-dialog-CFoZcBB0.js → git-history-dialog-DL0Trxiz.js} +1 -1
  15. package/dist/public/assets/index-B3-5kIOf.js +3658 -0
  16. package/dist/public/assets/merged-pr-dialog-BzND8nzx.js +1 -0
  17. package/dist/public/assets/{model-list-controls-CNrps9Ys.js → model-list-controls-I67L2x3H.js} +1 -1
  18. package/dist/public/assets/onboarding-dialog-DY8v11hv.js +1 -0
  19. package/dist/public/assets/{project-coding-view-DG1D8-z4.js → project-coding-view-DxOwsjtt.js} +1 -1
  20. package/dist/public/assets/project-danger-zone-view-CkvKOQrl.js +1 -0
  21. package/dist/public/assets/{project-env-vars-view-TblkryyN.js → project-env-vars-view-DYLWA7s0.js} +1 -1
  22. package/dist/public/assets/{project-model-aliases-view-Ct0v4NQm.js → project-model-aliases-view-DWu9khLA.js} +1 -1
  23. package/dist/public/assets/{project-settings-view-Dd3QPujg.js → project-settings-view-DJfmaWn6.js} +1 -1
  24. package/dist/public/assets/{project-tools-view-DdsKSUDp.js → project-tools-view-BEjBkghz.js} +1 -1
  25. package/dist/public/assets/providers-list-view-jMEPJCci.js +1 -0
  26. package/dist/public/assets/{pull-request-dialog-BRiR5Qz8.js → pull-request-dialog-B_JCqT53.js} +1 -1
  27. package/dist/public/assets/{pull-with-changes-dialog-BCIWOzvE.js → pull-with-changes-dialog-V3_km2zQ.js} +1 -1
  28. package/dist/public/assets/{push-before-pr-dialog-BEr0QZlO.js → push-before-pr-dialog-CarrD3y2.js} +1 -1
  29. package/dist/public/assets/{settings-general-view-CKvkG8C5.js → settings-general-view-BhrfHGfQ.js} +1 -1
  30. package/dist/public/assets/{settings-list-B9a61wMg.js → settings-list-DiiYzOxn.js} +1 -1
  31. package/dist/public/assets/{settings-logs-view-4Uoa1-Dx.js → settings-logs-view-DbKM1SNk.js} +2 -2
  32. package/dist/public/assets/settings-mcp-servers-view-4FpPIeYV.js +5 -0
  33. package/dist/public/assets/{settings-models-view-Ef404r4H.js → settings-models-view-CJVeo9ad.js} +1 -1
  34. package/dist/public/assets/settings-skills-view-DoRPGbHG.js +3 -0
  35. package/dist/public/assets/{settings-slack-view-C32in2Wg.js → settings-slack-view-Cc1NgVkx.js} +1 -1
  36. package/dist/public/assets/settings-slash-commands-view-CmlWqqmi.js +1 -0
  37. package/dist/public/assets/{settings-statistics-view-CxW2KB56.js → settings-statistics-view-DRuyEbcN.js} +1 -1
  38. package/dist/public/assets/settings-storage-view-DihbtUYb.js +1 -0
  39. package/dist/public/assets/{settings-subagents-view-StdmEn-E.js → settings-subagents-view-B2RvxDZI.js} +2 -2
  40. package/dist/public/assets/{settings-system-prompt-view-DizAjXjo.js → settings-system-prompt-view-CvVbgjNN.js} +1 -1
  41. package/dist/public/assets/settings-view-CPUAjTMa.js +2 -0
  42. package/dist/public/assets/tasks-view-CvFFLPeD.js +1 -0
  43. package/dist/public/assets/{terminal-panel-DSfDZzBk.js → terminal-panel-DIh6it7K.js} +1 -1
  44. package/dist/public/assets/{use-active-dock-panel-instance-DNExGWVs.js → use-active-dock-panel-instance-DRfRj6MV.js} +1 -1
  45. package/dist/public/assets/{use-installed-ai-files-BuuVI3sM.js → use-installed-ai-files-C8nNWGC7.js} +1 -1
  46. package/dist/public/assets/{useBaseQuery-GJoj38pA.js → useBaseQuery-34f0-SVd.js} +1 -1
  47. package/dist/public/assets/{web-DyYrh5r4.js → web-Bn9n5e7r.js} +1 -1
  48. package/dist/public/assets/{web-CliOgvKf.js → web-C2KGFouM.js} +1 -1
  49. package/dist/public/assets/{web-Dzci4edU.js → web-Dk3GAfTy.js} +1 -1
  50. package/dist/public/assets/{web-BmpJHrzY.js → web-DycfRH4j.js} +1 -1
  51. package/dist/public/index.html +3 -3
  52. package/package.json +1 -1
  53. package/dist/public/assets/browser-tab-5rqpwS93.js +0 -12
  54. package/dist/public/assets/chat-dock-context-BJNNRoZC.js +0 -1
  55. package/dist/public/assets/explorer-tree-m1u3VhWL.js +0 -1
  56. package/dist/public/assets/index-u8UbWjXL.js +0 -3658
  57. package/dist/public/assets/merged-pr-dialog-BMqHRow2.js +0 -1
  58. package/dist/public/assets/onboarding-dialog-BFJftu2O.js +0 -1
  59. package/dist/public/assets/project-danger-zone-view-6HEDGyUj.js +0 -1
  60. package/dist/public/assets/providers-list-view-BUNk2E8O.js +0 -1
  61. package/dist/public/assets/settings-mcp-servers-view-CaAy6iV4.js +0 -5
  62. package/dist/public/assets/settings-skills-view-DLrG4E_U.js +0 -3
  63. package/dist/public/assets/settings-slash-commands-view-CpBMV_5D.js +0 -1
  64. package/dist/public/assets/settings-storage-view-BzT8k6yE.js +0 -1
  65. package/dist/public/assets/settings-view-CTQgFmjM.js +0 -2
  66. package/dist/public/assets/tasks-view-z93aMoQp.js +0 -1
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{Dt as r}from"./dist-CTLFS4dn.js";import{r as i}from"./store-BSzKIu5G.js";import{r as a,t as o}from"./button-kWtLAMpB.js";import{Pt as s,k as c}from"./dist-c_QADQ5u.js";import{i as l,n as u,r as d,t as f}from"./tooltip-Db8UeYxm.js";import{N as p,Rt as m,S as h,cr as g,rr as _}from"./api-DX1ny6q-.js";import{t as v}from"./use-toast-xpb5jNtN.js";import{n as y}from"./explorer-tab-context-BxUVwWQQ.js";import{At as b,Ct as ee,Dt as x,Et as S,Ln as te,_t as C,dr as w,fr as T,gt as E,kt as D,mr as O,pr as ne,vt as re,yt as k}from"./index-B3-5kIOf.js";import{t as ie}from"./delete-confirm-dialog-Dl76vaxb.js";import{n as A,t as j}from"./radio-group-Dn_pN-pn.js";import{t as M}from"./use-settings-page-loading-BTySlInF.js";import{a as N,i as P,r as ae}from"./settings-list-DiiYzOxn.js";import{i as F,n as I,r as L}from"./slug-utils-CQ8PMWUL.js";var R=e(t(),1),z=n();function oe({projectId:e,threadId:t,onCommandCreated:n}){let[i,o]=(0,R.useState)(``),[s,c]=(0,R.useState)(``),[l,u]=(0,R.useState)(``),[d,f]=(0,R.useState)(`default`),[p,m]=(0,R.useState)(!1),g=L(i),_=I(g),y=async()=>{if(!(!_||!e)){m(!0);try{await h(g,``,{description:s.trim()||void 0,argumentHint:l.trim()||void 0,mode:d===`plan`?`plan`:void 0},`project`,t??void 0),v({title:`Command created`,description:`Command '/${g}' was created successfully.`}),o(``),c(``),u(``),f(`default`),n?.(g)}catch(e){v({title:`Error`,description:e instanceof Error?e.message:`Failed to create command`,variant:`destructive`})}finally{m(!1)}}};return e?(0,z.jsx)(D,{children:(0,z.jsxs)(E,{children:[(0,z.jsx)(k,{title:`Add Slash Command`,description:`Saved as a .md file in ~/.agents/commands.`,sticky:!0,className:`pr-10`}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(C,{title:`Command Name`,controlLayout:`stack`,className:`pt-6`,children:[(0,z.jsx)(T,{id:`commandName`,value:i,onChange:e=>o(e.target.value),placeholder:`e.g. review`,disabled:p}),i?(0,z.jsxs)(`p`,{className:a(r.caption,`mt-2`),children:[`Command: `,(0,z.jsxs)(`span`,{className:`font-mono`,children:[`/`,g||`...`]})]}):null]}),(0,z.jsx)(C,{title:`Description`,controlLayout:`stack`,className:`pt-6`,children:(0,z.jsx)(T,{id:`commandDescription`,value:s,onChange:e=>c(e.target.value),placeholder:`Brief description shown in autocomplete`,disabled:p})}),(0,z.jsx)(C,{title:`Argument Hint`,description:`Shows after the command name to guide users what to type`,controlLayout:`stack`,className:`pt-6`,children:(0,z.jsx)(T,{id:`argumentHint`,value:l,onChange:e=>u(e.target.value),placeholder:`e.g. <focus-area> or <branch-name>`,disabled:p})}),(0,z.jsx)(C,{title:`Mode`,description:d==="default"?`Standard chat mode`:`Activates plan mode when this command is used`,controlLayout:`stack`,className:`pt-6`,children:(0,z.jsxs)(j,{value:d,onValueChange:e=>f(e),className:`flex gap-4`,disabled:p,children:[(0,z.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,z.jsx)(A,{value:`default`,id:`mode-default`}),(0,z.jsx)(w,{htmlFor:`mode-default`,className:a(r.labelNormal,`cursor-pointer`),children:`Default`})]}),(0,z.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,z.jsx)(A,{value:`plan`,id:`mode-plan`}),(0,z.jsx)(w,{htmlFor:`mode-plan`,className:a(r.labelNormal,`cursor-pointer`),children:`Plan`})]})]})}),(0,z.jsx)(F,{onContinue:()=>void y(),disabled:!_,creating:p})]})]})}):(0,z.jsx)(S,{title:`No project selected`,children:`Please select a project to add a slash command.`})}function B(){let e=i(e=>e.selectedProjectId),t=i(e=>e.selectedThreadId),{openChatDockPanel:n}=te(),{setPendingExplorerPath:C,triggerExplorerRefresh:w,setExplorerClearPath:T}=y(),[E,D]=(0,R.useState)([]),[A,j]=(0,R.useState)(!0),[F,I]=(0,R.useState)(!1),[L,B]=(0,R.useState)(null),[V,H]=(0,R.useState)(!1),[U,W]=(0,R.useState)([]),[G,K]=(0,R.useState)(!0),[q,J]=(0,R.useState)(new Map),[Y,se]=(0,R.useState)(``),X=(0,R.useCallback)(async()=>{if(!t){j(!1),D([]),J(new Map);return}j(!0);try{let e=await m(t);D(e.filter(e=>!e.isBuiltIn)),J(new Map(e.map(e=>[e.name,e.filePath])))}catch{D([]),J(new Map)}finally{j(!1)}},[t]);(0,R.useLayoutEffect)(()=>{t&&j(!0)},[e,t]),(0,R.useEffect)(()=>{X()},[X]),(0,R.useEffect)(()=>{K(!0),_().then(W).catch(()=>W([])).finally(()=>K(!1))},[]);let ce=M(e?`${e}:${t??``}`:null,[A,G]),le=(0,R.useCallback)(async e=>{H(!0);try{if(!t)return;await p(e.filePath,t),T(e.filePath),w(),J(t=>{let n=new Map(t);return n.delete(e.name),n}),v({title:`Command removed`,description:`/${e.name}`}),B(null),await X()}catch(e){v({title:`Error`,description:e instanceof Error?e.message:`Failed to remove command`,variant:`destructive`})}finally{H(!1)}},[X,t,w,T]),ue=(0,R.useCallback)(e=>{C(e),n(`explorer`)},[C,n]),de=(0,R.useCallback)(e=>{let t=e.metadata?.description?.trim();return t&&t.length>0?t:`No description`},[]),Z=(0,R.useCallback)(async e=>{if(!(!t||q.has(e.name)))try{if(e.gitHubRepo&&e.gitHubFolder){let n=`.agents/commands`;await g(t,e.gitHubRepo,e.gitHubFolder,n);let r=`${n}/${e.name}.md`;J(t=>new Map(t).set(e.name,r))}else{let n=await h(e.name,e.content,{description:e.description,argumentHint:e.argumentHint},`project`,t);J(t=>new Map(t).set(e.name,n.filePath))}w(),X(),v({title:`Command installed`,description:`/${e.name}`})}catch(e){v({title:`Error`,description:e instanceof Error?e.message:`Failed to install command`,variant:`destructive`})}},[t,q,w,X]),Q=U.filter(e=>!q.has(e.name)),$=Y.trim()?Q.filter(e=>e.name.toLowerCase().includes(Y.toLowerCase())||e.description.toLowerCase().includes(Y.toLowerCase())):Q;return e?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(ee,{loading:ce,children:[(0,z.jsxs)(b,{className:`shrink-0`,children:[(0,z.jsx)(k,{title:(0,z.jsx)(d,{children:(0,z.jsxs)(f,{children:[(0,z.jsx)(l,{asChild:!0,children:(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Installed Slash Commands`,(0,z.jsx)(s,{"aria-hidden":`true`,className:`h-4 w-4 text-muted-foreground`})]})}),(0,z.jsx)(u,{children:`Project slash commands you run with / in chat.`})]})}),action:(0,z.jsx)(o,{onClick:()=>I(!0),disabled:!t,children:`Add Command`}),sticky:!1}),(0,z.jsxs)(x,{className:`pt-6`,children:[!t&&(0,z.jsx)(re,{children:`Select a thread to add or install slash commands.`}),(0,z.jsx)(ae,{showHeader:!1,loading:!1,items:E,emptyState:{icon:c,title:`No slash commands installed`,description:`Add slash commands to create quick actions in chat.`},getKey:e=>e.filePath,columnsClassName:`grid-cols-[minmax(0,1fr)_auto_1.75rem]`,renderContent:e=>(0,z.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,z.jsxs)(`div`,{className:a(r.body,`truncate`),children:[`/`,e.name]}),(0,z.jsx)(`div`,{className:a(r.compact,`truncate text-muted-foreground`),children:de(e)})]}),renderMiddle:e=>e.metadata?.mode?(0,z.jsx)(`span`,{className:a(r.compact,`bg-muted px-1.5 py-0.5 rounded flex-shrink-0`),children:e.metadata.mode}):(0,z.jsx)(`div`,{}),onItemClick:e=>ue(e.filePath),itemClickLabel:e=>`Open /${e.name} in Files`,onDelete:B,deleteAriaLabel:e=>`Delete /${e.name}`,deleteTooltip:`Remove this slash command from the project`})]})]}),(0,z.jsxs)(b,{className:`shrink-0`,children:[(0,z.jsx)(k,{title:(0,z.jsx)(d,{children:(0,z.jsxs)(f,{children:[(0,z.jsx)(l,{asChild:!0,children:(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Available Slash Commands`,(0,z.jsx)(s,{"aria-hidden":`true`,className:`h-4 w-4 text-muted-foreground`})]})}),(0,z.jsx)(u,{children:`Browse and install slash commands from the catalog.`})]})}),action:(0,z.jsx)(N,{placeholder:`Search`,value:Y,onChange:se,className:`mb-0 w-64`}),sticky:!1}),(0,z.jsx)(x,{className:`pt-6`,children:$.length===0?(0,z.jsx)(P,{searchQuery:Y,emptyLabel:`No available commands found.`}):(0,z.jsx)(`div`,{className:`divide-y divide-table-border`,children:$.map(e=>(0,z.jsxs)(`div`,{className:`group flex min-h-13 items-center justify-between gap-3 px-3 py-3 hover:bg-muted/30`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,z.jsxs)(`div`,{className:a(r.body,`truncate`),children:[`/`,e.name]}),(0,z.jsx)(`div`,{className:a(r.compact,`truncate text-muted-foreground`),children:e.description})]}),(0,z.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,className:`opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100`,disabled:!t,onClick:()=>void Z(e),children:`Install`})]},e.id))})})]})]}),(0,z.jsx)(ne,{open:F,onOpenChange:I,children:(0,z.jsx)(O,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,z.jsx)(oe,{projectId:e,threadId:t,onCommandCreated:()=>{I(!1),X(),w()}})})}),(0,z.jsx)(ie,{open:L!==null,onOpenChange:e=>!e&&B(null),title:`Delete Slash Command`,description:`Are you sure you want to delete "/${L?.name}"? This action cannot be undone.`,onConfirm:()=>{L&&le(L)},confirming:V})]}):(0,z.jsx)(S,{children:`Select a project to manage slash commands.`})}export{B as SettingsSlashCommandsView,B as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{Dt as i,N as a}from"./dist-CTLFS4dn.js";import{r as o,t as s}from"./button-kWtLAMpB.js";import{Z as c}from"./dist-c_QADQ5u.js";import{dn as l,ut as u}from"./api-DX1ny6q-.js";import{n as d}from"./use-toast-xpb5jNtN.js";import{Dt as f}from"./index-u8UbWjXL.js";import{t as p}from"./delete-confirm-dialog-Dl76vaxb.js";import{a as m,i as h,n as g,r as _,t as v}from"./table-A3cgauiZ.js";import{n as y,t as ee}from"./toggle-group-Q36wRGKA.js";var b=t(),x=e(n(),1),S=a(`app.use-latency-stats.hook`),C={tools:[],models:[]};function w(){let[e,t]=(0,x.useState)([]),[n,r]=(0,x.useState)([]),[i,a]=(0,x.useState)(!0),[o,s]=(0,x.useState)(!1),[c,d]=(0,x.useState)(null),f=(0,x.useCallback)(async function(){try{d(null);let e=await u();t(e.tools??C.tools),r(e.models??C.models)}catch(e){S.error(`Failed to load latency statistics`,e),d(e instanceof Error?e.message:`Failed to load statistics`)}finally{a(!1)}},[]),p=(0,x.useCallback)(async function(){s(!0);try{return d(null),await l(),t(C.tools),r(C.models),!0}catch(e){return S.error(`Failed to reset latency statistics`,e),d(e instanceof Error?e.message:`Failed to reset statistics`),!1}finally{s(!1)}},[]);return(0,x.useEffect)(()=>{f()},[f]),{tools:e,models:n,isLoading:i,isResetting:o,error:c,refresh:f,reset:p}}var T=r(),E=[{value:`tools`,label:`Tools`},{value:`models`,label:`Models`}],D=`inline-flex rounded-full border bg-muted/40 p-1`,O=`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm`,te=`flex items-center gap-2`,ne=`gap-1.5 text-muted-foreground hover:text-foreground`,k=`h-9`,A=`table-fixed`,j=o(i.body,`py-1.5`),M=o(i.body,`w-28 py-1.5 text-right tabular-nums`),N=o(i.body,`w-32 py-1.5 text-right tabular-nums`),P=`h-9 w-28 bg-transparent py-2 text-right`,F=`h-9 w-32 bg-transparent py-2 text-right`;function I(e){if(!Number.isFinite(e)||e<0)return`—`;if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;return t<10?`${t.toFixed(1)}s`:`${Math.round(t)}s`}function L(e){let t=(0,b.c)(3),{view:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=o(`w-full caption-bottom`,A,i.body),t[0]=r):r=t[0];let a;return t[1]===n?a=t[2]:(a=(0,T.jsx)(`table`,{className:r,children:(0,T.jsx)(`thead`,{className:`[&_tr]:border-b [&_tr]:border-table-border`,children:(0,T.jsx)(`tr`,{children:n===`tools`?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(h,{className:`h-9 bg-transparent py-2`,children:`Tool`}),(0,T.jsx)(h,{className:P,children:`Calls`}),(0,T.jsx)(h,{className:F,children:`Latency`})]}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(h,{className:`h-9 bg-transparent py-2`,children:`Model`}),(0,T.jsx)(h,{className:P,children:`Requests`}),(0,T.jsx)(h,{className:F,children:`Latency`})]})})})}),t[1]=n,t[2]=a),a}function R(){let e=(0,b.c)(38),{tools:t,models:n,isLoading:r,isResetting:a,error:l,reset:u}=w(),{toast:m}=d(),[h,_]=(0,x.useState)(`tools`),[y,S]=(0,x.useState)(!1),C=h===`tools`&&!r&&t.length>0,O=h===`models`&&!r&&n.length>0,k=C||O,j=t.length>0||n.length>0,M;e[0]!==u||e[1]!==m?(M=async function(){if(S(!1),await u()){m({title:`Statistics cleared`,description:`All tool and model latency data has been reset.`});return}m({title:`Error`,description:`Failed to reset statistics. Please try again.`,variant:`destructive`})},e[0]=u,e[1]=m,e[2]=M):M=e[2];let N=M,P;e[3]!==k||e[4]!==h?(P=k?(0,T.jsx)(L,{view:h}):void 0,e[3]=k,e[4]=h,e[5]=P):P=e[5];let F;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{(e===`tools`||e===`models`)&&_(e)},e[6]=F):F=e[6];let I;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(I=E.map(V),e[7]=I):I=e[7];let R;e[8]===h?R=e[9]:(R=(0,T.jsx)(ee,{type:`single`,value:h,onValueChange:F,"aria-label":`Statistics view`,variant:`outline`,className:D,children:I}),e[8]=h,e[9]=R);let H=r||a||!j,U,W;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>S(!0),W=(0,T.jsx)(c,{}),e[10]=U,e[11]=W):(U=e[10],W=e[11]);let G=a?`Resetting...`:`Reset`,K;e[12]!==H||e[13]!==G?(K=(0,T.jsxs)(s,{variant:`outline`,size:`sm`,className:ne,disabled:H,onClick:U,children:[W,G]}),e[12]=H,e[13]=G,e[14]=K):K=e[14];let q;e[15]!==R||e[16]!==K?(q=(0,T.jsxs)(`div`,{className:te,children:[R,K]}),e[15]=R,e[16]=K,e[17]=q):q=e[17];let J;e[18]===l?J=e[19]:(J=l?(0,T.jsx)(`p`,{className:o(i.bodyMuted,`mb-6 text-destructive`),children:l}):null,e[18]=l,e[19]=J);let Y;e[20]!==r||e[21]!==n||e[22]!==t||e[23]!==h?(Y=h===`tools`?r?(0,T.jsx)(`p`,{className:i.bodyMuted,children:`Loading…`}):t.length===0?(0,T.jsx)(`p`,{className:i.bodyMuted,children:`No tool call timings recorded yet. Stats appear after agent tool calls complete.`}):(0,T.jsx)(v,{className:A,children:(0,T.jsx)(g,{children:t.map(B)})}):r?(0,T.jsx)(`p`,{className:i.bodyMuted,children:`Loading…`}):n.length===0?(0,T.jsx)(`p`,{className:i.bodyMuted,children:`No model timings recorded yet. Stats appear after assistant responses complete.`}):(0,T.jsx)(v,{className:A,children:(0,T.jsx)(g,{children:n.map(z)})}),e[20]=r,e[21]=n,e[22]=t,e[23]=h,e[24]=Y):Y=e[24];let X;e[25]!==P||e[26]!==q||e[27]!==J||e[28]!==Y?(X=(0,T.jsxs)(f,{title:`Statistics`,description:`Average latency and request counts for tool calls and model responses.`,tableHeader:P,action:q,children:[J,Y]}),e[25]=P,e[26]=q,e[27]=J,e[28]=Y,e[29]=X):X=e[29];let Z;e[30]===N?Z=e[31]:(Z=()=>void N(),e[30]=N,e[31]=Z);let Q;e[32]!==y||e[33]!==Z?(Q=(0,T.jsx)(p,{open:y,onOpenChange:S,title:`Reset statistics?`,description:`This clears all recorded tool call and model response latency data. This action cannot be undone.`,onConfirm:Z,confirmLabel:`Reset`,confirmingLabel:`Resetting...`}),e[32]=y,e[33]=Z,e[34]=Q):Q=e[34];let $;return e[35]!==X||e[36]!==Q?($=(0,T.jsxs)(T.Fragment,{children:[X,Q]}),e[35]=X,e[36]=Q,e[37]=$):$=e[37],$}function z(e){return(0,T.jsxs)(m,{className:k,children:[(0,T.jsx)(_,{className:j,children:e.modelId}),(0,T.jsx)(_,{className:M,children:e.requestCount.toLocaleString()}),(0,T.jsx)(_,{className:N,children:I(e.averageDurationMs)})]},e.modelId)}function B(e){return(0,T.jsxs)(m,{className:k,children:[(0,T.jsx)(_,{className:j,children:e.toolName}),(0,T.jsx)(_,{className:M,children:e.callCount.toLocaleString()}),(0,T.jsx)(_,{className:N,children:I(e.averageDurationMs)})]},e.toolName)}function V(e){return(0,T.jsx)(y,{value:e.value,"aria-label":e.label,className:O,children:e.label},e.value)}export{R as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{Dt as i,N as a}from"./dist-CTLFS4dn.js";import{r as o,t as s}from"./button-kWtLAMpB.js";import{Z as c}from"./dist-c_QADQ5u.js";import{dn as l,ut as u}from"./api-DX1ny6q-.js";import{n as d}from"./use-toast-xpb5jNtN.js";import{Ot as f}from"./index-B3-5kIOf.js";import{t as p}from"./delete-confirm-dialog-Dl76vaxb.js";import{a as m,i as h,n as g,r as _,t as v}from"./table-A3cgauiZ.js";import{n as y,t as ee}from"./toggle-group-Q36wRGKA.js";var b=t(),x=e(n(),1),S=a(`app.use-latency-stats.hook`),C={tools:[],models:[]};function w(){let[e,t]=(0,x.useState)([]),[n,r]=(0,x.useState)([]),[i,a]=(0,x.useState)(!0),[o,s]=(0,x.useState)(!1),[c,d]=(0,x.useState)(null),f=(0,x.useCallback)(async function(){try{d(null);let e=await u();t(e.tools??C.tools),r(e.models??C.models)}catch(e){S.error(`Failed to load latency statistics`,e),d(e instanceof Error?e.message:`Failed to load statistics`)}finally{a(!1)}},[]),p=(0,x.useCallback)(async function(){s(!0);try{return d(null),await l(),t(C.tools),r(C.models),!0}catch(e){return S.error(`Failed to reset latency statistics`,e),d(e instanceof Error?e.message:`Failed to reset statistics`),!1}finally{s(!1)}},[]);return(0,x.useEffect)(()=>{f()},[f]),{tools:e,models:n,isLoading:i,isResetting:o,error:c,refresh:f,reset:p}}var T=r(),E=[{value:`tools`,label:`Tools`},{value:`models`,label:`Models`}],D=`inline-flex rounded-full border bg-muted/40 p-1`,O=`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm`,te=`flex items-center gap-2`,ne=`gap-1.5 text-muted-foreground hover:text-foreground`,k=`h-9`,A=`table-fixed`,j=o(i.body,`py-1.5`),M=o(i.body,`w-28 py-1.5 text-right tabular-nums`),N=o(i.body,`w-32 py-1.5 text-right tabular-nums`),P=`h-9 w-28 bg-transparent py-2 text-right`,F=`h-9 w-32 bg-transparent py-2 text-right`;function I(e){if(!Number.isFinite(e)||e<0)return`—`;if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;return t<10?`${t.toFixed(1)}s`:`${Math.round(t)}s`}function L(e){let t=(0,b.c)(3),{view:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=o(`w-full caption-bottom`,A,i.body),t[0]=r):r=t[0];let a;return t[1]===n?a=t[2]:(a=(0,T.jsx)(`table`,{className:r,children:(0,T.jsx)(`thead`,{className:`[&_tr]:border-b [&_tr]:border-table-border`,children:(0,T.jsx)(`tr`,{children:n===`tools`?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(h,{className:`h-9 bg-transparent py-2`,children:`Tool`}),(0,T.jsx)(h,{className:P,children:`Calls`}),(0,T.jsx)(h,{className:F,children:`Latency`})]}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(h,{className:`h-9 bg-transparent py-2`,children:`Model`}),(0,T.jsx)(h,{className:P,children:`Requests`}),(0,T.jsx)(h,{className:F,children:`Latency`})]})})})}),t[1]=n,t[2]=a),a}function R(){let e=(0,b.c)(38),{tools:t,models:n,isLoading:r,isResetting:a,error:l,reset:u}=w(),{toast:m}=d(),[h,_]=(0,x.useState)(`tools`),[y,S]=(0,x.useState)(!1),C=h===`tools`&&!r&&t.length>0,O=h===`models`&&!r&&n.length>0,k=C||O,j=t.length>0||n.length>0,M;e[0]!==u||e[1]!==m?(M=async function(){if(S(!1),await u()){m({title:`Statistics cleared`,description:`All tool and model latency data has been reset.`});return}m({title:`Error`,description:`Failed to reset statistics. Please try again.`,variant:`destructive`})},e[0]=u,e[1]=m,e[2]=M):M=e[2];let N=M,P;e[3]!==k||e[4]!==h?(P=k?(0,T.jsx)(L,{view:h}):void 0,e[3]=k,e[4]=h,e[5]=P):P=e[5];let F;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{(e===`tools`||e===`models`)&&_(e)},e[6]=F):F=e[6];let I;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(I=E.map(V),e[7]=I):I=e[7];let R;e[8]===h?R=e[9]:(R=(0,T.jsx)(ee,{type:`single`,value:h,onValueChange:F,"aria-label":`Statistics view`,variant:`outline`,className:D,children:I}),e[8]=h,e[9]=R);let H=r||a||!j,U,W;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>S(!0),W=(0,T.jsx)(c,{}),e[10]=U,e[11]=W):(U=e[10],W=e[11]);let G=a?`Resetting...`:`Reset`,K;e[12]!==H||e[13]!==G?(K=(0,T.jsxs)(s,{variant:`outline`,size:`sm`,className:ne,disabled:H,onClick:U,children:[W,G]}),e[12]=H,e[13]=G,e[14]=K):K=e[14];let q;e[15]!==R||e[16]!==K?(q=(0,T.jsxs)(`div`,{className:te,children:[R,K]}),e[15]=R,e[16]=K,e[17]=q):q=e[17];let J;e[18]===l?J=e[19]:(J=l?(0,T.jsx)(`p`,{className:o(i.bodyMuted,`mb-6 text-destructive`),children:l}):null,e[18]=l,e[19]=J);let Y;e[20]!==r||e[21]!==n||e[22]!==t||e[23]!==h?(Y=h===`tools`?r?(0,T.jsx)(`p`,{className:i.bodyMuted,children:`Loading…`}):t.length===0?(0,T.jsx)(`p`,{className:i.bodyMuted,children:`No tool call timings recorded yet. Stats appear after agent tool calls complete.`}):(0,T.jsx)(v,{className:A,children:(0,T.jsx)(g,{children:t.map(B)})}):r?(0,T.jsx)(`p`,{className:i.bodyMuted,children:`Loading…`}):n.length===0?(0,T.jsx)(`p`,{className:i.bodyMuted,children:`No model timings recorded yet. Stats appear after assistant responses complete.`}):(0,T.jsx)(v,{className:A,children:(0,T.jsx)(g,{children:n.map(z)})}),e[20]=r,e[21]=n,e[22]=t,e[23]=h,e[24]=Y):Y=e[24];let X;e[25]!==P||e[26]!==q||e[27]!==J||e[28]!==Y?(X=(0,T.jsxs)(f,{title:`Statistics`,description:`Average latency and request counts for tool calls and model responses.`,tableHeader:P,action:q,children:[J,Y]}),e[25]=P,e[26]=q,e[27]=J,e[28]=Y,e[29]=X):X=e[29];let Z;e[30]===N?Z=e[31]:(Z=()=>void N(),e[30]=N,e[31]=Z);let Q;e[32]!==y||e[33]!==Z?(Q=(0,T.jsx)(p,{open:y,onOpenChange:S,title:`Reset statistics?`,description:`This clears all recorded tool call and model response latency data. This action cannot be undone.`,onConfirm:Z,confirmLabel:`Reset`,confirmingLabel:`Resetting...`}),e[32]=y,e[33]=Z,e[34]=Q):Q=e[34];let $;return e[35]!==X||e[36]!==Q?($=(0,T.jsxs)(T.Fragment,{children:[X,Q]}),e[35]=X,e[36]=Q,e[37]=$):$=e[37],$}function z(e){return(0,T.jsxs)(m,{className:k,children:[(0,T.jsx)(_,{className:j,children:e.modelId}),(0,T.jsx)(_,{className:M,children:e.requestCount.toLocaleString()}),(0,T.jsx)(_,{className:N,children:I(e.averageDurationMs)})]},e.modelId)}function B(e){return(0,T.jsxs)(m,{className:k,children:[(0,T.jsx)(_,{className:j,children:e.toolName}),(0,T.jsx)(_,{className:M,children:e.callCount.toLocaleString()}),(0,T.jsx)(_,{className:N,children:I(e.averageDurationMs)})]},e.toolName)}function V(e){return(0,T.jsx)(y,{value:e.value,"aria-label":e.label,className:O,children:e.label},e.value)}export{R as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{Dt as i,c as a}from"./dist-CTLFS4dn.js";import{W as o,Y as s,r as c}from"./store-BSzKIu5G.js";import{m as l,r as u,t as d}from"./button-kWtLAMpB.js";import{D as f,Hn as p,Ot as m,zn as h}from"./dist-c_QADQ5u.js";import{i as g,n as _,t as v}from"./tooltip-Db8UeYxm.js";import{n as y}from"./use-toast-xpb5jNtN.js";import{n as ee}from"./async-loading-fallback-V0EaQ_Kn.js";import{Bn as te,Dt as ne,Mn as re,P as ie,et as ae,yt as oe}from"./index-B3-5kIOf.js";import{t as se}from"./delete-confirm-dialog-Dl76vaxb.js";import{i as ce,r as b}from"./table-A3cgauiZ.js";import{t as le}from"./settings-list-DiiYzOxn.js";var x=t(),S=e(n(),1),C=r(),ue=36,de=`table-fixed`,fe=`h-9 w-48 bg-transparent py-2`,pe=`h-9 bg-transparent py-2`,me=`h-9 w-32 bg-transparent py-2`,he=`h-9 w-10 bg-transparent py-2`,ge=u(i.bodyMuted,`w-48 truncate py-1.5`),_e=u(i.body,`truncate py-1.5`),ve=u(i.bodyMuted,`w-32 truncate py-1.5`),ye=`w-10 py-1.5`,be={column:`project`,direction:`asc`};function xe(e){let t=(0,x.c)(4),n;if(t[0]!==e){let{style:r,...a}=e,o;t[2]===r?o=t[3]:(o={...r,width:`100%`},t[2]=r,t[3]=o),n=(0,C.jsx)(`table`,{...a,style:o,className:u(`w-full caption-bottom`,de,i.body,a.className)}),t[0]=e,t[1]=n}else n=t[1];return n}function Se(e){let t=(0,x.c)(5),n;t[0]===e.className?n=t[1]:(n=u(`hidden`,e.className),t[0]=e.className,t[1]=n);let r;return t[2]!==e||t[3]!==n?(r=(0,C.jsx)(`thead`,{...e,className:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r}function Ce(e){let t=(0,x.c)(5),n;t[0]===e.className?n=t[1]:(n=u(`[&_tr:last-child]:border-0`,e.className),t[0]=e.className,t[1]=n);let r;return t[2]!==e||t[3]!==n?(r=(0,C.jsx)(`tbody`,{...e,className:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r}function we(e){let t=(0,x.c)(5),n;t[0]===e.className?n=t[1]:(n=u(`frosted-scrollbar`,e.className),t[0]=e.className,t[1]=n);let r;return t[2]!==e||t[3]!==n?(r=(0,C.jsx)(`div`,{...e,className:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r}function w(e,t){return t?a(t,e):e}function T(e,t,n){switch(t){case`project`:return e.projectName;case`path`:return w(e.path,n);case`branch`:return e.branch}}function Te(e){let t=[];for(let n of e){let e=l(n);for(let r of n.threads)t.push({threadId:r.threadId,projectId:n.projectId,projectName:e,path:r.path,branch:r.currentBranch||r.title})}return t}function Ee(e,t,n,r){return[...e].sort((e,i)=>{let a=T(e,t,r).localeCompare(T(i,t,r),void 0,{sensitivity:`base`});return n===`asc`?a:-a})}function E(e){let t=(0,x.c)(17),{label:n,column:r,sortColumn:i,sortDirection:a,className:o,onSort:s}=e,c=i===r,l=a===`asc`?h:p,d=c?`text-foreground`:`text-muted-foreground`,f;t[0]===d?f=t[1]:(f=u(`inline-flex items-center gap-1 transition-colors hover:text-foreground`,d),t[0]=d,t[1]=f);let m;t[2]!==r||t[3]!==s?(m=()=>s(r),t[2]=r,t[3]=s,t[4]=m):m=t[4];let g=c?a===`asc`?`ascending`:`descending`:`none`,_;t[5]!==l||t[6]!==c?(_=c?(0,C.jsx)(l,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}):null,t[5]=l,t[6]=c,t[7]=_):_=t[7];let v;t[8]!==n||t[9]!==f||t[10]!==m||t[11]!==g||t[12]!==_?(v=(0,C.jsxs)(`button`,{type:`button`,className:f,onClick:m,"aria-sort":g,children:[n,_]}),t[8]=n,t[9]=f,t[10]=m,t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;return t[14]!==o||t[15]!==v?(y=(0,C.jsx)(ce,{className:o,children:v}),t[14]=o,t[15]=v,t[16]=y):y=t[16],y}function D(){let e=(0,x.c)(55),t=c(Fe),n=c(Pe),r=c(Ne),a=c(Me),o=c(je),l=c(Ae),p=c(ke),h=c(Oe),{handleDeleteThread:T,refreshWorkspaces:D}=te(),{toast:O}=y(),[k,Ie]=(0,S.useState)(null),[A,Le]=(0,S.useState)(be),Re=ie()?`Finder`:`Explorer`,j,M;e[0]===D?(j=e[1],M=e[2]):(j=()=>{D()},M=[D],e[0]=D,e[1]=j,e[2]=M),(0,S.useEffect)(j,M);let N;e[3]!==n||e[4]!==t||e[5]!==A.column||e[6]!==A.direction?(N=Ee(Te(t),A.column,A.direction,n),e[3]=n,e[4]=t,e[5]=A.column,e[6]=A.direction,e[7]=N):N=e[7];let P=N,F;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){Le(t=>t.column===e?{column:e,direction:t.direction===`asc`?`desc`:`asc`}:{column:e,direction:`asc`})},e[8]=F):F=e[8];let ze=F,I;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){let{...t}=e;return(0,C.jsx)(`tr`,{...t,className:u(`group border-0 transition-colors hover:bg-muted/50`,t.className)})},e[9]=I):I=e[9];let Be=I,L;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(L={Table:xe,TableHead:Se,TableBody:Ce,TableRow:Be,Scroller:we},e[10]=L):L=e[10];let Ve=L,R;e[11]!==T||e[12]!==k?(R=function(){if(!k)return;let{projectId:e,threadId:t}=k;Ie(null),T(e,t)},e[11]=T,e[12]=k,e[13]=R):R=e[13];let He=R,z;e[14]===O?z=e[15]:(z=async function(e){try{await ae(e.threadId,`.`)}catch{O({title:`Error`,description:`Failed to open folder in ${Re}.`,variant:`destructive`})}},e[14]=O,e[15]=z);let Ue=z,B;e[16]!==n||e[17]!==l||e[18]!==a||e[19]!==Ue||e[20]!==h||e[21]!==o||e[22]!==p?(B=function(e,t){let r=a.includes(t.threadId),c=s(t.threadId,o,p,h),y=l.includes(t.threadId),ee=!c&&!r&&!y,te=w(t.path,n);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(b,{className:ge,children:t.projectName}),(0,C.jsx)(b,{className:_e,children:(0,C.jsx)(`button`,{type:`button`,className:u(i.body,`block w-full truncate text-left hover:underline`),title:`${t.path}\nOpen in ${Re}`,onClick:()=>void Ue(t),children:te})}),(0,C.jsx)(b,{className:ve,children:t.branch}),(0,C.jsx)(b,{className:ye,children:(0,C.jsx)(`div`,{className:`ml-auto flex h-7 w-7 items-center justify-center`,children:r?(0,C.jsx)(m,{className:`h-4 w-4 animate-spin text-muted-foreground`,"aria-label":`Deleting`}):ee?(0,C.jsxs)(v,{children:[(0,C.jsx)(g,{asChild:!0,children:(0,C.jsxs)(d,{variant:`ghost`,size:`icon-sm`,className:le,onClick:e=>{e.stopPropagation(),Ie(t)},children:[(0,C.jsx)(f,{}),(0,C.jsx)(`span`,{className:`sr-only`,children:`Delete workspace`})]})}),(0,C.jsx)(_,{side:`left`,children:`Delete branch and files from the repo`})]}):null})})]})},e[16]=n,e[17]=l,e[18]=a,e[19]=Ue,e[20]=h,e[21]=o,e[22]=p,e[23]=B):B=e[23];let We=B,V;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(V=u(`w-full caption-bottom`,de,i.body),e[24]=V):V=e[24];let H,U,W;e[25]!==A.column||e[26]!==A.direction?(H=(0,C.jsx)(E,{label:`Project`,column:`project`,sortColumn:A.column,sortDirection:A.direction,className:fe,onSort:ze}),U=(0,C.jsx)(E,{label:`Path`,column:`path`,sortColumn:A.column,sortDirection:A.direction,className:pe,onSort:ze}),W=(0,C.jsx)(E,{label:`Branch`,column:`branch`,sortColumn:A.column,sortDirection:A.direction,className:me,onSort:ze}),e[25]=A.column,e[26]=A.direction,e[27]=H,e[28]=U,e[29]=W):(H=e[27],U=e[28],W=e[29]);let G;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,C.jsx)(ce,{className:he,children:(0,C.jsx)(`span`,{className:`sr-only`,children:`Actions`})}),e[30]=G):G=e[30];let K;e[31]!==H||e[32]!==U||e[33]!==W?(K=(0,C.jsx)(`table`,{className:V,children:(0,C.jsx)(`thead`,{className:`[&_tr]:border-b [&_tr]:border-table-border`,children:(0,C.jsxs)(`tr`,{children:[H,U,W,G]})})}),e[31]=H,e[32]=U,e[33]=W,e[34]=K):K=e[34];let Ge=K,Ke=P.length>0?Ge:void 0,q;e[35]===Ke?q=e[36]:(q=(0,C.jsx)(oe,{title:`Storage`,description:`Workspaces and branches stored on disk across all projects.`,tableHeader:Ke}),e[35]=Ke,e[36]=q);let J;e[37]!==r||e[38]!==We||e[39]!==P?(J=(0,C.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:r&&P.length===0?(0,C.jsx)(ee,{label:`Loading workspaces...`,size:`lg`}):P.length===0?(0,C.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,C.jsxs)(`div`,{className:`max-w-md space-y-2 text-center`,children:[(0,C.jsx)(`h3`,{className:i.emptyStateTitle,children:`No workspaces`}),(0,C.jsx)(`p`,{className:i.bodyMuted,children:`No branches or workspaces found yet.`})]})}):(0,C.jsx)(re,{style:{height:`100%`},data:P,computeItemKey:De,itemContent:We,defaultItemHeight:ue,increaseViewportBy:ue*5,components:Ve})}),e[37]=r,e[38]=We,e[39]=P,e[40]=J):J=e[40];let Y;e[41]!==q||e[42]!==J?(Y=(0,C.jsxs)(ne,{className:`flex w-full max-w-none min-w-0 min-h-0 flex-1 flex-col pb-0 pt-0`,children:[q,J]}),e[41]=q,e[42]=J,e[43]=Y):Y=e[43];let qe=k!==null,X;e[44]===Symbol.for(`react.memo_cache_sentinel`)?(X=e=>{e||Ie(null)},e[44]=X):X=e[44];let Z;e[45]!==n||e[46]!==k?(Z=k?`Are you sure you want to delete the workspace at "${w(k.path,n)}"? This removes the branch and all its files. This action cannot be undone.`:``,e[45]=n,e[46]=k,e[47]=Z):Z=e[47];let Q;e[48]!==He||e[49]!==qe||e[50]!==Z?(Q=(0,C.jsx)(se,{open:qe,onOpenChange:X,title:`Delete workspace?`,description:Z,onConfirm:He,confirmLabel:`Delete`,confirmingLabel:`Deleting...`}),e[48]=He,e[49]=qe,e[50]=Z,e[51]=Q):Q=e[51];let $;return e[52]!==Y||e[53]!==Q?($=(0,C.jsxs)(`div`,{className:`flex h-full min-h-0 w-full min-w-0 flex-1 flex-col`,children:[Y,Q]}),e[52]=Y,e[53]=Q,e[54]=$):$=e[54],$}function De(e,t){return t.threadId}function Oe(e){return e.pendingChatMessage}function ke(e){return o(e.threadStreamingStates)}function Ae(e){return e.completedThreadIds}function je(e){return e.processingThreadIds}function Me(e){return e.deletingThreadIds}function Ne(e){return e.projectsLoading}function Pe(e){return e.cloneRootPath}function Fe(e){return e.projects}export{D as default};
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{Dt as r}from"./dist-CTLFS4dn.js";import{r as i,t as a}from"./button-kWtLAMpB.js";import{Pt as o,S as s}from"./dist-c_QADQ5u.js";import{i as c,n as l,r as u,t as d}from"./tooltip-Db8UeYxm.js";import{Tn as f,cr as p,tr as m,w as h}from"./api-DX1ny6q-.js";import{t as g}from"./use-toast-xpb5jNtN.js";import{Et as _,Jn as v,Ot as y,St as b,Tt as x,_t as S,fr as C,gt as w,ht as T,kt as E,mr as D,pr as O,vt as k}from"./index-u8UbWjXL.js";import{t as A}from"./delete-confirm-dialog-Dl76vaxb.js";import{t as j}from"./use-settings-page-loading-BTySlInF.js";import{a as M,i as N,r as P}from"./settings-list-B9a61wMg.js";import{t as F}from"./use-installed-ai-files-BuuVI3sM.js";import{i as I,n as L,r as R}from"./slug-utils-CQ8PMWUL.js";var z=e(t(),1),B=n();function V({threadId:e,onAgentCreated:t}){let[n,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1),f=R(n),p=L(f),m=async()=>{if(!(!p||!o.trim()||!e)){d(!0);try{let n=await h(e,f,o.trim(),c.trim()||void 0);g({title:`Agent created`,description:`Agent '${f}' was created successfully.`}),a(``),s(``),l(``),t?.(n.path,`AGENTS.md`)}catch(e){g({title:`Error`,description:e instanceof Error?e.message:`Failed to create agent`,variant:`destructive`})}finally{d(!1)}}};return e?(0,B.jsx)(y,{children:(0,B.jsxs)(T,{children:[(0,B.jsx)(k,{title:`Add Agent`,description:`Saved as AGENT.md in .agents/agents.`,sticky:!0,className:`pr-10`}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(w,{title:`Agent Name`,controlLayout:`stack`,className:`pt-6`,children:[(0,B.jsx)(C,{id:`agentName`,value:n,onChange:e=>a(e.target.value),placeholder:`e.g. Code Reviewer`,disabled:u}),n?(0,B.jsxs)(`p`,{className:i(r.caption,`mt-2`),children:[`Folder name: `,(0,B.jsx)(`span`,{className:`font-mono`,children:f||`...`})]}):null]}),(0,B.jsx)(w,{title:`Description`,controlLayout:`stack`,className:`pt-6`,children:(0,B.jsx)(v,{id:`agentDescription`,value:o,onChange:e=>s(e.target.value),placeholder:`Describe the agent's purpose and behavior...`,className:`resize-none min-h-[120px]`,disabled:u})}),(0,B.jsx)(w,{title:`Tools`,description:`Optional space-separated list of tools this agent can use`,controlLayout:`stack`,className:`pt-6`,children:(0,B.jsx)(C,{id:`agentTools`,value:c,onChange:e=>l(e.target.value),placeholder:`e.g. read grep glob`,disabled:u})}),(0,B.jsx)(I,{onContinue:()=>void m(),disabled:!p||!o.trim(),creating:u})]})]})}):(0,B.jsx)(x,{title:`No thread selected`,children:`Please select a thread to add an agent.`})}function H(e){let t=[];for(let n of e)n.path.startsWith(`.agents/agents/`)&&n.type===`folder`&&t.push(n),n.children&&n.children.length>0&&t.push(...H(n.children));return t}function U(){let{selectedProjectId:e,selectedThreadId:t,items:n,loading:h,deleteConfirm:v,setDeleteConfirm:y,deleting:C,installedFilePaths:w,setInstalledFilePaths:T,loadItems:I,handleDelete:L,handleOpenInExplorer:R,triggerExplorerRefresh:U}=F({findItems:H,installedPathSuffix:`/AGENT.md`,explorerPathSuffix:`/AGENT.md`,sortByName:!0,removedToastTitle:`Agent removed`}),[W,G]=(0,z.useState)(!1),[K,q]=(0,z.useState)([]),[J,Y]=(0,z.useState)(!0),[X,Z]=(0,z.useState)(``);(0,z.useEffect)(()=>{Y(!0),m().then(q).catch(()=>q([])).finally(()=>Y(!1))},[]);let Q=j(e?`${e}:${t??``}`:null,[h,J]),ee=(0,z.useCallback)(async e=>{let n=`.agents/agents/${e.id}/AGENT.md`;if(!(!t||w.has(n)))try{if(e.gitHubRepo&&e.gitHubFolder)await p(t,e.gitHubRepo,e.gitHubFolder,`.agents/agents/${e.id}`);else{let r=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.tools&&r.push(`tools: ${e.tools}`),r.push(`---`,``,e.systemPrompt),await f(t,n,r.join(`
2
- `))}T(e=>new Set(e).add(n)),U(),I(),g({title:`Agent installed`,description:e.name})}catch(e){g({title:`Error`,description:e instanceof Error?e.message:`Failed to install agent`,variant:`destructive`})}},[t,w,U,I]),$=X.trim()?K.filter(e=>e.name.toLowerCase().includes(X.toLowerCase())||e.description.toLowerCase().includes(X.toLowerCase())):K;return e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(b,{loading:Q,children:[(0,B.jsxs)(E,{className:`shrink-0`,children:[(0,B.jsx)(k,{title:(0,B.jsx)(u,{children:(0,B.jsxs)(d,{children:[(0,B.jsx)(c,{asChild:!0,children:(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Installed Subagents`,(0,B.jsx)(o,{"aria-hidden":`true`,className:`h-4 w-4 text-muted-foreground`})]})}),(0,B.jsx)(l,{children:`Project subagents available for focused tasks.`})]})}),action:(0,B.jsx)(a,{onClick:()=>G(!0),disabled:!t,children:`Add Subagent`}),sticky:!1}),(0,B.jsxs)(_,{className:`pt-6`,children:[!t&&(0,B.jsx)(S,{children:`Select a thread to add or install subagents.`}),(0,B.jsx)(P,{showHeader:!1,loading:!1,items:n,emptyState:{icon:s,title:`No subagents installed`,description:`Add subagents for specialized, focused tasks.`,bordered:!1},getKey:e=>e.id,columnsClassName:`grid-cols-[minmax(0,1fr)_1.75rem]`,renderContent:e=>(0,B.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,B.jsx)(`div`,{className:i(r.body,`truncate`),children:e.name}),(0,B.jsx)(`div`,{className:i(r.compact,`truncate text-muted-foreground`),children:e.path})]}),onItemClick:e=>R(e.path),itemClickLabel:e=>`Open ${e.name} in Files`,onDelete:y,deleteAriaLabel:e=>`Delete ${e.name}`,deleteTooltip:`Remove this subagent from the project`})]})]}),(0,B.jsxs)(E,{className:`shrink-0`,children:[(0,B.jsx)(k,{title:(0,B.jsx)(u,{children:(0,B.jsxs)(d,{children:[(0,B.jsx)(c,{asChild:!0,children:(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Available Subagents`,(0,B.jsx)(o,{"aria-hidden":`true`,className:`h-4 w-4 text-muted-foreground`})]})}),(0,B.jsx)(l,{children:`Browse and install subagents from the catalog.`})]})}),action:(0,B.jsx)(M,{placeholder:`Search`,value:X,onChange:Z,className:`mb-0 w-64`}),sticky:!1}),(0,B.jsx)(_,{className:`pt-6`,children:$.length===0?(0,B.jsx)(N,{searchQuery:X,emptyLabel:`No available subagents found.`}):(0,B.jsx)(`div`,{className:`divide-y divide-table-border`,children:$.map(e=>{let n=`.agents/agents/${e.id}/AGENT.md`,o=w.has(n);return(0,B.jsxs)(`div`,{className:`group flex min-h-13 items-center justify-between gap-3 px-3 py-3 hover:bg-muted/30`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,B.jsx)(`div`,{className:i(r.body,`truncate`),children:e.name}),(0,B.jsx)(`div`,{className:i(r.compact,`truncate text-muted-foreground`),children:e.description})]}),(0,B.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,className:`opacity-100 transition-opacity can-hover:opacity-0 can-hover:group-hover:opacity-100 focus-visible:opacity-100`,disabled:!t||o,onClick:()=>void ee(e),children:o?`Installed`:`Install`})]},e.id)})})})]})]}),(0,B.jsx)(O,{open:W,onOpenChange:G,children:(0,B.jsx)(D,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,B.jsx)(V,{threadId:t,onAgentCreated:()=>{G(!1),I(),U()}})})}),(0,B.jsx)(A,{open:v!==null,onOpenChange:e=>!e&&y(null),title:`Delete Subagent`,description:`Are you sure you want to delete the subagent "${v?.name}"? This action cannot be undone.`,onConfirm:()=>{v&&L(v)},confirming:C})]}):(0,B.jsx)(x,{children:`Select a project to manage subagents.`})}export{U as SettingsSubagentsView,U as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{Dt as r}from"./dist-CTLFS4dn.js";import{r as i,t as a}from"./button-kWtLAMpB.js";import{Pt as o,S as s}from"./dist-c_QADQ5u.js";import{i as c,n as l,r as u,t as d}from"./tooltip-Db8UeYxm.js";import{Tn as f,cr as p,tr as m,w as h}from"./api-DX1ny6q-.js";import{t as g}from"./use-toast-xpb5jNtN.js";import{At as _,Ct as v,Dt as y,Et as b,Jn as x,_t as S,fr as C,gt as w,kt as T,mr as E,pr as D,vt as O,yt as k}from"./index-B3-5kIOf.js";import{t as A}from"./delete-confirm-dialog-Dl76vaxb.js";import{t as j}from"./use-settings-page-loading-BTySlInF.js";import{a as M,i as N,r as P}from"./settings-list-DiiYzOxn.js";import{t as F}from"./use-installed-ai-files-C8nNWGC7.js";import{i as I,n as L,r as R}from"./slug-utils-CQ8PMWUL.js";var z=e(t(),1),B=n();function V({threadId:e,onAgentCreated:t}){let[n,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1),f=R(n),p=L(f),m=async()=>{if(!(!p||!o.trim()||!e)){d(!0);try{let n=await h(e,f,o.trim(),c.trim()||void 0);g({title:`Agent created`,description:`Agent '${f}' was created successfully.`}),a(``),s(``),l(``),t?.(n.path,`AGENTS.md`)}catch(e){g({title:`Error`,description:e instanceof Error?e.message:`Failed to create agent`,variant:`destructive`})}finally{d(!1)}}};return e?(0,B.jsx)(T,{children:(0,B.jsxs)(w,{children:[(0,B.jsx)(k,{title:`Add Agent`,description:`Saved as AGENT.md in .agents/agents.`,sticky:!0,className:`pr-10`}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(S,{title:`Agent Name`,controlLayout:`stack`,className:`pt-6`,children:[(0,B.jsx)(C,{id:`agentName`,value:n,onChange:e=>a(e.target.value),placeholder:`e.g. Code Reviewer`,disabled:u}),n?(0,B.jsxs)(`p`,{className:i(r.caption,`mt-2`),children:[`Folder name: `,(0,B.jsx)(`span`,{className:`font-mono`,children:f||`...`})]}):null]}),(0,B.jsx)(S,{title:`Description`,controlLayout:`stack`,className:`pt-6`,children:(0,B.jsx)(x,{id:`agentDescription`,value:o,onChange:e=>s(e.target.value),placeholder:`Describe the agent's purpose and behavior...`,className:`resize-none min-h-[120px]`,disabled:u})}),(0,B.jsx)(S,{title:`Tools`,description:`Optional space-separated list of tools this agent can use`,controlLayout:`stack`,className:`pt-6`,children:(0,B.jsx)(C,{id:`agentTools`,value:c,onChange:e=>l(e.target.value),placeholder:`e.g. read grep glob`,disabled:u})}),(0,B.jsx)(I,{onContinue:()=>void m(),disabled:!p||!o.trim(),creating:u})]})]})}):(0,B.jsx)(b,{title:`No thread selected`,children:`Please select a thread to add an agent.`})}function H(e){let t=[];for(let n of e)n.path.startsWith(`.agents/agents/`)&&n.type===`folder`&&t.push(n),n.children&&n.children.length>0&&t.push(...H(n.children));return t}function U(){let{selectedProjectId:e,selectedThreadId:t,items:n,loading:h,deleteConfirm:x,setDeleteConfirm:S,deleting:C,installedFilePaths:w,setInstalledFilePaths:T,loadItems:I,handleDelete:L,handleOpenInExplorer:R,triggerExplorerRefresh:U}=F({findItems:H,installedPathSuffix:`/AGENT.md`,explorerPathSuffix:`/AGENT.md`,sortByName:!0,removedToastTitle:`Agent removed`}),[W,G]=(0,z.useState)(!1),[K,q]=(0,z.useState)([]),[J,Y]=(0,z.useState)(!0),[X,Z]=(0,z.useState)(``);(0,z.useEffect)(()=>{Y(!0),m().then(q).catch(()=>q([])).finally(()=>Y(!1))},[]);let Q=j(e?`${e}:${t??``}`:null,[h,J]),ee=(0,z.useCallback)(async e=>{let n=`.agents/agents/${e.id}/AGENT.md`;if(!(!t||w.has(n)))try{if(e.gitHubRepo&&e.gitHubFolder)await p(t,e.gitHubRepo,e.gitHubFolder,`.agents/agents/${e.id}`);else{let r=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.tools&&r.push(`tools: ${e.tools}`),r.push(`---`,``,e.systemPrompt),await f(t,n,r.join(`
2
+ `))}T(e=>new Set(e).add(n)),U(),I(),g({title:`Agent installed`,description:e.name})}catch(e){g({title:`Error`,description:e instanceof Error?e.message:`Failed to install agent`,variant:`destructive`})}},[t,w,U,I]),$=X.trim()?K.filter(e=>e.name.toLowerCase().includes(X.toLowerCase())||e.description.toLowerCase().includes(X.toLowerCase())):K;return e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(v,{loading:Q,children:[(0,B.jsxs)(_,{className:`shrink-0`,children:[(0,B.jsx)(k,{title:(0,B.jsx)(u,{children:(0,B.jsxs)(d,{children:[(0,B.jsx)(c,{asChild:!0,children:(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Installed Subagents`,(0,B.jsx)(o,{"aria-hidden":`true`,className:`h-4 w-4 text-muted-foreground`})]})}),(0,B.jsx)(l,{children:`Project subagents available for focused tasks.`})]})}),action:(0,B.jsx)(a,{onClick:()=>G(!0),disabled:!t,children:`Add Subagent`}),sticky:!1}),(0,B.jsxs)(y,{className:`pt-6`,children:[!t&&(0,B.jsx)(O,{children:`Select a thread to add or install subagents.`}),(0,B.jsx)(P,{showHeader:!1,loading:!1,items:n,emptyState:{icon:s,title:`No subagents installed`,description:`Add subagents for specialized, focused tasks.`,bordered:!1},getKey:e=>e.id,columnsClassName:`grid-cols-[minmax(0,1fr)_1.75rem]`,renderContent:e=>(0,B.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,B.jsx)(`div`,{className:i(r.body,`truncate`),children:e.name}),(0,B.jsx)(`div`,{className:i(r.compact,`truncate text-muted-foreground`),children:e.path})]}),onItemClick:e=>R(e.path),itemClickLabel:e=>`Open ${e.name} in Files`,onDelete:S,deleteAriaLabel:e=>`Delete ${e.name}`,deleteTooltip:`Remove this subagent from the project`})]})]}),(0,B.jsxs)(_,{className:`shrink-0`,children:[(0,B.jsx)(k,{title:(0,B.jsx)(u,{children:(0,B.jsxs)(d,{children:[(0,B.jsx)(c,{asChild:!0,children:(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Available Subagents`,(0,B.jsx)(o,{"aria-hidden":`true`,className:`h-4 w-4 text-muted-foreground`})]})}),(0,B.jsx)(l,{children:`Browse and install subagents from the catalog.`})]})}),action:(0,B.jsx)(M,{placeholder:`Search`,value:X,onChange:Z,className:`mb-0 w-64`}),sticky:!1}),(0,B.jsx)(y,{className:`pt-6`,children:$.length===0?(0,B.jsx)(N,{searchQuery:X,emptyLabel:`No available subagents found.`}):(0,B.jsx)(`div`,{className:`divide-y divide-table-border`,children:$.map(e=>{let n=`.agents/agents/${e.id}/AGENT.md`,o=w.has(n);return(0,B.jsxs)(`div`,{className:`group flex min-h-13 items-center justify-between gap-3 px-3 py-3 hover:bg-muted/30`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,B.jsx)(`div`,{className:i(r.body,`truncate`),children:e.name}),(0,B.jsx)(`div`,{className:i(r.compact,`truncate text-muted-foreground`),children:e.description})]}),(0,B.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,className:`opacity-100 transition-opacity can-hover:opacity-0 can-hover:group-hover:opacity-100 focus-visible:opacity-100`,disabled:!t||o,onClick:()=>void ee(e),children:o?`Installed`:`Install`})]},e.id)})})})]})]}),(0,B.jsx)(D,{open:W,onOpenChange:G,children:(0,B.jsx)(E,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,B.jsx)(V,{threadId:t,onAgentCreated:()=>{G(!1),I(),U()}})})}),(0,B.jsx)(A,{open:x!==null,onOpenChange:e=>!e&&S(null),title:`Delete Subagent`,description:`Are you sure you want to delete the subagent "${x?.name}"? This action cannot be undone.`,onConfirm:()=>{x&&L(x)},confirming:C})]}):(0,B.jsx)(b,{children:`Select a project to manage subagents.`})}export{U as SettingsSubagentsView,U as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{Dt as r}from"./dist-CTLFS4dn.js";import{r as i}from"./store-BSzKIu5G.js";import{r as a,t as ee}from"./button-kWtLAMpB.js";import{Ot as o}from"./dist-c_QADQ5u.js";import{i as s,n as c,t as l}from"./tooltip-Db8UeYxm.js";import{Jt as u,Kn as d,Tt as f}from"./api-DX1ny6q-.js";import{t as p}from"./use-toast-xpb5jNtN.js";import{a as m,c as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./alert-dialog-BxMfaLuO.js";import{Et as S,Jn as C,Tt as w,bt as T,ot as E,vt as D,xt as O}from"./index-u8UbWjXL.js";import{t as k}from"./use-settings-page-loading-BTySlInF.js";var A=e(t(),1),j=n();function M(){let e=i(e=>e.selectedProjectId),[t,n]=(0,A.useState)(``),[M,N]=(0,A.useState)(``),[P,F]=(0,A.useState)(!0),[I,L]=(0,A.useState)(!1),[R,z]=(0,A.useState)(``),[B,V]=(0,A.useState)(!0),[H,U]=(0,A.useState)(!1),[W,G]=(0,A.useState)(!1);(0,A.useLayoutEffect)(()=>{e&&V(!0)},[e]),(0,A.useEffect)(()=>{if(!e){V(!1);return}V(!0),f(e).then(e=>{let t=e.useCustomSystemPrompt;n(e.generatedPrompt),L(t),z(e.customSystemPrompt),F(!t),N(t?e.customSystemPrompt:e.generatedPrompt)}).catch(()=>{n(``),N(``),F(!0),L(!1),z(``)}).finally(()=>V(!1))},[e]);let K=k(e,[B]);function q(){return P?I:M.trim()!==R.trim()}function J(e){N(e),P&&F(!1)}function Y(){N(t),F(!0)}function X(e){if(!e){F(!1);return}if(M===t){Y();return}G(!0)}function Z(){Y(),G(!1)}function Q(){G(!1)}async function $(){if(e){if(!P&&!M.trim()){p({title:`System prompt required`,description:`Enter a system prompt or enable Generated.`,variant:`destructive`});return}U(!0);try{await d(e,{customSystemPrompt:P?null:M.trim(),useCustomSystemPrompt:!P}),u(),L(!P),z(P?``:M.trim()),p({title:`System prompt settings saved`})}catch(e){p({title:`Error`,description:e instanceof Error?e.message:`Failed to save system prompt settings`,variant:`destructive`})}finally{U(!1)}}}return e?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(O,{loading:K,children:(0,j.jsx)(T,{children:(0,j.jsxs)(S,{className:`w-full flex-1 flex flex-col min-h-0 pt-0`,children:[(0,j.jsx)(D,{title:`System Prompt`,description:`View the default system prompt or override it for this project.`,sticky:!1,action:(0,j.jsx)(ee,{onClick:$,disabled:H||!q(),children:H?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})}),(0,j.jsxs)(`div`,{className:`mb-4 flex w-full items-center justify-end gap-2`,children:[(0,j.jsxs)(l,{children:[(0,j.jsx)(s,{asChild:!0,children:(0,j.jsx)(`span`,{tabIndex:0,className:a(r.label,`cursor-help`),children:`Generated`})}),(0,j.jsx)(c,{side:`top`,className:`max-w-xs`,children:`Use the auto-generated system prompt instead of a custom override.`})]}),(0,j.jsx)(E,{value:P,onChange:X,disabled:H,ariaLabel:`Generated system prompt`})]}),(0,j.jsx)(C,{value:M,onChange:e=>J(e.target.value),className:a(r.mono,`flex-1 min-h-0 resize-none`),placeholder:`System prompt will appear here...`,disabled:H})]})})}),(0,j.jsx)(x,{open:W,onOpenChange:G,children:(0,j.jsxs)(g,{children:[(0,j.jsxs)(b,{children:[(0,j.jsx)(h,{children:`Overwrite custom system prompt?`}),(0,j.jsx)(m,{children:`This will replace your custom system prompt with the generated default. You can save the change after confirming.`})]}),(0,j.jsxs)(v,{children:[(0,j.jsx)(y,{onClick:Q,children:`No`}),(0,j.jsx)(_,{onClick:Z,children:`Yes`})]})]})})]}):(0,j.jsx)(w,{children:`Select a project to edit the system prompt.`})}export{M as SettingsSystemPromptView,M as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{Dt as r}from"./dist-CTLFS4dn.js";import{r as i}from"./store-BSzKIu5G.js";import{r as a,t as ee}from"./button-kWtLAMpB.js";import{Ot as o}from"./dist-c_QADQ5u.js";import{i as s,n as c,t as l}from"./tooltip-Db8UeYxm.js";import{Jt as u,Kn as d,Tt as f}from"./api-DX1ny6q-.js";import{t as p}from"./use-toast-xpb5jNtN.js";import{a as m,c as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./alert-dialog-BxMfaLuO.js";import{Dt as S,Et as C,Jn as w,St as T,st as E,xt as D,yt as O}from"./index-B3-5kIOf.js";import{t as k}from"./use-settings-page-loading-BTySlInF.js";var A=e(t(),1),j=n();function M(){let e=i(e=>e.selectedProjectId),[t,n]=(0,A.useState)(``),[M,N]=(0,A.useState)(``),[P,F]=(0,A.useState)(!0),[I,L]=(0,A.useState)(!1),[R,z]=(0,A.useState)(``),[B,V]=(0,A.useState)(!0),[H,U]=(0,A.useState)(!1),[W,G]=(0,A.useState)(!1);(0,A.useLayoutEffect)(()=>{e&&V(!0)},[e]),(0,A.useEffect)(()=>{if(!e){V(!1);return}V(!0),f(e).then(e=>{let t=e.useCustomSystemPrompt;n(e.generatedPrompt),L(t),z(e.customSystemPrompt),F(!t),N(t?e.customSystemPrompt:e.generatedPrompt)}).catch(()=>{n(``),N(``),F(!0),L(!1),z(``)}).finally(()=>V(!1))},[e]);let K=k(e,[B]);function q(){return P?I:M.trim()!==R.trim()}function J(e){N(e),P&&F(!1)}function Y(){N(t),F(!0)}function X(e){if(!e){F(!1);return}if(M===t){Y();return}G(!0)}function Z(){Y(),G(!1)}function Q(){G(!1)}async function $(){if(e){if(!P&&!M.trim()){p({title:`System prompt required`,description:`Enter a system prompt or enable Generated.`,variant:`destructive`});return}U(!0);try{await d(e,{customSystemPrompt:P?null:M.trim(),useCustomSystemPrompt:!P}),u(),L(!P),z(P?``:M.trim()),p({title:`System prompt settings saved`})}catch(e){p({title:`Error`,description:e instanceof Error?e.message:`Failed to save system prompt settings`,variant:`destructive`})}finally{U(!1)}}}return e?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(T,{loading:K,children:(0,j.jsx)(D,{children:(0,j.jsxs)(S,{className:`w-full flex-1 flex flex-col min-h-0 pt-0`,children:[(0,j.jsx)(O,{title:`System Prompt`,description:`View the default system prompt or override it for this project.`,sticky:!1,action:(0,j.jsx)(ee,{onClick:$,disabled:H||!q(),children:H?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})}),(0,j.jsxs)(`div`,{className:`mb-4 flex w-full items-center justify-end gap-2`,children:[(0,j.jsxs)(l,{children:[(0,j.jsx)(s,{asChild:!0,children:(0,j.jsx)(`span`,{tabIndex:0,className:a(r.label,`cursor-help`),children:`Generated`})}),(0,j.jsx)(c,{side:`top`,className:`max-w-xs`,children:`Use the auto-generated system prompt instead of a custom override.`})]}),(0,j.jsx)(E,{value:P,onChange:X,disabled:H,ariaLabel:`Generated system prompt`})]}),(0,j.jsx)(w,{value:M,onChange:e=>J(e.target.value),className:a(r.mono,`flex-1 min-h-0 resize-none`),placeholder:`System prompt will appear here...`,disabled:H})]})})}),(0,j.jsx)(x,{open:W,onOpenChange:G,children:(0,j.jsxs)(g,{children:[(0,j.jsxs)(b,{children:[(0,j.jsx)(h,{children:`Overwrite custom system prompt?`}),(0,j.jsx)(m,{children:`This will replace your custom system prompt with the generated default. You can save the change after confirming.`})]}),(0,j.jsxs)(v,{children:[(0,j.jsx)(y,{onClick:Q,children:`No`}),(0,j.jsx)(_,{onClick:Z,children:`Yes`})]})]})})]}):(0,j.jsx)(C,{children:`Select a project to edit the system prompt.`})}export{M as SettingsSystemPromptView,M as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/settings-general-view-BhrfHGfQ.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-B3-5kIOf.js","assets/react-vendor-Ee0-5T4I.js","assets/alert-dialog-BxMfaLuO.js","assets/button-kWtLAMpB.js","assets/dist-CTLFS4dn.js","assets/use-browser-overlay-block-DyprQSIG.js","assets/browser-overlay-block-CiDtkfup.js","assets/dist-c_QADQ5u.js","assets/dist-D-2G8xGB.js","assets/es2015-BlPKkFZZ.js","assets/async-loading-fallback-V0EaQ_Kn.js","assets/scroll-area-lkVMElz5.js","assets/dist-OixawqbU.js","assets/tooltip-Db8UeYxm.js","assets/dist-C2G92uPn.js","assets/dist-DoxvnNEY.js","assets/use-toast-xpb5jNtN.js","assets/chat-dock-context-8K8Ikjgy.js","assets/api-DX1ny6q-.js","assets/store-BSzKIu5G.js","assets/explorer-tab-context-BxUVwWQQ.js","assets/main-tab-context-Byl1LybL.js","assets/use-suspense-resource-Dakt9lfT.js","assets/suspense-resource-BFrb_XJX.js","assets/create-project-workspace-Dv_lEfZx.js","assets/dist-DD4GtbiM.js","assets/dist-yM5kyz9Q.js","assets/dist-CHhgoHp6.js","assets/dist-DsmF-KJ-.js","assets/dist-CSssbxDI.js","assets/useBaseQuery-34f0-SVd.js","assets/chunk-QFMPRPBF-COsSkB7x.js","assets/index-BLNUy5nZ.css","assets/toggle-group-Q36wRGKA.js","assets/use-settings-page-loading-BTySlInF.js","assets/project-settings-view-DJfmaWn6.js","assets/context-menu-BcM6I0Sx.js","assets/project-coding-view-DxOwsjtt.js","assets/commit-method-fields-BtEHb0_G.js","assets/project-env-vars-view-DYLWA7s0.js","assets/project-danger-zone-view-CkvKOQrl.js","assets/project-model-aliases-view-DWu9khLA.js","assets/project-tools-view-BEjBkghz.js","assets/providers-list-view-jMEPJCci.js","assets/model-list-controls-I67L2x3H.js","assets/sorting-DqwxPMRN.js","assets/async-error-boundary-BX1G17o9.js","assets/card-B_EASkic.js","assets/settings-list-DiiYzOxn.js","assets/use-deferred-search-Dgxosq55.js","assets/pending-changes-Bn-0ak1d.js","assets/settings-models-view-CJVeo9ad.js","assets/table-A3cgauiZ.js","assets/settings-mcp-servers-view-4FpPIeYV.js","assets/delete-confirm-dialog-Dl76vaxb.js","assets/settings-slack-view-Cc1NgVkx.js","assets/settings-logs-view-DbKM1SNk.js","assets/settings-skills-view-DoRPGbHG.js","assets/slug-utils-CQ8PMWUL.js","assets/use-installed-ai-files-C8nNWGC7.js","assets/settings-slash-commands-view-CmlWqqmi.js","assets/radio-group-Dn_pN-pn.js","assets/settings-subagents-view-B2RvxDZI.js","assets/settings-system-prompt-view-CvVbgjNN.js","assets/account-view-CWtpznW2.js","assets/conversation-history-view-CuzU9qF6.js","assets/settings-storage-view-DihbtUYb.js","assets/settings-statistics-view-DRuyEbcN.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,r,t as i}from"./react-vendor-Ee0-5T4I.js";import{c as a,o,s}from"./chunk-QFMPRPBF-COsSkB7x.js";import{Dt as c,N as l}from"./dist-CTLFS4dn.js";import{$ as u,n as d,r as f}from"./store-BSzKIu5G.js";import{m as p,r as m,t as h}from"./button-kWtLAMpB.js";import{A as g,C as _,Cn as v,E as y,Fn as b,G as x,I as S,In as C,Ln as w,Lt as T,Rt as E,S as D,Tt as O,U as k,b as A,dt as j,k as M,x as N,y as P,yn as F}from"./dist-c_QADQ5u.js";import{Dt as I,Jt as L,fn as R}from"./api-DX1ny6q-.js";import{n as z}from"./scroll-area-lkVMElz5.js";import{n as B}from"./async-loading-fallback-V0EaQ_Kn.js";import{Et as V,Fn as H,Gn as U,Hn as W,Kn as G,N as K,Nn as ee,Pn as te,Un as q,er as ne}from"./index-B3-5kIOf.js";var J=t(),Y=e(n(),1),X=i(),re=(0,Y.forwardRef)(function(e,t){let n=(0,J.c)(29),{sidebar:r,children:i,defaultSidebarSize:a,minSidebarSize:o,maxSidebarSize:s,minContentSize:c,collapsible:l,collapsedSize:u,className:d,onCollapse:f,onExpand:p,isMobile:h,mobileShowSidebar:g,sidebarClassName:_}=e,v=a===void 0?25:a,y=o===void 0?20:o,b=s===void 0?30:s,x=c===void 0?40:c,S=l===void 0?!1:l,C=u===void 0?0:u,w=d===void 0?``:d,T=h===void 0?!1:h,E=g===void 0?!0:g,D=T&&!E,O=T&&E,k=`h-full ${w}`,A=T?100:v,j=T?50:y,M=T?100:b,N=D&&`hidden`,P;n[0]!==_||n[1]!==N?(P=m(`border-r border-transparent`,N,_),n[0]=_,n[1]=N,n[2]=P):P=n[2];let F;n[3]!==C||n[4]!==S||n[5]!==f||n[6]!==p||n[7]!==t||n[8]!==r||n[9]!==A||n[10]!==j||n[11]!==M||n[12]!==P?(F=(0,X.jsx)(te,{ref:t,defaultSize:A,minSize:j,maxSize:M,collapsible:S,collapsedSize:C,onCollapse:f,onExpand:p,className:P,children:r}),n[3]=C,n[4]=S,n[5]=f,n[6]=p,n[7]=t,n[8]=r,n[9]=A,n[10]=j,n[11]=M,n[12]=P,n[13]=F):F=n[13];let I;n[14]===T?I=n[15]:(I=!T&&(0,X.jsx)(ee,{withHandle:!0,className:`ml-[-10px]`}),n[14]=T,n[15]=I);let L=O&&`hidden`,R;n[16]===L?R=n[17]:(R=m(`overflow-hidden`,L),n[16]=L,n[17]=R);let z;n[18]!==i||n[19]!==x||n[20]!==R?(z=(0,X.jsx)(te,{minSize:x,className:R,children:i}),n[18]=i,n[19]=x,n[20]=R,n[21]=z):z=n[21];let B;n[22]!==F||n[23]!==I||n[24]!==z?(B=(0,X.jsxs)(H,{direction:`horizontal`,className:`h-full`,children:[F,I,z]}),n[22]=F,n[23]=I,n[24]=z,n[25]=B):B=n[25];let V;return n[26]!==k||n[27]!==B?(V=(0,X.jsx)(`div`,{className:k,children:B}),n[26]=k,n[27]=B,n[28]=V):V=n[28],V});function ie(e){let t=(0,J.c)(5),{className:n}=e,r;t[0]===n?r=t[1]:(r=m(`h-4 w-4`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(`path`,{d:`M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.528 2.528 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.528 2.528 0 0 1-2.52-2.523 2.528 2.528 0 0 1 2.52-2.52h6.313A2.528 2.528 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z`}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,className:r,children:i}),t[3]=r,t[4]=a),a}var Z=[{id:`skills`,label:`Skills`,icon:(0,X.jsx)(N,{className:`h-4 w-4`}),route:`/settings/skills`},{id:`slash-commands`,label:`Slash Commands`,icon:(0,X.jsx)(M,{className:`h-4 w-4`}),route:`/settings/slash-commands`},{id:`subagents`,label:`Subagents`,icon:(0,X.jsx)(D,{className:`h-4 w-4`}),route:`/settings/subagents`},{id:`system-prompt`,label:`System Prompt`,icon:(0,X.jsx)(S,{className:`h-4 w-4`}),route:`/settings/system-prompt`},{id:`mcp-servers`,label:`MCP Servers`,icon:(0,X.jsx)(x,{className:`h-4 w-4`}),route:`/settings/mcp-servers`},{id:`general`,label:`Settings`,icon:(0,X.jsx)(k,{className:`h-4 w-4`}),route:`/settings/general`},{id:`logs`,label:`Logs`,icon:(0,X.jsx)(O,{className:`h-4 w-4`}),route:`/settings/logs`},{id:`slack`,label:`Slack`,icon:(0,X.jsx)(ie,{}),route:`/settings/slack`},{id:`providers`,label:`Providers`,icon:(0,X.jsx)(F,{className:`h-4 w-4`}),route:`/settings/providers`},{id:`models`,label:`Models`,icon:(0,X.jsx)(C,{className:`h-4 w-4`}),route:`/settings/models`},{id:`model-aliases`,label:`Model Aliases`,icon:(0,X.jsx)(g,{className:`h-4 w-4`}),route:`/settings/model-aliases`},{id:`statistics`,label:`Statistics`,icon:(0,X.jsx)(b,{className:`h-4 w-4`}),route:`/settings/statistics`},{id:`history`,label:`History`,icon:(0,X.jsx)(T,{className:`h-4 w-4`}),route:`/settings/history`},{id:`storage`,label:`Storage`,icon:(0,X.jsx)(E,{className:`h-4 w-4`}),route:`/settings/storage`},{id:`account`,label:`Account`,icon:(0,X.jsx)(_,{className:`h-4 w-4`}),route:`/settings/account`}],Q=new Set([`project`,`project-coding`,`project-danger-zone`,`project-env-vars`,`project-tools`,`skills`,`slash-commands`,`subagents`,`system-prompt`,`mcp-servers`]),ae=new Set([`project`,`skills`,`mcp-servers`]),oe=new Set([`project-coding`,`project-env-vars`]),se=new Set([`system-prompt`,`project-tools`,`slash-commands`,`subagents`,`project-danger-zone`]),ce=new Set([`general`,`logs`,`slack`,`providers`,`models`,`model-aliases`,`statistics`,`history`,`storage`,`account`]);function le(e){return Q.has(e)?`project`:`general`}function $(e){let t=(0,J.c)(18),{label:n,items:r,activeTabId:i,onItemClick:a,showSeparator:o,className:s}=e,c=o===void 0?!0:o;if(r.length===0)return null;let l;t[0]===n?l=t[1]:(l=n?(0,X.jsx)(W,{className:`text-xs`,children:n}):null,t[0]=n,t[1]=l);let u;if(t[2]!==i||t[3]!==r||t[4]!==a){let e;t[6]!==i||t[7]!==a?(e=e=>(0,X.jsx)(G,{selected:i===e.id,asChild:!0,children:(0,X.jsx)(`button`,{className:`justify-start`,onClick:()=>a(e),children:(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.icon,(0,X.jsx)(`span`,{children:e.label})]})})},e.id),t[6]=i,t[7]=a,t[8]=e):e=t[8],u=r.map(e),t[2]=i,t[3]=r,t[4]=a,t[5]=u}else u=t[5];let d;t[9]===u?d=t[10]:(d=(0,X.jsx)(`div`,{className:`space-y-1`,children:u}),t[9]=u,t[10]=d);let f;t[11]===c?f=t[12]:(f=c?(0,X.jsx)(U,{className:`my-2`}):null,t[11]=c,t[12]=f);let p;return t[13]!==s||t[14]!==l||t[15]!==d||t[16]!==f?(p=(0,X.jsxs)(`div`,{className:s,children:[l,d,f]}),t[13]=s,t[14]=l,t[15]=d,t[16]=f,t[17]=p):p=t[17],p}function ue(e){let t=[...Z];if(!e)return t;let n=t.findIndex(e=>e.id===`skills`);t.splice(n,0,{id:`project`,label:`Settings`,icon:(0,X.jsx)(k,{className:`h-4 w-4`}),route:`/settings/project/${e}`});let r=t.findIndex(e=>e.id===`project`);t.splice(r+1,0,{id:`project-coding`,label:`Repo`,icon:(0,X.jsx)(v,{className:`h-4 w-4`}),route:`/settings/project/${e}/coding`});let i=t.findIndex(e=>e.id===`system-prompt`),a=i===-1?null:t.splice(i,1)[0],o=t.findIndex(e=>e.id===`slash-commands`),s=o===-1?null:t.splice(o,1)[0],c=t.findIndex(e=>e.id===`subagents`),l=c===-1?null:t.splice(c,1)[0],u=t.findIndex(e=>e.id===`mcp-servers`);return u!==-1&&t.splice(u+1,0,...a?[a]:[],{id:`project-tools`,label:`Tools`,icon:(0,X.jsx)(A,{className:`h-4 w-4`}),route:`/settings/project/${e}/tools`},...s?[s]:[],...l?[l]:[],{id:`project-env-vars`,label:`Variables`,icon:(0,X.jsx)(w,{className:`h-4 w-4`}),route:`/settings/project/${e}/env-vars`},{id:`project-danger-zone`,label:`Danger Zone`,icon:(0,X.jsx)(y,{className:`h-4 w-4`}),route:`/settings/project/${e}/danger-zone`}),t}function de(e){let t=(0,J.c)(48),{className:n,selectedProjectId:r,settingsScope:i,onResetOnboarding:a,onNavItemSelect:c}=e,l=s(),u=o(),d=(0,Y.useRef)(0),f=(0,Y.useRef)(null),p,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>()=>{f.current&&clearTimeout(f.current)},h=[],t[0]=p,t[1]=h):(p=t[0],h=t[1]),(0,Y.useEffect)(p,h);let g=q(),_;t[2]===r?_=t[3]:(_=ue(r),t[2]=r,t[3]=_);let v=_,y;t[4]!==g||t[5]!==v?(y=g?v.filter(ve):v,t[4]=g,t[5]=v,t[6]=y):y=t[6];let b=y,x;t[7]!==u.pathname||t[8]!==b?(x=function(){let e=u.pathname;if(e.endsWith(`/tools`)&&e.startsWith(`/settings/project/`))return`project-tools`;if(e.endsWith(`/model-aliases`)&&e.startsWith(`/settings/project/`))return`project-model-aliases`;if(e.endsWith(`/env-vars`)&&e.startsWith(`/settings/project/`))return`project-env-vars`;if(e.endsWith(`/coding`)&&e.startsWith(`/settings/project/`))return`project-coding`;if(e.endsWith(`/danger-zone`)&&e.startsWith(`/settings/project/`))return`project-danger-zone`;if(e.startsWith(`/settings/project/`))return`project`;for(let t of b)if(e.startsWith(t.route))return t.id;return`general`}(),t[7]=u.pathname,t[8]=b,t[9]=x):x=t[9];let S=x,C,w,T,E,D,O,k,A,j;if(t[10]!==S||t[11]!==n||t[12]!==b||t[13]!==l||t[14]!==c||t[15]!==a||t[16]!==r||t[17]!==i){w=function(e){e.id===`general`&&a&&(f.current&&clearTimeout(f.current),d.current+=1,d.current>=3?(d.current=0,a()):f.current=setTimeout(()=>{d.current=0},1500)),c?.(),l(e.route)};let e=!!r;O=!e||i!==`project`,k=e&&i!==`general`;let o=b.filter(_e);D=o.filter(ge),E=o.filter(he),T=o.filter(me);let s;t[27]===b?s=t[28]:(s=b.filter(pe),t[27]=b,t[28]=s),C=s;let u=e?[]:o.filter(fe);t[29]===n?A=t[30]:(A=m(`space-y-1`,n),t[29]=n,t[30]=A),j=u.length>0?(0,X.jsxs)(X.Fragment,{children:[u.map(e=>(0,X.jsx)(G,{selected:S===e.id,asChild:!0,children:(0,X.jsx)(`button`,{className:`justify-start`,onClick:()=>w(e),children:(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.icon,(0,X.jsx)(`span`,{children:e.label})]})})},e.id)),(0,X.jsx)(U,{className:`my-2`})]}):null,t[10]=S,t[11]=n,t[12]=b,t[13]=l,t[14]=c,t[15]=a,t[16]=r,t[17]=i,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O,t[24]=k,t[25]=A,t[26]=j}else C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23],k=t[24],A=t[25],j=t[26];let M;t[31]!==S||t[32]!==w||t[33]!==T||t[34]!==E||t[35]!==D||t[36]!==k?(M=k?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{label:`Project`,items:D,activeTabId:S,onItemClick:w,showSeparator:!1}),(0,X.jsx)($,{label:`Coding`,items:E,activeTabId:S,onItemClick:w,showSeparator:!1,className:`pt-3`}),(0,X.jsx)($,{label:`Advanced`,items:T,activeTabId:S,onItemClick:w,showSeparator:!1,className:`pt-3`})]}):null,t[31]=S,t[32]=w,t[33]=T,t[34]=E,t[35]=D,t[36]=k,t[37]=M):M=t[37];let N;t[38]!==S||t[39]!==C||t[40]!==w||t[41]!==O?(N=O?(0,X.jsx)($,{items:C,activeTabId:S,onItemClick:w,showSeparator:!1}):null,t[38]=S,t[39]=C,t[40]=w,t[41]=O,t[42]=N):N=t[42];let P;return t[43]!==A||t[44]!==j||t[45]!==M||t[46]!==N?(P=(0,X.jsxs)(`div`,{className:A,children:[j,M,N]}),t[43]=A,t[44]=j,t[45]=M,t[46]=N,t[47]=P):P=t[47],P}function fe(e){return e.id!==`project`}function pe(e){return ce.has(e.id)}function me(e){return se.has(e.id)}function he(e){return oe.has(e.id)}function ge(e){return ae.has(e.id)}function _e(e){return Q.has(e.id)}function ve(e){return e.id!==`account`}var ye=l(`app.settings-view.ui`),be=[{value:`project`,label:`Project`},{value:`general`,label:`General`}],xe=`frosted-surface backdrop-blur-2xl`,Se=(0,Y.lazy)(()=>r(()=>import(`./settings-general-view-BhrfHGfQ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]))),Ce=(0,Y.lazy)(()=>r(()=>import(`./project-settings-view-DJfmaWn6.js`),__vite__mapDeps([37,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,38,36]))),we=(0,Y.lazy)(()=>r(()=>import(`./project-coding-view-DxOwsjtt.js`),__vite__mapDeps([39,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,40,35,36]))),Te=(0,Y.lazy)(()=>r(()=>import(`./project-env-vars-view-DYLWA7s0.js`),__vite__mapDeps([41,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,36]))),Ee=(0,Y.lazy)(()=>r(()=>import(`./project-danger-zone-view-CkvKOQrl.js`),__vite__mapDeps([42,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34]))),De=(0,Y.lazy)(()=>r(()=>import(`./project-model-aliases-view-DWu9khLA.js`),__vite__mapDeps([43,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,36]))),Oe=(0,Y.lazy)(()=>r(()=>import(`./project-tools-view-BEjBkghz.js`),__vite__mapDeps([44,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,36]))),ke=(0,Y.lazy)(()=>r(()=>import(`./providers-list-view-jMEPJCci.js`),__vite__mapDeps([45,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,46,47,48,49,50,51,52]))),Ae=(0,Y.lazy)(()=>r(()=>import(`./settings-models-view-CJVeo9ad.js`),__vite__mapDeps([53,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,40,35,46,47,48,49,50,54,51]))),je=(0,Y.lazy)(()=>r(()=>import(`./settings-mcp-servers-view-4FpPIeYV.js`),__vite__mapDeps([55,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,56,50,49,36]))),Me=(0,Y.lazy)(()=>r(()=>import(`./settings-slack-view-Cc1NgVkx.js`),__vite__mapDeps([57,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34]))),Ne=(0,Y.lazy)(()=>r(()=>import(`./settings-logs-view-DbKM1SNk.js`),__vite__mapDeps([58,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]))),Pe=(0,Y.lazy)(()=>r(()=>import(`./settings-skills-view-DoRPGbHG.js`),__vite__mapDeps([59,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,56,60,50,49,51,61,36]))),Fe=(0,Y.lazy)(()=>r(()=>import(`./settings-slash-commands-view-CmlWqqmi.js`),__vite__mapDeps([62,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,56,60,63,50,49,36]))),Ie=(0,Y.lazy)(()=>r(()=>import(`./settings-subagents-view-B2RvxDZI.js`),__vite__mapDeps([64,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,56,60,50,49,61,36]))),Le=(0,Y.lazy)(()=>r(()=>import(`./settings-system-prompt-view-CvVbgjNN.js`),__vite__mapDeps([65,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,36]))),Re=(0,Y.lazy)(()=>r(()=>import(`./account-view-CWtpznW2.js`),__vite__mapDeps([66,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,56]))),ze=(0,Y.lazy)(()=>r(()=>import(`./conversation-history-view-CuzU9qF6.js`),__vite__mapDeps([67,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,56,54]))),Be=(0,Y.lazy)(()=>r(()=>import(`./settings-storage-view-DihbtUYb.js`),__vite__mapDeps([68,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,56,50,49,54]))),Ve=(0,Y.lazy)(()=>r(()=>import(`./settings-statistics-view-DRuyEbcN.js`),__vite__mapDeps([69,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,56,54,35]))),He=[`general`,`providers`,`models`,`model-aliases`,`skills`,`slash-commands`,`subagents`,`system-prompt`,`mcp-servers`,`slack`,`logs`,`statistics`,`history`,`storage`,`account`];function Ue(e){let t=(0,J.c)(2),{title:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(V,{title:n,children:`Content coming soon...`}),t[0]=n,t[1]=r),r}function We(e){return e.startsWith(`/settings/general`)?`general`:e.startsWith(`/settings/providers`)?`providers`:e.startsWith(`/settings/models`)?`models`:e.startsWith(`/settings/model-aliases`)?`model-aliases`:e.startsWith(`/settings/skills`)?`skills`:e.startsWith(`/settings/slash-commands`)?`slash-commands`:e.startsWith(`/settings/subagents`)?`subagents`:e.startsWith(`/settings/system-prompt`)?`system-prompt`:e.startsWith(`/settings/mcp-servers`)?`mcp-servers`:e.startsWith(`/settings/slack`)?`slack`:e.startsWith(`/settings/logs`)?`logs`:e.startsWith(`/settings/statistics`)?`statistics`:e.startsWith(`/settings/history`)?`history`:e.startsWith(`/settings/storage`)?`storage`:e.startsWith(`/settings/account`)?`account`:`general`}function Ge(e){let t=e.match(/^\/settings\/providers\/([^/]+)$/);return t?decodeURIComponent(t[1]):null}function Ke(e,t,n){return e&&He.includes(e)?e:t&&He.includes(t)?t:We(n)}function qe(e,t,n,r,i,a,o){return e?`project-tools`:t?`project-model-aliases`:n?`project-env-vars`:r?`project-coding`:i?`project-danger-zone`:a?`project`:o}function Je(e,t,n,r,i,a,o){return e?`Tools`:t?`Model Aliases`:n?`Variables`:r?`Repo`:i?`Danger Zone`:a?`Project`:Z.find(e=>e.id===o)?.label??`Settings`}function Ye(e,t){return e===`/settings`||e===`/settings/project`||[`/settings/mcp-server-edit`,`/settings/add-skill`,`/settings/add-command`,`/settings/add-rule`,`/settings/add-agent`,`/settings/rules`].some(t=>e.startsWith(t))||t&&e.startsWith(`/settings/account`)}function Xe(e,t){let n=!!e&&t.startsWith(`/settings/project/`),r=n&&t.endsWith(`/tools`),i=n&&t.endsWith(`/model-aliases`),a=n&&t.endsWith(`/env-vars`),o=n&&t.endsWith(`/coding`),s=n&&t.endsWith(`/danger-zone`);return{isProjectRoute:n,isProjectToolsRoute:r,isProjectModelAliasesRoute:i,isProjectEnvVarsRoute:a,isProjectCodingRoute:o,isProjectDangerZoneRoute:s,isProjectSettingsRoute:n&&!a&&!i&&!o&&!s&&!r}}function Ze(e,t){let n=(0,J.c)(5),r;n[0]!==t||n[1]!==e?(r=()=>{let n=e.current;if(!n)return;let r=function(e){if(e.key!==`Escape`)return;let n=document.activeElement;if(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLElement&&n.isContentEditable){n.blur();return}t()};return n.addEventListener(`keydown`,r),()=>n.removeEventListener(`keydown`,r)},n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]===t?i=n[4]:(i=[t],n[3]=t,n[4]=i),(0,Y.useEffect)(r,i)}function Qe(e){let t=(0,J.c)(5),{selectedProjectId:n,settingsScope:r,onResetOnboarding:i,onNavItemSelect:a}=e,o=n?r:void 0,s;return t[0]!==a||t[1]!==i||t[2]!==n||t[3]!==o?(s=(0,X.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden p-2.5`,children:(0,X.jsx)(z,{className:`min-h-0 flex-1`,children:(0,X.jsx)(`div`,{className:`py-2`,children:(0,X.jsx)(de,{selectedProjectId:n,settingsScope:o,onResetOnboarding:i,onNavItemSelect:a})})})}),t[0]=a,t[1]=i,t[2]=n,t[3]=o,t[4]=s):s=t[4],s}function $e(e){let t=(0,J.c)(21),{settingsHeaderTitle:n,isProjectSettingsScope:r,selectedProject:i,selectedProjectId:a,settingsScope:o,onScopeChange:s,onRequestClose:l}=e,u;t[0]!==r||t[1]!==i?(u=r&&i?(0,X.jsx)(ne,{project:i,className:`h-7 w-7 shrink-0 rounded-md`,iconClassName:`h-3.5 w-3.5`}):(0,X.jsx)(`div`,{className:`flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border shadow-sm`,children:(0,X.jsx)(`img`,{src:`/tarsk.svg`,alt:`Tarsk`,className:`h-full w-full`})}),t[0]=r,t[1]=i,t[2]=u):u=t[2];let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=m(c.sectionTitle,`truncate`),t[3]=d):d=t[3];let f;t[4]===n?f=t[5]:(f=(0,X.jsx)(`span`,{className:d,children:n}),t[4]=n,t[5]=f);let p;t[6]!==u||t[7]!==f?(p=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 electrobun-webkit-app-region-no-drag`,children:[u,f]}),t[6]=u,t[7]=f,t[8]=p):p=t[8];let g;t[9]!==s||t[10]!==a||t[11]!==o?(g=a?(0,X.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-4 flex justify-center`,children:(0,X.jsx)(K,{className:`pointer-events-auto electrobun-webkit-app-region-no-drag`,value:o,onValueChange:s,options:be})}):null,t[9]=s,t[10]=a,t[11]=o,t[12]=g):g=t[12];let _,v;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(P,{className:`h-4 w-4`}),v=(0,X.jsx)(`span`,{className:`sr-only`,children:`Close`}),t[13]=_,t[14]=v):(_=t[13],v=t[14]);let y;t[15]===l?y=t[16]:(y=(0,X.jsx)(`div`,{className:`ml-auto flex items-center gap-2 electrobun-webkit-app-region-no-drag`,children:(0,X.jsxs)(h,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:l,children:[_,v]})}),t[15]=l,t[16]=y);let b;return t[17]!==p||t[18]!==g||t[19]!==y?(b=(0,X.jsxs)(`div`,{className:`relative flex h-14 shrink-0 items-start px-4 pt-4 pb-2 electrobun-webkit-app-region-drag`,children:[p,g,y]}),t[17]=p,t[18]=g,t[19]=y,t[20]=b):b=t[20],b}function et(e){let t=(0,J.c)(10),{isMobile:n,mobileShowSidebar:r,isProviderDetailRoute:i,activeSectionLabel:a,onShowSidebar:o}=e;if(!n||r||i)return null;let s,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(j,{className:`h-4 w-4`}),l=(0,X.jsx)(`span`,{className:`sr-only`,children:`Show settings menu`}),t[0]=s,t[1]=l):(s=t[0],l=t[1]);let u;t[2]===o?u=t[3]:(u=(0,X.jsxs)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground`,onClick:o,children:[s,l]}),t[2]=o,t[3]=u);let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=m(c.sectionTitle,`truncate text-foreground`),t[4]=d):d=t[4];let f;t[5]===a?f=t[6]:(f=(0,X.jsx)(`span`,{className:d,children:a}),t[5]=a,t[6]=f);let p;return t[7]!==u||t[8]!==f?(p=(0,X.jsx)(`div`,{className:`px-6 pb-0 pt-6`,children:(0,X.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-center gap-2`,children:[u,f]})}),t[7]=u,t[8]=f,t[9]=p):p=t[9],p}function tt(e){let t=(0,J.c)(22),{isProjectToolsRoute:n,isProjectModelAliasesRoute:r,isProjectEnvVarsRoute:i,isProjectCodingRoute:a,isProjectDangerZoneRoute:o,isProjectSettingsRoute:s,projectId:c,activeTab:l,locationKey:u,onboardingResetSignal:d,handleProjectUpdated:f}=e;if(a&&c){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(B,{}),t[0]=e):e=t[0];let n;return t[1]===c?n=t[2]:(n=(0,X.jsx)(Y.Suspense,{fallback:e,children:(0,X.jsx)(we,{projectId:c})}),t[1]=c,t[2]=n),n}if(o&&c){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(B,{}),t[3]=e):e=t[3];let n;return t[4]===c?n=t[5]:(n=(0,X.jsx)(Y.Suspense,{fallback:e,children:(0,X.jsx)(Ee,{projectId:c})}),t[4]=c,t[5]=n),n}if(n&&c){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(B,{}),t[6]=e):e=t[6];let n;return t[7]!==f||t[8]!==c?(n=(0,X.jsx)(Y.Suspense,{fallback:e,children:(0,X.jsx)(Oe,{projectId:c,onProjectUpdated:f})}),t[7]=f,t[8]=c,t[9]=n):n=t[9],n}if(r&&c){let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(De,{})}),t[10]=e):e=t[10],e}if(i&&c){let e;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(B,{}),t[11]=e):e=t[11];let n;return t[12]===c?n=t[13]:(n=(0,X.jsx)(Y.Suspense,{fallback:e,children:(0,X.jsx)(Te,{projectId:c})}),t[12]=c,t[13]=n),n}if(s&&c){let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(B,{}),t[14]=e):e=t[14];let n;return t[15]!==f||t[16]!==c?(n=(0,X.jsx)(Y.Suspense,{fallback:e,children:(0,X.jsx)(Ce,{projectId:c,onProjectUpdated:f})}),t[15]=f,t[16]=c,t[17]=n):n=t[17],n}let p;return t[18]!==l||t[19]!==u||t[20]!==d?(p=nt(l,u,d),t[18]=l,t[19]=u,t[20]=d,t[21]=p):p=t[21],p}function nt(e,t,n){return{general:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Se,{onboardingResetSignal:n})}),providers:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{label:`Loading providers...`,size:`lg`}),children:(0,X.jsx)(ke,{})}),models:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{label:`Loading models...`,size:`lg`}),children:(0,X.jsx)(Ae,{})}),"model-aliases":(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(De,{})}),skills:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Pe,{},t)}),"slash-commands":(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Fe,{})}),subagents:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Ie,{})}),"system-prompt":(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Le,{})}),"mcp-servers":(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(je,{})}),slack:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Me,{})}),logs:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Ne,{})}),statistics:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Ve,{})}),history:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(ze,{})}),storage:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Be,{})}),account:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Re,{})})}[e]??(0,X.jsx)(Ue,{title:`Settings`})}function rt({onRequestClose:e}){let{tab:t,projectId:n}=a(),r=s(),i=o(),c=d(),l=f(e=>e.selectedProjectId),h=f(e=>e.projects),{isProjectRoute:g,isProjectToolsRoute:_,isProjectModelAliasesRoute:v,isProjectEnvVarsRoute:y,isProjectCodingRoute:b,isProjectDangerZoneRoute:x,isProjectSettingsRoute:S}=Xe(n,i.pathname),C=Ge(i.pathname)!==null,w=Ke(new URLSearchParams(i.search).get(`tab`),t,i.pathname),T=q(),[E,D]=(0,Y.useState)(!0),[O,k]=(0,Y.useState)(0),A=(0,Y.useRef)(null),j=(0,Y.useRef)(null),M=qe(_,v,y,b,x,g,w),[N,P]=(0,Y.useState)(()=>le(M));(0,Y.useEffect)(()=>{P(le(M))},[M]);let F=(0,Y.useCallback)(e=>{if(P(e),e===`project`&&l){r(`/settings/project/${l}`);return}e===`general`&&r(`/settings/general`)},[r,l]),z=(0,Y.useMemo)(()=>h.find(e=>e.projectId===l)??null,[h,l]),B=N===`project`&&z!==null,V=B?`${p(z)} Settings`:`General Settings`,H=(0,Y.useMemo)(()=>Je(_,v,y,b,x,S,w),[w,b,x,y,v,S,_]),U=(0,Y.useCallback)(()=>{T&&D(!1)},[T]),W=(0,Y.useCallback)(()=>{D(!0)},[]),G=(0,Y.useCallback)(async()=>{try{await R(),k(e=>e+1)}catch(e){ye.error(`Failed to reset onboarding:`,e)}},[]),K=(0,Y.useCallback)(async()=>{L(n);try{let e=await I();c({type:u.SetProjects,projects:e.projects,cloneRootPath:e.cloneRootPath})}catch(e){throw ye.error(`Failed to refresh projects after settings update:`,e),e}},[c,n]);return(0,Y.useEffect)(()=>{if(v){r(`/settings/model-aliases`,{replace:!0});return}Ye(i.pathname,T)&&r(`/settings/general`,{replace:!0})},[v,i.pathname,r,T]),Ze(j,e),(0,X.jsxs)(`div`,{ref:j,role:`dialog`,"aria-modal":`true`,"aria-label":`Settings`,className:m(`rounded-2xl border border-border shadow-lg`,xe,`flex h-full w-full flex-col overflow-hidden md:h-[95vh] md:w-[80vw] md:max-w-[1400px]`),children:[(0,X.jsx)($e,{settingsHeaderTitle:V,isProjectSettingsScope:B,selectedProject:z,selectedProjectId:l,settingsScope:N,onScopeChange:F,onRequestClose:e}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,X.jsx)(re,{ref:A,collapsible:!0,isMobile:T,mobileShowSidebar:E,sidebarClassName:m(`overflow-hidden rounded-tr-2xl`,xe),sidebar:(0,X.jsx)(Qe,{selectedProjectId:l,settingsScope:N,onResetOnboarding:G,onNavItemSelect:U}),children:(0,X.jsxs)(`div`,{className:m(`relative flex h-full min-h-0 flex-col overflow-hidden py-2.5 pl-2.5`,T?null:`ml-2.5`),children:[(0,X.jsx)(et,{isMobile:T,mobileShowSidebar:E,isProviderDetailRoute:C,activeSectionLabel:H,onShowSidebar:W}),(0,X.jsx)(tt,{isProjectToolsRoute:_,isProjectModelAliasesRoute:v,isProjectEnvVarsRoute:y,isProjectCodingRoute:b,isProjectDangerZoneRoute:x,isProjectSettingsRoute:S,projectId:n,activeTab:w,locationKey:i.key,onboardingResetSignal:O,handleProjectUpdated:K})]})})})]})}export{rt as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{a as i,n as a,r as o}from"./chat-dock-context-8K8Ikjgy.js";import{B as s,Dt as c,H as l,N as u,U as d,V as f,W as p,d as m,q as h}from"./dist-CTLFS4dn.js";import{$ as g,n as _,r as v}from"./store-BSzKIu5G.js";import{m as y,r as b,t as x}from"./button-kWtLAMpB.js";import{$ as S,A as C,D as w,Ot as T,Pn as E,bt as D,fn as O,it as k,mn as A,ot as j,q as ee,rt as te,v as M,wn as ne,y as N}from"./dist-c_QADQ5u.js";import{i as re,n as ie,r as ae,t as oe}from"./tooltip-Db8UeYxm.js";import{Dt as P,Jt as F,d as se,yt as ce}from"./api-DX1ny6q-.js";import{n as le,r as ue}from"./scroll-area-lkVMElz5.js";import{t as de}from"./use-toast-xpb5jNtN.js";import{t as fe}from"./suspense-resource-BFrb_XJX.js";import{t as pe}from"./use-suspense-resource-Dakt9lfT.js";import{a as I,c as me,i as he,n as L,o as ge,r as R,s as _e,t as ve}from"./alert-dialog-BxMfaLuO.js";import{$t as ye,Bt as be,En as xe,Ft as Se,Gt as Ce,It as we,Jn as Te,Jt as z,Kt as Ee,Mt as De,Nt as B,Qt as Oe,R as ke,Rn as Ae,Tn as je,Vn as Me,Wt as Ne,Xt as Pe,Yt as Fe,Zt as Ie,_n as Le,_r as Re,an as ze,bn as Be,cn as Ve,dn as He,dr as V,en as Ue,fn as We,fr as H,gn as Ge,gr as U,hn as W,hr as G,in as Ke,ir as K,it as qe,j as q,jt as Je,ln as J,mn as Ye,mr as Y,nn as Xe,o as Ze,on as Qe,or as $e,pn as et,pr as tt,qt as nt,rn as rt,rr as it,sn as at,tn as ot,tr as st,un as ct,ur as lt,vn as ut,vr as dt,wn as ft,xn as pt,yn as mt,zn as ht}from"./index-B3-5kIOf.js";import{t as gt}from"./async-error-boundary-BX1G17o9.js";var X=e(n(),1),Z=t(),Q=r();function _t(e){let t=(0,Z.c)(10),{tag:n,className:r}=e,i;t[0]===r?i=t[1]:(i=b(c.compact,`inline-flex items-center gap-1 rounded-full border border-border/50 bg-background px-2 py-0.5`,r),t[0]=r,t[1]=i);let a;t[2]===n.color?a=t[3]:(a=(0,Q.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:n.color}}),t[2]=n.color,t[3]=a);let o;t[4]===n.name?o=t[5]:(o=(0,Q.jsx)(`span`,{className:`truncate`,children:n.name}),t[4]=n.name,t[5]=o);let s;return t[6]!==i||t[7]!==a||t[8]!==o?(s=(0,Q.jsxs)(`span`,{className:i,children:[a,o]}),t[6]=i,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}var vt={Plan:`#EAB308`,Build:`#3B82F6`,Test:`#8B5CF6`,Review:`#F97316`,Done:`#22C55E`};function yt(e){let t=(0,Z.c)(10),{status:n,className:r}=e,i;t[0]===r?i=t[1]:(i=b(c.compact,`inline-flex items-center gap-1 rounded-full border border-border/50 bg-background px-2 py-0.5`,r),t[0]=r,t[1]=i);let a=vt[n],o;t[2]===a?o=t[3]:(o=(0,Q.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:a}}),t[2]=a,t[3]=o);let s;t[4]===n?s=t[5]:(s=(0,Q.jsx)(`span`,{className:`truncate`,children:n}),t[4]=n,t[5]=s);let l;return t[6]!==i||t[7]!==o||t[8]!==s?(l=(0,Q.jsxs)(`span`,{className:i,children:[o,s]}),t[6]=i,t[7]=o,t[8]=s,t[9]=l):l=t[9],l}var bt=u(`app.run-history-dialog`),xt={schedule:{label:`Schedule`,icon:ne},event:{label:`Event`,icon:M},manual:{label:`Manual`,icon:k}};function St(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`})}function Ct(e){let t=(0,Z.c)(6),{trigger:n}=e,r=xt[n],i=r.icon,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=b(c.compact,`inline-flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-0.5 text-muted-foreground`),t[0]=a):a=t[0];let o;t[1]===i?o=t[2]:(o=(0,Q.jsx)(i,{className:`h-3 w-3`}),t[1]=i,t[2]=o);let s;return t[3]!==r.label||t[4]!==o?(s=(0,Q.jsxs)(`span`,{className:a,children:[o,r.label]}),t[3]=r.label,t[4]=o,t[5]=s):s=t[5],s}function wt(e){let t=(0,Z.c)(23),{run:n,canOpen:r,onOpenRun:i}=e,a=r?`hover:bg-accent/40`:`cursor-default`,o;t[0]===a?o=t[1]:(o=b(`flex w-full items-center gap-2 rounded-md px-2 py-2 text-left transition-colors`,a),t[0]=a,t[1]=o);let s;t[2]!==i||t[3]!==n?(s=()=>i(n),t[2]=i,t[3]=n,t[4]=s):s=t[4];let l=!r,u,d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(D,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),d=b(c.body,`min-w-0 flex-1 truncate`),t[5]=u,t[6]=d):(u=t[5],d=t[6]);let f=n.threadTitle??`Conversation deleted`,p;t[7]===f?p=t[8]:(p=(0,Q.jsx)(`span`,{className:d,children:f}),t[7]=f,t[8]=p);let m;t[9]===n.trigger?m=t[10]:(m=(0,Q.jsx)(Ct,{trigger:n.trigger}),t[9]=n.trigger,t[10]=m);let h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=b(c.caption,`shrink-0 tabular-nums text-muted-foreground`),t[11]=h):h=t[11];let g;t[12]===n.createdAt?g=t[13]:(g=St(n.createdAt),t[12]=n.createdAt,t[13]=g);let _;t[14]===g?_=t[15]:(_=(0,Q.jsx)(`span`,{className:h,children:g}),t[14]=g,t[15]=_);let v;return t[16]!==_||t[17]!==o||t[18]!==s||t[19]!==l||t[20]!==p||t[21]!==m?(v=(0,Q.jsxs)(`button`,{type:`button`,className:o,onClick:s,disabled:l,children:[u,p,m,_]}),t[16]=_,t[17]=o,t[18]=s,t[19]=l,t[20]=p,t[21]=m,t[22]=v):v=t[22],v}function Tt(e){let t=(0,Z.c)(19),{open:n,onOpenChange:r,projectId:i,taskId:a,onOpenRun:o}=e,[s,l]=(0,X.useState)(null),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(null),m,h;t[0]!==n||t[1]!==i||t[2]!==a?(m=()=>{if(!n)return;let e=!1;return d(!0),p(null),Ge(i,a).then(t=>{e||l(t)}).catch(t=>{bt.error(`Failed to load task run history:`,t),e||p(t instanceof Error?t.message:String(t))}).finally(()=>{e||d(!1)}),()=>{e=!0}},h=[n,i,a],t[0]=n,t[1]=i,t[2]=a,t[3]=m,t[4]=h):(m=t[3],h=t[4]),(0,X.useEffect)(m,h);let g=!!o,_;t[5]!==r||t[6]!==o?(_=function(e){o&&(r(!1),o(e.threadId))},t[5]=r,t[6]=o,t[7]=_):_=t[7];let v=_,y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(dt,{children:`Run History`}),(0,Q.jsx)(G,{children:`Conversations created when this task ran, newest first.`})]}),t[8]=y):y=t[8];let x;t[9]!==g||t[10]!==f||t[11]!==v||t[12]!==u||t[13]!==s?(x=(0,Q.jsxs)(Y,{className:`flex max-h-[min(36rem,85vh)] flex-col sm:max-w-lg`,children:[y,u?(0,Q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-8 text-muted-foreground`,children:[(0,Q.jsx)(T,{className:`h-4 w-4 animate-spin`}),(0,Q.jsx)(`span`,{className:c.bodyMuted,children:`Loading runs…`})]}):f?(0,Q.jsxs)(`p`,{className:b(c.bodyMuted,`py-8 text-center text-destructive`),children:[`Failed to load run history: `,f]}):s&&s.length>0?(0,Q.jsx)(ue,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(`div`,{className:`space-y-1 py-2`,children:s.map(e=>(0,Q.jsx)(wt,{run:e,canOpen:g&&!!e.threadTitle,onOpenRun:v},e.id))})}):(0,Q.jsx)(`p`,{className:b(c.bodyMuted,`py-8 text-center`),children:`No runs yet. Runs appear here after the task is triggered by its schedule, an event, or Run Now.`})]}),t[9]=g,t[10]=f,t[11]=v,t[12]=u,t[13]=s,t[14]=x):x=t[14];let S;return t[15]!==r||t[16]!==n||t[17]!==x?(S=(0,Q.jsx)(tt,{open:n,onOpenChange:r,children:x}),t[15]=r,t[16]=n,t[17]=x,t[18]=S):S=t[18],S}function Et(e){let t=(0,Z.c)(6);if(!e.show)return null;let n;return t[0]!==e.onOpenChange||t[1]!==e.onOpenRun||t[2]!==e.open||t[3]!==e.task.id||t[4]!==e.task.projectId?(n=(0,Q.jsx)(Tt,{open:e.open,onOpenChange:e.onOpenChange,projectId:e.task.projectId,taskId:e.task.id,onOpenRun:e.onOpenRun}),t[0]=e.onOpenChange,t[1]=e.onOpenRun,t[2]=e.open,t[3]=e.task.id,t[4]=e.task.projectId,t[5]=n):n=t[5],n}function Dt(e){let t=(0,Z.c)(3),{show:n,onSelect:r}=e;if(!n)return null;let i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)($e,{}),t[0]=i):i=t[0];let a;return t[1]===r?a=t[2]:(a=(0,Q.jsxs)(Q.Fragment,{children:[i,(0,Q.jsx)(K,{onClick:r,children:`Run History`})]}),t[1]=r,t[2]=a),a}function Ot({task:e,disabled:t=!1,showRunHistory:n=!1,onStartInNewWorkspace:r,onMarkDone:i,onRunNow:a,onOpenRun:o}){let[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(!1),d=Qe(e)&&!e.triggerType,f=e.status!==`Done`&&!e.triggerType,p=at(e),m=t||s;async function h(e){c(!0);try{await e()}finally{c(!1)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(s||e.working)&&(0,Q.jsx)(Me,{size:`sm`}),(0,Q.jsxs)(st,{children:[(0,Q.jsx)(lt,{asChild:!0,children:(0,Q.jsxs)(x,{variant:`ghost`,size:`icon`,className:b(`h-8 w-8 shrink-0`,e.working&&`text-primary`),disabled:m,children:[(0,Q.jsx)(A,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Task actions`})]})}),(0,Q.jsxs)(it,{align:`end`,children:[p&&(0,Q.jsx)(K,{onClick:()=>void h(()=>a(e)),children:`Run Now`}),d&&(0,Q.jsx)(K,{onClick:()=>void h(()=>r(e)),children:`Start in a new workspace`}),f&&(0,Q.jsx)(K,{onClick:()=>void h(()=>i(e)),children:`Mark as Done`}),(0,Q.jsx)(Dt,{show:n,onSelect:()=>u(!0)})]})]})]}),(0,Q.jsx)(Et,{show:n,open:l,onOpenChange:u,task:e,onOpenRun:o})]})}function kt(e){return!!(e.tags&&e.tags.length>0)}function At(e){return e.status!==`Ready`||e.modified||kt(e)||J(e)}function jt(e){let t=(0,Z.c)(14),{task:n,className:r}=e,i;t[0]===n.status?i=t[1]:(i=n.status!==`Ready`&&(0,Q.jsx)(yt,{status:n.status}),t[0]=n.status,t[1]=i);let a;t[2]===n.modified?a=t[3]:(a=n.modified&&(0,Q.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-brand/15 px-2 py-0.5 text-[11px] font-medium leading-none text-brand`,children:`modified`}),t[2]=n.modified,t[3]=a);let o;t[4]===n?o=t[5]:(o=J(n)&&(0,Q.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-red-500/15 px-2 py-0.5 text-[11px] font-medium leading-none text-red-600 dark:text-red-400`,children:`paused`}),t[4]=n,t[5]=o);let s;t[6]===n.tags?s=t[7]:(s=n.tags?.map(function(e){return(0,Q.jsx)(_t,{tag:e},e.id)}),t[6]=n.tags,t[7]=s);let c;return t[8]!==r||t[9]!==i||t[10]!==a||t[11]!==o||t[12]!==s?(c=(0,Q.jsxs)(`div`,{className:r,children:[i,a,o,s]}),t[8]=r,t[9]=i,t[10]=a,t[11]=o,t[12]=s,t[13]=c):c=t[13],c}function Mt(e){let t=(0,Z.c)(10),{task:n,onThreadSelect:r}=e;if(!n.threadId||!r)return null;let i=n.threadId,a;t[0]!==r||t[1]!==i?(a=()=>r(i),t[0]=r,t[1]=i,t[2]=a):a=t[2];let o,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(O,{className:`h-4 w-4`}),s=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Open chat`}),t[3]=o,t[4]=s):(o=t[3],s=t[4]);let c;t[5]===a?c=t[6]:(c=(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsxs)(x,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0`,onClick:a,children:[o,s]})}),t[5]=a,t[6]=c);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(ie,{children:`Open chat`}),t[7]=l):l=t[7];let u;return t[8]===c?u=t[9]:(u=(0,Q.jsxs)(oe,{children:[c,l]}),t[8]=c,t[9]=u),u}function Nt(e){let t=(0,Z.c)(51),{task:n,now:r,onOpenEdit:i,showRunHistory:a,onThreadSelect:o,onStartInNewWorkspace:s,onMarkDone:l,onRunNow:u,onOpenRun:d}=e,f;t[0]!==r||t[1]!==n?(f=Ve(n,r),t[0]=r,t[1]=n,t[2]=f):f=t[2];let p=f,m;t[3]!==i||t[4]!==n?(m=()=>i(n),t[3]=i,t[4]=n,t[5]=m):m=t[5];let h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=b(c.label,`truncate leading-normal`),t[6]=h):h=t[6];let g;t[7]===n.title?g=t[8]:(g=(0,Q.jsx)(`p`,{className:h,children:n.title}),t[7]=n.title,t[8]=g);let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=b(c.caption,`mt-1 line-clamp-2 break-all text-muted-foreground max-sm:hidden`),t[9]=_):_=t[9];let v;t[10]===n.description?v=t[11]:(v=(0,Q.jsx)(`p`,{className:_,children:n.description}),t[10]=n.description,t[11]=v);let y;t[12]===p?y=t[13]:(y=p&&(0,Q.jsx)(`p`,{className:b(c.caption,`mt-1 text-muted-foreground`),children:p}),t[12]=p,t[13]=y);let x;t[14]===n?x=t[15]:(x=At(n)&&(0,Q.jsx)(jt,{task:n,className:`mt-2 flex flex-wrap gap-1`}),t[14]=n,t[15]=x);let S;t[16]!==m||t[17]!==g||t[18]!==v||t[19]!==y||t[20]!==x?(S=(0,Q.jsxs)(`button`,{type:`button`,className:`col-start-1 row-start-1 block min-w-0 overflow-hidden text-left sm:flex-1`,onClick:m,children:[g,v,y,x]}),t[16]=m,t[17]=g,t[18]=v,t[19]=y,t[20]=x,t[21]=S):S=t[21];let C;t[22]!==i||t[23]!==n?(C=()=>i(n),t[22]=i,t[23]=n,t[24]=C):C=t[24];let w;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(w=b(c.caption,`line-clamp-4 break-all text-muted-foreground`),t[25]=w):w=t[25];let T;t[26]===n.description?T=t[27]:(T=(0,Q.jsx)(`p`,{className:w,children:n.description}),t[26]=n.description,t[27]=T);let E;t[28]!==C||t[29]!==T?(E=(0,Q.jsx)(`button`,{type:`button`,className:`col-span-2 row-start-2 block min-w-0 overflow-hidden text-left sm:hidden`,onClick:C,children:T}),t[28]=C,t[29]=T,t[30]=E):E=t[30];let D;t[31]===n?D=t[32]:(D=At(n)&&(0,Q.jsx)(jt,{task:n,className:`col-span-2 row-start-3 flex min-w-0 flex-wrap gap-1 sm:hidden`}),t[31]=n,t[32]=D);let O;t[33]!==o||t[34]!==n?(O=(0,Q.jsx)(Mt,{task:n,onThreadSelect:o}),t[33]=o,t[34]=n,t[35]=O):O=t[35];let k;t[36]!==l||t[37]!==d||t[38]!==u||t[39]!==s||t[40]!==a||t[41]!==n?(k=(0,Q.jsx)(Ot,{task:n,showRunHistory:a,onStartInNewWorkspace:s,onMarkDone:l,onRunNow:u,onOpenRun:d}),t[36]=l,t[37]=d,t[38]=u,t[39]=s,t[40]=a,t[41]=n,t[42]=k):k=t[42];let A;t[43]!==O||t[44]!==k?(A=(0,Q.jsxs)(`div`,{className:`col-start-2 row-start-1 flex shrink-0 items-center gap-1.5 self-start`,children:[O,k]}),t[43]=O,t[44]=k,t[45]=A):A=t[45];let j;return t[46]!==E||t[47]!==D||t[48]!==A||t[49]!==S?(j=(0,Q.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] grid-rows-[auto_auto] gap-x-2 gap-y-1 px-4 py-3 hover:bg-accent/40 sm:flex sm:items-start sm:gap-4`,children:[S,E,D,A]}),t[46]=E,t[47]=D,t[48]=A,t[49]=S,t[50]=j):j=t[50],j}function Pt(e){let t=(0,Z.c)(28),{onSearchTermChange:n}=e,[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(``),s;t[0]===n?s=t[1]:(s=function(e){o(e),n(e)},t[0]=n,t[1]=s);let c=s,l;t[2]===n?l=t[3]:(l=function(){o(``),n(``),i(!1)},t[2]=n,t[3]=l);let u=l,d;t[4]!==u||t[5]!==r?(d=()=>{r?u():i(!0)},t[4]=u,t[5]=r,t[6]=d):d=t[6];let f,p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(ee,{className:`h-4 w-4`}),p=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Search tasks`}),t[7]=f,t[8]=p):(f=t[7],p=t[8]);let m;t[9]!==r||t[10]!==d?(m=(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsxs)(x,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,onClick:d,"aria-expanded":r,children:[f,p]})}),t[9]=r,t[10]=d,t[11]=m):m=t[11];let h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(ie,{children:`Search tasks`}),t[12]=h):h=t[12];let g;t[13]===m?g=t[14]:(g=(0,Q.jsxs)(oe,{children:[m,h]}),t[13]=m,t[14]=g);let _=r?`ml-1 w-44 opacity-100`:`w-0 opacity-0`,v;t[15]===_?v=t[16]:(v=b(`overflow-hidden transition-[width,opacity] duration-200`,_),t[15]=_,t[16]=v);let y;t[17]!==u||t[18]!==c||t[19]!==r||t[20]!==a?(y=r&&(0,Q.jsx)(H,{type:`search`,value:a,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Escape`&&u()},placeholder:`Search`,"aria-label":`Search tasks`,autoFocus:!0,className:`h-8 min-w-44 px-2`}),t[17]=u,t[18]=c,t[19]=r,t[20]=a,t[21]=y):y=t[21];let S;t[22]!==v||t[23]!==y?(S=(0,Q.jsx)(`div`,{className:v,children:y}),t[22]=v,t[23]=y,t[24]=S):S=t[24];let C;return t[25]!==S||t[26]!==g?(C=(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[g,S]}),t[25]=S,t[26]=g,t[27]=C):C=t[27],C}function Ft(e){let t=(0,Z.c)(16),{projectTags:n,hiddenTagIds:r,onToggleHiddenTag:i,onSearchTermChange:a,isRefreshing:o,onRefresh:s,onManageTags:c}=e,{setActions:l}=q(),u;if(t[0]!==r||t[1]!==n){let e;t[3]===r?e=t[4]:(e=function(e){return r.has(e.id)},t[3]=r,t[4]=e),u=n.some(e),t[0]=r,t[1]=n,t[2]=u}else u=t[2];let d=u,f,p;return t[5]!==d||t[6]!==r||t[7]!==o||t[8]!==c||t[9]!==s||t[10]!==a||t[11]!==i||t[12]!==n||t[13]!==l?(f=()=>(l((0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Pt,{onSearchTermChange:a}),(0,Q.jsxs)(oe,{children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsxs)(x,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,onClick:()=>s(),disabled:o,children:[(0,Q.jsx)(S,{className:b(`h-4 w-4`,o&&`animate-spin`)}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Refresh tasks`})]})}),(0,Q.jsx)(ie,{children:`Refresh`})]}),(0,Q.jsxs)(st,{children:[(0,Q.jsxs)(oe,{children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsx)(lt,{asChild:!0,children:(0,Q.jsxs)(x,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`relative`,children:[(0,Q.jsx)(C,{className:`h-4 w-4`}),d&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full bg-primary`})]}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Filter and manage tags`})]})})}),(0,Q.jsx)(ie,{children:`Tags`})]}),(0,Q.jsxs)(it,{align:`end`,className:`max-h-[var(--radix-dropdown-menu-content-available-height)] w-56 overflow-y-auto`,children:[n.length===0?(0,Q.jsx)(K,{disabled:!0,className:`text-muted-foreground`,children:`No tags yet`}):n.map(function(e){let t=!r.has(e.id);return(0,Q.jsxs)(K,{className:`[&_svg]:size-6`,onSelect:function(t){t.preventDefault(),i(e.id)},children:[(0,Q.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:e.color}}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:b(`flex h-7 w-7 shrink-0 items-center justify-center rounded-full border shadow-sm`,t?`border-transparent bg-foreground text-background`:`border-border bg-muted`),children:t&&(0,Q.jsx)(E,{className:`h-6 w-6`})})]},e.id)}),(0,Q.jsx)($e,{}),(0,Q.jsxs)(K,{onClick:c,children:[(0,Q.jsx)(j,{className:`h-4 w-4`}),`Edit Tags`]})]})]})]})),()=>l(null)),p=[l,n,r,d,i,o,s,c,a],t[5]=d,t[6]=r,t[7]=o,t[8]=c,t[9]=s,t[10]=a,t[11]=i,t[12]=n,t[13]=l,t[14]=f,t[15]=p):(f=t[14],p=t[15]),(0,X.useEffect)(f,p),null}function It({selectedTags:e,existingTags:t,onChange:n,placeholder:r=`Add tags...`,allowCreate:i=!0,className:a}){let[o,u]=(0,X.useState)(``),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(0),v=(0,X.useRef)(null),y=(0,X.useMemo)(()=>new Set(e.map(e=>l(e.name))),[e]),S=e.length>=10,C=(0,X.useMemo)(()=>{let e=o.trim(),n=e.toLowerCase(),r=new Map;for(let e of t){let t=l(e.name);y.has(t)||r.set(t,{name:e.name,color:e.color})}for(let e of s){let t=l(e);!y.has(t)&&!r.has(t)&&r.set(t,{name:e,color:f(t)})}let a=(n?[...r.values()].filter(e=>e.name.toLowerCase().includes(n)):[...r.values()]).map(e=>({name:e.name,color:e.color,isCreate:!1}));if(e&&i&&!S){let t=d(e),n=l(t),i=y.has(n)||r.has(n),o=!p(t);!i&&o&&a.push({name:t,color:f(n),isCreate:!0})}return a},[o,t,y,S]);(0,X.useEffect)(()=>{_(0)},[o]),(0,X.useEffect)(function(){if(!m||S)return;let e=requestAnimationFrame(function(){v.current?.focus()});return function(){cancelAnimationFrame(e)}},[m,S]);function w(r){if(S)return;let i=d(r),a=l(i);if(y.has(a))return;let o=t.find(e=>l(e.name)===a)??{id:`new:${a}`,name:i,color:f(a)};n([...e,o]),u(``)}function T(t){n(e.filter(e=>e.id!==t.id))}function E(e){let t=e.currentTarget;t.scrollHeight>t.clientHeight&&e.stopPropagation()}function D(t){if(t.key===`ArrowDown`)t.preventDefault(),m||h(!0),_(e=>(e+1)%Math.max(C.length,1));else if(t.key===`ArrowUp`)t.preventDefault(),_(e=>(e-1+C.length)%Math.max(C.length,1));else if(t.key===`Enter`){t.preventDefault();let e=C[g];e&&w(e.name)}else t.key===`Backspace`&&!o&&e.length>0?T(e[e.length-1]):t.key===`Escape`&&(h(!1),v.current?.blur())}return(0,Q.jsxs)(ft,{open:m,onOpenChange:function(e){h(e),e||u(``)},children:[(0,Q.jsxs)(`div`,{className:b(`flex flex-wrap items-center gap-1.5`,a),children:[e.map(function(e){return(0,Q.jsxs)(st,{children:[(0,Q.jsx)(lt,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,Q.jsx)(_t,{tag:e,className:`cursor-pointer transition-colors hover:border-border hover:bg-muted/40`})})}),(0,Q.jsx)(it,{align:`start`,sideOffset:6,children:(0,Q.jsx)(K,{onSelect:()=>T(e),children:`Delete`})})]},e.id)}),(0,Q.jsx)(ae,{children:(0,Q.jsxs)(oe,{children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsx)(xe,{asChild:!0,children:(0,Q.jsx)(x,{type:`button`,variant:`outline`,size:`icon-xs`,disabled:S,"aria-label":S?`Max 10 tags`:`Add tag`,className:b(`h-6 w-6 rounded-full border-dashed text-muted-foreground`,S&&`opacity-50`),children:(0,Q.jsx)(te,{className:`h-3 w-3`})})})}),(0,Q.jsx)(ie,{children:`Add Tag`})]})})]}),(0,Q.jsxs)(je,{align:`start`,className:`w-72 p-0`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsx)(`div`,{className:`border-b border-border p-2`,children:(0,Q.jsx)(`input`,{ref:v,type:`text`,value:o,onChange:function(e){u(e.target.value)},onKeyDown:D,placeholder:S?`Max 10 tags`:r,disabled:S,className:b(c.body,`w-full rounded-md border border-input bg-background px-3 py-2 outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`)})}),(0,Q.jsx)(`div`,{className:`overflow-y-auto overscroll-contain`,style:{maxHeight:220},onWheel:E,onTouchMove:E,children:C.length===0?(0,Q.jsx)(`p`,{className:b(c.bodyMuted,`px-3 py-4 text-center`),children:S?`Tag limit reached`:`No tags found`}):C.map(function(e,t){return(0,Q.jsxs)(`button`,{type:`button`,className:b(c.body,`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-accent`,g===t&&`bg-accent`),onClick:function(){w(e.name),h(!1)},children:[(0,Q.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:e.color}}),e.isCreate?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Create`}),(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:e.name})]}):(0,Q.jsx)(`span`,{className:`truncate`,children:e.name})]},e.isCreate?`create:${e.name}`:e.name)})})]})]})}var Lt=[{value:`0`,label:`Sunday`},{value:`1`,label:`Monday`},{value:`2`,label:`Tuesday`},{value:`3`,label:`Wednesday`},{value:`4`,label:`Thursday`},{value:`5`,label:`Friday`},{value:`6`,label:`Saturday`}],Rt=Array.from({length:60},function(e,t){return{value:String(t),label:String(t).padStart(2,`0`)}});function $(e,t){return{...e,...t}}function zt(e){let t=(0,Z.c)(7),{value:n,onChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(V,{htmlFor:`schedule-once-at`,children:`Run at`}),t[0]=i):i=t[0];let a;t[1]!==r||t[2]!==n?(a=e=>r($(n,{scheduledAtLocal:e.target.value})),t[1]=r,t[2]=n,t[3]=a):a=t[3];let o;return t[4]!==a||t[5]!==n.scheduledAtLocal?(o=(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[i,(0,Q.jsx)(H,{id:`schedule-once-at`,type:`datetime-local`,value:n.scheduledAtLocal,onChange:a})]}),t[4]=a,t[5]=n.scheduledAtLocal,t[6]=o):o=t[6],o}function Bt(e){let t=e.trim();if(t===``)return NaN;let n=Number(t);return Number.isNaN(n)?NaN:n}function Vt(e){return Math.min(m,Math.max(1,e))}function Ht(e){let t=(0,Z.c)(9),{value:n,onChange:r}=e,i;t[0]!==r||t[1]!==n?(i=n.preset===`weekly`&&(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(V,{children:`Day`}),(0,Q.jsxs)(Je,{value:String(n.dayOfWeek),onValueChange:e=>r($(n,{dayOfWeek:Number(e)})),children:[(0,Q.jsx)(Se,{children:(0,Q.jsx)(we,{})}),(0,Q.jsx)(De,{children:Lt.map(function(e){return(0,Q.jsx)(B,{value:e.value,children:e.label},e.value)})})]})]}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;t[3]!==r||t[4]!==n?(a=n.preset===`interval`?(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(V,{htmlFor:`schedule-interval-minutes`,children:`Minutes`}),(0,Q.jsx)(H,{id:`schedule-interval-minutes`,type:`number`,min:1,max:m,step:1,placeholder:`5`,value:Number.isNaN(n.presetIntervalMinutes)?``:String(n.presetIntervalMinutes),onChange:e=>r($(n,{presetIntervalMinutes:Bt(e.target.value)})),onBlur:()=>{let e=n.presetIntervalMinutes;!Number.isNaN(e)&&e!==Vt(e)&&r($(n,{presetIntervalMinutes:Vt(e)}))}})]}):n.preset===`hourly`?(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(V,{children:`Minute`}),(0,Q.jsxs)(Je,{value:String(n.presetMinute),onValueChange:e=>r($(n,{presetMinute:Number(e)})),children:[(0,Q.jsx)(Se,{children:(0,Q.jsx)(we,{})}),(0,Q.jsx)(De,{children:Rt.map(function(e){return(0,Q.jsx)(B,{value:e.value,children:e.label},e.value)})})]})]}):(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(V,{htmlFor:`schedule-time`,children:`Time`}),(0,Q.jsx)(H,{id:`schedule-time`,type:`time`,value:n.presetTime,onChange:e=>r($(n,{presetTime:e.target.value}))})]}),t[3]=r,t[4]=n,t[5]=a):a=t[5];let o;return t[6]!==i||t[7]!==a?(o=(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[i,a]}),t[6]=i,t[7]=a,t[8]=o):o=t[8],o}var Ut=`once`,Wt=`event`;function Gt(e){let t=(0,Z.c)(22),{value:n,onChange:r,error:i,showRemove:a,onRemove:o}=e,s=a===void 0?!1:a,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(V,{children:`Trigger`}),t[0]=c):c=t[0];let l=n.kind===`event`?Wt:n.scheduleMode===`once`?Ut:n.preset,u;t[1]!==r||t[2]!==n?(u=e=>{r(e===Wt?$(n,{kind:`event`}):e===Ut?$(n,{kind:`schedule`,scheduleMode:`once`}):$(n,{kind:`schedule`,scheduleMode:`repeating`,preset:e}))},t[1]=r,t[2]=n,t[3]=u):u=t[3];let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(Se,{children:(0,Q.jsx)(we,{})}),t[4]=d):d=t[4];let f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsxs)(De,{children:[(0,Q.jsx)(B,{value:Ut,children:`Once`}),(0,Q.jsx)(B,{value:`interval`,children:`Interval`}),(0,Q.jsx)(B,{value:`hourly`,children:`Hourly`}),(0,Q.jsx)(B,{value:`daily`,children:`Daily`}),(0,Q.jsx)(B,{value:`weekdays`,children:`Weekdays`}),(0,Q.jsx)(B,{value:`weekly`,children:`Weekly`}),(0,Q.jsx)(B,{value:Wt,children:`Event`})]}),t[5]=f):f=t[5];let p;t[6]!==l||t[7]!==u?(p=(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[c,(0,Q.jsxs)(Je,{value:l,onValueChange:u,children:[d,f]})]}),t[6]=l,t[7]=u,t[8]=p):p=t[8];let m;t[9]!==i||t[10]!==r||t[11]!==n?(m=n.kind===`event`?(0,Q.jsx)(qt,{value:n,onChange:r,error:i}):n.scheduleMode===`once`?(0,Q.jsx)(zt,{value:n,onChange:r}):(0,Q.jsx)(Ht,{value:n,onChange:r}),t[9]=i,t[10]=r,t[11]=n,t[12]=m):m=t[12];let h;t[13]!==p||t[14]!==m?(h=(0,Q.jsxs)(`div`,{className:`grid flex-1 gap-3 sm:grid-cols-2`,children:[p,m]}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g;t[16]!==o||t[17]!==s?(g=s&&(0,Q.jsxs)(x,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground`,onClick:()=>o?.(),children:[(0,Q.jsx)(N,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Remove trigger`})]}),t[16]=o,t[17]=s,t[18]=g):g=t[18];let _;return t[19]!==g||t[20]!==h?(_=(0,Q.jsx)(`div`,{className:`space-y-3`,children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[h,g]})}),t[19]=g,t[20]=h,t[21]=_):_=t[21],_}function Kt(e){return!!(e&&ye(e))}function qt(e){let t=(0,Z.c)(16),{value:n,onChange:r,error:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(V,{htmlFor:`event-key`,children:`Event Key`}),t[0]=a):a=t[0];let o=n.eventKey,s;t[1]===i?s=t[2]:(s=Kt(i),t[1]=i,t[2]=s);let l;t[3]!==r||t[4]!==n?(l=e=>r($(n,{eventKey:e.target.value})),t[3]=r,t[4]=n,t[5]=l):l=t[5];let u;t[6]!==s||t[7]!==l||t[8]!==n.eventKey?(u=(0,Q.jsx)(H,{id:`event-key`,value:o,placeholder:`door.opened`,"aria-invalid":s,onChange:l}),t[6]=s,t[7]=l,t[8]=n.eventKey,t[9]=u):u=t[9];let d;t[10]!==i||t[11]!==n.eventKey?(d=Kt(i)?(0,Q.jsx)(`p`,{className:b(c.caption,`text-destructive`),children:i}):(0,Q.jsxs)(`p`,{className:b(c.caption,`text-muted-foreground`),children:[`Test in chat with `,(0,Q.jsxs)(`code`,{children:[`/send-event `,n.eventKey.trim()||`event.key`]})]}),t[10]=i,t[11]=n.eventKey,t[12]=d):d=t[12];let f;return t[13]!==u||t[14]!==d?(f=(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[a,u,d]}),t[13]=u,t[14]=d,t[15]=f):f=t[15],f}function Jt(e){let t=(0,Z.c)(3),{error:n,kind:r}=e;if(!n||r===`event`)return null;let i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=b(c.caption,`text-destructive`),t[0]=i):i=t[0];let a;return t[1]===n?a=t[2]:(a=(0,Q.jsx)(`p`,{className:i,children:n}),t[1]=n,t[2]=a),a}function Yt(e){let t=(0,Z.c)(20),{value:n,onChange:r,onTriggerRemoved:i,showRemoveControl:a,error:o}=e,s=a===void 0?!1:a,l=o===void 0?null:o,u;t[0]!==r||t[1]!==i||t[2]!==n?(u=()=>{r($(n,{kind:`manual`})),i?.()},t[0]=r,t[1]=i,t[2]=n,t[3]=u):u=t[3];let d;t[4]!==l||t[5]!==r||t[6]!==s||t[7]!==u||t[8]!==n?(d=(0,Q.jsx)(Gt,{value:n,onChange:r,error:l,showRemove:s,onRemove:u}),t[4]=l,t[5]=r,t[6]=s,t[7]=u,t[8]=n,t[9]=d):d=t[9];let f;t[10]!==l||t[11]!==n.kind?(f=(0,Q.jsx)(Jt,{error:l,kind:n.kind}),t[10]=l,t[11]=n.kind,t[12]=f):f=t[12];let p;t[13]!==r||t[14]!==n?(p=n.kind!==`manual`&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n.kind!==`event`&&(0,Q.jsxs)(`p`,{className:b(c.caption,`text-muted-foreground`),children:[`Timezone: `,n.timezone]}),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,Q.jsx)(Ze,{id:`trigger-paused`,checked:!n.enabled,onCheckedChange:e=>{r($(n,{enabled:e!==!0}))}}),(0,Q.jsx)(V,{htmlFor:`trigger-paused`,className:c.caption,children:`Paused`})]})]}),t[13]=r,t[14]=n,t[15]=p):p=t[15];let m;return t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4 rounded-lg border border-border p-4`,children:[d,f,p]}),t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19],m}var Xt=u(`app.task-list.add-dialog`);function Zt({open:e,automationsOnly:t,projectId:n,projectTags:r,thread:i,getTriggerValidationError:a,onOpenChange:o,onTaskCreated:s,onTaskUpdated:c}){let[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)([]),[p,m]=(0,X.useState)(z),[h,g]=(0,X.useState)(!0),[_,v]=(0,X.useState)(null),[y,b]=(0,X.useState)(!1),[S,C]=(0,X.useState)(!1);(0,X.useEffect)(()=>{e&&(u(``),f([]),m(t?Fe():z()),g(!t))},[e,t]);let w=(0,X.useCallback)((e,t)=>{u(n=>t?.replace||!n.trim()?e:`${n.trimEnd()} ${e}`)},[]);function E(){return!!(l.trim()||d.length||!h&&JSON.stringify(p)!==JSON.stringify(Fe()))}function D(e){if(e){o(!0);return}if(E()){b(!0);return}v(null),o(!1)}function O(){b(!1),o(!1)}async function k(e){e.preventDefault(),await A()&&b(!1)}async function A(){if(!l.trim())return!1;let e=a(h,p);if(e)return v(e),!1;v(null),C(!0);try{let e=Ce({description:l,tagNames:d.map(e=>e.name),triggerCollapsed:h,triggerForm:p,thread:nt({selectedThreadId:i.selectedThreadId,selectedThreadModel:i.selectedThreadModel,selectedThread:i.selectedThread})}),t=await He(n,e.description,e.context);return s(t),o(!1),Ye(n,t.id,{...e.context,expectedTitle:t.title}).then(c).catch(e=>Xt.error(`Failed to generate task title:`,e)),u(``),f([]),v(null),!0}catch(e){return v(Pe(e,`Failed to add task`)),Xt.error(`Failed to add task:`,e),!1}finally{C(!1)}}return(0,Q.jsxs)(tt,{open:e,onOpenChange:D,children:[(0,Q.jsxs)(Y,{className:`max-w-2xl flex flex-col overflow-hidden max-md:top-[max(1rem,env(safe-area-inset-top,0px))] max-md:max-h-[calc(100dvh-2rem)] max-md:translate-y-0 max-md:data-[state=closed]:slide-out-to-top max-md:data-[state=open]:slide-in-from-top max-md:data-[state=closed]:slide-out-to-left-0 max-md:data-[state=open]:slide-in-from-left-0 max-md:data-[state=closed]:zoom-out-100 max-md:data-[state=open]:zoom-in-100 md:max-h-[calc(100svh-2rem)]`,children:[(0,Q.jsx)(Re,{className:`shrink-0`,children:(0,Q.jsxs)(oe,{children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsx)(dt,{className:`w-fit cursor-help`,children:t?`Add Automation`:`New Task`})}),(0,Q.jsx)(ie,{side:`top`,className:`max-w-xs`,children:`A title will be generated automatically from your description.`})]})}),(0,Q.jsx)(ue,{type:`auto`,className:`min-h-0 flex-1`,children:(0,Q.jsxs)(`div`,{className:`py-2 pl-1`,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(Te,{placeholder:`Describe what needs to be done...`,value:l,onChange:e=>u(e.target.value),rows:12,className:`max-h-[min(16rem,40svh)] resize-none pe-12 pb-10 text-base sm:max-h-none`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&A()}}),(0,Q.jsx)(It,{selectedTags:d,existingTags:r,onChange:f,allowCreate:!1,className:`absolute bottom-3 start-3 max-w-[calc(100%-4rem)]`}),(0,Q.jsx)(`div`,{className:`absolute bottom-3 end-3`,children:(0,Q.jsx)(qe,{onTranscript:w,threadId:i.selectedThreadId??void 0,provider:i.selectedThreadModel?.provider,model:i.selectedThreadModel?.id,children:({onClick:e,disabled:t,icon:n,label:r,isRecording:i,isTranscribing:a})=>(0,Q.jsx)(x,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":r,onClick:e,disabled:t||S,className:i||a?`text-destructive`:void 0,children:n})})})]}),!h&&(0,Q.jsx)(Yt,{value:p,onChange:e=>{m(e),v(null)},showRemoveControl:!0,onTriggerRemoved:()=>{g(!0),m(z())},error:_})]})}),(0,Q.jsxs)(U,{className:`shrink-0`,children:[t&&h&&(0,Q.jsx)(x,{type:`button`,variant:`outline`,disabled:S,onClick:()=>{g(!1),m(Fe())},children:`Add automation`}),(0,Q.jsxs)(x,{onClick:()=>void A(),disabled:S||!l.trim(),children:[`Add`,S?(0,Q.jsx)(T,{className:`ml-1 h-3 w-3 animate-spin`}):null]})]})]}),(0,Q.jsx)(ve,{open:y,onOpenChange:b,children:(0,Q.jsxs)(he,{children:[(0,Q.jsxs)(_e,{children:[(0,Q.jsx)(me,{children:`Save your task?`}),(0,Q.jsx)(I,{children:`You have unsaved changes. Would you like to save them before closing?`})]}),(0,Q.jsxs)(ge,{children:[(0,Q.jsx)(R,{children:`Keep editing`}),(0,Q.jsx)(L,{onClick:O,children:`Discard`}),(0,Q.jsx)(L,{onClick:k,children:`Save`})]})]})})]})}function Qt(e){let t=(0,Z.c)(6),[n,r]=(0,X.useState)(``),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,X.useState)(i),[s,c]=(0,X.useState)(z),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(null);if(e!==d&&(f(e),e)){let t=Ue(e);r(e.description),o(e.tags??[]),c(t),u(!Oe(t))}let p;return t[1]!==n||t[2]!==a||t[3]!==l||t[4]!==s?(p={description:n,setDescription:r,editTags:a,setEditTags:o,editTriggerForm:s,setEditTriggerForm:c,editTriggerCollapsed:l,setEditTriggerCollapsed:u},t[1]=n,t[2]=a,t[3]=l,t[4]=s,t[5]=p):p=t[5],p}var $t=u(`app.task-list.edit-dialog`);function en({task:e,automationsOnly:t,projectId:n,projectTags:r,thread:i,getTriggerValidationError:a,onOpenChange:o,onTaskSaved:s,onTaskDeleted:c}){let{description:l,setDescription:u,editTags:d,setEditTags:f,editTriggerForm:p,setEditTriggerForm:m,editTriggerCollapsed:h,setEditTriggerCollapsed:g}=Qt(e),[_,v]=(0,X.useState)(null),[y,b]=(0,X.useState)(!1),[S,C]=(0,X.useState)(!1);function w(){return e?Ee({task:e,description:l,tagNames:d.map(e=>e.name),triggerForm:p,thread:nt({selectedThreadId:i.selectedThreadId,selectedThreadModel:i.selectedThreadModel,selectedThread:i.selectedThread})}).kind!==`unchanged`:!1}function E(e){if(e){o(!0);return}if(w()){C(!0);return}v(null),o(!1)}function D(){C(!1),o(!1)}async function O(e){e.preventDefault(),await A()&&C(!1)}function k(){if(!l.trim()||!e)return!1;let t=a(!Oe(p),p);return t?(v(t),!1):!0}async function A(){if(!k())return!1;v(null),b(!0);try{return await j(),!0}catch(e){return ee(e),!1}finally{b(!1)}}async function j(){if(!e)return;let t=Ee({task:e,description:l,tagNames:d.map(e=>e.name),triggerForm:p,thread:nt({selectedThreadId:i.selectedThreadId,selectedThreadModel:i.selectedThreadModel,selectedThread:i.selectedThread})});if(t.kind===`unchanged`){o(!1);return}let r=await Be(n,e.id,t.payload),a=e.status===`Done`!=(r.status===`Done`);s(r,{tagsChanged:t.tagsChanged,completedChanged:a}),o(!1)}function ee(e){v(Pe(e,`Failed to save task`)),$t.error(`Failed to save task:`,e)}async function te(){if(e){b(!0);try{await et(n,e.id),c(e.id),o(!1)}catch(e){$t.error(`Failed to delete task:`,e)}finally{b(!1)}}}return(0,Q.jsxs)(tt,{open:e!==null,onOpenChange:E,children:[(0,Q.jsxs)(Y,{className:`max-w-2xl flex flex-col overflow-hidden max-md:top-[max(1rem,env(safe-area-inset-top,0px))] max-md:max-h-[calc(100dvh-2rem)] max-md:translate-y-0 max-md:data-[state=closed]:slide-out-to-top max-md:data-[state=open]:slide-in-from-top max-md:data-[state=closed]:slide-out-to-left-0 max-md:data-[state=open]:slide-in-from-left-0 max-md:data-[state=closed]:zoom-out-100 max-md:data-[state=open]:zoom-in-100 md:max-h-[calc(100svh-2rem)]`,children:[(0,Q.jsx)(Re,{className:`shrink-0`,children:(0,Q.jsx)(dt,{children:t?`Edit Automation`:`Edit Task`})}),(0,Q.jsx)(ue,{type:`auto`,className:`min-h-0 flex-1`,children:(0,Q.jsxs)(`div`,{className:`py-2 pl-1`,children:[(0,Q.jsx)(Te,{placeholder:`Describe what needs to be done...`,value:l,onChange:e=>u(e.target.value),rows:12,className:`max-h-[min(16rem,40svh)] resize-none text-base sm:max-h-none`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&A()}}),(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(It,{selectedTags:d,existingTags:r,onChange:f,allowCreate:!1})}),!h&&(0,Q.jsx)(Yt,{value:p,onChange:e=>{m(e),v(null)},showRemoveControl:!0,onTriggerRemoved:()=>{g(!0),m(z()),v(null)},error:_})]})}),(0,Q.jsxs)(U,{className:`flex-row shrink-0 justify-between gap-2 sm:justify-between sm:gap-0`,children:[(0,Q.jsx)(x,{variant:`destructive`,onClick:()=>void te(),disabled:y,children:`Delete`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t&&h&&(0,Q.jsx)(x,{type:`button`,variant:`outline`,disabled:y,onClick:()=>{g(!1),m(Fe())},children:`Add automation`}),(0,Q.jsxs)(x,{onClick:()=>void A(),disabled:y||!l.trim(),className:`w-auto`,children:[`Save`,y?(0,Q.jsx)(T,{className:`ml-1 h-3 w-3 animate-spin`}):null]})]})]})]}),(0,Q.jsx)(ve,{open:S,onOpenChange:C,children:(0,Q.jsxs)(he,{children:[(0,Q.jsxs)(_e,{children:[(0,Q.jsx)(me,{children:`Save your changes?`}),(0,Q.jsx)(I,{children:`You have unsaved changes. Would you like to save them before closing?`})]}),(0,Q.jsxs)(ge,{children:[(0,Q.jsx)(R,{children:`Keep editing`}),(0,Q.jsx)(L,{onClick:D,children:`Discard`}),(0,Q.jsx)(L,{onClick:O,children:`Save`})]})]})})]})}function tn({open:e,onOpenChange:t,projectId:n,tags:r,onTagsChanged:i}){let[a,o]=(0,X.useState)(null),[s,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(null);function S(e){o(e.id),l(e.name),_(null)}function C(){o(null),l(``),_(null)}async function D(){let e=u.trim();if(e){h(!0),_(null);try{let t=await ct(n,e);i([...r,t]),d(``)}catch(e){_(e instanceof Error?e.message:`Failed to create tag`)}finally{h(!1)}}}async function O(e){let t=s.trim();if(t){p(!0),_(null);try{let a=await ut(n,e,t);i(r.map(e=>e.id===a.id?{...e,name:a.name,color:a.color}:e)),C()}catch(e){_(e instanceof Error?e.message:`Failed to rename tag`)}finally{p(!1)}}}async function k(e){p(!0),_(null);try{await We(n,e),i(r.filter(t=>t.id!==e)),y(null),a===e&&C()}catch(e){_(e instanceof Error?e.message:`Failed to delete tag`)}finally{p(!1)}}return(0,Q.jsx)(tt,{open:e,onOpenChange:t,children:(0,Q.jsxs)(Y,{className:`flex max-h-[min(36rem,85vh)] flex-col sm:max-w-md`,children:[(0,Q.jsx)(Re,{children:(0,Q.jsx)(dt,{children:`Manage Tags`})}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 py-2`,children:[(0,Q.jsx)(H,{value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&D(),e.key===`Escape`&&d(``)},placeholder:`New tag name...`,className:`h-8 flex-1`,disabled:m}),(0,Q.jsx)(x,{size:`sm`,className:`h-8 shrink-0 bg-foreground text-background hover:bg-foreground/90`,onClick:()=>void D(),disabled:m||!u.trim(),children:m?(0,Q.jsx)(T,{className:`h-3.5 w-3.5 animate-spin`}):`Add`})]}),r.length===0?(0,Q.jsx)(`p`,{className:b(c.bodyMuted,`py-4 text-center`),children:`No tags yet. Create one above to get started.`}):(0,Q.jsx)(le,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(`div`,{className:`space-y-1 py-2 pr-3`,children:r.map(e=>{let t=a===e.id,n=v===e.id;return(0,Q.jsx)(`div`,{className:b(`group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-accent/40`,!t&&!n&&!f&&`cursor-pointer`),onClick:()=>{!f&&!t&&!n&&S(e)},children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(H,{value:s,onChange:e=>l(e.target.value),onKeyDown:t=>{t.key===`Enter`&&O(e.id),t.key===`Escape`&&C()},className:`h-8 flex-1 text-sm`,autoFocus:!0,disabled:f}),(0,Q.jsx)(x,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0`,onClick:()=>void O(e.id),disabled:f||!s.trim(),children:f?(0,Q.jsx)(T,{className:`h-4 w-4 animate-spin`}):(0,Q.jsx)(E,{className:`h-4 w-4`})}),(0,Q.jsx)(x,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0`,onClick:C,disabled:f,children:(0,Q.jsx)(N,{className:`h-4 w-4`})})]}):n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{className:b(c.body,`flex-1 truncate`),children:[`Delete `,e.name,`? Removes from `,e.taskCount,` `,e.taskCount===1?`task`:`tasks`,`.`]}),(0,Q.jsx)(x,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-destructive hover:text-destructive`,onClick:()=>void k(e.id),disabled:f,children:f?(0,Q.jsx)(T,{className:`h-4 w-4 animate-spin`}):(0,Q.jsx)(E,{className:`h-4 w-4`})}),(0,Q.jsx)(x,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0`,onClick:()=>y(null),disabled:f,children:(0,Q.jsx)(N,{className:`h-4 w-4`})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`h-2.5 w-2.5 shrink-0 rounded-full`,style:{backgroundColor:e.color}}),(0,Q.jsx)(`span`,{className:b(c.body,`min-w-0 flex-1 truncate`),children:e.name}),(0,Q.jsxs)(`span`,{className:b(c.caption,`shrink-0 text-muted-foreground`),children:[e.taskCount,` `,e.taskCount===1?`task`:`tasks`]}),(0,Q.jsx)(x,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-destructive opacity-0 pointer-events-none transition-opacity can-hover:group-hover:opacity-100 can-hover:group-hover:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto can-hover:hover:text-destructive`,onClick:t=>{t.stopPropagation(),y(e.id)},disabled:f,"aria-label":`Delete ${e.name}`,children:(0,Q.jsx)(w,{className:`h-3.5 w-3.5`})})]})},e.id)})})}),g&&(0,Q.jsx)(`p`,{className:b(c.caption,`text-destructive`),children:g})]})})}var nn=u(`app.task-list.sync`);function rn({projectId:e,initialTasks:t,refreshTrigger:n,project:r,onRefreshTags:i}){let a=_(),[o,s]=(0,X.useState)(t),[c,l]=(0,X.useState)(!1),u=(0,X.useRef)(n??0),d=(0,X.useRef)({}),f=r?.tasksModifiedCount??0,p=(0,X.useCallback)(async function(){l(!0);try{await se(e),s(await Le(e)),ze(e),i(),F();let t=await P();a({type:g.SetProjects,projects:t.projects,cloneRootPath:t.cloneRootPath})}catch(e){nn.error(`Failed to refresh project tasks:`,e)}finally{l(!1)}},[e,a,i]);(0,X.useEffect)(()=>{n==null||n===u.current||(u.current=n,p())},[n,p]),(0,X.useEffect)(()=>{let t=d.current[e]??0;if(f===0){d.current[e]=0;return}t!==f&&(d.current[e]=f,f>t&&p())},[f,e,p]);let m=o.some(e=>e.working);return(0,X.useEffect)(()=>{if(!m)return;let t=setInterval(async()=>{try{s(await Le(e))}catch(e){nn.error(`Failed to poll project tasks:`,e)}},2e3);return()=>clearInterval(t)},[m,e]),(0,X.useEffect)(()=>{s(t)},[t]),{tasks:o,setTasks:s,isRefreshing:c,handleRefreshTasks:p}}var an=u(`app.task-list.ui`);function on(e){let t=(0,Z.c)(15),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,i]=(0,X.useState)(n),a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=new Set,t[1]=a):a=t[1];let[o,s]=(0,X.useState)(a),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),f,p;t[2]===e?(f=t[3],p=t[4]):(f=()=>{W(e).then(i).catch(cn)},p=[e],t[2]=e,t[3]=f,t[4]=p),(0,X.useEffect)(f,p);let m;t[5]===e?m=t[6]:(m=function(){W(e).then(i).catch(sn)},t[5]=e,t[6]=m);let h=m,g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(e){s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[7]=g):g=t[7];let _=g,v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=function(){d(!0)},t[8]=v):v=t[8];let y=v,b;return t[9]!==o||t[10]!==u||t[11]!==r||t[12]!==h||t[13]!==c?(b={projectTags:r,setProjectTags:i,hiddenTagIds:o,setHiddenTagIds:s,searchTerm:c,setSearchTerm:l,manageTagsOpen:u,setManageTagsOpen:d,refreshProjectTags:h,toggleHiddenTag:_,openManageTags:y},t[9]=o,t[10]=u,t[11]=r,t[12]=h,t[13]=c,t[14]=b):b=t[14],b}function sn(e){return an.error(`Failed to refresh project tags:`,e)}function cn(e){return an.error(`Failed to fetch project tags:`,e)}function ln(e){let t=(0,Z.c)(15),n=v(hn),r=v(mn),i=v(pn),a=v(fn),o=v(dn),s=v(un),c,l;if(t[0]!==e||t[1]!==n||t[2]!==r){let i;t[5]===e?i=t[6]:(i=t=>t.projectId===e,t[5]=e,t[6]=i),c=n.find(i),l=c?.threads.find(e=>e.threadId===r),t[0]=e,t[1]=n,t[2]=r,t[3]=c,t[4]=l}else c=t[3],l=t[4];let u=l,d=r?s[r]:void 0,f;return t[7]!==a||t[8]!==i||t[9]!==c||t[10]!==o||t[11]!==u||t[12]!==r||t[13]!==d?(f={project:c,selectedThreadId:r,selectedThread:u,selectedThreadModel:d,processingThreadIds:i,pendingChatMessage:a,queuedChatMessages:o},t[7]=a,t[8]=i,t[9]=c,t[10]=o,t[11]=u,t[12]=r,t[13]=d,t[14]=f):f=t[14],f}function un(e){return e.projectModelSelections}function dn(e){return e.queuedChatMessages}function fn(e){return e.pendingChatMessage}function pn(e){return e.processingThreadIds}function mn(e){return e.selectedThreadId}function hn(e){return e.projects}function gn(){let e=(0,Z.c)(3),{modelAliases:t,isLoading:n}=be(),r;return e[0]!==t||e[1]!==n?(r=function(e,r){if(e)return null;let i=Xe(r);if(i)return Ie(i);if(n)return null;let a=ot(r,t);return a?Ie(a):null},e[0]=t,e[1]=n,e[2]=r):r=e[2],r}function _n(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Q.jsxs)(`div`,{className:`text-center`,children:[(0,Q.jsx)(Me,{className:`mx-auto`}),(0,Q.jsx)(`p`,{className:b(c.bodyMuted,`mt-2`),children:`Loading tasks`})]})}),e[0]=t):t=e[0],t}function vn(e){let t=(0,Z.c)(5),{projectId:n,resourceKey:r,children:i}=e,a;t[0]===n?a=t[1]:(a=function(){return rt(n)},t[0]=n,t[1]=a);let o=pe(r,a),s;return t[2]!==i||t[3]!==o?(s=i(o),t[2]=i,t[3]=o,t[4]=s):s=t[4],s}function yn({projectId:e,children:t}){let[n,r]=(0,X.useState)(0),i=Ke(e,n),a=(0,X.useRef)(null);a.current!==i&&(a.current=i,fe(i));function o(){fe(i),r(function(e){return e+1})}return(0,Q.jsx)(gt,{fallbackTitle:`Failed to load tasks`,onRetry:o,children:(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(_n,{}),children:(0,Q.jsx)(vn,{projectId:e,resourceKey:i,children:t},i)})},e)}var bn=u(`app.task-list.ui`);function xn(e){let t=(0,Z.c)(127),{projectId:n,onThreadSelect:r,initialTasks:a,refreshTrigger:s,automationsOnly:l}=e,u=l===void 0?!1:l,d=_(),{project:f,selectedThreadId:p,selectedThread:m,selectedThreadModel:h}=ln(n),[v,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)(null),{projectTags:T,setProjectTags:E,hiddenTagIds:D,setHiddenTagIds:O,searchTerm:k,setSearchTerm:A,manageTagsOpen:j,setManageTagsOpen:ee,refreshProjectTags:M,toggleHiddenTag:ne,openManageTags:N}=on(n),ae;t[0]!==a||t[1]!==f||t[2]!==n||t[3]!==M||t[4]!==s?(ae={projectId:n,initialTasks:a,refreshTrigger:s,project:f,onRefreshTags:M},t[0]=a,t[1]=f,t[2]=n,t[3]=M,t[4]=s,t[5]=ae):ae=t[5];let{tasks:P,setTasks:F,isRefreshing:se,handleRefreshTasks:ce}=rn(ae),ue=ht(Ae,u),fe;t[6]!==ue||t[7]!==u?(fe=u?new Date(ue):void 0,t[6]=ue,t[7]=u,t[8]=fe):fe=t[8];let pe=fe,I=gn(),me=i(),he;t[9]===me?he=t[10]:(he=function(){me.invalidateQueries({queryKey:o.conversations.unreadAll()})},t[9]=me,t[10]=he);let L=he,ge;t[11]!==M||t[12]!==F||t[13]!==P?(ge=function(e){let t=P.find(t=>t.id===e.id);F(t=>t.map(t=>t.id===e.id?e:t)),t&&t.status===`Done`!=(e.status===`Done`)&&M()},t[11]=M,t[12]=F,t[13]=P,t[14]=ge):ge=t[14];let R=ge,_e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_e=function(e){w({task:e})},t[15]=_e):_e=t[15];let ve=_e,ye;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ye=function(){w(null)},t[16]=ye):ye=t[16];let be=ye,xe;t[17]!==n||t[18]!==M||t[19]!==F?(xe=function(e){F(t=>[...t,e]),ze(n),M()},t[17]=n,t[18]=M,t[19]=F,t[20]=xe):xe=t[20];let Se=xe,Ce;t[21]!==n||t[22]!==F?(Ce=function(e){F(t=>t.map(t=>t.id===e.id?e:t)),ze(n)},t[21]=n,t[22]=F,t[23]=Ce):Ce=t[23];let we=Ce,Te;t[24]!==n||t[25]!==M||t[26]!==F?(Te=function(e,t){F(t=>t.map(t=>t.id===e.id?e:t)),ze(n),(t.tagsChanged||t.completedChanged)&&M()},t[24]=n,t[25]=M,t[26]=F,t[27]=Te):Te=t[27];let z=Te,Ee;t[28]!==n||t[29]!==M||t[30]!==F?(Ee=function(e){F(t=>t.filter(t=>t.id!==e)),ze(n),M()},t[28]=n,t[29]=M,t[30]=F,t[31]=Ee):Ee=t[31];let De=Ee,B;t[32]!==n||t[33]!==O||t[34]!==E||t[35]!==F?(B=function(e){let t=pt(e),r=new Set(t.map(function(e){return e.id}));E(t),O(function(e){return new Set([...e].filter(e=>r.has(e)))}),Le(n).then(F).catch(Sn)},t[32]=n,t[33]=O,t[34]=E,t[35]=F,t[36]=B):B=t[36];let Oe=B,je;t[37]!==d||t[38]!==R||t[39]!==n||t[40]!==L?(je=async function(e){try{await ke({projectId:n,dispatch:d,onUpdate:R},e),L()}catch(e){let t=e;de({title:`Could not start the task`,description:t instanceof Error?t.message:String(t),variant:`destructive`})}},t[37]=d,t[38]=R,t[39]=n,t[40]=L,t[41]=je):je=t[41];let Me=je,Pe;t[42]!==R||t[43]!==n||t[44]!==L?(Pe=async function(e){R(await mt(n,e.id)),ze(n),L()},t[42]=R,t[43]=n,t[44]=L,t[45]=Pe):Pe=t[45];let Fe=Pe,Ie;t[46]!==d||t[47]!==r||t[48]!==n?(Ie=async function(e){r?await r(e):d({type:g.SelectThread,threadId:e,projectId:n})},t[46]=d,t[47]=r,t[48]=n,t[49]=Ie):Ie=t[49];let Re=Ie,Ve;t[50]!==R||t[51]!==n?(Ve=async function(e){R(await Be(n,e.id,{status:`Done`,working:!1})),ze(n)},t[50]=R,t[51]=n,t[52]=Ve):Ve=t[52];let He=Ve,V;t[53]!==m||t[54]!==p||t[55]!==h?(V={selectedThreadId:p,selectedThreadModel:h,selectedThread:m},t[53]=m,t[54]=p,t[55]=h,t[56]=V):V=t[56];let Ue=V,We,H,Ge,U,W,G;if(t[57]!==pe||t[58]!==u||t[59]!==He||t[60]!==Re||t[61]!==ce||t[62]!==Fe||t[63]!==Me||t[64]!==D||t[65]!==se||t[66]!==r||t[67]!==N||t[68]!==f||t[69]!==T||t[70]!==k||t[71]!==A||t[72]!==P||t[73]!==ne){let{viewTasks:e,visibleTasks:n,emptyListMessage:i,noMatchMessage:a}=Ne(P,{automationsOnly:u,hiddenTagIds:D,searchTerm:k,projectName:f?y(f):void 0});W=`relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,t[80]!==ce||t[81]!==D||t[82]!==se||t[83]!==N||t[84]!==T||t[85]!==A||t[86]!==ne?(G=(0,Q.jsx)(Ft,{projectTags:T,hiddenTagIds:D,onToggleHiddenTag:ne,onSearchTermChange:A,isRefreshing:se,onRefresh:ce,onManageTags:N}),t[80]=ce,t[81]=D,t[82]=se,t[83]=N,t[84]=T,t[85]=A,t[86]=ne,t[87]=G):G=t[87],We=le,U=`min-h-0 min-w-0 flex-1 overflow-hidden`,H=`pb-14`,Ge=e.length===0?(0,Q.jsx)(`p`,{className:b(c.bodyMuted,`px-4 py-8 text-center`),children:i}):n.length===0?(0,Q.jsx)(`p`,{className:b(c.bodyMuted,`px-4 py-8 text-center`),children:a}):(0,Q.jsx)(`div`,{className:`min-w-0 w-full divide-y divide-border`,children:n.map(function(e){return(0,Q.jsx)(Nt,{task:e,now:pe,onOpenEdit:ve,showRunHistory:u,onThreadSelect:r,onStartInNewWorkspace:Me,onMarkDone:He,onRunNow:Fe,onOpenRun:Re},e.id)})}),t[57]=pe,t[58]=u,t[59]=He,t[60]=Re,t[61]=ce,t[62]=Fe,t[63]=Me,t[64]=D,t[65]=se,t[66]=r,t[67]=N,t[68]=f,t[69]=T,t[70]=k,t[71]=A,t[72]=P,t[73]=ne,t[74]=We,t[75]=H,t[76]=Ge,t[77]=U,t[78]=W,t[79]=G}else We=t[74],H=t[75],Ge=t[76],U=t[77],W=t[78],G=t[79];let Ke;t[88]!==H||t[89]!==Ge?(Ke=(0,Q.jsx)(`div`,{className:H,children:Ge}),t[88]=H,t[89]=Ge,t[90]=Ke):Ke=t[90];let K;t[91]!==We||t[92]!==U||t[93]!==Ke?(K=(0,Q.jsx)(We,{className:U,children:Ke}),t[91]=We,t[92]=U,t[93]=Ke,t[94]=K):K=t[94];let qe;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,Q.jsxs)(oe,{children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsxs)(x,{size:`icon`,className:`absolute bottom-6 right-6 z-10 h-10 w-10 rounded-full shadow-lg`,onClick:()=>S(!0),children:[(0,Q.jsx)(te,{className:`h-5 w-5`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`New task`})]})}),(0,Q.jsx)(ie,{children:`New task`})]}),t[95]=qe):qe=t[95];let q;t[96]!==v||t[97]!==u||t[98]!==I||t[99]!==Se||t[100]!==we||t[101]!==n||t[102]!==T||t[103]!==Ue?(q=(0,Q.jsx)(Zt,{open:v,automationsOnly:u,projectId:n,projectTags:T,thread:Ue,getTriggerValidationError:I,onOpenChange:S,onTaskCreated:Se,onTaskUpdated:we}),t[96]=v,t[97]=u,t[98]=I,t[99]=Se,t[100]=we,t[101]=n,t[102]=T,t[103]=Ue,t[104]=q):q=t[104];let Je=C?.task??null,J;t[105]!==u||t[106]!==I||t[107]!==De||t[108]!==z||t[109]!==n||t[110]!==T||t[111]!==Je||t[112]!==Ue?(J=(0,Q.jsx)(en,{task:Je,automationsOnly:u,projectId:n,projectTags:T,thread:Ue,getTriggerValidationError:I,onOpenChange:be,onTaskSaved:z,onTaskDeleted:De}),t[105]=u,t[106]=I,t[107]=De,t[108]=z,t[109]=n,t[110]=T,t[111]=Je,t[112]=Ue,t[113]=J):J=t[113];let Ye;t[114]!==Oe||t[115]!==j||t[116]!==n||t[117]!==T||t[118]!==ee?(Ye=(0,Q.jsx)(tn,{open:j,onOpenChange:ee,projectId:n,tags:T,onTagsChanged:Oe}),t[114]=Oe,t[115]=j,t[116]=n,t[117]=T,t[118]=ee,t[119]=Ye):Ye=t[119];let Y;return t[120]!==W||t[121]!==G||t[122]!==K||t[123]!==q||t[124]!==J||t[125]!==Ye?(Y=(0,Q.jsxs)(`div`,{className:W,children:[G,K,qe,q,J,Ye]}),t[120]=W,t[121]=G,t[122]=K,t[123]=q,t[124]=J,t[125]=Ye,t[126]=Y):Y=t[126],Y}function Sn(e){return bn.error(`Failed to refresh tasks after tag change:`,e)}function Cn(e){let t=(0,Z.c)(5),n;t[0]===e?n=t[1]:(n=function(t){return(0,Q.jsx)(xn,{...e,initialTasks:t})},t[0]=e,t[1]=n);let r=n,i;return t[2]!==e.projectId||t[3]!==r?(i=(0,Q.jsx)(yn,{projectId:e.projectId,children:r}),t[2]=e.projectId,t[3]=r,t[4]=i):i=t[4],i}var wn=u(`app.tasks-view.ui`);async function Tn(){return F(),P()}function En(e,t,n,r,i){r===t&&i===n||e({type:g.SelectThread,threadId:t,projectId:n})}async function Dn(e){try{let t=await ce();e({type:g.SetProcessingThreads,threadIds:t})}catch(e){wn.error(`Failed to fetch processing threads after thread selection:`,e)}}function On(e){let t=(0,Z.c)(16),{projectId:n,refreshTrigger:r,view:i}=e,o=i===void 0?`tasks`:i,s=_(),c=v(jn),l=v(An),u=v(kn),{expandWindow:d,hasOpenWindows:f}=a(),p,m;t[0]===s?(p=t[1],m=t[2]):(p=()=>{let e=!1;return(async()=>{try{let t=await Tn();e||s({type:g.SetProjects,projects:t.projects,cloneRootPath:t.cloneRootPath})}catch(e){let t=e;wn.error(`Failed to refresh projects on tasks view mount:`,t)}})(),()=>{e=!0}},m=[s],t[0]=s,t[1]=p,t[2]=m),(0,X.useEffect)(p,m);let y;t[3]!==s||t[4]!==d||t[5]!==f||t[6]!==n||t[7]!==c||t[8]!==u||t[9]!==l?(y=async function(e){if(!c.find(e=>e.projectId===n))return;f&&d(h);let t=null;try{t=await Tn(),s({type:g.SetProjects,projects:t.projects,cloneRootPath:t.cloneRootPath})}catch(e){let t=e;wn.error(`Failed to refresh projects for thread selection:`,t)}t&&!t.projects.find(e=>e.projectId===n)?.threads.find(t=>t.threadId===e)||(En(s,e,n,l,u),await Dn(s))},t[3]=s,t[4]=d,t[5]=f,t[6]=n,t[7]=c,t[8]=u,t[9]=l,t[10]=y):y=t[10];let b=y,x=o===`automations`,S;return t[11]!==b||t[12]!==n||t[13]!==r||t[14]!==x?(S=(0,Q.jsx)(`div`,{className:`relative flex h-full min-w-0 flex-col overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:(0,Q.jsx)(Cn,{projectId:n,refreshTrigger:r,onThreadSelect:b,automationsOnly:x})})}),t[11]=b,t[12]=n,t[13]=r,t[14]=x,t[15]=S):S=t[15],S}function kn(e){return e.selectedProjectId}function An(e){return e.selectedThreadId}function jn(e){return e.projects}export{On as TasksView};
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{n as i}from"./chat-dock-context-BJNNRoZC.js";import{Dt as a}from"./dist-CTLFS4dn.js";import{$ as o,a as s,r as c}from"./store-BSzKIu5G.js";import{r as l,t as u}from"./button-kWtLAMpB.js";import{Lr as d,Qt as f}from"./api-DX1ny6q-.js";import{n as p}from"./main-tab-context-Byl1LybL.js";import{t as m}from"./use-active-dock-panel-instance-DNExGWVs.js";var h=e(n(),1),g=t(),_=2,v=1,ee=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(_,Math.floor(u/e.css.cell.width)),rows:Math.max(v,Math.floor(l/e.css.cell.height))}}},y=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=ne.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function te(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var ne=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!te(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),!(!n.isWrapped||o.indexOf(` `)!==-1)););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},re=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function ie(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var ae=class{constructor(e=ie,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||re;this._linkProvider=this._terminal.registerLinkProvider(new y(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},oe=Object.defineProperty,b=Object.getOwnPropertyDescriptor,se=(e,t)=>{for(var n in t)oe(e,n,{get:t[n],enumerable:!0})},x=(e,t,n,r)=>{for(var i=r>1?void 0:r?b(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&oe(t,n,i),i},S=(e,t)=>(n,r)=>t(n,r,e),ce=`Terminal input`,le={get:()=>ce,set:e=>ce=e},C=`Too much output to announce, navigate to rows manually to read`,ue={get:()=>C,set:e=>C=e};function de(e){return e.replace(/\r?\n/g,`\r`)}function fe(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function pe(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function me(e,t,n,r){e.stopPropagation(),e.clipboardData&&w(e.clipboardData.getData(`text/plain`),t,n,r)}function w(e,t,n,r){e=de(e),e=fe(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function he(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function T(e,t,n,r,i){he(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function E(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ge(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var _e=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},ve=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},ye=``,be=` `,xe=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Se}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return(this.fg&50331648)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Se=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ce=class e extends xe{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Se,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?E(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},we=`di$target`,Te=`di$dependencies`,Ee=new Map;function De(e){return e[Te]||[]}function D(e){if(Ee.has(e))return Ee.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Oe(t,e,r)};return t._id=e,Ee.set(e,t),t}function Oe(e,t,n){t[we]===t?t[Te].push({id:e,index:n}):(t[Te]=[{id:e,index:n}],t[we]=t)}var O=D(`BufferService`),ke=D(`CoreMouseService`),Ae=D(`CoreService`),je=D(`CharsetService`),Me=D(`InstantiationService`),Ne=D(`LogService`),k=D(`OptionsService`),Pe=D(`OscLinkService`),Fe=D(`UnicodeService`),Ie=D(`DecorationService`),Le=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new Ce,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Re(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Le=x([S(0,O),S(1,k),S(2,Pe)],Le);function Re(e,t){if(confirm(`Do you want to navigate to ${t}?
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{n as i}from"./chat-dock-context-8K8Ikjgy.js";import{Dt as a}from"./dist-CTLFS4dn.js";import{$ as o,a as s,r as c}from"./store-BSzKIu5G.js";import{r as l,t as u}from"./button-kWtLAMpB.js";import{Lr as d,Qt as f}from"./api-DX1ny6q-.js";import{n as p}from"./main-tab-context-Byl1LybL.js";import{t as m}from"./use-active-dock-panel-instance-DRfRj6MV.js";var h=e(n(),1),g=t(),_=2,v=1,ee=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(_,Math.floor(u/e.css.cell.width)),rows:Math.max(v,Math.floor(l/e.css.cell.height))}}},y=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=ne.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function te(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var ne=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!te(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),!(!n.isWrapped||o.indexOf(` `)!==-1)););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},re=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function ie(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var ae=class{constructor(e=ie,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||re;this._linkProvider=this._terminal.registerLinkProvider(new y(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},oe=Object.defineProperty,b=Object.getOwnPropertyDescriptor,se=(e,t)=>{for(var n in t)oe(e,n,{get:t[n],enumerable:!0})},x=(e,t,n,r)=>{for(var i=r>1?void 0:r?b(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&oe(t,n,i),i},S=(e,t)=>(n,r)=>t(n,r,e),ce=`Terminal input`,le={get:()=>ce,set:e=>ce=e},C=`Too much output to announce, navigate to rows manually to read`,ue={get:()=>C,set:e=>C=e};function de(e){return e.replace(/\r?\n/g,`\r`)}function fe(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function pe(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function me(e,t,n,r){e.stopPropagation(),e.clipboardData&&w(e.clipboardData.getData(`text/plain`),t,n,r)}function w(e,t,n,r){e=de(e),e=fe(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function he(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function T(e,t,n,r,i){he(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function E(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ge(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var _e=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},ve=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},ye=``,be=` `,xe=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Se}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return(this.fg&50331648)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Se=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ce=class e extends xe{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Se,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?E(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},we=`di$target`,Te=`di$dependencies`,Ee=new Map;function De(e){return e[Te]||[]}function D(e){if(Ee.has(e))return Ee.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Oe(t,e,r)};return t._id=e,Ee.set(e,t),t}function Oe(e,t,n){t[we]===t?t[Te].push({id:e,index:n}):(t[Te]=[{id:e,index:n}],t[we]=t)}var O=D(`BufferService`),ke=D(`CoreMouseService`),Ae=D(`CoreService`),je=D(`CharsetService`),Me=D(`InstantiationService`),Ne=D(`LogService`),k=D(`OptionsService`),Pe=D(`OscLinkService`),Fe=D(`UnicodeService`),Ie=D(`DecorationService`),Le=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new Ce,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Re(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Le=x([S(0,O),S(1,k),S(2,Pe)],Le);function Re(e,t){if(confirm(`Do you want to navigate to ${t}?
2
2
 
3
3
  WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var ze=D(`CharSizeService`),Be=D(`CoreBrowserService`),Ve=D(`MouseService`),He=D(`RenderService`),Ue=D(`SelectionService`),We=D(`CharacterJoinerService`),Ge=D(`ThemeService`),Ke=D(`LinkProviderService`),qe=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?$e.isErrorNoTelemetry(e)?new $e(e.message+`
4
4
 
@@ -1 +1 @@
1
- import{n as e}from"./react-vendor-Ee0-5T4I.js";import{n as t}from"./chat-dock-context-BJNNRoZC.js";var n=e();function r(e){let{instanceId:t,panelId:n,windows:r,expandedWindowId:i,selectedWindowId:a,isLayoutExpanded:o}=e;if(o&&i!==t)return!1;let s=r.filter(e=>e.panelId===n).map(e=>e.id);return s.includes(t)?s.length===1?!0:s.includes(a)?a===t:i&&s.includes(i)?i===t:s[0]===t:!1}function i(e,i){let a=(0,n.c)(7),{windows:o,expandedWindowId:s,selectedWindowId:c,isLayoutExpanded:l}=t(),u;return a[0]!==s||a[1]!==e||a[2]!==l||a[3]!==i||a[4]!==c||a[5]!==o?(u=r({instanceId:e,panelId:i,windows:o,expandedWindowId:s,selectedWindowId:c,isLayoutExpanded:l}),a[0]=s,a[1]=e,a[2]=l,a[3]=i,a[4]=c,a[5]=o,a[6]=u):u=a[6],u}export{i as t};
1
+ import{n as e}from"./react-vendor-Ee0-5T4I.js";import{n as t}from"./chat-dock-context-8K8Ikjgy.js";var n=e();function r(e){let{instanceId:t,panelId:n,windows:r,expandedWindowId:i,selectedWindowId:a,isLayoutExpanded:o}=e;if(o&&i!==t)return!1;let s=r.filter(e=>e.panelId===n).map(e=>e.id);return s.includes(t)?s.length===1?!0:s.includes(a)?a===t:i&&s.includes(i)?i===t:s[0]===t:!1}function i(e,i){let a=(0,n.c)(7),{windows:o,expandedWindowId:s,selectedWindowId:c,isLayoutExpanded:l}=t(),u;return a[0]!==s||a[1]!==e||a[2]!==l||a[3]!==i||a[4]!==c||a[5]!==o?(u=r({instanceId:e,panelId:i,windows:o,expandedWindowId:s,selectedWindowId:c,isLayoutExpanded:l}),a[0]=s,a[1]=e,a[2]=l,a[3]=i,a[4]=c,a[5]=o,a[6]=u):u=a[6],u}export{i as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t}from"./react-vendor-Ee0-5T4I.js";import{$ as n,n as r,r as i}from"./store-BSzKIu5G.js";import{F as a,Ht as o,St as s,j as c}from"./api-DX1ny6q-.js";import{t as l}from"./use-toast-xpb5jNtN.js";import{n as u}from"./explorer-tab-context-BxUVwWQQ.js";import{Bn as d,Ln as f}from"./index-u8UbWjXL.js";var p=e(t(),1);function m({findItems:e,installedPathSuffix:t=``,explorerPathSuffix:m=``,sortByName:h=!1,removedToastTitle:g}){let _=r(),v=i(e=>e.projects),y=i(e=>e.selectedProjectId),b=i(e=>e.selectedThreadId),{handleSelectThread:x}=d(),{openChatDockPanel:S}=f(),{setPendingExplorerPath:C,triggerExplorerRefresh:w,setExplorerClearPath:T}=u(),[E,D]=(0,p.useState)([]),[O,k]=(0,p.useState)(!0),[A,j]=(0,p.useState)(null),[M,N]=(0,p.useState)(!1),[P,F]=(0,p.useState)(new Set),I=(0,p.useCallback)(async()=>{if(!y){k(!1);return}k(!0);try{let n=e(await s(y));if(b)try{let t=e(await o(b)),r=new Set(n.map(e=>e.path));for(let e of t)r.has(e.path)||n.push(e)}catch{}h&&(n=[...n].sort((e,t)=>e.name.localeCompare(t.name))),D(n),F(new Set(n.map(e=>`${e.path}${t}`)))}catch{D([]),F(new Set)}finally{k(!1)}},[y,b,e,t,h]);return(0,p.useLayoutEffect)(()=>{y&&k(!0)},[y,b]),(0,p.useEffect)(()=>{I()},[I]),{selectedProjectId:y,selectedThreadId:b,items:E,loading:O,deleteConfirm:A,setDeleteConfirm:j,deleting:M,installedFilePaths:P,setInstalledFilePaths:F,loadItems:I,handleDelete:(0,p.useCallback)(async e=>{if(!y)return;let n=e.name,r=e.path;N(!0);try{try{await c(y,r)}catch{if(b)await a(b,r);else throw Error(`No thread selected to delete from`)}T(r),w(),F(e=>{let n=new Set(e);return n.delete(`${r}${t}`),n}),l({title:g,description:n}),j(null),await I()}catch(e){l({title:`Error`,description:e instanceof Error?e.message:`Failed to remove item`,variant:`destructive`})}finally{N(!1)}},[y,b,I,w,T,t,g]),handleOpenInExplorer:(0,p.useCallback)(e=>{if(!y)return;let t=v.find(e=>e.projectId===y);if(t){if(_({type:n.OpenProjectPanel,projectId:y}),!t.threads.some(e=>e.threadId===b)){let e=t.threads.find(e=>e.isSelected)??t.threads[0]??null;e&&x(y,e.threadId)}C(`${e}${m}`),S(`explorer`)}},[y,b,v,_,x,C,S,m]),triggerExplorerRefresh:w}}export{m as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t}from"./react-vendor-Ee0-5T4I.js";import{$ as n,n as r,r as i}from"./store-BSzKIu5G.js";import{F as a,Ht as o,St as s,j as c}from"./api-DX1ny6q-.js";import{t as l}from"./use-toast-xpb5jNtN.js";import{n as u}from"./explorer-tab-context-BxUVwWQQ.js";import{Bn as d,Ln as f}from"./index-B3-5kIOf.js";var p=e(t(),1);function m({findItems:e,installedPathSuffix:t=``,explorerPathSuffix:m=``,sortByName:h=!1,removedToastTitle:g}){let _=r(),v=i(e=>e.projects),y=i(e=>e.selectedProjectId),b=i(e=>e.selectedThreadId),{handleSelectThread:x}=d(),{openChatDockPanel:S}=f(),{setPendingExplorerPath:C,triggerExplorerRefresh:w,setExplorerClearPath:T}=u(),[E,D]=(0,p.useState)([]),[O,k]=(0,p.useState)(!0),[A,j]=(0,p.useState)(null),[M,N]=(0,p.useState)(!1),[P,F]=(0,p.useState)(new Set),I=(0,p.useCallback)(async()=>{if(!y){k(!1);return}k(!0);try{let n=e(await s(y));if(b)try{let t=e(await o(b)),r=new Set(n.map(e=>e.path));for(let e of t)r.has(e.path)||n.push(e)}catch{}h&&(n=[...n].sort((e,t)=>e.name.localeCompare(t.name))),D(n),F(new Set(n.map(e=>`${e.path}${t}`)))}catch{D([]),F(new Set)}finally{k(!1)}},[y,b,e,t,h]);return(0,p.useLayoutEffect)(()=>{y&&k(!0)},[y,b]),(0,p.useEffect)(()=>{I()},[I]),{selectedProjectId:y,selectedThreadId:b,items:E,loading:O,deleteConfirm:A,setDeleteConfirm:j,deleting:M,installedFilePaths:P,setInstalledFilePaths:F,loadItems:I,handleDelete:(0,p.useCallback)(async e=>{if(!y)return;let n=e.name,r=e.path;N(!0);try{try{await c(y,r)}catch{if(b)await a(b,r);else throw Error(`No thread selected to delete from`)}T(r),w(),F(e=>{let n=new Set(e);return n.delete(`${r}${t}`),n}),l({title:g,description:n}),j(null),await I()}catch(e){l({title:`Error`,description:e instanceof Error?e.message:`Failed to remove item`,variant:`destructive`})}finally{N(!1)}},[y,b,I,w,T,t,g]),handleOpenInExplorer:(0,p.useCallback)(e=>{if(!y)return;let t=v.find(e=>e.projectId===y);if(t){if(_({type:n.OpenProjectPanel,projectId:y}),!t.threads.some(e=>e.threadId===b)){let e=t.threads.find(e=>e.isSelected)??t.threads[0]??null;e&&x(y,e.threadId)}C(`${e}${m}`),S(`explorer`)}},[y,b,v,_,x,C,S,m]),triggerExplorerRefresh:w}}export{m as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{l as r}from"./chat-dock-context-BJNNRoZC.js";var i=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},a=new class extends i{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},o={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},s=new class{#e=o;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function c(e){setTimeout(e,0)}var l=typeof window>`u`||`Deno`in globalThis;function u(){}function d(e,t){return typeof e==`function`?e(t):e}function f(e){return typeof e==`number`&&e>=0&&e!==1/0}function p(e,t){return Math.max(e+(t||0)-Date.now(),0)}function m(e,t){return typeof e==`function`?e(t):e}function h(e,t){return typeof e==`function`?e(t):e}function g(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==v(o,t.options))return!1}else if(!b(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function _(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(y(t.options.mutationKey)!==y(a))return!1}else if(!b(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function v(e,t){return(t?.queryKeyHashFn||y)(e)}function y(e){return JSON.stringify(e,(e,t)=>T(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function b(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>b(e[n],t[n])):!1}var x=Object.prototype.hasOwnProperty;function S(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=w(e)&&w(t);if(!r&&!(T(e)&&T(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:x.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=S(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function C(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function w(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function T(e){if(!E(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!E(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function E(e){return Object.prototype.toString.call(e)===`[object Object]`}function ee(e){return new Promise(t=>{s.setTimeout(t,e)})}function D(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:S(e,t)}function te(e){return e}function O(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ne(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var k=Symbol();function A(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===k?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function j(e,t){return typeof e==`function`?e(...t):!!e}function re(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var M=(()=>{let e=()=>l;return{isServer(){return e()},setIsServer(t){e=t}}})();function N(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var ie=c;function ae(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ie,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var P=ae(),F=new class extends i{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function oe(e){return Math.min(1e3*2**e,3e4)}function I(e){return(e??`online`)===`online`?F.isOnline():!0}var L=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function R(e){let t=!1,n=0,r,i=N(),o=()=>i.status!==`pending`,s=t=>{if(!o()){let n=new L(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>a.isFocused()&&(e.networkMode===`always`||F.isOnline())&&e.canRun(),d=()=>I(e.networkMode)&&e.canRun(),f=e=>{o()||(r?.(),i.resolve(e))},p=e=>{o()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(o()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),h=()=>{if(o())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(o())return;let i=e.retry??(M.isServer()?0:3),a=e.retryDelay??oe,s=typeof a==`function`?a(n,r):a,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),ee(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:i,status:()=>i.status,cancel:s,continue:()=>(r?.(),i),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),i)}}var z=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),f(this.gcTime)&&(this.#e=s.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(M.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(s.clearTimeout(this.#e),this.#e=void 0)}};function se(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{re(e,()=>t.signal,()=>n=!0)},u=A(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?ne:O;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?V:B,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:B(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function B(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function V(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function ce(e,t){return t?B(e,t)!=null:!1}function le(e,t){return!t||!e.getPreviousPageParam?!1:V(e,t)!=null}var H=class extends z{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=G(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=G(this.options);e.data!==void 0&&(this.setState(W(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=D(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(u).catch(u):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>h(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===k||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>m(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!p(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=A(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?se(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=R({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof L&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof L){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...U(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...W(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),P.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function U(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:I(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function W(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function G(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var ue=class extends i{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=N(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),K(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return q(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return q(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof h(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!C(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&J(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||h(this.options.enabled,this.#t)!==h(t.enabled,this.#t)||m(this.options.staleTime,this.#t)!==m(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||h(this.options.enabled,this.#t)!==h(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return fe(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u)),t}#g(){this.#b();let e=m(this.options.staleTime,this.#t);if(M.isServer()||this.#r.isStale||!f(e))return;let t=p(this.#r.dataUpdatedAt,e)+1;this.#d=s.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(M.isServer()||h(this.options.enabled,this.#t)===!1||!f(this.#p)||this.#p===0)&&(this.#f=s.setInterval(()=>{(this.options.refetchIntervalInBackground||a.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(s.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(s.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&K(e,t),o=i&&J(e,n,t,r);(a||o)&&(l={...l,...U(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let g=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,g=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=D(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!g)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=D(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let _=l.fetchStatus===`fetching`,v=m===`pending`,y=m===`error`,b=v&&_,x=d!==void 0,S={status:m,fetchStatus:l.fetchStatus,isPending:v,isSuccess:m===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:Y(e,t),refetch:this.refetch,promise:this.#o,isEnabled:h(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{i(this.#o=S.promise=N())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!C(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){P.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function de(e,t){return h(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&h(t.retryOnMount,e)===!1)}function K(e,t){return de(e,t)||e.state.data!==void 0&&q(e,t,t.refetchOnMount)}function q(e,t,n){if(h(t.enabled,e)!==!1&&m(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Y(e,t)}return!1}function J(e,t,n,r){return(e!==t||h(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Y(e,n)}function Y(e,t){return h(t.enabled,e)!==!1&&e.isStaleByTime(m(t.staleTime,e))}function fe(e,t){return!C(e.getCurrentResult(),t)}n();var X=e(t(),1),Z=X.createContext(!1),Q=()=>X.useContext(Z);Z.Provider;function pe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var me=X.createContext(pe()),he=()=>X.useContext(me),ge=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?j(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},_e=e=>{X.useEffect(()=>{e.clearReset()},[e])},ve=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||j(n,[e.error,r])),ye=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},be=(e,t)=>e.isLoading&&e.isFetching&&!t,xe=(e,t)=>e?.suspense&&t.isPending,$=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Se(e,t,n){let i=Q(),a=he(),o=r(n),s=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(s);let c=o.getQueryCache().get(s.queryHash),l=e.subscribed!==!1;s._optimisticResults=i?`isRestoring`:l?`optimistic`:void 0,ye(s),ge(s,a,c),_e(a);let d=!o.getQueryCache().get(s.queryHash),[f]=X.useState(()=>new t(o,s)),p=f.getOptimisticResult(s),m=!i&&l;if(X.useSyncExternalStore(X.useCallback(e=>{let t=m?f.subscribe(P.batchCalls(e)):u;return f.updateResult(),t},[f,m]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),X.useEffect(()=>{f.setOptions(s)},[s,f]),xe(s,p))throw $(s,f,a);if(ve({result:p,errorResetBoundary:a,throwOnError:s.throwOnError,query:c,suspense:s.suspense}))throw p.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(s,p),s.experimental_prefetchInRender&&!M.isServer()&&be(p,i)&&(d?$(s,f,a):c?.promise)?.catch(u).finally(()=>{f.updateResult()}),s.notifyOnChangeProps?p:f.trackResult(p)}export{b as _,le as a,a as b,F as c,y as d,v as f,u as g,g as h,ce as i,P as l,_ as m,ue as n,z as o,te as p,H as r,R as s,Se as t,d as u,m as v,i as x,k as y};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{a as r}from"./chat-dock-context-8K8Ikjgy.js";var i=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},a=new class extends i{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},o={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},s=new class{#e=o;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function c(e){setTimeout(e,0)}var l=typeof window>`u`||`Deno`in globalThis;function u(){}function d(e,t){return typeof e==`function`?e(t):e}function f(e){return typeof e==`number`&&e>=0&&e!==1/0}function p(e,t){return Math.max(e+(t||0)-Date.now(),0)}function m(e,t){return typeof e==`function`?e(t):e}function h(e,t){return typeof e==`function`?e(t):e}function g(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==v(o,t.options))return!1}else if(!b(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function _(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(y(t.options.mutationKey)!==y(a))return!1}else if(!b(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function v(e,t){return(t?.queryKeyHashFn||y)(e)}function y(e){return JSON.stringify(e,(e,t)=>T(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function b(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>b(e[n],t[n])):!1}var x=Object.prototype.hasOwnProperty;function S(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=w(e)&&w(t);if(!r&&!(T(e)&&T(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:x.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=S(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function C(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function w(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function T(e){if(!E(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!E(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function E(e){return Object.prototype.toString.call(e)===`[object Object]`}function ee(e){return new Promise(t=>{s.setTimeout(t,e)})}function D(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:S(e,t)}function te(e){return e}function O(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ne(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var k=Symbol();function A(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===k?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function j(e,t){return typeof e==`function`?e(...t):!!e}function re(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var M=(()=>{let e=()=>l;return{isServer(){return e()},setIsServer(t){e=t}}})();function N(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var ie=c;function ae(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ie,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var P=ae(),F=new class extends i{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function oe(e){return Math.min(1e3*2**e,3e4)}function I(e){return(e??`online`)===`online`?F.isOnline():!0}var L=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function R(e){let t=!1,n=0,r,i=N(),o=()=>i.status!==`pending`,s=t=>{if(!o()){let n=new L(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>a.isFocused()&&(e.networkMode===`always`||F.isOnline())&&e.canRun(),d=()=>I(e.networkMode)&&e.canRun(),f=e=>{o()||(r?.(),i.resolve(e))},p=e=>{o()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(o()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),h=()=>{if(o())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(o())return;let i=e.retry??(M.isServer()?0:3),a=e.retryDelay??oe,s=typeof a==`function`?a(n,r):a,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),ee(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:i,status:()=>i.status,cancel:s,continue:()=>(r?.(),i),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),i)}}var z=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),f(this.gcTime)&&(this.#e=s.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(M.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(s.clearTimeout(this.#e),this.#e=void 0)}};function se(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{re(e,()=>t.signal,()=>n=!0)},u=A(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?ne:O;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?V:B,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:B(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function B(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function V(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function ce(e,t){return t?B(e,t)!=null:!1}function le(e,t){return!t||!e.getPreviousPageParam?!1:V(e,t)!=null}var H=class extends z{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=G(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=G(this.options);e.data!==void 0&&(this.setState(W(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=D(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(u).catch(u):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>h(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===k||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>m(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!p(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=A(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?se(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=R({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof L&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof L){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...U(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...W(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),P.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function U(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:I(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function W(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function G(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var ue=class extends i{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=N(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),K(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return q(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return q(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof h(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!C(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&J(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||h(this.options.enabled,this.#t)!==h(t.enabled,this.#t)||m(this.options.staleTime,this.#t)!==m(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||h(this.options.enabled,this.#t)!==h(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return fe(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u)),t}#g(){this.#b();let e=m(this.options.staleTime,this.#t);if(M.isServer()||this.#r.isStale||!f(e))return;let t=p(this.#r.dataUpdatedAt,e)+1;this.#d=s.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(M.isServer()||h(this.options.enabled,this.#t)===!1||!f(this.#p)||this.#p===0)&&(this.#f=s.setInterval(()=>{(this.options.refetchIntervalInBackground||a.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(s.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(s.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&K(e,t),o=i&&J(e,n,t,r);(a||o)&&(l={...l,...U(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let g=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,g=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=D(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!g)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=D(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let _=l.fetchStatus===`fetching`,v=m===`pending`,y=m===`error`,b=v&&_,x=d!==void 0,S={status:m,fetchStatus:l.fetchStatus,isPending:v,isSuccess:m===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:Y(e,t),refetch:this.refetch,promise:this.#o,isEnabled:h(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{i(this.#o=S.promise=N())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!C(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){P.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function de(e,t){return h(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&h(t.retryOnMount,e)===!1)}function K(e,t){return de(e,t)||e.state.data!==void 0&&q(e,t,t.refetchOnMount)}function q(e,t,n){if(h(t.enabled,e)!==!1&&m(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Y(e,t)}return!1}function J(e,t,n,r){return(e!==t||h(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Y(e,n)}function Y(e,t){return h(t.enabled,e)!==!1&&e.isStaleByTime(m(t.staleTime,e))}function fe(e,t){return!C(e.getCurrentResult(),t)}n();var X=e(t(),1),Z=X.createContext(!1),Q=()=>X.useContext(Z);Z.Provider;function pe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var me=X.createContext(pe()),he=()=>X.useContext(me),ge=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?j(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},_e=e=>{X.useEffect(()=>{e.clearReset()},[e])},ve=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||j(n,[e.error,r])),ye=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},be=(e,t)=>e.isLoading&&e.isFetching&&!t,xe=(e,t)=>e?.suspense&&t.isPending,$=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Se(e,t,n){let i=Q(),a=he(),o=r(n),s=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(s);let c=o.getQueryCache().get(s.queryHash),l=e.subscribed!==!1;s._optimisticResults=i?`isRestoring`:l?`optimistic`:void 0,ye(s),ge(s,a,c),_e(a);let d=!o.getQueryCache().get(s.queryHash),[f]=X.useState(()=>new t(o,s)),p=f.getOptimisticResult(s),m=!i&&l;if(X.useSyncExternalStore(X.useCallback(e=>{let t=m?f.subscribe(P.batchCalls(e)):u;return f.updateResult(),t},[f,m]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),X.useEffect(()=>{f.setOptions(s)},[s,f]),xe(s,p))throw $(s,f,a);if(ve({result:p,errorResetBoundary:a,throwOnError:s.throwOnError,query:c,suspense:s.suspense}))throw p.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(s,p),s.experimental_prefetchInRender&&!M.isServer()&&be(p,i)&&(d?$(s,f,a):c?.promise)?.catch(u).finally(()=>{f.updateResult()}),s.notifyOnChangeProps?p:f.trackResult(p)}export{b as _,le as a,a as b,F as c,y as d,v as f,u as g,g as h,ce as i,P as l,_ as m,ue as n,z as o,te as p,H as r,R as s,Se as t,d as u,m as v,i as x,k as y};
@@ -1 +1 @@
1
- import{Sn as e}from"./index-u8UbWjXL.js";var t=class extends e{constructor(){super(),this.handleVisibilityChange=()=>{let e={isActive:document.hidden!==!0};this.notifyListeners(`appStateChange`,e),document.hidden?this.notifyListeners(`pause`,null):this.notifyListeners(`resume`,null)},document.addEventListener(`visibilitychange`,this.handleVisibilityChange,!1)}exitApp(){throw this.unimplemented(`Not implemented on web.`)}async getInfo(){throw this.unimplemented(`Not implemented on web.`)}async getLaunchUrl(){return{url:``}}async getState(){return{isActive:document.hidden!==!0}}async minimizeApp(){throw this.unimplemented(`Not implemented on web.`)}async toggleBackButtonHandler(){throw this.unimplemented(`Not implemented on web.`)}async getAppLanguage(){return{value:navigator.language.split(`-`)[0].toLowerCase()}}};export{t as AppWeb};
1
+ import{Cn as e}from"./index-B3-5kIOf.js";var t=class extends e{constructor(){super(),this.handleVisibilityChange=()=>{let e={isActive:document.hidden!==!0};this.notifyListeners(`appStateChange`,e),document.hidden?this.notifyListeners(`pause`,null):this.notifyListeners(`resume`,null)},document.addEventListener(`visibilitychange`,this.handleVisibilityChange,!1)}exitApp(){throw this.unimplemented(`Not implemented on web.`)}async getInfo(){throw this.unimplemented(`Not implemented on web.`)}async getLaunchUrl(){return{url:``}}async getState(){return{isActive:document.hidden!==!0}}async minimizeApp(){throw this.unimplemented(`Not implemented on web.`)}async toggleBackButtonHandler(){throw this.unimplemented(`Not implemented on web.`)}async getAppLanguage(){return{value:navigator.language.split(`-`)[0].toLowerCase()}}};export{t as AppWeb};
@@ -1 +1 @@
1
- import{B as e,Sn as t,z as n}from"./index-u8UbWjXL.js";var r=class extends t{constructor(){super(...arguments),this.selectionStarted=!1}async impact(e){let t=this.patternForImpact(e?.style);this.vibrateWithPattern(t)}async notification(e){let t=this.patternForNotification(e?.type);this.vibrateWithPattern(t)}async vibrate(e){let t=e?.duration||300;this.vibrateWithPattern([t])}async selectionStart(){this.selectionStarted=!0}async selectionChanged(){this.selectionStarted&&this.vibrateWithPattern([70])}async selectionEnd(){this.selectionStarted=!1}patternForImpact(e=n.Heavy){return e===n.Medium?[43]:e===n.Light?[20]:[61]}patternForNotification(t=e.Success){return t===e.Warning?[30,40,30,50,60]:t===e.Error?[27,45,50]:[35,65,21]}vibrateWithPattern(e){if(navigator.vibrate)navigator.vibrate(e);else throw this.unavailable(`Browser does not support the vibrate API`)}};export{r as HapticsWeb};
1
+ import{B as e,Cn as t,V as n}from"./index-B3-5kIOf.js";var r=class extends t{constructor(){super(...arguments),this.selectionStarted=!1}async impact(e){let t=this.patternForImpact(e?.style);this.vibrateWithPattern(t)}async notification(e){let t=this.patternForNotification(e?.type);this.vibrateWithPattern(t)}async vibrate(e){let t=e?.duration||300;this.vibrateWithPattern([t])}async selectionStart(){this.selectionStarted=!0}async selectionChanged(){this.selectionStarted&&this.vibrateWithPattern([70])}async selectionEnd(){this.selectionStarted=!1}patternForImpact(t=e.Heavy){return t===e.Medium?[43]:t===e.Light?[20]:[61]}patternForNotification(e=n.Success){return e===n.Warning?[30,40,30,50,60]:e===n.Error?[27,45,50]:[35,65,21]}vibrateWithPattern(e){if(navigator.vibrate)navigator.vibrate(e);else throw this.unavailable(`Browser does not support the vibrate API`)}};export{r as HapticsWeb};