openpond 0.0.47 → 0.0.49

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 (98) hide show
  1. package/dist/chunks/{app-layer-4PR4BS7N.js → app-layer-E2JWCA6D.js} +2 -2
  2. package/dist/chunks/{app-server-runtime-4KT5OMVC.js → app-server-runtime-OWEIHFEU.js} +6 -6
  3. package/dist/chunks/{apps-V7TF6RTV.js → apps-VQDIVGST.js} +2 -2
  4. package/dist/chunks/{chunk-CGVG46T5.js → chunk-3BR4ACFF.js} +1 -1
  5. package/dist/chunks/{chunk-KPVNB2KS.js → chunk-64LWPRGN.js} +2 -2
  6. package/dist/chunks/{chunk-I4CQJSZK.js → chunk-7G472COA.js} +451 -80
  7. package/dist/chunks/{chunk-7B2K727D.js → chunk-7M4HGT5X.js} +1 -1
  8. package/dist/chunks/{chunk-TNM6UTTF.js → chunk-CNIMJPM5.js} +1315 -894
  9. package/dist/chunks/{chunk-HGJQUQAP.js → chunk-LRLDBKTI.js} +1 -1
  10. package/dist/chunks/{chunk-YYJH2WWX.js → chunk-NR2N6JAC.js} +1 -1
  11. package/dist/chunks/{chunk-IM67TWCC.js → chunk-NRLI3S72.js} +1 -1
  12. package/dist/chunks/{chunk-YBQTQWOY.js → chunk-QD4FR3O4.js} +32 -32
  13. package/dist/chunks/{chunk-ERQUG3HB.js → chunk-UJV3UYLP.js} +1 -1
  14. package/dist/chunks/{cli-TINOXBYY.js → cli-T6TTMVSU.js} +5 -5
  15. package/dist/chunks/{core-commands-O76V62SB.js → core-commands-UW4XTGXK.js} +3 -3
  16. package/dist/chunks/{desktop-test-N2UPF5PP.js → desktop-test-JTBPE7CH.js} +2 -2
  17. package/dist/chunks/{extension-XQBSBEVO.js → extension-VP7LMA32.js} +1 -1
  18. package/dist/chunks/{help-YSGYNWPJ.js → help-OZNCHHO3.js} +1 -1
  19. package/dist/chunks/{opchat-F5OFTH56.js → opchat-RY3QU5UJ.js} +2 -2
  20. package/dist/chunks/{organizations-EEQPOIAZ.js → organizations-GLKSXK3Q.js} +4 -4
  21. package/dist/chunks/{profile-3OGGNTDS.js → profile-JWUYJF23.js} +2 -2
  22. package/dist/chunks/{project-agent-LVOSTVE5.js → project-agent-L4EB7QFO.js} +2 -2
  23. package/dist/chunks/{sandbox-command-S3VMWGMH.js → sandbox-command-26255MSV.js} +2 -2
  24. package/dist/chunks/{sandbox-template-UDXW7LRZ.js → sandbox-template-6UDA3AEY.js} +3 -3
  25. package/dist/chunks/{src-64JULYJS.js → src-7S66FU4P.js} +22 -21
  26. package/dist/chunks/{src-JMDVVYFD.js → src-GCZ2GMG3.js} +3 -3
  27. package/dist/chunks/{teams-bot-YRKKQDYL.js → teams-bot-PO3GOLWU.js} +2 -2
  28. package/dist/chunks/{workspaces-EICADW3U.js → workspaces-26IF6TQV.js} +2 -2
  29. package/dist/cli.js +13 -13
  30. package/dist/web/assets/{AppDialog-Bqw26W0m.js → AppDialog-BTOxCNC5.js} +1 -1
  31. package/dist/web/assets/{AppsView-CWhWKF1c.js → AppsView-Cm5x09IS.js} +1 -1
  32. package/dist/web/assets/{BrowserSidebar-MTkosLlw.js → BrowserSidebar-CIPh5JIn.js} +1 -1
  33. package/dist/web/assets/{CommandMenu-Bz9bpiwl.js → CommandMenu-DdR82TLd.js} +1 -1
  34. package/dist/web/assets/{CommunityView-BqFeUGPj.js → CommunityView-Dqu4cos1.js} +1 -1
  35. package/dist/web/assets/{ComposerCreateImproveStrip-B6BBqdaL.js → ComposerCreateImproveStrip-CW2QuI7r.js} +1 -1
  36. package/dist/web/assets/{GetStartedView-BsgErNU9.js → GetStartedView--CbCnzFQ.js} +1 -1
  37. package/dist/web/assets/{LabModelVersionDetailPage-BLnFb7Mt.js → LabModelVersionDetailPage-BPUvR5XP.js} +1 -1
  38. package/dist/web/assets/{LabSkillSidebar-Ba6gRUbM.js → LabSkillSidebar-CnuyFZ1G.js} +1 -1
  39. package/dist/web/assets/{LabsRoute-BFV7VPOU.js → LabsRoute-CYk2dzQp.js} +3 -3
  40. package/dist/web/assets/{MainChatThread-B283zmgR.js → MainChatThread-0Tc95p0t.js} +2 -2
  41. package/dist/web/assets/{MainPane-Lv073mMC.js → MainPane-Bke4JEHC.js} +3 -3
  42. package/dist/web/assets/{MarkdownText-CinDMr2e.js → MarkdownText-DTBS9xe7.js} +1 -1
  43. package/dist/web/assets/{Messages-okIKN3y-.js → Messages-Bae_sFx5.js} +1 -1
  44. package/dist/web/assets/{NativeSkillSidebar-B1QrK2aH.js → NativeSkillSidebar-DSoPD42b.js} +1 -1
  45. package/dist/web/assets/{NewProjectDialog-CcbDk9Py.js → NewProjectDialog-CmXg2GK7.js} +1 -1
  46. package/dist/web/assets/{OutputsPage-CmwXC2Xd.js → OutputsPage-XmIreC0M.js} +1 -1
  47. package/dist/web/assets/{RightChatPanelStack-CHOpwL1L.js → RightChatPanelStack-BMOtbjus.js} +1 -1
  48. package/dist/web/assets/{ScheduledWorkPage-BzSPcB3d.js → ScheduledWorkPage-Cn5a9VLV.js} +1 -1
  49. package/dist/web/assets/{SettingsView-CkmRV5NT.js → SettingsView-DXF8z3P2.js} +6 -6
  50. package/dist/web/assets/{TeamChatView-DevmTvuf.js → TeamChatView-CB_0oRid.js} +1 -1
  51. package/dist/web/assets/{TerminalOverlay-CteY7dSQ.js → TerminalOverlay-XhABQsCB.js} +1 -1
  52. package/dist/web/assets/{TrainingCreationPanel-AMq0npLN.js → TrainingCreationPanel-ChsDr2GP.js} +1 -1
  53. package/dist/web/assets/{TrainingDraftPanel-BVxPaBhF.js → TrainingDraftPanel-CDlpnno6.js} +1 -1
  54. package/dist/web/assets/{UsageSettingsSection-BPIzRNKL.js → UsageSettingsSection-NbX7_3Uz.js} +1 -1
  55. package/dist/web/assets/{WorkspaceDiffPanel-DMu3IIuX.js → WorkspaceDiffPanel-jaJU08NH.js} +3 -3
  56. package/dist/web/assets/{WorkspaceEnvironmentMenu-ConUKuWd.js → WorkspaceEnvironmentMenu-D0nvQmmj.js} +1 -1
  57. package/dist/web/assets/{WorkspaceGitDialogs-o76400dH.js → WorkspaceGitDialogs-C0PMpVfj.js} +1 -1
  58. package/dist/web/assets/{WorkspaceMonacoEditor-HwyVbn8h.js → WorkspaceMonacoEditor-6QNGzQUi.js} +3 -3
  59. package/dist/web/assets/{arrow-up-right-BKN-maHj.js → arrow-up-right-Cx2xjktp.js} +1 -1
  60. package/dist/web/assets/{chevron-up-CVs6VVxb.js → chevron-up-UF_r7JHT.js} +1 -1
  61. package/dist/web/assets/{circle-alert-C01fZFW7.js → circle-alert-BUHAQ7Du.js} +1 -1
  62. package/dist/web/assets/{cloud-upload-jtADHeTW.js → cloud-upload-Cc_ZQEAm.js} +1 -1
  63. package/dist/web/assets/{cssMode-xJZoI37_.js → cssMode-CrigFsxI.js} +1 -1
  64. package/dist/web/assets/{folder-open-DyyC6ByN.js → folder-open-D7a4t258.js} +1 -1
  65. package/dist/web/assets/{folder-plus-UGSTW1kn.js → folder-plus-CmeHTj5W.js} +1 -1
  66. package/dist/web/assets/{git-branch-D6gtbKJu.js → git-branch-CaVUghsI.js} +1 -1
  67. package/dist/web/assets/{git-commit-horizontal-C_GYw-SZ.js → git-commit-horizontal-oiDAVV_Y.js} +1 -1
  68. package/dist/web/assets/{htmlMode-BjKG829K.js → htmlMode-CLzM5GNi.js} +1 -1
  69. package/dist/web/assets/index-De6p2npi.js +1 -0
  70. package/dist/web/assets/index-UUM3pwfd.css +1 -0
  71. package/dist/web/assets/index-Ure41UF0.js +178 -0
  72. package/dist/web/assets/{info-z2hv9cD1.js → info-dTkimobU.js} +1 -1
  73. package/dist/web/assets/{jsonMode-DjZzpcCY.js → jsonMode-BBF67cOE.js} +1 -1
  74. package/dist/web/assets/{lspLanguageFeatures-B4RETEmT.js → lspLanguageFeatures-DHtN2nxz.js} +1 -1
  75. package/dist/web/assets/{monaco.contribution-I3nbx1nu.js → monaco.contribution-BClTZJd2.js} +2 -2
  76. package/dist/web/assets/{monaco.contribution-DJK2Dt3T.js → monaco.contribution-C_GWU01R.js} +2 -2
  77. package/dist/web/assets/{monaco.contribution-Du7kEHLz.js → monaco.contribution-DtM9AdPi.js} +2 -2
  78. package/dist/web/assets/{monaco.contribution-DCRifLw0.js → monaco.contribution-riAIDf7J.js} +2 -2
  79. package/dist/web/assets/{monitor-DCUsiZyp.js → monitor-POfnZCWw.js} +1 -1
  80. package/dist/web/assets/{play-DCKc0E80.js → play-CjWTsI9z.js} +1 -1
  81. package/dist/web/assets/{python-DwbW9406.js → python-CvZQM_g2.js} +1 -1
  82. package/dist/web/assets/{refresh-cw-D6okuGLV.js → refresh-cw-CeHT_tXT.js} +1 -1
  83. package/dist/web/assets/{reply-KIN_PSFi.js → reply-BkH8nKWG.js} +1 -1
  84. package/dist/web/assets/{save-D7tbQpM9.js → save-CmJ92Odx.js} +1 -1
  85. package/dist/web/assets/{square-BUG8bwGr.js → square-B00f_944.js} +1 -1
  86. package/dist/web/assets/{square-pen-CWS_8PrJ.js → square-pen-LHr8bFfZ.js} +1 -1
  87. package/dist/web/assets/{toggleHighContrast-CO8n70ql.js → toggleHighContrast-C6N52VOS.js} +1 -1
  88. package/dist/web/assets/{tsMode-f9Hqewvr.js → tsMode-CDIfvnHn.js} +1 -1
  89. package/dist/web/assets/{upload-DXI5er5D.js → upload-DK0-5jXz.js} +1 -1
  90. package/dist/web/assets/{useLocalAgentSchedules-BMvi6vmi.js → useLocalAgentSchedules-BUkZjV9E.js} +1 -1
  91. package/dist/web/assets/{wifi-off-B3ZtcrOA.js → wifi-off-BQGq-son.js} +1 -1
  92. package/dist/web/assets/{workers-CNGv6B0J.js → workers-BfcjsZ3C.js} +1 -1
  93. package/dist/web/assets/{yaml-C-tL3IVE.js → yaml-CNqgAihH.js} +1 -1
  94. package/dist/web/index.html +2 -2
  95. package/package.json +1 -1
  96. package/dist/web/assets/index-B8xSSlBW.js +0 -178
  97. package/dist/web/assets/index-C-1-yaL8.js +0 -1
  98. package/dist/web/assets/index-D9jTe16Q.css +0 -1
@@ -1,6 +1,6 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ComposerCreateImproveStrip-B6BBqdaL.js","./index-B8xSSlBW.js","./index-D9jTe16Q.css","./circle-alert-C01fZFW7.js","./MarkdownText-CinDMr2e.js","./play-DCKc0E80.js","./refresh-cw-D6okuGLV.js","./TerminalOverlay-CteY7dSQ.js","./TerminalOverlay-DwBiZLwk.css","./WorkspaceDiffPanel-DMu3IIuX.js","./training-model-data-B7-1Bxil.js","./square-pen-CWS_8PrJ.js","./folder-open-DyyC6ByN.js","./info-z2hv9cD1.js","./save-D7tbQpM9.js","./chevron-up-CVs6VVxb.js","./AppsView-CWhWKF1c.js","./AppsView-DIhprTIC.css","./GetStartedView-BsgErNU9.js","./index-C-1-yaL8.js","./AppDialog-Bqw26W0m.js","./GetStartedView-yVmnGZPw.css","./LabsRoute-BFV7VPOU.js","./cloud-upload-jtADHeTW.js","./UsageSettingsSection-BPIzRNKL.js","./arrow-up-right-BKN-maHj.js","./UsageSettingsSection-O8VK0qBL.css","./LabsRoute-CoSPO4HR.css","./training-BQVNUTZA.css","./ScheduledWorkPage-BzSPcB3d.js","./useLocalAgentSchedules-BMvi6vmi.js","./OutputsPage-CmwXC2Xd.js","./square-BUG8bwGr.js","./LabSkillSidebar-Ba6gRUbM.js","./LabSkillSidebar-CVxtS9pd.css","./BrowserSidebar-MTkosLlw.js","./BrowserSidebar-D9i7gQzw.css","./RightChatPanelStack-CHOpwL1L.js","./Messages-okIKN3y-.js","./git-branch-D6gtbKJu.js","./NativeSkillSidebar-B1QrK2aH.js","./NativeSkillSidebar-T8KXjnUH.css","./TeamChatView-DevmTvuf.js","./reply-KIN_PSFi.js","./TeamChatView-Cgxm-pKA.css","./git-dialogs-BZDqS1eT.css","./CommunityView-BqFeUGPj.js","./wifi-off-B3ZtcrOA.js","./CommunityView-DSik4sd2.css","./TrainingDraftPanel-BVxPaBhF.js","./MainChatThread-B283zmgR.js","./TrainingCreationPanel-AMq0npLN.js"])))=>i.map(i=>d[i]);
2
- import{c as Le,r as o,j as t,C as hs,P as tn,a as Fs,A as In,b as Ct,d as Sr,e as xr,E as Ho,f as Vo,O as Wo,g as Ir,B as Go,F as sn,h as $r,i as Ko,k as Qo,l as Xo,m as Jo,n as Se,p as Zo,o as Dr,q as Or,S as po,s as xo,t as Yo,X as Ws,G as ea,u as ta,v as Pt,w as Pr,x as _n,y as zr,z as bo,D as na,H as sa,I as ra,J as oa,K as aa,L as ia,M as la,N as ca,Q as ua,_ as je,R as go,T as da,U as fa,V as ma,W as ha,Y as pa,Z as xa,$ as ko,a0 as ba,a1 as ga,a2 as yo,a3 as ka,a4 as Fr,a5 as ya,a6 as va,a7 as Tn,a8 as ja,a9 as wa,aa as Sa,ab as Ca,ac as Ma,ad as Na,ae as Ea,af as Aa,ag as Ta,ah as Ra,ai as _a,aj as Ia,ak as $a,al as Pa,am as La,an as Da,ao as Oa}from"./index-B8xSSlBW.js";import{C as za}from"./cloud-upload-jtADHeTW.js";import{F as Cr,S as Fa}from"./square-pen-CWS_8PrJ.js";import{A as Mr}from"./arrow-up-right-BKN-maHj.js";import{T as vo,B as br,W as gr,D as Br,P as Ba,F as Ua,C as qa,M as jo,a as Ha,b as Va,r as Wa,s as Ga,A as wo,c as Ka,n as Qa}from"./MarkdownText-CinDMr2e.js";import{S as Nr,a as Xa}from"./square-BUG8bwGr.js";import{F as So}from"./folder-open-DyyC6ByN.js";function Co(e){return e?(e.match(/\r\n|\r|\n/g)?.length??0)+(/(?:\r\n|\r|\n)$/.test(e)?0:1):0}const Ja=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Za=Le("archive",Ja);const Ya=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ei=Le("arrow-down",Ya);const ti=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ur=Le("arrow-up",ti);const ni=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],qr=Le("at-sign",ni);const si=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ri=Le("badge-check",si);const oi=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ai=Le("ban",oi);const ii=[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]],li=Le("cloud-download",ii);const ci=[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],ui=Le("file-headphone",ci);const di=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],fi=Le("file-spreadsheet",di);const mi=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],hi=Le("file-play",mi);const pi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],xi=Le("image",pi);const bi=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],gi=Le("lightbulb",bi);const ki=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],yi=Le("mic",ki);const vi=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Hs=Le("paperclip",vi);const ji=[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]],wi=Le("presentation",ji);function Si(e,n){const s=e.slice(0,Math.max(0,Math.min(n,e.length))),r=/(?:^|\s)\$([a-zA-Z][a-zA-Z0-9_-]*)?$/.exec(s);if(!r||typeof r.index!="number")return null;const a=r[0].lastIndexOf("$");return a<0?null:{end:s.length,query:(r[1]??"").toLowerCase(),start:r.index+a}}function Gs(e){return`$${e.name}`}function Ci(e,n,s){const r=Math.max(0,Math.min(n.start,e.length)),a=Math.max(r,Math.min(n.end,e.length)),i=e.slice(0,r),c=e.slice(a),u=i&&!/\s$/.test(i)?" ":"",x=c&&/^\s/.test(c)?"":" ",b=`${u}${Gs(s)}${x}`;return{cursor:i.length+b.length-(c?x.length:0),value:`${i}${b}${c}`}}function Bs(e,n,s){const r=n.trim().toLowerCase(),a=e.filter(i=>i.enabled&&i.validationStatus==="valid").filter(i=>r?[i.name,i.description,i.path].join(" ").toLowerCase().includes(r):!0).sort((i,c)=>i.name.localeCompare(c.name));return typeof s=="number"&&Number.isFinite(s)?a.slice(0,Math.max(0,s)):a}function Mi(e,n,s){const r=n.trim().replace(/\s+/g," "),a=Ni(s,e.length);if(!r)return{value:e,cursorIndex:a};const i=e.slice(0,a),c=e.slice(a),u=i&&!/\s$/.test(i)?" ":"",x=c&&!/^\s/.test(c)?" ":"",b=`${u}${r}${x}`;return{value:`${i}${b}${c}`,cursorIndex:i.length+u.length+r.length+x.length}}function Ni(e,n){return Number.isFinite(e)?Math.max(0,Math.min(n,Math.round(e))):n}function Mo({busy:e,placement:n,state:s,onChange:r}){const[a,i]=o.useState(!1),[c,u]=o.useState(""),x=o.useRef(null),b=o.useMemo(()=>{const k=c.trim().toLowerCase();return k?s.options.filter(h=>`${h.label} ${h.detail}`.toLowerCase().includes(k)):s.options},[c,s.options]);return o.useEffect(()=>{if(!a){u("");return}function k(m){x.current?.contains(m.target)||i(!1)}function h(m){m.key==="Escape"&&i(!1)}return document.addEventListener("pointerdown",k),document.addEventListener("keydown",h),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",h)}},[a]),s.options.length<=1?null:t.jsxs("div",{className:`composer-profile-target ${n==="top"?"open-up":""}`,ref:x,children:[t.jsxs("button",{type:"button",className:`composer-profile-trigger ${a?"active":""}`,disabled:e,"aria-label":"Profile","aria-haspopup":"menu","aria-expanded":a,onClick:()=>i(k=>!k),children:[t.jsx("span",{children:s.label}),t.jsx(hs,{size:14})]}),a?t.jsxs("div",{className:"composer-project-menu",role:"menu","aria-label":"Profile",children:[t.jsx("div",{className:"composer-menu-search",children:t.jsx("input",{autoFocus:!0,value:c,placeholder:"Search profiles",onChange:k=>u(k.currentTarget.value)})}),t.jsx("div",{className:"composer-menu-items",children:b.map(k=>{const h=k.value===s.value;return t.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":h,className:`composer-project-option ${h?"selected":""}`,onClick:()=>{r(k.value),i(!1)},children:[t.jsxs("span",{children:[t.jsx("strong",{children:k.label}),t.jsx("small",{children:k.detail})]}),h?t.jsx(Ct,{size:14}):null]},k.value)})})]}):null]})}function Ei({busy:e,placement:n,state:s,onChange:r}){const[a,i]=o.useState(!1),[c,u]=o.useState(!1),[x,b]=o.useState(""),k=o.useRef(null),m=s.value==="none"?"Select Project":s.label,f=s.options.find(S=>S.value===s.value)?.kind??"local",v=o.useMemo(()=>{const S=x.trim().toLowerCase();return S?s.options.filter(L=>[L.label,L.detail].filter(Boolean).some(j=>j.toLowerCase().includes(S))):s.options},[x,s.options]),C=v.filter(S=>S.kind==="local"||S.kind==="cloud"),A=v.filter(S=>S.kind==="action"),p=v.filter(S=>S.kind==="none");o.useEffect(()=>{if(!a){b(""),u(!1);return}function S(j){k.current?.contains(j.target)||i(!1)}function L(j){j.key==="Escape"&&(c?u(!1):i(!1))}return document.addEventListener("pointerdown",S),document.addEventListener("keydown",L),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",L)}},[c,a]);function E(S){const L=S.value===s.value,j=e||S.disabled,I=S.kind==="action",D=S.disabled&&S.disabledReason?S.disabledReason:`${S.label}: ${S.detail}`;return t.jsxs("button",{type:"button",role:I?"menuitem":"menuitemradio","aria-checked":I?void 0:L,className:`composer-project-option ${L?"selected":""} ${S.kind}`,disabled:j,"data-tooltip":D,onClick:()=>{r(S.value),u(!1),i(!1)},children:[t.jsx(Er,{kind:S.kind,size:14}),t.jsxs("span",{children:[t.jsx("strong",{children:S.label}),t.jsx("small",{children:S.detail})]}),L&&t.jsx(Ct,{size:14})]},S.value)}return t.jsxs("div",{className:`composer-project-target ${n==="top"?"open-up":""}`,ref:k,children:[t.jsxs("button",{type:"button",className:`composer-project-trigger ${a?"active":""} ${f}`,disabled:e,"aria-label":"Project","aria-haspopup":"menu","aria-expanded":a,onClick:()=>{i(S=>!S),u(!1)},children:[t.jsx(Er,{kind:f,size:14}),t.jsx("span",{children:m}),t.jsx(hs,{size:14})]}),a&&t.jsxs("div",{className:"composer-project-menu",role:"menu","aria-label":"Project",children:[t.jsx("div",{className:"composer-menu-search",children:t.jsx("input",{autoFocus:!0,value:x,placeholder:"Search projects",onChange:S=>b(S.target.value)})}),t.jsx("div",{className:"composer-menu-items",children:v.length===0?t.jsx("div",{className:"composer-menu-empty",children:"No projects found"}):C.map(E)}),A.length>0||p.length>0?t.jsxs("div",{className:"composer-project-actions",children:[A.length>0?t.jsxs("button",{type:"button",role:"menuitem",className:`composer-project-option action composer-project-new-trigger ${c?"selected":""}`,"aria-haspopup":"menu","aria-expanded":c,onClick:()=>u(S=>!S),children:[t.jsx(tn,{size:14}),t.jsxs("span",{children:[t.jsx("strong",{children:"New"}),t.jsx("small",{children:"Create or add a project"})]}),t.jsx(Fs,{size:14})]}):null,p.map(E)]}):null]}),a&&c?t.jsxs("div",{className:"composer-project-new-menu",role:"menu","aria-label":"New project",children:[t.jsxs("button",{type:"button",role:"menuitem",className:"composer-project-new-menu-back",onClick:()=>u(!1),children:[t.jsx(In,{size:14}),t.jsx("span",{children:"New project"})]}),A.map(E)]}):null]})}function Er({kind:e,size:n}){return e==="cloud"?t.jsx(Sr,{size:n}):e==="action"?t.jsx(tn,{size:n}):t.jsx(Cr,{size:n})}function Ai({busy:e,placement:n,state:s,onChange:r}){const[a,i]=o.useState(!1),c=o.useRef(null),u=s.value==="cloud"?"cloud":s.value==="hybrid"?"hybrid":"local",x=`${s.label}: ${s.detail}`,b=s.uploadAction??null,k=b?Hr(b):null,h=b?b.disabled&&b.disabledReason?b.disabledReason:`${b.label}: ${k??b.detail}`:null,m=!!(b&&(e||s.busy||b.disabled));return o.useEffect(()=>{if(!a)return;function f(C){c.current?.contains(C.target)||i(!1)}function v(C){C.key==="Escape"&&i(!1)}return document.addEventListener("pointerdown",f),document.addEventListener("keydown",v),()=>{document.removeEventListener("pointerdown",f),document.removeEventListener("keydown",v)}},[a]),t.jsxs("div",{className:`workspace-action-control ${n==="top"?"open-up":""}`,ref:c,children:[t.jsxs("button",{type:"button",className:`workspace-action-trigger ${u} ${a?"active":""}`,disabled:e,"data-tooltip":x,"aria-label":"Working in","aria-haspopup":"menu","aria-expanded":a,onClick:()=>i(f=>!f),children:[t.jsx(Us,{value:s.value,size:14}),t.jsx("span",{className:"workspace-target-trigger-label",children:s.label}),t.jsx(hs,{size:14})]}),b?t.jsx("button",{type:"button",className:`workspace-upload-trigger ${b.value}`,disabled:m,"data-tooltip":h??void 0,"aria-label":b.label,onClick:()=>{r(b.value),i(!1)},children:t.jsx(Us,{value:b.value,size:14})}):null,a&&t.jsx("div",{className:"workspace-target-menu",role:"menu","aria-label":"Working in",children:s.options.map(f=>{const v=f.value===s.value,C=e||s.busy||f.disabled,p=Hr(f)??f.detail,E=f.disabled&&f.disabledReason?f.disabledReason:`${f.label}: ${p}`;return t.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":v,className:`workspace-target-option ${v?"selected":""} ${f.value}`,disabled:C,"data-tooltip":E,onClick:()=>{r(f.value),i(!1)},children:[t.jsx(Us,{value:f.value,size:14}),t.jsxs("span",{children:[t.jsx("strong",{children:f.label}),t.jsx("small",{children:p})]}),v&&t.jsx(Ct,{size:14})]},f.value)})})]})}function Ti({project:e,workspace:n}){const r=e.options.find(i=>i.value===e.value)?.kind??"none",a=e.value==="none"?"No Project":e.label;return t.jsxs("div",{className:"composer-footer composer-pinned-context",role:"group","aria-label":"Task context",children:[t.jsxs("span",{className:"composer-context-chip","aria-label":`Project: ${a}`,children:[t.jsx(Er,{kind:r,size:14}),t.jsx("span",{children:a})]}),t.jsxs("span",{className:"composer-context-chip","aria-label":`Execution: ${n.label}`,children:[t.jsx(Us,{value:n.value,size:14}),t.jsx("span",{children:n.label})]})]})}function Hr(e){return e.disabled&&e.disabledReason?e.disabledReason:e.stateNote??null}function Us({value:e,size:n}){return e==="cloud"?t.jsx(Sr,{size:n}):e==="hybrid"?t.jsxs("span",{className:"workspace-target-hybrid-icon","aria-hidden":"true",children:[t.jsx(Cr,{className:"hybrid-folder",size:n}),t.jsx(Sr,{className:"hybrid-cloud",size:Math.max(7,Math.round(n*.62))})]}):e==="upload_cloud"?t.jsx(za,{size:n}):t.jsx(Cr,{size:n})}function Vr({disabled:e,model:n,modelGroups:s,placement:r,provider:a,reasoningEffort:i,showReasoning:c,onModelSelectionChange:u,onProviderSetupOpen:x,onReasoningEffortChange:b}){const[k,h]=o.useState(!1),[m,f]=o.useState("root"),v=o.useRef(null),C=s.find(j=>j.provider===a),A=C?.options.find(j=>j.value===n),p=xr.find(j=>j.value===i)??xr[1],E=Ri(A?.label??n),S=c?`${E} ${p.shortLabel??p.label}`:E,L=c?"Model and reasoning":"Model";return o.useEffect(()=>{if(!k){f("root");return}function j(D){v.current?.contains(D.target)||h(!1)}function I(D){D.key==="Escape"&&h(!1)}return document.addEventListener("pointerdown",j),document.addEventListener("keydown",I),()=>{document.removeEventListener("pointerdown",j),document.removeEventListener("keydown",I)}},[k]),o.useEffect(()=>{!c&&m==="effort"&&f("root")},[m,c]),t.jsxs("div",{className:`codex-model-reasoning ${r==="top"?"open-up":""}`,"data-tooltip":L,ref:v,children:[t.jsxs("button",{type:"button",className:`codex-model-trigger ${k?"active":""}`,disabled:e,"aria-label":L,"aria-haspopup":"menu","aria-expanded":k,onClick:()=>h(j=>!j),children:[t.jsx("span",{children:S}),t.jsx(hs,{size:14})]}),k&&t.jsx("div",{className:"codex-model-menu",role:"menu","aria-label":L,children:m==="root"?t.jsxs("div",{className:"codex-model-menu-root",children:[t.jsxs("button",{type:"button",className:"codex-model-menu-row",role:"menuitem",onClick:()=>f("provider"),children:[t.jsx("span",{children:"Provider"}),t.jsx("span",{className:"codex-model-menu-value",children:C?.label??a}),t.jsx(Fs,{size:14})]}),t.jsxs("button",{type:"button",className:"codex-model-menu-row",role:"menuitem",onClick:()=>f("model"),children:[t.jsx("span",{children:"Model"}),t.jsx("span",{className:"codex-model-menu-value",children:A?.label??n}),t.jsx(Fs,{size:14})]}),c?t.jsxs("button",{type:"button",className:"codex-model-menu-row",role:"menuitem",onClick:()=>f("effort"),children:[t.jsx("span",{children:"Effort"}),t.jsx("span",{className:"codex-model-menu-value",children:p.shortLabel??p.label}),t.jsx(Fs,{size:14})]}):null]}):m==="provider"?t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",className:"codex-model-submenu-heading","aria-label":"Back to model settings — Provider",onClick:()=>f("root"),children:[t.jsx(In,{size:14}),t.jsx("span",{children:"Provider"})]}),t.jsx("div",{className:"codex-model-menu-divider"}),t.jsx("div",{className:"codex-model-menu-options",children:s.map(j=>{const I=j.provider===a;return t.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":I,className:I?"selected":"",onClick:()=>{const D=j.options.find(re=>re.value===j.defaultModel)??j.options[0];D&&(u(j.provider,D.value),f("root"))},children:[t.jsx("span",{children:j.label}),I?t.jsx(Ct,{size:14}):null]},j.provider)})}),t.jsx("button",{type:"button",className:"codex-model-setup-action",role:"menuitem",onClick:()=>{h(!1),x?.()},children:t.jsxs("span",{className:"codex-model-menu-option-label",children:[t.jsx(tn,{size:13}),t.jsx("span",{children:"New Model/Provider"})]})})]}):m==="model"?t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",className:"codex-model-submenu-heading","aria-label":"Back to model settings — Model",onClick:()=>f("root"),children:[t.jsx(In,{size:14}),t.jsx("span",{children:"Model"})]}),t.jsx("div",{className:"codex-model-menu-divider"}),t.jsxs("div",{className:"codex-model-menu-options",children:[(C?.options??[]).map(j=>{const I=j.value===n;return t.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":I,className:I?"selected":"",onClick:()=>{u(a,j.value),f("root")},children:[t.jsx("span",{children:j.label}),I?t.jsx(Ct,{size:14}):null]},j.value)}),C?.options.length?null:t.jsx("div",{className:"codex-model-menu-empty",children:"No models from this provider"})]}),t.jsx("button",{type:"button",className:"codex-model-setup-action",role:"menuitem",onClick:()=>{h(!1),x?.()},children:t.jsxs("span",{className:"codex-model-menu-option-label",children:[t.jsx(tn,{size:13}),t.jsx("span",{children:"New Model/Provider"})]})})]}):t.jsxs("div",{className:"codex-model-menu-effort",children:[t.jsxs("button",{type:"button",className:"codex-model-submenu-heading","aria-label":"Back to model settings — Effort",onClick:()=>f("root"),children:[t.jsx(In,{size:14}),t.jsx("span",{children:"Effort"})]}),t.jsx("div",{className:"codex-model-menu-divider"}),xr.map(j=>t.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":j.value===i,className:j.value===i?"selected":"",onClick:()=>{b(j.value),f("root")},children:[t.jsx("span",{children:j.label}),j.value===i?t.jsx(Ct,{size:14}):null]},j.value))]})})]})}function Ri(e){return e.replace(/^GPT-/,"").replace(/\s+Codex Spark$/," Spark").replace(/\s+Codex$/," Codex")}function _i({detailsOpen:e,goalRuntime:n,objectiveId:s,subagentRuntime:r,onToggleDetails:a}){const i=r?.activeCount?`${n.tooltip}. ${r.tooltip}`:n.tooltip;return t.jsxs("div",{className:`composer-goal-strip ${n.tone}${r?.activeCount?" has-subagents":""}`,"data-tooltip":i,children:[t.jsx("div",{className:"composer-goal-heading",children:t.jsxs("button",{type:"button",className:"composer-goal-toggle","aria-expanded":e,"aria-controls":s,onClick:a,children:[t.jsx("span",{children:n.actionLabel}),t.jsxs("span",{className:"composer-goal-toggle-meta",children:[r?t.jsx("span",{className:"composer-goal-subagent-count",children:r.label}):null,t.jsx("span",{children:n.timeLabel}),t.jsx(hs,{size:15,"aria-hidden":"true"})]})]})}),e&&t.jsxs("div",{className:"composer-goal-objective",id:s,children:[n.objective,r?t.jsx("span",{className:"composer-goal-subagent-summary",children:r.tooltip}):null]})]})}function Ii(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`steer-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,9)}`}function Wr(e,n=120){const s=e.trim().replace(/\s+/g," ");return s.length<=n?s:`${s.slice(0,Math.max(0,n-1)).trimEnd()}...`}function $i(e,n={}){const s=n.now??new Date().toISOString();return{createdAt:s,id:n.id??Ii(),prompt:e,updatedAt:s}}function qs(e,n){return e.filter(s=>s.id!==n)}function Pi(e,n,s,r=new Date().toISOString()){return e.map(a=>a.id===n?{...a,prompt:s,updatedAt:r}:a)}function Li(e,n,s){return s?qs(e,n):e}function Ar(e,n,s=[]){return e[n]??s}function Di(e,n,s,r=[]){const a=Ar(e,n,r),i=s(a);return Object.is(a,i)?e:{...e,[n]:i}}function Oi(e){return e.prompt.trim()||e.attachmentCount>0||e.hasSelectedAction||e.hasSelectedCommand?"dialog":"load_composer"}function zi(e){return e.wasRunning&&!e.running&&e.autoDispatchReady&&e.hasQueuedDrafts&&!e.sending&&!e.waitingForStartedTurn}function Fi({drafts:e,editDraftValue:n,editingDraft:s,sendingDraftId:r,onCancelEdit:a,onDeleteDraft:i,onEditDraft:c,onEditDraftValueChange:u,onReplaceComposerDraft:x,onSaveQueuedDraft:b,onSteerDraft:k}){return e.length===0&&!s?null:t.jsxs("div",{className:"composer-steer-stack","aria-label":"Queued steer drafts",children:[e.map(h=>{const m=r===h.id;return t.jsxs("div",{className:`composer-steer-row ${m?"sending":""}`,children:[t.jsx("span",{className:"composer-steer-row-icon","aria-hidden":"true",children:t.jsx(Mr,{size:13})}),t.jsx("span",{className:"composer-steer-row-text",title:h.prompt,children:Wr(h.prompt)}),t.jsxs("button",{type:"button",className:"composer-steer-row-action primary",disabled:m,"aria-label":`Steer queued draft: ${Wr(h.prompt,60)}`,onClick:()=>k(h.id),children:[t.jsx(Mr,{size:12}),t.jsx("span",{children:m?"Sending":"Steer"})]}),t.jsx("button",{type:"button",className:"composer-steer-row-icon-button",disabled:m,"data-tooltip":"Edit queued steer","aria-label":"Edit queued steer",onClick:()=>c(h),children:t.jsx(Fa,{size:13})}),t.jsx("button",{type:"button",className:"composer-steer-row-icon-button",disabled:m,"data-tooltip":"Delete queued steer","aria-label":"Delete queued steer",onClick:()=>i(h.id),children:t.jsx(vo,{size:13})}),t.jsx("button",{type:"button",className:"composer-steer-row-icon-button",disabled:m,"data-tooltip":"More","aria-label":"More queued steer actions",children:t.jsx(Ho,{size:13})})]},h.id)}),s?t.jsx("div",{className:"composer-steer-edit-backdrop",role:"presentation",children:t.jsxs("div",{className:"composer-steer-edit-dialog",role:"dialog","aria-modal":"true","aria-label":"Edit queued steer",children:[t.jsxs("label",{className:"composer-steer-edit-field",children:[t.jsx("span",{children:"Edit queued steer"}),t.jsx("textarea",{autoFocus:!0,value:n,onChange:h=>u(h.target.value)})]}),t.jsxs("div",{className:"composer-steer-edit-actions",children:[t.jsx("button",{type:"button",onClick:a,children:"Cancel"}),t.jsx("button",{type:"button",disabled:!n.trim(),onClick:x,children:"Replace composer"}),t.jsx("button",{type:"button",className:"primary",disabled:!n.trim(),onClick:b,children:"Save queued draft"})]})]})}):null]})}const Bi=/\b(?:https?:\/\/)?(?:github\.com|(?:[a-z0-9-]+\.)*openpond\.ai)\/[^\s<>"'`]+/gi,Ui=/\b(?:git@)?(?:github\.com|(?:[a-z0-9-]+\.)*openpond\.ai):[^\s<>"'`]+/gi,qi=new Set(["about","apps","collections","codespaces","contact","customer-stories","enterprise","events","explore","features","issues","login","marketplace","mobile","new","notifications","orgs","organizations","pricing","pulls","readme","search","settings","sponsors","team","topics","trending"]),Hi=new Set(["account","api","dashboard","docs","install.sh","login","logout","opchat","sandboxes","settings"]);function Vi(e){const n=e.toLowerCase().replace(/^www\./,"");return n==="github.com"?"github":n==="openpond.ai"||n.endsWith(".openpond.ai")?"openpond":null}function Wi(e){return e==="github"?qi:Hi}function No(e){let n=e;for(;/[.,;!?]$/.test(n);)n=n.slice(0,-1);for(;Gi(n);)n=n.slice(0,-1);return n}function Gi(e){const n=e.at(-1);if(!n||!")]}".includes(n))return!1;const s=n===")"?"(":n==="]"?"[":"{";let r=0;for(const a of e)a===s&&(r+=1),a===n&&(r-=1);return r<0}function Ki(e){return e.replace(/\.git$/i,"")}function Eo(e){try{return decodeURIComponent(e)}catch{return e}}function Qi(e){return Ki(Eo(e.trim()))}function Ao(e){const n=e.host.toLowerCase().replace(/^www\./,""),s=Vi(n);if(!s)return null;const r=Eo(e.owner?.trim()??""),a=Qi(e.repo??"");return!r||!a||Wi(s).has(r.toLowerCase())?null:{end:e.end,host:n,label:`${r}/${a}`,provider:s,repo:a,start:e.start,url:e.url,owner:r}}function Xi(e,n){const s=No(e);if(!s)return null;try{const r=new URL(/^https?:\/\//i.test(s)?s:`https://${s}`),a=r.pathname.split("/").filter(Boolean);return Ao({end:n+s.length,host:r.hostname,owner:a[0],repo:a[1],start:n,url:s})}catch{return null}}function Ji(e,n){const s=No(e),r=/^(?:git@)?([^:]+):(.+)$/i.exec(s);if(!r)return null;const a=r[1]?.trim()??"",i=(r[2]??"").split("/").filter(Boolean);return Ao({end:n+s.length,host:a,owner:i[0],repo:i[1],start:n,url:s})}function Gr(e,n,s){const r=[];n.lastIndex=0;let a;for(;a=n.exec(e);){const i=a[0]??"",c=s(i,a.index);c&&r.push(c)}return r}function Zi(e){if(!e)return[];const n=[...Gr(e,Bi,Xi),...Gr(e,Ui,Ji)].sort((r,a)=>r.start-a.start||a.end-r.end),s=[];for(const r of n)s.some(a=>r.start<a.end&&r.end>a.start)||s.push(r);return s.sort((r,a)=>r.start-a.start)}const Yi=10,el=340,tl=320,nl=160,sl=56;function St(e,n=0){const s=Number.parseFloat(e);return Number.isFinite(s)?s:n}function kr(e){if(!e)return;e.style.height="auto";const n=window.getComputedStyle(e),s=St(n.fontSize,16),r=St(n.lineHeight,s*1.45),a=St(n.paddingTop)+St(n.paddingBottom),i=St(n.borderTopWidth)+St(n.borderBottomWidth),c=St(n.minHeight,66),u=Math.max(c,Math.ceil(r*Yi+a+i)),x=Math.max(c,Math.min(e.scrollHeight,u));e.style.height=`${x}px`,e.style.overflowY=e.scrollHeight>u?"auto":"hidden"}function yr(e,n){const s=e.getBoundingClientRect(),r=n.getBoundingClientRect(),a=window.getComputedStyle(e),i=St(a.paddingLeft,14),c=St(a.paddingTop,15),u=Math.max(0,r.width-16),x=Math.min(el,u),b=s.left-r.left+i-8,k=Math.max(8,Math.min(b,r.width-x-8)),h=Math.max(8,s.top-r.top+c+2);return{left:k,top:h,width:x}}function rl(e){const n=e.getBoundingClientRect(),s=Math.floor(n.top-sl);return{maxHeight:Math.max(nl,Math.min(tl,s))}}const ol="[data-inline-token='true']",al="[data-inline-repo-link='true']",il="[data-inline-connected-app-mention='true']";function ds(e){return e instanceof HTMLElement&&e.matches(ol)}function fs(e){return e instanceof HTMLElement&&e.matches(al)}function ms(e){return e instanceof HTMLElement&&e.matches(il)}function Vs(e,n){return Math.max(0,Math.min(e,n))}function $n(e,n){return e?Vs(e.position,n.length):null}function ll(e,n,s,r=!1){const a=$n(n,s),i=Vs(e,s.length);return a===null?i:i>a||r&&i===a?i+1:i}function Kr(e,n,s){const r=$n(n,s);return Vs(r===null?e:e>r?e-1:e,s.length)}function Qr(e){let n="",s=null;function r(a){if(fs(a)){n+=a.dataset.repoUrl??"";return}if(ms(a)){n+=a.dataset.connectedMentionText??"";return}if(ds(a)){s=n.length;return}if(a.nodeType===Node.TEXT_NODE){n+=a.textContent??"";return}a instanceof HTMLBRElement||a.childNodes.forEach(r)}return e.childNodes.forEach(r),{text:n,tokenPosition:s}}function nn(e){if(fs(e))return e.dataset.repoUrl?.length??0;if(ms(e))return e.dataset.connectedMentionText?.length??0;if(ds(e))return 1;if(e.nodeType===Node.TEXT_NODE)return e.textContent?.length??0;if(e instanceof HTMLBRElement)return 0;let n=0;return e.childNodes.forEach(s=>{n+=nn(s)}),n}function Xr(e,n,s){if(!n||n!==e&&!e.contains(n))return null;let r=0,a=!1;function i(c){if(!a){if((ds(c)||fs(c)||ms(c))&&(c===n||c.contains(n))){(c!==n||s>0)&&(r+=nn(c)),a=!0;return}if(ds(c)||fs(c)||ms(c)){r+=nn(c);return}if(c===n){if(c.nodeType===Node.TEXT_NODE)r+=s;else{const u=Array.from(c.childNodes).slice(0,s);for(const x of u)r+=nn(x)}a=!0;return}if(c.nodeType===Node.TEXT_NODE){r+=c.textContent?.length??0;return}c instanceof HTMLBRElement||c.childNodes.forEach(i)}}return i(e),a?r:null}function vr(e){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const s=Xr(e,n.anchorNode,n.anchorOffset),r=Xr(e,n.focusNode,n.focusOffset);return s===null||r===null?null:{anchor:s,focus:r}}function Jr(e,n){let s=Math.max(0,n);function r(c){const u=c.parentNode;return u?{node:u,offset:Array.prototype.indexOf.call(u.childNodes,c)}:{node:e,offset:0}}function a(c){const u=r(c);return{node:u.node,offset:u.offset+1}}function i(c){if(ds(c)||fs(c)||ms(c)){const u=nn(c);return s<=0?r(c):s<=u?a(c):(s-=u,null)}if(c.nodeType===Node.TEXT_NODE){const u=c.textContent?.length??0;return s<=u?{node:c,offset:s}:(s-=u,null)}if(c instanceof HTMLBRElement)return null;for(const u of c.childNodes){const x=i(u);if(x)return x}return null}return i(e)??{node:e,offset:e.childNodes.length}}function To(e,n){const s=window.getSelection();if(!s)return;const r=Jr(e,n.anchor),a=Jr(e,n.focus);if(s.removeAllRanges(),typeof s.setBaseAndExtent=="function"){s.setBaseAndExtent(r.node,r.offset,a.node,a.offset);return}const i=document.createRange(),c=n.anchor<=n.focus,u=c?r:a,x=c?a:r;i.setStart(u.node,u.offset),i.setEnd(x.node,x.offset),s.addRange(i)}function cl(e,n){To(e,{anchor:n,focus:n})}function Zr(e){document.execCommand("insertText",!1,e)}function ul(e){return e==="plus"?'<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"></path><path d="M12 5v14"></path></svg>':e==="bot"?'<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 8V4H8"></path><rect width="16" height="12" x="4" y="8" rx="2"></rect><path d="M2 14h2"></path><path d="M20 14h2"></path><path d="M15 13v2"></path><path d="M9 13v2"></path></svg>':e==="skill"?'<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 7v14"></path><path d="M3 18a1 1 0 0 1-1-1V5a2 2 0 0 1 2-2h5a3 3 0 0 1 3 3v15a3 3 0 0 0-3-3Z"></path><path d="M21 18a1 1 0 0 0 1-1V5a2 2 0 0 0-2-2h-5a3 3 0 0 0-3 3v15a3 3 0 0 1 3-3Z"></path></svg>':'<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="8" height="8" x="3" y="3" rx="2"></rect><path d="M7 11v4a2 2 0 0 0 2 2h4"></path><rect width="8" height="8" x="13" y="13" rx="2"></rect></svg>'}function dl(){return'<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="composer-invocation-clear" aria-hidden="true"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg>'}function Yr(e){const n=document.createElement("span");n.className="composer-invocation-pill",n.contentEditable="false",n.dataset.inlineToken="true";const s=document.createElement("button");s.type="button",s.className="composer-invocation-remove",s.setAttribute("aria-label",`Remove ${e.label}`),s.addEventListener("mousedown",i=>i.preventDefault()),s.addEventListener("click",i=>{i.preventDefault(),e.onRemove()});const r=document.createElement("span");r.className="composer-invocation-icon",r.setAttribute("aria-hidden","true"),r.innerHTML=ul(e.icon),s.append(r),s.insertAdjacentHTML("beforeend",dl());const a=document.createElement("span");return a.className="composer-invocation-label",a.textContent=e.label,n.append(s,a),n}function fl(e){return e.provider==="github"?Ir("github"):Wo}function ml(e){const n=document.createElement("span");n.className=`composer-repo-link ${e.provider}`,n.contentEditable="false",n.dataset.inlineRepoLink="true",n.dataset.repoUrl=e.url,n.dataset.repoProvider=e.provider,n.setAttribute("aria-label",`${e.provider==="github"?"GitHub":"OpenPond"} repository ${e.label}`),n.title=e.url;const s=document.createElement("img");s.className="composer-repo-link-icon",s.src=fl(e),s.alt="",s.draggable=!1;const r=document.createElement("span");return r.className="composer-repo-link-label",r.textContent=e.label,n.append(s,r),n}function hl(e){return Ir(e)}function pl(e){const n=document.createElement("span");n.className=`composer-connected-app-mention ${e.provider}`,n.contentEditable="false",n.dataset.inlineConnectedAppMention="true",n.dataset.connectedMentionText=e.text,n.dataset.connectedMentionProvider=e.provider,n.setAttribute("aria-label",`${e.label} connected app mention ${e.displayText}`),n.title=e.detail;const s=document.createElement("img");s.className="composer-connected-app-mention-icon",s.src=hl(e.provider),s.alt="",s.draggable=!1;const r=document.createElement("span");return r.className="composer-connected-app-mention-label",r.textContent=e.displayText,n.append(s,r),n}function xl(e,n){const s=Zi(e);return n===null?s:s.filter(r=>n<=r.start||n>=r.end)}function bl(e,n,s){const r=Vo(e,n);return s===null?r:r.filter(a=>s<=a.start||s>=a.end)}function Ro(e,n,s){const r=[...xl(e,n).map(c=>({end:c.end,kind:"repo",link:c,start:c.start})),...bl(e,s,n).map(c=>({end:c.end,kind:"connected-app",mention:c,start:c.start}))].sort((c,u)=>c.start-u.start||u.end-c.end),a=[];let i=0;for(const c of r)c.start<i||(a.push(c),i=c.end);return a}function gl(e,n,s){return Ro(e,n,s).map(r=>r.kind==="repo"?`${r.start}:${r.end}:repo:${r.link.provider}:${r.link.label}:${r.link.url}`:`${r.start}:${r.end}:connected-app:${r.mention.provider}:${r.mention.text}:${r.mention.displayText}`).join("|")}function kl(e,n,s,r){const a=$n(s,n),i=Ro(n,a,r);let c=!1;function u(k){k&&e.append(document.createTextNode(k))}function x(k,h){if(!s||a===null||c||a<k||a>h){u(n.slice(k,h));return}u(n.slice(k,a)),e.append(Yr(s)),c=!0,u(n.slice(a,h))}e.replaceChildren();let b=0;for(const k of i)x(b,k.start),k.kind==="repo"?e.append(ml(k.link)):e.append(pl(k.mention)),b=k.end;x(b,n.length),s&&!c&&e.append(Yr(s))}const yl=o.forwardRef(function({connectedAppMentions:n=[],disabled:s,onCursorChange:r,onKeyDown:a,onPasteFiles:i,onPasteTextAsAttachment:c,onPromptChange:u,onTokenPositionChange:x,placeholder:b,prompt:k,token:h},m){const f=o.useRef(null),C=`${h?`${h.key}:${$n(h,k)??0}`:"none"}|${gl(k,$n(h,k),n)}`,A=o.useRef(null),p=k.length===0&&!h;o.useImperativeHandle(m,()=>({get element(){return f.current},focusAtPromptIndex(j,I){const D=f.current;if(!D)return;const re=ll(j,h,k,I?.afterToken);D.focus(),cl(D,re),kr(D)},resize(){kr(f.current)}}),[k,h]),o.useLayoutEffect(()=>{const j=f.current;if(!j)return;const I=A.current!==C;A.current=C;const D=Qr(j);if(I||k===""||D.text!==k||D.tokenPosition!==$n(h,k)){const ue=document.activeElement===j?vr(j):null;kl(j,k,h,n),j.dataset.empty=k.length===0&&!h?"true":"false",ue&&To(j,ue)}kr(j)},[n,k,h,C]);function E(){const j=f.current;if(!j)return;const I=vr(j)?.focus??nn(j),D=Qr(j),re=Kr(I,h,D.text);j.dataset.empty=D.text.length===0&&!h?"true":"false",x(D.tokenPosition),r(re),u(D.text,re)}function S(){E(),window.requestAnimationFrame(E)}function L(){const j=f.current;if(!j)return;const I=vr(j)?.focus??nn(j);r(Kr(I,h,k))}return t.jsx("div",{ref:f,className:"composer-inline-input",role:"textbox","aria-multiline":"true",contentEditable:!s,suppressContentEditableWarning:!0,"data-empty":p?"true":"false","data-placeholder":b,onBeforeInput:j=>{j.nativeEvent.inputType==="insertParagraph"&&(j.preventDefault(),Zr(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ComposerCreateImproveStrip-CW2QuI7r.js","./index-Ure41UF0.js","./index-UUM3pwfd.css","./circle-alert-BUHAQ7Du.js","./MarkdownText-DTBS9xe7.js","./play-CjWTsI9z.js","./refresh-cw-CeHT_tXT.js","./TerminalOverlay-XhABQsCB.js","./TerminalOverlay-DwBiZLwk.css","./WorkspaceDiffPanel-jaJU08NH.js","./training-model-data-B7-1Bxil.js","./square-pen-LHr8bFfZ.js","./folder-open-D7a4t258.js","./info-dTkimobU.js","./save-CmJ92Odx.js","./chevron-up-UF_r7JHT.js","./AppsView-Cm5x09IS.js","./AppsView-DIhprTIC.css","./GetStartedView--CbCnzFQ.js","./index-De6p2npi.js","./AppDialog-BTOxCNC5.js","./GetStartedView-yVmnGZPw.css","./LabsRoute-CYk2dzQp.js","./cloud-upload-Cc_ZQEAm.js","./UsageSettingsSection-NbX7_3Uz.js","./arrow-up-right-Cx2xjktp.js","./UsageSettingsSection-O8VK0qBL.css","./LabsRoute-CoSPO4HR.css","./training-BQVNUTZA.css","./ScheduledWorkPage-Cn5a9VLV.js","./useLocalAgentSchedules-BUkZjV9E.js","./OutputsPage-XmIreC0M.js","./square-B00f_944.js","./LabSkillSidebar-CnuyFZ1G.js","./LabSkillSidebar-CVxtS9pd.css","./BrowserSidebar-CIPh5JIn.js","./BrowserSidebar-D9i7gQzw.css","./RightChatPanelStack-BMOtbjus.js","./Messages-Bae_sFx5.js","./git-branch-CaVUghsI.js","./NativeSkillSidebar-DSoPD42b.js","./NativeSkillSidebar-T8KXjnUH.css","./TeamChatView-CB_0oRid.js","./reply-BkH8nKWG.js","./TeamChatView-Cgxm-pKA.css","./git-dialogs-BZDqS1eT.css","./CommunityView-Dqu4cos1.js","./wifi-off-BQGq-son.js","./CommunityView-DSik4sd2.css","./TrainingDraftPanel-CDlpnno6.js","./MainChatThread-0Tc95p0t.js","./TrainingCreationPanel-ChsDr2GP.js"])))=>i.map(i=>d[i]);
2
+ import{c as Le,r as o,j as t,C as hs,P as tn,a as Fs,A as In,b as Ct,d as Sr,e as xr,E as Ho,f as Vo,O as Wo,g as Ir,B as Go,F as sn,h as $r,i as Ko,k as Qo,l as Xo,m as Jo,n as Se,p as Zo,o as Dr,q as Or,S as po,s as xo,t as Yo,X as Ws,G as ea,u as ta,v as Pt,w as Pr,x as _n,y as zr,z as bo,D as na,H as sa,I as ra,J as oa,K as aa,L as ia,M as la,N as ca,Q as ua,_ as je,R as go,T as da,U as fa,V as ma,W as ha,Y as pa,Z as xa,$ as ko,a0 as ba,a1 as ga,a2 as yo,a3 as ka,a4 as Fr,a5 as ya,a6 as va,a7 as Tn,a8 as ja,a9 as wa,aa as Sa,ab as Ca,ac as Ma,ad as Na,ae as Ea,af as Aa,ag as Ta,ah as Ra,ai as _a,aj as Ia,ak as $a,al as Pa,am as La,an as Da,ao as Oa}from"./index-Ure41UF0.js";import{C as za}from"./cloud-upload-Cc_ZQEAm.js";import{F as Cr,S as Fa}from"./square-pen-LHr8bFfZ.js";import{A as Mr}from"./arrow-up-right-Cx2xjktp.js";import{T as vo,B as br,W as gr,D as Br,P as Ba,F as Ua,C as qa,M as jo,a as Ha,b as Va,r as Wa,s as Ga,A as wo,c as Ka,n as Qa}from"./MarkdownText-DTBS9xe7.js";import{S as Nr,a as Xa}from"./square-B00f_944.js";import{F as So}from"./folder-open-D7a4t258.js";function Co(e){return e?(e.match(/\r\n|\r|\n/g)?.length??0)+(/(?:\r\n|\r|\n)$/.test(e)?0:1):0}const Ja=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Za=Le("archive",Ja);const Ya=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ei=Le("arrow-down",Ya);const ti=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ur=Le("arrow-up",ti);const ni=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],qr=Le("at-sign",ni);const si=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ri=Le("badge-check",si);const oi=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ai=Le("ban",oi);const ii=[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]],li=Le("cloud-download",ii);const ci=[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],ui=Le("file-headphone",ci);const di=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],fi=Le("file-spreadsheet",di);const mi=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],hi=Le("file-play",mi);const pi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],xi=Le("image",pi);const bi=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],gi=Le("lightbulb",bi);const ki=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],yi=Le("mic",ki);const vi=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Hs=Le("paperclip",vi);const ji=[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]],wi=Le("presentation",ji);function Si(e,n){const s=e.slice(0,Math.max(0,Math.min(n,e.length))),r=/(?:^|\s)\$([a-zA-Z][a-zA-Z0-9_-]*)?$/.exec(s);if(!r||typeof r.index!="number")return null;const a=r[0].lastIndexOf("$");return a<0?null:{end:s.length,query:(r[1]??"").toLowerCase(),start:r.index+a}}function Gs(e){return`$${e.name}`}function Ci(e,n,s){const r=Math.max(0,Math.min(n.start,e.length)),a=Math.max(r,Math.min(n.end,e.length)),i=e.slice(0,r),c=e.slice(a),u=i&&!/\s$/.test(i)?" ":"",x=c&&/^\s/.test(c)?"":" ",b=`${u}${Gs(s)}${x}`;return{cursor:i.length+b.length-(c?x.length:0),value:`${i}${b}${c}`}}function Bs(e,n,s){const r=n.trim().toLowerCase(),a=e.filter(i=>i.enabled&&i.validationStatus==="valid").filter(i=>r?[i.name,i.description,i.path].join(" ").toLowerCase().includes(r):!0).sort((i,c)=>i.name.localeCompare(c.name));return typeof s=="number"&&Number.isFinite(s)?a.slice(0,Math.max(0,s)):a}function Mi(e,n,s){const r=n.trim().replace(/\s+/g," "),a=Ni(s,e.length);if(!r)return{value:e,cursorIndex:a};const i=e.slice(0,a),c=e.slice(a),u=i&&!/\s$/.test(i)?" ":"",x=c&&!/^\s/.test(c)?" ":"",b=`${u}${r}${x}`;return{value:`${i}${b}${c}`,cursorIndex:i.length+u.length+r.length+x.length}}function Ni(e,n){return Number.isFinite(e)?Math.max(0,Math.min(n,Math.round(e))):n}function Mo({busy:e,placement:n,state:s,onChange:r}){const[a,i]=o.useState(!1),[c,u]=o.useState(""),x=o.useRef(null),b=o.useMemo(()=>{const k=c.trim().toLowerCase();return k?s.options.filter(h=>`${h.label} ${h.detail}`.toLowerCase().includes(k)):s.options},[c,s.options]);return o.useEffect(()=>{if(!a){u("");return}function k(m){x.current?.contains(m.target)||i(!1)}function h(m){m.key==="Escape"&&i(!1)}return document.addEventListener("pointerdown",k),document.addEventListener("keydown",h),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",h)}},[a]),s.options.length<=1?null:t.jsxs("div",{className:`composer-profile-target ${n==="top"?"open-up":""}`,ref:x,children:[t.jsxs("button",{type:"button",className:`composer-profile-trigger ${a?"active":""}`,disabled:e,"aria-label":"Profile","aria-haspopup":"menu","aria-expanded":a,onClick:()=>i(k=>!k),children:[t.jsx("span",{children:s.label}),t.jsx(hs,{size:14})]}),a?t.jsxs("div",{className:"composer-project-menu",role:"menu","aria-label":"Profile",children:[t.jsx("div",{className:"composer-menu-search",children:t.jsx("input",{autoFocus:!0,value:c,placeholder:"Search profiles",onChange:k=>u(k.currentTarget.value)})}),t.jsx("div",{className:"composer-menu-items",children:b.map(k=>{const h=k.value===s.value;return t.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":h,className:`composer-project-option ${h?"selected":""}`,onClick:()=>{r(k.value),i(!1)},children:[t.jsxs("span",{children:[t.jsx("strong",{children:k.label}),t.jsx("small",{children:k.detail})]}),h?t.jsx(Ct,{size:14}):null]},k.value)})})]}):null]})}function Ei({busy:e,placement:n,state:s,onChange:r}){const[a,i]=o.useState(!1),[c,u]=o.useState(!1),[x,b]=o.useState(""),k=o.useRef(null),m=s.value==="none"?"Select Project":s.label,f=s.options.find(S=>S.value===s.value)?.kind??"local",v=o.useMemo(()=>{const S=x.trim().toLowerCase();return S?s.options.filter(L=>[L.label,L.detail].filter(Boolean).some(j=>j.toLowerCase().includes(S))):s.options},[x,s.options]),C=v.filter(S=>S.kind==="local"||S.kind==="cloud"),A=v.filter(S=>S.kind==="action"),p=v.filter(S=>S.kind==="none");o.useEffect(()=>{if(!a){b(""),u(!1);return}function S(j){k.current?.contains(j.target)||i(!1)}function L(j){j.key==="Escape"&&(c?u(!1):i(!1))}return document.addEventListener("pointerdown",S),document.addEventListener("keydown",L),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",L)}},[c,a]);function E(S){const L=S.value===s.value,j=e||S.disabled,I=S.kind==="action",D=S.disabled&&S.disabledReason?S.disabledReason:`${S.label}: ${S.detail}`;return t.jsxs("button",{type:"button",role:I?"menuitem":"menuitemradio","aria-checked":I?void 0:L,className:`composer-project-option ${L?"selected":""} ${S.kind}`,disabled:j,"data-tooltip":D,onClick:()=>{r(S.value),u(!1),i(!1)},children:[t.jsx(Er,{kind:S.kind,size:14}),t.jsxs("span",{children:[t.jsx("strong",{children:S.label}),t.jsx("small",{children:S.detail})]}),L&&t.jsx(Ct,{size:14})]},S.value)}return t.jsxs("div",{className:`composer-project-target ${n==="top"?"open-up":""}`,ref:k,children:[t.jsxs("button",{type:"button",className:`composer-project-trigger ${a?"active":""} ${f}`,disabled:e,"aria-label":"Project","aria-haspopup":"menu","aria-expanded":a,onClick:()=>{i(S=>!S),u(!1)},children:[t.jsx(Er,{kind:f,size:14}),t.jsx("span",{children:m}),t.jsx(hs,{size:14})]}),a&&t.jsxs("div",{className:"composer-project-menu",role:"menu","aria-label":"Project",children:[t.jsx("div",{className:"composer-menu-search",children:t.jsx("input",{autoFocus:!0,value:x,placeholder:"Search projects",onChange:S=>b(S.target.value)})}),t.jsx("div",{className:"composer-menu-items",children:v.length===0?t.jsx("div",{className:"composer-menu-empty",children:"No projects found"}):C.map(E)}),A.length>0||p.length>0?t.jsxs("div",{className:"composer-project-actions",children:[A.length>0?t.jsxs("button",{type:"button",role:"menuitem",className:`composer-project-option action composer-project-new-trigger ${c?"selected":""}`,"aria-haspopup":"menu","aria-expanded":c,onClick:()=>u(S=>!S),children:[t.jsx(tn,{size:14}),t.jsxs("span",{children:[t.jsx("strong",{children:"New"}),t.jsx("small",{children:"Create or add a project"})]}),t.jsx(Fs,{size:14})]}):null,p.map(E)]}):null]}),a&&c?t.jsxs("div",{className:"composer-project-new-menu",role:"menu","aria-label":"New project",children:[t.jsxs("button",{type:"button",role:"menuitem",className:"composer-project-new-menu-back",onClick:()=>u(!1),children:[t.jsx(In,{size:14}),t.jsx("span",{children:"New project"})]}),A.map(E)]}):null]})}function Er({kind:e,size:n}){return e==="cloud"?t.jsx(Sr,{size:n}):e==="action"?t.jsx(tn,{size:n}):t.jsx(Cr,{size:n})}function Ai({busy:e,placement:n,state:s,onChange:r}){const[a,i]=o.useState(!1),c=o.useRef(null),u=s.value==="cloud"?"cloud":s.value==="hybrid"?"hybrid":"local",x=`${s.label}: ${s.detail}`,b=s.uploadAction??null,k=b?Hr(b):null,h=b?b.disabled&&b.disabledReason?b.disabledReason:`${b.label}: ${k??b.detail}`:null,m=!!(b&&(e||s.busy||b.disabled));return o.useEffect(()=>{if(!a)return;function f(C){c.current?.contains(C.target)||i(!1)}function v(C){C.key==="Escape"&&i(!1)}return document.addEventListener("pointerdown",f),document.addEventListener("keydown",v),()=>{document.removeEventListener("pointerdown",f),document.removeEventListener("keydown",v)}},[a]),t.jsxs("div",{className:`workspace-action-control ${n==="top"?"open-up":""}`,ref:c,children:[t.jsxs("button",{type:"button",className:`workspace-action-trigger ${u} ${a?"active":""}`,disabled:e,"data-tooltip":x,"aria-label":"Working in","aria-haspopup":"menu","aria-expanded":a,onClick:()=>i(f=>!f),children:[t.jsx(Us,{value:s.value,size:14}),t.jsx("span",{className:"workspace-target-trigger-label",children:s.label}),t.jsx(hs,{size:14})]}),b?t.jsx("button",{type:"button",className:`workspace-upload-trigger ${b.value}`,disabled:m,"data-tooltip":h??void 0,"aria-label":b.label,onClick:()=>{r(b.value),i(!1)},children:t.jsx(Us,{value:b.value,size:14})}):null,a&&t.jsx("div",{className:"workspace-target-menu",role:"menu","aria-label":"Working in",children:s.options.map(f=>{const v=f.value===s.value,C=e||s.busy||f.disabled,p=Hr(f)??f.detail,E=f.disabled&&f.disabledReason?f.disabledReason:`${f.label}: ${p}`;return t.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":v,className:`workspace-target-option ${v?"selected":""} ${f.value}`,disabled:C,"data-tooltip":E,onClick:()=>{r(f.value),i(!1)},children:[t.jsx(Us,{value:f.value,size:14}),t.jsxs("span",{children:[t.jsx("strong",{children:f.label}),t.jsx("small",{children:p})]}),v&&t.jsx(Ct,{size:14})]},f.value)})})]})}function Ti({project:e,workspace:n}){const r=e.options.find(i=>i.value===e.value)?.kind??"none",a=e.value==="none"?"No Project":e.label;return t.jsxs("div",{className:"composer-footer composer-pinned-context",role:"group","aria-label":"Task context",children:[t.jsxs("span",{className:"composer-context-chip","aria-label":`Project: ${a}`,children:[t.jsx(Er,{kind:r,size:14}),t.jsx("span",{children:a})]}),t.jsxs("span",{className:"composer-context-chip","aria-label":`Execution: ${n.label}`,children:[t.jsx(Us,{value:n.value,size:14}),t.jsx("span",{children:n.label})]})]})}function Hr(e){return e.disabled&&e.disabledReason?e.disabledReason:e.stateNote??null}function Us({value:e,size:n}){return e==="cloud"?t.jsx(Sr,{size:n}):e==="hybrid"?t.jsxs("span",{className:"workspace-target-hybrid-icon","aria-hidden":"true",children:[t.jsx(Cr,{className:"hybrid-folder",size:n}),t.jsx(Sr,{className:"hybrid-cloud",size:Math.max(7,Math.round(n*.62))})]}):e==="upload_cloud"?t.jsx(za,{size:n}):t.jsx(Cr,{size:n})}function Vr({disabled:e,model:n,modelGroups:s,placement:r,provider:a,reasoningEffort:i,showReasoning:c,onModelSelectionChange:u,onProviderSetupOpen:x,onReasoningEffortChange:b}){const[k,h]=o.useState(!1),[m,f]=o.useState("root"),v=o.useRef(null),C=s.find(j=>j.provider===a),A=C?.options.find(j=>j.value===n),p=xr.find(j=>j.value===i)??xr[1],E=Ri(A?.label??n),S=c?`${E} ${p.shortLabel??p.label}`:E,L=c?"Model and reasoning":"Model";return o.useEffect(()=>{if(!k){f("root");return}function j(D){v.current?.contains(D.target)||h(!1)}function I(D){D.key==="Escape"&&h(!1)}return document.addEventListener("pointerdown",j),document.addEventListener("keydown",I),()=>{document.removeEventListener("pointerdown",j),document.removeEventListener("keydown",I)}},[k]),o.useEffect(()=>{!c&&m==="effort"&&f("root")},[m,c]),t.jsxs("div",{className:`codex-model-reasoning ${r==="top"?"open-up":""}`,"data-tooltip":L,ref:v,children:[t.jsxs("button",{type:"button",className:`codex-model-trigger ${k?"active":""}`,disabled:e,"aria-label":L,"aria-haspopup":"menu","aria-expanded":k,onClick:()=>h(j=>!j),children:[t.jsx("span",{children:S}),t.jsx(hs,{size:14})]}),k&&t.jsx("div",{className:"codex-model-menu",role:"menu","aria-label":L,children:m==="root"?t.jsxs("div",{className:"codex-model-menu-root",children:[t.jsxs("button",{type:"button",className:"codex-model-menu-row",role:"menuitem",onClick:()=>f("provider"),children:[t.jsx("span",{children:"Provider"}),t.jsx("span",{className:"codex-model-menu-value",children:C?.label??a}),t.jsx(Fs,{size:14})]}),t.jsxs("button",{type:"button",className:"codex-model-menu-row",role:"menuitem",onClick:()=>f("model"),children:[t.jsx("span",{children:"Model"}),t.jsx("span",{className:"codex-model-menu-value",children:A?.label??n}),t.jsx(Fs,{size:14})]}),c?t.jsxs("button",{type:"button",className:"codex-model-menu-row",role:"menuitem",onClick:()=>f("effort"),children:[t.jsx("span",{children:"Effort"}),t.jsx("span",{className:"codex-model-menu-value",children:p.shortLabel??p.label}),t.jsx(Fs,{size:14})]}):null]}):m==="provider"?t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",className:"codex-model-submenu-heading","aria-label":"Back to model settings — Provider",onClick:()=>f("root"),children:[t.jsx(In,{size:14}),t.jsx("span",{children:"Provider"})]}),t.jsx("div",{className:"codex-model-menu-divider"}),t.jsx("div",{className:"codex-model-menu-options",children:s.map(j=>{const I=j.provider===a;return t.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":I,className:I?"selected":"",onClick:()=>{const D=j.options.find(re=>re.value===j.defaultModel)??j.options[0];D&&(u(j.provider,D.value),f("root"))},children:[t.jsx("span",{children:j.label}),I?t.jsx(Ct,{size:14}):null]},j.provider)})}),t.jsx("button",{type:"button",className:"codex-model-setup-action",role:"menuitem",onClick:()=>{h(!1),x?.()},children:t.jsxs("span",{className:"codex-model-menu-option-label",children:[t.jsx(tn,{size:13}),t.jsx("span",{children:"New Model/Provider"})]})})]}):m==="model"?t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",className:"codex-model-submenu-heading","aria-label":"Back to model settings — Model",onClick:()=>f("root"),children:[t.jsx(In,{size:14}),t.jsx("span",{children:"Model"})]}),t.jsx("div",{className:"codex-model-menu-divider"}),t.jsxs("div",{className:"codex-model-menu-options",children:[(C?.options??[]).map(j=>{const I=j.value===n;return t.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":I,className:I?"selected":"",onClick:()=>{u(a,j.value),f("root")},children:[t.jsx("span",{children:j.label}),I?t.jsx(Ct,{size:14}):null]},j.value)}),C?.options.length?null:t.jsx("div",{className:"codex-model-menu-empty",children:"No models from this provider"})]}),t.jsx("button",{type:"button",className:"codex-model-setup-action",role:"menuitem",onClick:()=>{h(!1),x?.()},children:t.jsxs("span",{className:"codex-model-menu-option-label",children:[t.jsx(tn,{size:13}),t.jsx("span",{children:"New Model/Provider"})]})})]}):t.jsxs("div",{className:"codex-model-menu-effort",children:[t.jsxs("button",{type:"button",className:"codex-model-submenu-heading","aria-label":"Back to model settings — Effort",onClick:()=>f("root"),children:[t.jsx(In,{size:14}),t.jsx("span",{children:"Effort"})]}),t.jsx("div",{className:"codex-model-menu-divider"}),xr.map(j=>t.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":j.value===i,className:j.value===i?"selected":"",onClick:()=>{b(j.value),f("root")},children:[t.jsx("span",{children:j.label}),j.value===i?t.jsx(Ct,{size:14}):null]},j.value))]})})]})}function Ri(e){return e.replace(/^GPT-/,"").replace(/\s+Codex Spark$/," Spark").replace(/\s+Codex$/," Codex")}function _i({detailsOpen:e,goalRuntime:n,objectiveId:s,subagentRuntime:r,onToggleDetails:a}){const i=r?.activeCount?`${n.tooltip}. ${r.tooltip}`:n.tooltip;return t.jsxs("div",{className:`composer-goal-strip ${n.tone}${r?.activeCount?" has-subagents":""}`,"data-tooltip":i,children:[t.jsx("div",{className:"composer-goal-heading",children:t.jsxs("button",{type:"button",className:"composer-goal-toggle","aria-expanded":e,"aria-controls":s,onClick:a,children:[t.jsx("span",{children:n.actionLabel}),t.jsxs("span",{className:"composer-goal-toggle-meta",children:[r?t.jsx("span",{className:"composer-goal-subagent-count",children:r.label}):null,t.jsx("span",{children:n.timeLabel}),t.jsx(hs,{size:15,"aria-hidden":"true"})]})]})}),e&&t.jsxs("div",{className:"composer-goal-objective",id:s,children:[n.objective,r?t.jsx("span",{className:"composer-goal-subagent-summary",children:r.tooltip}):null]})]})}function Ii(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`steer-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,9)}`}function Wr(e,n=120){const s=e.trim().replace(/\s+/g," ");return s.length<=n?s:`${s.slice(0,Math.max(0,n-1)).trimEnd()}...`}function $i(e,n={}){const s=n.now??new Date().toISOString();return{createdAt:s,id:n.id??Ii(),prompt:e,updatedAt:s}}function qs(e,n){return e.filter(s=>s.id!==n)}function Pi(e,n,s,r=new Date().toISOString()){return e.map(a=>a.id===n?{...a,prompt:s,updatedAt:r}:a)}function Li(e,n,s){return s?qs(e,n):e}function Ar(e,n,s=[]){return e[n]??s}function Di(e,n,s,r=[]){const a=Ar(e,n,r),i=s(a);return Object.is(a,i)?e:{...e,[n]:i}}function Oi(e){return e.prompt.trim()||e.attachmentCount>0||e.hasSelectedAction||e.hasSelectedCommand?"dialog":"load_composer"}function zi(e){return e.wasRunning&&!e.running&&e.autoDispatchReady&&e.hasQueuedDrafts&&!e.sending&&!e.waitingForStartedTurn}function Fi({drafts:e,editDraftValue:n,editingDraft:s,sendingDraftId:r,onCancelEdit:a,onDeleteDraft:i,onEditDraft:c,onEditDraftValueChange:u,onReplaceComposerDraft:x,onSaveQueuedDraft:b,onSteerDraft:k}){return e.length===0&&!s?null:t.jsxs("div",{className:"composer-steer-stack","aria-label":"Queued steer drafts",children:[e.map(h=>{const m=r===h.id;return t.jsxs("div",{className:`composer-steer-row ${m?"sending":""}`,children:[t.jsx("span",{className:"composer-steer-row-icon","aria-hidden":"true",children:t.jsx(Mr,{size:13})}),t.jsx("span",{className:"composer-steer-row-text",title:h.prompt,children:Wr(h.prompt)}),t.jsxs("button",{type:"button",className:"composer-steer-row-action primary",disabled:m,"aria-label":`Steer queued draft: ${Wr(h.prompt,60)}`,onClick:()=>k(h.id),children:[t.jsx(Mr,{size:12}),t.jsx("span",{children:m?"Sending":"Steer"})]}),t.jsx("button",{type:"button",className:"composer-steer-row-icon-button",disabled:m,"data-tooltip":"Edit queued steer","aria-label":"Edit queued steer",onClick:()=>c(h),children:t.jsx(Fa,{size:13})}),t.jsx("button",{type:"button",className:"composer-steer-row-icon-button",disabled:m,"data-tooltip":"Delete queued steer","aria-label":"Delete queued steer",onClick:()=>i(h.id),children:t.jsx(vo,{size:13})}),t.jsx("button",{type:"button",className:"composer-steer-row-icon-button",disabled:m,"data-tooltip":"More","aria-label":"More queued steer actions",children:t.jsx(Ho,{size:13})})]},h.id)}),s?t.jsx("div",{className:"composer-steer-edit-backdrop",role:"presentation",children:t.jsxs("div",{className:"composer-steer-edit-dialog",role:"dialog","aria-modal":"true","aria-label":"Edit queued steer",children:[t.jsxs("label",{className:"composer-steer-edit-field",children:[t.jsx("span",{children:"Edit queued steer"}),t.jsx("textarea",{autoFocus:!0,value:n,onChange:h=>u(h.target.value)})]}),t.jsxs("div",{className:"composer-steer-edit-actions",children:[t.jsx("button",{type:"button",onClick:a,children:"Cancel"}),t.jsx("button",{type:"button",disabled:!n.trim(),onClick:x,children:"Replace composer"}),t.jsx("button",{type:"button",className:"primary",disabled:!n.trim(),onClick:b,children:"Save queued draft"})]})]})}):null]})}const Bi=/\b(?:https?:\/\/)?(?:github\.com|(?:[a-z0-9-]+\.)*openpond\.ai)\/[^\s<>"'`]+/gi,Ui=/\b(?:git@)?(?:github\.com|(?:[a-z0-9-]+\.)*openpond\.ai):[^\s<>"'`]+/gi,qi=new Set(["about","apps","collections","codespaces","contact","customer-stories","enterprise","events","explore","features","issues","login","marketplace","mobile","new","notifications","orgs","organizations","pricing","pulls","readme","search","settings","sponsors","team","topics","trending"]),Hi=new Set(["account","api","dashboard","docs","install.sh","login","logout","opchat","sandboxes","settings"]);function Vi(e){const n=e.toLowerCase().replace(/^www\./,"");return n==="github.com"?"github":n==="openpond.ai"||n.endsWith(".openpond.ai")?"openpond":null}function Wi(e){return e==="github"?qi:Hi}function No(e){let n=e;for(;/[.,;!?]$/.test(n);)n=n.slice(0,-1);for(;Gi(n);)n=n.slice(0,-1);return n}function Gi(e){const n=e.at(-1);if(!n||!")]}".includes(n))return!1;const s=n===")"?"(":n==="]"?"[":"{";let r=0;for(const a of e)a===s&&(r+=1),a===n&&(r-=1);return r<0}function Ki(e){return e.replace(/\.git$/i,"")}function Eo(e){try{return decodeURIComponent(e)}catch{return e}}function Qi(e){return Ki(Eo(e.trim()))}function Ao(e){const n=e.host.toLowerCase().replace(/^www\./,""),s=Vi(n);if(!s)return null;const r=Eo(e.owner?.trim()??""),a=Qi(e.repo??"");return!r||!a||Wi(s).has(r.toLowerCase())?null:{end:e.end,host:n,label:`${r}/${a}`,provider:s,repo:a,start:e.start,url:e.url,owner:r}}function Xi(e,n){const s=No(e);if(!s)return null;try{const r=new URL(/^https?:\/\//i.test(s)?s:`https://${s}`),a=r.pathname.split("/").filter(Boolean);return Ao({end:n+s.length,host:r.hostname,owner:a[0],repo:a[1],start:n,url:s})}catch{return null}}function Ji(e,n){const s=No(e),r=/^(?:git@)?([^:]+):(.+)$/i.exec(s);if(!r)return null;const a=r[1]?.trim()??"",i=(r[2]??"").split("/").filter(Boolean);return Ao({end:n+s.length,host:a,owner:i[0],repo:i[1],start:n,url:s})}function Gr(e,n,s){const r=[];n.lastIndex=0;let a;for(;a=n.exec(e);){const i=a[0]??"",c=s(i,a.index);c&&r.push(c)}return r}function Zi(e){if(!e)return[];const n=[...Gr(e,Bi,Xi),...Gr(e,Ui,Ji)].sort((r,a)=>r.start-a.start||a.end-r.end),s=[];for(const r of n)s.some(a=>r.start<a.end&&r.end>a.start)||s.push(r);return s.sort((r,a)=>r.start-a.start)}const Yi=10,el=340,tl=320,nl=160,sl=56;function St(e,n=0){const s=Number.parseFloat(e);return Number.isFinite(s)?s:n}function kr(e){if(!e)return;e.style.height="auto";const n=window.getComputedStyle(e),s=St(n.fontSize,16),r=St(n.lineHeight,s*1.45),a=St(n.paddingTop)+St(n.paddingBottom),i=St(n.borderTopWidth)+St(n.borderBottomWidth),c=St(n.minHeight,66),u=Math.max(c,Math.ceil(r*Yi+a+i)),x=Math.max(c,Math.min(e.scrollHeight,u));e.style.height=`${x}px`,e.style.overflowY=e.scrollHeight>u?"auto":"hidden"}function yr(e,n){const s=e.getBoundingClientRect(),r=n.getBoundingClientRect(),a=window.getComputedStyle(e),i=St(a.paddingLeft,14),c=St(a.paddingTop,15),u=Math.max(0,r.width-16),x=Math.min(el,u),b=s.left-r.left+i-8,k=Math.max(8,Math.min(b,r.width-x-8)),h=Math.max(8,s.top-r.top+c+2);return{left:k,top:h,width:x}}function rl(e){const n=e.getBoundingClientRect(),s=Math.floor(n.top-sl);return{maxHeight:Math.max(nl,Math.min(tl,s))}}const ol="[data-inline-token='true']",al="[data-inline-repo-link='true']",il="[data-inline-connected-app-mention='true']";function ds(e){return e instanceof HTMLElement&&e.matches(ol)}function fs(e){return e instanceof HTMLElement&&e.matches(al)}function ms(e){return e instanceof HTMLElement&&e.matches(il)}function Vs(e,n){return Math.max(0,Math.min(e,n))}function $n(e,n){return e?Vs(e.position,n.length):null}function ll(e,n,s,r=!1){const a=$n(n,s),i=Vs(e,s.length);return a===null?i:i>a||r&&i===a?i+1:i}function Kr(e,n,s){const r=$n(n,s);return Vs(r===null?e:e>r?e-1:e,s.length)}function Qr(e){let n="",s=null;function r(a){if(fs(a)){n+=a.dataset.repoUrl??"";return}if(ms(a)){n+=a.dataset.connectedMentionText??"";return}if(ds(a)){s=n.length;return}if(a.nodeType===Node.TEXT_NODE){n+=a.textContent??"";return}a instanceof HTMLBRElement||a.childNodes.forEach(r)}return e.childNodes.forEach(r),{text:n,tokenPosition:s}}function nn(e){if(fs(e))return e.dataset.repoUrl?.length??0;if(ms(e))return e.dataset.connectedMentionText?.length??0;if(ds(e))return 1;if(e.nodeType===Node.TEXT_NODE)return e.textContent?.length??0;if(e instanceof HTMLBRElement)return 0;let n=0;return e.childNodes.forEach(s=>{n+=nn(s)}),n}function Xr(e,n,s){if(!n||n!==e&&!e.contains(n))return null;let r=0,a=!1;function i(c){if(!a){if((ds(c)||fs(c)||ms(c))&&(c===n||c.contains(n))){(c!==n||s>0)&&(r+=nn(c)),a=!0;return}if(ds(c)||fs(c)||ms(c)){r+=nn(c);return}if(c===n){if(c.nodeType===Node.TEXT_NODE)r+=s;else{const u=Array.from(c.childNodes).slice(0,s);for(const x of u)r+=nn(x)}a=!0;return}if(c.nodeType===Node.TEXT_NODE){r+=c.textContent?.length??0;return}c instanceof HTMLBRElement||c.childNodes.forEach(i)}}return i(e),a?r:null}function vr(e){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const s=Xr(e,n.anchorNode,n.anchorOffset),r=Xr(e,n.focusNode,n.focusOffset);return s===null||r===null?null:{anchor:s,focus:r}}function Jr(e,n){let s=Math.max(0,n);function r(c){const u=c.parentNode;return u?{node:u,offset:Array.prototype.indexOf.call(u.childNodes,c)}:{node:e,offset:0}}function a(c){const u=r(c);return{node:u.node,offset:u.offset+1}}function i(c){if(ds(c)||fs(c)||ms(c)){const u=nn(c);return s<=0?r(c):s<=u?a(c):(s-=u,null)}if(c.nodeType===Node.TEXT_NODE){const u=c.textContent?.length??0;return s<=u?{node:c,offset:s}:(s-=u,null)}if(c instanceof HTMLBRElement)return null;for(const u of c.childNodes){const x=i(u);if(x)return x}return null}return i(e)??{node:e,offset:e.childNodes.length}}function To(e,n){const s=window.getSelection();if(!s)return;const r=Jr(e,n.anchor),a=Jr(e,n.focus);if(s.removeAllRanges(),typeof s.setBaseAndExtent=="function"){s.setBaseAndExtent(r.node,r.offset,a.node,a.offset);return}const i=document.createRange(),c=n.anchor<=n.focus,u=c?r:a,x=c?a:r;i.setStart(u.node,u.offset),i.setEnd(x.node,x.offset),s.addRange(i)}function cl(e,n){To(e,{anchor:n,focus:n})}function Zr(e){document.execCommand("insertText",!1,e)}function ul(e){return e==="plus"?'<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"></path><path d="M12 5v14"></path></svg>':e==="bot"?'<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 8V4H8"></path><rect width="16" height="12" x="4" y="8" rx="2"></rect><path d="M2 14h2"></path><path d="M20 14h2"></path><path d="M15 13v2"></path><path d="M9 13v2"></path></svg>':e==="skill"?'<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 7v14"></path><path d="M3 18a1 1 0 0 1-1-1V5a2 2 0 0 1 2-2h5a3 3 0 0 1 3 3v15a3 3 0 0 0-3-3Z"></path><path d="M21 18a1 1 0 0 0 1-1V5a2 2 0 0 0-2-2h-5a3 3 0 0 0-3 3v15a3 3 0 0 1 3-3Z"></path></svg>':'<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="8" height="8" x="3" y="3" rx="2"></rect><path d="M7 11v4a2 2 0 0 0 2 2h4"></path><rect width="8" height="8" x="13" y="13" rx="2"></rect></svg>'}function dl(){return'<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="composer-invocation-clear" aria-hidden="true"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg>'}function Yr(e){const n=document.createElement("span");n.className="composer-invocation-pill",n.contentEditable="false",n.dataset.inlineToken="true";const s=document.createElement("button");s.type="button",s.className="composer-invocation-remove",s.setAttribute("aria-label",`Remove ${e.label}`),s.addEventListener("mousedown",i=>i.preventDefault()),s.addEventListener("click",i=>{i.preventDefault(),e.onRemove()});const r=document.createElement("span");r.className="composer-invocation-icon",r.setAttribute("aria-hidden","true"),r.innerHTML=ul(e.icon),s.append(r),s.insertAdjacentHTML("beforeend",dl());const a=document.createElement("span");return a.className="composer-invocation-label",a.textContent=e.label,n.append(s,a),n}function fl(e){return e.provider==="github"?Ir("github"):Wo}function ml(e){const n=document.createElement("span");n.className=`composer-repo-link ${e.provider}`,n.contentEditable="false",n.dataset.inlineRepoLink="true",n.dataset.repoUrl=e.url,n.dataset.repoProvider=e.provider,n.setAttribute("aria-label",`${e.provider==="github"?"GitHub":"OpenPond"} repository ${e.label}`),n.title=e.url;const s=document.createElement("img");s.className="composer-repo-link-icon",s.src=fl(e),s.alt="",s.draggable=!1;const r=document.createElement("span");return r.className="composer-repo-link-label",r.textContent=e.label,n.append(s,r),n}function hl(e){return Ir(e)}function pl(e){const n=document.createElement("span");n.className=`composer-connected-app-mention ${e.provider}`,n.contentEditable="false",n.dataset.inlineConnectedAppMention="true",n.dataset.connectedMentionText=e.text,n.dataset.connectedMentionProvider=e.provider,n.setAttribute("aria-label",`${e.label} connected app mention ${e.displayText}`),n.title=e.detail;const s=document.createElement("img");s.className="composer-connected-app-mention-icon",s.src=hl(e.provider),s.alt="",s.draggable=!1;const r=document.createElement("span");return r.className="composer-connected-app-mention-label",r.textContent=e.displayText,n.append(s,r),n}function xl(e,n){const s=Zi(e);return n===null?s:s.filter(r=>n<=r.start||n>=r.end)}function bl(e,n,s){const r=Vo(e,n);return s===null?r:r.filter(a=>s<=a.start||s>=a.end)}function Ro(e,n,s){const r=[...xl(e,n).map(c=>({end:c.end,kind:"repo",link:c,start:c.start})),...bl(e,s,n).map(c=>({end:c.end,kind:"connected-app",mention:c,start:c.start}))].sort((c,u)=>c.start-u.start||u.end-c.end),a=[];let i=0;for(const c of r)c.start<i||(a.push(c),i=c.end);return a}function gl(e,n,s){return Ro(e,n,s).map(r=>r.kind==="repo"?`${r.start}:${r.end}:repo:${r.link.provider}:${r.link.label}:${r.link.url}`:`${r.start}:${r.end}:connected-app:${r.mention.provider}:${r.mention.text}:${r.mention.displayText}`).join("|")}function kl(e,n,s,r){const a=$n(s,n),i=Ro(n,a,r);let c=!1;function u(k){k&&e.append(document.createTextNode(k))}function x(k,h){if(!s||a===null||c||a<k||a>h){u(n.slice(k,h));return}u(n.slice(k,a)),e.append(Yr(s)),c=!0,u(n.slice(a,h))}e.replaceChildren();let b=0;for(const k of i)x(b,k.start),k.kind==="repo"?e.append(ml(k.link)):e.append(pl(k.mention)),b=k.end;x(b,n.length),s&&!c&&e.append(Yr(s))}const yl=o.forwardRef(function({connectedAppMentions:n=[],disabled:s,onCursorChange:r,onKeyDown:a,onPasteFiles:i,onPasteTextAsAttachment:c,onPromptChange:u,onTokenPositionChange:x,placeholder:b,prompt:k,token:h},m){const f=o.useRef(null),C=`${h?`${h.key}:${$n(h,k)??0}`:"none"}|${gl(k,$n(h,k),n)}`,A=o.useRef(null),p=k.length===0&&!h;o.useImperativeHandle(m,()=>({get element(){return f.current},focusAtPromptIndex(j,I){const D=f.current;if(!D)return;const re=ll(j,h,k,I?.afterToken);D.focus(),cl(D,re),kr(D)},resize(){kr(f.current)}}),[k,h]),o.useLayoutEffect(()=>{const j=f.current;if(!j)return;const I=A.current!==C;A.current=C;const D=Qr(j);if(I||k===""||D.text!==k||D.tokenPosition!==$n(h,k)){const ue=document.activeElement===j?vr(j):null;kl(j,k,h,n),j.dataset.empty=k.length===0&&!h?"true":"false",ue&&To(j,ue)}kr(j)},[n,k,h,C]);function E(){const j=f.current;if(!j)return;const I=vr(j)?.focus??nn(j),D=Qr(j),re=Kr(I,h,D.text);j.dataset.empty=D.text.length===0&&!h?"true":"false",x(D.tokenPosition),r(re),u(D.text,re)}function S(){E(),window.requestAnimationFrame(E)}function L(){const j=f.current;if(!j)return;const I=vr(j)?.focus??nn(j);r(Kr(I,h,k))}return t.jsx("div",{ref:f,className:"composer-inline-input",role:"textbox","aria-multiline":"true",contentEditable:!s,suppressContentEditableWarning:!0,"data-empty":p?"true":"false","data-placeholder":b,onBeforeInput:j=>{j.nativeEvent.inputType==="insertParagraph"&&(j.preventDefault(),Zr(`
3
3
  `),S())},onInput:E,onKeyDown:j=>{a(j)},onKeyUp:L,onMouseUp:L,onPaste:j=>{j.preventDefault();const I=Array.from(j.clipboardData.files);if(I.length>0&&i){i(I);return}const D=j.clipboardData.getData("text/plain");D&&(c?.(D)||(Zr(D),S()))}})});function eo(e){const n=e.implementation?.type;return n==="openpond-agent"||n==="local-profile-agent"||n==="openpond-profile-action"&&(e.sourceActionId==="chat"||e.id==="chat"||e.id.endsWith(".chat"))}function vl(e){return e.kind==="command"?`command:${e.command.id}`:e.kind==="app-context"?`app-context:${e.app.id}`:e.kind==="skill"?`skill:${e.skill.name}`:`action:${e.action.id}`}function jl(e){return e.kind==="command"?`${e.command.command} ${e.command.label}`:e.kind==="app-context"?e.app.name:e.kind==="skill"?Gs(e.skill):$r(e.action)}function wl(e){return e.kind==="command"?Qo(e.command):e.kind==="app-context"?`Planning context${e.app.description?`: ${e.app.description}`:e.app.gitRepo?`: ${e.app.gitRepo}`:""}`:e.kind==="skill"?e.skill.description||e.skill.path:e.action.description||Xo(e.action)}function Sl(e){return e.kind==="app"?`app:${e.app.id}`:e.kind==="connected-app"?`connected-app:${e.app.provider}`:e.kind==="team-member"?`team-member:${e.member.userId}`:e.kind==="skill"?`skill:${e.skill.name}`:`action:${e.action.id}`}function Cl(e){return e.kind==="app"?e.app.name:e.kind==="connected-app"?e.app.label:e.kind==="team-member"?e.member.name:e.kind==="skill"?Gs(e.skill):Ko(e.action)}function Ml(e){if(e.kind==="action")return Jo(e.action);if(e.kind==="connected-app")return e.app.detail;if(e.kind==="team-member")return e.member.handle?`@${e.member.handle}`:"Team member";if(e.kind==="skill")return e.skill.description||e.skill.path;const n=e.app.sandboxActionRegistry?.actions.map(s=>s.name)??[];return n.length>0?`Actions: ${n.slice(0,4).join(", ")}${n.length>4?` +${n.length-4}`:""}`:e.app.sandboxManifestError?"Manifest registry unavailable":e.app.description||e.app.gitRepo||e.app.id}function Nl(e){return e.kind==="files"?"files":e.kind==="folder"?"folder":e.kind==="slash"?`slash:${vl(e.item)}`:`mention:${Sl(e.item)}`}function _o(e){return e.kind==="files"?"Files and folders":e.kind==="folder"?"Local folder":e.kind==="slash"?jl(e.item):Cl(e.item)}function Io(e){return e.kind==="files"?"Attach images, documents, or other files":e.kind==="folder"?"Share a bounded folder as Work input":e.kind==="slash"?wl(e.item):Ml(e.item)}function El(e,n){const s=n.toLowerCase().split(/\s+/).filter(Boolean);if(s.length===0)return!0;const r=`${_o(e)} ${Io(e)}`.toLowerCase();return s.every(a=>r.includes(a))}function Al(e,n){const s=n.trimStart(),r=s.startsWith("/")?"slash":s.startsWith("@")?"mentions":null,a=r?s.slice(1).trimStart():s,i=r?e.filter(x=>x.id===r||x.queryScope===r||x.queryScopes?.includes(r)):e;if(!a)return i;const c=i.map(x=>({...x,items:x.items.filter(b=>El(b,a))})).filter(x=>x.items.length>0);return c.length>0?c:[{...(r?i[0]:null)??{id:"results",label:"Results"},emptyLabel:r==="slash"?"No slash commands match":r==="mentions"?"No mentions match":"No commands match",items:[]}]}function Tl(e){if(e.kind==="files")return t.jsx(Hs,{size:14});if(e.kind==="folder")return t.jsx(Hs,{size:14});if(e.kind==="slash"){const s=e.item;return s.kind==="command"?s.command.id==="agent"?t.jsx(br,{size:14}):s.command.id==="skill"?t.jsx(Go,{size:14}):t.jsx(gr,{size:14}):s.kind==="app-context"?t.jsx(qr,{size:14}):s.kind==="skill"?t.jsx(sn,{size:14}):eo(s.action)?t.jsx(br,{size:14}):t.jsx(gr,{size:14})}const n=e.item;return n.kind==="connected-app"?t.jsx("img",{alt:"",className:"composer-provider-mention-icon",draggable:!1,src:Ir(n.app.provider)}):n.kind==="action"?eo(n.action)?t.jsx(br,{size:14}):t.jsx(gr,{size:14}):n.kind==="skill"?t.jsx(sn,{size:14}):t.jsx(qr,{size:14})}function Rl(e){if(e.kind==="slash"&&e.item.kind==="app-context"||e.kind==="mention"&&e.item.kind==="app")return e.item.app.id}function Lr({ariaLabel:e,className:n="",id:s,menuIndex:r,menuRef:a,onSelect:i,onSelectIndex:c,sections:u,style:x,variant:b}){const k=o.useRef(null),h=u.reduce((f,v)=>f+v.items.length,0);o.useEffect(()=>{if(b==="add"&&r===0){const f=k.current?.closest(".composer-command-menu");f&&(f.scrollTop=0);return}k.current?.scrollIntoView({block:"nearest"})},[h,r,b]);let m=0;return t.jsx("div",{ref:a,id:s,className:`composer-project-menu composer-slash-menu ${n} composer-command-menu composer-command-menu-${b}`.trim(),role:b==="add"?"menu":"listbox","aria-label":e,style:x,children:u.map(f=>{const v=m;return m+=f.items.length,t.jsxs("div",{className:`composer-command-section ${f.grid?"composer-command-section-grid":""}`.trim(),role:"group","aria-label":f.label,children:[t.jsx("div",{className:"composer-command-section-title",children:f.label}),f.items.length>0?f.items.map((C,A)=>{const p=v+A,E=p===r;return t.jsxs("button",{type:"button",role:b==="add"?"menuitem":"option",ref:E?k:void 0,"aria-selected":b==="typed"?E:void 0,className:`composer-project-option ${E?"selected":""} composer-command-option`,"data-app-context-id":Rl(C),onFocus:()=>c(p),onMouseEnter:()=>c(p),onMouseDown:S=>{S.preventDefault()},onClick:()=>i(C),children:[Tl(C),t.jsxs("span",{children:[t.jsx("strong",{children:_o(C)}),t.jsx("small",{children:Io(C)})]}),b==="typed"&&E?t.jsx(Ct,{size:14}):t.jsx("span",{"aria-hidden":"true"})]},Nl(C))}):t.jsx("div",{className:"composer-menu-empty",children:f.emptyLabel??"No items available"})]},f.id)})})}function _l({mentionIndex:e,items:n,onSelect:s,onSelectIndex:r,style:a}){return t.jsx(Lr,{ariaLabel:"Mentions",className:"composer-mention-menu",menuIndex:e,sections:[{emptyLabel:"No matching mentions",id:"mentions",items:n.map(i=>({kind:"mention",item:i})),label:"@"}],style:a,variant:"typed",onSelect:i=>{i.kind==="mention"&&s(i.item)},onSelectIndex:r})}function Tr(){return!!(navigator.mediaDevices&&typeof AudioContext<"u")}async function Il(){if(!Tr())throw new Error("Voice recording is not available in this browser.");const e=await navigator.mediaDevices.getUserMedia({audio:{autoGainControl:!0,channelCount:1,echoCancellation:!0,noiseSuppression:!0}}),n=new AudioContext,s=n.createMediaStreamSource(e),r=n.createScriptProcessor(4096,1,1),a=n.createGain();a.gain.value=0;const i={audioContext:n,chunks:[],processor:r,silentGain:a,source:s,stream:e,startedAt:performance.now(),stopped:!1};return r.onaudioprocess=c=>{if(i.stopped)return;const u=c.inputBuffer.getChannelData(0);i.chunks.push(new Float32Array(u))},s.connect(r),r.connect(a),a.connect(n.destination),{stop:()=>to(i,!0),cancel:()=>to(i,!1).then(()=>{})}}async function to(e,n){if(e.stopped)return{blob:new Blob([],{type:"audio/wav"}),durationMs:0,sampleRate:e.audioContext.sampleRate};e.stopped=!0,e.processor.disconnect(),e.silentGain.disconnect(),e.source.disconnect();for(const a of e.stream.getTracks())a.stop();await e.audioContext.close().catch(()=>{});const s=Math.max(0,performance.now()-e.startedAt);if(!n)return{blob:new Blob([],{type:"audio/wav"}),durationMs:s,sampleRate:e.audioContext.sampleRate};const r=$l(e.chunks);if(r.length===0)throw new Error("No microphone audio was captured.");return{blob:Pl(r,e.audioContext.sampleRate),durationMs:s,sampleRate:e.audioContext.sampleRate}}function $l(e){const n=e.reduce((a,i)=>a+i.length,0),s=new Float32Array(n);let r=0;for(const a of e)s.set(a,r),r+=a.length;return s}function Pl(e,n){const a=e.length*2,i=new ArrayBuffer(44+a),c=new DataView(i);Ds(c,0,"RIFF"),c.setUint32(4,36+a,!0),Ds(c,8,"WAVE"),Ds(c,12,"fmt "),c.setUint32(16,16,!0),c.setUint16(20,1,!0),c.setUint16(22,1,!0),c.setUint32(24,n,!0),c.setUint32(28,n*1*2,!0),c.setUint16(32,2,!0),c.setUint16(34,16,!0),Ds(c,36,"data"),c.setUint32(40,a,!0);let u=44;for(const x of e){const b=Math.max(-1,Math.min(1,x));c.setInt16(u,b<0?b*32768:b*32767,!0),u+=2}return new Blob([i],{type:"audio/wav"})}function Ds(e,n,s){for(let r=0;r<s.length;r+=1)e.setUint8(n+r,s.charCodeAt(r))}const Ll=12e4,$o="openpond.voice.setupNoticeAcknowledged",Dl="Voice dictation runs locally with whisper.cpp. OpenPond uses a local whisper-cli binary and downloads the voice model on first use.";function no({connection:e,buttonClassName:n,wrapperClassName:s="",disabled:r=!1,iconSize:a=16,language:i="en",showToast:c,onTranscript:u}){const x=o.useRef(null),b=o.useRef(null),k=o.useRef(e),h=o.useRef(r),m=o.useRef(zl());k.current=e,h.current=r;const[f,v]=o.useState("idle"),[C,A]=o.useState(null),p=f==="transcribing",E=f==="recording",S=!e||!Tr(),L=C??(E?"Stop dictation":p?"Transcribing voice":S?"Voice input unavailable":"Dictate"),j=o.useCallback(()=>{b.current!==null&&(window.clearTimeout(b.current),b.current=null)},[]),I=o.useCallback(async()=>{j();const B=x.current;x.current=null,v("idle"),B&&await B.cancel().catch(()=>{})},[j]),D=o.useCallback(async B=>{const H=k.current;if(!H)throw new Error("Voice input is still connecting.");const Q=await Se.voiceTranscriptionStatus(H);if(!Q.binaryPath)throw new Error(Q.installHint??"Install whisper.cpp to use dictation.");!Q.modelReady&&Q.canDownloadModel?A(`Downloading ${Q.modelName} voice model...`):A("Transcribing voice...");const pe=await Se.transcribeVoice(H,{audioBase64:await Ol(B.blob),durationMs:Math.round(B.durationMs),language:i,mimeType:"audio/wav"});u(pe.text),A(null)},[i,u]),re=o.useCallback(async()=>{j();const B=x.current;if(x.current=null,!!B){v("transcribing"),A("Transcribing voice...");try{const H=await B.stop();await D(H)}catch(H){A(so(H))}finally{v("idle")}}},[j,D]),ue=o.useCallback(async()=>{if(h.current)return;const B=k.current;if(!B){A("Voice input is still connecting.");return}if(!Tr()){A("Voice recording is not available in this browser.");return}A(null);try{const H=await Se.voiceTranscriptionStatus(B);if(!H.binaryPath)throw new Error(H.installHint??"Install whisper.cpp to use dictation.");if(!H.modelReady&&H.canDownloadModel&&A(`${H.modelName} will download after recording.`),await window.openpond?.requestMicrophoneAccess?.()===!1)throw new Error("Microphone access is denied.");const pe=await Il();x.current=pe,v("recording"),A("Recording..."),b.current=window.setTimeout(()=>{re()},Ll)}catch(H){A(so(H)),await I()}},[I,re]),le=o.useCallback(()=>{if(m.current){ue();return}c(Dl,"info",{actionLabel:"Continue",persistent:!0,onAction:()=>{m.current=!0,Fl(),ue()}})},[ue,c]);return o.useEffect(()=>{if(!C||E||p)return;const B=window.setTimeout(()=>A(null),7e3);return()=>window.clearTimeout(B)},[p,C,E]),o.useEffect(()=>()=>{I()},[I]),t.jsxs("span",{className:`voice-input-control ${s} ${E?"recording":""}`.trim(),children:[t.jsx("button",{type:"button",className:`${n} ${E?"recording active":""}`.trim(),"aria-label":E?"Stop dictation":"Dictate","aria-pressed":E,"data-tooltip":L,disabled:r||p,onClick:()=>{E?re():le()},children:E?t.jsx(Nr,{size:Math.max(12,a-3),fill:"currentColor"}):t.jsx(yi,{size:a})}),C?t.jsx("span",{className:"voice-input-status",role:"status",children:C}):null]})}async function Ol(e){const n=new Uint8Array(await e.arrayBuffer());let s="";for(let r=0;r<n.length;r+=32768){const a=n.subarray(r,r+32768);s+=String.fromCharCode(...a)}return window.btoa(s)}function so(e){const n=e instanceof Error?e.message:String(e);return/NotAllowedError|Permission denied|denied/i.test(n)?"Microphone access is denied.":/NotFoundError|Requested device not found/i.test(n)?"No microphone was found.":n||"Voice input failed."}function zl(){if(typeof window>"u")return!1;try{return window.localStorage.getItem($o)==="true"}catch{return!1}}function Fl(){if(!(typeof window>"u"))try{window.localStorage.setItem($o,"true")}catch{}}const Bl=new Set(["codex","local-adapter","openai","xai","openrouter","deepseek","zai","moonshot","together","groq","custom-openai-compatible","setup-provider"]);function Ul({surface:e="chat",teamUseModel:n=!1,teamUseModelLocked:s=!1,onTeamUseModelChange:r,addFiles:a,addMenuId:i,addMenuOpen:c,addMenuRef:u,busy:x,codexPermissionMode:b,codexReasoningEffort:k,connection:h,contextStatusStyle:m,contextStatusTooltipId:f,contextWindowStatus:v,disabled:C,dropdownPlacement:A,fileInputRef:p,modelValue:E,modelOptions:S=[],openPondCommandAccessMode:L,showCommandAccess:j=!0,profileTarget:I,onCodexPermissionModeChange:D,onCodexReasoningEffortChange:re,onOpenPondCommandAccessModeChange:ue,onProfileTargetChange:le,onModelChange:B,onOpenFilePicker:H,onProviderChange:Q,onProviderSetupOpen:pe,onQueueDraft:be,onStop:de,onToggleAddMenu:y,onTranscript:w,provider:_,providerSettings:U,providerOptions:oe,queueDraftDisabled:fe,queueDraftTooltip:$,running:Ce,sendDisabled:Ne,sendTooltip:z,showToast:Y,stopIcon:V="stop",stopLabel:ae="Stop response",steering:F}){const he=Zo(_,E,U),G=o.useMemo(()=>ql({currentModelOptions:S,currentProvider:_,providerOptions:oe,providerSettings:U}),[S,_,oe,U]),st=o.useMemo(()=>G.filter(N=>Bl.has(N.provider)),[G]),M=(N,ne)=>{if(N===_){B(ne);return}B(ne),Q(N)};return e==="team"?t.jsxs("div",{className:"composer-primary-controls team-chat-composer-controls",children:[t.jsx("button",{type:"button",className:"composer-icon","aria-label":"Add photos and files",disabled:C,onClick:H,children:t.jsx(tn,{size:18})}),t.jsx("input",{ref:p,className:"composer-file-input",type:"file",multiple:!0,tabIndex:-1,onChange:N=>{a(Array.from(N.currentTarget.files??[])),N.currentTarget.value=""}}),t.jsxs("label",{className:"team-chat-model-toggle",children:[t.jsx("input",{type:"checkbox",checked:n,disabled:x||s,onChange:N=>r?.(N.currentTarget.checked)}),t.jsx("span",{children:"Use model"})]}),t.jsx("div",{className:"composer-spacer"}),n?t.jsx(Vr,{disabled:x,model:E,modelGroups:st,placement:A,provider:_,reasoningEffort:k,showReasoning:he,onModelSelectionChange:M,onProviderSetupOpen:pe,onReasoningEffortChange:re}):null,t.jsx(no,{buttonClassName:"composer-icon",connection:h,disabled:C,iconSize:16,wrapperClassName:"composer-voice-input",showToast:Y,onTranscript:w}),Ce?t.jsx("button",{type:"button",className:"send-button stop-button","data-tooltip":ae,"aria-label":ae,onClick:de,children:t.jsx(Nr,{size:13,fill:"currentColor"})}):t.jsx("button",{className:"send-button",disabled:Ne,"data-tooltip":z,"aria-label":z,children:t.jsx(Ur,{size:18})})]}):t.jsxs("div",{className:"composer-primary-controls",children:[t.jsxs("div",{className:"composer-add-control open-up",ref:u,children:[t.jsx("button",{type:"button",className:`composer-icon ${c?"active":""}`,"aria-label":"Add to message","aria-haspopup":"menu","aria-expanded":c,"aria-controls":c?i:void 0,disabled:C,onMouseDown:N=>N.preventDefault(),onClick:y,children:t.jsx(tn,{size:18})}),t.jsx("input",{ref:p,className:"composer-file-input",type:"file",multiple:!0,tabIndex:-1,onChange:N=>{a(Array.from(N.currentTarget.files??[])),N.currentTarget.value=""}})]}),j&&_==="codex"?t.jsx(Br,{compact:!0,className:"permission-select",icon:t.jsx(Xa,{size:14}),placement:A,label:"Codex permissions",tooltip:Dr.find(N=>N.value===b)?.label,value:b,options:Dr,disabled:x,onChange:N=>D(N)}):j?t.jsx(Br,{compact:!0,className:"permission-select",icon:t.jsx(po,{size:14}),placement:A,label:"Command access",tooltip:Or.find(N=>N.value===(L==="disabled"?"ask":L))?.label,value:L==="disabled"?"ask":L,options:Or,disabled:x,onChange:N=>ue(N)}):null,I&&le?t.jsx(Mo,{busy:x,placement:A,state:I,onChange:le}):null,t.jsx("div",{className:"composer-spacer"}),t.jsxs("span",{className:`context-status-shell ${v.tone}`,style:m,children:[t.jsx("span",{className:`composer-status ${v.tone}`,role:v.maxTokens===null?"img":"meter","aria-label":v.tooltip,"aria-describedby":f,"aria-valuemin":v.maxTokens===null?void 0:0,"aria-valuemax":v.maxTokens??void 0,"aria-valuenow":v.maxTokens===null?void 0:v.usedTokens,tabIndex:0}),t.jsxs("span",{className:"context-status-tooltip",id:f,role:"tooltip",children:[t.jsx("span",{className:"context-status-tooltip-title",children:"Context window"}),t.jsxs("span",{className:"context-status-tooltip-main",children:[t.jsx("span",{children:v.summary}),t.jsx("span",{children:v.tokensLabel})]}),v.maxTokens!==null&&t.jsx("span",{className:"context-status-tooltip-bar","aria-hidden":"true",children:t.jsx("span",{})}),v.detail?t.jsx("span",{className:"context-status-tooltip-detail",children:v.detail}):null]})]}),t.jsx(Vr,{disabled:x,model:E,modelGroups:G,placement:A,provider:_,reasoningEffort:k,showReasoning:he,onModelSelectionChange:M,onProviderSetupOpen:pe,onReasoningEffortChange:re}),t.jsx(no,{buttonClassName:"composer-icon",connection:h,disabled:C,iconSize:16,wrapperClassName:"composer-voice-input",showToast:Y,onTranscript:w}),F?t.jsxs("button",{type:"button",className:"composer-queue-control",disabled:fe,"data-tooltip":$,"aria-label":"Queue steer draft",onClick:be,children:[t.jsx(tn,{size:13}),t.jsx("span",{children:"Queue"})]}):null,Ce?t.jsx("button",{type:"button",className:"send-button stop-button","data-tooltip":ae,"aria-label":ae,onClick:de,children:V==="pause"?t.jsx(Ba,{size:15}):t.jsx(Nr,{size:13,fill:"currentColor"})}):F?t.jsxs("button",{className:"send-button steer-button",disabled:Ne,"data-tooltip":"Steer","aria-label":"Steer",children:[t.jsx(Mr,{size:13}),t.jsx("span",{children:"Steer"})]}):t.jsx("button",{className:"send-button",disabled:Ne,"data-tooltip":z,"aria-label":z,children:t.jsx(Ur,{size:18})})]})}function ql({currentModelOptions:e,currentProvider:n,providerOptions:s,providerSettings:r}){return s.flatMap(a=>{if(a.value==="setup-provider")return[];const i=a.value,c=i===n?e:xo(i,r);return c.length>0?[{provider:i,label:a.label,defaultModel:Yo(i,r),options:c}]:[]})}function Hl(e){return e.description||e.path}function Vl({items:e,onSelect:n,onSelectIndex:s,skillIndex:r,style:a}){const i=o.useRef(null);return o.useEffect(()=>{i.current?.scrollIntoView({block:"nearest"})},[e.length,r]),t.jsx("div",{className:"composer-project-menu composer-slash-menu composer-skill-menu",role:"listbox","aria-label":"Available skills",style:a,children:e.length>0?e.map((c,u)=>{const x=u===r;return t.jsxs("button",{type:"button",className:`composer-project-option ${x?"selected":""}`,ref:x?i:void 0,role:"option","aria-selected":x,onMouseEnter:()=>s(u),onMouseDown:b=>{b.preventDefault(),n(c)},children:[t.jsx(sn,{size:14}),t.jsxs("span",{children:[t.jsx("strong",{children:Gs(c)}),t.jsx("small",{children:Hl(c)})]}),x?t.jsx(Ct,{size:14}):t.jsx("span",{"aria-hidden":"true"})]},c.name)}):t.jsx("div",{className:"composer-menu-empty",role:"option","aria-selected":"false",children:"No matching skills"})})}function Wl({actionCatalogCount:e,actionIndex:n,items:s,onSelect:r,onSelectIndex:a,style:i}){return t.jsx(Lr,{ariaLabel:"OpenPond agents and actions",menuIndex:n,sections:[{emptyLabel:e===0?"No matching commands or apps":"No matching commands, apps, agents, or actions",id:"slash",items:s.map(c=>({kind:"slash",item:c})),label:"/"}],style:i,variant:"typed",onSelect:c=>{c.kind==="slash"&&r(c.item)},onSelectIndex:a})}function Gl({busy:e,initialDescription:n,open:s,onClose:r,onSubmit:a}){const[i,c]=o.useState(""),[u,x]=o.useState(()=>n.trim()),b=i.trim(),k=u.trim(),h=e||!b||!k;if(o.useEffect(()=>{s&&(c(""),x(n.trim()))},[n,s]),o.useEffect(()=>{if(!s||e)return;function f(v){v.key==="Escape"&&r()}return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,r,s]),!s)return null;async function m(){if(h)return;await a({title:b,description:k})&&(c(""),x(""))}return t.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:e?void 0:r,children:t.jsxs("section",{className:"git-dialog submit-issue-dialog",role:"dialog","aria-modal":"true","aria-label":"Submit GitHub issue",onMouseDown:f=>f.stopPropagation(),onKeyDown:f=>{f.key!=="Enter"||!(f.target instanceof HTMLInputElement)||(f.preventDefault(),m())},children:[t.jsx("button",{className:"git-dialog-close",disabled:e,type:"button",onClick:r,children:t.jsx(Ws,{size:16})}),t.jsx("div",{className:"git-dialog-icon",children:t.jsx(ea,{size:18})}),t.jsx("h2",{children:"Submit issue"}),t.jsxs("div",{className:"git-dialog-row submit-issue-repo-row",children:[t.jsx("span",{children:"Repository"}),t.jsx("strong",{children:ta})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Title"}),t.jsx("input",{autoFocus:!0,disabled:e,placeholder:"Short issue title",value:i,onChange:f=>c(f.target.value)})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Description"}),t.jsx("textarea",{disabled:e,placeholder:"What happened, what you expected, and any useful context",value:u,onChange:f=>x(f.target.value)})]}),t.jsxs("div",{className:"git-dialog-footer",children:[t.jsx("button",{className:"git-dialog-secondary",disabled:e,type:"button",onClick:r,children:"Cancel"}),t.jsx("button",{className:"git-dialog-primary",disabled:h,type:"button",onClick:()=>{m()},children:"Submit issue"})]})]})})}const Kl=new Set(["c","cc","cpp","css","go","h","html","java","js","json","jsx","mdx","php","py","rb","rs","sh","sql","toml","ts","tsx","xml","yaml","yml"]),Ql=new Set(["csv","ods","tsv","xls","xlsm","xlsx"]),Xl=new Set(["7z","bz2","gz","rar","tar","tgz","xz","zip"]),Jl=new Set(["doc","docx","epub","md","odt","pdf","rtf","txt"]),Zl=new Set(["key","odp","ppt","pptx"]);function Po(e){const n=e.mediaType.toLowerCase(),s=e.name.split(".").pop()?.toLowerCase()??"";return e.kind==="image"||n.startsWith("image/")?"image":n.startsWith("audio/")?"audio":n.startsWith("video/")?"video":Ql.has(s)||n.includes("spreadsheet")||n.includes("excel")?"spreadsheet":Xl.has(s)||n.includes("zip")||n.includes("compressed")?"archive":Zl.has(s)||n.includes("presentation")||n.includes("powerpoint")?"presentation":Kl.has(s)?"code":e.kind==="text"||Jl.has(s)||n.startsWith("text/")||n==="application/pdf"||n.includes("document")||n.includes("msword")?"document":"file"}function Yl(e){if(e.mediaType.toLowerCase()==="application/pdf")return"PDF";const n=Po(e);return n==="spreadsheet"?"Spreadsheet":n.charAt(0).toUpperCase()+n.slice(1)}function ec(e){return`${e.toLocaleString()} ${e===1?"line":"lines"}`}const tc={archive:Za,audio:ui,code:qa,document:sn,file:Ua,image:xi,presentation:wi,spreadsheet:fi,video:hi};function nc({attachment:e,...n}){const s=tc[Po(e)];return t.jsx(s,{...n})}const sc=new Set(["csv","css","html","js","json","jsx","log","md","mdx","py","sql","svg","ts","tsx","txt","xml","yaml","yml"]),rc=2e3,oc=/^Pasted text(?: (\d+))?\.txt$/;function ac(e,n){if(e.length<rc)return null;const s=new Set;for(const i of n){const c=oc.exec(i.name);c&&s.add(c[1]?Number(c[1]):1)}let r=1;for(;s.has(r);)r+=1;const a=r===1?"Pasted text.txt":`Pasted text ${r}.txt`;return new File([e],a,{type:"text/plain"})}function ic({attachment:e,onRemove:n}){const[s,r]=o.useState(null);o.useEffect(()=>{if(e.kind!=="text")return;let i=!1;return e.file.text().then(c=>{i||r(Co(c))},()=>{}),()=>{i=!0}},[e.file,e.kind]);const a=e.kind!=="image";return t.jsxs("div",{className:`composer-attachment-card ${e.kind}`,children:[t.jsx("div",{className:"composer-attachment-thumb","aria-hidden":"true",children:e.previewUrl?t.jsx("img",{alt:"",decoding:"async",src:e.previewUrl}):t.jsx(nc,{attachment:e,size:22})}),a?t.jsxs("div",{className:"composer-attachment-meta",children:[t.jsx("strong",{children:e.name}),t.jsx("span",{children:e.kind==="text"&&s!==null?ec(s):Yl(e)})]}):null,t.jsx("button",{type:"button",className:"composer-attachment-remove","aria-label":`Remove ${e.name}`,onClick:n,children:t.jsx(Ws,{size:14})})]})}function lc(){return globalThis.crypto?.randomUUID?.()??`attachment-${Date.now()}-${Math.random().toString(36).slice(2)}`}function cc(e){if(e.type.startsWith("image/"))return"image";if(e.type.startsWith("text/"))return"text";const n=e.name.split(".").pop()?.toLowerCase()??"";return sc.has(n)?"text":"file"}async function uc(e){const[n,s]=await Promise.all([fc(e.file),e.kind==="text"?mc(e.file):Promise.resolve(void 0)]);return{id:e.id,name:e.name,mediaType:e.mediaType,sizeBytes:e.sizeBytes,kind:e.kind,...s!==void 0?{lineCount:Co(s)}:{},...e.relativePath?{relativePath:e.relativePath}:{},contentsBase64:n,...s?{text:hc(s)}:{}}}function dc(e){const n=["KB","MB","GB"];let s=e/1024;for(const r of n){if(s<1024)return`${s.toFixed(s>=10?0:1)} ${r}`;s/=1024}return`${s.toFixed(0)} TB`}function fc(e){return new Promise((n,s)=>{const r=new FileReader;r.onload=()=>{const a=typeof r.result=="string"?r.result:"",[,i=""]=a.split(",",2);n(i)},r.onerror=()=>s(r.error??new Error("Failed to read file")),r.readAsDataURL(e)})}function mc(e){return new Promise((n,s)=>{const r=new FileReader;r.onload=()=>n(typeof r.result=="string"?r.result:""),r.onerror=()=>s(r.error??new Error("Failed to read file")),r.readAsText(e)})}function hc(e){if(e.length<=Pt.maxTextChars)return e;const n=`
4
- [attachment text truncated]`;return`${e.slice(0,Math.max(0,Pt.maxTextChars-n.length))}${n}`}function pc(){const e=o.useRef([]),n=o.useRef([]),s=o.useRef(!1),[r,a]=o.useState([]),[i,c]=o.useState(null);o.useEffect(()=>{e.current=r},[r]),o.useEffect(()=>()=>{s.current=!0;for(const m of e.current)us(m);for(const m of n.current)us(m)},[]);const u=o.useCallback(m=>{if(m.length===0)return;const f=Math.max(0,Pt.maxAttachments-r.length),v=[];let C=0,A=0;for(const p of m){if(p.size>Pt.maxAttachmentBytes){C+=1;continue}if(v.length>=f){A+=1;continue}const E="webkitRelativePath"in p&&typeof p.webkitRelativePath=="string"&&p.webkitRelativePath.trim()?p.webkitRelativePath.trim():void 0;v.push({id:lc(),file:p,name:p.name||"Untitled file",mediaType:p.type||"application/octet-stream",sizeBytes:p.size,kind:cc(p),...E?{relativePath:E}:{},...p.type.startsWith("image/")?{previewUrl:URL.createObjectURL(p)}:{}})}if(v.length>0&&(a([...r,...v]),c(null)),C>0||A>0){const p=[];C>0&&p.push(`${C} file${C===1?"":"s"} exceeded ${dc(Pt.maxAttachmentBytes)}`),A>0&&p.push(`maximum ${Pt.maxAttachments} attachments`),c(p.join("; "))}},[r]),x=o.useCallback(m=>{a(f=>{const v=f.find(A=>A.id===m);v&&us(v);const C=f.filter(A=>A.id!==m);return C.length===0&&c(null),C})},[]),b=o.useCallback(()=>{for(const m of e.current)us(m);e.current=[],a([]),c(null)},[]),k=o.useCallback(()=>{const m=e.current;return m.length===0||(e.current=[],n.current=m,a([]),c(null)),m},[]),h=o.useCallback((m,f)=>{if(m.length===0)return;const v=new Set(m.map(C=>C.id));if(n.current=n.current.filter(C=>!v.has(C.id)),f==="restore"&&!s.current){a(C=>{const A=new Set(C.map(E=>E.id)),p=[...m.filter(E=>!A.has(E.id)),...C];return e.current=p,p});return}for(const C of m)us(C)},[]);return{attachmentError:i,attachments:r,addFiles:u,clearAttachments:b,removeAttachment:x,settleStagedAttachments:h,setAttachmentError:c,stageAttachmentsForSubmit:k}}function us(e){e.previewUrl&&URL.revokeObjectURL(e.previewUrl)}function xc(e,n){const s=e.slice(0,Math.max(0,Math.min(n,e.length))),r=/(?:^|\s)\/([a-zA-Z0-9_-]*)$/.exec(s);if(!r||typeof r.index!="number")return null;const a=r[0].lastIndexOf("/");if(a<0)return null;const i=r.index+a;return{end:s.length,query:(r[1]??"").toLowerCase(),start:i}}function bc(e,n,s=Pr){const r=e.slice(0,Math.max(0,Math.min(n,e.length))),a=/(?:^|\s)\/([a-z][a-z0-9_-]*)\s$/.exec(r);if(!a)return null;const i=s.find(u=>u.id===a[1]);if(!i)return null;const c=a[0].lastIndexOf("/");return c<0||typeof a.index!="number"?null:{command:i,end:r.length,start:a.index+c}}function gc(e,n=Pr){return sa({commands:n,prompt:`/${e}`})}function ro(e,n){return e.length===0?[]:e.filter(s=>n?[s.id,s.name??"",s.label??"",s.description??"",typeof s.implementation?.type=="string"?s.implementation.type:""].join(" ").toLowerCase().includes(n):!0)}function oo(e,n){return e.length===0?[]:e.filter(s=>n?[s.id,s.name,s.description??"",s.gitRepo??"",bo(s)].join(" ").toLowerCase().includes(n):!0).slice(0,8)}function ao({actionCatalog:e,connectedAppMentions:n,mentionApps:s,profileSkills:r,query:a,surface:i,teamMentionMembers:c}){const u=a.toLowerCase();if(i==="team"){const m=c.filter(v=>u?[v.name,v.handle??""].map(_n).some(C=>C.includes(u)):!0).map(v=>({kind:"team-member",member:v}));return[...zr(e,u,e.length).map(v=>({kind:"action",action:v})),...m]}const x=s.filter(m=>u?[_n(m.id),_n(m.name),m.gitRepo?_n(m.gitRepo):"",bo(m)].some(v=>v.includes(u)):!0).map(m=>({kind:"app",app:m})),b=zr(e,u,e.length).map(m=>({kind:"action",action:m})),k=Bs(r,u).map(m=>({kind:"skill",skill:m})),h=na(n,u).map(m=>({kind:"connected-app",app:m}));return[...b,...k,...x,...h]}function kc(e,n,s){const r=n?.trim();if(!r)return e;const a=Math.max(0,Math.min(s??0,e.length)),i=e.slice(0,a),c=e.slice(a),u=i&&!/\s$/.test(i)?" ":"",x=c&&!/^\s/.test(c)?" ":"";return`${i}${u}${r}${x}${c}`.replace(/\s+/g," ").trim()}function yc(e){const n=_n($r(e)||e.name||e.id);return n?`@${n}`:null}function vc(e){const n=e.trim();if(!n.startsWith("{")||!n.endsWith("}"))return e;try{const s=JSON.parse(n);if(!s||Array.isArray(s)||typeof s!="object")return e;const r=Object.entries(s).filter(([,a])=>a!=null&&a!=="").map(([a,i])=>`${Lo(a)}: ${Rr(a,i)}`);return r.length?r.join(" · "):e}catch{return e}}function Lo(e){const n=e.replace(/Id$/,"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replaceAll("_"," ").trim().toLowerCase();return n?`${n[0].toUpperCase()}${n.slice(1)}`:"Input"}function Rr(e,n){if(Array.isArray(n))return n.map(r=>Rr(e,r)).join(", ");if(n&&typeof n=="object")return Object.entries(n).map(([r,a])=>`${Lo(r)}: ${Rr(r,a)}`).join(" · ");const s=String(n);return/Id$/.test(e)&&/^[a-z0-9_-]+$/i.test(s)?s.split(/[-_]+/).filter(Boolean).map(r=>`${r[0].toUpperCase()}${r.slice(1)}`).join(" "):s}function jc({action:e,prompt:n,selectedActionMentionText:s,selectedInvocationPosition:r}){if(!e)return null;const a=s?.trim(),i=a?.startsWith("@")?a:yc(e);return i?kc(vc(n),i,r):null}function wc({attachmentCount:e,prompt:n,selectedAction:s,selectedCommand:r}){return!!(n.trim()||e>0||s||r)}const Sc=new Set(["openpond-agent-authoring","openpond-skill-authoring","openpond-taskset-authoring"]);function Cc({activeMentionKey:e,activeSkillKey:n,activeSlashKey:s,addMenuIndex:r,addMenuItems:a,addMenuOpen:i,addMenuPanelRef:c,addMenuRef:u,attachmentCount:x,composerRef:b,createImproveActive:k,goalRuntimeActive:h,inputRef:m,inputShellRef:f,mentionQuery:v,prompt:C,selectedActionId:A,selectAddMenuItem:p,setActionIndex:E,setActionMenuDismissedPrompt:S,setAddMenuIndex:L,setAddMenuOpen:j,setAddMenuQuery:I,setMentionMenuDismissedPrompt:D,setMentionIndex:re,setSkillIndex:ue,setSkillMenuDismissedPrompt:le,skillMatchCount:B,skillQuery:H,slashMatchCount:Q,slashQuery:pe,showActionMenu:be,showMentionMenu:de,showSkillMenu:y}){const[w,_]=o.useState({}),[U,oe]=o.useState({}),[fe,$]=o.useState({}),[Ce,Ne]=o.useState({});return o.useEffect(()=>{re(0)},[v]),o.useEffect(()=>{ue(0)},[B,H]),o.useEffect(()=>{E(0)},[Q,pe]),o.useEffect(()=>{const z=m.current?.element,Y=z?.parentElement;if(!z||!Y||typeof ResizeObserver>"u")return;const V=new ResizeObserver(()=>m.current?.resize());return V.observe(Y),()=>V.disconnect()},[]),o.useEffect(()=>{if(!i)return;function z(V){const ae=V.target,F=m.current?.element?.parentElement;!u.current?.contains(ae)&&!c.current?.contains(ae)&&!F?.contains(ae)&&(j(!1),I(""),D(e),S(s),le(n))}function Y(V){if(V.key==="Escape"){V.preventDefault(),j(!1),I(""),D(e),S(s),le(n);return}if(a.length!==0){if(V.key==="ArrowDown"){V.preventDefault(),L(ae=>(ae+1)%a.length);return}if(V.key==="ArrowUp"){V.preventDefault(),L(ae=>(ae-1+a.length)%a.length);return}if(V.key==="Home"){V.preventDefault(),L(0);return}if(V.key==="End"){V.preventDefault(),L(a.length-1);return}if(V.key==="Enter"){V.preventDefault();const ae=a[r]??a[0];ae&&p(ae)}}}return document.addEventListener("pointerdown",z),document.addEventListener("keydown",Y),()=>{document.removeEventListener("pointerdown",z),document.removeEventListener("keydown",Y)}},[e,n,s,r,a,i]),o.useLayoutEffect(()=>{if(!i)return;const z=f.current;if(!z)return;const Y=z;function V(){Ne(rl(Y))}return V(),window.addEventListener("resize",V),window.addEventListener("scroll",V,!0),()=>{window.removeEventListener("resize",V),window.removeEventListener("scroll",V,!0)}},[i,x,k,h]),o.useLayoutEffect(()=>{if(!be)return;const z=m.current?.element,Y=b.current;if(!z||!Y)return;const V=z,ae=Y;function F(){$(yr(V,ae))}return F(),window.addEventListener("resize",F),window.addEventListener("scroll",F,!0),()=>{window.removeEventListener("resize",F),window.removeEventListener("scroll",F,!0)}},[x,k,h,C,A,be]),o.useLayoutEffect(()=>{if(!y)return;const z=m.current?.element,Y=b.current;if(!z||!Y)return;const V=z,ae=Y;function F(){oe(yr(V,ae))}return F(),window.addEventListener("resize",F),window.addEventListener("scroll",F,!0),()=>{window.removeEventListener("resize",F),window.removeEventListener("scroll",F,!0)}},[x,k,h,C,A,y]),o.useLayoutEffect(()=>{if(!de)return;const z=m.current?.element,Y=b.current;if(!z||!Y)return;const V=z,ae=Y;function F(){_(yr(V,ae))}return F(),window.addEventListener("resize",F),window.addEventListener("scroll",F,!0),()=>{window.removeEventListener("resize",F),window.removeEventListener("scroll",F,!0)}},[x,k,h,C,A,de]),{actionMenuStyle:fe,addMenuStyle:Ce,mentionMenuStyle:w,skillMenuStyle:U}}const Mc=o.lazy(()=>je(()=>import("./ComposerCreateImproveStrip-B6BBqdaL.js"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url).then(e=>({default:e.ComposerCreateImproveStrip}))),Nc=[],Ec=Pr.find(e=>e.id==="submit-issue");function Ac({experience:e="development",mode:n,surface:s="chat",teamUseModel:r=!1,teamUseModelLocked:a=!1,teamMentionMembers:i=[],onTeamUseModelChange:c,prompt:u,composeNotice:x=null,mentionApps:b=[],connectedAppMentions:k=[],profileSkills:h=[],selectedMentionAppId:m=null,contextWindowStatus:f,goalRuntime:v=null,subagentRuntime:C=null,createImproveRuntime:A=null,busy:p,running:E=p,submissionScopeKey:S="default",initialSteerDrafts:L=Nc,steerAutoDispatchReady:j=!1,steerAutoDispatchBlocked:I=!1,showProjectFooter:D=!0,autoFocus:re=!1,focusRequestId:ue=0,attachmentRequest:le=null,connection:B,providerSettings:H=null,provider:Q,model:pe,projectTarget:be,profileTarget:de=null,actionCatalog:y=[],requestedAction:w=null,workspaceTarget:_,codexPermissionMode:U,codexReasoningEffort:oe,openPondCommandAccessMode:fe,onProviderChange:$,onProviderSetupOpen:Ce,onProjectTargetChange:Ne,onProfileTargetChange:z,onWorkspaceTargetChange:Y,onModelChange:V,onCodexPermissionModeChange:ae,onCodexReasoningEffortChange:F,onOpenPondCommandAccessModeChange:he,onPromptChange:G,onMentionAppSelect:st,showToast:M,onSubmit:N,onStop:ne,onPauseGoal:_e}){const ge=o.useRef(null),ze=o.useRef(null),ee=o.useRef(null),Ie=o.useRef(null),$e=o.useRef(null),Mt=o.useRef(null),Nt=o.useRef(null),rt=o.useRef(0),ot=w&&y.some(l=>l.id===w.actionId)?w:null,Et=o.useRef(!1),rn=o.useRef(0),Me=o.useRef(ot?.requestId??0),Pn=o.useRef(new Set),Be=o.useRef(E?new Set([S]):new Set),Ln=o.useRef(new Set),on=o.useRef(new Set),[me,xe]=o.useState(u.length),[Lt,an]=o.useState(0),[ps,ln]=o.useState(0),[xs,Ee]=o.useState(0),[bs,Dt]=o.useState(0),[bt,Je]=o.useState(""),[Ze,cn]=o.useState(null),[un,gt]=o.useState(null),[Qs,At]=o.useState(null),[Ae,kt]=o.useState(!1),[Ye,at]=o.useState(ot?.actionId??null),[dn,it]=o.useState(null),[yt,De]=o.useState(null),[Dn,lt]=o.useState(null),[On,fn]=o.useState(null),[zn,mn]=o.useState(!1),[hn,Fn]=o.useState(()=>({[S]:L})),[Ot,pn]=o.useState(null),[zt,Ue]=o.useState(null),[J,et]=o.useState(""),[gs,Bn]=o.useState(!1),[Xs,qe]=o.useState(""),[Fe,Tt]=o.useState(!1),{attachmentError:xn,attachments:Te,addFiles:vt,removeAttachment:Un,settleStagedAttachments:qn,setAttachmentError:Rt,stageAttachmentsForSubmit:Js}=pc(),Hn=o.useRef(0);o.useEffect(()=>{!le||Hn.current===le.id||(Hn.current=le.id,vt([le.file]))},[vt,le]);const ks=o.useCallback(l=>{const d=ac(l,Te);return!d||Te.length>=Pt.maxAttachments||d.size>Pt.maxAttachmentBytes?!1:(vt([d]),!0)},[vt,Te]),ys=s==="team"?"Message team":n==="start"?e==="chat"?"Ask anything":"What should we work on?":"Ask for follow-up changes",Ft=e==="development"||e==="work"&&be.value!=="none",Zs=ra(Q,pe,H),bn="top",vs=o.useId(),Ys=o.useId(),er=o.useId(),tr={"--context-fill":`${Math.round((f.percent??0)/100*360)}deg`,"--context-bar-fill":`${f.percent??0}%`},ke=o.useMemo(()=>y.find(l=>l.id===Ye)??null,[y,Ye]),ct=o.useMemo(()=>oa(Q,e),[e,Q]),Pe=o.useMemo(()=>Ft?h:h.filter(l=>!Sc.has(l.name)),[e,h]),ye=o.useMemo(()=>ct.find(l=>l.id===dn)??null,[ct,dn]),jt=jc({action:ke,prompt:u,selectedActionMentionText:Dn,selectedInvocationPosition:yt}),Bt=wc({attachmentCount:Te.length,prompt:u,selectedAction:ke,selectedCommand:ye}),js=o.useMemo(()=>{const l=Math.max(0,Math.min(yt??0,u.length));return ye?{icon:ye.id==="agent"?"plus":ye.id==="skill"?"skill":"workflow",key:`command:${ye.id}`,label:ye.id==="agent"?"Author Agent":ye.id,position:l,onRemove:()=>{it(null),De(null),lt(null)}}:ke?{icon:ke.implementation?.type==="openpond-agent"?"bot":"workflow",key:`action:${ke.id}`,label:$r(ke),position:l,onRemove:()=>{at(null),De(null),lt(null)}}:null},[u.length,ke,ye,yt]),ut=On===S,Ut=E&&Bt,ws=ut||!Bt,gn=ut?"Preparing files":Ut?"Steer":"Send",He=ut,nr=p||ut,Vn=!E||!u.trim()||Te.length>0||!!(ke||ye)||ut,sr=Te.length>0?"Queue supports text drafts":ke||ye?"Queue plain text drafts":u.trim()?"Queue steer draft":"Type a draft to queue";function kn(l=S){const d=Pn.current;return d.has(l)?!1:(d.add(l),!0)}function Wn(l){Pn.current.delete(l)}function yn(l){return Pn.current.has(l)}function Ss(){return yn(S)}function rr(l){fn(d=>d===l?null:d)}const or=o.useMemo(()=>{const l=aa(H,{enabledOnly:!0}).map(Z=>({...Z,description:void 0})),d=Ft?l:l.filter(Z=>Z.value!=="codex"),T=_.value==="cloud"&&Ft?d.filter(Z=>Z.value==="openpond"):d,P=T.some(Z=>Z.value===Q)?T:[{value:Q,label:ia(Q,H),description:"Current"},...T],O={value:"setup-provider",label:"New Model/Provider",icon:"plus",separatorBefore:!0};return[...P,O]},[Q,H,Ft,_.value]),vn=o.useMemo(()=>xo(Q,H),[Q,H]),ve=o.useMemo(()=>la(u,Math.min(me,u.length)),[me,u]),_t=ve?`${u}:${ve.start}:${Math.min(me,u.length)}`:null,tt=o.useMemo(()=>ve?ao({actionCatalog:y,connectedAppMentions:k,mentionApps:b,profileSkills:Pe,query:ve.query,surface:s,teamMentionMembers:i}):[],[y,k,b,ve,Pe,s,i]),dt=o.useMemo(()=>s==="team"?[]:ao({actionCatalog:y,connectedAppMentions:k,mentionApps:b,profileSkills:Pe,query:"",surface:s,teamMentionMembers:i}).filter(l=>l.kind!=="skill"),[y,k,b,Pe,s,i]),qt=!!(!Ae&&!He&&ve&&_t&&Ze!==_t&&tt.length>0),X=o.useMemo(()=>Si(u,Math.min(me,u.length)),[me,u]),jn=X?`${u}:${X.start}:${X.end}`:null,Ve=o.useMemo(()=>X?Bs(Pe,X.query):[],[X,Pe]),Gn=!!(!Ae&&!He&&X&&jn&&Qs!==jn),se=o.useMemo(()=>xc(u,Math.min(me,u.length)),[me,u]),wn=se?`${u}:${se.start}:${se.end}`:null,Cs=o.useMemo(()=>se?ro(y,se.query):[],[y,se]),Kn=o.useMemo(()=>se&&s!=="team"?oo(b,se.query):[],[se,b,s]),Ms=o.useMemo(()=>se&&s!=="team"?gc(se.query,ct):[],[se,ct,s]),Ns=o.useMemo(()=>se&&s!=="team"?Bs(Pe,se.query):[],[se,Pe,s]),We=o.useMemo(()=>[...Cs.map(l=>({kind:"action",action:l})),...Ns.map(l=>({kind:"skill",skill:l})),...Ms.map(l=>({kind:"command",command:l})),...Kn.map(l=>({kind:"app-context",app:l}))],[Cs,Kn,Ms,Ns]),ft=!!(!Ae&&!He&&se&&wn&&un!==wn),Es=o.useMemo(()=>ct.map(l=>({kind:"command",command:l})),[ct]),Qn=o.useMemo(()=>[...ro(y,"").map(l=>({kind:"action",action:l})),...oo(b,"").map(l=>({kind:"app-context",app:l}))],[y,b]),Ht=o.useMemo(()=>Bs(Pe,"").map(l=>({kind:"skill",skill:l})),[Pe]),Vt=o.useMemo(()=>{const l=[{id:"add",items:e==="work"?[{kind:"files"},{kind:"folder"}]:[{kind:"files"}],label:"Add"}];return Qn.length>0&&l.push({id:"slash",items:Qn.map(d=>({kind:"slash",item:d})),label:"Agents and actions",queryScope:"slash"}),Ht.length>0&&l.push({id:"skills",items:Ht.map(d=>({kind:"slash",item:d})),label:"Skills",queryScopes:["slash","mentions"]}),l.push({id:"openpond",items:Es.map(d=>({kind:"slash",item:d})),label:"OpenPond",grid:!0,queryScope:"slash"}),l.push({emptyLabel:"No mentions available",id:"mentions",items:dt.map(d=>({kind:"mention",item:d})),label:"@"}),l},[dt,Es,Ht,Qn,e]),Xn=o.useMemo(()=>Al(Vt,bt),[bt,Vt]),we=o.useMemo(()=>Xn.flatMap(l=>l.items),[Xn]);o.useEffect(()=>{Ae&&Dt(l=>l<we.length?l:0)},[we.length,Ae]);const It=!!v,Jn=It&&v?.tone==="active",ar=Jn?"Pause goal":"Stop response",As=Jn?"pause":"stop",ir=e==="work"||be.value!=="none",Oe=Ar(hn,S,L),Wt=Ot?.scopeKey===S?Ot.draftId:null,mt=o.useMemo(()=>Oe.find(l=>l.id===zt)??null,[zt,Oe]);function nt(l,d){Fn(T=>Di(T,l,d,l===S?L:[]))}o.useLayoutEffect(()=>{ee.current?.resize()},[Te.length,xn,A,v,u,Ye,dn,yt]),o.useEffect(()=>{if(!re){Et.current=!1;return}Et.current||He||(Et.current=!0,window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(u.length)}))},[re,He,u.length]),o.useEffect(()=>{!ue||rn.current===ue||He||(rn.current=ue,window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(u.length)}))},[ue,He,u.length]),o.useEffect(()=>{v||mn(!1)},[v]),o.useEffect(()=>{Ye&&!y.some(l=>l.id===Ye)&&(at(null),De(null))},[y,Ye]),o.useEffect(()=>{if(!w||w.requestId<=Me.current)return;const l=y.find(d=>d.id===w.actionId);l&&(Me.current=w.requestId,at(l.id),it(null),De(0),lt(null),G(""),xe(0),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(0,{afterToken:!0})}))},[y,G,w]),o.useEffect(()=>{!ke&&!ye||De(l=>l===null?0:Math.max(0,Math.min(l,u.length)))},[u.length,ke,ye]),o.useEffect(()=>{if(!m||!st)return;const l=b.find(d=>d.id===m);(!l||!ca(u,l))&&st(null)},[b,st,u,m]);const{actionMenuStyle:Ge,addMenuStyle:lr,mentionMenuStyle:Zn,skillMenuStyle:Yn}=Cc({activeMentionKey:_t,activeSkillKey:jn,activeSlashKey:wn,addMenuIndex:bs,addMenuItems:we,addMenuOpen:Ae,addMenuPanelRef:Nt,addMenuRef:Mt,attachmentCount:Te.length,composerRef:ge,createImproveActive:!!A,goalRuntimeActive:!!v,inputRef:ee,inputShellRef:ze,mentionQuery:ve?.query,prompt:u,selectedActionId:Ye,selectAddMenuItem:$s,setActionIndex:Ee,setActionMenuDismissedPrompt:gt,setAddMenuIndex:Dt,setAddMenuOpen:kt,setAddMenuQuery:Je,setMentionMenuDismissedPrompt:cn,setMentionIndex:an,setSkillIndex:ln,setSkillMenuDismissedPrompt:At,skillMatchCount:Ve.length,skillQuery:X?.query,slashMatchCount:We.length,slashQuery:se?.query,showActionMenu:ft,showMentionMenu:qt,showSkillMenu:Gn});function ht(){at(null),it(null),De(null),lt(null)}function Gt(l){qe(l.trim()),Bn(!0)}function es(){Fe||(Bn(!1),ht())}function cr(){ht(),G(""),xe(0)}async function ts(){const l=S;on.current.add(l);const d=await(Jn&&_e?_e():ne());return d===!1&&on.current.delete(l),d}function $t(l,d){const T=Math.max(0,Math.min(me,u.length)),P=d?Math.max(0,Math.min(d.start,u.length)):T,O=d?Math.max(P,Math.min(d.end,u.length)):P,Z=u.slice(0,P),Re=u.slice(O),wt=Z&&!/\s$/.test(Z)?" ":"",Zt=Re&&!/^\s/.test(Re)?" ":"",Yt=`${fa(l)} `,pt=`${wt}${Yt}${Zt}`,en=`${Z}${pt}${Re}`,Qe=Z.length+pt.length;return G(en),st?.(l.id),xe(Qe),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(Qe)}),Qe}function ns(l){if(!ve)return;const d=Math.max(0,Math.min(me,u.length));$t(l,{start:ve.start,end:d})}function Kt(l,d,T=null){const P=Math.max(0,Math.min(me,u.length)),O=d?Math.max(0,Math.min(d.start,u.length)):P,Z=d?Math.max(O,Math.min(d.end,u.length)):O,Re=`${u.slice(0,O)}${u.slice(Z)}`;return at(l.id),it(null),De(O),lt(T?.startsWith("@")?T:null),gt(null),G(Re),xe(O),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(O,{afterToken:!0})}),O}function Sn(l){if(!ve)return;const d=Math.max(0,Math.min(me,u.length)),T=Math.max(0,Math.min(ve.start,u.length)),P=Math.max(T,Math.min(d,u.length));Kt(l,{start:T,end:P},u.slice(T,P).trim())}function Cn(l,d){const T=Math.max(0,Math.min(me,u.length)),P=d?Math.max(0,Math.min(d.start,u.length)):T,O=d?Math.max(P,Math.min(d.end,u.length)):P,Z=u.slice(0,P),Re=u.slice(O),wt=Z&&!/\s$/.test(Z)?" ":"",Zt=Re&&!/^\s/.test(Re)?" ":"",Yt=`${ma(l)} `,pt=`${wt}${Yt}${Zt}`,en=`${Z}${pt}${Re}`,Qe=Z.length+pt.length;return G(en),xe(Qe),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(Qe)}),Qe}function Ts(l){if(!ve)return;const d=Math.max(0,Math.min(me,u.length));Cn(l,{start:ve.start,end:d})}function Qt(l,d){const T=Math.max(0,Math.min(me,u.length)),P=d?Math.max(0,Math.min(d.start,u.length)):T,O=d?Math.max(P,Math.min(d.end,u.length)):P,Z=l.handle||_n(l.name),Re=u.slice(0,P),wt=u.slice(O),Zt=Re&&!/\s$/.test(Re)?" ":"",Yt=wt&&!/^\s/.test(wt)?" ":"",pt=`${Zt}@${Z} ${Yt}`,en=`${Re}${pt}${wt}`,Qe=Re.length+pt.length;return G(en),xe(Qe),window.requestAnimationFrame(()=>ee.current?.focusAtPromptIndex(Qe)),Qe}function ss(l){if(l.kind==="team-member"){if(!ve)return;const d=Math.max(0,Math.min(me,u.length));Qt(l.member,{start:ve.start,end:d});return}if(l.kind==="app"){ns(l.app);return}if(l.kind==="connected-app"){Ts(l.app);return}if(l.kind==="skill"){if(!ve)return;const d=Math.max(0,Math.min(me,u.length));Xt(l.skill,{start:ve.start,end:d});return}Sn(l.action)}function rs(l){se&&(gt(null),$t(l,{start:se.start,end:se.end}))}function Rs(l){se&&Kt(l,se)}function os(l,d){const T=Math.max(0,Math.min(me,u.length)),P=d?Math.max(0,Math.min(d.start,u.length)):T,O=d?Math.max(P,Math.min(d.end,u.length)):P,Z=`${u.slice(0,P)}${u.slice(O)}`;return it(l.id),at(null),De(P),lt(null),gt(null),G(Z),xe(P),l.id==="submit-issue"&&Gt(Z),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(P,{afterToken:!0})}),P}function as(l){se&&os(l,se)}function Mn(l){if(l.kind==="command"){as(l.command);return}if(l.kind==="app-context"){rs(l.app);return}if(l.kind==="skill"){if(!se)return;Xt(l.skill,se);return}Rs(l.action)}function Xt(l,d){const T=Ci(u,d,l);return At(null),cn(null),gt(null),G(T.value),xe(T.cursor),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(T.cursor)}),T.cursor}function is(l){X&&Xt(l,X)}function ls(){Ie.current?.click()}function _s(){$e.current?.click()}function Ke(l){rt.current=l,Je(""),Dt(0)}function Is(){const l=Math.max(0,Math.min(me,u.length)),d=Math.max(0,Math.min(rt.current,u.length));return l>=d?{start:d,end:l}:{start:l,end:l}}function $s(l){const d=Is();if(kt(!1),Je(""),l.kind==="files"||l.kind==="folder"){if(d.start!==d.end){const T=`${u.slice(0,d.start)}${u.slice(d.end)}`;G(T),xe(d.start)}Ke(d.start),l.kind==="folder"?_s():ls();return}if(l.kind==="slash"){if(l.item.kind==="command"){Ke(os(l.item.command,d));return}if(l.item.kind==="app-context"){Ke($t(l.item.app,d));return}if(l.item.kind==="skill"){Ke(Xt(l.item.skill,d));return}Ke(Kt(l.item.action,d));return}if(l.item.kind==="team-member"){Ke(Qt(l.item.member,d));return}if(l.item.kind==="app"){Ke($t(l.item.app,d));return}if(l.item.kind==="connected-app"){Ke(Cn(l.item.app,d));return}if(l.item.kind==="skill"){Ke(Xt(l.item.skill,d));return}Ke(Kt(l.item.action,d))}function ur(){const l=u.trim();if(!l||Vn)return;nt(S,T=>[...T,$i(l)]),cr(),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(0)})}async function Ps(l,d="manual"){const T=S;if(yn(T)||Ot?.scopeKey===T)return!1;const P=Ar(hn,T,L).find(O=>O.id===l);if(!P||!kn(T))return!1;pn({draftId:l,scopeKey:T}),Rt(null);try{if(E&&await ne()===!1)return!1;const O=await N([],null,null,{preservePrompt:!0,promptOverride:P.prompt});return O&&d==="auto"&&Ln.current.add(T),nt(T,Z=>Li(Z,l,O)),O}catch(O){return Rt(O instanceof Error?O.message:String(O)),!1}finally{Wn(T),pn(O=>O?.scopeKey===T&&O.draftId===l?null:O)}}function Ls(l){Wt!==l&&(zt===l&&(Ue(null),et("")),nt(S,d=>qs(d,l)))}function dr(l){if(Oi({attachmentCount:Te.length,hasSelectedAction:!!Ye,hasSelectedCommand:!!dn,prompt:u})==="load_composer"){nt(S,T=>qs(T,l.id)),G(l.prompt),xe(l.prompt.length),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(l.prompt.length)});return}Ue(l.id),et(l.prompt)}function cs(){Ue(null),et("")}function fr(){!mt||!J.trim()||(nt(S,l=>Pi(l,mt.id,J.trim())),cs())}function mr(){if(!mt||!J.trim())return;const l=J.trim();nt(S,d=>qs(d,mt.id)),cs(),G(l),xe(l.length),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(l.length)})}async function Jt(){if(Ss())return;const l=ke||ye?null:go(u);if(ye?.id==="submit-issue"||l?.command==="submit-issue"){Gt(l?.command==="submit-issue"?l.args:u);return}if(ws)return;const d=S;if(kn(d)){kt(!1),Rt(null);try{if(E&&await ne()===!1)return;const T=Js();try{fn(T.length>0?d:null);let P;try{P=await Promise.all(T.map(uc))}finally{rr(d)}const O=ke&&jt&&!u.trim()?jt:void 0,Z=await N(P,ke,ye,jt||O?{...jt?{displayPrompt:jt}:{},...O?{promptOverride:O}:{}}:void 0);qn(T,Z?"dispose":"restore"),Z&&!da(ke)&&ht()}catch(P){throw qn(T,"restore"),P}}catch(T){Rt(T instanceof Error?T.message:String(T))}finally{Wn(d),rr(d)}}}async function Nn(l){if(Ss()||Fe)return!1;const d=S;if(!kn(d))return!1;Tt(!0),kt(!1),Rt(null);try{if(E&&await ne()===!1)return!1;const T=await N([],null,Ec,{displayPrompt:`/submit-issue ${l.title.trim()}`,promptOverride:ua(l)});return T&&(Bn(!1),ht()),T}catch(T){return Rt(T instanceof Error?T.message:String(T)),!1}finally{Wn(d),Tt(!1)}}o.useEffect(()=>{const l=S;if(E){Ln.current.delete(l),Be.current.add(l);return}if(on.current.has(l)||I){on.current.delete(l),Be.current.delete(l);return}const d=Be.current.has(l);if(d&&!j)return;const T=zi({autoDispatchReady:j&&!A,hasQueuedDrafts:Oe.length>0,running:E,sending:!!Wt||yn(l),waitingForStartedTurn:Ln.current.has(l),wasRunning:d});if(Be.current.delete(l),!T)return;const P=Oe[0];P&&Ps(P.id,"auto")},[A,E,Wt,I,j,Oe,S]);function En(l){const T=Mi(u,l,me);G(T.value),xe(T.cursorIndex),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(T.cursorIndex)})}return t.jsxs("form",{ref:ge,className:`composer ${n} ${A?"has-create-runtime":""} ${It?"has-goal-runtime":""} ${Ut?"is-steering":""} ${Te.length>0?"has-attachments":""} ${ke||ye?"has-selected-action":""} ${xn?"has-attachment-error":""} ${Ae?"has-add-menu":""}`,onSubmit:l=>{l.preventDefault(),Jt()},children:[t.jsx("input",{webkitdirectory:"",ref:$e,className:"composer-file-input",type:"file",multiple:!0,tabIndex:-1,onChange:l=>{vt(Array.from(l.currentTarget.files??[])),l.currentTarget.value=""}}),qt&&t.jsx(_l,{items:tt,mentionIndex:Lt,onSelect:ss,onSelectIndex:an,style:Zn}),Gn&&t.jsx(Vl,{items:Ve,onSelect:is,onSelectIndex:ln,skillIndex:ps,style:Yn}),ft&&t.jsx(Wl,{actionCatalogCount:y.length,actionIndex:xs,items:We,onSelect:Mn,onSelectIndex:Ee,style:Ge}),t.jsx(Gl,{busy:Fe,initialDescription:Xs,open:gs,onClose:es,onSubmit:Nn}),D&&t.jsxs("div",{className:"composer-footer",children:[D?t.jsx(Ei,{busy:p||be.busy,placement:bn,state:be,onChange:Ne}):null,de&&z?t.jsx(Mo,{busy:p,placement:bn,state:de,onChange:z}):null,ir?t.jsx(Ai,{busy:p,placement:bn,state:_,onChange:Y}):null]}),!D&&e==="work"&&t.jsx(Ti,{project:be,workspace:_}),A?t.jsx(o.Suspense,{fallback:null,children:t.jsx(Mc,{runtime:A})}):null,t.jsx(Fi,{drafts:Oe,editDraftValue:J,editingDraft:mt,sendingDraftId:Wt,onCancelEdit:cs,onDeleteDraft:Ls,onEditDraft:dr,onEditDraftValueChange:et,onReplaceComposerDraft:mr,onSaveQueuedDraft:fr,onSteerDraft:l=>{Ps(l)}}),It&&v&&t.jsx(_i,{detailsOpen:zn,goalRuntime:v,objectiveId:er,subagentRuntime:C,onToggleDetails:()=>mn(l=>!l)}),x&&t.jsx("div",{className:`composer-notice ${x.tone}`,role:"status",children:x.message}),t.jsxs("div",{className:"composer-input-shell",ref:ze,children:[Ae&&s!=="team"&&t.jsx(Lr,{id:vs,ariaLabel:"Add to message",className:"composer-add-command-menu",menuIndex:bs,menuRef:Nt,sections:Xn,style:lr,variant:"add",onSelect:$s,onSelectIndex:Dt}),Te.length>0&&t.jsx("div",{className:"composer-attachments","aria-label":"Selected attachments",children:Te.map(l=>t.jsx(ic,{attachment:l,onRemove:()=>Un(l.id)},l.id))}),xn&&t.jsx("div",{className:"composer-attachment-error",role:"status",children:xn}),t.jsx("div",{className:"composer-textarea-frame",onClick:l=>{l.target===l.currentTarget&&ee.current?.focusAtPromptIndex(me)},children:t.jsx(yl,{ref:ee,connectedAppMentions:k,disabled:He,onCursorChange:xe,onKeyDown:l=>{if(Ae&&["ArrowDown","ArrowUp","Home","End","Enter","Escape"].includes(l.key)){l.preventDefault();return}if(qt){if(l.key==="ArrowDown"){l.preventDefault(),an(d=>(d+1)%tt.length);return}if(l.key==="ArrowUp"){l.preventDefault(),an(d=>(d-1+tt.length)%tt.length);return}if(l.key==="Enter"||l.key==="Tab"){l.preventDefault(),ss(tt[Lt]??tt[0]);return}if(l.key==="Escape"){l.preventDefault(),cn(_t);return}}if(Gn){if(Ve.length>0&&l.key==="ArrowDown"){l.preventDefault(),ln(d=>(d+1)%Ve.length);return}if(Ve.length>0&&l.key==="ArrowUp"){l.preventDefault(),ln(d=>(d-1+Ve.length)%Ve.length);return}if(Ve.length>0&&(l.key==="Enter"||l.key==="Tab")){l.preventDefault(),is(Ve[ps]??Ve[0]);return}if(l.key==="Escape"){l.preventDefault(),At(jn??u);return}}if(ft){if(We.length>0&&l.key==="ArrowDown"){l.preventDefault(),Ee(d=>(d+1)%We.length);return}if(We.length>0&&l.key==="ArrowUp"){l.preventDefault(),Ee(d=>(d-1+We.length)%We.length);return}if(We.length>0&&(l.key==="Enter"||l.key==="Tab")){l.preventDefault(),Mn(We[xs]??We[0]);return}if(l.key==="Escape"){l.preventDefault(),gt(wn??u);return}}if((ke||ye)&&l.key==="Backspace"&&me===(yt??0)){l.preventDefault(),ht();return}l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),Bt&&!ut&&Jt())},onPasteFiles:vt,onPasteTextAsAttachment:ks,onPromptChange:(l,d)=>{if(Ae){const P=Math.max(0,Math.min(rt.current,l.length));d<P?(rt.current=d,Je("")):Je(l.slice(P,d))}const T=s==="team"?null:bc(l,d,ct);if(T){const P=`${l.slice(0,T.start)}${l.slice(T.end)}`,O=T.start;G(l),xe(d),window.requestAnimationFrame(()=>{it(T.command.id),at(null),De(O),gt(null),G(P),xe(O),T.command.id==="submit-issue"&&Gt(P),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(O,{afterToken:!0})})});return}G(l)},onTokenPositionChange:l=>{if(!(!ke&&!ye)){if(l===null){ht();return}De(l)}},placeholder:ys,prompt:u,token:js})}),t.jsx(Ul,{surface:s,teamUseModel:r,teamUseModelLocked:a,onTeamUseModelChange:c,addFiles:vt,addMenuId:vs,addMenuOpen:Ae,addMenuRef:Mt,busy:p,codexPermissionMode:U,codexReasoningEffort:oe,connection:B,contextStatusStyle:tr,contextStatusTooltipId:Ys,contextWindowStatus:f,disabled:nr,dropdownPlacement:bn,fileInputRef:Ie,modelValue:Zs,modelOptions:vn,openPondCommandAccessMode:fe,showCommandAccess:Ft,profileTarget:D?null:de,onCodexPermissionModeChange:ae,onCodexReasoningEffortChange:F,onOpenPondCommandAccessModeChange:he,onProfileTargetChange:z,onModelChange:V,onOpenFilePicker:ls,onProviderChange:$,onProviderSetupOpen:Ce,onQueueDraft:ur,onStop:ts,onToggleAddMenu:()=>{const l=Math.max(0,Math.min(me,u.length));Ae||(rt.current=l,Je(""),Dt(0),kt(!0)),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(l)})},onTranscript:En,provider:Q,providerSettings:H,providerOptions:or,queueDraftDisabled:Vn,queueDraftTooltip:sr,running:E&&!Bt,sendDisabled:ws,sendTooltip:gn,showToast:M,stopIcon:As,stopLabel:ar,steering:Ut})]})]})}const io=o.memo(function({draftStore:n,...s}){const r=ha(n);return t.jsx(pa,{id:"composer",children:t.jsx(Ac,{...s,prompt:r,onPromptChange:n.set})})});function lo({approval:e,onResolve:n}){const[s,r]=o.useState(null);if(o.useEffect(()=>{r(null)},[e?.id]),!e||e.kind==="create_plan")return null;const a=Tc(e.detail),i=e.kind!=="subagent_patch_apply";async function c(u){if(!(!e||s)){r(u);try{await n(e.id,u)}catch{r(null)}}}return t.jsx("div",{className:"approval-request-shell",role:"status","aria-live":"polite",children:t.jsxs("section",{className:"approval-request-card","aria-label":`${co(e.kind)} approval request`,children:[t.jsxs("div",{className:"approval-request-copy",children:[t.jsx("div",{className:"approval-request-header",children:t.jsx("span",{children:co(e.kind)})}),t.jsx("code",{className:"approval-request-title",title:e.title,children:e.title}),a&&a!==e.title&&t.jsxs("details",{className:"approval-request-details",children:[t.jsx("summary",{children:"Details"}),t.jsx("pre",{children:a})]})]}),t.jsxs("div",{className:"approval-request-actions",children:[t.jsxs("button",{type:"button",className:"approval-action primary",disabled:!!s,onClick:()=>{c("accept")},children:[t.jsx(Ct,{size:14}),t.jsx("span",{children:s==="accept"?"Approving":"Approve"})]}),i?t.jsxs("button",{type:"button",className:"approval-action",title:"Approve for the rest of this session",disabled:!!s,onClick:()=>{c("acceptForSession")},children:[t.jsx(ri,{size:14}),t.jsx("span",{children:s==="acceptForSession"?"Approving":"Session"})]}):null,t.jsxs("button",{type:"button",className:"approval-action muted",disabled:!!s,onClick:()=>{c("decline")},children:[t.jsx(ai,{size:14}),t.jsx("span",{children:s==="decline"?"Denying":"Deny"})]}),t.jsx("button",{type:"button",className:"approval-action icon-only",title:"Cancel task","aria-label":"Cancel task",disabled:!!s,onClick:()=>{c("cancel")},children:t.jsx(Ws,{size:15})})]})]})})}function co(e){return e==="create_plan"?"Plan review":e==="subagent_patch_apply"?"Subagent patch":e==="file_change"||e==="legacy_patch"?"File change":e==="permissions"?"Permissions":e==="user_input"?"Input needed":"Command"}function Tc(e){const n=e.trim();if(!n)return"";try{return JSON.stringify(JSON.parse(n),null,2)}catch{return n}}const Rc=/\.(?:m4v|mov|mp4|webm)$/i;function _c(e){return Rc.test(e.trim().split(/[?#]/,1)[0]??"")}function Ic(e,n){let s=e.trim();if(!s||!_c(s))return null;if(/^file:\/\//i.test(s))try{s=decodeURIComponent(new URL(s).pathname)}catch{s=s.replace(/^file:\/\//i,"")}if(/^\//.test(s)||/^[A-Za-z]:[\\/]/.test(s))return s;const r=n?.trim().replace(/[\\/]+$/,"");return r?`${r}/${s.replace(/^\.\//,"")}`:null}function $c(e,n={}){const s=Pc(e),r=e.map(a=>({id:`message:${a.id}`,type:"message",message:a,showFooter:a.id===s}));return n.showThinkingIndicator&&r.push({id:"thinking",type:"thinking"}),r}function Pc(e){for(let n=e.length-1;n>=0;n-=1){const s=e[n];if(s.role==="assistant")return s.id}return null}function Lc(e){const n=e[e.length-1];if(!n)return!0;if(n.role==="assistant"||n.role==="error"||n.role==="status_divider"&&n.statusState==="running")return!1;if(n.role==="activity_group"){if(n.traceState==="running")return!1;const s=n.activities?.[n.activities.length-1]??null;return s?.state!=="running"&&s?.state!=="pending"}return!0}function Dc(e){const n=[];if(e.localWorkspaceId&&n.push({value:"local",label:"Local"}),(e.sandboxSourceAvailable??!!e.sandboxWorkspaceId)&&n.push({value:"sandbox",label:"Sandbox"}),n.length===0)return{source:null,options:n};const s=new Set(n.map(a=>a.value));if(e.override&&s.has(e.override))return{source:e.override,options:n};const r=e.workspaceTarget==="local"?"local":"sandbox";return s.has(r)?{source:r,options:n}:{source:n[0].value,options:n}}const Oc=new Set(["create","edit","help","list"]);function zc(e,n,s=null){return Fc(e)}function Fc(e){const n=e.trim();if(!n)return"/skill";const[s=""]=n.split(/\s+/,1);return Oc.has(s.toLowerCase())?`/skill ${n}`:`/skill create ${n}`}async function Bc(e){const n=e.session?.currentProfile??null,s=e.session?await e.patchSession(e.session.id,e.ref):null;try{return{selected:await e.selectProfile(e.ref),session:s}}catch(r){if(s)try{await e.patchSession(s.id,n)}catch{}throw r}}const Uc=o.lazy(()=>je(()=>import("./TerminalOverlay-CteY7dSQ.js"),__vite__mapDeps([7,1,2,8]),import.meta.url).then(e=>({default:e.TerminalOverlay})));function qc({open:e,connection:n,scope:s,tabs:r,onTabsChange:a,cwd:i,appId:c,workspaceName:u,queuedCommand:x,onClose:b}){const[k,h]=o.useState(!1);return o.useEffect(()=>{e&&h(!0)},[e]),k?t.jsx(o.Suspense,{fallback:null,children:t.jsx(Uc,{open:e,connection:n,scope:s,tabs:r,onTabsChange:a,cwd:i,appId:c,workspaceName:u,queuedCommand:x,onClose:b})}):null}function Hc({expanded:e,terminalOpen:n,sideChatAvailable:s,onOpenBrowser:r,onOpenFiles:a,onOpenReview:i,onOpenSideChat:c,onOpenTrainingDraft:u,trainingDraftAvailable:x,onResizeStart:b,onToggleExpanded:k,onToggleTerminal:h}){const m=[{id:"review",label:"Review",meta:"Diffs",icon:Ha,onSelect:i},{id:"files",label:"Files",meta:"Workspace",icon:So,onSelect:a},{id:"browser",label:"Browser",meta:"Preview",icon:ba,onSelect:r},{id:"side-chat",label:"Side chat",meta:"Context",icon:ga,onSelect:c,disabled:!s},{id:"training-draft",label:"Task draft",meta:"Training",icon:yo,onSelect:u,disabled:!x},{id:"terminal",label:n?"Hide terminal":"Terminal",meta:"Shell",icon:po,onSelect:h}];return t.jsxs("aside",{className:`workspace-diff-panel right-sidebar-home-panel ${e?"expanded":""}`,"aria-label":"Right sidebar",children:[e?null:t.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize right sidebar",onPointerDown:b}),t.jsxs("div",{className:"workspace-diff-topbar right-sidebar-home-topbar",children:[t.jsx("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Right sidebar views",children:t.jsxs("button",{type:"button",className:"workspace-diff-tab active",role:"tab","aria-selected":!0,children:[t.jsx(xa,{size:14}),t.jsx("span",{children:"Workspace"})]})}),t.jsx("div",{className:"workspace-diff-toolbar-actions",children:t.jsx("button",{type:"button",className:"diff-icon-button",title:e?"Dock sidebar":"Expand sidebar","aria-label":e?"Dock sidebar":"Expand sidebar",onClick:k,children:e?t.jsx(jo,{size:14}):t.jsx(ko,{size:14})})})]}),t.jsx("div",{className:"right-sidebar-home-body",children:t.jsx("div",{className:"right-sidebar-home-actions",role:"menu","aria-label":"Workspace actions",children:m.map(f=>t.jsxs("button",{type:"button",className:"right-sidebar-home-row",role:"menuitem",disabled:f.disabled,onClick:f.onSelect,children:[t.jsx(f.icon,{size:15}),t.jsx("span",{children:f.label}),f.meta?t.jsx("span",{className:"right-sidebar-home-chip",children:f.meta}):null]},f.id))})})]})}function Vc({chatMessages:e,connection:n,contextWindowStatus:s,expanded:r,runtimeEvents:a,sessionId:i,showToast:c,onResizeStart:u,onToggleExpanded:x,onUseOutput:b,onHandoffOutput:k,onReviseOutput:h,onAgentPackageInstalled:m}){const[f,v]=o.useState("outputs"),[C,A]=o.useState(null),[p,E]=o.useState(null),[S,L]=o.useState(""),[j,I]=o.useState({}),D=o.useMemo(()=>Gc(a),[a]),re=o.useMemo(()=>Kc(D),[D]),ue=o.useMemo(()=>Wc(e),[e]),le=o.useMemo(()=>Qc(e),[e]);o.useEffect(()=>()=>{p?.objectUrl&&URL.revokeObjectURL(p.objectUrl)},[p?.objectUrl]);async function B(y){if(!n||!i||y.kind!=="file")return null;A(Xe(y));try{const w=await Se.workspaceTool(n,i,{action:"work_output_read",source:"ui_button",args:{outputId:y.id,revision:y.revision}});if(!w.ok)throw new Error(w.output);const _=Yc(w.data),U=typeof _.contentsBase64=="string"?_.contentsBase64:"";if(!U)throw new Error("The output did not include file data.");return new File([Jc(U)],y.title,{type:y.contentType})}catch(w){return c(w instanceof Error?w.message:"Could not load the output.","error"),null}finally{A(null)}}async function H(y){const w=await B(y);if(!w)return;p?.objectUrl&&URL.revokeObjectURL(p.objectUrl);const _=y.kind==="file"&&(y.contentType.startsWith("text/")||y.contentType==="application/json");L(""),E({output:y,file:w,text:_?await w.text():null,objectUrl:_?null:URL.createObjectURL(w)})}async function Q(y){const w=await B(y);w&&(b(w),c("Added the output to the task as input.","success"))}async function pe(y,w){const _=w.kind==="file"?await B(w):null;w.kind==="file"&&!_||await k(y,w,_)}async function be(y){if(!(!n||!i)&&window.confirm(`Delete ${y.title} revision ${y.revision} from this device?`)){A(Xe(y));try{const w=await Se.workspaceTool(n,i,{action:"work_output_delete",source:"ui_button",args:{outputId:y.id,revision:y.revision}});if(!w.ok)throw new Error(w.output);p?.output.id===y.id&&E(null),c("Work output deleted.","success")}catch(w){c(w instanceof Error?w.message:"Could not delete the output.","error")}finally{A(null)}}}async function de(y){if(!n||!i||!window.confirm(`Add ${y.title} version ${y.versionId} to your active Agents profile?`))return;const w=async _=>Se.workspaceTool(n,i,{action:"work_agent_package_install",source:"ui_button",args:{outputId:y.id,revision:y.revision,overwrite:_}});A(Xe(y));try{let _;try{_=await w(!1)}catch(U){if(!(U instanceof Error?U.message:"Agent installation failed.").includes("already exists")||!window.confirm(`${y.agentId} already exists. Replace its active checkout with this immutable version?`))throw U;_=await w(!0)}if(!_.ok)throw new Error(_.output);await m?.(),c(`${y.title} was added to Agents. Its package remains available in this Work task.`,"success")}catch(_){c(_ instanceof Error?_.message:"Could not add the Agent package.","error")}finally{A(null)}}return t.jsxs("aside",{className:`workspace-diff-panel work-sidebar-panel ${r?"expanded":""}`,"aria-label":"Work details",children:[r?null:t.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize Work details",onPointerDown:u}),t.jsxs("div",{className:"workspace-diff-topbar",children:[t.jsx("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Work details",children:[["outputs","Outputs"],["activity","Activity"],["context","Context"]].map(([y,w])=>t.jsx("button",{type:"button",className:`workspace-diff-tab ${f===y?"active":""}`,role:"tab","aria-selected":f===y,onClick:()=>v(y),children:w},y))}),t.jsx("div",{className:"workspace-diff-toolbar-actions",children:t.jsx("button",{type:"button",className:"diff-icon-button",title:r?"Dock sidebar":"Expand sidebar","aria-label":r?"Dock sidebar":"Expand sidebar",onClick:x,children:r?t.jsx(jo,{size:14}):t.jsx(ko,{size:14})})})]}),t.jsxs("div",{className:"work-sidebar-body",children:[f==="outputs"?p?t.jsxs("div",{className:"work-output-preview",children:[t.jsxs("header",{children:[t.jsx("button",{type:"button",onClick:()=>{p.objectUrl&&URL.revokeObjectURL(p.objectUrl),E(null)},children:"Outputs"}),t.jsxs("strong",{children:[p.output.title," · revision ",p.output.revision]})]}),p.text!==null?t.jsx(Va,{content:p.text}):p.output.kind==="file"&&p.output.contentType.startsWith("image/")&&p.objectUrl?t.jsx("img",{src:p.objectUrl,alt:p.output.title}):p.output.kind==="file"&&p.output.contentType==="application/pdf"&&p.objectUrl?t.jsx("iframe",{src:p.objectUrl,title:p.output.title}):p.output.kind==="file"&&p.output.contentType.startsWith("audio/")&&p.objectUrl?t.jsx("audio",{controls:!0,src:p.objectUrl}):p.output.kind==="file"&&p.output.contentType.startsWith("video/")&&p.objectUrl?t.jsx("video",{controls:!0,src:p.objectUrl}):t.jsx("p",{children:"This file type uses its native application for detailed review."}),t.jsxs("section",{className:"work-output-annotation",children:[t.jsx("label",{htmlFor:"work-output-revision-note",children:"Revision note"}),t.jsx("textarea",{id:"work-output-revision-note",value:S,onChange:y=>L(y.target.value),placeholder:"Describe the exact change to make in the next revision."}),t.jsx("button",{type:"button",disabled:!S.trim(),onClick:()=>{h(p.output,p.file,S.trim()),c(`Prepared revision ${p.output.revision+1}.`,"success")},children:"Revise this version"})]})]}):re.length>0?t.jsx("div",{className:"work-output-list",children:re.map(y=>{const w=y.revisions.find(_=>_.revision===j[y.id])??y.revisions[0];return t.jsxs("article",{className:"work-output-card",children:[t.jsxs("header",{children:[t.jsx(sn,{size:16}),t.jsxs("span",{children:[t.jsx("strong",{children:w.title}),y.revisions.length>1?t.jsxs("label",{className:"work-output-version",children:[t.jsx("span",{children:"Version"}),t.jsx("select",{value:w.revision,onChange:_=>I(U=>({...U,[y.id]:Number(_.target.value)})),children:y.revisions.map(_=>t.jsxs("option",{value:_.revision,children:["Revision ",_.revision]},Xe(_)))})]}):t.jsxs("small",{children:["Revision ",w.revision]}),t.jsx("small",{children:Xc(w)})]})]}),w.validation.length>0?t.jsxs("div",{className:"work-output-validation",children:[t.jsx(ka,{size:13}),t.jsxs("span",{children:[w.validation.filter(_=>_.status==="passed").length," ","checks passed"]})]}):null,t.jsxs("div",{className:"work-output-actions",children:[w.kind==="file"&&w.location.kind==="local"?t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",onClick:()=>{Wa(fo(w))},children:[t.jsx(So,{size:13}),"Reveal"]}),t.jsx("button",{type:"button",onClick:async()=>{const _=await Ga(fo(w),w.title);_.ok?c("Saved a copy of the Work output.","success"):_.canceled||c("Could not save a copy of the Work output.","error")},children:"Save as"})]}):null,w.kind==="file"?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",disabled:C===Xe(w),onClick:()=>{H(w)},children:"Preview"}),t.jsxs("button",{type:"button",disabled:C===Xe(w),onClick:()=>{Q(w)},children:[t.jsx(Hs,{size:13}),"Use as input"]})]}):w.kind==="agent_package"?t.jsx("button",{type:"button",disabled:C===Xe(w),onClick:()=>{de(w)},children:"Add to Agents"}):"url"in w&&w.url?t.jsx("button",{type:"button",onClick:()=>window.open(w.url,"_blank","noopener,noreferrer"),children:"Open"}):null,w.kind==="file"&&w.location.kind==="local"?t.jsxs("button",{type:"button",className:"danger",disabled:C===Xe(w),onClick:()=>{be(w)},children:[t.jsx(vo,{size:13}),"Delete"]}):null,t.jsx("button",{type:"button",disabled:C===Xe(w),onClick:()=>{pe("chat",w)},children:"Continue in Chat"}),t.jsx("button",{type:"button",disabled:C===Xe(w),onClick:()=>{pe("work",w)},children:"Continue in repository Work"})]})]},y.id)})}):t.jsx(uo,{icon:sn,title:"No saved outputs yet",detail:"Finished files and connected results will appear here."}):null,f==="activity"?ue.length>0?t.jsx("div",{className:"work-activity-list",children:ue.map(y=>t.jsxs("details",{className:`work-activity-row ${y.state??""}`,children:[t.jsxs("summary",{children:[t.jsx(Fr,{size:14}),t.jsx("span",{children:y.label}),t.jsx("small",{children:y.state??"completed"})]}),t.jsx("p",{children:y.content}),y.detail?t.jsx("pre",{children:y.detail}):null]},y.id))}):t.jsx(uo,{icon:Fr,title:"No activity yet",detail:"Commands, tool receipts, and checks appear while Work runs."}):null,f==="context"?t.jsxs("div",{className:"work-context",children:[t.jsxs("section",{children:[t.jsx("h3",{children:"Model context"}),t.jsx("p",{children:s.summary}),t.jsx("small",{children:s.tokensLabel})]}),t.jsxs("section",{children:[t.jsx("h3",{children:"Task inputs and sources"}),le.length>0?t.jsx("ul",{children:le.map(y=>t.jsxs("li",{children:[t.jsx(Hs,{size:13}),t.jsxs("span",{children:[t.jsx("strong",{children:y.title}),t.jsx("small",{children:y.detail})]})]},y.key))}):t.jsx("p",{children:"No attached files or cited sources yet."})]})]}):null]})]})}function Wc(e){return e.flatMap(n=>n.activities??[]).filter(n=>n.kind!=="reasoning").reverse()}function Gc(e){const n=new Map,s=new Set;for(const r of e){const a=_r(r.data);if(r.action==="work_output_delete"&&r.status==="completed"){for(const i of a){const c=Xe(i);s.add(c),n.delete(c)}continue}if(r.action!=="work_output_read")for(const i of a){const c=Xe(i);s.has(c)||n.set(c,i)}}return[...n.values()].sort((r,a)=>a.createdAt.localeCompare(r.createdAt)||a.revision-r.revision)}function Xe(e){return`${e.id}:${e.revision}`}function Kc(e){const n=new Map;for(const s of e){const r=n.get(s.id)??[];r.push(s),n.set(s.id,r)}return[...n.entries()].map(([s,r])=>({id:s,revisions:r.sort((a,i)=>i.revision-a.revision||i.createdAt.localeCompare(a.createdAt))})).sort((s,r)=>r.revisions[0].createdAt.localeCompare(s.revisions[0].createdAt))}function _r(e,n=[],s=new Set,r=0){if(r>8||e==null)return n;const a=ya.safeParse(e);if(a.success){const i=`${a.data.id}:${a.data.revision}`;return s.has(i)||(s.add(i),n.push(a.data)),n}if(Array.isArray(e)){for(const i of e)_r(i,n,s,r+1);return n}if(typeof e=="object")for(const i of Object.values(e))_r(i,n,s,r+1);return n}function Qc(e){const n=new Map;for(const s of e){for(const r of s.attachments??[])n.set(`attachment:${r.id}`,{key:`attachment:${r.id}`,title:r.name,detail:`${r.mediaType} · ${Do(r.sizeBytes)}`});for(const r of s.sources??[])n.set(`source:${r.id}`,{key:`source:${r.id}`,title:r.title,detail:r.sourceName??Zc(r.url)})}return[...n.values()]}function uo({icon:e,title:n,detail:s}){return t.jsxs("div",{className:"work-sidebar-empty",children:[t.jsx(e,{size:22}),t.jsx("strong",{children:n}),t.jsx("p",{children:s})]})}function Xc(e){return e.kind==="deployment"?"Deployment":e.kind==="source_change"?"Source change":e.kind==="external_resource"?e.provider:e.kind==="agent_package"?`${e.actions.length} action${e.actions.length===1?"":"s"}`:e.location.kind==="local"?Do(e.sizeBytes):e.location.kind==="managed"?"Managed file":e.location.provider}function Do(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Jc(e){const n=window.atob(e),s=new ArrayBuffer(n.length),r=new Uint8Array(s);for(let a=0;a<n.length;a+=1)r[a]=n.charCodeAt(a);return s}function fo(e){return e.kind==="file"&&e.location.kind==="local"?e.location.path:""}function Zc(e){try{return new URL(e).hostname||e}catch{return e}}function Yc(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}const eu=[{label:"Turn meeting notes into an executive report",prompt:"Turn my notes and attached source material into a polished report. Organize the key findings, identify missing information, and return a draft for my review.",icon:sn},{label:"Find trends and anomalies in a spreadsheet",prompt:"Analyze the attached spreadsheet. Check the calculations, summarize the most important findings, flag anomalies or missing data, and create a reviewable results file.",icon:yo},{label:"Compare options and recommend the best fit",prompt:"Research the best options for this decision. Compare the most important criteria, cite the sources, flag uncertainty, and return a recommendation with next steps.",icon:va},{label:"Build a presentation from source materials",prompt:"Create a concise presentation from my attached source material. Focus on the main themes and supporting evidence, separate findings from recommendations, and return a draft for my review.",icon:gi}];function tu({onSelect:e}){return t.jsx("div",{className:"work-starter-prompts","aria-label":"Work task examples",children:eu.map(({icon:n,label:s,prompt:r})=>t.jsxs("button",{type:"button",className:"work-starter-prompt",onClick:()=>e(r),children:[t.jsx(n,{size:15,"aria-hidden":"true"}),t.jsx("span",{children:s})]},s))})}function nu({value:e,onChange:n}){const s=(r,a)=>{let i;if(r.key==="Home")i=0;else if(r.key==="End")i=Tn.length-1;else if(r.key==="ArrowRight"||r.key==="ArrowDown")i=(a+1)%Tn.length;else if(r.key==="ArrowLeft"||r.key==="ArrowUp")i=(a-1+Tn.length)%Tn.length;else return;r.preventDefault();const c=Tn[i];if(!c)return;n(c.value),r.currentTarget.parentElement?.querySelectorAll(".new-experience-option")?.[i]?.focus()};return t.jsx("div",{className:"new-experience-switcher",role:"radiogroup","aria-label":"Choose task mode",children:Tn.map((r,a)=>{const i=r.value===e;return t.jsx("button",{type:"button",role:"radio","aria-checked":i,className:`new-experience-option ${i?"active":""}`,"data-experience":r.value,tabIndex:i?0:-1,onClick:()=>{i||n(r.value)},onKeyDown:c=>s(c,a),children:r.label},r.value)})})}function su(e,n){if(!e||!n)return null;const s=new Set(e.sources.filter(r=>r.sessionId===n).map(r=>r.id));return s.size?e.creations.find(r=>r.request.sourceIds.some(a=>s.has(a)))??null:null}function ru(e){const[n,s]=o.useState(null),[r,a]=o.useState(null),[i,c]=o.useState(!1),[u,x]=o.useState(null),[b,k]=o.useState(null),h=o.useRef(null),m=o.useRef(0),f=o.useCallback(async(p,E={})=>{if(!e){a(null),x("OpenPond App server is not connected.");return}const S=m.current+1;m.current=S,E.silent||c(!0),x(null);try{const L=await Se.getCreateImproveCandidateDiff(e,p.runId,p.candidateId),j=h.current;if(S!==m.current||j?.runId!==p.runId||j.candidateId!==p.candidateId)return;a(L)}catch(L){if(S!==m.current)return;x(L instanceof Error?L.message:String(L))}finally{S===m.current&&!E.silent&&c(!1)}},[e]),v=o.useCallback(p=>{const E=h.current;if(!(p&&E?.runId===p.runId&&E.candidateId===p.candidateId)){if(h.current=p,s(p),k(null),!p){m.current+=1,a(null),x(null),c(!1);return}a(S=>S?.appId===ou(p)?S:null),f(p)}},[f]),C=o.useCallback(async(p={})=>{const E=h.current;E&&await f(E,p)},[f]),A=o.useCallback(p=>{k({id:Date.now(),path:p})},[]);return o.useEffect(()=>{e||v(null)},[v,e]),{selection:n,diff:r,loading:i,error:u,openFileRequest:b,activate:v,refresh:C,openFile:A}}function ou(e){return`candidate:${e.runId}:${e.candidateId}`}function au(e){const{activeModel:n,activeProvider:s,bootstrap:r,codexPermissionMode:a,codexReasoningEffort:i,connection:c,onOpenRightChatForSession:u,onPayload:x}=e,b=o.useCallback(async m=>{if(!c||!r)throw new Error("OpenPond is still connecting.");const f=r.profile;if(f.mode!=="local"||!f.repoPath)throw new Error("A local Git-backed Profile is required to change an Agent.");const v=m.authoringModel??ja(s,n,r.providers);if(!v)throw new Error("Choose a model before changing an Agent.");const C=await Se.createSession(c,{provider:v.providerId,modelRef:v,systemKind:"openpond.lab",hiddenFromDefaultSidebar:!0,title:`${m.operation==="create"?"New":"Improve"} Agent · ${m.objective.slice(0,80)}`,cwd:f.repoPath,metadata:{source:m.operation==="create"?"lab_agent_create":"lab_agent_improve",profileId:f.activeProfile??"default",targetAgentId:m.agentId??null}}),A=m.objective.trim();if(!A)throw new Error(m.operation==="create"?"Describe what the Agent should do.":"Describe what the Agent could do better.");if(v.providerId==="codex")throw new Error("Agent authoring uses OpenPond's bundled authoring skill. Choose a hosted model.");const p=m.operation==="create"?`/agent create ${A}`:`/agent improve ${m.agentId??""} ${A}`,E=await Se.sendTurn(c,C.id,{prompt:p,model:v.modelId,modelRef:v,approvalPolicy:"never",sandbox:"workspace-write",codexPermissionMode:"default",codexReasoningEffort:i});if(E.status==="failed")throw new Error(E.error??"OpenPond could not complete the Agent authoring turn.");x(await Se.bootstrap(c)),u(C.id,C)},[n,s,r,a,i,c,u,x]),k=o.useCallback((m,f,v)=>b({objective:m,operation:"create",authoringRunId:f,authoringModel:v}),[b]),h=o.useCallback((m,f,v,C,A)=>b({agentId:m,agentName:v,objective:f,operation:"improve",authoringRunId:C,authoringModel:A}),[b]);return{createAgentFromLab:k,improveAgentFromLab:h}}const iu=72,jr=120,Oo=24,lu=280,cu=460;function Rn(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=iu}const Os={canGoPrevious:!1,canGoNext:!1};function zo(e){return Array.from(e.querySelectorAll(".message-row.user")).filter(n=>n.parentElement===e)}function uu({activeWorkspaceId:e,cloudProjects:n}){const s=n.find(i=>i.id===e),r=n.find(i=>i.organizationSlug||i.teamId),a=s??r??null;return{organizationSlug:a?.organizationSlug??null,teamId:a?.teamId??null}}function Ks(e,n){return n.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop}function Fo(e,n){return Ks(e,n)+n.getBoundingClientRect().height}function Bo(e){return e.scrollTop+Oo}function Uo(e){return e.scrollTop+8}function zs(e){const n=Bo(e),s=Uo(e);let r=!1,a=!1;for(const i of zo(e)){const c=Ks(e,i);if(Fo(e,i)<s&&(r=!0),c>n+8&&(a=!0),r&&a)break}return{canGoPrevious:r,canGoNext:a}}function du(e,n){const s=zo(e),r=Bo(e);if(n==="previous"){const a=Uo(e);for(let i=s.length-1;i>=0;i-=1){const c=s[i];if(Fo(e,c)<a)return c}return null}for(const a of s)if(Ks(e,a)>r+8)return a;return null}function fu(e){return Math.min(cu,Math.max(lu,Math.abs(e)/5))}function mu(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function hu(e){const n=wa({messages:e});return n?{run:n}:null}function mo(e){return e.command==="agent"?e.args?`/agent ${e.args}`:"/agent":e.command==="skill"?e.args?`/skill ${e.args}`:"/skill":e.args?`/${e.command} ${e.args}`:`/${e.command}`}function wr(e,n){return{surface:"chat",workflowKind:"slash_command",commandName:`/${e.command}`,commandSource:n}}function pu(e){return e.command==="goal"||e.command==="agent"||e.command==="skill"||e.command==="sync-cloud"}function xu(e){const n=e?.trim()??"";return/^[a-z0-9]{24}$/.test(n)?n:null}function bu({busy:e,handoff:n,onDismiss:s,onSelectTask:r}){const a=Sa(n),i=n.selectedTaskIndex+1;return t.jsxs("section",{className:"training-chat-handoff","aria-label":"Model chat",children:[t.jsxs("div",{className:"training-chat-handoff-copy",children:[t.jsx("strong",{children:a?"Generated Taskset question":"Model chat"}),t.jsx("span",{children:n.tasksetName}),t.jsx("small",{children:a?`${gu(a.split)} · ${i} of ${n.tasks.length} · New chat per question`:"Ask the imported model directly"})]}),t.jsxs("div",{className:"training-chat-handoff-actions",children:[a?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button","aria-label":"Previous generated question",title:"Previous question",disabled:e||n.selectedTaskIndex===0,onClick:()=>r(n.selectedTaskIndex-1),children:t.jsx(In,{size:14})}),t.jsx("button",{type:"button",className:"training-chat-handoff-load",disabled:e,onClick:()=>r(n.selectedTaskIndex),children:"Load question"}),t.jsx("button",{type:"button","aria-label":"Next generated question",title:"Next question",disabled:e||n.selectedTaskIndex>=n.tasks.length-1,onClick:()=>r(n.selectedTaskIndex+1),children:t.jsx(wo,{size:14})})]}):null,t.jsx("button",{type:"button","aria-label":"Close generated question handoff",title:"Close",disabled:e,onClick:s,children:t.jsx(Ws,{size:14})})]})]})}function gu(e){return e==="frozen_eval"?"Frozen evaluation":e==="validation"?"Validation":"Training"}function ku({activeModel:e,activeProvider:n,busy:s,handoff:r,onDismiss:a,onSelectTask:i}){return!r||r.model.providerId!==n||r.model.modelId!==e?null:t.jsx(bu,{busy:s,handoff:r,onDismiss:a,onSelectTask:i})}function yu({canGoNext:e,canGoPrevious:n,onJumpToLatest:s,onNext:r,onPrevious:a}){return t.jsxs("div",{className:"chat-scroll-controls","aria-label":"Message navigation",children:[t.jsx("button",{type:"button",className:"chat-scroll-control-button","data-tooltip":"Go to previous message","aria-label":"Go to previous message","aria-disabled":!n,onClick:a,children:t.jsx(In,{size:17})}),t.jsx("button",{type:"button",className:"chat-scroll-control-button primary","data-tooltip":"Jump to latest","aria-label":"Jump to latest",onClick:s,children:t.jsx(ei,{size:18})}),t.jsx("button",{type:"button",className:"chat-scroll-control-button","data-tooltip":"Go to next message","aria-label":"Go to next message","aria-disabled":!e,onClick:r,children:t.jsx(wo,{size:17})})]})}function vu({busy:e,onSync:n}){return t.jsxs("button",{type:"button",className:"sync-local-button",disabled:e,onClick:n,children:[t.jsx(li,{size:15}),t.jsx("span",{children:e?"Syncing locally":"Sync locally to work on this"})]})}function qo(e){return e.supportedView&&e.open&&!e.hasContentPanel}function ju(e,n){return e==="team"?"team-active":e==="community"?"community-active":e==="apps"||e==="get-started"||e==="labs"||e==="outputs"||e==="scheduled"?"page-active":n?"chat-active":"chat-start"}function wu({browserConversationId:e,chatHistoryHasMore:n,chatHistoryLoading:s,chatMessages:r,onLoadMoreChatHistory:a,pendingApproval:i,showChatThread:c,showThinkingIndicator:u,view:x}){const b=o.useRef(null),k=o.useRef(null),h=o.useRef(!0),m=o.useRef(null),f=o.useRef(null),v=o.useRef(!1),C=o.useRef(!1),A=o.useRef(!1),p=o.useRef(null),E=o.useRef(null),[S,L]=o.useState(0),[j,I]=o.useState(null),[D,re]=o.useState(!1),[ue,le]=o.useState(132),[B,H]=o.useState(Os),Q=o.useMemo(()=>$c(r,{showThinkingIndicator:u}),[r,u]),pe=o.useMemo(()=>({"--chat-composer-reserve":`${ue}px`}),[ue]),be=r.at(-1),de=[Q.length,be?.id??"",be?.content?.length??0,be?.timestamp??"",u?"thinking":""].join(":"),y=n,w=e,_=x==="chat"&&c&&!!w&&j!==w,U=o.useCallback(M=>{re(N=>N===M?N:M)},[]),oe=o.useCallback(M=>{H(N=>N.canGoPrevious===M.canGoPrevious&&N.canGoNext===M.canGoNext?N:M)},[]),fe=o.useCallback((M,N={})=>{const ne=N.nearBottom??Rn(M);U(!ne),oe(zs(M))},[U,oe]),$=o.useCallback(M=>{const N=C.current;C.current=!1,I(M),U(!1),oe(Os),N&&L(ne=>ne+1)},[U,oe]),Ce=o.useCallback(()=>{E.current===null||typeof window>"u"||(window.cancelAnimationFrame(E.current),E.current=null)},[]),Ne=o.useCallback((M,N,ne)=>{Ce();const _e=Math.max(0,M.scrollHeight-M.clientHeight),ge=()=>{const ot=typeof N=="function"?N():N;return Math.max(0,Math.min(ot,Math.max(0,M.scrollHeight-M.clientHeight)))},ze=Math.max(0,Math.min(ge(),_e)),ee=M.scrollTop,Ie=ze-ee;if(typeof window>"u"||window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0||Math.abs(Ie)<1){M.scrollTop=ze,ne?.();return}const Mt=fu(Ie),Nt=window.performance.now(),rt=ot=>{if(b.current!==M){E.current=null;return}const Et=Math.min(1,(ot-Nt)/Mt),rn=ge();if(M.scrollTop=ee+(rn-ee)*mu(Et),Et<1){E.current=window.requestAnimationFrame(rt);return}M.scrollTop=ge(),E.current=null,ne?.()};E.current=window.requestAnimationFrame(rt)},[Ce]),z=o.useCallback(()=>{A.current=!1,!(p.current===null||typeof window>"u")&&(window.cancelAnimationFrame(p.current),p.current=null)},[]),Y=o.useCallback((M,N={})=>{if(M.scrollTop=M.scrollHeight,typeof window>"u"){N.finishInitial&&$(N.conversationKey??null);return}z(),A.current=!0;let _e=0,ge=0,ze=M.scrollHeight;const ee=N.settle?12:2,Ie=()=>{const $e=b.current;if(!$e){p.current=null,A.current=!1,N.finishInitial&&$(N.conversationKey??null);return}$e.scrollTop=$e.scrollHeight;const Mt=$e.scrollHeight-$e.scrollTop-$e.clientHeight,Nt=Math.abs($e.scrollHeight-ze)<=1;if(ze=$e.scrollHeight,ge=Mt<=1&&Nt?ge+1:0,_e+=1,_e<ee&&ge<2){p.current=window.requestAnimationFrame(Ie);return}p.current=null,A.current=!1,h.current=!0,U(!1),oe(zs($e)),N.finishInitial&&$(N.conversationKey??null)};p.current=window.requestAnimationFrame(Ie)},[z,$,U,oe]),V=o.useCallback(()=>{const M=b.current;M&&(z(),h.current=!0,U(!1),Ne(M,()=>M.scrollHeight-M.clientHeight,()=>{b.current===M&&(M.scrollTop=M.scrollHeight,h.current=!0,U(!1),oe(zs(M)))}))},[z,U,oe,Ne]),ae=o.useCallback(M=>{const N=b.current;if(!N)return;const ne=du(N,M);if(!ne)return;z(),Ne(N,()=>ne.isConnected?Math.max(0,Ks(N,ne)-Oo):N.scrollTop,()=>{if(b.current!==N)return;const ge=Rn(N);h.current=ge,fe(N,{nearBottom:ge})})},[z,Ne,fe]),F=o.useCallback(()=>{const M=b.current;M&&(f.current={scrollHeight:M.scrollHeight,scrollTop:M.scrollTop},h.current=!1)},[]),he=o.useCallback(async()=>{if(y&&!(!a||s||v.current)){F(),v.current=!0;try{await a()}finally{v.current=!1}}},[y,s,a,F]),G=o.useCallback(M=>{if(A.current){h.current=!0,U(!1),oe(Os);return}const N=Rn(M);h.current=N,fe(M,{nearBottom:N}),!C.current&&M.scrollTop<=jr&&y&&!s&&he()},[y,s,he,U,oe,fe]),st=o.useCallback(M=>{!h.current&&!Rn(M)||(h.current=!0,M.scrollTop=M.scrollHeight)},[]);return o.useLayoutEffect(()=>{if(x!=="chat"||!c||typeof window>"u")return;const M=k.current;if(!M)return;let N=null;const ne=()=>{N=null;const ze=Math.max(96,Math.ceil(M.getBoundingClientRect().height+20));le(ee=>ee===ze?ee:ze)},_e=()=>{N===null&&(N=window.requestAnimationFrame(ne))};_e();const ge=typeof window.ResizeObserver>"u"?null:new window.ResizeObserver(_e);return ge?.observe(M),window.addEventListener("resize",_e),()=>{N!==null&&window.cancelAnimationFrame(N),ge?.disconnect(),window.removeEventListener("resize",_e)}},[c,x]),o.useLayoutEffect(()=>{const M=b.current;x!=="chat"||!c||!M||C.current||!h.current&&!Rn(M)||(h.current=!0,Y(M,{settle:!0}))},[ue,Y,c,x]),o.useLayoutEffect(()=>{f.current=null,v.current=!1,C.current=!0,h.current=!0,Ce(),z(),I(null),U(!1),oe(Os)},[z,Ce,w,U,oe]),o.useEffect(()=>{const M=b.current;x!=="chat"||!M||C.current||!y||s||M.scrollTop<=jr&&M.scrollHeight<=M.clientHeight+jr&&he()},[y,s,S,Q.length,he,x]),o.useLayoutEffect(()=>{const M=f.current,N=b.current;!M||!N||C.current||(f.current=null,N.scrollTop=M.scrollTop+Math.max(0,N.scrollHeight-M.scrollHeight),fe(N))},[Q.length,fe]),o.useLayoutEffect(()=>{const M=b.current;if(x!=="chat"||!w||!M){m.current=w,h.current=!0,$(w);return}const N=m.current!==w;if(m.current=w,N||C.current){h.current=!0,Y(M,{conversationKey:w,finishInitial:!0,settle:!0});return}const ne=Rn(M);if(h.current||ne){h.current=!0,U(!1),oe(zs(M)),Y(M,{settle:!0});return}fe(M,{nearBottom:ne})},[de,w,$,i?.id,Y,U,oe,fe,x]),o.useEffect(()=>()=>{z(),Ce()},[z,Ce]),{chatColumnStyle:pe,chatThreadPreparingInitialScroll:_,chatThreadRef:b,composerStackRef:k,goToUserMessage:ae,handleChatContentMutation:st,handleChatScroll:G,jumpToLatestChatMessage:V,showScrollToBottomButton:D,userMessageNavigation:B,chatTimelineRows:Q}}const Su=o.lazy(()=>je(()=>import("./WorkspaceDiffPanel-DMu3IIuX.js"),__vite__mapDeps([9,1,2,4,3,6,10,11,12,13,14,15]),import.meta.url).then(e=>({default:e.WorkspaceDiffPanel}))),Cu=o.lazy(()=>je(()=>import("./AppsView-CWhWKF1c.js"),__vite__mapDeps([16,1,2,17]),import.meta.url).then(e=>({default:e.AppsView}))),Mu=o.lazy(()=>je(()=>import("./GetStartedView-BsgErNU9.js"),__vite__mapDeps([18,1,2,5,19,20,4,21]),import.meta.url).then(e=>({default:e.GetStartedView}))),Nu=o.lazy(()=>je(()=>import("./LabsRoute-BFV7VPOU.js").then(e=>e.f),__vite__mapDeps([22,1,2,23,20,10,4,0,3,5,6,11,24,25,19,26,27,28]),import.meta.url).then(e=>({default:e.LabsRoute}))),Eu=o.lazy(()=>je(()=>import("./ScheduledWorkPage-BzSPcB3d.js"),__vite__mapDeps([29,1,2,30,4,5,6,14]),import.meta.url).then(e=>({default:e.ScheduledWorkPage}))),Au=o.lazy(()=>je(()=>import("./OutputsPage-CmwXC2Xd.js"),__vite__mapDeps([31,1,2,4,12,23,11,25,32]),import.meta.url).then(e=>({default:e.OutputsPage}))),ho=o.lazy(()=>je(()=>import("./LabSkillSidebar-Ba6gRUbM.js"),__vite__mapDeps([33,1,2,4,23,11,25,32,12,34]),import.meta.url).then(e=>({default:e.LabSkillSidebar}))),Tu=o.lazy(()=>je(()=>import("./BrowserSidebar-MTkosLlw.js"),__vite__mapDeps([35,1,2,4,6,32,36]),import.meta.url).then(e=>({default:e.BrowserSidebar}))),Ru=o.lazy(()=>je(()=>import("./RightChatPanelStack-CHOpwL1L.js"),__vite__mapDeps([37,1,2,12,38,15,4,25,39,3,5,11,23,32]),import.meta.url).then(e=>({default:e.RightChatPanelStack}))),_u=o.lazy(()=>je(()=>import("./NativeSkillSidebar-B1QrK2aH.js"),__vite__mapDeps([40,1,2,4,41]),import.meta.url).then(e=>({default:e.NativeSkillSidebar}))),Iu=o.lazy(()=>je(()=>import("./TeamChatView-DevmTvuf.js"),__vite__mapDeps([42,1,2,4,6,43,11,19,23,25,32,12,44,45]),import.meta.url).then(e=>({default:e.TeamChatView}))),$u=o.lazy(()=>je(()=>import("./TeamChatView-DevmTvuf.js"),__vite__mapDeps([42,1,2,4,6,43,11,19,23,25,32,12,44,45]),import.meta.url).then(e=>({default:e.TeamChatProView}))),Pu=o.lazy(()=>je(()=>import("./CommunityView-BqFeUGPj.js"),__vite__mapDeps([46,1,2,47,6,4,43,11,23,25,32,12,48]),import.meta.url).then(e=>({default:e.CommunityView}))),Lu=o.lazy(()=>je(()=>import("./TeamChatView-DevmTvuf.js"),__vite__mapDeps([42,1,2,4,6,43,11,19,23,25,32,12,44,45]),import.meta.url).then(e=>({default:e.TeamAiThreadPanel}))),Du=o.lazy(()=>je(()=>import("./TeamChatView-DevmTvuf.js"),__vite__mapDeps([42,1,2,4,6,43,11,19,23,25,32,12,44,45]),import.meta.url).then(e=>({default:e.TeamAgentConversationPanel}))),Ou=o.lazy(()=>je(()=>import("./TrainingDraftPanel-BVxPaBhF.js"),__vite__mapDeps([49,1,2,4,28]),import.meta.url).then(e=>({default:e.TrainingDraftPanel}))),zu=o.lazy(()=>je(()=>import("./MainChatThread-B283zmgR.js"),__vite__mapDeps([50,1,2,38,15,4,25,39,3,12,5,11,23,32]),import.meta.url).then(e=>({default:e.MainChatThread}))),Fu=o.lazy(()=>je(()=>import("./TrainingCreationPanel-AMq0npLN.js"),__vite__mapDeps([51,1,2,3,28]),import.meta.url).then(e=>({default:e.TrainingCreationPanel})));function Bu({experience:e,onNewExperienceChange:n,view:s,teamChat:r,community:a,bootstrap:i,runtimeEvents:c,chatMessages:u,contextWindowStatus:x,goalRuntime:b,subagentRuntime:k,selectedSessionId:h,composerDraftStore:m,mainComposerFocusRequestId:f,onRequestComposerFocus:v,labCloseDetailRequestId:C,labCloseDetailKind:A,sideChatTrainingLaunchRequest:p,onSideChatTrainingLaunchHandled:E,steerAutoDispatchBlocked:S,steerAutoDispatchReady:L,mentionApps:j,connectedAppMentions:I,profileSkills:D,selectedMentionAppId:re,busy:ue,turnRunning:le,activeProvider:B,activeModel:H,codexPermissionMode:Q,codexReasoningEffort:pe,openPondCommandAccessMode:be,pendingApproval:de,activeWorkspaceAppId:y,activeWorkspaceId:w,activeWorkspaceKind:_,projectTarget:U,actionCatalog:oe,workspaceTarget:fe,connection:$,workspaceName:Ce,workspaceState:Ne,workspaceDiff:z,workspaceBusy:Y,diffBusy:V,forceChatThread:ae=!1,diffPanelOpen:F,diffPanelExpanded:he,rightPanelMode:G,rightPanelTabRequest:st,rightChatPanels:M,nativeSkillSidebar:N,extensionSkillSidebar:ne,workspaceDiffPanelViewState:_e,sidebarFileOpenRequest:ge,sidebarFileBookmarks:ze,onSetSidebarFileStatus:ee,browserConversationId:Ie,terminalScope:$e,terminalTabs:Mt,terminalCwd:Nt,pendingTerminalCommand:rt,terminalOpen:ot,onToggleTerminal:Et,onWorkspaceDiffPanelViewStateChange:rn,training:Me,trainingSessions:Pn,trainingChatHandoff:Be,trainingDetailTasksetId:Ln,onTrainingDetailTasksetIdChange:on,onTrainingChatTaskSelect:me,onTrainingChatHandoffDismiss:xe,onOpenSession:Lt,onExperienceHandoff:an,cloudProjects:ps,chatHistoryHasMore:ln=!1,chatHistoryLoading:xs=!1,onDiffPanelResizeStart:Ee,canSyncWorkspace:bs,startMessage:Dt,onPayload:bt,onError:Je,setView:Ze,onOpenProfileSettings:cn,onOpenProviderSettings:un,onOpenComputeSettings:gt,onOpenDatasetStorageSettings:Qs,changeDraftProvider:At,changeProjectTarget:Ae,changeWorkspaceTarget:kt,setDraftProvider:Ye,setDraftModel:at,onBeginNewChatWithModel:dn,changeCodexPermissionMode:it,changeCodexReasoningEffort:yt,changeOpenPondCommandAccessMode:De,resolveApproval:Dn,answerCreateImproveQuestion:lt,approveCreateImproveRun:On,applyCreateImproveCandidate:fn,cancelCreateImproveRun:zn,openCreateImprovePullRequest:mn,pauseCreateImproveRun:hn,reconcileCreateImprovePullRequest:Fn,rejectCreateImproveCandidate:Ot,resumeCreateImproveRun:pn,reviseCreateImproveRun:zt,setMentionedAppId:Ue,showToast:J,sendPrompt:et,stopTurn:gs,syncWorkspaceLocally:Bn,refreshWorkspaceDiff:Xs,onToggleDiffPanelExpanded:qe,onShowDiffPanel:Fe,onShowBrowserPanel:Tt,onShowTrainingDraftPanel:xn,onShowFilesPanel:Te,onShowRightChatPanel:vt,onAddRightChat:Un,onOpenRightChatForSession:qn,onLabDetailOpenChange:Rt,onTerminalTabsChange:Js,onCloseRightChatPanel:Hn,onCloseNativeSkillSidebar:ks,onActivateRightChatPanel:ys,onRightChatModelChange:Ft,onRightChatPromptChange:Zs,onRightChatScrollStateChange:bn,onRightChatProviderChange:vs,onSubmitRightChat:Ys,onStopRightChat:er,onCloseTerminal:tr,onLoadMoreChatHistory:ke}){const[ct,Pe]=o.useState(null),[ye,jt]=o.useState(null),[Bt,js]=o.useState(null),[ut,Ut]=o.useState(null),[ws,gn]=o.useState(null),[He,nr]=o.useState(null),[Vn,sr]=o.useState(null),[kn,Wn]=o.useState(null),[yn,Ss]=o.useState([]),or=o.useMemo(()=>i?.sessions.find(g=>g.id===h)??null,[i?.sessions,h])?.currentProfile??i?.profileLibrary?.lastUsed??null,vn=Ca(i?.profileLibrary??{profiles:[]},or)??i?.profile??null,ve=o.useMemo(()=>Ma(vn,i?.extensionCatalog),[i?.extensionCatalog,vn]),_t=o.useMemo(()=>Na(vn),[vn]),tt=o.useCallback(async(g,R=h)=>{if(!$||!i)return;const te=Ea(i.profileLibrary??{profiles:[]},g);if(te)try{const K=R&&!Aa(R)?i.sessions.find(q=>q.id===R)??null:null,W=await Bc({ref:te,session:K,selectProfile:q=>Se.profileSelect($,q),patchSession:(q,xt)=>Se.patchSession($,q,{currentProfile:xt})});let ce=i.sessions;W.session&&(ce=ce.map(q=>q.id===W.session.id?W.session:q)),bt({...i,profile:W.selected.profile,profileLibrary:W.selected.library,sessions:ce})}catch(K){const W=K instanceof Error?K.message:String(K);Je(W),J(W,"error")}},[i,$,Je,bt,h,J]);o.useEffect(()=>{if(!ge)return;const{file:g,id:R}=ge;if(jt({id:R,path:g.path}),!$)return;let te=!1;return(g.workspaceKind==="local"?Se.workspaceFile($,g.workspaceId,g.path).then(W=>W.content??""):Se.sandboxDownloadFile($,g.workspaceId,g.path).then(W=>{if(W.file.isBinary)throw new Error("Binary files cannot be attached to chat.");return W.contents})).then(W=>{if(te)return;const ce=g.path.split("/").at(-1)??g.path;Pe({id:R,file:new File([W],ce,{type:Uu(g)})})}).catch(W=>{te||J(W instanceof Error?W.message:String(W),"error")}),()=>{te=!0}},[$,J,ge]);const dt=e==="development"||e==="work"&&U.value!=="none",qt=o.useMemo(()=>{if(e==="chat")return _t;if(!dt)return[];const g=new Map(oe.filter(R=>!Ta(R)).map(R=>[R.id,R]));for(const R of _t)g.set(R.id,R);for(const R of yn)g.set(R.id,R);return[...g.values()]},[oe,e,dt,yn,_t]),X=ru($),jn=o.useCallback(g=>{if(!g){X.activate(null);return}X.activate({runId:g.run.id,candidateId:g.candidate.id,title:g.run.objective,fileRootPath:g.fileRootPath,initialPath:g.initialPath})},[X.activate]),Ve=o.useCallback(()=>{X.selection?.initialPath&&X.openFile(X.selection.initialPath),Fe()},[X.openFile,X.selection?.initialPath,Fe]),Gn=o.useCallback(g=>{Ut(g),g&&Fe()},[Fe]),se=o.useCallback(()=>{Ut(null),he&&qe()},[he,qe]);o.useEffect(()=>{s!=="labs"&&Ut(null)},[s]);const wn=o.useCallback((g,R)=>{const te=Date.now(),K=oe.find(ce=>ce.id===g)??null;m.set(""),Ue(null),Ze("chat");const W=ce=>{if(!(ce.find(ie=>ie.id===g)??null))return!1;const xt=ce.map(ie=>ie.id===g?{...ie,label:R}:ie);return Ss(xt),window.requestAnimationFrame(()=>{Wn({actionId:g,requestId:Math.max(Date.now(),te+1)})}),!0};if(!$){K?W([K]):J("The Agent action catalog is still loading. Try Use again.","error");return}Se.profileCurrent($).then(ce=>{const q=ce.actionCatalog.map(xt=>Ra(xt));!W(q)&&K?W([K]):q.some(xt=>xt.id===g)||J("This Agent is ready, but its default chat action is unavailable.","error")}).catch(ce=>{K||J(ce instanceof Error?ce.message:String(ce),"error")})},[oe,m,$,Ue,Ze,J]),Cs=o.useCallback((g,R)=>{m.set(g),Ue(null),R&&At(R),Ze("chat")},[At,m,Ue,Ze]),Kn=o.useMemo(()=>_a(i?.preferences),[i?.preferences]),Ms=Kn.training,{createAgentFromLab:Ns,improveAgentFromLab:We}=au({activeModel:H,activeProvider:B,bootstrap:i,codexPermissionMode:Q,codexReasoningEffort:pe,connection:$,onOpenRightChatForSession:qn,onPayload:bt}),ft=o.useMemo(()=>{const g=Me.payload?.tasksets??[];return g.some(R=>R.id===He)?He:g[0]?.id??null},[He,Me.payload?.tasksets]),Es=s==="labs"&&ft?`profiles/${i?.profile.activeProfile??"default"}/tasksets/${ft}`:null,Qn=o.useMemo(()=>{if(s!=="labs"||!ft||!Me.payload)return null;const g=Me.payload.tasksets.find(ie=>ie.id===ft);if(!g)return null;const R=Me.payload.plans.filter(ie=>ie.tasksetId===g.id),te=new Set(R.map(ie=>ie.id)),K=Me.payload.jobs.filter(ie=>te.has(ie.planId)).sort((ie,pr)=>pr.createdAt.localeCompare(ie.createdAt)),W=K.find(ie=>ie.id===Vn)??K[0]??null,ce=W?R.find(ie=>ie.id===W.planId)??null:R.sort((ie,pr)=>pr.createdAt.localeCompare(ie.createdAt))[0]??null,q=W?Me.payload.models.find(ie=>ie.jobId===W.id)??null:null,xt=W?Me.payload.artifacts.filter(ie=>ie.jobId===W.id):[];return{taskset:g,plan:ce,job:W,lineage:q,artifacts:xt}},[ft,Vn,Me.payload,s]),Ht=o.useMemo(()=>su(Me.payload,h),[h,Me.payload]),Vt=o.useMemo(()=>hu(u),[u]),Xn=!!b||!!Vt||!!k,we=s==="labs"&&!!X.selection,It=s==="labs"&&F&&G==="changes"&&!!ut,Jn=(s==="chat"||s==="labs")&&!!y,ar=s==="chat"&&F&&G==="chat"&&M.length===0,As=Ia(_)?w??xu(Ce):null,ir=s==="chat"&&!!As,Oe=As,Wt=!!Oe||fe.value==="cloud"||fe.value==="hybrid",mt=o.useMemo(()=>Dc({workspaceTarget:fe.value,localWorkspaceId:y,sandboxSourceAvailable:Wt,sandboxWorkspaceId:Oe,override:Bt}),[y,Wt,Oe,Bt,fe.value]),nt=mt.source,Ge=nt==="sandbox",lr=o.useMemo(()=>nt&&mt.options.length>1?{value:nt,options:mt.options,onChange:js}:null,[nt,mt.options]);o.useEffect(()=>{js(null)},[y,Ie,Oe,fe.value]);const Zn=!It&&(we||Jn||ir)&&F&&(G==="changes"||G==="goal"&&Xn||ar),Yn=s==="chat"&&F&&G==="browser",ht=(s==="chat"||s==="labs")&&F&&G==="chat"&&M.length>0,Gt=s==="chat"&&F&&G==="training",es=s==="chat"&&F&&!!N,cr=s==="chat"&&F&&!!ne,ts=s==="team"&&F&&G==="chat"&&!!r.aiThread,$t=s==="team"&&F&&G==="chat"&&!!r.agentConversation,ns=e==="work"&&s==="chat"&&F&&G==="home",Kt=qo({supportedView:s==="chat"&&dt||s==="labs",open:F,hasContentPanel:Zn||It||Yn||ht||Gt||es||ts||$t||ns}),Sn=Zn||It||Yn||ht||Gt||es||ts||$t||ns||Kt,Cn=Sn&&G!=="chat"&&he,Ts=i?.account.baseUrl??i?.account.activeProfile?.baseUrl??null,Qt=uu({activeWorkspaceId:w,cloudProjects:ps}),ss=s==="chat"&&le&&!de&&Lc(u),rs=ae||u.length>0||ss,Rs=h??`draft:${s}:${_??"none"}:${w??y??"none"}`,os=t.jsx(ku,{activeModel:H,activeProvider:B,busy:le,handoff:Be,onDismiss:xe,onSelectTask:me}),as=o.useMemo(()=>({onAnswerQuestion:lt,onApprove:On,onApplyCandidate:fn,onCancel:zn,onOpenPullRequest:mn,onPause:hn,onReconcilePullRequest:Fn,onRejectCandidate:Ot,onResume:pn,onRevise:zt}),[lt,On,fn,zn,mn,hn,Fn,Ot,pn,zt]),Mn=o.useMemo(()=>Vt?{...Vt,...as}:null,[as,Vt]),Xt=ju(s,rs),is=o.useCallback(async(g=[],R=null,te=null,K={})=>{const W=K.promptOverride??m.getSnapshot(),ce=()=>{K.preservePrompt||(m.set(""),Ue(null))};if(!R){const q=te?{command:te.id,args:W.trim()}:go(W);if(q){if(!$a({id:q.command},e))return J(`/${q.command} isn't available in ${e}.`,"info"),!1;if(q.command==="train")return g.length>0?(J("/train uses the selected chat; add other chats from Models.","error"),!1):h?(ce(),gn({id:Date.now(),objective:q.args.trim()||null,initialSessionIds:[h]}),Ze("labs"),!0):(ce(),gn({id:Date.now(),objective:q.args.trim()||null,initialSessionIds:[]}),Ze("labs"),!0);if(!q.args&&q.command!=="skill"&&q.command!=="sync-cloud")return J(`Add instructions after /${q.command}.`,"info"),!1;if(g.length>0)return J(`/${q.command} tasks do not accept attachments yet. Add file context in the task thread.`,"error"),!1;if(q.command==="submit-issue")return Pa(I)?et([],null,La(q.args),{clearPrompt:K.preservePrompt?()=>{}:void 0,usageAttribution:wr(q,te?"composer_selection":"prompt_parse")}):(J("Connect the GitHub app before using /submit-issue.","error"),!1);if(pu(q)){const ie=q.command==="skill"?zc(q.args,B,i?.profile.sourcePath??null):mo(q);return et([],null,ie,{clearPrompt:K.preservePrompt?()=>{}:void 0,usageAttribution:wr(q,te?"composer_selection":"prompt_parse")})}return et([],null,mo(q),{clearPrompt:K.preservePrompt?()=>{}:void 0,usageAttribution:wr(q,te?"composer_selection":"prompt_parse")})}}return et(g,R,K.promptOverride,{clearPrompt:K.preservePrompt?()=>{}:void 0,displayPrompt:K.displayPrompt,turnMetadata:K.turnMetadata})},[H,B,_,i?.profile,I,m,e,et,h,Ue,Ze,J,Me,s]),ls=o.useCallback(g=>{Be&&g!==Be.model.modelId&&xe(),Ye(B),at(g)},[B,xe,at,Ye,Be]),_s=o.useCallback(g=>{Be&&g!==Be.model.providerId&&xe(),At(g)},[At,xe,Be]),{chatColumnStyle:Ke,chatThreadPreparingInitialScroll:Is,chatThreadRef:$s,chatTimelineRows:ur,composerStackRef:Ps,goToUserMessage:Ls,handleChatContentMutation:dr,handleChatScroll:cs,jumpToLatestChatMessage:fr,showScrollToBottomButton:mr,userMessageNavigation:Jt}=wu({browserConversationId:Ie,chatHistoryHasMore:ln,chatHistoryLoading:xs,chatMessages:u,onLoadMoreChatHistory:ke,pendingApproval:de,showChatThread:rs,showThinkingIndicator:ss,view:s}),Nn=o.useCallback((g,R)=>{Da({conversationId:Ie,href:g,explicitFile:R?.explicitFile,newTab:R?.newTab}).then(te=>{te&&Tt()})},[Ie,Tt]),En=Ka({projectTargetDetail:U.detail,projectTargetValue:U.value,workspaceRepoPath:Ne?.repoPath,workspaceTargetValue:fe.value}),l=o.useCallback(g=>{const R=Ic(g,En);if(R&&$){Se.signLocalVideoUrl($,{path:R}).then(({url:K})=>Nn(K)).catch(K=>{J(K instanceof Error?K.message:"Could not open this video.","error")});return}const te=Qa(g,{workspaceRootPath:En});Fe(),jt({id:Date.now(),path:te?.path??g})},[$,Nn,Fe,J,En]),d=o.useCallback(async g=>{if(!$||!g.filePreview&&!g.imagePreview){J("File content is not available for this attachment.","error");return}try{const R=g.name.trim().replace(/[\\/]+/g,"-")||"attachment.txt",K=`Attachments/${g.id.replace(/[^a-zA-Z0-9._-]+/g,"-")||"file"}/${R}`,W={path:K,status:"",additions:0,deletions:0,patch:"",content:null};let ce;if(g.filePreview){const q=await Se.chatAttachmentFile($,g.filePreview);W.content=q.content}else g.imagePreview&&(ce=(await Se.signChatAttachmentImageUrl($,g.imagePreview)).url);Fe(),jt({id:Date.now(),path:K,file:W,...ce?{imageUrl:ce}:{}})}catch(R){J(R instanceof Error?R.message:"Could not open this attachment.","error")}},[$,Fe,J]),T=Y&&!!y&&!Ne,P=X.selection?`candidate:${X.selection.runId}:${X.selection.candidateId}`:null,O=Zn?t.jsx(Su,{appId:we?P:Ge?null:y,workspaceId:we?P:Ge?Oe:y,workspaceKind:we?"local_project":Ge?null:"local_project",connection:$,runtimeEvents:c,diff:we?X.diff:Ge?null:z,fileRootPath:we?X.selection?.fileRootPath??null:Ge?null:Es,filesWithPreview:we,editorPreferences:i?.preferences.editor??null,loading:we?X.loading:Ge?Y:V||T,openFileRequest:we?X.openFileRequest:ye,sidebarFileBookmarks:ze,sidebarFileSourceSessionId:h,onSetSidebarFileStatus:ee,readOnly:we,sideChatTabs:M.map(g=>({id:g.id,title:g.title,running:g.running})),sourceSwitcher:we?null:lr,tabRequest:st,viewState:_e,workspaceName:we?X.selection?.title??"Change":Ge?Ce??"Sandbox":Ce,workspaceInitialized:we?!0:Ge?!!Oe:!!Ne?.initialized,workspaceError:we?X.error:Ge?null:Ne?.error??z?.error??null,expanded:he,onResizeStart:Ee,onRefresh:g=>{we?X.refresh(g):Xs(g)},onToggleExpanded:qe,onOpenBrowser:Tt,onOpenBrowserUrl:Nn,onViewStateChange:rn,onCloseSideChat:Hn,onOpenSideChat:s==="chat"?Un:void 0,onSelectSideChat:g=>{ys(g),vt()},goalDetails:{active:G==="goal",createRuntime:Mn,goalRuntime:b,subagentRuntime:k},sandboxFileSource:Ge?{sandboxId:Oe,emptyMessage:"No sandbox filesystem yet."}:null,trainingSummary:Qn}):null,Z=Yn?t.jsx(Tu,{conversationId:Ie,expanded:he,onResizeStart:Ee}):null,Re=ts?o.createElement(Lu,{...r,key:r.aiThread?.conversationId,onResizeStart:Ee}):null,wt=$t?o.createElement(Du,{...r,key:r.agentConversation?.run.id,onResizeStart:Ee}):null,Zt=ht?t.jsx(Ru,{panels:M,actionCatalog:qt,createImproveActions:as,busy:ue,codexPermissionMode:Q,codexReasoningEffort:pe,openPondCommandAccessMode:be,connection:$,connectedAppMentions:I,mentionApps:j,codexPersonalSkills:i?.codexPersonalSkills??[],profileSkills:D,profileLibrary:i?.profileLibrary??{lastUsed:null,profiles:[]},extensionCatalog:i?.extensionCatalog??null,projectTarget:U,providerSettings:i?.providers??null,accountBaseUrl:Ts,billingOrganizationSlug:Qt.organizationSlug,billingTeamId:Qt.teamId,showToast:J,workspaceTarget:fe,onAddChat:Un,onActivatePanel:ys,onClosePanel:Hn,onCodexPermissionModeChange:it,onCodexReasoningEffortChange:yt,onOpenPondCommandAccessModeChange:De,onModelChange:Ft,onOpenAttachmentInSidebar:d,onOpenFileInSidebar:l,onOpenProfileSettings:cn,onOpenSession:Lt,onProviderChange:vs,onProviderSetupOpen:un,onPromptChange:Zs,onProfileTargetChange:(g,R)=>{tt(R,g)},onScrollStateChange:bn,onProjectTargetChange:Ae,onResolveApproval:Dn,onResizeStart:Ee,onSelectFiles:Te,onShowBrowserPanel:Tt,onStop:er,onSubmit:Ys,onWorkspaceTargetChange:g=>{kt(g)}}):null,Yt=Kt?t.jsx(Hc,{expanded:he,terminalOpen:ot,sideChatAvailable:s==="chat"||s==="labs",onOpenBrowser:Tt,onOpenFiles:Te,onOpenReview:Fe,onOpenSideChat:Un,onOpenTrainingDraft:xn,trainingDraftAvailable:!!h,onResizeStart:Ee,onToggleExpanded:qe,onToggleTerminal:Et}):null,pt=ns?t.jsx(Vc,{chatMessages:u,connection:$,contextWindowStatus:x,expanded:he,runtimeEvents:c,sessionId:h,showToast:J,onResizeStart:Ee,onToggleExpanded:qe,onUseOutput:g=>Pe({id:Date.now(),file:g}),onHandoffOutput:async(g,R,te)=>{await an({target:g,sourceSessionId:h,output:R,prompt:Oa(R,g)}),te&&Pe({id:Date.now(),file:te})},onReviseOutput:(g,R,te)=>{Pe({id:Date.now(),file:R}),m.set(`Create revision ${g.revision+1} of "${g.title}" from the attached revision ${g.revision}. Apply only this requested change:
4
+ [attachment text truncated]`;return`${e.slice(0,Math.max(0,Pt.maxTextChars-n.length))}${n}`}function pc(){const e=o.useRef([]),n=o.useRef([]),s=o.useRef(!1),[r,a]=o.useState([]),[i,c]=o.useState(null);o.useEffect(()=>{e.current=r},[r]),o.useEffect(()=>()=>{s.current=!0;for(const m of e.current)us(m);for(const m of n.current)us(m)},[]);const u=o.useCallback(m=>{if(m.length===0)return;const f=Math.max(0,Pt.maxAttachments-r.length),v=[];let C=0,A=0;for(const p of m){if(p.size>Pt.maxAttachmentBytes){C+=1;continue}if(v.length>=f){A+=1;continue}const E="webkitRelativePath"in p&&typeof p.webkitRelativePath=="string"&&p.webkitRelativePath.trim()?p.webkitRelativePath.trim():void 0;v.push({id:lc(),file:p,name:p.name||"Untitled file",mediaType:p.type||"application/octet-stream",sizeBytes:p.size,kind:cc(p),...E?{relativePath:E}:{},...p.type.startsWith("image/")?{previewUrl:URL.createObjectURL(p)}:{}})}if(v.length>0&&(a([...r,...v]),c(null)),C>0||A>0){const p=[];C>0&&p.push(`${C} file${C===1?"":"s"} exceeded ${dc(Pt.maxAttachmentBytes)}`),A>0&&p.push(`maximum ${Pt.maxAttachments} attachments`),c(p.join("; "))}},[r]),x=o.useCallback(m=>{a(f=>{const v=f.find(A=>A.id===m);v&&us(v);const C=f.filter(A=>A.id!==m);return C.length===0&&c(null),C})},[]),b=o.useCallback(()=>{for(const m of e.current)us(m);e.current=[],a([]),c(null)},[]),k=o.useCallback(()=>{const m=e.current;return m.length===0||(e.current=[],n.current=m,a([]),c(null)),m},[]),h=o.useCallback((m,f)=>{if(m.length===0)return;const v=new Set(m.map(C=>C.id));if(n.current=n.current.filter(C=>!v.has(C.id)),f==="restore"&&!s.current){a(C=>{const A=new Set(C.map(E=>E.id)),p=[...m.filter(E=>!A.has(E.id)),...C];return e.current=p,p});return}for(const C of m)us(C)},[]);return{attachmentError:i,attachments:r,addFiles:u,clearAttachments:b,removeAttachment:x,settleStagedAttachments:h,setAttachmentError:c,stageAttachmentsForSubmit:k}}function us(e){e.previewUrl&&URL.revokeObjectURL(e.previewUrl)}function xc(e,n){const s=e.slice(0,Math.max(0,Math.min(n,e.length))),r=/(?:^|\s)\/([a-zA-Z0-9_-]*)$/.exec(s);if(!r||typeof r.index!="number")return null;const a=r[0].lastIndexOf("/");if(a<0)return null;const i=r.index+a;return{end:s.length,query:(r[1]??"").toLowerCase(),start:i}}function bc(e,n,s=Pr){const r=e.slice(0,Math.max(0,Math.min(n,e.length))),a=/(?:^|\s)\/([a-z][a-z0-9_-]*)\s$/.exec(r);if(!a)return null;const i=s.find(u=>u.id===a[1]);if(!i)return null;const c=a[0].lastIndexOf("/");return c<0||typeof a.index!="number"?null:{command:i,end:r.length,start:a.index+c}}function gc(e,n=Pr){return sa({commands:n,prompt:`/${e}`})}function ro(e,n){return e.length===0?[]:e.filter(s=>n?[s.id,s.name??"",s.label??"",s.description??"",typeof s.implementation?.type=="string"?s.implementation.type:""].join(" ").toLowerCase().includes(n):!0)}function oo(e,n){return e.length===0?[]:e.filter(s=>n?[s.id,s.name,s.description??"",s.gitRepo??"",bo(s)].join(" ").toLowerCase().includes(n):!0).slice(0,8)}function ao({actionCatalog:e,connectedAppMentions:n,mentionApps:s,profileSkills:r,query:a,surface:i,teamMentionMembers:c}){const u=a.toLowerCase();if(i==="team"){const m=c.filter(v=>u?[v.name,v.handle??""].map(_n).some(C=>C.includes(u)):!0).map(v=>({kind:"team-member",member:v}));return[...zr(e,u,e.length).map(v=>({kind:"action",action:v})),...m]}const x=s.filter(m=>u?[_n(m.id),_n(m.name),m.gitRepo?_n(m.gitRepo):"",bo(m)].some(v=>v.includes(u)):!0).map(m=>({kind:"app",app:m})),b=zr(e,u,e.length).map(m=>({kind:"action",action:m})),k=Bs(r,u).map(m=>({kind:"skill",skill:m})),h=na(n,u).map(m=>({kind:"connected-app",app:m}));return[...b,...k,...x,...h]}function kc(e,n,s){const r=n?.trim();if(!r)return e;const a=Math.max(0,Math.min(s??0,e.length)),i=e.slice(0,a),c=e.slice(a),u=i&&!/\s$/.test(i)?" ":"",x=c&&!/^\s/.test(c)?" ":"";return`${i}${u}${r}${x}${c}`.replace(/\s+/g," ").trim()}function yc(e){const n=_n($r(e)||e.name||e.id);return n?`@${n}`:null}function vc(e){const n=e.trim();if(!n.startsWith("{")||!n.endsWith("}"))return e;try{const s=JSON.parse(n);if(!s||Array.isArray(s)||typeof s!="object")return e;const r=Object.entries(s).filter(([,a])=>a!=null&&a!=="").map(([a,i])=>`${Lo(a)}: ${Rr(a,i)}`);return r.length?r.join(" · "):e}catch{return e}}function Lo(e){const n=e.replace(/Id$/,"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replaceAll("_"," ").trim().toLowerCase();return n?`${n[0].toUpperCase()}${n.slice(1)}`:"Input"}function Rr(e,n){if(Array.isArray(n))return n.map(r=>Rr(e,r)).join(", ");if(n&&typeof n=="object")return Object.entries(n).map(([r,a])=>`${Lo(r)}: ${Rr(r,a)}`).join(" · ");const s=String(n);return/Id$/.test(e)&&/^[a-z0-9_-]+$/i.test(s)?s.split(/[-_]+/).filter(Boolean).map(r=>`${r[0].toUpperCase()}${r.slice(1)}`).join(" "):s}function jc({action:e,prompt:n,selectedActionMentionText:s,selectedInvocationPosition:r}){if(!e)return null;const a=s?.trim(),i=a?.startsWith("@")?a:yc(e);return i?kc(vc(n),i,r):null}function wc({attachmentCount:e,prompt:n,selectedAction:s,selectedCommand:r}){return!!(n.trim()||e>0||s||r)}const Sc=new Set(["openpond-agent-authoring","openpond-skill-authoring","openpond-taskset-authoring"]);function Cc({activeMentionKey:e,activeSkillKey:n,activeSlashKey:s,addMenuIndex:r,addMenuItems:a,addMenuOpen:i,addMenuPanelRef:c,addMenuRef:u,attachmentCount:x,composerRef:b,createImproveActive:k,goalRuntimeActive:h,inputRef:m,inputShellRef:f,mentionQuery:v,prompt:C,selectedActionId:A,selectAddMenuItem:p,setActionIndex:E,setActionMenuDismissedPrompt:S,setAddMenuIndex:L,setAddMenuOpen:j,setAddMenuQuery:I,setMentionMenuDismissedPrompt:D,setMentionIndex:re,setSkillIndex:ue,setSkillMenuDismissedPrompt:le,skillMatchCount:B,skillQuery:H,slashMatchCount:Q,slashQuery:pe,showActionMenu:be,showMentionMenu:de,showSkillMenu:y}){const[w,_]=o.useState({}),[U,oe]=o.useState({}),[fe,$]=o.useState({}),[Ce,Ne]=o.useState({});return o.useEffect(()=>{re(0)},[v]),o.useEffect(()=>{ue(0)},[B,H]),o.useEffect(()=>{E(0)},[Q,pe]),o.useEffect(()=>{const z=m.current?.element,Y=z?.parentElement;if(!z||!Y||typeof ResizeObserver>"u")return;const V=new ResizeObserver(()=>m.current?.resize());return V.observe(Y),()=>V.disconnect()},[]),o.useEffect(()=>{if(!i)return;function z(V){const ae=V.target,F=m.current?.element?.parentElement;!u.current?.contains(ae)&&!c.current?.contains(ae)&&!F?.contains(ae)&&(j(!1),I(""),D(e),S(s),le(n))}function Y(V){if(V.key==="Escape"){V.preventDefault(),j(!1),I(""),D(e),S(s),le(n);return}if(a.length!==0){if(V.key==="ArrowDown"){V.preventDefault(),L(ae=>(ae+1)%a.length);return}if(V.key==="ArrowUp"){V.preventDefault(),L(ae=>(ae-1+a.length)%a.length);return}if(V.key==="Home"){V.preventDefault(),L(0);return}if(V.key==="End"){V.preventDefault(),L(a.length-1);return}if(V.key==="Enter"){V.preventDefault();const ae=a[r]??a[0];ae&&p(ae)}}}return document.addEventListener("pointerdown",z),document.addEventListener("keydown",Y),()=>{document.removeEventListener("pointerdown",z),document.removeEventListener("keydown",Y)}},[e,n,s,r,a,i]),o.useLayoutEffect(()=>{if(!i)return;const z=f.current;if(!z)return;const Y=z;function V(){Ne(rl(Y))}return V(),window.addEventListener("resize",V),window.addEventListener("scroll",V,!0),()=>{window.removeEventListener("resize",V),window.removeEventListener("scroll",V,!0)}},[i,x,k,h]),o.useLayoutEffect(()=>{if(!be)return;const z=m.current?.element,Y=b.current;if(!z||!Y)return;const V=z,ae=Y;function F(){$(yr(V,ae))}return F(),window.addEventListener("resize",F),window.addEventListener("scroll",F,!0),()=>{window.removeEventListener("resize",F),window.removeEventListener("scroll",F,!0)}},[x,k,h,C,A,be]),o.useLayoutEffect(()=>{if(!y)return;const z=m.current?.element,Y=b.current;if(!z||!Y)return;const V=z,ae=Y;function F(){oe(yr(V,ae))}return F(),window.addEventListener("resize",F),window.addEventListener("scroll",F,!0),()=>{window.removeEventListener("resize",F),window.removeEventListener("scroll",F,!0)}},[x,k,h,C,A,y]),o.useLayoutEffect(()=>{if(!de)return;const z=m.current?.element,Y=b.current;if(!z||!Y)return;const V=z,ae=Y;function F(){_(yr(V,ae))}return F(),window.addEventListener("resize",F),window.addEventListener("scroll",F,!0),()=>{window.removeEventListener("resize",F),window.removeEventListener("scroll",F,!0)}},[x,k,h,C,A,de]),{actionMenuStyle:fe,addMenuStyle:Ce,mentionMenuStyle:w,skillMenuStyle:U}}const Mc=o.lazy(()=>je(()=>import("./ComposerCreateImproveStrip-CW2QuI7r.js"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url).then(e=>({default:e.ComposerCreateImproveStrip}))),Nc=[],Ec=Pr.find(e=>e.id==="submit-issue");function Ac({experience:e="development",mode:n,surface:s="chat",teamUseModel:r=!1,teamUseModelLocked:a=!1,teamMentionMembers:i=[],onTeamUseModelChange:c,prompt:u,composeNotice:x=null,mentionApps:b=[],connectedAppMentions:k=[],profileSkills:h=[],selectedMentionAppId:m=null,contextWindowStatus:f,goalRuntime:v=null,subagentRuntime:C=null,createImproveRuntime:A=null,busy:p,running:E=p,submissionScopeKey:S="default",initialSteerDrafts:L=Nc,steerAutoDispatchReady:j=!1,steerAutoDispatchBlocked:I=!1,showProjectFooter:D=!0,autoFocus:re=!1,focusRequestId:ue=0,attachmentRequest:le=null,connection:B,providerSettings:H=null,provider:Q,model:pe,projectTarget:be,profileTarget:de=null,actionCatalog:y=[],requestedAction:w=null,workspaceTarget:_,codexPermissionMode:U,codexReasoningEffort:oe,openPondCommandAccessMode:fe,onProviderChange:$,onProviderSetupOpen:Ce,onProjectTargetChange:Ne,onProfileTargetChange:z,onWorkspaceTargetChange:Y,onModelChange:V,onCodexPermissionModeChange:ae,onCodexReasoningEffortChange:F,onOpenPondCommandAccessModeChange:he,onPromptChange:G,onMentionAppSelect:st,showToast:M,onSubmit:N,onStop:ne,onPauseGoal:_e}){const ge=o.useRef(null),ze=o.useRef(null),ee=o.useRef(null),Ie=o.useRef(null),$e=o.useRef(null),Mt=o.useRef(null),Nt=o.useRef(null),rt=o.useRef(0),ot=w&&y.some(l=>l.id===w.actionId)?w:null,Et=o.useRef(!1),rn=o.useRef(0),Me=o.useRef(ot?.requestId??0),Pn=o.useRef(new Set),Be=o.useRef(E?new Set([S]):new Set),Ln=o.useRef(new Set),on=o.useRef(new Set),[me,xe]=o.useState(u.length),[Lt,an]=o.useState(0),[ps,ln]=o.useState(0),[xs,Ee]=o.useState(0),[bs,Dt]=o.useState(0),[bt,Je]=o.useState(""),[Ze,cn]=o.useState(null),[un,gt]=o.useState(null),[Qs,At]=o.useState(null),[Ae,kt]=o.useState(!1),[Ye,at]=o.useState(ot?.actionId??null),[dn,it]=o.useState(null),[yt,De]=o.useState(null),[Dn,lt]=o.useState(null),[On,fn]=o.useState(null),[zn,mn]=o.useState(!1),[hn,Fn]=o.useState(()=>({[S]:L})),[Ot,pn]=o.useState(null),[zt,Ue]=o.useState(null),[J,et]=o.useState(""),[gs,Bn]=o.useState(!1),[Xs,qe]=o.useState(""),[Fe,Tt]=o.useState(!1),{attachmentError:xn,attachments:Te,addFiles:vt,removeAttachment:Un,settleStagedAttachments:qn,setAttachmentError:Rt,stageAttachmentsForSubmit:Js}=pc(),Hn=o.useRef(0);o.useEffect(()=>{!le||Hn.current===le.id||(Hn.current=le.id,vt([le.file]))},[vt,le]);const ks=o.useCallback(l=>{const d=ac(l,Te);return!d||Te.length>=Pt.maxAttachments||d.size>Pt.maxAttachmentBytes?!1:(vt([d]),!0)},[vt,Te]),ys=s==="team"?"Message team":n==="start"?e==="chat"?"Ask anything":"What should we work on?":"Ask for follow-up changes",Ft=e==="development"||e==="work"&&be.value!=="none",Zs=ra(Q,pe,H),bn="top",vs=o.useId(),Ys=o.useId(),er=o.useId(),tr={"--context-fill":`${Math.round((f.percent??0)/100*360)}deg`,"--context-bar-fill":`${f.percent??0}%`},ke=o.useMemo(()=>y.find(l=>l.id===Ye)??null,[y,Ye]),ct=o.useMemo(()=>oa(Q,e),[e,Q]),Pe=o.useMemo(()=>Ft?h:h.filter(l=>!Sc.has(l.name)),[e,h]),ye=o.useMemo(()=>ct.find(l=>l.id===dn)??null,[ct,dn]),jt=jc({action:ke,prompt:u,selectedActionMentionText:Dn,selectedInvocationPosition:yt}),Bt=wc({attachmentCount:Te.length,prompt:u,selectedAction:ke,selectedCommand:ye}),js=o.useMemo(()=>{const l=Math.max(0,Math.min(yt??0,u.length));return ye?{icon:ye.id==="agent"?"plus":ye.id==="skill"?"skill":"workflow",key:`command:${ye.id}`,label:ye.id==="agent"?"Author Agent":ye.id,position:l,onRemove:()=>{it(null),De(null),lt(null)}}:ke?{icon:ke.implementation?.type==="openpond-agent"?"bot":"workflow",key:`action:${ke.id}`,label:$r(ke),position:l,onRemove:()=>{at(null),De(null),lt(null)}}:null},[u.length,ke,ye,yt]),ut=On===S,Ut=E&&Bt,ws=ut||!Bt,gn=ut?"Preparing files":Ut?"Steer":"Send",He=ut,nr=p||ut,Vn=!E||!u.trim()||Te.length>0||!!(ke||ye)||ut,sr=Te.length>0?"Queue supports text drafts":ke||ye?"Queue plain text drafts":u.trim()?"Queue steer draft":"Type a draft to queue";function kn(l=S){const d=Pn.current;return d.has(l)?!1:(d.add(l),!0)}function Wn(l){Pn.current.delete(l)}function yn(l){return Pn.current.has(l)}function Ss(){return yn(S)}function rr(l){fn(d=>d===l?null:d)}const or=o.useMemo(()=>{const l=aa(H,{enabledOnly:!0}).map(Z=>({...Z,description:void 0})),d=Ft?l:l.filter(Z=>Z.value!=="codex"),T=_.value==="cloud"&&Ft?d.filter(Z=>Z.value==="openpond"):d,P=T.some(Z=>Z.value===Q)?T:[{value:Q,label:ia(Q,H),description:"Current"},...T],O={value:"setup-provider",label:"New Model/Provider",icon:"plus",separatorBefore:!0};return[...P,O]},[Q,H,Ft,_.value]),vn=o.useMemo(()=>xo(Q,H),[Q,H]),ve=o.useMemo(()=>la(u,Math.min(me,u.length)),[me,u]),_t=ve?`${u}:${ve.start}:${Math.min(me,u.length)}`:null,tt=o.useMemo(()=>ve?ao({actionCatalog:y,connectedAppMentions:k,mentionApps:b,profileSkills:Pe,query:ve.query,surface:s,teamMentionMembers:i}):[],[y,k,b,ve,Pe,s,i]),dt=o.useMemo(()=>s==="team"?[]:ao({actionCatalog:y,connectedAppMentions:k,mentionApps:b,profileSkills:Pe,query:"",surface:s,teamMentionMembers:i}).filter(l=>l.kind!=="skill"),[y,k,b,Pe,s,i]),qt=!!(!Ae&&!He&&ve&&_t&&Ze!==_t&&tt.length>0),X=o.useMemo(()=>Si(u,Math.min(me,u.length)),[me,u]),jn=X?`${u}:${X.start}:${X.end}`:null,Ve=o.useMemo(()=>X?Bs(Pe,X.query):[],[X,Pe]),Gn=!!(!Ae&&!He&&X&&jn&&Qs!==jn),se=o.useMemo(()=>xc(u,Math.min(me,u.length)),[me,u]),wn=se?`${u}:${se.start}:${se.end}`:null,Cs=o.useMemo(()=>se?ro(y,se.query):[],[y,se]),Kn=o.useMemo(()=>se&&s!=="team"?oo(b,se.query):[],[se,b,s]),Ms=o.useMemo(()=>se&&s!=="team"?gc(se.query,ct):[],[se,ct,s]),Ns=o.useMemo(()=>se&&s!=="team"?Bs(Pe,se.query):[],[se,Pe,s]),We=o.useMemo(()=>[...Cs.map(l=>({kind:"action",action:l})),...Ns.map(l=>({kind:"skill",skill:l})),...Ms.map(l=>({kind:"command",command:l})),...Kn.map(l=>({kind:"app-context",app:l}))],[Cs,Kn,Ms,Ns]),ft=!!(!Ae&&!He&&se&&wn&&un!==wn),Es=o.useMemo(()=>ct.map(l=>({kind:"command",command:l})),[ct]),Qn=o.useMemo(()=>[...ro(y,"").map(l=>({kind:"action",action:l})),...oo(b,"").map(l=>({kind:"app-context",app:l}))],[y,b]),Ht=o.useMemo(()=>Bs(Pe,"").map(l=>({kind:"skill",skill:l})),[Pe]),Vt=o.useMemo(()=>{const l=[{id:"add",items:e==="work"?[{kind:"files"},{kind:"folder"}]:[{kind:"files"}],label:"Add"}];return Qn.length>0&&l.push({id:"slash",items:Qn.map(d=>({kind:"slash",item:d})),label:"Agents and actions",queryScope:"slash"}),Ht.length>0&&l.push({id:"skills",items:Ht.map(d=>({kind:"slash",item:d})),label:"Skills",queryScopes:["slash","mentions"]}),l.push({id:"openpond",items:Es.map(d=>({kind:"slash",item:d})),label:"OpenPond",grid:!0,queryScope:"slash"}),l.push({emptyLabel:"No mentions available",id:"mentions",items:dt.map(d=>({kind:"mention",item:d})),label:"@"}),l},[dt,Es,Ht,Qn,e]),Xn=o.useMemo(()=>Al(Vt,bt),[bt,Vt]),we=o.useMemo(()=>Xn.flatMap(l=>l.items),[Xn]);o.useEffect(()=>{Ae&&Dt(l=>l<we.length?l:0)},[we.length,Ae]);const It=!!v,Jn=It&&v?.tone==="active",ar=Jn?"Pause goal":"Stop response",As=Jn?"pause":"stop",ir=e==="work"||be.value!=="none",Oe=Ar(hn,S,L),Wt=Ot?.scopeKey===S?Ot.draftId:null,mt=o.useMemo(()=>Oe.find(l=>l.id===zt)??null,[zt,Oe]);function nt(l,d){Fn(T=>Di(T,l,d,l===S?L:[]))}o.useLayoutEffect(()=>{ee.current?.resize()},[Te.length,xn,A,v,u,Ye,dn,yt]),o.useEffect(()=>{if(!re){Et.current=!1;return}Et.current||He||(Et.current=!0,window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(u.length)}))},[re,He,u.length]),o.useEffect(()=>{!ue||rn.current===ue||He||(rn.current=ue,window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(u.length)}))},[ue,He,u.length]),o.useEffect(()=>{v||mn(!1)},[v]),o.useEffect(()=>{Ye&&!y.some(l=>l.id===Ye)&&(at(null),De(null))},[y,Ye]),o.useEffect(()=>{if(!w||w.requestId<=Me.current)return;const l=y.find(d=>d.id===w.actionId);l&&(Me.current=w.requestId,at(l.id),it(null),De(0),lt(null),G(""),xe(0),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(0,{afterToken:!0})}))},[y,G,w]),o.useEffect(()=>{!ke&&!ye||De(l=>l===null?0:Math.max(0,Math.min(l,u.length)))},[u.length,ke,ye]),o.useEffect(()=>{if(!m||!st)return;const l=b.find(d=>d.id===m);(!l||!ca(u,l))&&st(null)},[b,st,u,m]);const{actionMenuStyle:Ge,addMenuStyle:lr,mentionMenuStyle:Zn,skillMenuStyle:Yn}=Cc({activeMentionKey:_t,activeSkillKey:jn,activeSlashKey:wn,addMenuIndex:bs,addMenuItems:we,addMenuOpen:Ae,addMenuPanelRef:Nt,addMenuRef:Mt,attachmentCount:Te.length,composerRef:ge,createImproveActive:!!A,goalRuntimeActive:!!v,inputRef:ee,inputShellRef:ze,mentionQuery:ve?.query,prompt:u,selectedActionId:Ye,selectAddMenuItem:$s,setActionIndex:Ee,setActionMenuDismissedPrompt:gt,setAddMenuIndex:Dt,setAddMenuOpen:kt,setAddMenuQuery:Je,setMentionMenuDismissedPrompt:cn,setMentionIndex:an,setSkillIndex:ln,setSkillMenuDismissedPrompt:At,skillMatchCount:Ve.length,skillQuery:X?.query,slashMatchCount:We.length,slashQuery:se?.query,showActionMenu:ft,showMentionMenu:qt,showSkillMenu:Gn});function ht(){at(null),it(null),De(null),lt(null)}function Gt(l){qe(l.trim()),Bn(!0)}function es(){Fe||(Bn(!1),ht())}function cr(){ht(),G(""),xe(0)}async function ts(){const l=S;on.current.add(l);const d=await(Jn&&_e?_e():ne());return d===!1&&on.current.delete(l),d}function $t(l,d){const T=Math.max(0,Math.min(me,u.length)),P=d?Math.max(0,Math.min(d.start,u.length)):T,O=d?Math.max(P,Math.min(d.end,u.length)):P,Z=u.slice(0,P),Re=u.slice(O),wt=Z&&!/\s$/.test(Z)?" ":"",Zt=Re&&!/^\s/.test(Re)?" ":"",Yt=`${fa(l)} `,pt=`${wt}${Yt}${Zt}`,en=`${Z}${pt}${Re}`,Qe=Z.length+pt.length;return G(en),st?.(l.id),xe(Qe),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(Qe)}),Qe}function ns(l){if(!ve)return;const d=Math.max(0,Math.min(me,u.length));$t(l,{start:ve.start,end:d})}function Kt(l,d,T=null){const P=Math.max(0,Math.min(me,u.length)),O=d?Math.max(0,Math.min(d.start,u.length)):P,Z=d?Math.max(O,Math.min(d.end,u.length)):O,Re=`${u.slice(0,O)}${u.slice(Z)}`;return at(l.id),it(null),De(O),lt(T?.startsWith("@")?T:null),gt(null),G(Re),xe(O),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(O,{afterToken:!0})}),O}function Sn(l){if(!ve)return;const d=Math.max(0,Math.min(me,u.length)),T=Math.max(0,Math.min(ve.start,u.length)),P=Math.max(T,Math.min(d,u.length));Kt(l,{start:T,end:P},u.slice(T,P).trim())}function Cn(l,d){const T=Math.max(0,Math.min(me,u.length)),P=d?Math.max(0,Math.min(d.start,u.length)):T,O=d?Math.max(P,Math.min(d.end,u.length)):P,Z=u.slice(0,P),Re=u.slice(O),wt=Z&&!/\s$/.test(Z)?" ":"",Zt=Re&&!/^\s/.test(Re)?" ":"",Yt=`${ma(l)} `,pt=`${wt}${Yt}${Zt}`,en=`${Z}${pt}${Re}`,Qe=Z.length+pt.length;return G(en),xe(Qe),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(Qe)}),Qe}function Ts(l){if(!ve)return;const d=Math.max(0,Math.min(me,u.length));Cn(l,{start:ve.start,end:d})}function Qt(l,d){const T=Math.max(0,Math.min(me,u.length)),P=d?Math.max(0,Math.min(d.start,u.length)):T,O=d?Math.max(P,Math.min(d.end,u.length)):P,Z=l.handle||_n(l.name),Re=u.slice(0,P),wt=u.slice(O),Zt=Re&&!/\s$/.test(Re)?" ":"",Yt=wt&&!/^\s/.test(wt)?" ":"",pt=`${Zt}@${Z} ${Yt}`,en=`${Re}${pt}${wt}`,Qe=Re.length+pt.length;return G(en),xe(Qe),window.requestAnimationFrame(()=>ee.current?.focusAtPromptIndex(Qe)),Qe}function ss(l){if(l.kind==="team-member"){if(!ve)return;const d=Math.max(0,Math.min(me,u.length));Qt(l.member,{start:ve.start,end:d});return}if(l.kind==="app"){ns(l.app);return}if(l.kind==="connected-app"){Ts(l.app);return}if(l.kind==="skill"){if(!ve)return;const d=Math.max(0,Math.min(me,u.length));Xt(l.skill,{start:ve.start,end:d});return}Sn(l.action)}function rs(l){se&&(gt(null),$t(l,{start:se.start,end:se.end}))}function Rs(l){se&&Kt(l,se)}function os(l,d){const T=Math.max(0,Math.min(me,u.length)),P=d?Math.max(0,Math.min(d.start,u.length)):T,O=d?Math.max(P,Math.min(d.end,u.length)):P,Z=`${u.slice(0,P)}${u.slice(O)}`;return it(l.id),at(null),De(P),lt(null),gt(null),G(Z),xe(P),l.id==="submit-issue"&&Gt(Z),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(P,{afterToken:!0})}),P}function as(l){se&&os(l,se)}function Mn(l){if(l.kind==="command"){as(l.command);return}if(l.kind==="app-context"){rs(l.app);return}if(l.kind==="skill"){if(!se)return;Xt(l.skill,se);return}Rs(l.action)}function Xt(l,d){const T=Ci(u,d,l);return At(null),cn(null),gt(null),G(T.value),xe(T.cursor),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(T.cursor)}),T.cursor}function is(l){X&&Xt(l,X)}function ls(){Ie.current?.click()}function _s(){$e.current?.click()}function Ke(l){rt.current=l,Je(""),Dt(0)}function Is(){const l=Math.max(0,Math.min(me,u.length)),d=Math.max(0,Math.min(rt.current,u.length));return l>=d?{start:d,end:l}:{start:l,end:l}}function $s(l){const d=Is();if(kt(!1),Je(""),l.kind==="files"||l.kind==="folder"){if(d.start!==d.end){const T=`${u.slice(0,d.start)}${u.slice(d.end)}`;G(T),xe(d.start)}Ke(d.start),l.kind==="folder"?_s():ls();return}if(l.kind==="slash"){if(l.item.kind==="command"){Ke(os(l.item.command,d));return}if(l.item.kind==="app-context"){Ke($t(l.item.app,d));return}if(l.item.kind==="skill"){Ke(Xt(l.item.skill,d));return}Ke(Kt(l.item.action,d));return}if(l.item.kind==="team-member"){Ke(Qt(l.item.member,d));return}if(l.item.kind==="app"){Ke($t(l.item.app,d));return}if(l.item.kind==="connected-app"){Ke(Cn(l.item.app,d));return}if(l.item.kind==="skill"){Ke(Xt(l.item.skill,d));return}Ke(Kt(l.item.action,d))}function ur(){const l=u.trim();if(!l||Vn)return;nt(S,T=>[...T,$i(l)]),cr(),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(0)})}async function Ps(l,d="manual"){const T=S;if(yn(T)||Ot?.scopeKey===T)return!1;const P=Ar(hn,T,L).find(O=>O.id===l);if(!P||!kn(T))return!1;pn({draftId:l,scopeKey:T}),Rt(null);try{if(E&&await ne()===!1)return!1;const O=await N([],null,null,{preservePrompt:!0,promptOverride:P.prompt});return O&&d==="auto"&&Ln.current.add(T),nt(T,Z=>Li(Z,l,O)),O}catch(O){return Rt(O instanceof Error?O.message:String(O)),!1}finally{Wn(T),pn(O=>O?.scopeKey===T&&O.draftId===l?null:O)}}function Ls(l){Wt!==l&&(zt===l&&(Ue(null),et("")),nt(S,d=>qs(d,l)))}function dr(l){if(Oi({attachmentCount:Te.length,hasSelectedAction:!!Ye,hasSelectedCommand:!!dn,prompt:u})==="load_composer"){nt(S,T=>qs(T,l.id)),G(l.prompt),xe(l.prompt.length),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(l.prompt.length)});return}Ue(l.id),et(l.prompt)}function cs(){Ue(null),et("")}function fr(){!mt||!J.trim()||(nt(S,l=>Pi(l,mt.id,J.trim())),cs())}function mr(){if(!mt||!J.trim())return;const l=J.trim();nt(S,d=>qs(d,mt.id)),cs(),G(l),xe(l.length),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(l.length)})}async function Jt(){if(Ss())return;const l=ke||ye?null:go(u);if(ye?.id==="submit-issue"||l?.command==="submit-issue"){Gt(l?.command==="submit-issue"?l.args:u);return}if(ws)return;const d=S;if(kn(d)){kt(!1),Rt(null);try{if(E&&await ne()===!1)return;const T=Js();try{fn(T.length>0?d:null);let P;try{P=await Promise.all(T.map(uc))}finally{rr(d)}const O=ke&&jt&&!u.trim()?jt:void 0,Z=await N(P,ke,ye,jt||O?{...jt?{displayPrompt:jt}:{},...O?{promptOverride:O}:{}}:void 0);qn(T,Z?"dispose":"restore"),Z&&!da(ke)&&ht()}catch(P){throw qn(T,"restore"),P}}catch(T){Rt(T instanceof Error?T.message:String(T))}finally{Wn(d),rr(d)}}}async function Nn(l){if(Ss()||Fe)return!1;const d=S;if(!kn(d))return!1;Tt(!0),kt(!1),Rt(null);try{if(E&&await ne()===!1)return!1;const T=await N([],null,Ec,{displayPrompt:`/submit-issue ${l.title.trim()}`,promptOverride:ua(l)});return T&&(Bn(!1),ht()),T}catch(T){return Rt(T instanceof Error?T.message:String(T)),!1}finally{Wn(d),Tt(!1)}}o.useEffect(()=>{const l=S;if(E){Ln.current.delete(l),Be.current.add(l);return}if(on.current.has(l)||I){on.current.delete(l),Be.current.delete(l);return}const d=Be.current.has(l);if(d&&!j)return;const T=zi({autoDispatchReady:j&&!A,hasQueuedDrafts:Oe.length>0,running:E,sending:!!Wt||yn(l),waitingForStartedTurn:Ln.current.has(l),wasRunning:d});if(Be.current.delete(l),!T)return;const P=Oe[0];P&&Ps(P.id,"auto")},[A,E,Wt,I,j,Oe,S]);function En(l){const T=Mi(u,l,me);G(T.value),xe(T.cursorIndex),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(T.cursorIndex)})}return t.jsxs("form",{ref:ge,className:`composer ${n} ${A?"has-create-runtime":""} ${It?"has-goal-runtime":""} ${Ut?"is-steering":""} ${Te.length>0?"has-attachments":""} ${ke||ye?"has-selected-action":""} ${xn?"has-attachment-error":""} ${Ae?"has-add-menu":""}`,onSubmit:l=>{l.preventDefault(),Jt()},children:[t.jsx("input",{webkitdirectory:"",ref:$e,className:"composer-file-input",type:"file",multiple:!0,tabIndex:-1,onChange:l=>{vt(Array.from(l.currentTarget.files??[])),l.currentTarget.value=""}}),qt&&t.jsx(_l,{items:tt,mentionIndex:Lt,onSelect:ss,onSelectIndex:an,style:Zn}),Gn&&t.jsx(Vl,{items:Ve,onSelect:is,onSelectIndex:ln,skillIndex:ps,style:Yn}),ft&&t.jsx(Wl,{actionCatalogCount:y.length,actionIndex:xs,items:We,onSelect:Mn,onSelectIndex:Ee,style:Ge}),t.jsx(Gl,{busy:Fe,initialDescription:Xs,open:gs,onClose:es,onSubmit:Nn}),D&&t.jsxs("div",{className:"composer-footer",children:[D?t.jsx(Ei,{busy:p||be.busy,placement:bn,state:be,onChange:Ne}):null,de&&z?t.jsx(Mo,{busy:p,placement:bn,state:de,onChange:z}):null,ir?t.jsx(Ai,{busy:p,placement:bn,state:_,onChange:Y}):null]}),!D&&e==="work"&&t.jsx(Ti,{project:be,workspace:_}),A?t.jsx(o.Suspense,{fallback:null,children:t.jsx(Mc,{runtime:A})}):null,t.jsx(Fi,{drafts:Oe,editDraftValue:J,editingDraft:mt,sendingDraftId:Wt,onCancelEdit:cs,onDeleteDraft:Ls,onEditDraft:dr,onEditDraftValueChange:et,onReplaceComposerDraft:mr,onSaveQueuedDraft:fr,onSteerDraft:l=>{Ps(l)}}),It&&v&&t.jsx(_i,{detailsOpen:zn,goalRuntime:v,objectiveId:er,subagentRuntime:C,onToggleDetails:()=>mn(l=>!l)}),x&&t.jsx("div",{className:`composer-notice ${x.tone}`,role:"status",children:x.message}),t.jsxs("div",{className:"composer-input-shell",ref:ze,children:[Ae&&s!=="team"&&t.jsx(Lr,{id:vs,ariaLabel:"Add to message",className:"composer-add-command-menu",menuIndex:bs,menuRef:Nt,sections:Xn,style:lr,variant:"add",onSelect:$s,onSelectIndex:Dt}),Te.length>0&&t.jsx("div",{className:"composer-attachments","aria-label":"Selected attachments",children:Te.map(l=>t.jsx(ic,{attachment:l,onRemove:()=>Un(l.id)},l.id))}),xn&&t.jsx("div",{className:"composer-attachment-error",role:"status",children:xn}),t.jsx("div",{className:"composer-textarea-frame",onClick:l=>{l.target===l.currentTarget&&ee.current?.focusAtPromptIndex(me)},children:t.jsx(yl,{ref:ee,connectedAppMentions:k,disabled:He,onCursorChange:xe,onKeyDown:l=>{if(Ae&&["ArrowDown","ArrowUp","Home","End","Enter","Escape"].includes(l.key)){l.preventDefault();return}if(qt){if(l.key==="ArrowDown"){l.preventDefault(),an(d=>(d+1)%tt.length);return}if(l.key==="ArrowUp"){l.preventDefault(),an(d=>(d-1+tt.length)%tt.length);return}if(l.key==="Enter"||l.key==="Tab"){l.preventDefault(),ss(tt[Lt]??tt[0]);return}if(l.key==="Escape"){l.preventDefault(),cn(_t);return}}if(Gn){if(Ve.length>0&&l.key==="ArrowDown"){l.preventDefault(),ln(d=>(d+1)%Ve.length);return}if(Ve.length>0&&l.key==="ArrowUp"){l.preventDefault(),ln(d=>(d-1+Ve.length)%Ve.length);return}if(Ve.length>0&&(l.key==="Enter"||l.key==="Tab")){l.preventDefault(),is(Ve[ps]??Ve[0]);return}if(l.key==="Escape"){l.preventDefault(),At(jn??u);return}}if(ft){if(We.length>0&&l.key==="ArrowDown"){l.preventDefault(),Ee(d=>(d+1)%We.length);return}if(We.length>0&&l.key==="ArrowUp"){l.preventDefault(),Ee(d=>(d-1+We.length)%We.length);return}if(We.length>0&&(l.key==="Enter"||l.key==="Tab")){l.preventDefault(),Mn(We[xs]??We[0]);return}if(l.key==="Escape"){l.preventDefault(),gt(wn??u);return}}if((ke||ye)&&l.key==="Backspace"&&me===(yt??0)){l.preventDefault(),ht();return}l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),Bt&&!ut&&Jt())},onPasteFiles:vt,onPasteTextAsAttachment:ks,onPromptChange:(l,d)=>{if(Ae){const P=Math.max(0,Math.min(rt.current,l.length));d<P?(rt.current=d,Je("")):Je(l.slice(P,d))}const T=s==="team"?null:bc(l,d,ct);if(T){const P=`${l.slice(0,T.start)}${l.slice(T.end)}`,O=T.start;G(l),xe(d),window.requestAnimationFrame(()=>{it(T.command.id),at(null),De(O),gt(null),G(P),xe(O),T.command.id==="submit-issue"&&Gt(P),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(O,{afterToken:!0})})});return}G(l)},onTokenPositionChange:l=>{if(!(!ke&&!ye)){if(l===null){ht();return}De(l)}},placeholder:ys,prompt:u,token:js})}),t.jsx(Ul,{surface:s,teamUseModel:r,teamUseModelLocked:a,onTeamUseModelChange:c,addFiles:vt,addMenuId:vs,addMenuOpen:Ae,addMenuRef:Mt,busy:p,codexPermissionMode:U,codexReasoningEffort:oe,connection:B,contextStatusStyle:tr,contextStatusTooltipId:Ys,contextWindowStatus:f,disabled:nr,dropdownPlacement:bn,fileInputRef:Ie,modelValue:Zs,modelOptions:vn,openPondCommandAccessMode:fe,showCommandAccess:Ft,profileTarget:D?null:de,onCodexPermissionModeChange:ae,onCodexReasoningEffortChange:F,onOpenPondCommandAccessModeChange:he,onProfileTargetChange:z,onModelChange:V,onOpenFilePicker:ls,onProviderChange:$,onProviderSetupOpen:Ce,onQueueDraft:ur,onStop:ts,onToggleAddMenu:()=>{const l=Math.max(0,Math.min(me,u.length));Ae||(rt.current=l,Je(""),Dt(0),kt(!0)),window.requestAnimationFrame(()=>{ee.current?.focusAtPromptIndex(l)})},onTranscript:En,provider:Q,providerSettings:H,providerOptions:or,queueDraftDisabled:Vn,queueDraftTooltip:sr,running:E&&!Bt,sendDisabled:ws,sendTooltip:gn,showToast:M,stopIcon:As,stopLabel:ar,steering:Ut})]})]})}const io=o.memo(function({draftStore:n,...s}){const r=ha(n);return t.jsx(pa,{id:"composer",children:t.jsx(Ac,{...s,prompt:r,onPromptChange:n.set})})});function lo({approval:e,onResolve:n}){const[s,r]=o.useState(null);if(o.useEffect(()=>{r(null)},[e?.id]),!e||e.kind==="create_plan")return null;const a=Tc(e.detail),i=e.kind!=="subagent_patch_apply";async function c(u){if(!(!e||s)){r(u);try{await n(e.id,u)}catch{r(null)}}}return t.jsx("div",{className:"approval-request-shell",role:"status","aria-live":"polite",children:t.jsxs("section",{className:"approval-request-card","aria-label":`${co(e.kind)} approval request`,children:[t.jsxs("div",{className:"approval-request-copy",children:[t.jsx("div",{className:"approval-request-header",children:t.jsx("span",{children:co(e.kind)})}),t.jsx("code",{className:"approval-request-title",title:e.title,children:e.title}),a&&a!==e.title&&t.jsxs("details",{className:"approval-request-details",children:[t.jsx("summary",{children:"Details"}),t.jsx("pre",{children:a})]})]}),t.jsxs("div",{className:"approval-request-actions",children:[t.jsxs("button",{type:"button",className:"approval-action primary",disabled:!!s,onClick:()=>{c("accept")},children:[t.jsx(Ct,{size:14}),t.jsx("span",{children:s==="accept"?"Approving":"Approve"})]}),i?t.jsxs("button",{type:"button",className:"approval-action",title:"Approve for the rest of this session",disabled:!!s,onClick:()=>{c("acceptForSession")},children:[t.jsx(ri,{size:14}),t.jsx("span",{children:s==="acceptForSession"?"Approving":"Session"})]}):null,t.jsxs("button",{type:"button",className:"approval-action muted",disabled:!!s,onClick:()=>{c("decline")},children:[t.jsx(ai,{size:14}),t.jsx("span",{children:s==="decline"?"Denying":"Deny"})]}),t.jsx("button",{type:"button",className:"approval-action icon-only",title:"Cancel task","aria-label":"Cancel task",disabled:!!s,onClick:()=>{c("cancel")},children:t.jsx(Ws,{size:15})})]})]})})}function co(e){return e==="create_plan"?"Plan review":e==="subagent_patch_apply"?"Subagent patch":e==="file_change"||e==="legacy_patch"?"File change":e==="permissions"?"Permissions":e==="user_input"?"Input needed":"Command"}function Tc(e){const n=e.trim();if(!n)return"";try{return JSON.stringify(JSON.parse(n),null,2)}catch{return n}}const Rc=/\.(?:m4v|mov|mp4|webm)$/i;function _c(e){return Rc.test(e.trim().split(/[?#]/,1)[0]??"")}function Ic(e,n){let s=e.trim();if(!s||!_c(s))return null;if(/^file:\/\//i.test(s))try{s=decodeURIComponent(new URL(s).pathname)}catch{s=s.replace(/^file:\/\//i,"")}if(/^\//.test(s)||/^[A-Za-z]:[\\/]/.test(s))return s;const r=n?.trim().replace(/[\\/]+$/,"");return r?`${r}/${s.replace(/^\.\//,"")}`:null}function $c(e,n={}){const s=Pc(e),r=e.map(a=>({id:`message:${a.id}`,type:"message",message:a,showFooter:a.id===s}));return n.showThinkingIndicator&&r.push({id:"thinking",type:"thinking"}),r}function Pc(e){for(let n=e.length-1;n>=0;n-=1){const s=e[n];if(s.role==="assistant")return s.id}return null}function Lc(e){const n=e[e.length-1];if(!n)return!0;if(n.role==="assistant"||n.role==="error"||n.role==="status_divider"&&n.statusState==="running")return!1;if(n.role==="activity_group"){if(n.traceState==="running")return!1;const s=n.activities?.[n.activities.length-1]??null;return s?.state!=="running"&&s?.state!=="pending"}return!0}function Dc(e){const n=[];if(e.localWorkspaceId&&n.push({value:"local",label:"Local"}),(e.sandboxSourceAvailable??!!e.sandboxWorkspaceId)&&n.push({value:"sandbox",label:"Sandbox"}),n.length===0)return{source:null,options:n};const s=new Set(n.map(a=>a.value));if(e.override&&s.has(e.override))return{source:e.override,options:n};const r=e.workspaceTarget==="local"?"local":"sandbox";return s.has(r)?{source:r,options:n}:{source:n[0].value,options:n}}const Oc=new Set(["create","edit","help","list"]);function zc(e,n,s=null){return Fc(e)}function Fc(e){const n=e.trim();if(!n)return"/skill";const[s=""]=n.split(/\s+/,1);return Oc.has(s.toLowerCase())?`/skill ${n}`:`/skill create ${n}`}async function Bc(e){const n=e.session?.currentProfile??null,s=e.session?await e.patchSession(e.session.id,e.ref):null;try{return{selected:await e.selectProfile(e.ref),session:s}}catch(r){if(s)try{await e.patchSession(s.id,n)}catch{}throw r}}const Uc=o.lazy(()=>je(()=>import("./TerminalOverlay-XhABQsCB.js"),__vite__mapDeps([7,1,2,8]),import.meta.url).then(e=>({default:e.TerminalOverlay})));function qc({open:e,connection:n,scope:s,tabs:r,onTabsChange:a,cwd:i,appId:c,workspaceName:u,queuedCommand:x,onClose:b}){const[k,h]=o.useState(!1);return o.useEffect(()=>{e&&h(!0)},[e]),k?t.jsx(o.Suspense,{fallback:null,children:t.jsx(Uc,{open:e,connection:n,scope:s,tabs:r,onTabsChange:a,cwd:i,appId:c,workspaceName:u,queuedCommand:x,onClose:b})}):null}function Hc({expanded:e,terminalOpen:n,sideChatAvailable:s,onOpenBrowser:r,onOpenFiles:a,onOpenReview:i,onOpenSideChat:c,onOpenTrainingDraft:u,trainingDraftAvailable:x,onResizeStart:b,onToggleExpanded:k,onToggleTerminal:h}){const m=[{id:"review",label:"Review",meta:"Diffs",icon:Ha,onSelect:i},{id:"files",label:"Files",meta:"Workspace",icon:So,onSelect:a},{id:"browser",label:"Browser",meta:"Preview",icon:ba,onSelect:r},{id:"side-chat",label:"Side chat",meta:"Context",icon:ga,onSelect:c,disabled:!s},{id:"training-draft",label:"Task draft",meta:"Training",icon:yo,onSelect:u,disabled:!x},{id:"terminal",label:n?"Hide terminal":"Terminal",meta:"Shell",icon:po,onSelect:h}];return t.jsxs("aside",{className:`workspace-diff-panel right-sidebar-home-panel ${e?"expanded":""}`,"aria-label":"Right sidebar",children:[e?null:t.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize right sidebar",onPointerDown:b}),t.jsxs("div",{className:"workspace-diff-topbar right-sidebar-home-topbar",children:[t.jsx("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Right sidebar views",children:t.jsxs("button",{type:"button",className:"workspace-diff-tab active",role:"tab","aria-selected":!0,children:[t.jsx(xa,{size:14}),t.jsx("span",{children:"Workspace"})]})}),t.jsx("div",{className:"workspace-diff-toolbar-actions",children:t.jsx("button",{type:"button",className:"diff-icon-button",title:e?"Dock sidebar":"Expand sidebar","aria-label":e?"Dock sidebar":"Expand sidebar",onClick:k,children:e?t.jsx(jo,{size:14}):t.jsx(ko,{size:14})})})]}),t.jsx("div",{className:"right-sidebar-home-body",children:t.jsx("div",{className:"right-sidebar-home-actions",role:"menu","aria-label":"Workspace actions",children:m.map(f=>t.jsxs("button",{type:"button",className:"right-sidebar-home-row",role:"menuitem",disabled:f.disabled,onClick:f.onSelect,children:[t.jsx(f.icon,{size:15}),t.jsx("span",{children:f.label}),f.meta?t.jsx("span",{className:"right-sidebar-home-chip",children:f.meta}):null]},f.id))})})]})}function Vc({chatMessages:e,connection:n,contextWindowStatus:s,expanded:r,runtimeEvents:a,sessionId:i,showToast:c,onResizeStart:u,onToggleExpanded:x,onUseOutput:b,onHandoffOutput:k,onReviseOutput:h,onAgentPackageInstalled:m}){const[f,v]=o.useState("outputs"),[C,A]=o.useState(null),[p,E]=o.useState(null),[S,L]=o.useState(""),[j,I]=o.useState({}),D=o.useMemo(()=>Gc(a),[a]),re=o.useMemo(()=>Kc(D),[D]),ue=o.useMemo(()=>Wc(e),[e]),le=o.useMemo(()=>Qc(e),[e]);o.useEffect(()=>()=>{p?.objectUrl&&URL.revokeObjectURL(p.objectUrl)},[p?.objectUrl]);async function B(y){if(!n||!i||y.kind!=="file")return null;A(Xe(y));try{const w=await Se.workspaceTool(n,i,{action:"work_output_read",source:"ui_button",args:{outputId:y.id,revision:y.revision}});if(!w.ok)throw new Error(w.output);const _=Yc(w.data),U=typeof _.contentsBase64=="string"?_.contentsBase64:"";if(!U)throw new Error("The output did not include file data.");return new File([Jc(U)],y.title,{type:y.contentType})}catch(w){return c(w instanceof Error?w.message:"Could not load the output.","error"),null}finally{A(null)}}async function H(y){const w=await B(y);if(!w)return;p?.objectUrl&&URL.revokeObjectURL(p.objectUrl);const _=y.kind==="file"&&(y.contentType.startsWith("text/")||y.contentType==="application/json");L(""),E({output:y,file:w,text:_?await w.text():null,objectUrl:_?null:URL.createObjectURL(w)})}async function Q(y){const w=await B(y);w&&(b(w),c("Added the output to the task as input.","success"))}async function pe(y,w){const _=w.kind==="file"?await B(w):null;w.kind==="file"&&!_||await k(y,w,_)}async function be(y){if(!(!n||!i)&&window.confirm(`Delete ${y.title} revision ${y.revision} from this device?`)){A(Xe(y));try{const w=await Se.workspaceTool(n,i,{action:"work_output_delete",source:"ui_button",args:{outputId:y.id,revision:y.revision}});if(!w.ok)throw new Error(w.output);p?.output.id===y.id&&E(null),c("Work output deleted.","success")}catch(w){c(w instanceof Error?w.message:"Could not delete the output.","error")}finally{A(null)}}}async function de(y){if(!n||!i||!window.confirm(`Add ${y.title} version ${y.versionId} to your active Agents profile?`))return;const w=async _=>Se.workspaceTool(n,i,{action:"work_agent_package_install",source:"ui_button",args:{outputId:y.id,revision:y.revision,overwrite:_}});A(Xe(y));try{let _;try{_=await w(!1)}catch(U){if(!(U instanceof Error?U.message:"Agent installation failed.").includes("already exists")||!window.confirm(`${y.agentId} already exists. Replace its active checkout with this immutable version?`))throw U;_=await w(!0)}if(!_.ok)throw new Error(_.output);await m?.(),c(`${y.title} was added to Agents. Its package remains available in this Work task.`,"success")}catch(_){c(_ instanceof Error?_.message:"Could not add the Agent package.","error")}finally{A(null)}}return t.jsxs("aside",{className:`workspace-diff-panel work-sidebar-panel ${r?"expanded":""}`,"aria-label":"Work details",children:[r?null:t.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize Work details",onPointerDown:u}),t.jsxs("div",{className:"workspace-diff-topbar",children:[t.jsx("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Work details",children:[["outputs","Outputs"],["activity","Activity"],["context","Context"]].map(([y,w])=>t.jsx("button",{type:"button",className:`workspace-diff-tab ${f===y?"active":""}`,role:"tab","aria-selected":f===y,onClick:()=>v(y),children:w},y))}),t.jsx("div",{className:"workspace-diff-toolbar-actions",children:t.jsx("button",{type:"button",className:"diff-icon-button",title:r?"Dock sidebar":"Expand sidebar","aria-label":r?"Dock sidebar":"Expand sidebar",onClick:x,children:r?t.jsx(jo,{size:14}):t.jsx(ko,{size:14})})})]}),t.jsxs("div",{className:"work-sidebar-body",children:[f==="outputs"?p?t.jsxs("div",{className:"work-output-preview",children:[t.jsxs("header",{children:[t.jsx("button",{type:"button",onClick:()=>{p.objectUrl&&URL.revokeObjectURL(p.objectUrl),E(null)},children:"Outputs"}),t.jsxs("strong",{children:[p.output.title," · revision ",p.output.revision]})]}),p.text!==null?t.jsx(Va,{content:p.text}):p.output.kind==="file"&&p.output.contentType.startsWith("image/")&&p.objectUrl?t.jsx("img",{src:p.objectUrl,alt:p.output.title}):p.output.kind==="file"&&p.output.contentType==="application/pdf"&&p.objectUrl?t.jsx("iframe",{src:p.objectUrl,title:p.output.title}):p.output.kind==="file"&&p.output.contentType.startsWith("audio/")&&p.objectUrl?t.jsx("audio",{controls:!0,src:p.objectUrl}):p.output.kind==="file"&&p.output.contentType.startsWith("video/")&&p.objectUrl?t.jsx("video",{controls:!0,src:p.objectUrl}):t.jsx("p",{children:"This file type uses its native application for detailed review."}),t.jsxs("section",{className:"work-output-annotation",children:[t.jsx("label",{htmlFor:"work-output-revision-note",children:"Revision note"}),t.jsx("textarea",{id:"work-output-revision-note",value:S,onChange:y=>L(y.target.value),placeholder:"Describe the exact change to make in the next revision."}),t.jsx("button",{type:"button",disabled:!S.trim(),onClick:()=>{h(p.output,p.file,S.trim()),c(`Prepared revision ${p.output.revision+1}.`,"success")},children:"Revise this version"})]})]}):re.length>0?t.jsx("div",{className:"work-output-list",children:re.map(y=>{const w=y.revisions.find(_=>_.revision===j[y.id])??y.revisions[0];return t.jsxs("article",{className:"work-output-card",children:[t.jsxs("header",{children:[t.jsx(sn,{size:16}),t.jsxs("span",{children:[t.jsx("strong",{children:w.title}),y.revisions.length>1?t.jsxs("label",{className:"work-output-version",children:[t.jsx("span",{children:"Version"}),t.jsx("select",{value:w.revision,onChange:_=>I(U=>({...U,[y.id]:Number(_.target.value)})),children:y.revisions.map(_=>t.jsxs("option",{value:_.revision,children:["Revision ",_.revision]},Xe(_)))})]}):t.jsxs("small",{children:["Revision ",w.revision]}),t.jsx("small",{children:Xc(w)})]})]}),w.validation.length>0?t.jsxs("div",{className:"work-output-validation",children:[t.jsx(ka,{size:13}),t.jsxs("span",{children:[w.validation.filter(_=>_.status==="passed").length," ","checks passed"]})]}):null,t.jsxs("div",{className:"work-output-actions",children:[w.kind==="file"&&w.location.kind==="local"?t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",onClick:()=>{Wa(fo(w))},children:[t.jsx(So,{size:13}),"Reveal"]}),t.jsx("button",{type:"button",onClick:async()=>{const _=await Ga(fo(w),w.title);_.ok?c("Saved a copy of the Work output.","success"):_.canceled||c("Could not save a copy of the Work output.","error")},children:"Save as"})]}):null,w.kind==="file"?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",disabled:C===Xe(w),onClick:()=>{H(w)},children:"Preview"}),t.jsxs("button",{type:"button",disabled:C===Xe(w),onClick:()=>{Q(w)},children:[t.jsx(Hs,{size:13}),"Use as input"]})]}):w.kind==="agent_package"?t.jsx("button",{type:"button",disabled:C===Xe(w),onClick:()=>{de(w)},children:"Add to Agents"}):"url"in w&&w.url?t.jsx("button",{type:"button",onClick:()=>window.open(w.url,"_blank","noopener,noreferrer"),children:"Open"}):null,w.kind==="file"&&w.location.kind==="local"?t.jsxs("button",{type:"button",className:"danger",disabled:C===Xe(w),onClick:()=>{be(w)},children:[t.jsx(vo,{size:13}),"Delete"]}):null,t.jsx("button",{type:"button",disabled:C===Xe(w),onClick:()=>{pe("chat",w)},children:"Continue in Chat"}),t.jsx("button",{type:"button",disabled:C===Xe(w),onClick:()=>{pe("work",w)},children:"Continue in repository Work"})]})]},y.id)})}):t.jsx(uo,{icon:sn,title:"No saved outputs yet",detail:"Finished files and connected results will appear here."}):null,f==="activity"?ue.length>0?t.jsx("div",{className:"work-activity-list",children:ue.map(y=>t.jsxs("details",{className:`work-activity-row ${y.state??""}`,children:[t.jsxs("summary",{children:[t.jsx(Fr,{size:14}),t.jsx("span",{children:y.label}),t.jsx("small",{children:y.state??"completed"})]}),t.jsx("p",{children:y.content}),y.detail?t.jsx("pre",{children:y.detail}):null]},y.id))}):t.jsx(uo,{icon:Fr,title:"No activity yet",detail:"Commands, tool receipts, and checks appear while Work runs."}):null,f==="context"?t.jsxs("div",{className:"work-context",children:[t.jsxs("section",{children:[t.jsx("h3",{children:"Model context"}),t.jsx("p",{children:s.summary}),t.jsx("small",{children:s.tokensLabel})]}),t.jsxs("section",{children:[t.jsx("h3",{children:"Task inputs and sources"}),le.length>0?t.jsx("ul",{children:le.map(y=>t.jsxs("li",{children:[t.jsx(Hs,{size:13}),t.jsxs("span",{children:[t.jsx("strong",{children:y.title}),t.jsx("small",{children:y.detail})]})]},y.key))}):t.jsx("p",{children:"No attached files or cited sources yet."})]})]}):null]})]})}function Wc(e){return e.flatMap(n=>n.activities??[]).filter(n=>n.kind!=="reasoning").reverse()}function Gc(e){const n=new Map,s=new Set;for(const r of e){const a=_r(r.data);if(r.action==="work_output_delete"&&r.status==="completed"){for(const i of a){const c=Xe(i);s.add(c),n.delete(c)}continue}if(r.action!=="work_output_read")for(const i of a){const c=Xe(i);s.has(c)||n.set(c,i)}}return[...n.values()].sort((r,a)=>a.createdAt.localeCompare(r.createdAt)||a.revision-r.revision)}function Xe(e){return`${e.id}:${e.revision}`}function Kc(e){const n=new Map;for(const s of e){const r=n.get(s.id)??[];r.push(s),n.set(s.id,r)}return[...n.entries()].map(([s,r])=>({id:s,revisions:r.sort((a,i)=>i.revision-a.revision||i.createdAt.localeCompare(a.createdAt))})).sort((s,r)=>r.revisions[0].createdAt.localeCompare(s.revisions[0].createdAt))}function _r(e,n=[],s=new Set,r=0){if(r>8||e==null)return n;const a=ya.safeParse(e);if(a.success){const i=`${a.data.id}:${a.data.revision}`;return s.has(i)||(s.add(i),n.push(a.data)),n}if(Array.isArray(e)){for(const i of e)_r(i,n,s,r+1);return n}if(typeof e=="object")for(const i of Object.values(e))_r(i,n,s,r+1);return n}function Qc(e){const n=new Map;for(const s of e){for(const r of s.attachments??[])n.set(`attachment:${r.id}`,{key:`attachment:${r.id}`,title:r.name,detail:`${r.mediaType} · ${Do(r.sizeBytes)}`});for(const r of s.sources??[])n.set(`source:${r.id}`,{key:`source:${r.id}`,title:r.title,detail:r.sourceName??Zc(r.url)})}return[...n.values()]}function uo({icon:e,title:n,detail:s}){return t.jsxs("div",{className:"work-sidebar-empty",children:[t.jsx(e,{size:22}),t.jsx("strong",{children:n}),t.jsx("p",{children:s})]})}function Xc(e){return e.kind==="deployment"?"Deployment":e.kind==="source_change"?"Source change":e.kind==="external_resource"?e.provider:e.kind==="agent_package"?`${e.actions.length} action${e.actions.length===1?"":"s"}`:e.location.kind==="local"?Do(e.sizeBytes):e.location.kind==="managed"?"Managed file":e.location.provider}function Do(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Jc(e){const n=window.atob(e),s=new ArrayBuffer(n.length),r=new Uint8Array(s);for(let a=0;a<n.length;a+=1)r[a]=n.charCodeAt(a);return s}function fo(e){return e.kind==="file"&&e.location.kind==="local"?e.location.path:""}function Zc(e){try{return new URL(e).hostname||e}catch{return e}}function Yc(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}const eu=[{label:"Turn meeting notes into an executive report",prompt:"Turn my notes and attached source material into a polished report. Organize the key findings, identify missing information, and return a draft for my review.",icon:sn},{label:"Find trends and anomalies in a spreadsheet",prompt:"Analyze the attached spreadsheet. Check the calculations, summarize the most important findings, flag anomalies or missing data, and create a reviewable results file.",icon:yo},{label:"Compare options and recommend the best fit",prompt:"Research the best options for this decision. Compare the most important criteria, cite the sources, flag uncertainty, and return a recommendation with next steps.",icon:va},{label:"Build a presentation from source materials",prompt:"Create a concise presentation from my attached source material. Focus on the main themes and supporting evidence, separate findings from recommendations, and return a draft for my review.",icon:gi}];function tu({onSelect:e}){return t.jsx("div",{className:"work-starter-prompts","aria-label":"Work task examples",children:eu.map(({icon:n,label:s,prompt:r})=>t.jsxs("button",{type:"button",className:"work-starter-prompt",onClick:()=>e(r),children:[t.jsx(n,{size:15,"aria-hidden":"true"}),t.jsx("span",{children:s})]},s))})}function nu({value:e,onChange:n}){const s=(r,a)=>{let i;if(r.key==="Home")i=0;else if(r.key==="End")i=Tn.length-1;else if(r.key==="ArrowRight"||r.key==="ArrowDown")i=(a+1)%Tn.length;else if(r.key==="ArrowLeft"||r.key==="ArrowUp")i=(a-1+Tn.length)%Tn.length;else return;r.preventDefault();const c=Tn[i];if(!c)return;n(c.value),r.currentTarget.parentElement?.querySelectorAll(".new-experience-option")?.[i]?.focus()};return t.jsx("div",{className:"new-experience-switcher",role:"radiogroup","aria-label":"Choose task mode",children:Tn.map((r,a)=>{const i=r.value===e;return t.jsx("button",{type:"button",role:"radio","aria-checked":i,className:`new-experience-option ${i?"active":""}`,"data-experience":r.value,tabIndex:i?0:-1,onClick:()=>{i||n(r.value)},onKeyDown:c=>s(c,a),children:r.label},r.value)})})}function su(e,n){if(!e||!n)return null;const s=new Set(e.sources.filter(r=>r.sessionId===n).map(r=>r.id));return s.size?e.creations.find(r=>r.request.sourceIds.some(a=>s.has(a)))??null:null}function ru(e){const[n,s]=o.useState(null),[r,a]=o.useState(null),[i,c]=o.useState(!1),[u,x]=o.useState(null),[b,k]=o.useState(null),h=o.useRef(null),m=o.useRef(0),f=o.useCallback(async(p,E={})=>{if(!e){a(null),x("OpenPond App server is not connected.");return}const S=m.current+1;m.current=S,E.silent||c(!0),x(null);try{const L=await Se.getCreateImproveCandidateDiff(e,p.runId,p.candidateId),j=h.current;if(S!==m.current||j?.runId!==p.runId||j.candidateId!==p.candidateId)return;a(L)}catch(L){if(S!==m.current)return;x(L instanceof Error?L.message:String(L))}finally{S===m.current&&!E.silent&&c(!1)}},[e]),v=o.useCallback(p=>{const E=h.current;if(!(p&&E?.runId===p.runId&&E.candidateId===p.candidateId)){if(h.current=p,s(p),k(null),!p){m.current+=1,a(null),x(null),c(!1);return}a(S=>S?.appId===ou(p)?S:null),f(p)}},[f]),C=o.useCallback(async(p={})=>{const E=h.current;E&&await f(E,p)},[f]),A=o.useCallback(p=>{k({id:Date.now(),path:p})},[]);return o.useEffect(()=>{e||v(null)},[v,e]),{selection:n,diff:r,loading:i,error:u,openFileRequest:b,activate:v,refresh:C,openFile:A}}function ou(e){return`candidate:${e.runId}:${e.candidateId}`}function au(e){const{activeModel:n,activeProvider:s,bootstrap:r,codexPermissionMode:a,codexReasoningEffort:i,connection:c,onOpenRightChatForSession:u,onPayload:x}=e,b=o.useCallback(async m=>{if(!c||!r)throw new Error("OpenPond is still connecting.");const f=r.profile;if(f.mode!=="local"||!f.repoPath)throw new Error("A local Git-backed Profile is required to change an Agent.");const v=m.authoringModel??ja(s,n,r.providers);if(!v)throw new Error("Choose a model before changing an Agent.");const C=await Se.createSession(c,{provider:v.providerId,modelRef:v,systemKind:"openpond.lab",hiddenFromDefaultSidebar:!0,title:`${m.operation==="create"?"New":"Improve"} Agent · ${m.objective.slice(0,80)}`,cwd:f.repoPath,metadata:{source:m.operation==="create"?"lab_agent_create":"lab_agent_improve",profileId:f.activeProfile??"default",targetAgentId:m.agentId??null}}),A=m.objective.trim();if(!A)throw new Error(m.operation==="create"?"Describe what the Agent should do.":"Describe what the Agent could do better.");if(v.providerId==="codex")throw new Error("Agent authoring uses OpenPond's bundled authoring skill. Choose a hosted model.");const p=m.operation==="create"?`/agent create ${A}`:`/agent improve ${m.agentId??""} ${A}`,E=await Se.sendTurn(c,C.id,{prompt:p,model:v.modelId,modelRef:v,approvalPolicy:"never",sandbox:"workspace-write",codexPermissionMode:"default",codexReasoningEffort:i});if(E.status==="failed")throw new Error(E.error??"OpenPond could not complete the Agent authoring turn.");x(await Se.bootstrap(c)),u(C.id,C)},[n,s,r,a,i,c,u,x]),k=o.useCallback((m,f,v)=>b({objective:m,operation:"create",authoringRunId:f,authoringModel:v}),[b]),h=o.useCallback((m,f,v,C,A)=>b({agentId:m,agentName:v,objective:f,operation:"improve",authoringRunId:C,authoringModel:A}),[b]);return{createAgentFromLab:k,improveAgentFromLab:h}}const iu=72,jr=120,Oo=24,lu=280,cu=460;function Rn(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=iu}const Os={canGoPrevious:!1,canGoNext:!1};function zo(e){return Array.from(e.querySelectorAll(".message-row.user")).filter(n=>n.parentElement===e)}function uu({activeWorkspaceId:e,cloudProjects:n}){const s=n.find(i=>i.id===e),r=n.find(i=>i.organizationSlug||i.teamId),a=s??r??null;return{organizationSlug:a?.organizationSlug??null,teamId:a?.teamId??null}}function Ks(e,n){return n.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop}function Fo(e,n){return Ks(e,n)+n.getBoundingClientRect().height}function Bo(e){return e.scrollTop+Oo}function Uo(e){return e.scrollTop+8}function zs(e){const n=Bo(e),s=Uo(e);let r=!1,a=!1;for(const i of zo(e)){const c=Ks(e,i);if(Fo(e,i)<s&&(r=!0),c>n+8&&(a=!0),r&&a)break}return{canGoPrevious:r,canGoNext:a}}function du(e,n){const s=zo(e),r=Bo(e);if(n==="previous"){const a=Uo(e);for(let i=s.length-1;i>=0;i-=1){const c=s[i];if(Fo(e,c)<a)return c}return null}for(const a of s)if(Ks(e,a)>r+8)return a;return null}function fu(e){return Math.min(cu,Math.max(lu,Math.abs(e)/5))}function mu(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function hu(e){const n=wa({messages:e});return n?{run:n}:null}function mo(e){return e.command==="agent"?e.args?`/agent ${e.args}`:"/agent":e.command==="skill"?e.args?`/skill ${e.args}`:"/skill":e.args?`/${e.command} ${e.args}`:`/${e.command}`}function wr(e,n){return{surface:"chat",workflowKind:"slash_command",commandName:`/${e.command}`,commandSource:n}}function pu(e){return e.command==="goal"||e.command==="agent"||e.command==="skill"||e.command==="sync-cloud"}function xu(e){const n=e?.trim()??"";return/^[a-z0-9]{24}$/.test(n)?n:null}function bu({busy:e,handoff:n,onDismiss:s,onSelectTask:r}){const a=Sa(n),i=n.selectedTaskIndex+1;return t.jsxs("section",{className:"training-chat-handoff","aria-label":"Model chat",children:[t.jsxs("div",{className:"training-chat-handoff-copy",children:[t.jsx("strong",{children:a?"Generated Taskset question":"Model chat"}),t.jsx("span",{children:n.tasksetName}),t.jsx("small",{children:a?`${gu(a.split)} · ${i} of ${n.tasks.length} · New chat per question`:"Ask the imported model directly"})]}),t.jsxs("div",{className:"training-chat-handoff-actions",children:[a?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button","aria-label":"Previous generated question",title:"Previous question",disabled:e||n.selectedTaskIndex===0,onClick:()=>r(n.selectedTaskIndex-1),children:t.jsx(In,{size:14})}),t.jsx("button",{type:"button",className:"training-chat-handoff-load",disabled:e,onClick:()=>r(n.selectedTaskIndex),children:"Load question"}),t.jsx("button",{type:"button","aria-label":"Next generated question",title:"Next question",disabled:e||n.selectedTaskIndex>=n.tasks.length-1,onClick:()=>r(n.selectedTaskIndex+1),children:t.jsx(wo,{size:14})})]}):null,t.jsx("button",{type:"button","aria-label":"Close generated question handoff",title:"Close",disabled:e,onClick:s,children:t.jsx(Ws,{size:14})})]})]})}function gu(e){return e==="frozen_eval"?"Frozen evaluation":e==="validation"?"Validation":"Training"}function ku({activeModel:e,activeProvider:n,busy:s,handoff:r,onDismiss:a,onSelectTask:i}){return!r||r.model.providerId!==n||r.model.modelId!==e?null:t.jsx(bu,{busy:s,handoff:r,onDismiss:a,onSelectTask:i})}function yu({canGoNext:e,canGoPrevious:n,onJumpToLatest:s,onNext:r,onPrevious:a}){return t.jsxs("div",{className:"chat-scroll-controls","aria-label":"Message navigation",children:[t.jsx("button",{type:"button",className:"chat-scroll-control-button","data-tooltip":"Go to previous message","aria-label":"Go to previous message","aria-disabled":!n,onClick:a,children:t.jsx(In,{size:17})}),t.jsx("button",{type:"button",className:"chat-scroll-control-button primary","data-tooltip":"Jump to latest","aria-label":"Jump to latest",onClick:s,children:t.jsx(ei,{size:18})}),t.jsx("button",{type:"button",className:"chat-scroll-control-button","data-tooltip":"Go to next message","aria-label":"Go to next message","aria-disabled":!e,onClick:r,children:t.jsx(wo,{size:17})})]})}function vu({busy:e,onSync:n}){return t.jsxs("button",{type:"button",className:"sync-local-button",disabled:e,onClick:n,children:[t.jsx(li,{size:15}),t.jsx("span",{children:e?"Syncing locally":"Sync locally to work on this"})]})}function qo(e){return e.supportedView&&e.open&&!e.hasContentPanel}function ju(e,n){return e==="team"?"team-active":e==="community"?"community-active":e==="apps"||e==="get-started"||e==="labs"||e==="outputs"||e==="scheduled"?"page-active":n?"chat-active":"chat-start"}function wu({browserConversationId:e,chatHistoryHasMore:n,chatHistoryLoading:s,chatMessages:r,onLoadMoreChatHistory:a,pendingApproval:i,showChatThread:c,showThinkingIndicator:u,view:x}){const b=o.useRef(null),k=o.useRef(null),h=o.useRef(!0),m=o.useRef(null),f=o.useRef(null),v=o.useRef(!1),C=o.useRef(!1),A=o.useRef(!1),p=o.useRef(null),E=o.useRef(null),[S,L]=o.useState(0),[j,I]=o.useState(null),[D,re]=o.useState(!1),[ue,le]=o.useState(132),[B,H]=o.useState(Os),Q=o.useMemo(()=>$c(r,{showThinkingIndicator:u}),[r,u]),pe=o.useMemo(()=>({"--chat-composer-reserve":`${ue}px`}),[ue]),be=r.at(-1),de=[Q.length,be?.id??"",be?.content?.length??0,be?.timestamp??"",u?"thinking":""].join(":"),y=n,w=e,_=x==="chat"&&c&&!!w&&j!==w,U=o.useCallback(M=>{re(N=>N===M?N:M)},[]),oe=o.useCallback(M=>{H(N=>N.canGoPrevious===M.canGoPrevious&&N.canGoNext===M.canGoNext?N:M)},[]),fe=o.useCallback((M,N={})=>{const ne=N.nearBottom??Rn(M);U(!ne),oe(zs(M))},[U,oe]),$=o.useCallback(M=>{const N=C.current;C.current=!1,I(M),U(!1),oe(Os),N&&L(ne=>ne+1)},[U,oe]),Ce=o.useCallback(()=>{E.current===null||typeof window>"u"||(window.cancelAnimationFrame(E.current),E.current=null)},[]),Ne=o.useCallback((M,N,ne)=>{Ce();const _e=Math.max(0,M.scrollHeight-M.clientHeight),ge=()=>{const ot=typeof N=="function"?N():N;return Math.max(0,Math.min(ot,Math.max(0,M.scrollHeight-M.clientHeight)))},ze=Math.max(0,Math.min(ge(),_e)),ee=M.scrollTop,Ie=ze-ee;if(typeof window>"u"||window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0||Math.abs(Ie)<1){M.scrollTop=ze,ne?.();return}const Mt=fu(Ie),Nt=window.performance.now(),rt=ot=>{if(b.current!==M){E.current=null;return}const Et=Math.min(1,(ot-Nt)/Mt),rn=ge();if(M.scrollTop=ee+(rn-ee)*mu(Et),Et<1){E.current=window.requestAnimationFrame(rt);return}M.scrollTop=ge(),E.current=null,ne?.()};E.current=window.requestAnimationFrame(rt)},[Ce]),z=o.useCallback(()=>{A.current=!1,!(p.current===null||typeof window>"u")&&(window.cancelAnimationFrame(p.current),p.current=null)},[]),Y=o.useCallback((M,N={})=>{if(M.scrollTop=M.scrollHeight,typeof window>"u"){N.finishInitial&&$(N.conversationKey??null);return}z(),A.current=!0;let _e=0,ge=0,ze=M.scrollHeight;const ee=N.settle?12:2,Ie=()=>{const $e=b.current;if(!$e){p.current=null,A.current=!1,N.finishInitial&&$(N.conversationKey??null);return}$e.scrollTop=$e.scrollHeight;const Mt=$e.scrollHeight-$e.scrollTop-$e.clientHeight,Nt=Math.abs($e.scrollHeight-ze)<=1;if(ze=$e.scrollHeight,ge=Mt<=1&&Nt?ge+1:0,_e+=1,_e<ee&&ge<2){p.current=window.requestAnimationFrame(Ie);return}p.current=null,A.current=!1,h.current=!0,U(!1),oe(zs($e)),N.finishInitial&&$(N.conversationKey??null)};p.current=window.requestAnimationFrame(Ie)},[z,$,U,oe]),V=o.useCallback(()=>{const M=b.current;M&&(z(),h.current=!0,U(!1),Ne(M,()=>M.scrollHeight-M.clientHeight,()=>{b.current===M&&(M.scrollTop=M.scrollHeight,h.current=!0,U(!1),oe(zs(M)))}))},[z,U,oe,Ne]),ae=o.useCallback(M=>{const N=b.current;if(!N)return;const ne=du(N,M);if(!ne)return;z(),Ne(N,()=>ne.isConnected?Math.max(0,Ks(N,ne)-Oo):N.scrollTop,()=>{if(b.current!==N)return;const ge=Rn(N);h.current=ge,fe(N,{nearBottom:ge})})},[z,Ne,fe]),F=o.useCallback(()=>{const M=b.current;M&&(f.current={scrollHeight:M.scrollHeight,scrollTop:M.scrollTop},h.current=!1)},[]),he=o.useCallback(async()=>{if(y&&!(!a||s||v.current)){F(),v.current=!0;try{await a()}finally{v.current=!1}}},[y,s,a,F]),G=o.useCallback(M=>{if(A.current){h.current=!0,U(!1),oe(Os);return}const N=Rn(M);h.current=N,fe(M,{nearBottom:N}),!C.current&&M.scrollTop<=jr&&y&&!s&&he()},[y,s,he,U,oe,fe]),st=o.useCallback(M=>{!h.current&&!Rn(M)||(h.current=!0,M.scrollTop=M.scrollHeight)},[]);return o.useLayoutEffect(()=>{if(x!=="chat"||!c||typeof window>"u")return;const M=k.current;if(!M)return;let N=null;const ne=()=>{N=null;const ze=Math.max(96,Math.ceil(M.getBoundingClientRect().height+20));le(ee=>ee===ze?ee:ze)},_e=()=>{N===null&&(N=window.requestAnimationFrame(ne))};_e();const ge=typeof window.ResizeObserver>"u"?null:new window.ResizeObserver(_e);return ge?.observe(M),window.addEventListener("resize",_e),()=>{N!==null&&window.cancelAnimationFrame(N),ge?.disconnect(),window.removeEventListener("resize",_e)}},[c,x]),o.useLayoutEffect(()=>{const M=b.current;x!=="chat"||!c||!M||C.current||!h.current&&!Rn(M)||(h.current=!0,Y(M,{settle:!0}))},[ue,Y,c,x]),o.useLayoutEffect(()=>{f.current=null,v.current=!1,C.current=!0,h.current=!0,Ce(),z(),I(null),U(!1),oe(Os)},[z,Ce,w,U,oe]),o.useEffect(()=>{const M=b.current;x!=="chat"||!M||C.current||!y||s||M.scrollTop<=jr&&M.scrollHeight<=M.clientHeight+jr&&he()},[y,s,S,Q.length,he,x]),o.useLayoutEffect(()=>{const M=f.current,N=b.current;!M||!N||C.current||(f.current=null,N.scrollTop=M.scrollTop+Math.max(0,N.scrollHeight-M.scrollHeight),fe(N))},[Q.length,fe]),o.useLayoutEffect(()=>{const M=b.current;if(x!=="chat"||!w||!M){m.current=w,h.current=!0,$(w);return}const N=m.current!==w;if(m.current=w,N||C.current){h.current=!0,Y(M,{conversationKey:w,finishInitial:!0,settle:!0});return}const ne=Rn(M);if(h.current||ne){h.current=!0,U(!1),oe(zs(M)),Y(M,{settle:!0});return}fe(M,{nearBottom:ne})},[de,w,$,i?.id,Y,U,oe,fe,x]),o.useEffect(()=>()=>{z(),Ce()},[z,Ce]),{chatColumnStyle:pe,chatThreadPreparingInitialScroll:_,chatThreadRef:b,composerStackRef:k,goToUserMessage:ae,handleChatContentMutation:st,handleChatScroll:G,jumpToLatestChatMessage:V,showScrollToBottomButton:D,userMessageNavigation:B,chatTimelineRows:Q}}const Su=o.lazy(()=>je(()=>import("./WorkspaceDiffPanel-jaJU08NH.js"),__vite__mapDeps([9,1,2,4,3,6,10,11,12,13,14,15]),import.meta.url).then(e=>({default:e.WorkspaceDiffPanel}))),Cu=o.lazy(()=>je(()=>import("./AppsView-Cm5x09IS.js"),__vite__mapDeps([16,1,2,17]),import.meta.url).then(e=>({default:e.AppsView}))),Mu=o.lazy(()=>je(()=>import("./GetStartedView--CbCnzFQ.js"),__vite__mapDeps([18,1,2,5,19,20,4,21]),import.meta.url).then(e=>({default:e.GetStartedView}))),Nu=o.lazy(()=>je(()=>import("./LabsRoute-CYk2dzQp.js").then(e=>e.f),__vite__mapDeps([22,1,2,23,20,10,4,0,3,5,6,11,24,25,19,26,27,28]),import.meta.url).then(e=>({default:e.LabsRoute}))),Eu=o.lazy(()=>je(()=>import("./ScheduledWorkPage-Cn5a9VLV.js"),__vite__mapDeps([29,1,2,30,4,5,6,14]),import.meta.url).then(e=>({default:e.ScheduledWorkPage}))),Au=o.lazy(()=>je(()=>import("./OutputsPage-XmIreC0M.js"),__vite__mapDeps([31,1,2,4,12,23,11,25,32]),import.meta.url).then(e=>({default:e.OutputsPage}))),ho=o.lazy(()=>je(()=>import("./LabSkillSidebar-CnuyFZ1G.js"),__vite__mapDeps([33,1,2,4,23,11,25,32,12,34]),import.meta.url).then(e=>({default:e.LabSkillSidebar}))),Tu=o.lazy(()=>je(()=>import("./BrowserSidebar-CIPh5JIn.js"),__vite__mapDeps([35,1,2,4,6,32,36]),import.meta.url).then(e=>({default:e.BrowserSidebar}))),Ru=o.lazy(()=>je(()=>import("./RightChatPanelStack-BMOtbjus.js"),__vite__mapDeps([37,1,2,12,38,15,4,25,39,3,5,11,23,32]),import.meta.url).then(e=>({default:e.RightChatPanelStack}))),_u=o.lazy(()=>je(()=>import("./NativeSkillSidebar-DSoPD42b.js"),__vite__mapDeps([40,1,2,4,41]),import.meta.url).then(e=>({default:e.NativeSkillSidebar}))),Iu=o.lazy(()=>je(()=>import("./TeamChatView-CB_0oRid.js"),__vite__mapDeps([42,1,2,4,6,43,11,19,23,25,32,12,44,45]),import.meta.url).then(e=>({default:e.TeamChatView}))),$u=o.lazy(()=>je(()=>import("./TeamChatView-CB_0oRid.js"),__vite__mapDeps([42,1,2,4,6,43,11,19,23,25,32,12,44,45]),import.meta.url).then(e=>({default:e.TeamChatProView}))),Pu=o.lazy(()=>je(()=>import("./CommunityView-Dqu4cos1.js"),__vite__mapDeps([46,1,2,47,6,4,43,11,23,25,32,12,48]),import.meta.url).then(e=>({default:e.CommunityView}))),Lu=o.lazy(()=>je(()=>import("./TeamChatView-CB_0oRid.js"),__vite__mapDeps([42,1,2,4,6,43,11,19,23,25,32,12,44,45]),import.meta.url).then(e=>({default:e.TeamAiThreadPanel}))),Du=o.lazy(()=>je(()=>import("./TeamChatView-CB_0oRid.js"),__vite__mapDeps([42,1,2,4,6,43,11,19,23,25,32,12,44,45]),import.meta.url).then(e=>({default:e.TeamAgentConversationPanel}))),Ou=o.lazy(()=>je(()=>import("./TrainingDraftPanel-CDlpnno6.js"),__vite__mapDeps([49,1,2,4,28]),import.meta.url).then(e=>({default:e.TrainingDraftPanel}))),zu=o.lazy(()=>je(()=>import("./MainChatThread-0Tc95p0t.js"),__vite__mapDeps([50,1,2,38,15,4,25,39,3,12,5,11,23,32]),import.meta.url).then(e=>({default:e.MainChatThread}))),Fu=o.lazy(()=>je(()=>import("./TrainingCreationPanel-ChsDr2GP.js"),__vite__mapDeps([51,1,2,3,28]),import.meta.url).then(e=>({default:e.TrainingCreationPanel})));function Bu({experience:e,onNewExperienceChange:n,view:s,teamChat:r,community:a,bootstrap:i,runtimeEvents:c,chatMessages:u,contextWindowStatus:x,goalRuntime:b,subagentRuntime:k,selectedSessionId:h,composerDraftStore:m,mainComposerFocusRequestId:f,onRequestComposerFocus:v,labCloseDetailRequestId:C,labCloseDetailKind:A,sideChatTrainingLaunchRequest:p,onSideChatTrainingLaunchHandled:E,steerAutoDispatchBlocked:S,steerAutoDispatchReady:L,mentionApps:j,connectedAppMentions:I,profileSkills:D,selectedMentionAppId:re,busy:ue,turnRunning:le,activeProvider:B,activeModel:H,codexPermissionMode:Q,codexReasoningEffort:pe,openPondCommandAccessMode:be,pendingApproval:de,activeWorkspaceAppId:y,activeWorkspaceId:w,activeWorkspaceKind:_,projectTarget:U,actionCatalog:oe,workspaceTarget:fe,connection:$,workspaceName:Ce,workspaceState:Ne,workspaceDiff:z,workspaceBusy:Y,diffBusy:V,forceChatThread:ae=!1,diffPanelOpen:F,diffPanelExpanded:he,rightPanelMode:G,rightPanelTabRequest:st,rightChatPanels:M,nativeSkillSidebar:N,extensionSkillSidebar:ne,workspaceDiffPanelViewState:_e,sidebarFileOpenRequest:ge,sidebarFileBookmarks:ze,onSetSidebarFileStatus:ee,browserConversationId:Ie,terminalScope:$e,terminalTabs:Mt,terminalCwd:Nt,pendingTerminalCommand:rt,terminalOpen:ot,onToggleTerminal:Et,onWorkspaceDiffPanelViewStateChange:rn,training:Me,trainingSessions:Pn,trainingChatHandoff:Be,trainingDetailTasksetId:Ln,onTrainingDetailTasksetIdChange:on,onTrainingChatTaskSelect:me,onTrainingChatHandoffDismiss:xe,onOpenSession:Lt,onExperienceHandoff:an,cloudProjects:ps,chatHistoryHasMore:ln=!1,chatHistoryLoading:xs=!1,onDiffPanelResizeStart:Ee,canSyncWorkspace:bs,startMessage:Dt,onPayload:bt,onError:Je,setView:Ze,onOpenProfileSettings:cn,onOpenProviderSettings:un,onOpenComputeSettings:gt,onOpenDatasetStorageSettings:Qs,changeDraftProvider:At,changeProjectTarget:Ae,changeWorkspaceTarget:kt,setDraftProvider:Ye,setDraftModel:at,onBeginNewChatWithModel:dn,changeCodexPermissionMode:it,changeCodexReasoningEffort:yt,changeOpenPondCommandAccessMode:De,resolveApproval:Dn,answerCreateImproveQuestion:lt,approveCreateImproveRun:On,applyCreateImproveCandidate:fn,cancelCreateImproveRun:zn,openCreateImprovePullRequest:mn,pauseCreateImproveRun:hn,reconcileCreateImprovePullRequest:Fn,rejectCreateImproveCandidate:Ot,resumeCreateImproveRun:pn,reviseCreateImproveRun:zt,setMentionedAppId:Ue,showToast:J,sendPrompt:et,stopTurn:gs,syncWorkspaceLocally:Bn,refreshWorkspaceDiff:Xs,onToggleDiffPanelExpanded:qe,onShowDiffPanel:Fe,onShowBrowserPanel:Tt,onShowTrainingDraftPanel:xn,onShowFilesPanel:Te,onShowRightChatPanel:vt,onAddRightChat:Un,onOpenRightChatForSession:qn,onLabDetailOpenChange:Rt,onTerminalTabsChange:Js,onCloseRightChatPanel:Hn,onCloseNativeSkillSidebar:ks,onActivateRightChatPanel:ys,onRightChatModelChange:Ft,onRightChatPromptChange:Zs,onRightChatScrollStateChange:bn,onRightChatProviderChange:vs,onSubmitRightChat:Ys,onStopRightChat:er,onCloseTerminal:tr,onLoadMoreChatHistory:ke}){const[ct,Pe]=o.useState(null),[ye,jt]=o.useState(null),[Bt,js]=o.useState(null),[ut,Ut]=o.useState(null),[ws,gn]=o.useState(null),[He,nr]=o.useState(null),[Vn,sr]=o.useState(null),[kn,Wn]=o.useState(null),[yn,Ss]=o.useState([]),or=o.useMemo(()=>i?.sessions.find(g=>g.id===h)??null,[i?.sessions,h])?.currentProfile??i?.profileLibrary?.lastUsed??null,vn=Ca(i?.profileLibrary??{profiles:[]},or)??i?.profile??null,ve=o.useMemo(()=>Ma(vn,i?.extensionCatalog),[i?.extensionCatalog,vn]),_t=o.useMemo(()=>Na(vn),[vn]),tt=o.useCallback(async(g,R=h)=>{if(!$||!i)return;const te=Ea(i.profileLibrary??{profiles:[]},g);if(te)try{const K=R&&!Aa(R)?i.sessions.find(q=>q.id===R)??null:null,W=await Bc({ref:te,session:K,selectProfile:q=>Se.profileSelect($,q),patchSession:(q,xt)=>Se.patchSession($,q,{currentProfile:xt})});let ce=i.sessions;W.session&&(ce=ce.map(q=>q.id===W.session.id?W.session:q)),bt({...i,profile:W.selected.profile,profileLibrary:W.selected.library,sessions:ce})}catch(K){const W=K instanceof Error?K.message:String(K);Je(W),J(W,"error")}},[i,$,Je,bt,h,J]);o.useEffect(()=>{if(!ge)return;const{file:g,id:R}=ge;if(jt({id:R,path:g.path}),!$)return;let te=!1;return(g.workspaceKind==="local"?Se.workspaceFile($,g.workspaceId,g.path).then(W=>W.content??""):Se.sandboxDownloadFile($,g.workspaceId,g.path).then(W=>{if(W.file.isBinary)throw new Error("Binary files cannot be attached to chat.");return W.contents})).then(W=>{if(te)return;const ce=g.path.split("/").at(-1)??g.path;Pe({id:R,file:new File([W],ce,{type:Uu(g)})})}).catch(W=>{te||J(W instanceof Error?W.message:String(W),"error")}),()=>{te=!0}},[$,J,ge]);const dt=e==="development"||e==="work"&&U.value!=="none",qt=o.useMemo(()=>{if(e==="chat")return _t;if(!dt)return[];const g=new Map(oe.filter(R=>!Ta(R)).map(R=>[R.id,R]));for(const R of _t)g.set(R.id,R);for(const R of yn)g.set(R.id,R);return[...g.values()]},[oe,e,dt,yn,_t]),X=ru($),jn=o.useCallback(g=>{if(!g){X.activate(null);return}X.activate({runId:g.run.id,candidateId:g.candidate.id,title:g.run.objective,fileRootPath:g.fileRootPath,initialPath:g.initialPath})},[X.activate]),Ve=o.useCallback(()=>{X.selection?.initialPath&&X.openFile(X.selection.initialPath),Fe()},[X.openFile,X.selection?.initialPath,Fe]),Gn=o.useCallback(g=>{Ut(g),g&&Fe()},[Fe]),se=o.useCallback(()=>{Ut(null),he&&qe()},[he,qe]);o.useEffect(()=>{s!=="labs"&&Ut(null)},[s]);const wn=o.useCallback((g,R)=>{const te=Date.now(),K=oe.find(ce=>ce.id===g)??null;m.set(""),Ue(null),Ze("chat");const W=ce=>{if(!(ce.find(ie=>ie.id===g)??null))return!1;const xt=ce.map(ie=>ie.id===g?{...ie,label:R}:ie);return Ss(xt),window.requestAnimationFrame(()=>{Wn({actionId:g,requestId:Math.max(Date.now(),te+1)})}),!0};if(!$){K?W([K]):J("The Agent action catalog is still loading. Try Use again.","error");return}Se.profileCurrent($).then(ce=>{const q=ce.actionCatalog.map(xt=>Ra(xt));!W(q)&&K?W([K]):q.some(xt=>xt.id===g)||J("This Agent is ready, but its default chat action is unavailable.","error")}).catch(ce=>{K||J(ce instanceof Error?ce.message:String(ce),"error")})},[oe,m,$,Ue,Ze,J]),Cs=o.useCallback((g,R)=>{m.set(g),Ue(null),R&&At(R),Ze("chat")},[At,m,Ue,Ze]),Kn=o.useMemo(()=>_a(i?.preferences),[i?.preferences]),Ms=Kn.training,{createAgentFromLab:Ns,improveAgentFromLab:We}=au({activeModel:H,activeProvider:B,bootstrap:i,codexPermissionMode:Q,codexReasoningEffort:pe,connection:$,onOpenRightChatForSession:qn,onPayload:bt}),ft=o.useMemo(()=>{const g=Me.payload?.tasksets??[];return g.some(R=>R.id===He)?He:g[0]?.id??null},[He,Me.payload?.tasksets]),Es=s==="labs"&&ft?`profiles/${i?.profile.activeProfile??"default"}/tasksets/${ft}`:null,Qn=o.useMemo(()=>{if(s!=="labs"||!ft||!Me.payload)return null;const g=Me.payload.tasksets.find(ie=>ie.id===ft);if(!g)return null;const R=Me.payload.plans.filter(ie=>ie.tasksetId===g.id),te=new Set(R.map(ie=>ie.id)),K=Me.payload.jobs.filter(ie=>te.has(ie.planId)).sort((ie,pr)=>pr.createdAt.localeCompare(ie.createdAt)),W=K.find(ie=>ie.id===Vn)??K[0]??null,ce=W?R.find(ie=>ie.id===W.planId)??null:R.sort((ie,pr)=>pr.createdAt.localeCompare(ie.createdAt))[0]??null,q=W?Me.payload.models.find(ie=>ie.jobId===W.id)??null:null,xt=W?Me.payload.artifacts.filter(ie=>ie.jobId===W.id):[];return{taskset:g,plan:ce,job:W,lineage:q,artifacts:xt}},[ft,Vn,Me.payload,s]),Ht=o.useMemo(()=>su(Me.payload,h),[h,Me.payload]),Vt=o.useMemo(()=>hu(u),[u]),Xn=!!b||!!Vt||!!k,we=s==="labs"&&!!X.selection,It=s==="labs"&&F&&G==="changes"&&!!ut,Jn=(s==="chat"||s==="labs")&&!!y,ar=s==="chat"&&F&&G==="chat"&&M.length===0,As=Ia(_)?w??xu(Ce):null,ir=s==="chat"&&!!As,Oe=As,Wt=!!Oe||fe.value==="cloud"||fe.value==="hybrid",mt=o.useMemo(()=>Dc({workspaceTarget:fe.value,localWorkspaceId:y,sandboxSourceAvailable:Wt,sandboxWorkspaceId:Oe,override:Bt}),[y,Wt,Oe,Bt,fe.value]),nt=mt.source,Ge=nt==="sandbox",lr=o.useMemo(()=>nt&&mt.options.length>1?{value:nt,options:mt.options,onChange:js}:null,[nt,mt.options]);o.useEffect(()=>{js(null)},[y,Ie,Oe,fe.value]);const Zn=!It&&(we||Jn||ir)&&F&&(G==="changes"||G==="goal"&&Xn||ar),Yn=s==="chat"&&F&&G==="browser",ht=(s==="chat"||s==="labs")&&F&&G==="chat"&&M.length>0,Gt=s==="chat"&&F&&G==="training",es=s==="chat"&&F&&!!N,cr=s==="chat"&&F&&!!ne,ts=s==="team"&&F&&G==="chat"&&!!r.aiThread,$t=s==="team"&&F&&G==="chat"&&!!r.agentConversation,ns=e==="work"&&s==="chat"&&F&&G==="home",Kt=qo({supportedView:s==="chat"&&dt||s==="labs",open:F,hasContentPanel:Zn||It||Yn||ht||Gt||es||ts||$t||ns}),Sn=Zn||It||Yn||ht||Gt||es||ts||$t||ns||Kt,Cn=Sn&&G!=="chat"&&he,Ts=i?.account.baseUrl??i?.account.activeProfile?.baseUrl??null,Qt=uu({activeWorkspaceId:w,cloudProjects:ps}),ss=s==="chat"&&le&&!de&&Lc(u),rs=ae||u.length>0||ss,Rs=h??`draft:${s}:${_??"none"}:${w??y??"none"}`,os=t.jsx(ku,{activeModel:H,activeProvider:B,busy:le,handoff:Be,onDismiss:xe,onSelectTask:me}),as=o.useMemo(()=>({onAnswerQuestion:lt,onApprove:On,onApplyCandidate:fn,onCancel:zn,onOpenPullRequest:mn,onPause:hn,onReconcilePullRequest:Fn,onRejectCandidate:Ot,onResume:pn,onRevise:zt}),[lt,On,fn,zn,mn,hn,Fn,Ot,pn,zt]),Mn=o.useMemo(()=>Vt?{...Vt,...as}:null,[as,Vt]),Xt=ju(s,rs),is=o.useCallback(async(g=[],R=null,te=null,K={})=>{const W=K.promptOverride??m.getSnapshot(),ce=()=>{K.preservePrompt||(m.set(""),Ue(null))};if(!R){const q=te?{command:te.id,args:W.trim()}:go(W);if(q){if(!$a({id:q.command},e))return J(`/${q.command} isn't available in ${e}.`,"info"),!1;if(q.command==="train")return g.length>0?(J("/train uses the selected chat; add other chats from Models.","error"),!1):h?(ce(),gn({id:Date.now(),objective:q.args.trim()||null,initialSessionIds:[h]}),Ze("labs"),!0):(ce(),gn({id:Date.now(),objective:q.args.trim()||null,initialSessionIds:[]}),Ze("labs"),!0);if(!q.args&&q.command!=="skill"&&q.command!=="sync-cloud")return J(`Add instructions after /${q.command}.`,"info"),!1;if(g.length>0)return J(`/${q.command} tasks do not accept attachments yet. Add file context in the task thread.`,"error"),!1;if(q.command==="submit-issue")return Pa(I)?et([],null,La(q.args),{clearPrompt:K.preservePrompt?()=>{}:void 0,usageAttribution:wr(q,te?"composer_selection":"prompt_parse")}):(J("Connect the GitHub app before using /submit-issue.","error"),!1);if(pu(q)){const ie=q.command==="skill"?zc(q.args,B,i?.profile.sourcePath??null):mo(q);return et([],null,ie,{clearPrompt:K.preservePrompt?()=>{}:void 0,usageAttribution:wr(q,te?"composer_selection":"prompt_parse")})}return et([],null,mo(q),{clearPrompt:K.preservePrompt?()=>{}:void 0,usageAttribution:wr(q,te?"composer_selection":"prompt_parse")})}}return et(g,R,K.promptOverride,{clearPrompt:K.preservePrompt?()=>{}:void 0,displayPrompt:K.displayPrompt,turnMetadata:K.turnMetadata})},[H,B,_,i?.profile,I,m,e,et,h,Ue,Ze,J,Me,s]),ls=o.useCallback(g=>{Be&&g!==Be.model.modelId&&xe(),Ye(B),at(g)},[B,xe,at,Ye,Be]),_s=o.useCallback(g=>{Be&&g!==Be.model.providerId&&xe(),At(g)},[At,xe,Be]),{chatColumnStyle:Ke,chatThreadPreparingInitialScroll:Is,chatThreadRef:$s,chatTimelineRows:ur,composerStackRef:Ps,goToUserMessage:Ls,handleChatContentMutation:dr,handleChatScroll:cs,jumpToLatestChatMessage:fr,showScrollToBottomButton:mr,userMessageNavigation:Jt}=wu({browserConversationId:Ie,chatHistoryHasMore:ln,chatHistoryLoading:xs,chatMessages:u,onLoadMoreChatHistory:ke,pendingApproval:de,showChatThread:rs,showThinkingIndicator:ss,view:s}),Nn=o.useCallback((g,R)=>{Da({conversationId:Ie,href:g,explicitFile:R?.explicitFile,newTab:R?.newTab}).then(te=>{te&&Tt()})},[Ie,Tt]),En=Ka({projectTargetDetail:U.detail,projectTargetValue:U.value,workspaceRepoPath:Ne?.repoPath,workspaceTargetValue:fe.value}),l=o.useCallback(g=>{const R=Ic(g,En);if(R&&$){Se.signLocalVideoUrl($,{path:R}).then(({url:K})=>Nn(K)).catch(K=>{J(K instanceof Error?K.message:"Could not open this video.","error")});return}const te=Qa(g,{workspaceRootPath:En});Fe(),jt({id:Date.now(),path:te?.path??g})},[$,Nn,Fe,J,En]),d=o.useCallback(async g=>{if(!$||!g.filePreview&&!g.imagePreview){J("File content is not available for this attachment.","error");return}try{const R=g.name.trim().replace(/[\\/]+/g,"-")||"attachment.txt",K=`Attachments/${g.id.replace(/[^a-zA-Z0-9._-]+/g,"-")||"file"}/${R}`,W={path:K,status:"",additions:0,deletions:0,patch:"",content:null};let ce;if(g.filePreview){const q=await Se.chatAttachmentFile($,g.filePreview);W.content=q.content}else g.imagePreview&&(ce=(await Se.signChatAttachmentImageUrl($,g.imagePreview)).url);Fe(),jt({id:Date.now(),path:K,file:W,...ce?{imageUrl:ce}:{}})}catch(R){J(R instanceof Error?R.message:"Could not open this attachment.","error")}},[$,Fe,J]),T=Y&&!!y&&!Ne,P=X.selection?`candidate:${X.selection.runId}:${X.selection.candidateId}`:null,O=Zn?t.jsx(Su,{appId:we?P:Ge?null:y,workspaceId:we?P:Ge?Oe:y,workspaceKind:we?"local_project":Ge?null:"local_project",connection:$,runtimeEvents:c,diff:we?X.diff:Ge?null:z,fileRootPath:we?X.selection?.fileRootPath??null:Ge?null:Es,filesWithPreview:we,editorPreferences:i?.preferences.editor??null,loading:we?X.loading:Ge?Y:V||T,openFileRequest:we?X.openFileRequest:ye,sidebarFileBookmarks:ze,sidebarFileSourceSessionId:h,onSetSidebarFileStatus:ee,readOnly:we,sideChatTabs:M.map(g=>({id:g.id,title:g.title,running:g.running})),sourceSwitcher:we?null:lr,tabRequest:st,viewState:_e,workspaceName:we?X.selection?.title??"Change":Ge?Ce??"Sandbox":Ce,workspaceInitialized:we?!0:Ge?!!Oe:!!Ne?.initialized,workspaceError:we?X.error:Ge?null:Ne?.error??z?.error??null,expanded:he,onResizeStart:Ee,onRefresh:g=>{we?X.refresh(g):Xs(g)},onToggleExpanded:qe,onOpenBrowser:Tt,onOpenBrowserUrl:Nn,onViewStateChange:rn,onCloseSideChat:Hn,onOpenSideChat:s==="chat"?Un:void 0,onSelectSideChat:g=>{ys(g),vt()},goalDetails:{active:G==="goal",createRuntime:Mn,goalRuntime:b,subagentRuntime:k},sandboxFileSource:Ge?{sandboxId:Oe,emptyMessage:"No sandbox filesystem yet."}:null,trainingSummary:Qn}):null,Z=Yn?t.jsx(Tu,{conversationId:Ie,expanded:he,onResizeStart:Ee}):null,Re=ts?o.createElement(Lu,{...r,key:r.aiThread?.conversationId,onResizeStart:Ee}):null,wt=$t?o.createElement(Du,{...r,key:r.agentConversation?.run.id,onResizeStart:Ee}):null,Zt=ht?t.jsx(Ru,{panels:M,actionCatalog:qt,createImproveActions:as,busy:ue,codexPermissionMode:Q,codexReasoningEffort:pe,openPondCommandAccessMode:be,connection:$,connectedAppMentions:I,mentionApps:j,codexPersonalSkills:i?.codexPersonalSkills??[],profileSkills:D,profileLibrary:i?.profileLibrary??{lastUsed:null,profiles:[]},extensionCatalog:i?.extensionCatalog??null,projectTarget:U,providerSettings:i?.providers??null,accountBaseUrl:Ts,billingOrganizationSlug:Qt.organizationSlug,billingTeamId:Qt.teamId,showToast:J,workspaceTarget:fe,onAddChat:Un,onActivatePanel:ys,onClosePanel:Hn,onCodexPermissionModeChange:it,onCodexReasoningEffortChange:yt,onOpenPondCommandAccessModeChange:De,onModelChange:Ft,onOpenAttachmentInSidebar:d,onOpenFileInSidebar:l,onOpenProfileSettings:cn,onOpenSession:Lt,onProviderChange:vs,onProviderSetupOpen:un,onPromptChange:Zs,onProfileTargetChange:(g,R)=>{tt(R,g)},onScrollStateChange:bn,onProjectTargetChange:Ae,onResolveApproval:Dn,onResizeStart:Ee,onSelectFiles:Te,onShowBrowserPanel:Tt,onStop:er,onSubmit:Ys,onWorkspaceTargetChange:g=>{kt(g)}}):null,Yt=Kt?t.jsx(Hc,{expanded:he,terminalOpen:ot,sideChatAvailable:s==="chat"||s==="labs",onOpenBrowser:Tt,onOpenFiles:Te,onOpenReview:Fe,onOpenSideChat:Un,onOpenTrainingDraft:xn,trainingDraftAvailable:!!h,onResizeStart:Ee,onToggleExpanded:qe,onToggleTerminal:Et}):null,pt=ns?t.jsx(Vc,{chatMessages:u,connection:$,contextWindowStatus:x,expanded:he,runtimeEvents:c,sessionId:h,showToast:J,onResizeStart:Ee,onToggleExpanded:qe,onUseOutput:g=>Pe({id:Date.now(),file:g}),onHandoffOutput:async(g,R,te)=>{await an({target:g,sourceSessionId:h,output:R,prompt:Oa(R,g)}),te&&Pe({id:Date.now(),file:te})},onReviseOutput:(g,R,te)=>{Pe({id:Date.now(),file:R}),m.set(`Create revision ${g.revision+1} of "${g.title}" from the attached revision ${g.revision}. Apply only this requested change:
5
5
 
6
6
  ${te}`)},onAgentPackageInstalled:async()=>{$&&bt(await Se.bootstrap($))}}):null,en=Gt?t.jsx(o.Suspense,{fallback:null,children:t.jsx(Ou,{training:Me,sessionId:h,expanded:he,onOpenTraining:()=>Ze("labs"),onResizeStart:Ee,onToggleExpanded:qe})}):null,An=wt??Re??Zt??(es&&N?t.jsx(_u,{expanded:he,skill:N,onClose:ks,onResizeStart:Ee,onToggleExpanded:qe}):null)??(cr&&ne?t.jsx(ho,{connection:$,expanded:he,selection:ne,onClose:ks,onResizeStart:Ee,onToggleExpanded:qe}):null)??(It&&ut?t.jsx(ho,{connection:$,expanded:he,selection:ut,onClose:se,onResizeStart:Ee,onToggleExpanded:qe}):null)??O??Z??en??pt??Yt,hr=t.jsx(qc,{open:ot,connection:$,scope:$e,tabs:Mt,onTabsChange:Js,cwd:Nt,appId:y,workspaceName:Ce,queuedCommand:rt,onClose:tr});return t.jsx("main",{className:`main-pane ${Xt} ${ot?"terminal-open":""} ${Sn?"diff-open":""} ${Cn?"diff-expanded":""}`,children:s==="apps"?t.jsx(o.Suspense,{fallback:null,children:t.jsx(Cu,{account:i?.account??null,connection:$,defaultTeamId:i?.preferences.defaultTeamId??null,onToast:J})}):s==="team"?t.jsxs(o.Suspense,{fallback:null,children:[r.teamId?t.jsx(Iu,{...r}):t.jsx($u,{}),Sn?An:null]}):s==="community"?t.jsx(o.Suspense,{fallback:null,children:t.jsx(Pu,{...a})}):s==="get-started"?t.jsx(o.Suspense,{fallback:null,children:t.jsx(Mu,{})}):s==="scheduled"?t.jsx(o.Suspense,{fallback:null,children:t.jsx(Eu,{connection:$,detailExpanded:he,onDetailResizeStart:Ee,onToggleDetailExpanded:qe})}):s==="outputs"?t.jsx(o.Suspense,{fallback:null,children:t.jsx(Au,{connection:$,onViewChat:Lt})}):s==="labs"?Cn?t.jsx(o.Suspense,{fallback:null,children:An}):t.jsxs(t.Fragment,{children:[t.jsx(o.Suspense,{fallback:null,children:t.jsx(Nu,{account:i?.account??null,closeDetailRequestId:C,closeDetailKind:A,onNewModel:g=>{gn({id:Date.now(),objective:null,initialSessionIds:[],initialTasksetId:g})},onUseAgent:wn,onCreateAgent:Ns,onImproveAgent:We,onDetailOpenChange:Rt,onSkillSelectionChange:Gn,onOpenRunConversation:qn,onAnswerQuestion:lt,onApplyCandidate:fn,onApprove:On,onCancel:zn,candidateReview:{diff:X.diff,error:X.error,loading:X.loading},onCandidateReviewChange:jn,onOpenPullRequest:mn,onOpenCandidateFiles:Ve,onPause:hn,onReconcilePullRequest:Fn,onRejectCandidate:Ot,onResume:pn,onRevise:zt,profileView:{payload:i,connection:$,onPayload:bt,onError:Je,onToast:J,onSkillCommand:Cs},training:{training:Me,sessions:Pn,localProjects:i?.localProjects??[],connection:$,defaultModel:{providerId:B,modelId:H},onError:Je,onToast:J,onSettingsPreferences:g=>{i&&bt({...i,preferences:g.preferences})},onOpenComputeSettings:gt,onOpenProviderSettings:un,onOpenDatasetStorageSettings:Qs,onOpenChat:Lt,onChatWithModel:dn,onOpenTasksetFiles:Te,launchRequest:p??ws,onLaunchHandled:g=>{if(p?.id===g){E(g);return}gn(R=>R?.id===g?null:R)},preferences:Ms,settingsPreferences:Kn,providerSettings:i?.providers??null,reasoningEffort:pe,selectedTasksetId:ft,onSelectedTasksetIdChange:nr,onSelectedTrainingJobIdChange:sr,detailTasksetId:Ln,onDetailTasksetIdChange:on}})}),hr,Sn?t.jsx(o.Suspense,{fallback:null,children:An}):null]}):Cn?t.jsx(o.Suspense,{fallback:null,children:An}):rs?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:`chat-column ${de?"has-approval":""}`,style:Ke,children:[t.jsx(o.Suspense,{fallback:null,children:t.jsx(zu,{accountBaseUrl:Ts,activeWorkspaceAppId:y,billingOrganizationSlug:Qt.organizationSlug,billingTeamId:Qt.teamId,connection:$,conversationKey:Ie??"draft",creation:Ht,onOpenBrowserLink:Nn,onOpenAttachmentInSidebar:d,onOpenFileInSidebar:l,onOpenProfileSettings:cn,onContentMutation:dr,onResolveUserQuestion:async(g,R)=>{const te=R.action==="answer"?R.text:"Dismiss this question";if(!await et([],null,te,{displayPrompt:te,turnMetadata:{userQuestionResolution:R}}))throw new Error("The question response could not be sent.")},onOpenSession:Lt,onScroll:g=>cs(g.currentTarget),preparingInitialScroll:Is,rows:ur,userAttachmentDisplay:B==="codex"?"compact":"full",threadRef:$s,workspaceRootPath:En})}),t.jsxs("div",{className:`composer-stack dock ${de?"has-approval":""}`,ref:Ps,children:[Ht?t.jsx(o.Suspense,{fallback:null,children:t.jsx(Fu,{compact:!0,creation:Ht,training:Me,onOpenTraining:()=>Ze("labs")})}):null,os,t.jsx(lo,{approval:de,onResolve:Dn}),mr&&!Is?t.jsx(yu,{canGoNext:Jt.canGoNext,canGoPrevious:Jt.canGoPrevious,onJumpToLatest:fr,onNext:()=>{Jt.canGoNext&&Ls("next")},onPrevious:()=>{Jt.canGoPrevious&&Ls("previous")}}):null,t.jsx(io,{experience:e,draftStore:m,attachmentRequest:ct,mode:"dock",focusRequestId:f,mentionApps:dt?j:[],connectedAppMentions:I,profileSkills:B==="codex"?i?.codexPersonalSkills??[]:ve,selectedMentionAppId:re,contextWindowStatus:x,goalRuntime:e!=="chat"?b:null,subagentRuntime:e!=="chat"?k:null,createImproveRuntime:dt?Mn:null,busy:le,running:le,submissionScopeKey:Rs,steerAutoDispatchBlocked:S||!!de,steerAutoDispatchReady:L&&!de,showProjectFooter:!1,connection:$,providerSettings:i?.providers??null,provider:B,model:H,projectTarget:U,profileTarget:null,actionCatalog:qt,requestedAction:kn,workspaceTarget:fe,codexPermissionMode:Q,codexReasoningEffort:pe,openPondCommandAccessMode:be,onProviderChange:_s,onProviderSetupOpen:un,onProjectTargetChange:Ae,onProfileTargetChange:g=>{tt(g)},onWorkspaceTargetChange:g=>{kt(g)},onModelChange:ls,onCodexPermissionModeChange:it,onCodexReasoningEffortChange:yt,onOpenPondCommandAccessModeChange:De,onMentionAppSelect:Ue,showToast:J,onSubmit:is,onStop:gs})]})]}),hr,t.jsx(o.Suspense,{fallback:null,children:An})]}):t.jsxs(t.Fragment,{children:[t.jsxs("section",{className:"start-panel",children:[t.jsx(nu,{value:e==="chat"?"chat":"work",onChange:n}),t.jsxs("div",{className:"start-welcome",children:[t.jsx("h1",{children:Dt}),e==="work"?t.jsx(tu,{onSelect:g=>{m.set(g),v()}}):null,bs&&t.jsx(vu,{busy:Y,onSync:()=>{Bn()}})]}),t.jsxs("div",{className:"composer-stack start",children:[os,t.jsx(lo,{approval:de,onResolve:Dn}),t.jsx(io,{experience:e,draftStore:m,attachmentRequest:ct,mode:"start",autoFocus:!0,focusRequestId:f,mentionApps:dt?j:[],connectedAppMentions:I,profileSkills:B==="codex"?i?.codexPersonalSkills??[]:ve,selectedMentionAppId:re,contextWindowStatus:x,goalRuntime:e!=="chat"?b:null,subagentRuntime:e!=="chat"?k:null,createImproveRuntime:dt?Mn:null,busy:le,running:le,submissionScopeKey:Rs,steerAutoDispatchBlocked:S||!!de,steerAutoDispatchReady:L&&!de,connection:$,providerSettings:i?.providers??null,provider:B,model:H,showProjectFooter:e!=="chat",projectTarget:U,profileTarget:null,actionCatalog:qt,requestedAction:kn,workspaceTarget:fe,codexPermissionMode:Q,codexReasoningEffort:pe,openPondCommandAccessMode:be,onProviderChange:_s,onProviderSetupOpen:un,onProjectTargetChange:Ae,onProfileTargetChange:g=>{tt(g)},onWorkspaceTargetChange:g=>{kt(g)},onModelChange:ls,onCodexPermissionModeChange:it,onCodexReasoningEffortChange:yt,onOpenPondCommandAccessModeChange:De,onMentionAppSelect:Ue,showToast:J,onSubmit:is,onStop:gs})]})]}),hr,t.jsx(o.Suspense,{fallback:null,children:An})]})})}function Uu(e){const n=e.path.toLowerCase();return n.endsWith(".md")||n.endsWith(".mdx")?"text/markdown":n.endsWith(".json")?"application/json":n.endsWith(".yaml")||n.endsWith(".yml")?"application/yaml":"text/plain"}const Zu=Object.freeze(Object.defineProperty({__proto__:null,MainPane:Bu,shouldShowRightSidebarHomePanel:qo},Symbol.toStringTag,{value:"Module"}));export{lo as A,li as C,ui as F,xi as I,gi as L,Zu as M,wi as P,fi as a,hi as b,$c as c,Ac as d,nc as e,ec as f,ic as g,yl as h,Hs as i,Ur as j,lc as k,uc as r,Lc as s};