decocms 4.95.1 → 4.95.2

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 (235) hide show
  1. package/dist/client/assets/{AlertCircle-CdaQFqHl.js → AlertCircle-8aL2p4Jm.js} +1 -1
  2. package/dist/client/assets/{AreaChart-BagHq3g2.js → AreaChart-CH1JlaHA.js} +1 -1
  3. package/dist/client/assets/{ArrowRight-Cov2YPeB.js → ArrowRight-BmTkQdSS.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-_a-SRtGc.js → ArrowUp-BRv6jMcd.js} +1 -1
  5. package/dist/client/assets/{ArrowUpRight-DJyks9HV.js → ArrowUpRight-DgWDf4bB.js} +1 -1
  6. package/dist/client/assets/{Check-L1zt1MhQ.js → Check-xlx8bieA.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-MzaIveO0.js → CheckCircle-BhHr7P8S.js} +1 -1
  8. package/dist/client/assets/{ChevronDown-ste9rvwa.js → ChevronDown-z_OgoJuG.js} +1 -1
  9. package/dist/client/assets/{ChevronRight-DjxxY9yH.js → ChevronRight-HByc-_dD.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-BMKp68Ef.js → ChevronUp-C0dubflE.js} +1 -1
  11. package/dist/client/assets/{Copy01-LCLhyD88.js → Copy01-BhLnIcPa.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-DCjclS0s.js → DotsVertical-9e8whEmO.js} +1 -1
  13. package/dist/client/assets/{Eye-DfJI2F2R.js → Eye-Dmrq3Yx3.js} +1 -1
  14. package/dist/client/assets/{FilterLines-BqkGYn3N.js → FilterLines-LxfJFt1s.js} +1 -1
  15. package/dist/client/assets/{Globe01-DTnpQEvE.js → Globe01-C1OI0rNn.js} +1 -1
  16. package/dist/client/assets/{Globe04-CWIUsgNy.js → Globe04-D37KO3Rl.js} +1 -1
  17. package/dist/client/assets/{HardDrive-CalrZSFc.js → HardDrive-xaUFGQWK.js} +1 -1
  18. package/dist/client/assets/{Image01-SH1T61tk.js → Image01-D2MElAgS.js} +1 -1
  19. package/dist/client/assets/{Key01-n8lq21nZ.js → Key01-CJ4v8ToT.js} +1 -1
  20. package/dist/client/assets/{LayoutLeft-D1i_m16o.js → LayoutLeft-BXx4559W.js} +1 -1
  21. package/dist/client/assets/{LinkExternal01-BnAWWVH2.js → LinkExternal01-RdFrwyl0.js} +1 -1
  22. package/dist/client/assets/{Monitor01-WjwD_B76.js → Monitor01-ByOW8gCA.js} +1 -1
  23. package/dist/client/assets/{Package-NScsE20z.js → Package-BApyVZZF.js} +1 -1
  24. package/dist/client/assets/{Palette-Dq9W8WsR.js → Palette-gwCbQEVd.js} +1 -1
  25. package/dist/client/assets/{Play-DwFJH11i.js → Play-CRcD5urt.js} +1 -1
  26. package/dist/client/assets/{Plus-B9C9Hujd.js → Plus-CpvaryXc.js} +1 -1
  27. package/dist/client/assets/{SearchLg-C07Q8QRW.js → SearchLg-BLbYMh4R.js} +1 -1
  28. package/dist/client/assets/{SearchMd-DP6rSkG4.js → SearchMd-BbTMkDIb.js} +1 -1
  29. package/dist/client/assets/{Settings02-CNqO4CPf.js → Settings02-CoD4T3JT.js} +1 -1
  30. package/dist/client/assets/{Shield01-qRQ0B-Cf.js → Shield01-BSQ914Nd.js} +1 -1
  31. package/dist/client/assets/{Star01-Cc38MZxO.js → Star01-B_ldc-QG.js} +1 -1
  32. package/dist/client/assets/{Stars01-DFWKWgNe.js → Stars01-BEQN6TZj.js} +1 -1
  33. package/dist/client/assets/{Stars02-BDaM006Z.js → Stars02-wl-TgjVw.js} +1 -1
  34. package/dist/client/assets/{Sun-DuSRYQOH.js → Sun-DcglW2RF.js} +1 -1
  35. package/dist/client/assets/{SwitchHorizontal01-BfOiWCGP.js → SwitchHorizontal01-BjhVVVE7.js} +1 -1
  36. package/dist/client/assets/{Tool01-CGUbJHe6.js → Tool01-F8NWFSUY.js} +1 -1
  37. package/dist/client/assets/{Tool02-yWUlg2Jl.js → Tool02-CYQFsqUw.js} +1 -1
  38. package/dist/client/assets/{Trash01-qeRcmh_t.js → Trash01-CFIi5PAY.js} +1 -1
  39. package/dist/client/assets/{TrendUp01-C15jO-JN.js → TrendUp01-B11vKIzx.js} +1 -1
  40. package/dist/client/assets/{Upload01-DUtmbuEn.js → Upload01-CYv9Q0Sh.js} +1 -1
  41. package/dist/client/assets/{User01-BwTr9f5y.js → User01-BHW_CvWq.js} +1 -1
  42. package/dist/client/assets/{Users01-7br16I2u.js → Users01-CVvGtppm.js} +1 -1
  43. package/dist/client/assets/{Users03-sWa9-yJE.js → Users03-Bg-uyP8J.js} +1 -1
  44. package/dist/client/assets/{X-BYK4muxp.js → X-B9OMbRgI.js} +1 -1
  45. package/dist/client/assets/{XCircle-DQ0bT2Xh.js → XCircle-z2zpbAQl.js} +1 -1
  46. package/dist/client/assets/{XClose-Djg48M2y.js → XClose-Bvx5TP10.js} +1 -1
  47. package/dist/client/assets/{Zap-BIGnAJhj.js → Zap-CaoQpAZT.js} +1 -1
  48. package/dist/client/assets/{ZapSquare-BO7N9q2-.js → ZapSquare-NmRRaYpN.js} +1 -1
  49. package/dist/client/assets/{ZoomOut-CejWxeXb.js → ZoomOut-Bjuv5wtp.js} +1 -1
  50. package/dist/client/assets/{access-gate-hWVXWH-C.js → access-gate-CSvdc98W.js} +1 -1
  51. package/dist/client/assets/{add-section-modal-BKKn2cBw.js → add-section-modal-BlKiDhBw.js} +1 -1
  52. package/dist/client/assets/{agent-icon-yglVWNMq.js → agent-icon-kMrNxjYJ.js} +1 -1
  53. package/dist/client/assets/{agents-list-C2AH2ZTQ.js → agents-list-4wX4J2kJ.js} +1 -1
  54. package/dist/client/assets/{ai-providers-CvWWN6p0.js → ai-providers-Dj7ASIds.js} +1 -1
  55. package/dist/client/assets/{alert-C2Xn0s7k.js → alert-CgsPHe2o.js} +1 -1
  56. package/dist/client/assets/{alert-dialog-DFT5_7dO.js → alert-dialog-lT11Jsbj.js} +1 -1
  57. package/dist/client/assets/{app-editor-BXtqlVCU.js → app-editor-B3W7tylT.js} +1 -1
  58. package/dist/client/assets/{auth-BZr8EHmi.js → auth-CaW_gj1t.js} +1 -1
  59. package/dist/client/assets/{auth-catchall-B9JfYMyP.js → auth-catchall-CWTTCQsz.js} +1 -1
  60. package/dist/client/assets/{auth-entry-DJVyveKU.js → auth-entry-IJFQq8w-.js} +1 -1
  61. package/dist/client/assets/{auth-split-layout-D4gZanxW.js → auth-split-layout-C25aJ8eh.js} +1 -1
  62. package/dist/client/assets/{authenticate-and-persist-oauth-CpPUo5MX.js → authenticate-and-persist-oauth-jkSUOcu8.js} +1 -1
  63. package/dist/client/assets/{automation-list-row-PQh9RFJz.js → automation-list-row-QQUoi2db.js} +1 -1
  64. package/dist/client/assets/{automation-runs-BkYkVwPY.js → automation-runs-Cs7mheBT.js} +1 -1
  65. package/dist/client/assets/{automations-D2bv4snW.js → automations-BzzWpoAs.js} +1 -1
  66. package/dist/client/assets/{autosend-pURvoWwX.js → autosend-CSO0mWVp.js} +1 -1
  67. package/dist/client/assets/{avatar-DZQ3Pejc.js → avatar-BHNRf2BK.js} +1 -1
  68. package/dist/client/assets/{badge-tRp7IfGb.js → badge-0FaSmMEN.js} +1 -1
  69. package/dist/client/assets/{block-document-BxADDFPU.js → block-document-BV8UCOiY.js} +1 -1
  70. package/dist/client/assets/{brand-context-BSI08ulM.js → brand-context-CnL-EXLr.js} +1 -1
  71. package/dist/client/assets/{buckets-B3DpKkO7.js → buckets-BhRo2ooL.js} +1 -1
  72. package/dist/client/assets/{bulk-category-panel-GNC4wgLD.js → bulk-category-panel-CzxYutCW.js} +1 -1
  73. package/dist/client/assets/{calendar-BFap2Gyw.js → calendar-ajXRpj7H.js} +1 -1
  74. package/dist/client/assets/{capability-load-error-BoQyulw4.js → capability-load-error-D08tgLJn.js} +1 -1
  75. package/dist/client/assets/{card-BFaEMAcD.js → card-CxpjTUKu.js} +1 -1
  76. package/dist/client/assets/{category-editor-CS6NoJ0d.js → category-editor-VzyKXFmI.js} +1 -1
  77. package/dist/client/assets/{chat-context-B8zmzrLo.js → chat-context-BKkLQtRB.js} +1 -1
  78. package/dist/client/assets/{checkbox-CSxALpSd.js → checkbox-9SStA5q1.js} +1 -1
  79. package/dist/client/assets/{cli-auth-success-Bz0Qm1gF.js → cli-auth-success-DMtwNV80.js} +1 -1
  80. package/dist/client/assets/{collection-detail-D3ZVqoRT.js → collection-detail-CjiPw-t8.js} +1 -1
  81. package/dist/client/assets/{collection-display-button-CwYXQHk_.js → collection-display-button-BkQRfMlH.js} +1 -1
  82. package/dist/client/assets/{collection-search-C26mO7tt.js → collection-search-DZDCl18y.js} +1 -1
  83. package/dist/client/assets/{collection-table-wrapper-D350rJfW.js → collection-table-wrapper-3CLNdiVr.js} +1 -1
  84. package/dist/client/assets/{collection-tabs-C2N7Gsrx.js → collection-tabs-C2iwwrh8.js} +1 -1
  85. package/dist/client/assets/{command-g-mrhqk4.js → command-Dv4-KFR5.js} +1 -1
  86. package/dist/client/assets/{commerce-onboarding-oYMpNL3-.js → commerce-onboarding-Cw_rAIUN.js} +1 -1
  87. package/dist/client/assets/{companions-core-C4XWmT-B.js → companions-core-AOH9czLM.js} +1 -1
  88. package/dist/client/assets/{connect-D_C13SPH.js → connect-Cqt8XvcG.js} +1 -1
  89. package/dist/client/assets/{connect-desktop-dialog-Ddq0AXN_.js → connect-desktop-dialog-CcP2o0mO.js} +1 -1
  90. package/dist/client/assets/{connection-card-DSiFCHTb.js → connection-card-DSeJr6d2.js} +1 -1
  91. package/dist/client/assets/{connection-detail-B3zC3uoA.js → connection-detail-D0NuPfPl.js} +1 -1
  92. package/dist/client/assets/{connection-form-helpers-DqE8VlOL.js → connection-form-helpers-Ce26XCbs.js} +1 -1
  93. package/dist/client/assets/{connections-DNK3PDxG.js → connections-CaxsgoYU.js} +1 -1
  94. package/dist/client/assets/{decopilot-sse-pool-Czpmu6TG.js → decopilot-sse-pool-DWXTDK7c.js} +1 -1
  95. package/dist/client/assets/{dialog-BhHo_8aX.js → dialog-B8iPXZfB.js} +1 -1
  96. package/dist/client/assets/{domain-settings-Ditk8ojC.js → domain-settings-DkOZ5_VY.js} +1 -1
  97. package/dist/client/assets/{drawer-BtalvzOh.js → drawer-D5z1QpZ1.js} +1 -1
  98. package/dist/client/assets/{dropdown-menu-CS4ITtQz.js → dropdown-menu-D3W9Mypw.js} +1 -1
  99. package/dist/client/assets/{empty-state-BKVeh2JK.js → empty-state-B0XUVWqe.js} +1 -1
  100. package/dist/client/assets/{extract-connection-data-C_u7UnJF.js → extract-connection-data-ChcGsUj8.js} +1 -1
  101. package/dist/client/assets/{file-explorer-B0O5puyX.js → file-explorer-DIO_SQJ1.js} +1 -1
  102. package/dist/client/assets/{file-type-icon-CAWuba96.js → file-type-icon-CICh64eJ.js} +1 -1
  103. package/dist/client/assets/{files-CzJ2I1iX.js → files-Cql2muKm.js} +1 -1
  104. package/dist/client/assets/{form-CzoZxyKx.js → form-BbtpCekf.js} +1 -1
  105. package/dist/client/assets/{general-BBZsnwfo.js → general-DPD4y6iK.js} +1 -1
  106. package/dist/client/assets/{github-repo-picker-BDoqlkEl.js → github-repo-picker-qhKlxIkP.js} +1 -1
  107. package/dist/client/assets/{hooks-D4wZCWx0.js → hooks-QkqjVdn8.js} +1 -1
  108. package/dist/client/assets/{index-DgiImAyY.js → index-B72iIhnj.js} +1 -1
  109. package/dist/client/assets/{index-C_Zijcof.js → index-BD3KwOs3.js} +1 -1
  110. package/dist/client/assets/{index-Dgwu6aJL.js → index-BDQNsoxm.js} +1 -1
  111. package/dist/client/assets/{index-DS2AuJy-.js → index-BUJePXEL.js} +1 -1
  112. package/dist/client/assets/{index-58E47QOH.js → index-BdfBtWtk.js} +1 -1
  113. package/dist/client/assets/{index-K_meiP0u.js → index-BmTD_ujn.js} +1 -1
  114. package/dist/client/assets/{index-B28hvUXv.js → index-Bz75jbQc.js} +1 -1
  115. package/dist/client/assets/{index-BtvbO-YY.js → index-CfAl6qA3.js} +3 -3
  116. package/dist/client/assets/{index-CHGiYPlv.js → index-CwSqgILb.js} +9 -9
  117. package/dist/client/assets/{index-DuRfU6hc.js → index-D7GpXBZi.js} +1 -1
  118. package/dist/client/assets/{index-DOnqxg7a.js → index-DCLh1sVt.js} +1 -1
  119. package/dist/client/assets/{index-_3eICCSJ.js → index-DFylQUoD.js} +3 -3
  120. package/dist/client/assets/{index-B3rpW3YZ.js → index-DyxjlEL3.js} +1 -1
  121. package/dist/client/assets/{index-Qmmk-CVi.js → index-krar3iag.js} +1 -1
  122. package/dist/client/assets/{index-redirect-Dk66NSBz.js → index-redirect-BIF-9n41.js} +1 -1
  123. package/dist/client/assets/{input-B_sJYQmR.js → input-C96iFBVQ.js} +1 -1
  124. package/dist/client/assets/{integration-icon-D8ONihzR.js → integration-icon-B1RhpoYr.js} +1 -1
  125. package/dist/client/assets/{invite-member-dialog-DAWEia1M.js → invite-member-dialog-xjgZGOB2.js} +1 -1
  126. package/dist/client/assets/{label-DFLzLt29.js → label-Dyml5mFF.js} +1 -1
  127. package/dist/client/assets/{layout-CzxSs3tN.js → layout-DDL4dMPD.js} +1 -1
  128. package/dist/client/assets/{login-CHdAxa3B.js → login-CoR8jNzG.js} +1 -1
  129. package/dist/client/assets/{mcp-oauth-c9yHY2lN.js → mcp-oauth-C3_4QnQD.js} +1 -1
  130. package/dist/client/assets/{members-BSctJ4Dt.js → members-Bq1eH0V7.js} +1 -1
  131. package/dist/client/assets/{monaco-editor-BAOenOTd.js → monaco-editor-CzUxXwGN.js} +1 -1
  132. package/dist/client/assets/{monitoring-stats-row-CDlw7YVI.js → monitoring-stats-row-B0DrzvEt.js} +1 -1
  133. package/dist/client/assets/{multi-select-BMnTeVlJ.js → multi-select-rPe-eyDx.js} +1 -1
  134. package/dist/client/assets/{oauth-callback-DighZLSE.js → oauth-callback-BrUhk0Wa.js} +1 -1
  135. package/dist/client/assets/{oauth-callback-ai-provider-Dxa7fBXN.js → oauth-callback-ai-provider-B8YVCFyJ.js} +1 -1
  136. package/dist/client/assets/{onboarding-Bd1JidMq.js → onboarding-COoyusCG.js} +1 -1
  137. package/dist/client/assets/{org-install-BxMEPJ2B.js → org-install-JAHRkU5h.js} +1 -1
  138. package/dist/client/assets/{org-layout-Bd18fWgm.js → org-layout-D60pVxIN.js} +1 -1
  139. package/dist/client/assets/{organization-choice-B6HwP4Tc.js → organization-choice-C6Ls0A49.js} +1 -1
  140. package/dist/client/assets/{orgs-BCYlPNJI.js → orgs-DztT5sab.js} +1 -1
  141. package/dist/client/assets/{page-seo-form-138jxBGg.js → page-seo-form-B_P0EHl2.js} +1 -1
  142. package/dist/client/assets/page-seo-sheet-DHzmRm4L.js +1 -0
  143. package/dist/client/assets/{popover-DwFxfwW1.js → popover-CNhMnjco.js} +1 -1
  144. package/dist/client/assets/{post-editor-DltwfLuy.js → post-editor-D_xoTmn-.js} +1 -1
  145. package/dist/client/assets/{primitives-BqTD_FqC.js → primitives-CBYGlggB.js} +1 -1
  146. package/dist/client/assets/{profile-CxHF32FT.js → profile-cvRYji9N.js} +1 -1
  147. package/dist/client/assets/project-app-view-CBEQxExF.js +1 -0
  148. package/dist/client/assets/record-editor-PW0VGnvH.js +1 -0
  149. package/dist/client/assets/redirect-editor-DsFvTbg2.js +1 -0
  150. package/dist/client/assets/registry-CvDjs0_s.js +2 -0
  151. package/dist/client/assets/{registry-layout-C4qIpvwO.js → registry-layout-bAxFNLjy.js} +1 -1
  152. package/dist/client/assets/{reports-BAyzZeWB.js → reports-CQcFaphb.js} +1 -1
  153. package/dist/client/assets/{require-capability-9SFR5rb-.js → require-capability-DxlH57sg.js} +1 -1
  154. package/dist/client/assets/{required-auth-layout-CcmRmSDB.js → required-auth-layout-C-fhbIaJ.js} +1 -1
  155. package/dist/client/assets/{reset-password-BArup2RO.js → reset-password-DNx83PQG.js} +1 -1
  156. package/dist/client/assets/{roles-A1577aL6.js → roles-BHDPkFyx.js} +1 -1
  157. package/dist/client/assets/{search-input-CPAXCLRZ.js → search-input-DzbdykkS.js} +1 -1
  158. package/dist/client/assets/{secrets-BRyxdGkx.js → secrets-BiPQdzxP.js} +1 -1
  159. package/dist/client/assets/{sections-editor-Gc_tx3k8.js → sections-editor-DtTXEdpr.js} +1 -1
  160. package/dist/client/assets/{select-TTPpfzgt.js → select-DfWJsEeW.js} +1 -1
  161. package/dist/client/assets/{select-model-Cnv_ibpl.js → select-model-va_ybRaj.js} +1 -1
  162. package/dist/client/assets/{self-tool-result-7fY-wes8.js → self-tool-result-BYn91ML_.js} +1 -1
  163. package/dist/client/assets/{seo-editor-CKIx7Ev1.js → seo-editor-DhB9wLXc.js} +1 -1
  164. package/dist/client/assets/{settings-layout-Ch199aiR.js → settings-layout-C0ekeOOv.js} +1 -1
  165. package/dist/client/assets/{settings-section-CC-4Jtnh.js → settings-section-ZxnBfBdb.js} +1 -1
  166. package/dist/client/assets/{shell-controls-B4QWth0f.js → shell-controls-CWv-6pxT.js} +1 -1
  167. package/dist/client/assets/{shell-layout-CoLLzn9H.js → shell-layout-B3ubQVJp.js} +1 -1
  168. package/dist/client/assets/{sidebar-BdJCwNma.js → sidebar-Bmfjcji7.js} +1 -1
  169. package/dist/client/assets/{skeleton--YzuGfHz.js → skeleton-DYsdfnWI.js} +1 -1
  170. package/dist/client/assets/{sso-BMhbiV6W.js → sso-DxE0pH8a.js} +1 -1
  171. package/dist/client/assets/{store-CiVH2RIN.js → store-DQtXE3rO.js} +1 -1
  172. package/dist/client/assets/store-registry-DJ5jwwgh.js +2 -0
  173. package/dist/client/assets/{studio-tools-B1kdyH0X.js → studio-tools-CZ0lHHg8.js} +1 -1
  174. package/dist/client/assets/{switch-2of9e1Pf.js → switch-C8NVFCle.js} +1 -1
  175. package/dist/client/assets/{table-BwYfp4B-.js → table-rrhMpufJ.js} +1 -1
  176. package/dist/client/assets/{tabs-CVlUtRmS.js → tabs-Zz7_UEQN.js} +1 -1
  177. package/dist/client/assets/{textarea-Dbhv6rS_.js → textarea-Q9mIBUV-.js} +1 -1
  178. package/dist/client/assets/{toggle-group-Di2SNh_L.js → toggle-group-B8ZzagA8.js} +1 -1
  179. package/dist/client/assets/{toolbar-tptVGV-T.js → toolbar-1oJVDPdM.js} +1 -1
  180. package/dist/client/assets/{toolbar-icon-button-iNad5FK0.js → toolbar-icon-button-CqHN6MBe.js} +1 -1
  181. package/dist/client/assets/{tooltip-9cwJhSFd.js → tooltip-lvzwcxmr.js} +1 -1
  182. package/dist/client/assets/{use-ai-providers-CmTPM2dv.js → use-ai-providers-DLA17X4H.js} +1 -1
  183. package/dist/client/assets/{use-api-keys-Cu8rjQnp.js → use-api-keys-ZZNQlaQa.js} +1 -1
  184. package/dist/client/assets/{use-automations-D40MTJOG.js → use-automations-CtAoOh2g.js} +1 -1
  185. package/dist/client/assets/{use-autosave-Q8T9bi5T.js → use-autosave-Dj0woe8W.js} +1 -1
  186. package/dist/client/assets/{use-capability-fPLq6YoG.js → use-capability-x07oRB_v.js} +1 -1
  187. package/dist/client/assets/{use-clock-tick-JBKdZGDh.js → use-clock-tick-Cdnpjga1.js} +1 -1
  188. package/dist/client/assets/{use-collections-CV_TsUFs.js → use-collections-DJ2e88Xq.js} +1 -1
  189. package/dist/client/assets/{use-connection-BRQu0PKf.js → use-connection-CawdsRuN.js} +1 -1
  190. package/dist/client/assets/{use-copy-CMH3YN5-.js → use-copy-aPelM9gN.js} +1 -1
  191. package/dist/client/assets/{use-create-virtual-mcp-g467HJAl.js → use-create-virtual-mcp-D42LRs4W.js} +1 -1
  192. package/dist/client/assets/{use-debounced-autosave-sUGnSDUu.js → use-debounced-autosave-D46G2Nb3.js} +1 -1
  193. package/dist/client/assets/{use-debounced-value-CfrD-Ttf.js → use-debounced-value-U6TK_cAJ.js} +1 -1
  194. package/dist/client/assets/{use-deco-credits-CcbI-TH5.js → use-deco-credits-tLUAgc-O.js} +1 -1
  195. package/dist/client/assets/{use-decopilot-events-dX9WsnUS.js → use-decopilot-events-zHZ5c1US.js} +1 -1
  196. package/dist/client/assets/{use-delete-connection-Clb2-JR1.js → use-delete-connection-B0eSidiK.js} +1 -1
  197. package/dist/client/assets/{use-deployment-admin-DEQXPunY.js → use-deployment-admin-C0wf5iR9.js} +1 -1
  198. package/dist/client/assets/{use-file-configs-CfqRNUzP.js → use-file-configs-D6OQvi29.js} +1 -1
  199. package/dist/client/assets/{use-infinite-scroll-BonCf-uW.js → use-infinite-scroll-DgeL9DrI.js} +1 -1
  200. package/dist/client/assets/{use-join-requests-Bj_cRaW0.js → use-join-requests-DYt3ADmT.js} +1 -1
  201. package/dist/client/assets/{use-mcp-auth-status-CLvmNhzR.js → use-mcp-auth-status-mlZiRJgT.js} +1 -1
  202. package/dist/client/assets/{use-mcp-client-BDydpGXC.js → use-mcp-client-CAtCw6yl.js} +1 -1
  203. package/dist/client/assets/{use-mcp-tools-u68duyZ2.js → use-mcp-tools-BkyW84hu.js} +1 -1
  204. package/dist/client/assets/{use-members-8JQgnpEk.js → use-members-BPomUDuY.js} +1 -1
  205. package/dist/client/assets/{use-mobile-DC-H7nsJ.js → use-mobile-D0KrjV8M.js} +1 -1
  206. package/dist/client/assets/{use-navigate-to-agent-BxZflEOw.js → use-navigate-to-agent-CYMIGICl.js} +1 -1
  207. package/dist/client/assets/{use-org-auth-client-DrxeOGQ4.js → use-org-auth-client-BY7CXLsN.js} +1 -1
  208. package/dist/client/assets/{use-org-sso-BosEp_Ab.js → use-org-sso-BNL5m012.js} +1 -1
  209. package/dist/client/assets/{use-organization-roles-ChAylB-B.js → use-organization-roles-DP7VZAnw.js} +1 -1
  210. package/dist/client/assets/{use-organization-settings-B2unqpKQ.js → use-organization-settings-Btln8Py9.js} +1 -1
  211. package/dist/client/assets/{use-registry-app-CHS0S4YQ.js → use-registry-app-DGmz0d5i.js} +1 -1
  212. package/dist/client/assets/{use-registry-connections-TAn2JTW7.js → use-registry-connections-BNAx72pz.js} +1 -1
  213. package/dist/client/assets/{use-secrets-BwDhV9o1.js → use-secrets-Brx7T76W.js} +1 -1
  214. package/dist/client/assets/{use-status-sounds-DLYR4WdM.js → use-status-sounds-WASJAR7W.js} +1 -1
  215. package/dist/client/assets/{use-t-BGNaKfJX.js → use-t-Ca0ZB4W6.js} +1 -1
  216. package/dist/client/assets/{use-view-mode-DPa-2KX2.js → use-view-mode-CcZjEdUn.js} +1 -1
  217. package/dist/client/assets/{use-virtual-mcp-Zb-pycz2.js → use-virtual-mcp--wK0dI9I.js} +1 -1
  218. package/dist/client/assets/useInfiniteQuery-BT7hVNXg.js +1 -0
  219. package/dist/client/assets/{useRouterState-Cgc6JWBa.js → useRouterState-G26gh0wT.js} +1 -1
  220. package/dist/client/assets/useSuspenseInfiniteQuery-CIkQZwY0.js +1 -0
  221. package/dist/client/assets/{users-Cvx3FCBd.js → users-Cd08kHgh.js} +1 -1
  222. package/dist/client/assets/{variant-calendar-BdY0lXCO.js → variant-calendar-DuJ3EROs.js} +1 -1
  223. package/dist/client/assets/{view-mode-toggle-2HIAhZ9T.js → view-mode-toggle-IMXhdpcC.js} +1 -1
  224. package/dist/client/index.html +1 -1
  225. package/dist/server/cli.js +1 -1
  226. package/dist/server/server.js +1 -1
  227. package/package.json +1 -1
  228. package/dist/client/assets/page-seo-sheet-Cfwy2L4k.js +0 -1
  229. package/dist/client/assets/project-app-view-DxgfMS4y.js +0 -1
  230. package/dist/client/assets/record-editor-otSX7UwZ.js +0 -1
  231. package/dist/client/assets/redirect-editor-CC92-3j9.js +0 -1
  232. package/dist/client/assets/registry-BvkHxKgI.js +0 -2
  233. package/dist/client/assets/store-registry-CkfO8nd-.js +0 -2
  234. package/dist/client/assets/useInfiniteQuery-RcsnwPkt.js +0 -1
  235. package/dist/client/assets/useSuspenseInfiniteQuery-DKEXqmd5.js +0 -1
@@ -1 +1 @@
1
- import{c as z,b as ie,C as X,D as Ns,j as s,B as le,r as M,F as Cs,E as Ve,a as se,v as ws,K as Tt,d as Be,p as q,G as we,l as P,H as ks,I as Is,J as As,M as zs,P as $s,q as Ts,t as ee,s as Os,i as Ot,e as qe,u as ke,L as Mt,R as Ms,U as Ps,V as Es,W as Ds,m as Fs,X as Rs,O as Ls,Y as Bs}from"./index-BtvbO-YY.js";import{u as re,S as Ye,a as Xe,b as te,c as Y,d as B,e as Pt,f as Us,g as Et,h as Hs,i as he,j as Gs,k as Ws,l as Ks}from"./sidebar-BdJCwNma.js";import{u as Qe}from"./use-mobile-DC-H7nsJ.js";import{C as Vs,p as Ee,s as qs,b as Ys,S as Xs,d as Qs,e as Js,c as Zs,n as en}from"./self-tool-result-7fY-wes8.js";import{f as tn,a as Je,e as Ze,g as sn,d as Dt,h as Ft,D as Rt}from"./dialog-BhHo_8aX.js";import{f as nn}from"./tab-id-BijBBRwE.js";import{C as on,W as Lt,g as ln,u as Bt,S as Ut,a as Ne,i as rn,b as an}from"./use-mcp-client-BDydpGXC.js";import{i as et}from"./ArrowRight-Cov2YPeB.js";import{S as ne}from"./skeleton--YzuGfHz.js";import{i as Ht}from"./LayoutLeft-D1i_m16o.js";import{t as tt}from"./ChevronDown-ste9rvwa.js";import{T as ae,a as ce,b as de,c as Gt}from"./tooltip-9cwJhSFd.js";import{u as Wt,a as st}from"./use-virtual-mcp-Zb-pycz2.js";import{A as me,t as Kt,a as cn,i as dn,b as dt,c as mn,d as un,e as Vt,f as mt,g as fn,s as xn,h as hn}from"./agent-icon-yglVWNMq.js";import{P as xe,a as Ie,b as Ae}from"./popover-DwFxfwW1.js";import{i as ve}from"./Check-L1zt1MhQ.js";import{s as pe}from"./Plus-B9C9Hujd.js";import{i as qt}from"./SearchMd-DP6rSkG4.js";import{s as pn}from"./XClose-Djg48M2y.js";import{A as gn,a as bn,b as jn,c as vn,d as yn,e as Sn,f as _n}from"./alert-dialog-DFT5_7dO.js";import{F as Nn,a as Cn,b as wn,c as kn,d as In,e as An,f as zn}from"./form-CzoZxyKx.js";import{I as $n}from"./input-B_sJYQmR.js";import{S as Tn,u as On,C as Mn}from"./chat-context-B8zmzrLo.js";import{T as ue}from"./toolbar-icon-button-iNad5FK0.js";import{D as Yt,a as Xt,b as Qt}from"./drawer-BtalvzOh.js";import{G as Pn}from"./use-registry-app-CHS0S4YQ.js";import{G as En}from"./github-repo-picker-BDoqlkEl.js";import{u as Jt,a as nt,b as Dn,T as Fn}from"./hooks-D4wZCWx0.js";import{r as Rn,u as it,f as Ln}from"./shell-layout-CoLLzn9H.js";import{u as Bn,g as Un,a as Hn,b as Gn,S as Zt}from"./use-navigate-to-agent-BxZflEOw.js";import{g as Wn,a as es,u as Kn,A as Vn,b as qn}from"./use-deco-credits-CcbI-TH5.js";import{f as Yn}from"./reusable-new-chat-CouMjkYR.js";import{A as Ue}from"./avatar-DZQ3Pejc.js";import{a as He}from"./Copy01-LCLhyD88.js";import{n as Xn,i as Qn}from"./Globe01-DTnpQEvE.js";import{i as Jn}from"./ZoomOut-CejWxeXb.js";import{n as Zn}from"./LinkExternal01-BnAWWVH2.js";import{i as ut,a as ei}from"./ZapSquare-BO7N9q2-.js";import{i as Ge}from"./Monitor01-WjwD_B76.js";import{n as ti,a as si}from"./Sun-DuSRYQOH.js";import{a as ze}from"./Settings02-CNqO4CPf.js";import{i as ni}from"./Shield01-qRQ0B-Cf.js";import{a as ii}from"./Users03-sWa9-yJE.js";import{u as oi}from"./use-deployment-admin-DEQXPunY.js";import"./index-B28hvUXv.js";import{a as ts}from"./XCircle-DQ0bT2Xh.js";import{I as ss}from"./invite-member-dialog-DAWEia1M.js";import{u as ft}from"./use-copy-CMH3YN5-.js";import{m as li,u as ri,c as ai}from"./use-api-keys-Cu8rjQnp.js";import{v as ci,C as xt}from"./connect-desktop-dialog-Ddq0AXN_.js";import{u as $e}from"./use-organization-settings-B2unqpKQ.js";import{i as di}from"./FilterLines-BqkGYn3N.js";import{T as mi,a as ui}from"./toggle-group-Di2SNh_L.js";import{C as fi,a as xi,b as hi,c as pi,d as gi}from"./command-g-mrhqk4.js";import{u as ns}from"./studio-tools-B1kdyH0X.js";import{i as is}from"./Zap-BIGnAJhj.js";import{S as os,M as bi}from"./shell-controls-B4QWth0f.js";import{n as ji}from"./Stars02-BDaM006Z.js";import{g as vi,u as yi,S as Si}from"./use-clock-tick-JBKdZGDh.js";import{a as _i}from"./format-time-BnbuEtat.js";import{i as Ni}from"./ChevronRight-DjxxY9yH.js";import{T as Z}from"./toolbar-tptVGV-T.js";import"./X-BYK4muxp.js";import"./integration-icon-D8ONihzR.js";import"./Tool02-yWUlg2Jl.js";import"./CheckCircle-MzaIveO0.js";import"./companions-core-C4XWmT-B.js";import"./extract-connection-data-C_u7UnJF.js";import"./github-repo-scope-DjMZbiKa.js";import"./Eye-DfJI2F2R.js";import"./use-debounced-value-CfrD-Ttf.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./authenticate-and-persist-oauth-CpPUo5MX.js";import"./mcp-oauth-c9yHY2lN.js";import"./auth-BZr8EHmi.js";import"./ArrowUpRight-DJyks9HV.js";import"./use-collections-CV_TsUFs.js";import"./AlertCircle-CdaQFqHl.js";import"./Tool01-CGUbJHe6.js";import"./ArrowUp-_a-SRtGc.js";import"./TrendUp01-C15jO-JN.js";import"./ChevronUp-BMKp68Ef.js";import"./DotsVertical-DCjclS0s.js";import"./Star01-Cc38MZxO.js";import"./Globe04-CWIUsgNy.js";import"./SwitchHorizontal01-BfOiWCGP.js";import"./HardDrive-CalrZSFc.js";import"./Image01-SH1T61tk.js";import"./Key01-n8lq21nZ.js";import"./Package-NScsE20z.js";import"./Palette-Dq9W8WsR.js";import"./Play-DwFJH11i.js";import"./SearchLg-C07Q8QRW.js";import"./Stars01-DFWKWgNe.js";import"./Trash01-qeRcmh_t.js";import"./Upload01-DUtmbuEn.js";import"./User01-BwTr9f5y.js";import"./Users01-7br16I2u.js";import"./label-DFLzLt29.js";import"./autosend-pURvoWwX.js";import"./use-ai-providers-CmTPM2dv.js";import"./location-BpLtHjTZ.js";import"./use-decopilot-events-dX9WsnUS.js";import"./decopilot-sse-pool-Czpmu6TG.js";import"./backoff-CrEUbyZT.js";import"./use-mcp-tools-u68duyZ2.js";import"./collection-search-C26mO7tt.js";import"./use-connection-BRQu0PKf.js";import"./delay-CnY5UFtP.js";import"./use-t-BGNaKfJX.js";import"./required-auth-layout-CcmRmSDB.js";import"./use-org-sso-BosEp_Ab.js";import"./connection-card-DSiFCHTb.js";import"./use-registry-connections-TAn2JTW7.js";import"./useInfiniteQuery-RcsnwPkt.js";import"./use-infinite-scroll-BonCf-uW.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./card-BFaEMAcD.js";import"./select-TTPpfzgt.js";import"./textarea-Dbhv6rS_.js";import"./connection-form-helpers-DqE8VlOL.js";import"./collection-tabs-C2N7Gsrx.js";import"./badge-tRp7IfGb.js";import"./useSuspenseInfiniteQuery-DKEXqmd5.js";import"./use-org-auth-client-DrxeOGQ4.js";import"./use-organization-roles-ChAylB-B.js";import"./index-DOnqxg7a.js";import"./differenceInSeconds-NQ4PDo0z.js";function Ci(t){const e=z.c(15),{siteUrl:n}=t,i=ie(),{org:o}=X();let l;e[0]!==i||e[1]!==o.id||e[2]!==o.slug?(l=()=>{localStorage.setItem(Ns.sidebarOpen(),JSON.stringify(!1)),i({to:"/$org/$taskId",params:{org:o.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:ln(o.id),main:nn(Lt.COMMERCE_DISCOVERY(o.id),on),sidepanel:0}})},e[0]=i,e[1]=o.id,e[2]=o.slug,e[3]=l):l=e[3];const r=l;let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(tn,{className:"bg-black/15 backdrop-blur-sm"}),e[4]=a):a=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(Je,{className:"sr-only",children:"Conecte suas ferramentas para ver o diagnóstico completo"}),e[5]=m):m=e[5];let c;e[6]!==r?(c=()=>s.jsxs("div",{className:"grid gap-4 p-6",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Não foi possível carregar as integrações. Você pode continuar e abrir o relatório mesmo assim."}),s.jsxs(le,{type:"button",size:"xl",className:"w-full",onClick:r,children:["Continuar",s.jsx(et,{size:18})]})]}),e[6]=r,e[7]=c):c=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Vs,{}),e[8]=d):d=e[8];let u;e[9]!==r||e[10]!==n?(u=s.jsx(M.Suspense,{fallback:d,children:s.jsx(Ai,{siteUrlFromUrl:n,onComplete:r})}),e[9]=r,e[10]=n,e[11]=u):u=e[11];let x;return e[12]!==c||e[13]!==u?(x=s.jsx(Ze,{open:!0,children:s.jsxs(sn,{children:[a,s.jsxs(Cs,{"data-slot":"commerce-connect-modal",onEscapeKeyDown:Ii,onPointerDownOutside:ki,onInteractOutside:wi,className:"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 flex h-[calc(100dvh-1rem)] w-full max-w-[calc(100%-1rem)] translate-x-[-50%] translate-y-[-50%] flex-col overflow-hidden rounded-2xl border p-0 shadow-md duration-200 sm:max-w-lg md:h-auto md:max-h-[calc(100dvh-2rem)] lg:max-h-[calc(100dvh-4rem)] lg:max-w-5xl",children:[m,s.jsx(Ve,{fallback:c,children:u})]})]})}),e[12]=c,e[13]=u,e[14]=x):x=e[14],x}function wi(t){return t.preventDefault()}function ki(t){return t.preventDefault()}function Ii(t){return t.preventDefault()}function Ai({siteUrlFromUrl:t,onComplete:e}){const{org:n}=X(),{data:i}=se.useSession(),o=Lt.COMMERCE_DISCOVERY(n.id),l=Bt({connectionId:Ut,orgId:n.id,orgSlug:n.slug}),a=ws({queryKey:Tt.commerceDiscoveryConnection(n.id,o),queryFn:async()=>{const v=await l.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}});return Ee(v)},retry:!1}).data.item,m=typeof a?.metadata?.siteUrl=="string"?a.metadata.siteUrl:void 0,c=t||m,d=qs(c),[u,x]=M.useState(!0),[f,h]=M.useState(null),g=Be({mutationFn:async v=>Ee(await l.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:v}})),retry:!1}),p=Be({mutationFn:async v=>Ee(await l.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:v}})),retry:!1}),b=Ys({siteUrl:c,email:i?.user?.email}),j=async()=>{h(null),q("commerce_onboarding_open_report_clicked",{domain:d??void 0,organization_id:n.id});const v=c?en(c):null;if(v?.ok)try{let y=await p.mutateAsync(v.value);if(y.triggered||(q("commerce_onboarding_run_reclaim",{domain:d??void 0,organization_id:n.id,reason:y.reason??"not_upgraded"}),await g.mutateAsync(v.value),y=await p.mutateAsync(v.value)),!y.triggered){q("commerce_onboarding_run_failed",{domain:d??void 0,organization_id:n.id,error:y.reason??"not_triggered"}),h("Não foi possível gerar o relatório para este site. Recarregue a página e tente novamente.");return}}catch(y){q("commerce_onboarding_run_failed",{domain:d??void 0,organization_id:n.id,error:y instanceof Error?y.message:String(y)}),h("Algo deu errado ao gerar seu relatório. Tente novamente em instantes.");return}e()};return s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4 p-4 lg:gap-6 lg:bg-sidebar lg:p-10",children:[d?s.jsx(Xs,{host:d}):null,s.jsx(Qs,{org:n,cdConnectionId:o,siteUrl:c,onReadinessChange:x}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-3",children:[s.jsx(Js,{href:b,orgId:n.id,className:"lg:hidden"}),f?s.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:f}):null,s.jsxs(le,{type:"button",size:"xl",className:"w-full rounded-2xl text-base font-medium whitespace-normal h-auto py-3",onClick:()=>{j()},disabled:p.isPending||!u,children:[p.isPending?"Abrindo relatório...":u?"Ver relatório completo":"Conecte uma ferramenta para continuar",!p.isPending&&u?s.jsx(et,{size:18}):null]})]})]}),s.jsx("aside",{className:"hidden lg:flex lg:w-[380px] lg:shrink-0 lg:items-center lg:justify-center lg:overflow-y-auto lg:border-l lg:border-border lg:bg-muted",children:s.jsx(Zs,{href:b,orgId:n.id})})]})}function zi(t){const e=z.c(5),{onPointerDown:n,onDoubleClick:i}=t,{state:o,isMobile:l}=re();if(l||o==="collapsed")return null;let r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={left:"var(--sidebar-width)"},a=s.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors duration-150 group-hover/resize:bg-border group-active/resize:bg-border"}),e[0]=r,e[1]=a):(r=e[0],a=e[1]);let m;return e[2]!==i||e[3]!==n?(m=s.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar",title:"Drag to resize, double-click to reset",onPointerDown:n,onDoubleClick:i,className:"group/resize absolute top-0 z-20 h-full w-2 -translate-x-1/2 cursor-col-resize",style:r,children:a}),e[2]=i,e[3]=n,e[4]=m):m=e[4],m}const ot=240,$i=400,Ti="sidebar.width";function ge(t){return Math.max(ot,Math.min($i,t))}function Oi(){const t=z.c(11),[e,n]=we(Ti,Mi),i=M.useRef(null);let o;t[0]!==n||t[1]!==e?(o=d=>{d.preventDefault();const u=d.clientX,x=ge(e),f=i.current??(typeof document<"u"?document.querySelector('[data-slot="sidebar-wrapper"]'):null),h=f?Array.from(f.querySelectorAll('[data-slot="sidebar"], [data-slot="sidebar-container"]')):[];for(const b of h)b.style.transition="none";const g=b=>{const j=ge(x+(b.clientX-u));f?.style.setProperty("--sidebar-width",`${j}px`)},p=b=>{const j=ge(x+(b.clientX-u));n(j);for(const v of h)v.style.transition="";window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",p),document.body.style.userSelect="",document.body.style.cursor=""};document.body.style.userSelect="none",document.body.style.cursor="col-resize",window.addEventListener("pointermove",g),window.addEventListener("pointerup",p)},t[0]=n,t[1]=e,t[2]=o):o=t[2];const l=o;let r;t[3]!==n?(r=()=>{n(ot)},t[3]=n,t[4]=r):r=t[4];const a=r;let m;t[5]!==e?(m=ge(e),t[5]=e,t[6]=m):m=t[6];let c;return t[7]!==l||t[8]!==a||t[9]!==m?(c={width:m,wrapperRef:i,onStartResize:l,resetWidth:a},t[7]=l,t[8]=a,t[9]=m,t[10]=c):c=t[10],c}function Mi(t){return typeof t=="number"?ge(t):ot}function ls(){return[]}function rs(t){const e=z.c(3),{children:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"flex h-6 items-center",children:s.jsx("div",{className:"h-0.5 w-16 rounded-full bg-sidebar-foreground/15"})}),e[0]=i):i=e[0];let o;return e[1]!==n?(o=s.jsxs(Ye,{className:"pt-0 pr-0 pb-2 pl-0 mt-2",children:[i,s.jsx(Xe,{children:s.jsx(te,{className:"gap-0.5",children:n})})]}),e[1]=n,e[2]=o):o=e[2],o}function as(t){const e=z.c(18),{item:n}=t,{isMobile:i,setOpenMobile:o}=re();let l;e[0]!==i||e[1]!==n||e[2]!==o?(l=()=>{q("nav_item_clicked",{nav_key:n.key,nav_label:n.label,is_active:!!n.isActive,is_mobile:i}),n.onClick?.(),i&&o(!1)},e[0]=i,e[1]=n,e[2]=o,e[3]=l):l=e[3];const r=l,a=n.key,m=n.isActive&&"z-10";let c;e[4]!==m?(c=P(m),e[4]=m,e[5]=c):c=e[5];let d;e[6]!==n.label?(d=s.jsx("span",{children:n.label}),e[6]=n.label,e[7]=d):d=e[7];let u;e[8]!==r||e[9]!==n.icon||e[10]!==n.isActive||e[11]!==n.label||e[12]!==d?(u=s.jsxs(Y,{onClick:r,isActive:n.isActive,tooltip:n.label,children:[n.icon,d]}),e[8]=r,e[9]=n.icon,e[10]=n.isActive,e[11]=n.label,e[12]=d,e[13]=u):u=e[13];let x;return e[14]!==n.key||e[15]!==c||e[16]!==u?(x=s.jsx(B,{className:c,children:u},a),e[14]=n.key,e[15]=c,e[16]=u,e[17]=x):x=e[17],x}function Pi(t){const e=z.c(12),{section:n}=t;switch(n.type){case"divider":{let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Pt,{className:"my-2"}),e[0]=i):i=e[0],i}case"spacer":{let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"flex-1"}),e[1]=i):i=e[1],i}case"group":{const i=n.group.label,o=n.group.defaultExpanded;let l;e[2]!==n.group.items?(l=n.group.items.map(Di),e[2]=n.group.items,e[3]=l):l=e[3];let r;return e[4]!==n.group.defaultExpanded||e[5]!==n.group.label||e[6]!==l?(r=s.jsx(rs,{label:i,defaultExpanded:o,children:l}),e[4]=n.group.defaultExpanded,e[5]=n.group.label,e[6]=l,e[7]=r):r=e[7],r}case"items":{let i;e[8]!==n.items?(i=n.items.map(Ei),e[8]=n.items,e[9]=i):i=e[9];let o;return e[10]!==i?(o=s.jsx(Ye,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(Xe,{children:s.jsx(te,{className:"gap-1.5",children:i})})}),e[10]=i,e[11]=o):o=e[11],o}case"custom":return n.content}}function Ei(t){return s.jsx(as,{item:t},t.key)}function Di(t){return s.jsx(as,{item:t},t.key)}function Fi(t){const e=z.c(17),{sections:n,footer:i,additionalContent:o,header:l,variant:r,contentClassName:a}=t,m=r===void 0?"sidebar":r;let c;e[0]!==l?(c=l&&s.jsx(Us,{className:"sidebar-titlebar wco-drag shrink-0 h-12 flex flex-row items-center px-2 py-0 group-data-[collapsible=icon]/sidebar:hidden",children:l}),e[0]=l,e[1]=c):c=e[1];let d;e[2]!==a?(d=P("flex flex-col flex-1 px-2 pb-2 gap-0.5",a),e[2]=a,e[3]=d):d=e[3];let u;e[4]!==n?(u=n.map(Ri),e[4]=n,e[5]=u):u=e[5];let x;e[6]!==o?(x=o&&s.jsx("div",{className:"flex flex-col flex-1 min-h-0 group-data-[state=collapsed]/sidebar:mt-1 group-data-[state=expanded]/sidebar:mt-2",children:o}),e[6]=o,e[7]=x):x=e[7];let f;e[8]!==d||e[9]!==u||e[10]!==x?(f=s.jsxs(Et,{className:d,children:[u,x]}),e[8]=d,e[9]=u,e[10]=x,e[11]=f):f=e[11];let h;return e[12]!==i||e[13]!==c||e[14]!==f||e[15]!==m?(h=s.jsxs(Hs,{variant:m,children:[c,f,i]}),e[12]=i,e[13]=c,e[14]=f,e[15]=m,e[16]=h):h=e[16],h}function Ri(t,e){return s.jsx(Pi,{section:t},e)}function cs(t){const e=z.c(2);let n;return e[0]!==t?(n=s.jsx(Fi,{...t}),e[0]=t,e[1]=n):n=e[1],n}cs.Skeleton=function(){return s.jsx("div",{className:"flex flex-col gap-0.5",children:Array.from({length:8}).map((e,n)=>s.jsx("div",{className:"w-full h-8",children:s.jsx(ne,{className:"h-full bg-sidebar-accent rounded-md"})},n))})};function ds(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Li=ks({name:Is().min(2,"Organization name is required")});function Bi(t){const e=z.c(41),{open:n,onOpenChange:i}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={resolver:As(Li),defaultValues:{name:""}},e[0]=o):o=e[0];const l=zs(o);let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r={mutationFn:Hi,onSuccess:Ui},e[1]=r):r=e[1];const a=Be(r),m=a.error instanceof Error?a.error.message:a.error?"Failed to create organization.":null;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs(jn,{children:[s.jsx(vn,{children:"Create a new organization"}),s.jsx(yn,{children:"Set up a new organization to collaborate with others."})]}),e[2]=c):c=e[2];let d;if(e[3]!==a||e[4]!==l){let _;e[6]!==a?(_=N=>a.mutateAsync(N),e[6]=a,e[7]=_):_=e[7],d=l.handleSubmit(_),e[3]=a,e[4]=l,e[5]=d}else d=e[5];let u;e[8]!==l.formState.isSubmitting?(u=_=>{const{field:N}=_;return s.jsxs(wn,{children:[s.jsx(kn,{children:"Organization Name"}),s.jsx(In,{children:s.jsx($n,{...N,placeholder:"Acme Inc.",disabled:l.formState.isSubmitting})}),s.jsx(An,{children:"The name of your company or organization"}),N.value&&s.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Organization URL:"," ",s.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",ds(N.value)]})]}),s.jsx(zn,{})]})},e[8]=l.formState.isSubmitting,e[9]=u):u=e[9];let x;e[10]!==l.control||e[11]!==u?(x=s.jsx(Nn,{control:l.control,name:"name",render:u}),e[10]=l.control,e[11]=u,e[12]=x):x=e[12];let f;e[13]!==m?(f=m&&s.jsx("div",{className:"text-destructive text-sm mt-2",children:m}),e[13]=m,e[14]=f):f=e[14];let h;e[15]!==a||e[16]!==l?(h=()=>{a.reset(),l.reset()},e[15]=a,e[16]=l,e[17]=h):h=e[17];let g;e[18]!==l.formState.isSubmitting||e[19]!==h?(g=s.jsx(gn,{disabled:l.formState.isSubmitting,onClick:h,children:"Cancel"}),e[18]=l.formState.isSubmitting,e[19]=h,e[20]=g):g=e[20];const p=!l.formState.isValid||l.formState.isSubmitting;let b;e[21]!==l.formState.isSubmitting?(b=l.formState.isSubmitting?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(Tn,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=l.formState.isSubmitting,e[22]=b):b=e[22];let j;e[23]!==p||e[24]!==b?(j=s.jsx(le,{type:"submit",variant:"default",disabled:p,children:b}),e[23]=p,e[24]=b,e[25]=j):j=e[25];let v;e[26]!==j||e[27]!==g?(v=s.jsxs(Sn,{children:[g,j]}),e[26]=j,e[27]=g,e[28]=v):v=e[28];let y;e[29]!==v||e[30]!==d||e[31]!==x||e[32]!==f?(y=s.jsxs("form",{className:"space-y-6",onSubmit:d,autoComplete:"off",children:[x,f,v]}),e[29]=v,e[30]=d,e[31]=x,e[32]=f,e[33]=y):y=e[33];let S;e[34]!==l||e[35]!==y?(S=s.jsxs(bn,{children:[c,s.jsx(Cn,{...l,children:y})]}),e[34]=l,e[35]=y,e[36]=S):S=e[36];let C;return e[37]!==i||e[38]!==n||e[39]!==S?(C=s.jsx(_n,{open:n,onOpenChange:i,children:S}),e[37]=i,e[38]=n,e[39]=S,e[40]=C):C=e[40],C}function Ui(t){const{orgSlug:e}=t;window.location.href=`/${e}`}async function Hi(t){const e=ds(t.name);if(!e)throw new Error("Organization slug is invalid");const n=await se.organization.create({name:t.name,slug:e});if(n?.error)throw new Error(n.error.message||"Failed to create organization");const i=n?.data?.slug??e;if(!i)throw new Error("Failed to create organization");return{orgSlug:i}}function ms(){const t=M.useContext($s),{data:e,refetch:n}=t.hooks.useListUserInvitations();return{invitations:(e??[]).filter(o=>o.status==="pending"&&new Date(o.expiresAt)>new Date),refetch:()=>n?.()}}function Gi(t){let e=0;for(let i=0;i<t.length;i++)e=t.charCodeAt(i)+((e<<5)-e);const n=Math.abs(e)%360;return{backgroundColor:`hsl(${n} 55% 70%)`,color:`hsl(${n} 55% 20%)`}}function Te(t){const e=z.c(13),{org:n,size:i}=t,o=i===void 0?"sm":i,l=o==="xs"?"size-5":"size-6",r=o==="xs"?"text-[9px]":"text-xs";let a;e[0]!==l?(a=P(l,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=l,e[1]=a):a=e[1];let m;e[2]!==n.logo||e[3]!==n.name?(m=n.logo?void 0:Gi(n.name),e[2]=n.logo,e[3]=n.name,e[4]=m):m=e[4];let c;e[5]!==n.logo||e[6]!==n.name||e[7]!==r?(c=n.logo?s.jsx("img",{src:n.logo,alt:"",className:"size-full object-cover"}):s.jsx("span",{className:P("font-semibold leading-none",r),children:n.name.slice(0,2).toUpperCase()}),e[5]=n.logo,e[6]=n.name,e[7]=r,e[8]=c):c=e[8];let d;return e[9]!==a||e[10]!==m||e[11]!==c?(d=s.jsx("div",{className:a,style:m,children:c}),e[9]=a,e[10]=m,e[11]=c,e[12]=d):d=e[12],d}function Wi({invitation:t,onChanged:e}){const[n,i]=M.useState(!1),o=t.organizationName??"Unknown organization",l=async()=>{i(!0);try{const m=await se.organization.acceptInvitation({invitationId:t.id});if(m.error){ee.error(m.error.message),i(!1);return}}catch{ee.error("Failed to accept invitation"),i(!1);return}ee.success(`Joined ${o}`),Os();let a;try{a=(await se.organization.getFullOrganization({query:{organizationId:t.organizationId}}))?.data?.slug}catch{}window.location.href=a?`/${a}`:"/"},r=async()=>{i(!0);try{const a=await se.organization.rejectInvitation({invitationId:t.id});if(a.error){ee.error(a.error.message),i(!1);return}ee.success("Invitation declined"),i(!1),e()}catch{ee.error("Failed to decline invitation"),i(!1)}};return s.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-dashed border-border px-3 py-2.5",children:[s.jsx(Te,{org:{name:o},size:"sm"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium",children:o}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:"Invited to join"})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s.jsx(le,{size:"sm",variant:"default",className:"h-7 text-xs",onClick:l,disabled:n,children:"Accept"}),s.jsx(le,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground",onClick:r,disabled:n,"aria-label":`Decline invitation to ${o}`,children:s.jsx(pn,{size:14})})]})]})}function Ki(t){const e=z.c(29),{orgParam:n,onSelectOrg:i,onCreateOrg:o}=t,{data:l}=Ts(),{invitations:r,refetch:a}=ms();let m;e[0]!==n?(m=(k,$)=>k.slug===n?-1:$.slug===n?1:k.name.localeCompare($.name),e[0]=n,e[1]=m):m=e[1];const c=[...l??[]].sort(m),[d,u]=M.useState(""),x=d.toLowerCase(),f=x?c.filter(k=>k.name.toLowerCase().includes(x)||k.slug.toLowerCase().includes(x)):c;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(qt,{size:16,className:"shrink-0 text-muted-foreground/60"}),e[2]=h):h=e[2];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=k=>u(k.target.value),e[3]=g):g=e[3];let p;e[4]!==d?(p=k=>k.key==="Escape"&&d&&u(""),e[4]=d,e[5]=p):p=e[5];let b;e[6]!==d||e[7]!==p?(b=s.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:d,onChange:g,onKeyDown:p,placeholder:"Search organizations...",className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),e[6]=d,e[7]=p,e[8]=b):b=e[8];let j;e[9]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(pe,{size:16}),e[9]=j):j=e[9];let v;e[10]!==o?(v=s.jsx("button",{type:"button",onClick:o,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:j}),e[10]=o,e[11]=v):v=e[11];let y;e[12]!==b||e[13]!==v?(y=s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[h,b,v]}),e[12]=b,e[13]=v,e[14]=y):y=e[14];const S="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1";let C;e[15]!==r||e[16]!==d||e[17]!==a?(C=!d&&r.map(k=>s.jsx(Wi,{invitation:k,onChanged:a},k.id)),e[15]=r,e[16]=d,e[17]=a,e[18]=C):C=e[18];const _=f.length===0&&s.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:d?`No organizations match "${d}"`:"No organizations available"});let N;e[19]!==i||e[20]!==n?(N=k=>s.jsxs("button",{type:"button",onClick:()=>i(k.slug),className:P("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",k.slug===n?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[s.jsx(Te,{org:k,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:k.name}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:k.slug})]}),k.slug===n&&s.jsx(ve,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},k.id),e[19]=i,e[20]=n,e[21]=N):N=e[21];const w=f.map(N);let I;e[22]!==C||e[23]!==_||e[24]!==w?(I=s.jsxs("div",{className:S,children:[C,_,w]}),e[22]=C,e[23]=_,e[24]=w,e[25]=I):I=e[25];let A;return e[26]!==I||e[27]!==y?(A=s.jsxs(s.Fragment,{children:[y,I]}),e[26]=I,e[27]=y,e[28]=A):A=e[28],A}function us(t){const e=z.c(22),{trigger:n,orgParam:i,align:o,side:l}=t,r=o===void 0?"start":o,a=l===void 0?"bottom":l,m=ie(),[c,d]=M.useState(!1),[u,x]=M.useState(!1);let f;e[0]!==n?(f=s.jsx(xe,{asChild:!0,children:n}),e[0]=n,e[1]=f):f=e[1];const h=String(c);let g;e[2]!==m?(g=C=>{d(!1),m({to:"/$org",params:{org:C}})},e[2]=m,e[3]=g):g=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{d(!1),x(!0)},e[4]=p):p=e[4];let b;e[5]!==i||e[6]!==h||e[7]!==g?(b=s.jsx(Ki,{orgParam:i,onSelectOrg:g,onCreateOrg:p},h),e[5]=i,e[6]=h,e[7]=g,e[8]=b):b=e[8];let j;e[9]!==r||e[10]!==a||e[11]!==b?(j=s.jsx(Ie,{side:a,align:r,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:qi,onCloseAutoFocus:Vi,children:b}),e[9]=r,e[10]=a,e[11]=b,e[12]=j):j=e[12];let v;e[13]!==c||e[14]!==f||e[15]!==j?(v=s.jsxs(Ae,{open:c,onOpenChange:d,children:[f,j]}),e[13]=c,e[14]=f,e[15]=j,e[16]=v):v=e[16];let y;e[17]!==u?(y=s.jsx(Bi,{open:u,onOpenChange:x}),e[17]=u,e[18]=y):y=e[18];let S;return e[19]!==y||e[20]!==v?(S=s.jsxs(s.Fragment,{children:[v,y]}),e[19]=y,e[20]=v,e[21]=S):S=e[21],S}function Vi(t){return t.preventDefault()}function qi(t){t.preventDefault(),t.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function Yi(t){const e=z.c(21),{value:n,onChange:i,placeholder:o,onKeyDown:l,className:r,isSearching:a,disabled:m}=t,c=o===void 0?"Search...":o;let d;e[0]!==r?(d=P("shrink-0 w-full border-b border-border h-12",r),e[0]=r,e[1]=d):d=e[1];const u=m?"cursor-not-allowed opacity-50":"cursor-text";let x;e[2]!==u?(x=P("flex items-center gap-2.5 h-12 px-4",u),e[2]=u,e[3]=x):x=e[3];let f;e[4]!==a?(f=a?s.jsx(Ot,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):s.jsx(qt,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=a,e[5]=f):f=e[5];let h;e[6]!==i?(h=j=>i(j.target.value),e[6]=i,e[7]=h):h=e[7];let g;e[8]!==m||e[9]!==l||e[10]!==c||e[11]!==h||e[12]!==n?(g=s.jsx("input",{type:"text",value:n,onChange:h,onKeyDown:l,placeholder:c,disabled:m,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=m,e[9]=l,e[10]=c,e[11]=h,e[12]=n,e[13]=g):g=e[13];let p;e[14]!==x||e[15]!==f||e[16]!==g?(p=s.jsxs("label",{className:x,children:[f,g]}),e[14]=x,e[15]=f,e[16]=g,e[17]=p):p=e[17];let b;return e[18]!==d||e[19]!==p?(b=s.jsx("div",{className:d,children:p}),e[18]=d,e[19]=p,e[20]=b):b=e[20],b}const Xi="Select an existing agent";function Qi(t){const e=z.c(5),{children:n}=t;let i;e[0]!==n?(i=s.jsx(ae,{asChild:!0,children:n}),e[0]=n,e[1]=i):i=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ce,{side:"right",sideOffset:8,children:Xi}),e[2]=o):o=e[2];let l;return e[3]!==i?(l=s.jsxs(de,{defaultOpen:!0,delayDuration:0,children:[i,o]}),e[3]=i,e[4]=l):l=e[4],l}function Ji(t){const e=ie(),{create:n}=Jt(),{locator:i}=X(),o=qe({strict:!1}),l=ke({strict:!1});return async r=>{const a=crypto.randomUUID(),m=r===l.virtualmcpid?Rn(t,i,o.taskId??""):null;try{await n({id:a,virtual_mcp_id:r,...m?{branch:m}:{}})}catch{}e({to:"/$org/$taskId",params:{org:t,taskId:a},search:{virtualmcpid:r}})}}function De(t){const e=z.c(20),{agent:n,selected:i,onClick:o}=t,l=i?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50";let r;e[0]!==l?(r=P("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",l),e[0]=l,e[1]=r):r=e[1];let a;e[2]!==n.icon||e[3]!==n.title?(a=s.jsx(me,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[2]=n.icon,e[3]=n.title,e[4]=a):a=e[4];let m;e[5]!==n.title?(m=s.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[5]=n.title,e[6]=m):m=e[6];let c;e[7]!==n.description?(c=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n.description}),e[7]=n.description,e[8]=c):c=e[8];let d;e[9]!==m||e[10]!==c?(d=s.jsxs("div",{className:"flex-1 min-w-0",children:[m,c]}),e[9]=m,e[10]=c,e[11]=d):d=e[11];let u;e[12]!==i?(u=i&&s.jsx(ve,{size:14,className:"ml-auto text-muted-foreground shrink-0"}),e[12]=i,e[13]=u):u=e[13];let x;return e[14]!==o||e[15]!==r||e[16]!==a||e[17]!==d||e[18]!==u?(x=s.jsxs("button",{type:"button",onClick:o,className:r,children:[a,d,u]}),e[14]=o,e[15]=r,e[16]=a,e[17]=d,e[18]=u,e[19]=x):x=e[19],x}function ht(t){const e=z.c(5),{children:n,action:i}=t;let o;e[0]!==n?(o=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n}),e[0]=n,e[1]=o):o=e[1];let l;return e[2]!==i||e[3]!==o?(l=s.jsxs("div",{className:"flex items-center justify-between px-3 pb-1 pt-2",children:[o,i]}),e[2]=i,e[3]=o,e[4]=l):l=e[4],l}function Zi(t){const e=z.c(27),{onClose:n,onSelectAgent:i,selectedAgentId:o,onImportFromGithub:l}=t,[r,a]=M.useState(""),m=Wt(),c=m??[],{org:d}=X(),{data:u}=se.useSession(),x=u?.user?.id??"anon",f=Un(m),h=Hn(),g=Ji(d.slug),p=Wn(m),b=r.toLowerCase(),j=c.filter(no).filter(K=>!p.has(K.id)).filter(so).filter(K=>!r||K.title.toLowerCase().includes(b)),v=j.filter(to),y=j.filter(eo),S=Ne(d.id),C=!r||S.title.toLowerCase().includes(b),_=!!(i&&C);let N;e[0]!==n||e[1]!==i?(N=()=>{i?.(null),n(),a("")},e[0]=n,e[1]=i,e[2]=N):N=e[2];const w=N,I=K=>{if(i){i(K.id),n(),a("");return}Gn({orgId:d.id,userId:x},K.id,f),h(),n(),a(""),g(K.id)},A="flex flex-col max-h-[min(640px,80dvh)]";let k;e[3]!==r?(k=s.jsx(Yi,{value:r,onChange:a,placeholder:"Search agents..."}),e[3]=r,e[4]=k):k=e[4];const $="overflow-y-auto flex-1 min-h-0 p-1.5 flex flex-col gap-0.5",O=i&&C&&S&&s.jsx(De,{agent:S,selected:!o||o===S.id,onClick:w}),E=(v.length>0||!r)&&s.jsx(ht,{action:s.jsxs("button",{type:"button",onClick:l,className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",children:[s.jsx(Pn,{className:"size-3.5"}),"Import"]}),children:"Code Agents"}),U=v.map(K=>s.jsx(De,{agent:K,selected:i?o===K.id:void 0,onClick:()=>I(K)},K.id)),R=y.length>0&&s.jsx(ht,{children:"Agents"}),F=y.map(K=>s.jsx(De,{agent:K,selected:i?o===K.id:void 0,onClick:()=>I(K)},K.id));let D;e[5]!==_||e[6]!==r||e[7]!==j.length?(D=j.length===0&&!_&&r&&s.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:"No agents found"}),e[5]=_,e[6]=r,e[7]=j.length,e[8]=D):D=e[8];let L;e[9]!==D||e[10]!==O||e[11]!==E||e[12]!==U||e[13]!==R||e[14]!==F?(L=s.jsxs("div",{className:$,children:[O,E,U,R,F,D]}),e[9]=D,e[10]=O,e[11]=E,e[12]=U,e[13]=R,e[14]=F,e[15]=L):L=e[15];let H;e[16]!==d.slug?(H={org:d.slug},e[16]=d.slug,e[17]=H):H=e[17];let G;e[18]!==n?(G=()=>n(),e[18]=n,e[19]=G):G=e[19];let W;e[20]!==H||e[21]!==G?(W=s.jsx("div",{className:"border-t border-border px-3 py-2.5",children:s.jsx(Mt,{to:"/$org/settings/agents",params:H,onClick:G,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:"See all agents"})}),e[20]=H,e[21]=G,e[22]=W):W=e[22];let Q;return e[23]!==L||e[24]!==W||e[25]!==k?(Q=s.jsxs("div",{className:A,children:[k,L,W]}),e[23]=L,e[24]=W,e[25]=k,e[26]=Q):Q=e[26],Q}function eo(t){return!es(t.metadata)}function to(t){return es(t.metadata)}function so(t){return!an(t.id)}function no(t){return!rn(t.id)}function io(t){const e=z.c(31);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const{compact:i,trigger:o,onSelectAgent:l,selectedAgentId:r,side:a,align:m}=n,c=i===void 0?!1:i,d=a===void 0?"right":a,u=m===void 0?"start":m,[x,f]=M.useState(!1),[h,g]=M.useState(!1),p=Qe(),{setOpenMobile:b}=re(),j=Bn(),v=j?"border border-border":void 0;let y;e[2]!==j?(y=E=>j?s.jsx(Qi,{children:E}):E,e[2]=j,e[3]=y):y=e[3];const S=y;let C;e[4]!==p||e[5]!==b?(C=()=>{f(!1),p&&b(!1)},e[4]=p,e[5]=b,e[6]=C):C=e[6];const _=C;let N;e[7]!==_?(N=()=>{_(),g(!0)},e[7]=_,e[8]=N):N=e[8];const w=N;let I;e[9]!==_||e[10]!==w||e[11]!==l||e[12]!==x||e[13]!==r?(I=x&&s.jsx(M.Suspense,{fallback:s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(ne,{className:"h-4 w-24"})}),children:s.jsx(Zi,{onClose:_,onSelectAgent:l,selectedAgentId:r,onImportFromGithub:w})}),e[9]=_,e[10]=w,e[11]=l,e[12]=x,e[13]=r,e[14]=I):I=e[14];const A=I;let k;e[15]!==u||e[16]!==c||e[17]!==v||e[18]!==j||e[19]!==p||e[20]!==x||e[21]!==A||e[22]!==d||e[23]!==o||e[24]!==S?(k=p?s.jsxs(s.Fragment,{children:[o?s.jsx("button",{type:"button",onClick:()=>f(!0),className:"contents",children:o}):c?S(s.jsx(ue,{"aria-label":"Browse agents",className:P(v),onClick:()=>{q("agent_browser_opened",{surface:"mobile_drawer"}),f(!0)},children:s.jsx(pe,{className:"size-4"})})):s.jsx(B,{children:S(s.jsxs(Y,{tooltip:j?void 0:"Browse agents",className:P(v),onClick:()=>{q("agent_browser_opened",{surface:"mobile_drawer"}),f(!0)},children:[s.jsx(pe,{}),s.jsx("span",{children:"New agent"})]}))}),s.jsx(Yt,{open:x,onOpenChange:f,direction:"bottom",children:s.jsxs(Xt,{className:"max-h-[85dvh] p-0",children:[s.jsx(Qt,{className:"sr-only",children:"Browse agents"}),A]})})]}):s.jsxs(Ae,{open:x,onOpenChange:E=>{E&&!x&&q("agent_browser_opened",{surface:"desktop_popover"}),f(E)},children:[o?s.jsx(xe,{asChild:!0,children:o}):c?S(s.jsx(xe,{asChild:!0,children:s.jsx(ue,{"aria-label":"Browse agents",className:P(v),children:s.jsx(pe,{className:"size-4"})})})):s.jsx(B,{children:S(s.jsx(xe,{asChild:!0,children:s.jsxs(Y,{tooltip:j?void 0:"Browse agents",className:P(v),children:[s.jsx(pe,{}),s.jsx("span",{children:"New agent"})]})}))}),s.jsx(Ie,{className:"w-[380px] p-0 overflow-hidden",side:d,align:u,children:A})]}),e[15]=u,e[16]=c,e[17]=v,e[18]=j,e[19]=p,e[20]=x,e[21]=A,e[22]=d,e[23]=o,e[24]=S,e[25]=k):k=e[25];let $;e[26]!==h?($=s.jsx(En,{open:h,onOpenChange:g,mode:"agent"}),e[26]=h,e[27]=$):$=e[27];let O;return e[28]!==$||e[29]!==k?(O=s.jsxs(s.Fragment,{children:[k,$]}),e[28]=$,e[29]=k,e[30]=O):O=e[30],O}const oo="wco-no-drag inline-flex items-center gap-1.5 min-w-0 rounded-md pl-1 pr-2 py-1.5 text-sm text-foreground hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50";function lo(t){const e=z.c(19),{agentId:n,fallback:i,onOpenHome:o,onPick:l}=t,r=st(n)??i??null,a=r?.title??"Super Agent",m=`Open ${a} home`,c=r?.icon??null;let d;e[0]!==c||e[1]!==a?(d=s.jsx(me,{icon:c,name:a,size:"xs"}),e[0]=c,e[1]=a,e[2]=d):d=e[2];let u;e[3]!==o||e[4]!==m||e[5]!==d?(u=s.jsx("button",{type:"button",onClick:o,"aria-label":m,className:"wco-no-drag flex items-center shrink-0 rounded-md p-1 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:d}),e[3]=o,e[4]=m,e[5]=d,e[6]=u):u=e[6];let x;e[7]!==a?(x=s.jsx("span",{className:"truncate font-medium max-w-[8rem]",children:a}),e[7]=a,e[8]=x):x=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(tt,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[9]=f):f=e[9];let h;e[10]!==x?(h=s.jsxs("button",{type:"button",className:oo,children:[x,f]}),e[10]=x,e[11]=h):h=e[11];let g;e[12]!==n||e[13]!==l||e[14]!==h?(g=s.jsx(io,{side:"bottom",align:"start",selectedAgentId:n,onSelectAgent:l,trigger:h}),e[12]=n,e[13]=l,e[14]=h,e[15]=g):g=e[15];let p;return e[16]!==u||e[17]!==g?(p=s.jsxs("div",{className:"flex min-w-0 items-center gap-0",children:[u,g]}),e[16]=u,e[17]=g,e[18]=p):p=e[18],p}function We(t){const e=z.c(26);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const{showName:i}=n,{org:o}=X(),{state:l,isMobile:r}=re(),a=ms().invitations.length>0,m=l==="collapsed"||r,c=a?`${o.name} — switch organization (pending invitation)`:`${o.name} — switch organization`;let d;e[2]!==o?(d=s.jsx(Te,{org:o,size:"sm"}),e[2]=o,e[3]=d):d=e[3];let u;e[4]!==a||e[5]!==m?(u=a&&s.jsx("span",{className:P("absolute -right-1 size-2.5 rounded-full bg-destructive ring-2 ring-background",m?"-top-1":"top-1/2 -translate-y-1/2")}),e[4]=a,e[5]=m,e[6]=u):u=e[6];let x;e[7]!==d||e[8]!==u?(x=s.jsxs("span",{className:"relative inline-flex",children:[d,u]}),e[7]=d,e[8]=u,e[9]=x):x=e[9];let f;e[10]!==o.name||e[11]!==i?(f=i&&s.jsx("span",{className:"truncate text-sm font-medium text-foreground max-w-[10rem]",children:o.name}),e[10]=o.name,e[11]=i,e[12]=f):f=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(tt,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[13]=h):h=e[13];let g;e[14]!==c||e[15]!==x||e[16]!==f?(g=s.jsx(ae,{asChild:!0,children:s.jsxs("button",{type:"button","aria-label":c,className:"wco-no-drag flex items-center gap-1.5 shrink-0 rounded-lg pl-[5px] pr-1.5 py-1.5 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[x,f,h]})}),e[14]=c,e[15]=x,e[16]=f,e[17]=g):g=e[17];let p;e[18]!==o.slug||e[19]!==g?(p=s.jsx(us,{orgParam:o.slug,trigger:g}),e[18]=o.slug,e[19]=g,e[20]=p):p=e[20];let b;e[21]!==o.name?(b=s.jsx(ce,{side:"bottom",children:o.name}),e[21]=o.name,e[22]=b):b=e[22];let j;return e[23]!==b||e[24]!==p?(j=s.jsxs(de,{children:[p,b]}),e[23]=b,e[24]=p,e[25]=j):j=e[25],j}function Oe(t){const e=z.c(24);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const{onNavigate:i}=n,{org:o}=X(),l=ie();let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[2]=r):r=e[2];const a=qe(r);let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m={strict:!1},e[3]=m):m=e[3];const c=ke(m),{threads:d}=nt(),{data:u}=se.useSession(),{setTaskId:x,createNewTask:f}=it();let h;e[4]!==o.id?(h=Ne(o.id),e[4]=o.id,e[5]=h):h=e[5];const g=h,p=g.id,b=a.taskId?c.virtualmcpid??p:p;let j;e[6]!==f||e[7]!==p||e[8]!==l||e[9]!==i||e[10]!==o.slug||e[11]!==u?.user?.id||e[12]!==x||e[13]!==d?(j=N=>{if(!N||N===p){l({to:"/$org",params:{org:o.slug}}),i?.();return}const w=Yn(d,N,u?.user?.id);w?x(w.id,N):f(N),i?.()},e[6]=f,e[7]=p,e[8]=l,e[9]=i,e[10]=o.slug,e[11]=u?.user?.id,e[12]=x,e[13]=d,e[14]=j):j=e[14];const v=j;let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("span",{className:"h-5 w-24 rounded bg-muted animate-pulse"}),e[15]=y):y=e[15];const S=b===p?g:void 0;let C;e[16]!==b||e[17]!==v?(C=()=>v(b),e[16]=b,e[17]=v,e[18]=C):C=e[18];let _;return e[19]!==b||e[20]!==v||e[21]!==S||e[22]!==C?(_=s.jsx(M.Suspense,{fallback:y,children:s.jsx(lo,{agentId:b,fallback:S,onOpenHome:C,onPick:v})}),e[19]=b,e[20]=v,e[21]=S,e[22]=C,e[23]=_):_=e[23],_}function pt(t){const e=z.c(18),{item:n,onClose:i}=t,o=n.isActive&&"z-10";let l;e[0]!==o?(l=P(o),e[0]=o,e[1]=l):l=e[1];let r;e[2]!==n||e[3]!==i?(r=()=>{n.onClick?.(),i()},e[2]=n,e[3]=i,e[4]=r):r=e[4];let a;e[5]!==n.icon?(a=s.jsx("span",{className:"[&>svg]:size-5 shrink-0",children:n.icon}),e[5]=n.icon,e[6]=a):a=e[6];let m;e[7]!==n.label?(m=s.jsx("span",{children:n.label}),e[7]=n.label,e[8]=m):m=e[8];let c;e[9]!==n.isActive||e[10]!==n.label||e[11]!==r||e[12]!==a||e[13]!==m?(c=s.jsxs(Y,{onClick:r,isActive:n.isActive,tooltip:n.label,className:"h-10! text-sm!",children:[a,m]}),e[9]=n.isActive,e[10]=n.label,e[11]=r,e[12]=a,e[13]=m,e[14]=c):c=e[14];let d;return e[15]!==l||e[16]!==c?(d=s.jsx(B,{className:l,children:c}),e[15]=l,e[16]=c,e[17]=d):d=e[17],d}function ro(t){const e=z.c(18),{section:n,onClose:i}=t;switch(n.type){case"divider":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(Pt,{className:"my-2"}),e[0]=o):o=e[0],o}case"spacer":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"flex-1"}),e[1]=o):o=e[1],o}case"group":{const o=n.group.label,l=n.group.defaultExpanded;let r;if(e[2]!==i||e[3]!==n.group.items){let m;e[5]!==i?(m=c=>s.jsx(pt,{item:c,onClose:i},c.key),e[5]=i,e[6]=m):m=e[6],r=n.group.items.map(m),e[2]=i,e[3]=n.group.items,e[4]=r}else r=e[4];let a;return e[7]!==n.group.defaultExpanded||e[8]!==n.group.label||e[9]!==r?(a=s.jsx(rs,{label:o,defaultExpanded:l,children:r}),e[7]=n.group.defaultExpanded,e[8]=n.group.label,e[9]=r,e[10]=a):a=e[10],a}case"items":{let o;if(e[11]!==i||e[12]!==n.items){let r;e[14]!==i?(r=a=>s.jsx(pt,{item:a,onClose:i},a.key),e[14]=i,e[15]=r):r=e[15],o=n.items.map(r),e[11]=i,e[12]=n.items,e[13]=o}else o=e[13];let l;return e[16]!==o?(l=s.jsx(Ye,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(Xe,{children:s.jsx(te,{className:"gap-1.5",children:o})})}),e[16]=o,e[17]=l):l=e[17],l}case"custom":return n.content}}function ao(t){const e=z.c(24),{sections:n,onClose:i,footer:o,additionalContent:l}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(We,{}),e[0]=r):r=e[0];let a;e[1]!==i?(a=s.jsx(Oe,{onNavigate:i}),e[1]=i,e[2]=a):a=e[2];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("div",{className:"flex-1"}),e[3]=m):m=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Ht,{size:16}),e[4]=c):c=e[4];let d;e[5]!==i?(d=s.jsx(ue,{onClick:i,"aria-label":"Close sidebar",children:c}),e[5]=i,e[6]=d):d=e[6];let u;e[7]!==a||e[8]!==d?(u=s.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-0.5 px-1.5",children:[r,a,m,d]}),e[7]=a,e[8]=d,e[9]=u):u=e[9];let x;if(e[10]!==i||e[11]!==n){let p;e[13]!==i?(p=(b,j)=>s.jsx(ro,{section:b,onClose:i},j),e[13]=i,e[14]=p):p=e[14],x=n.map(p),e[10]=i,e[11]=n,e[12]=x}else x=e[12];let f;e[15]!==l?(f=l&&s.jsx("div",{className:"mt-3 flex flex-col flex-1 min-h-0",children:l}),e[15]=l,e[16]=f):f=e[16];let h;e[17]!==x||e[18]!==f?(h=s.jsxs(Et,{className:"flex flex-col flex-1 px-2 py-2 gap-0",children:[x,f]}),e[17]=x,e[18]=f,e[19]=h):h=e[19];let g;return e[20]!==o||e[21]!==u||e[22]!==h?(g=s.jsxs("div",{className:"bg-sidebar flex h-full w-full flex-col","data-sidebar":"sidebar",children:[u,h,o]}),e[20]=o,e[21]=u,e[22]=h,e[23]=g):g=e[23],g}function fe(t){const e=z.c(26),{item:n,onClose:i}=t;let o;e[0]!==n.className?(o=P("flex items-center gap-2.5 px-3 py-2 rounded-md text-sm text-left w-full transition-colors text-foreground/80 hover:bg-sidebar-accent hover:text-foreground",n.className),e[0]=n.className,e[1]=o):o=e[1];const l=o;if(n.href){const d=n.external?"_blank":void 0,u=n.external?"noopener noreferrer":void 0;let x;e[2]!==n.icon?(x=s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n.icon}),e[2]=n.icon,e[3]=x):x=e[3];let f;e[4]!==n.label?(f=s.jsx("span",{className:"flex-1",children:n.label}),e[4]=n.label,e[5]=f):f=e[5];let h;return e[6]!==l||e[7]!==n.href||e[8]!==i||e[9]!==d||e[10]!==u||e[11]!==x||e[12]!==f?(h=s.jsxs("a",{href:n.href,target:d,rel:u,className:l,onClick:i,children:[x,f]}),e[6]=l,e[7]=n.href,e[8]=i,e[9]=d,e[10]=u,e[11]=x,e[12]=f,e[13]=h):h=e[13],h}let r;e[14]!==n||e[15]!==i?(r=()=>{n.onClick?.(),i()},e[14]=n,e[15]=i,e[16]=r):r=e[16];let a;e[17]!==n.icon?(a=s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n.icon}),e[17]=n.icon,e[18]=a):a=e[18];let m;e[19]!==n.label?(m=s.jsx("span",{className:"flex-1",children:n.label}),e[19]=n.label,e[20]=m):m=e[20];let c;return e[21]!==l||e[22]!==r||e[23]!==a||e[24]!==m?(c=s.jsxs("button",{type:"button",onClick:r,className:l,children:[a,m]}),e[21]=l,e[22]=r,e[23]=a,e[24]=m,e[25]=c):c=e[25],c}function co(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("span",{className:"shrink-0 inline-flex items-center rounded-full bg-warning/10 px-2 py-0.5 text-[10px] font-medium text-warning",children:"Impersonating"}),t[0]=e):e=t[0],e}function gt(t){const e=z.c(30),{user:n,userImage:i,isImpersonating:o,isMobile:l}=t,r=l?"py-4 border-b border-border":"py-3 mx-1 mt-1";let a;e[0]!==r?(a=P("flex items-center gap-3 px-4",r),e[0]=r,e[1]=a):a=e[1];const m=n?.name??"U";let c;e[2]!==m||e[3]!==i?(c=s.jsx(Ue,{url:i,fallback:m,shape:"circle",size:"sm",className:"shrink-0"}),e[2]=m,e[3]=i,e[4]=c):c=e[4];const d=n?.name??"User";let u;e[5]!==d?(u=s.jsx("p",{className:"text-sm font-medium truncate",children:d}),e[5]=d,e[6]=u):u=e[6];let x;e[7]!==o?(x=o&&s.jsx(co,{}),e[7]=o,e[8]=x):x=e[8];let f;e[9]!==u||e[10]!==x?(f=s.jsxs("div",{className:"flex items-center gap-2",children:[u,x]}),e[9]=u,e[10]=x,e[11]=f):f=e[11];const h=n?.email;let g;e[12]!==h?(g=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:h}),e[12]=h,e[13]=g):g=e[13];let p;e[14]!==g||e[15]!==f?(p=s.jsxs("div",{className:"flex-1 min-w-0",children:[f,g]}),e[14]=g,e[15]=f,e[16]=p):p=e[16];let b;e[17]!==n?(b=()=>{n?.id&&navigator.clipboard.writeText(n.id).then(mo)},e[17]=n,e[18]=b):b=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(He,{size:14}),e[19]=j):j=e[19];let v;e[20]!==b?(v=s.jsx(ae,{asChild:!0,children:s.jsx("button",{type:"button",tabIndex:-1,onClick:b,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:j})}),e[20]=b,e[21]=v):v=e[21];let y;e[22]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(ce,{side:"right",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[22]=y):y=e[22];let S;e[23]!==v?(S=s.jsx(Gt,{delayDuration:300,children:s.jsxs(de,{children:[v,y]})}),e[23]=v,e[24]=S):S=e[24];let C;return e[25]!==p||e[26]!==S||e[27]!==a||e[28]!==c?(C=s.jsxs("div",{className:a,children:[c,p,S]}),e[25]=p,e[26]=S,e[27]=a,e[28]=c,e[29]=C):C=e[29],C}function mo(){ee.success("User ID copied")}function bt(t){const e=z.c(32),{themeOptions:n,preferences:i,setPreferences:o,isMobile:l}=t,r=l?"size-8":"size-7",a=l?"px-3 py-3":"px-2 py-1.5";let m;e[0]!==a?(m=P("flex items-center justify-between border-t border-border/50",a),e[0]=a,e[1]=m):m=e[1];let c;if(e[2]!==r||e[3]!==i.theme||e[4]!==o||e[5]!==n){let y;e[7]!==r||e[8]!==i.theme||e[9]!==o?(y=S=>{const{value:C,icon:_,label:N}=S;return s.jsx("button",{type:"button","aria-label":N,onClick:()=>o(w=>({...w,theme:C})),className:P(r,"rounded-md flex items-center justify-center transition-colors",i.theme===C?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:_},C)},e[7]=r,e[8]=i.theme,e[9]=o,e[10]=y):y=e[10],c=n.map(y),e[2]=r,e[3]=i.theme,e[4]=o,e[5]=n,e[6]=c}else c=e[6];let d;e[11]!==c?(d=s.jsx("div",{className:"flex items-center gap-0.5",children:c}),e[11]=c,e[12]=d):d=e[12];const u=i.enableSounds?"Disable sounds":"Enable sounds";let x;e[13]!==o?(x=()=>o(uo),e[13]=o,e[14]=x):x=e[14];const f=i.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let h;e[15]!==r||e[16]!==f?(h=P(r,"rounded-md flex items-center justify-center transition-colors",f),e[15]=r,e[16]=f,e[17]=h):h=e[17];let g;e[18]!==i.enableSounds?(g=i.enableSounds?s.jsx(cn,{size:14}):s.jsx(dn,{size:14}),e[18]=i.enableSounds,e[19]=g):g=e[19];let p;e[20]!==u||e[21]!==x||e[22]!==h||e[23]!==g?(p=s.jsx("button",{type:"button","aria-label":u,onClick:x,className:h,children:g}),e[20]=u,e[21]=x,e[22]=h,e[23]=g,e[24]=p):p=e[24];let b;e[25]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","4.95.1"]}),e[25]=b):b=e[25];let j;e[26]!==p?(j=s.jsxs("div",{className:"flex items-center gap-2",children:[p,b]}),e[26]=p,e[27]=j):j=e[27];let v;return e[28]!==j||e[29]!==m||e[30]!==d?(v=s.jsxs("div",{className:m,children:[d,j]}),e[28]=j,e[29]=m,e[30]=d,e[31]=v):v=e[31],v}function uo(t){return{...t,enableSounds:!t.enableSounds}}function jt(t){const e=z.c(54),{user:n,userImage:i,menuItems:o,signOutItem:l,stopImpersonatingItem:r,isImpersonating:a,themeOptions:m,preferences:c,setPreferences:d,close:u,isMobile:x}=t;if(x){let y;e[0]!==a||e[1]!==n||e[2]!==i?(y=s.jsx(gt,{user:n,userImage:i,isImpersonating:a,isMobile:!0}),e[0]=a,e[1]=n,e[2]=i,e[3]=y):y=e[3];let S;if(e[4]!==u||e[5]!==o){let A;e[7]!==u?(A=k=>s.jsx(fe,{item:k,onClose:u},k.key),e[7]=u,e[8]=A):A=e[8],S=o.map(A),e[4]=u,e[5]=o,e[6]=S}else S=e[6];let C;e[9]!==u||e[10]!==r?(C=r&&s.jsx(fe,{item:r,onClose:u}),e[9]=u,e[10]=r,e[11]=C):C=e[11];let _;e[12]!==u||e[13]!==l?(_=s.jsx(fe,{item:l,onClose:u}),e[12]=u,e[13]=l,e[14]=_):_=e[14];let N;e[15]!==S||e[16]!==C||e[17]!==_?(N=s.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:s.jsxs("nav",{className:"flex flex-col px-2 pt-2 pb-2 gap-0.5",children:[S,C,_]})}),e[15]=S,e[16]=C,e[17]=_,e[18]=N):N=e[18];let w;e[19]!==c||e[20]!==d||e[21]!==m?(w=s.jsx(bt,{themeOptions:m,preferences:c,setPreferences:d,isMobile:!0}),e[19]=c,e[20]=d,e[21]=m,e[22]=w):w=e[22];let I;return e[23]!==y||e[24]!==N||e[25]!==w?(I=s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[y,N,w]}),e[23]=y,e[24]=N,e[25]=w,e[26]=I):I=e[26],I}let f;e[27]!==a||e[28]!==n||e[29]!==i?(f=s.jsx(gt,{user:n,userImage:i,isImpersonating:a,isMobile:!1}),e[27]=a,e[28]=n,e[29]=i,e[30]=f):f=e[30];let h;if(e[31]!==u||e[32]!==o){let y;e[34]!==u?(y=S=>s.jsx(fe,{item:S,onClose:u},S.key),e[34]=u,e[35]=y):y=e[35],h=o.map(y),e[31]=u,e[32]=o,e[33]=h}else h=e[33];let g;e[36]!==u||e[37]!==r?(g=r&&s.jsx(fe,{item:r,onClose:u}),e[36]=u,e[37]=r,e[38]=g):g=e[38];let p;e[39]!==u||e[40]!==l?(p=s.jsx(fe,{item:l,onClose:u}),e[39]=u,e[40]=l,e[41]=p):p=e[41];let b;e[42]!==h||e[43]!==g||e[44]!==p?(b=s.jsxs("nav",{className:"flex-1 flex flex-col px-2 pt-1 overflow-y-auto",children:[h,g,p]}),e[42]=h,e[43]=g,e[44]=p,e[45]=b):b=e[45];let j;e[46]!==c||e[47]!==d||e[48]!==m?(j=s.jsx(bt,{themeOptions:m,preferences:c,setPreferences:d,isMobile:!1}),e[46]=c,e[47]=d,e[48]=m,e[49]=j):j=e[49];let v;return e[50]!==f||e[51]!==b||e[52]!==j?(v=s.jsx("div",{className:"flex w-full flex-col overflow-hidden",children:s.jsxs("div",{className:"flex flex-col",children:[f,b,j]})}),e[50]=f,e[51]=b,e[52]=j,e[53]=v):v=e[53],v}function be(){const t=z.c(43),{data:e}=se.useSession(),{org:n}=X(),i=ie();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org",shouldThrow:!1},t[0]=o):o=t[0];const r=Ms(o)?.params.org,[a,m]=Ps(),c=Qe(),{isAdmin:d}=oi(),[u,x]=M.useState(!1),f=e?.user,h=f?.image,g=!!e?.session?.impersonatedBy;let p;t[1]===Symbol.for("react.memo_cache_sentinel")?(p=()=>x(!1),t[1]=p):p=t[1];const b=p;let j;t[2]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(ze,{size:16}),t[2]=j):j=t[2];let v;t[3]!==i||t[4]!==r?(v={key:"preferences",label:"Preferences",icon:j,onClick:()=>{i({to:"/$org/settings/profile",params:{org:r??""}})}},t[3]=i,t[4]=r,t[5]=v):v=t[5];let y;t[6]!==n||t[7]!==i?(y=n?[{key:"install-app",label:"Add to Home Screen",icon:s.jsx(Xn,{size:16}),onClick:()=>{i({to:"/$org/install",params:{org:n.slug}})}},{key:"connect-clients",label:"Connect to Agents",icon:s.jsx(Zn,{size:16}),onClick:()=>{i({to:"/$org/settings/connect",params:{org:n.slug}})}}]:[],t[6]=n,t[7]=i,t[8]=y):y=t[8];let S;t[9]===Symbol.for("react.memo_cache_sentinel")?(S={key:"terms",label:"Terms of Use",icon:s.jsx(Jn,{size:16}),href:"https://www.decocms.com/terms-of-use",external:!0},t[9]=S):S=t[9];let C;t[10]===Symbol.for("react.memo_cache_sentinel")?(C={key:"privacy",label:"Privacy Policy",icon:s.jsx(ni,{size:16}),href:"https://www.decocms.com/privacy-policy",external:!0},t[10]=C):C=t[10];let _;t[11]===Symbol.for("react.memo_cache_sentinel")?(_={key:"github",label:"decocms/studio",icon:s.jsx(Es,{className:"w-4 h-4"}),href:"https://github.com/decocms/studio",external:!0},t[11]=_):_=t[11];let N;t[12]===Symbol.for("react.memo_cache_sentinel")?(N={key:"community",label:"Community",icon:s.jsx(ii,{size:16}),href:"https://decocms.com/discord",external:!0},t[12]=N):N=t[12];let w;t[13]===Symbol.for("react.memo_cache_sentinel")?(w={key:"homepage",label:"Homepage",icon:s.jsx(Qn,{size:16}),href:"https://decocms.com",external:!0},t[13]=w):w=t[13];let I;t[14]!==d||t[15]!==i?(I=d?[{key:"admin-dashboard",label:"Admin Dashboard",icon:s.jsx(Kt,{size:16}),onClick:()=>i({to:"/_admin"}),className:"text-warning"}]:[],t[14]=d,t[15]=i,t[16]=I):I=t[16];let A;t[17]!==I||t[18]!==v||t[19]!==y?(A=[v,...y,S,C,_,N,w,...I],t[17]=I,t[18]=v,t[19]=y,t[20]=A):A=t[20];const k=A;let $;t[21]===Symbol.for("react.memo_cache_sentinel")?($={key:"logout",label:"Sign out",icon:s.jsx(ut,{size:16}),onClick:ho},t[21]=$):$=t[21];const O=$;let E;t[22]!==g?(E=g?{key:"stop-impersonating",label:"Stop impersonation",icon:s.jsx(ut,{size:16}),onClick:xo,className:"text-warning"}:null,t[22]=g,t[23]=E):E=t[23];const U=E;let R;t[24]===Symbol.for("react.memo_cache_sentinel")?(R={value:"light",icon:s.jsx(ti,{size:14}),label:"Light theme"},t[24]=R):R=t[24];let F;t[25]===Symbol.for("react.memo_cache_sentinel")?(F={value:"dark",icon:s.jsx(si,{size:14}),label:"Dark theme"},t[25]=F):F=t[25];let D;t[26]===Symbol.for("react.memo_cache_sentinel")?(D=[R,F,{value:"system",icon:s.jsx(Ge,{size:14}),label:"System theme"}],t[26]=D):D=t[26];const L=D;let H;t[27]!==g||t[28]!==c||t[29]!==k||t[30]!==a||t[31]!==m||t[32]!==U||t[33]!==f||t[34]!==h?(H={user:f,userImage:h,menuItems:k,signOutItem:O,stopImpersonatingItem:U,isImpersonating:g,themeOptions:L,preferences:a,setPreferences:m,close:b,isMobile:c},t[27]=g,t[28]=c,t[29]=k,t[30]=a,t[31]=m,t[32]=U,t[33]=f,t[34]=h,t[35]=H):H=t[35];const G=H;let W;return t[36]!==g||t[37]!==c||t[38]!==u||t[39]!==G||t[40]!==f?.name||t[41]!==h?(W=s.jsx(s.Fragment,{children:c?s.jsxs(Yt,{open:u,onOpenChange:x,direction:"bottom",children:[s.jsxs("button",{type:"button",onClick:()=>x(!0),className:P("flex items-center gap-3 w-full px-3 py-2.5 rounded-lg transition-colors text-sm text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground",g&&"border-2 border-dashed border-warning"),children:[s.jsx(Ue,{url:h,fallback:f?.name??"U",shape:"circle",size:"2xs",className:"shrink-0"}),s.jsx("span",{className:"truncate",children:f?.name??"Account"})]}),s.jsxs(Xt,{className:"h-[80dvh] p-0",children:[s.jsx(Qt,{className:"sr-only",children:"Account"}),s.jsx(jt,{...G})]})]}):s.jsxs(Ae,{open:u,onOpenChange:x,children:[s.jsx(xe,{asChild:!0,children:s.jsxs(Y,{tooltip:f?.name??"Account",className:P("rounded-md",g&&"border-2 border-dashed border-warning"),children:[s.jsx(Ue,{url:h,fallback:f?.name??"U",shape:"circle",size:"xs",className:"shrink-0"}),s.jsx("span",{className:"truncate",children:f?.name??"Account"})]})}),s.jsx(Ie,{side:"right",align:"end",sideOffset:18,collisionPadding:16,className:"w-[280px] p-0 flex flex-col max-h-[520px]",onCloseAutoFocus:fo,children:s.jsx(jt,{...G})})]})}),t[36]=g,t[37]=c,t[38]=u,t[39]=G,t[40]=f?.name,t[41]=h,t[42]=W):W=t[42],W}function fo(t){return t.preventDefault()}async function xo(){const{error:t}=await se.admin.stopImpersonating();if(t){ee.error(t.message||"Failed to stop impersonation");return}window.location.href="/"}function ho(){q("signed_out",{source:"account_popover"}),Ds(),se.signOut()}const po=["Browse and edit your Library files","Run your agents","Enable and call any MCP tool in this org"],go="Connect: ";function bo(){return typeof window>"u"?"unknown host":window.location.hostname}function jo(t){const e=z.c(45),{onClose:n}=t,{org:i}=X();let o;e[0]!==i.slug?(o=li(i.slug),e[0]=i.slug,e[1]=o):o=e[1];const l=o,r=ri(),[a,m]=M.useState(null),c=ft(),d=ft();let u;e[2]!==r||e[3]!==i.slug?(u=()=>{r.mutate({name:`${go}Claude Code on ${bo()}`,permissions:{"*":["*"]}},{onSuccess:U=>{const R=ai(i.slug,U.key);m(R),q("connect_studio_generate",{target:"claude-code"}),navigator.clipboard?.writeText(R).then(_o,So)},onError:yo})},e[2]=r,e[3]=i.slug,e[4]=u):u=e[4];const x=u;let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx("span",{className:"size-8 rounded-lg bg-special/15 text-special flex items-center justify-center shrink-0",children:s.jsx(ts,{size:17})}),e[5]=f):f=e[5];let h;e[6]!==i.name?(h=s.jsxs(Je,{className:"flex items-center gap-2.5",children:[f,"Connect ",i.name," to Claude"]}),e[6]=i.name,e[7]=h):h=e[7];let g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Ft,{children:"Hand Claude this org's MCP endpoint. Once linked, Claude can:"}),e[8]=g):g=e[8];let p;e[9]!==h?(p=s.jsxs(Rt,{children:[h,g]}),e[9]=h,e[10]=p):p=e[10];let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx("ul",{className:"flex flex-col gap-2 text-sm",children:po.map(vo)}),e[11]=b):b=e[11];let j;e[12]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(dt,{size:15,className:"text-muted-foreground"}),e[12]=j):j=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[j,"Claude Code",s.jsx("span",{className:"ml-auto text-[11px] font-medium text-special uppercase tracking-wide",children:"Recommended"})]}),e[13]=v):v=e[13];let y;e[14]!==a||e[15]!==c||e[16]!==r.isPending||e[17]!==x?(y=s.jsxs("section",{className:"rounded-xl border border-border bg-muted/30 p-4 flex flex-col gap-3",children:[v,a?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"rounded-lg border border-border bg-background p-3 max-h-32 overflow-y-auto",children:s.jsx("code",{className:"text-xs leading-relaxed break-all font-mono text-foreground/90 whitespace-pre-wrap",children:a})}),s.jsxs(le,{size:"sm",className:"gap-1.5 self-start",onClick:()=>{c.handleCopy(a),q("connect_studio_copy",{target:"claude-code"}),ee.success("Command copied — paste it in your terminal")},children:[c.copied?s.jsx(ve,{size:14}):s.jsx(He,{size:14}),c.copied?"Copied":"Copy command"]}),s.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-warning/40 bg-warning/10 px-3 py-2",children:[s.jsx(Kt,{size:14,className:"text-warning shrink-0 mt-0.5"}),s.jsxs("p",{className:"text-xs leading-relaxed text-foreground/80",children:["No login step — this command embeds a"," ",s.jsx("span",{className:"font-medium text-foreground",children:"full-access token"}),". Treat it like a password; revoke it any time in Settings → Connect."]})]})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"One command, no browser login. We'll mint a scoped access token and embed it so Claude Code connects instantly."}),s.jsxs(le,{size:"sm",className:"gap-1.5 self-start",disabled:r.isPending,onClick:x,children:[s.jsx(dt,{size:14}),r.isPending?"Generating…":"Generate connect command"]})]})]}),e[14]=a,e[15]=c,e[16]=r.isPending,e[17]=x,e[18]=y):y=e[18];let S,C;e[19]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[s.jsx(mn,{size:15,className:"text-muted-foreground"}),"Claude Desktop or claude.ai"]}),C=s.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"Add a custom connector in Settings → Connectors and paste this URL. Claude signs in with OAuth on first use."}),e[19]=S,e[20]=C):(S=e[19],C=e[20]);let _;e[21]!==l?(_=s.jsx("code",{className:"text-xs flex-1 min-w-0 truncate font-mono text-foreground/90",children:l}),e[21]=l,e[22]=_):_=e[22];let N;e[23]!==l||e[24]!==d?(N=()=>{d.handleCopy(l),q("connect_studio_copy",{target:"claude-connector"})},e[23]=l,e[24]=d,e[25]=N):N=e[25];let w;e[26]!==d.copied?(w=d.copied?s.jsx(ve,{size:14}):s.jsx(He,{size:14}),e[26]=d.copied,e[27]=w):w=e[27];let I;e[28]!==N||e[29]!==w?(I=s.jsx(le,{variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"Copy URL",onClick:N,children:w}),e[28]=N,e[29]=w,e[30]=I):I=e[30];let A;e[31]!==_||e[32]!==I?(A=s.jsxs("section",{className:"flex flex-col gap-2.5",children:[S,C,s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/30 pl-3 pr-1.5 py-1.5 min-w-0",children:[_,I]})]}),e[31]=_,e[32]=I,e[33]=A):A=e[33];let k;e[34]!==i.slug?(k={org:i.slug},e[34]=i.slug,e[35]=k):k=e[35];let $;e[36]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(et,{size:12}),e[36]=$):$=e[36];let O;e[37]!==n||e[38]!==k?(O=s.jsx("div",{className:"flex items-center border-t border-border pt-3",children:s.jsx(le,{asChild:!0,variant:"link",size:"sm",className:"px-0 text-xs gap-1",children:s.jsxs(Mt,{to:"/$org/settings/connect",params:k,onClick:n,children:["More clients & API keys ",$]})})}),e[37]=n,e[38]=k,e[39]=O):O=e[39];let E;return e[40]!==y||e[41]!==A||e[42]!==O||e[43]!==p?(E=s.jsxs("div",{className:"flex flex-col gap-4 min-w-0",children:[p,b,y,A,O]}),e[40]=y,e[41]=A,e[42]=O,e[43]=p,e[44]=E):E=e[44],E}function vo(t){return s.jsxs("li",{className:"flex items-center gap-2.5",children:[s.jsx("span",{className:"size-4 rounded-full bg-special/15 text-special flex items-center justify-center shrink-0",children:s.jsx(ve,{size:11,strokeWidth:3})}),s.jsx("span",{className:"text-foreground",children:t})]},t)}function yo(t){return ee.error(t.message)}function So(){return ee.success("Command ready — copy it below")}function _o(){return ee.success("Command copied — paste it in your terminal")}function No(t){const e=z.c(6),{open:n,onOpenChange:i}=t;let o;e[0]!==i?(o=s.jsx(Dt,{className:"max-w-lg gap-4",children:s.jsx(jo,{onClose:()=>i(!1)})}),e[0]=i,e[1]=o):o=e[1];let l;return e[2]!==i||e[3]!==n||e[4]!==o?(l=s.jsx(Ze,{open:n,onOpenChange:i,children:o}),e[2]=i,e[3]=n,e[4]=o,e[5]=l):l=e[5],l}function je(t){const e=z.c(43),{variant:n}=t===void 0?{}:t,i=n===void 0?"icon":n,o=On(),[l,r]=M.useState(!1);let a,m;if(e[0]!==o.capabilities||e[1]!==o.hostname||e[2]!==o.machineId||e[3]!==o.online){const v=ci(o.capabilities);a=o.online?"Desktop linked":"Connect desktop",m=o.online?s.jsxs("div",{className:"flex flex-col gap-0.5 text-xs",children:[s.jsx("span",{className:"font-medium",children:o.hostname??o.machineId??"Desktop linked"}),s.jsx("span",{className:"text-muted-foreground",children:v.length>0?`Available: ${v.join(", ")}`:"No CLI agents detected"})]}):s.jsx("span",{className:"text-xs",children:"Desktop disconnected"}),e[0]=o.capabilities,e[1]=o.hostname,e[2]=o.machineId,e[3]=o.online,e[4]=a,e[5]=m}else a=e[4],m=e[5];const c=m;if(i==="full"){let v,y;e[6]===Symbol.for("react.memo_cache_sentinel")?(v=()=>r(!0),y=s.jsx(Ge,{}),e[6]=v,e[7]=y):(v=e[6],y=e[7]);let S;e[8]!==a?(S=s.jsx("span",{children:a}),e[8]=a,e[9]=S):S=e[9];let C;e[10]!==o.online?(C=o.online&&s.jsx("span",{className:"ml-auto size-2 rounded-full bg-success animate-pulse"}),e[10]=o.online,e[11]=C):C=e[11];let _;e[12]!==a||e[13]!==S||e[14]!==C?(_=s.jsx(ae,{asChild:!0,children:s.jsxs(Y,{tooltip:a,onClick:v,children:[y,S,C]})}),e[12]=a,e[13]=S,e[14]=C,e[15]=_):_=e[15];let N;e[16]!==c?(N=s.jsx(ce,{side:"right",children:c}),e[16]=c,e[17]=N):N=e[17];let w;e[18]!==_||e[19]!==N?(w=s.jsxs(de,{children:[_,N]}),e[18]=_,e[19]=N,e[20]=w):w=e[20];let I;e[21]!==l?(I=s.jsx(xt,{open:l,onOpenChange:r}),e[21]=l,e[22]=I):I=e[22];let A;return e[23]!==I||e[24]!==w?(A=s.jsxs(s.Fragment,{children:[w,I]}),e[23]=I,e[24]=w,e[25]=A):A=e[25],A}let d;e[26]===Symbol.for("react.memo_cache_sentinel")?(d=()=>r(!0),e[26]=d):d=e[26];const u=o.online?"Desktop linked":"Connect your desktop";let x;e[27]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Ge,{size:16}),e[27]=x):x=e[27];let f;e[28]!==o.online?(f=o.online&&s.jsx("span",{className:"absolute top-1 right-1 size-2 rounded-full bg-success ring-2 ring-background animate-pulse"}),e[28]=o.online,e[29]=f):f=e[29];let h;e[30]!==u||e[31]!==f?(h=s.jsx(ae,{asChild:!0,children:s.jsxs(ue,{onClick:d,"aria-label":u,children:[x,f]})}),e[30]=u,e[31]=f,e[32]=h):h=e[32];let g;e[33]!==c?(g=s.jsx(ce,{side:"bottom",children:c}),e[33]=c,e[34]=g):g=e[34];let p;e[35]!==h||e[36]!==g?(p=s.jsxs(de,{children:[h,g]}),e[35]=h,e[36]=g,e[37]=p):p=e[37];let b;e[38]!==l?(b=s.jsx(xt,{open:l,onOpenChange:r}),e[38]=l,e[39]=b):b=e[39];let j;return e[40]!==b||e[41]!==p?(j=s.jsxs(s.Fragment,{children:[p,b]}),e[40]=b,e[41]=p,e[42]=j):j=e[42],j}class Co extends M.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,n){}render(){return this.state.hasError?null:this.props.children}}function wo(t){return t<=1?"text-destructive":t<=5?"text-warning":"text-foreground/70"}function ko(){const t=z.c(17),e=ie(),{org:n}=X(),{hasDecoKey:i,balanceDollars:o}=Kn();if(!i)return null;let l;t[0]!==o?(l=o!=null?`Credits: $${o.toFixed(2)}`:"Credits",t[0]=o,t[1]=l):l=t[1];let r;t[2]!==o?(r=P(o!=null&&wo(o)),t[2]=o,t[3]=r):r=t[3];let a;t[4]!==e||t[5]!==n.slug?(a=()=>e({to:"/$org/settings/ai-providers",params:{org:n.slug}}),t[4]=e,t[5]=n.slug,t[6]=a):a=t[6];let m;t[7]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(un,{}),t[7]=m):m=t[7];let c;t[8]!==o?(c=o!=null?`$${o.toFixed(2)}`:"Credits",t[8]=o,t[9]=c):c=t[9];let d;t[10]!==c?(d=s.jsx("span",{children:c}),t[10]=c,t[11]=d):d=t[11];let u;return t[12]!==l||t[13]!==r||t[14]!==a||t[15]!==d?(u=s.jsx(te,{children:s.jsx(B,{children:s.jsxs(Y,{tooltip:l,className:r,onClick:a,children:[m,d]})})}),t[12]=l,t[13]=r,t[14]=a,t[15]=d,t[16]=u):u=t[16],u}function vt(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Co,{children:s.jsx(M.Suspense,{fallback:null,children:s.jsx(ko,{})})}),t[0]=e):e=t[0],e}function Fe(){const t=z.c(7),e=ie(),{org:n}=X();let i;t[0]!==e||t[1]!==n.slug?(i=()=>e({to:"/$org/settings",params:{org:n.slug}}),t[0]=e,t[1]=n.slug,t[2]=i):i=t[2];let o,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ze,{}),l=s.jsx("span",{children:"Settings"}),t[3]=o,t[4]=l):(o=t[3],l=t[4]);let r;return t[5]!==i?(r=s.jsxs(Y,{tooltip:"Settings",onClick:i,children:[o,l]}),t[5]=i,t[6]=r):r=t[6],r}function Io(){const t=z.c(6),e=ie(),{org:n}=X();let i;t[0]!==e||t[1]!==n.slug?(i=()=>e({to:"/$org/settings",params:{org:n.slug}}),t[0]=e,t[1]=n.slug,t[2]=i):i=t[2];let o;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ze,{size:15}),t[3]=o):o=t[3];let l;return t[4]!==i?(l=s.jsx("button",{type:"button","aria-label":"Settings",onClick:i,className:"shrink-0 flex items-center justify-center size-7 rounded-md text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",children:o}),t[4]=i,t[5]=l):l=t[5],l}function yt(){const t=z.c(10),[e,n]=M.useState(!1),[i,o]=M.useState(!1);let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(B,{children:s.jsx(ss,{trigger:s.jsxs(Y,{tooltip:"Invite members",children:[s.jsx(Vt,{}),s.jsx("span",{children:"Invite members"})]})})}),t[0]=l):l=t[0];let r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(B,{children:s.jsxs(Y,{tooltip:"Add connection",onClick:()=>n(!0),children:[s.jsx(ei,{}),s.jsx("span",{children:"Add connection"})]})}),t[1]=r):r=t[1];let a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs(te,{className:"gap-0.5",children:[l,r,s.jsx(B,{children:s.jsxs(Y,{tooltip:"Connect to Claude",onClick:()=>{q("connect_studio_opened",{source:"sidebar_footer"}),o(!0)},children:[s.jsx(ts,{}),s.jsx("span",{children:"Connect to Claude"})]})})]}),t[2]=a):a=t[2];let m;t[3]!==e?(m=s.jsx(Vn,{open:e,onOpenChange:n,mode:"browse"}),t[3]=e,t[4]=m):m=t[4];let c;t[5]!==i?(c=s.jsx(No,{open:i,onOpenChange:o}),t[5]=i,t[6]=c):c=t[6];let d;return t[7]!==m||t[8]!==c?(d=s.jsxs(s.Fragment,{children:[a,m,c]}),t[7]=m,t[8]=c,t[9]=d):d=t[9],d}function St(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{className:"gap-0.5",children:s.jsx(B,{children:s.jsx(ss,{trigger:s.jsxs(Y,{tooltip:"Invite members",children:[s.jsx(Vt,{}),s.jsx("span",{children:"Invite members"})]})})})}),t[0]=e):e=t[0],e}function Ao(){const t=z.c(17),{state:e}=re(),n=e==="collapsed";if($e()){if(n){let x;t[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(St,{}),t[0]=x):x=t[0];let f;t[1]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(B,{children:s.jsx("div",{className:"flex justify-center",children:s.jsx(je,{})})}),t[1]=f):f=t[1];let h;t[2]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(B,{children:s.jsx(Fe,{})}),t[2]=h):h=t[2];let g;return t[3]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsxs(he,{className:"px-2 pb-3 gap-1",children:[x,s.jsxs(te,{children:[f,h,s.jsx(B,{children:s.jsx(be,{})})]})]}),t[3]=g):g=t[3],g}let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(St,{}),t[4]=c):c=t[4];let d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(B,{children:s.jsx(je,{variant:"full"})}),t[5]=d):d=t[5];let u;return t[6]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs(he,{className:"px-2 pb-3 gap-0.5",children:[c,s.jsxs(te,{className:"gap-0.5",children:[d,s.jsx(B,{children:s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(be,{})}),s.jsx(Io,{})]})})]})]}),t[6]=u):u=t[6],u}if(n){let c,d;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(yt,{}),d=s.jsx(vt,{}),t[7]=c,t[8]=d):(c=t[7],d=t[8]);let u;t[9]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(B,{children:s.jsx("div",{className:"flex justify-center",children:s.jsx(je,{})})}),t[9]=u):u=t[9];let x;t[10]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(B,{children:s.jsx(Fe,{})}),t[10]=x):x=t[10];let f;return t[11]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsxs(he,{className:"px-2 pb-3 gap-1",children:[c,d,s.jsxs(te,{children:[u,x,s.jsx(B,{children:s.jsx(be,{})})]})]}),t[11]=f):f=t[11],f}let o,l;t[12]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(yt,{}),l=s.jsx(vt,{}),t[12]=o,t[13]=l):(o=t[12],l=t[13]);let r;t[14]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(B,{children:s.jsx(je,{variant:"full"})}),t[14]=r):r=t[14];let a;t[15]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(B,{children:s.jsx(Fe,{})}),t[15]=a):a=t[15];let m;return t[16]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsxs(he,{className:"px-2 pb-3 gap-0.5",children:[o,l,s.jsxs(te,{className:"gap-0.5",children:[r,a,s.jsx(B,{children:s.jsx(be,{})})]})]}),t[16]=m):m=t[16],m}function zo(){const t=z.c(8),e=ie(),{org:n}=X(),{setOpenMobile:i}=re();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(te,{children:s.jsx(B,{children:s.jsx(be,{})})})}),t[0]=o):o=t[0];let l;t[1]!==e||t[2]!==n.slug||t[3]!==i?(l=()=>{e({to:"/$org/settings",params:{org:n.slug}}),i(!1)},t[1]=e,t[2]=n.slug,t[3]=i,t[4]=l):l=t[4];let r;t[5]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(ze,{className:"size-4"}),t[5]=r):r=t[5];let a;return t[6]!==l?(a=s.jsx(he,{className:"px-2 pb-3",children:s.jsxs("div",{className:"flex items-center gap-1",children:[o,s.jsx(ue,{"aria-label":"Settings",onClick:l,children:r})]})}),t[6]=l,t[7]=a):a=t[7],a}function _t(t){const e=z.c(15),{className:n,wrapperClassName:i,children:o}=t,[l,r]=M.useState(!1);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=b=>{b&&r(b.scrollHeight>b.clientHeight+1)},e[0]=a):a=e[0];const m=a;let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=b=>{const j=b.currentTarget;r(j.scrollHeight-j.scrollTop>j.clientHeight+1)},e[1]=c):c=e[1];const d=c;let u;e[2]!==i?(u=P("relative",i),e[2]=i,e[3]=u):u=e[3];let x;e[4]!==o||e[5]!==n?(x=s.jsx("div",{ref:m,onScroll:d,className:n,children:o}),e[4]=o,e[5]=n,e[6]=x):x=e[6];const f=l?"opacity-100":"opacity-0";let h;e[7]!==f?(h=P("pointer-events-none absolute right-0 bottom-0 left-0 h-10 bg-gradient-to-t from-sidebar to-transparent transition-opacity duration-150",f),e[7]=f,e[8]=h):h=e[8];let g;e[9]!==h?(g=s.jsx("div",{"aria-hidden":!0,className:h}),e[9]=h,e[10]=g):g=e[10];let p;return e[11]!==u||e[12]!==x||e[13]!==g?(p=s.jsxs("div",{className:u,children:[x,g]}),e[11]=u,e[12]=x,e[13]=g,e[14]=p):p=e[14],p}function $o(t){const e=z.c(8),{virtualMcpId:n,size:i,showAutomationBadge:o}=t,l=i===void 0?"sm":i;let r;e[0]!==l||e[1]!==n?(r=n?s.jsx(To,{virtualMcpId:n,size:l}):s.jsx(me,{icon:null,name:"?",size:l}),e[0]=l,e[1]=n,e[2]=r):r=e[2];let a;e[3]!==o?(a=o&&s.jsx("span",{"aria-label":"Automation-triggered",className:"absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full bg-blue-500 border border-blue-600 text-white",children:s.jsx(is,{size:10,className:"text-white"})}),e[3]=o,e[4]=a):a=e[4];let m;return e[5]!==r||e[6]!==a?(m=s.jsxs("div",{className:"relative shrink-0",children:[r,a]}),e[5]=r,e[6]=a,e[7]=m):m=e[7],m}function To(t){const e=z.c(6),{virtualMcpId:n,size:i}=t,o=st(n);if(!o){let a;return e[0]!==i?(a=s.jsx(me,{icon:null,name:"?",size:i}),e[0]=i,e[1]=a):a=e[1],a}const l=o.icon??null;let r;return e[2]!==o.title||e[3]!==i||e[4]!==l?(r=s.jsx(me,{icon:l,name:o.title,size:i}),e[2]=o.title,e[3]=i,e[4]=l,e[5]=r):r=e[5],r}function Nt(t){const e=z.c(36),{open:n,onOpenChange:i}=t,[o,l]=M.useState(""),{org:r}=X(),{setTaskId:a}=it(),m=ns();let c,d,u;e[0]!==r.id||e[1]!==o?(u=o.trim(),d=Fs,c=Tt.globalSearch(r.id,u),e[0]=r.id,e[1]=o,e[2]=c,e[3]=d,e[4]=u):(c=e[2],d=e[3],u=e[4]);const x=n&&u.length>0;let f;e[5]!==m||e[6]!==u?(f=async()=>await m.call("GLOBAL_SEARCH",{query:u,limit:20}),e[5]=m,e[6]=u,e[7]=f):f=e[7];let h;e[8]!==c||e[9]!==x||e[10]!==f?(h={queryKey:c,enabled:x,queryFn:f,staleTime:1e4},e[8]=c,e[9]=x,e[10]=f,e[11]=h):h=e[11];const{data:g,isFetching:p}=d(h);let b;e[12]!==g?.items?(b=g?.items??[],e[12]=g?.items,e[13]=b):b=e[13];const j=b;let v;e[14]!==i?(v=$=>{$||l(""),i($)},e[14]=i,e[15]=v):v=e[15];const y=v;let S;e[16]!==y||e[17]!==a?(S=$=>{y(!1),a($.id,$.virtual_mcp_id??void 0)},e[16]=y,e[17]=a,e[18]=S):S=e[18];const C=S;let _;e[19]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(Rt,{className:"sr-only",children:[s.jsx(Je,{children:"Search"}),s.jsx(Ft,{children:"Search across your organization's resources."})]}),e[19]=_):_=e[19];let N;e[20]!==o?(N=s.jsx(hi,{value:o,onValueChange:l,placeholder:"Search..."}),e[20]=o,e[21]=N):N=e[21];let w;e[22]!==C||e[23]!==p||e[24]!==j||e[25]!==u?(w=u?p&&j.length===0?s.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching…"}):j.length===0?s.jsx(fi,{children:"No results."}):j.map($=>$.type==="thread"?s.jsxs(xi,{value:`thread:${$.id}:${$.title}`,onSelect:()=>C($),className:"gap-2.5",children:[s.jsx($o,{virtualMcpId:$.virtual_mcp_id,size:"xs"}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("div",{className:"text-sm text-foreground truncate",children:$.title||"Untitled chat"})}),s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:new Date($.updated_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]},`thread:${$.id}`):null):s.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Start typing to search."}),e[22]=C,e[23]=p,e[24]=j,e[25]=u,e[26]=w):w=e[26];let I;e[27]!==w?(I=s.jsx(pi,{children:w}),e[27]=w,e[28]=I):I=e[28];let A;e[29]!==N||e[30]!==I?(A=s.jsxs(Dt,{className:"overflow-hidden p-0",closeButtonClassName:"hidden",children:[_,s.jsxs(gi,{shouldFilter:!1,className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:[N,I]})]}),e[29]=N,e[30]=I,e[31]=A):A=e[31];let k;return e[32]!==y||e[33]!==n||e[34]!==A?(k=s.jsx(Ze,{open:n,onOpenChange:y,children:A}),e[32]=y,e[33]=n,e[34]=A,e[35]=k):k=e[35],k}function Oo(t){return t==="ephemeral"||t.startsWith("thread:")}function fs(t){const e=z.c(40),{task:n,isActive:i,onClick:o,onArchive:l,showAutomationBadge:r,showAgentIcon:a,hideStatusIdle:m,indented:c}=t,d=vi(n.status),u=d.icon,x=n.metadata?.kind==="tool_call_run",f=st(x?void 0:n.virtual_mcp_id);let h;e[0]!==f?(h=qn(f),e[0]=f,e[1]=h):h=e[1];const g=h;yi(6e4);const p=r||!!n.trigger_id,b=n.id,j="button",v=0;let y;e[2]!==o?(y=L=>{L.target===L.currentTarget&&(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),o())},e[2]=o,e[3]=y):y=e[3];const S=c?"-ml-4 pl-6":"pl-[7px]",C=i?"bg-accent text-accent-foreground":"hover:bg-accent/60";let _;e[4]!==S||e[5]!==C?(_=P("group/row flex items-center gap-2 py-1.5 rounded-md cursor-pointer transition-colors",S,"focus-visible:outline-none focus-visible:inset-ring-2 focus-visible:inset-ring-ring/50",C),e[4]=S,e[5]=C,e[6]=_):_=e[6];let N;e[7]!==x||e[8]!==a||e[9]!==f?.icon||e[10]!==f?.title?(N=a&&!x&&s.jsx(me,{icon:f?.icon??null,name:f?.title??"?",size:"2xs"}),e[7]=x,e[8]=a,e[9]=f?.icon,e[10]=f?.title,e[11]=N):N=e[11];let w;e[12]!==p?(w=p&&s.jsx(is,{size:12,"aria-label":"Automation-triggered",className:"shrink-0 text-blue-500"}),e[12]=p,e[13]=w):w=e[13];const I=n.title||"Untitled task";let A;e[14]!==I?(A=s.jsx("div",{className:"text-sm text-foreground truncate",children:I}),e[14]=I,e[15]=A):A=e[15];let k;e[16]!==w||e[17]!==A?(k=s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[w,A]}),e[16]=w,e[17]=A,e[18]=k):k=e[18];let $;e[19]!==g||e[20]!==i||e[21]!==n.branch||e[22]!==n.updated_at?($=n.updated_at&&s.jsxs("div",{className:P("flex items-center gap-1 text-[11px] min-w-0",i?"text-accent-foreground/70":"text-muted-foreground/60"),children:[n.branch&&!Oo(n.branch)?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"truncate font-mono",children:n.branch}),s.jsx("span",{className:"shrink-0",children:"·"})]}):g?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"truncate",children:[g.owner,"/",g.name]}),s.jsx("span",{className:"shrink-0",children:"·"})]}):null,s.jsx("span",{className:"shrink-0",children:_i(new Date(n.updated_at))})]}),e[19]=g,e[20]=i,e[21]=n.branch,e[22]=n.updated_at,e[23]=$):$=e[23];let O;e[24]!==k||e[25]!==$?(O=s.jsxs("div",{className:"flex-1 min-w-0",children:[k,$]}),e[24]=k,e[25]=$,e[26]=O):O=e[26];const E="shrink-0 grid [grid-template-areas:'slot'] items-center justify-items-center",U=!m&&s.jsx("span",{className:P("[grid-area:slot] flex size-8 items-center justify-center pointer-events-none transition-opacity",l&&"group-hover/row:opacity-0"),"aria-label":d.label,children:s.jsx(u,{size:14,className:P(d.iconClassName,n.status==="in_progress"&&"animate-spin")})});let R;e[27]!==l?(R=l&&s.jsxs(de,{children:[s.jsx(ae,{asChild:!0,children:s.jsx("button",{type:"button","aria-label":"Archive task",onClick:L=>{L.stopPropagation(),l()},className:"[grid-area:slot] opacity-0 pointer-events-none group-hover/row:opacity-100 group-hover/row:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto transition-opacity flex size-8 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:s.jsx(Rs,{size:14})})}),s.jsx(ce,{side:"right",children:"Archive"})]}),e[27]=l,e[28]=R):R=e[28];let F;e[29]!==U||e[30]!==R?(F=s.jsxs("div",{className:E,children:[U,R]}),e[29]=U,e[30]=R,e[31]=F):F=e[31];let D;return e[32]!==o||e[33]!==O||e[34]!==F||e[35]!==y||e[36]!==_||e[37]!==N||e[38]!==n.id?(D=s.jsxs("div",{"data-task-id":b,role:j,tabIndex:v,onClick:o,onKeyDown:y,className:_,children:[N,O,F]}),e[32]=o,e[33]=O,e[34]=F,e[35]=y,e[36]=_,e[37]=N,e[38]=n.id,e[39]=D):D=e[39],D}const Ct=["requires_action","in_progress","failed","expired","completed"];function Mo(t){const e=new Map(Ct.map(n=>[n,[]]));for(const n of t){const i=n.status??"completed";(e.get(i)??e.get("completed")).push(n)}return Ct.map(n=>({status:n,threads:e.get(n)}))}const Po="sidebar.group.expanded.";function Eo(t,e){const n=z.c(3),[i,o]=we(`${Po}${t}`,e);let l;return n[0]!==i||n[1]!==o?(l=[i,o],n[0]=i,n[1]=o,n[2]=l):l=n[2],l}function xs(t){const e=z.c(12),{onClick:n,isFetching:i,indented:o}=t,l=o?"-ml-4 pl-6 pr-2":"px-2";let r;e[0]!==l?(r=P("flex items-center gap-2 py-1.5 rounded-md text-sm text-muted-foreground",l,"hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","transition-colors disabled:cursor-progress disabled:opacity-60"),e[0]=l,e[1]=r):r=e[1];let a;e[2]!==i?(a=i&&s.jsx(Ot,{size:14,className:"animate-spin"}),e[2]=i,e[3]=a):a=e[3];const m=i?"Loading…":"Show more";let c;e[4]!==m?(c=s.jsx("span",{children:m}),e[4]=m,e[5]=c):c=e[5];let d;return e[6]!==i||e[7]!==n||e[8]!==r||e[9]!==a||e[10]!==c?(d=s.jsxs("button",{type:"button","aria-label":"Show more tasks",onClick:n,disabled:i,className:r,children:[a,c]}),e[6]=i,e[7]=n,e[8]=r,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function Do(t,e,n,i){return[t,e,n,i.type,i.member,i.currentUserId??""].join("|")}function Fo(t){return t.member==="mine"&&!t.currentUserId}const hs=4;let _e=0;const Ke=[];function Ro(){for(;_e<hs&&Ke.length>0;){const t=Ke.shift();t&&t()}}function ps(t){return new Promise((e,n)=>{const i=()=>{_e++,t().then(e,n).finally(()=>{_e--,Ro()})};_e<hs?i():Ke.push(i)})}const Me=10;function wt(t,e,n,i,o){const l={hidden:!1};i.member==="mine"&&i.currentUserId&&(l.created_by=i.currentUserId),i.type==="automation"&&(l.has_trigger=!0),i.type==="manual"&&(l.has_trigger=!1);const r={where:l,limit:o,offset:n,orderBy:[{field:["updated_at"],direction:"desc"}]};return r.status=e,r}function Lo(t,e,n,i){let o=0;for(const l of t)gs(l,e,n,i)&&o++;return o}function Re(t,e,n,i){return Lo(t,e,n,i)}function Bo(t,e){return!!(t>=Me||t===0&&e)}function kt(t,e){return t<e}function Uo(t,e){return e===!1?!1:e===!0?!0:t}function gs(t,e,n,i){return!(t.hidden||(t.status??"completed")!==n||i.member==="mine"&&i.currentUserId&&t.created_by!==i.currentUserId||i.type==="automation"&&!t.trigger_id||i.type==="manual"&&t.trigger_id)}const Ce=new Map,Se=new Map;function Ho(t,e){return e?t>=Me?!0:null:!1}function It(t){return Ce.get(t)}function Go(t,e){Ce.set(t,e)}function Wo(t,e,n){const i=Ce.get(t);if(i!==void 0){n(i);return}let o=Se.get(t);o||(o=ps(e).then(l=>(Ce.set(t,l),Se.delete(t),l)).catch(()=>(Se.delete(t),Promise.reject(new Error("group probe failed")))),Se.set(t,o)),o.then(n,()=>n(!1))}function At(t){const e=t,n=Array.isArray(e.items)?e.items:[];return{items:n,hasMore:e.hasMore??n.length===Me,totalCount:typeof e.totalCount=="number"?e.totalCount:void 0}}function Ko(t,e,n,i,o){let l=0;for(const r of t)e.has(r.id)||gs(r,n,i,o)&&l++;return l}function Vo(t,e,n,i){const o=z.c(8),{org:l}=X(),r=Do(l.id,t,e,n);let a;o[0]!==n?(a=Fo(n),o[0]=n,o[1]=a):a=o[1];const m=a,[c,d]=M.useState({isFetching:!1,isProbing:!1,identity:r,probeSubscribedIdentity:null,serverHasMore:null});c.identity!==r&&d({isFetching:!1,isProbing:!1,identity:r,probeSubscribedIdentity:null,serverHasMore:null});const u=Dn(),{threads:x,hasMore:f}=nt(),h=Re(x,t,e,n),g=Bo(h,f),p=Ho(h,f),b=ns();if(c.identity===r&&c.serverHasMore===null){const _=p??It(r);_!==void 0&&d({isFetching:!1,isProbing:!1,identity:r,probeSubscribedIdentity:c.probeSubscribedIdentity,serverHasMore:_})}!m&&c.identity===r&&c.serverHasMore===null&&p===null&&It(r)===void 0&&c.probeSubscribedIdentity!==r&&(d(_=>_.identity===r?{..._,isProbing:!0,probeSubscribedIdentity:r}:_),Wo(r,async()=>{const _=wt(t,e,0,n,1),N=await b.call("COLLECTION_THREADS_LIST",_),{totalCount:w}=At(N),I=Re(u.threads.get(),t,e,n);return w===void 0?!1:kt(I,w)},_=>{d(N=>N.identity!==r?N:{...N,isProbing:!1,serverHasMore:_})}));const v=async function(){if(c.isFetching||c.isProbing||m)return;const N=r;d(w=>w.identity===N?{...w,isFetching:!0}:w);try{const w=Re(x,t,e,n),I=wt(t,e,w,n,Me),A=await ps(()=>b.call("COLLECTION_THREADS_LIST",I)),{items:k,hasMore:$,totalCount:O}=At(A),E=new Set(x.map(qo)),U=Ko(k,E,t,e,n),R=w;u.mergeThreads(k),d(F=>{if(F.identity!==N)return F;let D;return O!==void 0?D=kt(R+U,O):D=k.length===0||U===0?!1:$,Go(N,D),{...F,isFetching:!1,serverHasMore:D}})}catch(w){const I=w,A=I instanceof Error?I.message:String(I);ee.error(`Could not load more tasks: ${A}`),d(k=>k.identity===N?{...k,isFetching:!1}:k)}},y=c.isFetching||c.isProbing,S=!m&&!y&&Uo(g,c.serverHasMore);let C;return o[2]!==y||o[3]!==v||o[4]!==S||o[5]!==c.isProbing||o[6]!==c.serverHasMore?(C={hasMore:S,isFetching:y,isProbing:c.isProbing,serverHasMore:c.serverHasMore,loadMore:v},o[2]=y,o[3]=v,o[4]=S,o[5]=c.isProbing,o[6]=c.serverHasMore,o[7]=C):C=o[7],C}function qo(t){return t.id}function Yo(t){const e=z.c(20),{status:n,threads:i,activeTaskId:o,onSelectTask:l,onArchiveTask:r,canArchive:a,filters:m}=t,{isFetching:c,isProbing:d,loadMore:u,hasMore:x,serverHasMore:f}=Vo("status",n,m),[h,g]=M.useState(!1);!h&&i.length===0&&f===!0&&!c&&!d&&(g(!0),queueMicrotask(()=>{u()}));let p;if(e[0]!==o||e[1]!==a||e[2]!==m||e[3]!==r||e[4]!==l||e[5]!==i){let v;e[7]!==o||e[8]!==a||e[9]!==m||e[10]!==r||e[11]!==l?(v=y=>s.jsx(fs,{task:y,isActive:o===y.id,onClick:()=>l(y),onArchive:a&&y.created_by===m.currentUserId?()=>r(y):void 0,showAutomationBadge:!!y.trigger_id,showAgentIcon:!0,hideStatusIdle:!0,indented:!0},y.id),e[7]=o,e[8]=a,e[9]=m,e[10]=r,e[11]=l,e[12]=v):v=e[12],p=i.map(v),e[0]=o,e[1]=a,e[2]=m,e[3]=r,e[4]=l,e[5]=i,e[6]=p}else p=e[6];let b;e[13]!==x||e[14]!==c||e[15]!==u?(b=(x||c)&&s.jsx(xs,{onClick:()=>{u()},isFetching:c,indented:!0}),e[13]=x,e[14]=c,e[15]=u,e[16]=b):b=e[16];let j;return e[17]!==p||e[18]!==b?(j=s.jsxs(s.Fragment,{children:[p,b]}),e[17]=p,e[18]=b,e[19]=j):j=e[19],j}function Xo(t){const e=z.c(36),{status:n,threads:i,activeTaskId:o,onSelectTask:l,onArchiveTask:r,canArchive:a,filters:m}=t,c=Si[n],d=c.icon,[u,x]=Eo(`status-${n}`,!1);let f;e[0]!==u||e[1]!==x?(f=function(){x(!u)},e[0]=u,e[1]=x,e[2]=f):f=e[2];const h=f;let g;e[3]!==h?(g=N=>{N.target===N.currentTarget&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),h())},e[3]=h,e[4]=g):g=e[4];let p;e[5]!==d||e[6]!==c.iconClassName?(p=s.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:s.jsx(d,{size:12,className:c.iconClassName})}),e[5]=d,e[6]=c.iconClassName,e[7]=p):p=e[7];let b;e[8]!==u?(b=s.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground opacity-0 transition-opacity group-hover/group:opacity-100",children:u?s.jsx(tt,{size:14}):s.jsx(Ni,{size:14})}),e[8]=u,e[9]=b):b=e[9];let j;e[10]!==p||e[11]!==b?(j=s.jsxs("div",{className:"relative size-5 shrink-0 flex items-center justify-center",children:[p,b]}),e[10]=p,e[11]=b,e[12]=j):j=e[12];let v;e[13]!==c.label?(v=s.jsx("span",{className:"flex-1 truncate",children:c.label}),e[13]=c.label,e[14]=v):v=e[14];let y;e[15]!==i.length?(y=s.jsx("div",{className:"size-5 shrink-0 flex items-center justify-center",children:s.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:i.length})}),e[15]=i.length,e[16]=y):y=e[16];let S;e[17]!==u||e[18]!==h||e[19]!==g||e[20]!==j||e[21]!==v||e[22]!==y?(S=s.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":u,onClick:h,onKeyDown:g,className:"group/group flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-medium text-foreground cursor-pointer hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 transition-colors",children:[j,v,y]}),e[17]=u,e[18]=h,e[19]=g,e[20]=j,e[21]=v,e[22]=y,e[23]=S):S=e[23];let C;e[24]!==o||e[25]!==a||e[26]!==u||e[27]!==m||e[28]!==r||e[29]!==l||e[30]!==n||e[31]!==i?(C=u&&s.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:s.jsx(Yo,{status:n,threads:i,activeTaskId:o,onSelectTask:l,onArchiveTask:r,canArchive:a,filters:m})}),e[24]=o,e[25]=a,e[26]=u,e[27]=m,e[28]=r,e[29]=l,e[30]=n,e[31]=i,e[32]=C):C=e[32];let _;return e[33]!==S||e[34]!==C?(_=s.jsxs("div",{className:"flex flex-col gap-0.5",children:[S,C]}),e[33]=S,e[34]=C,e[35]=_):_=e[35],_}function zt(t){const e=z.c(38),{threads:n,groupBy:i,activeTaskId:o,onSelectTask:l,onArchiveTask:r,filters:a,hasMore:m,isFetchingMore:c,onLoadMore:d,filtersActive:u}=t;if(n.length===0&&!m&&!c){let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(ji,{className:"size-6 opacity-60"}),e[0]=p):p=e[0];const b=u?"No chats match your filters":"No chats yet";let j;return e[1]!==b?(j=s.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",children:[p,s.jsx("p",{className:"text-sm",children:b})]}),e[1]=b,e[2]=j):j=e[2],j}const x=n.length>1||m;if(i==="status"){let p;if(e[3]!==o||e[4]!==x||e[5]!==a||e[6]!==r||e[7]!==l||e[8]!==n){let j;e[10]!==o||e[11]!==x||e[12]!==a||e[13]!==r||e[14]!==l?(j=v=>s.jsx(Xo,{status:v.status,threads:v.threads,activeTaskId:o,onSelectTask:l,onArchiveTask:r,canArchive:x,filters:a},v.status),e[10]=o,e[11]=x,e[12]=a,e[13]=r,e[14]=l,e[15]=j):j=e[15],p=Mo(n).map(j),e[3]=o,e[4]=x,e[5]=a,e[6]=r,e[7]=l,e[8]=n,e[9]=p}else p=e[9];let b;return e[16]!==p?(b=s.jsx(s.Fragment,{children:p}),e[16]=p,e[17]=b):b=e[17],b}let f;if(e[18]!==o||e[19]!==x||e[20]!==a||e[21]!==r||e[22]!==l||e[23]!==n){let p;e[25]!==o||e[26]!==x||e[27]!==a||e[28]!==r||e[29]!==l?(p=b=>s.jsx(fs,{task:b,isActive:o===b.id,onClick:()=>l(b),onArchive:x&&b.created_by===a.currentUserId?()=>r(b):void 0,showAutomationBadge:!!b.trigger_id,showAgentIcon:!0},b.id),e[25]=o,e[26]=x,e[27]=a,e[28]=r,e[29]=l,e[30]=p):p=e[30],f=n.map(p),e[18]=o,e[19]=x,e[20]=a,e[21]=r,e[22]=l,e[23]=n,e[24]=f}else f=e[24];let h;e[31]!==m||e[32]!==c||e[33]!==d?(h=(m||c)&&s.jsx(xs,{onClick:d,isFetching:c}),e[31]=m,e[32]=c,e[33]=d,e[34]=h):h=e[34];let g;return e[35]!==f||e[36]!==h?(g=s.jsxs(s.Fragment,{children:[f,h]}),e[35]=f,e[36]=h,e[37]=g):g=e[37],g}function Qo(t,e,n){if(!n)return;const i=t.findIndex(o=>o.id===e);if(i!==-1){for(let o=i+1;o<t.length;o++){const l=t[o];if(l?.created_by===n)return l}for(let o=i-1;o>=0;o--){const l=t[o];if(l?.created_by===n)return l}}}function $t(t){const e=z.c(17),{label:n,onClick:i,active:o,children:l}=t,[r,a]=M.useState(!1);let m,c,d,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=()=>a(!0),c=()=>a(!1),d=()=>a(!0),u=()=>a(!1),e[0]=m,e[1]=c,e[2]=d,e[3]=u):(m=e[0],c=e[1],d=e[2],u=e[3]);const x=o&&"bg-sidebar-accent text-foreground";let f;e[4]!==x?(f=P("md:size-[34px] rounded-lg",x),e[4]=x,e[5]=f):f=e[5];let h;e[6]!==l||e[7]!==n||e[8]!==i||e[9]!==f?(h=s.jsx(ae,{asChild:!0,children:s.jsx(ue,{"aria-label":n,onClick:i,onPointerEnter:m,onPointerLeave:c,onFocus:d,onBlur:u,className:f,children:l})}),e[6]=l,e[7]=n,e[8]=i,e[9]=f,e[10]=h):h=e[10];let g;e[11]!==n?(g=s.jsx(ce,{side:"bottom",children:n}),e[11]=n,e[12]=g):g=e[12];let p;return e[13]!==r||e[14]!==h||e[15]!==g?(p=s.jsxs(de,{open:r,children:[h,g]}),e[13]=r,e[14]=h,e[15]=g,e[16]=p):p=e[16],p}function Le(t){const e=z.c(13),{label:n,value:i,onChange:o,options:l}=t;let r;e[0]!==n?(r=s.jsx("span",{className:"text-sm text-muted-foreground",children:n}),e[0]=n,e[1]=r):r=e[1];let a;e[2]!==o?(a=u=>u&&o(u),e[2]=o,e[3]=a):a=e[3];let m;e[4]!==l?(m=l.map(Jo),e[4]=l,e[5]=m):m=e[5];let c;e[6]!==a||e[7]!==m||e[8]!==i?(c=s.jsx(ui,{type:"single",size:"sm",value:i,onValueChange:a,className:"gap-0.5 rounded-lg border border-border bg-muted/50 p-0.5",children:m}),e[6]=a,e[7]=m,e[8]=i,e[9]=c):c=e[9];let d;return e[10]!==r||e[11]!==c?(d=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r,c]}),e[10]=r,e[11]=c,e[12]=d):d=e[12],d}function Jo(t){return s.jsxs(mi,{value:t.value,className:"h-6 gap-1.5 rounded-md border border-transparent px-2 text-xs font-medium text-muted-foreground hover:bg-transparent data-[state=on]:border-border data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm",children:[t.icon,t.label]},t.value)}function bs({onNavigate:t}={}){const{data:e}=se.useSession(),n=e?.user?.id,{org:i}=X(),o=Bt({connectionId:Ut,orgId:i.id,orgSlug:i.slug}),l=Ne(i.id).id,r=Wt(),{threads:a,hasMore:m,isFetchingMore:c,fetchNextPage:d}=nt(),u=a.filter(T=>!T.hidden),{hide:x,setScope:f}=Jt(),h=ie(),{setTaskId:g,createNewTask:p}=it(),b=qe({strict:!1}),j=ke({strict:!1}),v=b.taskId??null,y=j.virtualmcpid??a.find(T=>T.id===v)?.virtual_mcp_id??null,S=()=>{t?.()},C=[...u].sort((T,V)=>(V.updated_at??"").localeCompare(T.updated_at??"")),[_,N]=M.useState("all"),[w,I]=M.useState("flat"),[A,k]=we("sidebar-threads-scope-all",!1),[$,O]=M.useState(!1),[E,U]=M.useState(!1),R={type:_,member:"mine",currentUserId:n??null},F={};A||(F.created_by="me"),f(F);const D=T=>n?T.filter(V=>V.created_by===n):[],L=T=>_==="automation"?T.filter(V=>!!V.trigger_id):_==="manual"?T.filter(V=>!V.trigger_id):T,H=D(C),G=L(H),W=L(C),Q=A?W:G,K=T=>{if(n&&T.created_by&&T.created_by!==n)return;const V=T.id===v;if(x(T.id),Ln(T.id),!V)return;const oe=Qo(Q,T.id,n);S(),oe?g(oe.id,oe.virtual_mcp_id):h({to:"/$org",params:{org:i.slug}})},Pe=T=>{S(),g(T.id,T.virtual_mcp_id)},vs=async T=>{try{const V=await o.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:T,limit:1,offset:0}});return((V.structuredContent??V).items?.length??0)===0}catch{return!1}},lt=async()=>{const T=y??l;q("sidebar_new_thread_clicked",{virtual_mcp_id:T});const V=H.find(oe=>oe.virtual_mcp_id===T&&oe.title==="New chat");if(V&&await vs(V.id)){S(),g(V.id,T);return}S(),p(T)},{state:ys,isMobile:rt,toggleSidebar:Ss}=re();if(ys==="collapsed"&&!rt){const T=Ne(i.id),V=new Map((r??[]).map(J=>[J.id,J])),oe=J=>(J?V.get(J):void 0)??(J===l?T:void 0);return s.jsxs("div",{className:"flex flex-col min-h-0 flex-1 -mt-1 w-[calc(var(--sidebar-width-icon)-1rem)]",children:[s.jsx("div",{className:"flex h-12 shrink-0 items-center justify-center",children:s.jsx(us,{orgParam:i.slug,side:"right",align:"start",trigger:s.jsx(Y,{tooltip:i.name,children:s.jsx(Te,{org:i,size:"sm"})})})}),s.jsxs(te,{className:"mt-2 min-h-0 gap-1.5 overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[s.jsx(B,{children:s.jsx(Y,{"aria-label":"Toggle sidebar",tooltip:"Toggle sidebar",onClick:Ss,children:s.jsx(Ht,{size:16})})}),s.jsx(B,{children:s.jsx(Y,{"aria-label":"New chat",tooltip:"New chat",onClick:()=>{lt()},children:s.jsx(mt,{size:16})})}),Q.map(J=>{const ct=oe(J.virtual_mcp_id);return s.jsx(B,{children:s.jsx(Y,{"aria-label":J.title||"New chat",tooltip:J.title||"New chat",isActive:J.id===v,onClick:()=>Pe(J),children:s.jsx(me,{icon:ct?.icon??null,name:ct?.title??"Agent",size:"xs"})})},J.id)})]})]})}const ye=w!=="flat"||_!=="all"||A===!0,_s=s.jsxs(Ae,{children:[s.jsxs(de,{children:[s.jsx(ae,{asChild:!0,children:s.jsx(xe,{asChild:!0,children:s.jsxs(ue,{"aria-label":"Filter chats",active:ye,className:"md:size-[34px] rounded-lg",children:[s.jsx(di,{size:16}),ye&&s.jsx("span",{className:"absolute right-1 top-1 size-1.5 rounded-full bg-primary ring-2 ring-sidebar"})]})})}),s.jsx(ce,{side:"bottom",children:"Filter chats"})]}),s.jsxs(Ie,{align:"start",className:"w-64 flex flex-col gap-3 p-3",children:[s.jsx(Le,{label:"View",value:w,onChange:T=>{q("tasks_panel_group_by_changed",{to_value:T}),I(T)},options:[{value:"flat",label:"List",icon:s.jsx(xn,{size:13})},{value:"status",label:"Status",icon:s.jsx(hn,{size:13})}]}),s.jsx(Le,{label:"Type",value:_,onChange:T=>{q("tasks_panel_filter_changed",{to_value:T}),N(T)},options:[{value:"all",label:"All"},{value:"manual",label:"Chats"},{value:"automation",label:"Auto"}]}),s.jsx(Le,{label:"Scope",value:A?"team":"mine",onChange:T=>k(T==="team"),options:[{value:"mine",label:"Mine"},{value:"team",label:"Team"}]})]})]}),at=T=>s.jsx(Gt,{delayDuration:300,children:s.jsxs("div",{className:P("shrink-0 flex items-center justify-between",T?"h-10":"h-10 md:h-[34px] mb-2"),children:[s.jsxs("div",{className:"flex items-center gap-0.5",children:[!T&&s.jsx(os,{className:"md:size-[34px] rounded-lg"}),_s]}),s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx($t,{label:"Search chats",onClick:()=>{q("tasks_panel_search_opened"),U(!0),O(!0)},children:s.jsx(fn,{size:16})}),s.jsx($t,{label:"New chat",onClick:()=>{lt()},children:s.jsx(mt,{size:16})})]})]})});return rt?s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[at(!0),s.jsx(_t,{wrapperClassName:"flex-1 min-h-0",className:"flex flex-col gap-0.5 overflow-y-auto overscroll-contain px-1 h-full",children:s.jsx(zt,{threads:Q,groupBy:w,activeTaskId:v,onSelectTask:Pe,onArchiveTask:K,filters:R,hasMore:m,isFetchingMore:c,onLoadMore:()=>{d()},filtersActive:ye})}),E&&s.jsx(Nt,{open:$,onOpenChange:O})]}):s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[at(!1),s.jsx("div",{className:"flex-1 min-h-0 flex flex-col gap-0.5 -mr-2 pr-2",children:s.jsx(_t,{wrapperClassName:"flex-1 min-h-0",className:"flex flex-col gap-0.5 overflow-y-auto overscroll-contain h-full",children:s.jsx(zt,{threads:Q,groupBy:w,activeTaskId:v,onSelectTask:Pe,onArchiveTask:K,filters:R,hasMore:m,isFetchingMore:c,onLoadMore:()=>{d()},filtersActive:ye})})}),E&&s.jsx(Nt,{open:$,onOpenChange:O})]})}const Zo=5,el=[{nameWidth:"w-24",taskRows:2},{nameWidth:"w-28",taskRows:0},{nameWidth:"w-20",taskRows:1},{nameWidth:"w-32",taskRows:0},{nameWidth:"w-24",taskRows:0}];function js(){const t=z.c(3),{state:e}=re();if(e==="collapsed"){let o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"flex flex-col gap-1.5",children:Array.from({length:Zo}).map(nl)}),t[0]=o):o=t[0],o}let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"shrink-0 px-1 h-10 md:h-7 mb-2 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ne,{className:"size-6 rounded-md"}),s.jsx(ne,{className:"size-6 rounded-md"}),s.jsx(ne,{className:"size-6 rounded-md"})]}),s.jsx(ne,{className:"h-6 w-20 rounded-md"})]}),t[1]=n):n=t[1];let i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n,s.jsx("div",{className:"flex flex-col gap-0.5",children:el.map(tl)})]}),t[2]=i):i=t[2],i}function tl(t,e){return s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[s.jsx(ne,{className:"size-5 rounded-full shrink-0"}),s.jsx(ne,{className:P("h-3",t.nameWidth,"rounded-sm")})]}),t.taskRows>0&&s.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:Array.from({length:t.taskRows}).map(sl)})]},e)}function sl(t,e){return s.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5",children:s.jsx(ne,{className:"h-3 flex-1 rounded-sm"})},e)}function nl(t,e){return s.jsx(ne,{className:"size-10 rounded-lg mx-auto"},e)}function il(){const t=z.c(2);if($e()){let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(We,{showName:!0}),t[0]=i):i=t[0],i}let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs(s.Fragment,{children:[s.jsx(We,{}),s.jsx(Oe,{})]}),t[1]=n):n=t[1],n}function ol(){const t=z.c(5),e=ls();let n,i;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Ao,{}),i=s.jsx(il,{}),t[0]=n,t[1]=i):(n=t[0],i=t[1]);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(Ve,{children:s.jsx(M.Suspense,{fallback:s.jsx(js,{}),children:s.jsx(bs,{})})}),t[2]=o):o=t[2];let l;return t[3]!==e?(l=s.jsx(Zt,{children:s.jsx(cs,{sections:e,footer:n,header:i,additionalContent:o})}),t[3]=e,t[4]=l):l=t[4],l}function ll(t){const e=z.c(8),{onClose:n}=t,i=ls();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(zo,{}),e[0]=o):o=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(js,{}),e[1]=l):l=e[1];let r;e[2]!==n?(r=s.jsx(Ve,{children:s.jsx(M.Suspense,{fallback:l,children:s.jsx(bs,{onNavigate:n})})}),e[2]=n,e[3]=r):r=e[3];let a;return e[4]!==n||e[5]!==i||e[6]!==r?(a=s.jsx(Zt,{children:s.jsx(ao,{sections:i,onClose:n,footer:o,additionalContent:r})}),e[4]=n,e[5]=i,e[6]=r,e[7]=a):a=e[7],a}const rl="sidebar.open";function al(){const t=z.c(1),{state:e}=re(),n=$e();if(e!=="collapsed"||n)return null;let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Oe,{}),t[0]=i):i=t[0],i}function cl(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Bs,{}),t[0]=e):e=t[0],e}function Oa(){const t=z.c(43),e=Qe(),n=$e();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},t[0]=i):i=t[0];const{connect:o,siteUrl:l}=ke(i),r=o==="1",[a,m]=we(rl,!1),{width:c,wrapperRef:d,onStartResize:u,resetWidth:x}=Oi(),f=!e;let h,g;t[1]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsxs(Z.LeftColumn,{children:[s.jsx(al,{}),s.jsx(Z.TogglesSlot,{})]}),g=s.jsx(Z.CenterSlot,{}),t[1]=h,t[2]=g):(h=t[1],g=t[2]);let p;t[3]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsxs(Z.Header,{children:[h,g,s.jsxs(Z.RightColumn,{children:[s.jsx("div",{className:"min-w-0 flex-1 overflow-x-auto [scrollbar-width:none] flex justify-end items-center gap-0.5",children:s.jsx(Z.TabsSlot,{})}),s.jsx(Z.RightSlot,{})]})]}),t[3]=p):p=t[3];const b=p;let j;t[4]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(os,{}),t[4]=j):j=t[4];let v;t[5]!==n?(v=!n&&s.jsx("div",{className:"flex min-w-0 flex-1 items-center",children:s.jsx(Oe,{})}),t[5]=n,t[6]=v):v=t[6];let y,S,C,_,N;t[7]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(je,{}),C=s.jsx(Z.TogglesSlot,{}),_=s.jsx(Z.TabsSlot,{className:"shrink-0"}),N=s.jsx(Z.CenterSlot,{}),y=s.jsx(Z.RightSlot,{}),t[7]=y,t[8]=S,t[9]=C,t[10]=_,t[11]=N):(y=t[7],S=t[8],C=t[9],_=t[10],N=t[11]);let w;t[12]!==v?(w=s.jsx(Z.Header,{className:"grid-cols-1 px-1",children:s.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1",children:[j,v,S,C,_,N,y]})}),t[12]=v,t[13]=w):w=t[13];const I=w;let A;t[14]===Symbol.for("react.memo_cache_sentinel")?(A={background:"transparent",containerType:"inline-size"},t[14]=A):A=t[14];let k;t[15]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Gs,{className:"flex flex-col min-h-0",style:A,children:s.jsx("div",{className:"flex flex-col h-full min-h-0",children:s.jsx("div",{className:"relative flex-1 min-h-0 flex flex-row",children:s.jsx(M.Suspense,{fallback:s.jsx(cl,{}),children:s.jsx(Ls,{})})})})}),t[15]=k):k=t[15];const $=k,O=!f&&(e?I:b),E=`${c}px`;let U;t[16]!==E?(U={"--sidebar-width":E,"--sidebar-width-icon":"3.125rem"},t[16]=E,t[17]=U):U=t[17];const R=U;let F;t[18]!==e||t[19]!==u||t[20]!==x?(F=!e&&s.jsxs(s.Fragment,{children:[s.jsx(ol,{}),s.jsx(zi,{onPointerDown:u,onDoubleClick:x})]}),t[18]=e,t[19]=u,t[20]=x,t[21]=F):F=t[21];let D;t[22]!==f?(D=f?s.jsxs("div",{className:"flex flex-col flex-1 min-w-0 min-h-0 h-full",children:[b,$]}):$,t[22]=f,t[23]=D):D=t[23];let L;t[24]!==R||t[25]!==F||t[26]!==D||t[27]!==d?(L=s.jsxs(Ws,{ref:d,className:"flex-1 bg-sidebar relative min-h-0",style:R,children:[F,D]}),t[24]=R,t[25]=F,t[26]=D,t[27]=d,t[28]=L):L=t[28];let H;t[29]!==e?(H=e&&s.jsx(bi,{renderSidebar:dl}),t[29]=e,t[30]=H):H=t[30];let G;t[31]!==l||t[32]!==r?(G=r&&s.jsx(Ci,{siteUrl:l}),t[31]=l,t[32]=r,t[33]=G):G=t[33];let W;t[34]!==O||t[35]!==L||t[36]!==H||t[37]!==G?(W=s.jsx(Mn,{children:s.jsxs("div",{className:"app-shell-root flex flex-col h-dvh overflow-hidden",children:[O,L,H,G]})}),t[34]=O,t[35]=L,t[36]=H,t[37]=G,t[38]=W):W=t[38];let Q;return t[39]!==m||t[40]!==a||t[41]!==W?(Q=s.jsx(Fn,{children:s.jsx(Z.Provider,{children:s.jsx(Ks,{open:a,onOpenChange:m,children:W})})}),t[39]=m,t[40]=a,t[41]=W,t[42]=Q):Q=t[42],Q}function dl(t){const{onClose:e}=t;return s.jsx("div",{className:"flex h-full",children:s.jsx("div",{className:"w-full bg-sidebar flex flex-col overflow-y-auto group/sidebar","data-state":"expanded",children:s.jsx(ll,{onClose:e})})})}export{Oa as default};
1
+ import{c as z,b as ie,C as X,D as Ns,j as s,B as le,r as M,F as Cs,E as Ve,a as se,v as ws,K as Tt,d as Be,p as q,G as we,l as P,H as ks,I as Is,J as As,M as zs,P as $s,q as Ts,t as ee,s as Os,i as Ot,e as qe,u as ke,L as Mt,R as Ms,U as Ps,V as Es,W as Ds,m as Fs,X as Rs,O as Ls,Y as Bs}from"./index-CfAl6qA3.js";import{u as re,S as Ye,a as Xe,b as te,c as Y,d as B,e as Pt,f as Us,g as Et,h as Hs,i as he,j as Gs,k as Ws,l as Ks}from"./sidebar-Bmfjcji7.js";import{u as Qe}from"./use-mobile-D0KrjV8M.js";import{C as Vs,p as Ee,s as qs,b as Ys,S as Xs,d as Qs,e as Js,c as Zs,n as en}from"./self-tool-result-BYn91ML_.js";import{f as tn,a as Je,e as Ze,g as sn,d as Dt,h as Ft,D as Rt}from"./dialog-B8iPXZfB.js";import{f as nn}from"./tab-id-BijBBRwE.js";import{C as on,W as Lt,g as ln,u as Bt,S as Ut,a as Ne,i as rn,b as an}from"./use-mcp-client-CAtCw6yl.js";import{i as et}from"./ArrowRight-BmTkQdSS.js";import{S as ne}from"./skeleton-DYsdfnWI.js";import{i as Ht}from"./LayoutLeft-BXx4559W.js";import{t as tt}from"./ChevronDown-z_OgoJuG.js";import{T as ae,a as ce,b as de,c as Gt}from"./tooltip-lvzwcxmr.js";import{u as Wt,a as st}from"./use-virtual-mcp--wK0dI9I.js";import{A as me,t as Kt,a as cn,i as dn,b as dt,c as mn,d as un,e as Vt,f as mt,g as fn,s as xn,h as hn}from"./agent-icon-kMrNxjYJ.js";import{P as xe,a as Ie,b as Ae}from"./popover-CNhMnjco.js";import{i as ve}from"./Check-xlx8bieA.js";import{s as pe}from"./Plus-CpvaryXc.js";import{i as qt}from"./SearchMd-BbTMkDIb.js";import{s as pn}from"./XClose-Bvx5TP10.js";import{A as gn,a as bn,b as jn,c as vn,d as yn,e as Sn,f as _n}from"./alert-dialog-lT11Jsbj.js";import{F as Nn,a as Cn,b as wn,c as kn,d as In,e as An,f as zn}from"./form-BbtpCekf.js";import{I as $n}from"./input-C96iFBVQ.js";import{S as Tn,u as On,C as Mn}from"./chat-context-BKkLQtRB.js";import{T as ue}from"./toolbar-icon-button-CqHN6MBe.js";import{D as Yt,a as Xt,b as Qt}from"./drawer-D5z1QpZ1.js";import{G as Pn}from"./use-registry-app-DGmz0d5i.js";import{G as En}from"./github-repo-picker-qhKlxIkP.js";import{u as Jt,a as nt,b as Dn,T as Fn}from"./hooks-QkqjVdn8.js";import{r as Rn,u as it,f as Ln}from"./shell-layout-B3ubQVJp.js";import{u as Bn,g as Un,a as Hn,b as Gn,S as Zt}from"./use-navigate-to-agent-CYMIGICl.js";import{g as Wn,a as es,u as Kn,A as Vn,b as qn}from"./use-deco-credits-tLUAgc-O.js";import{f as Yn}from"./reusable-new-chat-CouMjkYR.js";import{A as Ue}from"./avatar-BHNRf2BK.js";import{a as He}from"./Copy01-BhLnIcPa.js";import{n as Xn,i as Qn}from"./Globe01-C1OI0rNn.js";import{i as Jn}from"./ZoomOut-Bjuv5wtp.js";import{n as Zn}from"./LinkExternal01-RdFrwyl0.js";import{i as ut,a as ei}from"./ZapSquare-NmRRaYpN.js";import{i as Ge}from"./Monitor01-ByOW8gCA.js";import{n as ti,a as si}from"./Sun-DcglW2RF.js";import{a as ze}from"./Settings02-CoD4T3JT.js";import{i as ni}from"./Shield01-BSQ914Nd.js";import{a as ii}from"./Users03-Bg-uyP8J.js";import{u as oi}from"./use-deployment-admin-C0wf5iR9.js";import"./index-Bz75jbQc.js";import{a as ts}from"./XCircle-z2zpbAQl.js";import{I as ss}from"./invite-member-dialog-xjgZGOB2.js";import{u as ft}from"./use-copy-aPelM9gN.js";import{m as li,u as ri,c as ai}from"./use-api-keys-ZZNQlaQa.js";import{v as ci,C as xt}from"./connect-desktop-dialog-CcP2o0mO.js";import{u as $e}from"./use-organization-settings-Btln8Py9.js";import{i as di}from"./FilterLines-LxfJFt1s.js";import{T as mi,a as ui}from"./toggle-group-B8ZzagA8.js";import{C as fi,a as xi,b as hi,c as pi,d as gi}from"./command-Dv4-KFR5.js";import{u as ns}from"./studio-tools-CZ0lHHg8.js";import{i as is}from"./Zap-CaoQpAZT.js";import{S as os,M as bi}from"./shell-controls-CWv-6pxT.js";import{n as ji}from"./Stars02-wl-TgjVw.js";import{g as vi,u as yi,S as Si}from"./use-clock-tick-Cdnpjga1.js";import{a as _i}from"./format-time-BnbuEtat.js";import{i as Ni}from"./ChevronRight-HByc-_dD.js";import{T as Z}from"./toolbar-1oJVDPdM.js";import"./X-B9OMbRgI.js";import"./integration-icon-B1RhpoYr.js";import"./Tool02-CYQFsqUw.js";import"./CheckCircle-BhHr7P8S.js";import"./companions-core-AOH9czLM.js";import"./extract-connection-data-ChcGsUj8.js";import"./github-repo-scope-DjMZbiKa.js";import"./Eye-Dmrq3Yx3.js";import"./use-debounced-value-U6TK_cAJ.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./authenticate-and-persist-oauth-jkSUOcu8.js";import"./mcp-oauth-C3_4QnQD.js";import"./auth-CaW_gj1t.js";import"./ArrowUpRight-DgWDf4bB.js";import"./use-collections-DJ2e88Xq.js";import"./AlertCircle-8aL2p4Jm.js";import"./Tool01-F8NWFSUY.js";import"./ArrowUp-BRv6jMcd.js";import"./TrendUp01-B11vKIzx.js";import"./ChevronUp-C0dubflE.js";import"./DotsVertical-9e8whEmO.js";import"./Star01-B_ldc-QG.js";import"./Globe04-D37KO3Rl.js";import"./SwitchHorizontal01-BjhVVVE7.js";import"./HardDrive-xaUFGQWK.js";import"./Image01-D2MElAgS.js";import"./Key01-CJ4v8ToT.js";import"./Package-BApyVZZF.js";import"./Palette-gwCbQEVd.js";import"./Play-CRcD5urt.js";import"./SearchLg-BLbYMh4R.js";import"./Stars01-BEQN6TZj.js";import"./Trash01-CFIi5PAY.js";import"./Upload01-CYv9Q0Sh.js";import"./User01-BHW_CvWq.js";import"./Users01-CVvGtppm.js";import"./label-Dyml5mFF.js";import"./autosend-CSO0mWVp.js";import"./use-ai-providers-DLA17X4H.js";import"./location-BpLtHjTZ.js";import"./use-decopilot-events-zHZ5c1US.js";import"./decopilot-sse-pool-DWXTDK7c.js";import"./backoff-CrEUbyZT.js";import"./use-mcp-tools-BkyW84hu.js";import"./collection-search-DZDCl18y.js";import"./use-connection-CawdsRuN.js";import"./delay-CnY5UFtP.js";import"./use-t-Ca0ZB4W6.js";import"./required-auth-layout-C-fhbIaJ.js";import"./use-org-sso-BNL5m012.js";import"./connection-card-DSeJr6d2.js";import"./use-registry-connections-BNAx72pz.js";import"./useInfiniteQuery-BT7hVNXg.js";import"./use-infinite-scroll-DgeL9DrI.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./card-CxpjTUKu.js";import"./select-DfWJsEeW.js";import"./textarea-Q9mIBUV-.js";import"./connection-form-helpers-Ce26XCbs.js";import"./collection-tabs-C2iwwrh8.js";import"./badge-0FaSmMEN.js";import"./useSuspenseInfiniteQuery-CIkQZwY0.js";import"./use-org-auth-client-BY7CXLsN.js";import"./use-organization-roles-DP7VZAnw.js";import"./index-DCLh1sVt.js";import"./differenceInSeconds-NQ4PDo0z.js";function Ci(t){const e=z.c(15),{siteUrl:n}=t,i=ie(),{org:o}=X();let l;e[0]!==i||e[1]!==o.id||e[2]!==o.slug?(l=()=>{localStorage.setItem(Ns.sidebarOpen(),JSON.stringify(!1)),i({to:"/$org/$taskId",params:{org:o.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:ln(o.id),main:nn(Lt.COMMERCE_DISCOVERY(o.id),on),sidepanel:0}})},e[0]=i,e[1]=o.id,e[2]=o.slug,e[3]=l):l=e[3];const r=l;let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(tn,{className:"bg-black/15 backdrop-blur-sm"}),e[4]=a):a=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(Je,{className:"sr-only",children:"Conecte suas ferramentas para ver o diagnóstico completo"}),e[5]=m):m=e[5];let c;e[6]!==r?(c=()=>s.jsxs("div",{className:"grid gap-4 p-6",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Não foi possível carregar as integrações. Você pode continuar e abrir o relatório mesmo assim."}),s.jsxs(le,{type:"button",size:"xl",className:"w-full",onClick:r,children:["Continuar",s.jsx(et,{size:18})]})]}),e[6]=r,e[7]=c):c=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Vs,{}),e[8]=d):d=e[8];let u;e[9]!==r||e[10]!==n?(u=s.jsx(M.Suspense,{fallback:d,children:s.jsx(Ai,{siteUrlFromUrl:n,onComplete:r})}),e[9]=r,e[10]=n,e[11]=u):u=e[11];let x;return e[12]!==c||e[13]!==u?(x=s.jsx(Ze,{open:!0,children:s.jsxs(sn,{children:[a,s.jsxs(Cs,{"data-slot":"commerce-connect-modal",onEscapeKeyDown:Ii,onPointerDownOutside:ki,onInteractOutside:wi,className:"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 flex h-[calc(100dvh-1rem)] w-full max-w-[calc(100%-1rem)] translate-x-[-50%] translate-y-[-50%] flex-col overflow-hidden rounded-2xl border p-0 shadow-md duration-200 sm:max-w-lg md:h-auto md:max-h-[calc(100dvh-2rem)] lg:max-h-[calc(100dvh-4rem)] lg:max-w-5xl",children:[m,s.jsx(Ve,{fallback:c,children:u})]})]})}),e[12]=c,e[13]=u,e[14]=x):x=e[14],x}function wi(t){return t.preventDefault()}function ki(t){return t.preventDefault()}function Ii(t){return t.preventDefault()}function Ai({siteUrlFromUrl:t,onComplete:e}){const{org:n}=X(),{data:i}=se.useSession(),o=Lt.COMMERCE_DISCOVERY(n.id),l=Bt({connectionId:Ut,orgId:n.id,orgSlug:n.slug}),a=ws({queryKey:Tt.commerceDiscoveryConnection(n.id,o),queryFn:async()=>{const v=await l.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}});return Ee(v)},retry:!1}).data.item,m=typeof a?.metadata?.siteUrl=="string"?a.metadata.siteUrl:void 0,c=t||m,d=qs(c),[u,x]=M.useState(!0),[f,h]=M.useState(null),g=Be({mutationFn:async v=>Ee(await l.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:v}})),retry:!1}),p=Be({mutationFn:async v=>Ee(await l.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:v}})),retry:!1}),b=Ys({siteUrl:c,email:i?.user?.email}),j=async()=>{h(null),q("commerce_onboarding_open_report_clicked",{domain:d??void 0,organization_id:n.id});const v=c?en(c):null;if(v?.ok)try{let y=await p.mutateAsync(v.value);if(y.triggered||(q("commerce_onboarding_run_reclaim",{domain:d??void 0,organization_id:n.id,reason:y.reason??"not_upgraded"}),await g.mutateAsync(v.value),y=await p.mutateAsync(v.value)),!y.triggered){q("commerce_onboarding_run_failed",{domain:d??void 0,organization_id:n.id,error:y.reason??"not_triggered"}),h("Não foi possível gerar o relatório para este site. Recarregue a página e tente novamente.");return}}catch(y){q("commerce_onboarding_run_failed",{domain:d??void 0,organization_id:n.id,error:y instanceof Error?y.message:String(y)}),h("Algo deu errado ao gerar seu relatório. Tente novamente em instantes.");return}e()};return s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4 p-4 lg:gap-6 lg:bg-sidebar lg:p-10",children:[d?s.jsx(Xs,{host:d}):null,s.jsx(Qs,{org:n,cdConnectionId:o,siteUrl:c,onReadinessChange:x}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-3",children:[s.jsx(Js,{href:b,orgId:n.id,className:"lg:hidden"}),f?s.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:f}):null,s.jsxs(le,{type:"button",size:"xl",className:"w-full rounded-2xl text-base font-medium whitespace-normal h-auto py-3",onClick:()=>{j()},disabled:p.isPending||!u,children:[p.isPending?"Abrindo relatório...":u?"Ver relatório completo":"Conecte uma ferramenta para continuar",!p.isPending&&u?s.jsx(et,{size:18}):null]})]})]}),s.jsx("aside",{className:"hidden lg:flex lg:w-[380px] lg:shrink-0 lg:items-center lg:justify-center lg:overflow-y-auto lg:border-l lg:border-border lg:bg-muted",children:s.jsx(Zs,{href:b,orgId:n.id})})]})}function zi(t){const e=z.c(5),{onPointerDown:n,onDoubleClick:i}=t,{state:o,isMobile:l}=re();if(l||o==="collapsed")return null;let r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={left:"var(--sidebar-width)"},a=s.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors duration-150 group-hover/resize:bg-border group-active/resize:bg-border"}),e[0]=r,e[1]=a):(r=e[0],a=e[1]);let m;return e[2]!==i||e[3]!==n?(m=s.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar",title:"Drag to resize, double-click to reset",onPointerDown:n,onDoubleClick:i,className:"group/resize absolute top-0 z-20 h-full w-2 -translate-x-1/2 cursor-col-resize",style:r,children:a}),e[2]=i,e[3]=n,e[4]=m):m=e[4],m}const ot=240,$i=400,Ti="sidebar.width";function ge(t){return Math.max(ot,Math.min($i,t))}function Oi(){const t=z.c(11),[e,n]=we(Ti,Mi),i=M.useRef(null);let o;t[0]!==n||t[1]!==e?(o=d=>{d.preventDefault();const u=d.clientX,x=ge(e),f=i.current??(typeof document<"u"?document.querySelector('[data-slot="sidebar-wrapper"]'):null),h=f?Array.from(f.querySelectorAll('[data-slot="sidebar"], [data-slot="sidebar-container"]')):[];for(const b of h)b.style.transition="none";const g=b=>{const j=ge(x+(b.clientX-u));f?.style.setProperty("--sidebar-width",`${j}px`)},p=b=>{const j=ge(x+(b.clientX-u));n(j);for(const v of h)v.style.transition="";window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",p),document.body.style.userSelect="",document.body.style.cursor=""};document.body.style.userSelect="none",document.body.style.cursor="col-resize",window.addEventListener("pointermove",g),window.addEventListener("pointerup",p)},t[0]=n,t[1]=e,t[2]=o):o=t[2];const l=o;let r;t[3]!==n?(r=()=>{n(ot)},t[3]=n,t[4]=r):r=t[4];const a=r;let m;t[5]!==e?(m=ge(e),t[5]=e,t[6]=m):m=t[6];let c;return t[7]!==l||t[8]!==a||t[9]!==m?(c={width:m,wrapperRef:i,onStartResize:l,resetWidth:a},t[7]=l,t[8]=a,t[9]=m,t[10]=c):c=t[10],c}function Mi(t){return typeof t=="number"?ge(t):ot}function ls(){return[]}function rs(t){const e=z.c(3),{children:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"flex h-6 items-center",children:s.jsx("div",{className:"h-0.5 w-16 rounded-full bg-sidebar-foreground/15"})}),e[0]=i):i=e[0];let o;return e[1]!==n?(o=s.jsxs(Ye,{className:"pt-0 pr-0 pb-2 pl-0 mt-2",children:[i,s.jsx(Xe,{children:s.jsx(te,{className:"gap-0.5",children:n})})]}),e[1]=n,e[2]=o):o=e[2],o}function as(t){const e=z.c(18),{item:n}=t,{isMobile:i,setOpenMobile:o}=re();let l;e[0]!==i||e[1]!==n||e[2]!==o?(l=()=>{q("nav_item_clicked",{nav_key:n.key,nav_label:n.label,is_active:!!n.isActive,is_mobile:i}),n.onClick?.(),i&&o(!1)},e[0]=i,e[1]=n,e[2]=o,e[3]=l):l=e[3];const r=l,a=n.key,m=n.isActive&&"z-10";let c;e[4]!==m?(c=P(m),e[4]=m,e[5]=c):c=e[5];let d;e[6]!==n.label?(d=s.jsx("span",{children:n.label}),e[6]=n.label,e[7]=d):d=e[7];let u;e[8]!==r||e[9]!==n.icon||e[10]!==n.isActive||e[11]!==n.label||e[12]!==d?(u=s.jsxs(Y,{onClick:r,isActive:n.isActive,tooltip:n.label,children:[n.icon,d]}),e[8]=r,e[9]=n.icon,e[10]=n.isActive,e[11]=n.label,e[12]=d,e[13]=u):u=e[13];let x;return e[14]!==n.key||e[15]!==c||e[16]!==u?(x=s.jsx(B,{className:c,children:u},a),e[14]=n.key,e[15]=c,e[16]=u,e[17]=x):x=e[17],x}function Pi(t){const e=z.c(12),{section:n}=t;switch(n.type){case"divider":{let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Pt,{className:"my-2"}),e[0]=i):i=e[0],i}case"spacer":{let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"flex-1"}),e[1]=i):i=e[1],i}case"group":{const i=n.group.label,o=n.group.defaultExpanded;let l;e[2]!==n.group.items?(l=n.group.items.map(Di),e[2]=n.group.items,e[3]=l):l=e[3];let r;return e[4]!==n.group.defaultExpanded||e[5]!==n.group.label||e[6]!==l?(r=s.jsx(rs,{label:i,defaultExpanded:o,children:l}),e[4]=n.group.defaultExpanded,e[5]=n.group.label,e[6]=l,e[7]=r):r=e[7],r}case"items":{let i;e[8]!==n.items?(i=n.items.map(Ei),e[8]=n.items,e[9]=i):i=e[9];let o;return e[10]!==i?(o=s.jsx(Ye,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(Xe,{children:s.jsx(te,{className:"gap-1.5",children:i})})}),e[10]=i,e[11]=o):o=e[11],o}case"custom":return n.content}}function Ei(t){return s.jsx(as,{item:t},t.key)}function Di(t){return s.jsx(as,{item:t},t.key)}function Fi(t){const e=z.c(17),{sections:n,footer:i,additionalContent:o,header:l,variant:r,contentClassName:a}=t,m=r===void 0?"sidebar":r;let c;e[0]!==l?(c=l&&s.jsx(Us,{className:"sidebar-titlebar wco-drag shrink-0 h-12 flex flex-row items-center px-2 py-0 group-data-[collapsible=icon]/sidebar:hidden",children:l}),e[0]=l,e[1]=c):c=e[1];let d;e[2]!==a?(d=P("flex flex-col flex-1 px-2 pb-2 gap-0.5",a),e[2]=a,e[3]=d):d=e[3];let u;e[4]!==n?(u=n.map(Ri),e[4]=n,e[5]=u):u=e[5];let x;e[6]!==o?(x=o&&s.jsx("div",{className:"flex flex-col flex-1 min-h-0 group-data-[state=collapsed]/sidebar:mt-1 group-data-[state=expanded]/sidebar:mt-2",children:o}),e[6]=o,e[7]=x):x=e[7];let f;e[8]!==d||e[9]!==u||e[10]!==x?(f=s.jsxs(Et,{className:d,children:[u,x]}),e[8]=d,e[9]=u,e[10]=x,e[11]=f):f=e[11];let h;return e[12]!==i||e[13]!==c||e[14]!==f||e[15]!==m?(h=s.jsxs(Hs,{variant:m,children:[c,f,i]}),e[12]=i,e[13]=c,e[14]=f,e[15]=m,e[16]=h):h=e[16],h}function Ri(t,e){return s.jsx(Pi,{section:t},e)}function cs(t){const e=z.c(2);let n;return e[0]!==t?(n=s.jsx(Fi,{...t}),e[0]=t,e[1]=n):n=e[1],n}cs.Skeleton=function(){return s.jsx("div",{className:"flex flex-col gap-0.5",children:Array.from({length:8}).map((e,n)=>s.jsx("div",{className:"w-full h-8",children:s.jsx(ne,{className:"h-full bg-sidebar-accent rounded-md"})},n))})};function ds(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Li=ks({name:Is().min(2,"Organization name is required")});function Bi(t){const e=z.c(41),{open:n,onOpenChange:i}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={resolver:As(Li),defaultValues:{name:""}},e[0]=o):o=e[0];const l=zs(o);let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r={mutationFn:Hi,onSuccess:Ui},e[1]=r):r=e[1];const a=Be(r),m=a.error instanceof Error?a.error.message:a.error?"Failed to create organization.":null;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs(jn,{children:[s.jsx(vn,{children:"Create a new organization"}),s.jsx(yn,{children:"Set up a new organization to collaborate with others."})]}),e[2]=c):c=e[2];let d;if(e[3]!==a||e[4]!==l){let _;e[6]!==a?(_=N=>a.mutateAsync(N),e[6]=a,e[7]=_):_=e[7],d=l.handleSubmit(_),e[3]=a,e[4]=l,e[5]=d}else d=e[5];let u;e[8]!==l.formState.isSubmitting?(u=_=>{const{field:N}=_;return s.jsxs(wn,{children:[s.jsx(kn,{children:"Organization Name"}),s.jsx(In,{children:s.jsx($n,{...N,placeholder:"Acme Inc.",disabled:l.formState.isSubmitting})}),s.jsx(An,{children:"The name of your company or organization"}),N.value&&s.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Organization URL:"," ",s.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",ds(N.value)]})]}),s.jsx(zn,{})]})},e[8]=l.formState.isSubmitting,e[9]=u):u=e[9];let x;e[10]!==l.control||e[11]!==u?(x=s.jsx(Nn,{control:l.control,name:"name",render:u}),e[10]=l.control,e[11]=u,e[12]=x):x=e[12];let f;e[13]!==m?(f=m&&s.jsx("div",{className:"text-destructive text-sm mt-2",children:m}),e[13]=m,e[14]=f):f=e[14];let h;e[15]!==a||e[16]!==l?(h=()=>{a.reset(),l.reset()},e[15]=a,e[16]=l,e[17]=h):h=e[17];let g;e[18]!==l.formState.isSubmitting||e[19]!==h?(g=s.jsx(gn,{disabled:l.formState.isSubmitting,onClick:h,children:"Cancel"}),e[18]=l.formState.isSubmitting,e[19]=h,e[20]=g):g=e[20];const p=!l.formState.isValid||l.formState.isSubmitting;let b;e[21]!==l.formState.isSubmitting?(b=l.formState.isSubmitting?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(Tn,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=l.formState.isSubmitting,e[22]=b):b=e[22];let j;e[23]!==p||e[24]!==b?(j=s.jsx(le,{type:"submit",variant:"default",disabled:p,children:b}),e[23]=p,e[24]=b,e[25]=j):j=e[25];let v;e[26]!==j||e[27]!==g?(v=s.jsxs(Sn,{children:[g,j]}),e[26]=j,e[27]=g,e[28]=v):v=e[28];let y;e[29]!==v||e[30]!==d||e[31]!==x||e[32]!==f?(y=s.jsxs("form",{className:"space-y-6",onSubmit:d,autoComplete:"off",children:[x,f,v]}),e[29]=v,e[30]=d,e[31]=x,e[32]=f,e[33]=y):y=e[33];let S;e[34]!==l||e[35]!==y?(S=s.jsxs(bn,{children:[c,s.jsx(Cn,{...l,children:y})]}),e[34]=l,e[35]=y,e[36]=S):S=e[36];let C;return e[37]!==i||e[38]!==n||e[39]!==S?(C=s.jsx(_n,{open:n,onOpenChange:i,children:S}),e[37]=i,e[38]=n,e[39]=S,e[40]=C):C=e[40],C}function Ui(t){const{orgSlug:e}=t;window.location.href=`/${e}`}async function Hi(t){const e=ds(t.name);if(!e)throw new Error("Organization slug is invalid");const n=await se.organization.create({name:t.name,slug:e});if(n?.error)throw new Error(n.error.message||"Failed to create organization");const i=n?.data?.slug??e;if(!i)throw new Error("Failed to create organization");return{orgSlug:i}}function ms(){const t=M.useContext($s),{data:e,refetch:n}=t.hooks.useListUserInvitations();return{invitations:(e??[]).filter(o=>o.status==="pending"&&new Date(o.expiresAt)>new Date),refetch:()=>n?.()}}function Gi(t){let e=0;for(let i=0;i<t.length;i++)e=t.charCodeAt(i)+((e<<5)-e);const n=Math.abs(e)%360;return{backgroundColor:`hsl(${n} 55% 70%)`,color:`hsl(${n} 55% 20%)`}}function Te(t){const e=z.c(13),{org:n,size:i}=t,o=i===void 0?"sm":i,l=o==="xs"?"size-5":"size-6",r=o==="xs"?"text-[9px]":"text-xs";let a;e[0]!==l?(a=P(l,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=l,e[1]=a):a=e[1];let m;e[2]!==n.logo||e[3]!==n.name?(m=n.logo?void 0:Gi(n.name),e[2]=n.logo,e[3]=n.name,e[4]=m):m=e[4];let c;e[5]!==n.logo||e[6]!==n.name||e[7]!==r?(c=n.logo?s.jsx("img",{src:n.logo,alt:"",className:"size-full object-cover"}):s.jsx("span",{className:P("font-semibold leading-none",r),children:n.name.slice(0,2).toUpperCase()}),e[5]=n.logo,e[6]=n.name,e[7]=r,e[8]=c):c=e[8];let d;return e[9]!==a||e[10]!==m||e[11]!==c?(d=s.jsx("div",{className:a,style:m,children:c}),e[9]=a,e[10]=m,e[11]=c,e[12]=d):d=e[12],d}function Wi({invitation:t,onChanged:e}){const[n,i]=M.useState(!1),o=t.organizationName??"Unknown organization",l=async()=>{i(!0);try{const m=await se.organization.acceptInvitation({invitationId:t.id});if(m.error){ee.error(m.error.message),i(!1);return}}catch{ee.error("Failed to accept invitation"),i(!1);return}ee.success(`Joined ${o}`),Os();let a;try{a=(await se.organization.getFullOrganization({query:{organizationId:t.organizationId}}))?.data?.slug}catch{}window.location.href=a?`/${a}`:"/"},r=async()=>{i(!0);try{const a=await se.organization.rejectInvitation({invitationId:t.id});if(a.error){ee.error(a.error.message),i(!1);return}ee.success("Invitation declined"),i(!1),e()}catch{ee.error("Failed to decline invitation"),i(!1)}};return s.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-dashed border-border px-3 py-2.5",children:[s.jsx(Te,{org:{name:o},size:"sm"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium",children:o}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:"Invited to join"})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s.jsx(le,{size:"sm",variant:"default",className:"h-7 text-xs",onClick:l,disabled:n,children:"Accept"}),s.jsx(le,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground",onClick:r,disabled:n,"aria-label":`Decline invitation to ${o}`,children:s.jsx(pn,{size:14})})]})]})}function Ki(t){const e=z.c(29),{orgParam:n,onSelectOrg:i,onCreateOrg:o}=t,{data:l}=Ts(),{invitations:r,refetch:a}=ms();let m;e[0]!==n?(m=(k,$)=>k.slug===n?-1:$.slug===n?1:k.name.localeCompare($.name),e[0]=n,e[1]=m):m=e[1];const c=[...l??[]].sort(m),[d,u]=M.useState(""),x=d.toLowerCase(),f=x?c.filter(k=>k.name.toLowerCase().includes(x)||k.slug.toLowerCase().includes(x)):c;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(qt,{size:16,className:"shrink-0 text-muted-foreground/60"}),e[2]=h):h=e[2];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=k=>u(k.target.value),e[3]=g):g=e[3];let p;e[4]!==d?(p=k=>k.key==="Escape"&&d&&u(""),e[4]=d,e[5]=p):p=e[5];let b;e[6]!==d||e[7]!==p?(b=s.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:d,onChange:g,onKeyDown:p,placeholder:"Search organizations...",className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),e[6]=d,e[7]=p,e[8]=b):b=e[8];let j;e[9]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(pe,{size:16}),e[9]=j):j=e[9];let v;e[10]!==o?(v=s.jsx("button",{type:"button",onClick:o,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:j}),e[10]=o,e[11]=v):v=e[11];let y;e[12]!==b||e[13]!==v?(y=s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[h,b,v]}),e[12]=b,e[13]=v,e[14]=y):y=e[14];const S="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1";let C;e[15]!==r||e[16]!==d||e[17]!==a?(C=!d&&r.map(k=>s.jsx(Wi,{invitation:k,onChanged:a},k.id)),e[15]=r,e[16]=d,e[17]=a,e[18]=C):C=e[18];const _=f.length===0&&s.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:d?`No organizations match "${d}"`:"No organizations available"});let N;e[19]!==i||e[20]!==n?(N=k=>s.jsxs("button",{type:"button",onClick:()=>i(k.slug),className:P("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",k.slug===n?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[s.jsx(Te,{org:k,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:k.name}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:k.slug})]}),k.slug===n&&s.jsx(ve,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},k.id),e[19]=i,e[20]=n,e[21]=N):N=e[21];const w=f.map(N);let I;e[22]!==C||e[23]!==_||e[24]!==w?(I=s.jsxs("div",{className:S,children:[C,_,w]}),e[22]=C,e[23]=_,e[24]=w,e[25]=I):I=e[25];let A;return e[26]!==I||e[27]!==y?(A=s.jsxs(s.Fragment,{children:[y,I]}),e[26]=I,e[27]=y,e[28]=A):A=e[28],A}function us(t){const e=z.c(22),{trigger:n,orgParam:i,align:o,side:l}=t,r=o===void 0?"start":o,a=l===void 0?"bottom":l,m=ie(),[c,d]=M.useState(!1),[u,x]=M.useState(!1);let f;e[0]!==n?(f=s.jsx(xe,{asChild:!0,children:n}),e[0]=n,e[1]=f):f=e[1];const h=String(c);let g;e[2]!==m?(g=C=>{d(!1),m({to:"/$org",params:{org:C}})},e[2]=m,e[3]=g):g=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{d(!1),x(!0)},e[4]=p):p=e[4];let b;e[5]!==i||e[6]!==h||e[7]!==g?(b=s.jsx(Ki,{orgParam:i,onSelectOrg:g,onCreateOrg:p},h),e[5]=i,e[6]=h,e[7]=g,e[8]=b):b=e[8];let j;e[9]!==r||e[10]!==a||e[11]!==b?(j=s.jsx(Ie,{side:a,align:r,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:qi,onCloseAutoFocus:Vi,children:b}),e[9]=r,e[10]=a,e[11]=b,e[12]=j):j=e[12];let v;e[13]!==c||e[14]!==f||e[15]!==j?(v=s.jsxs(Ae,{open:c,onOpenChange:d,children:[f,j]}),e[13]=c,e[14]=f,e[15]=j,e[16]=v):v=e[16];let y;e[17]!==u?(y=s.jsx(Bi,{open:u,onOpenChange:x}),e[17]=u,e[18]=y):y=e[18];let S;return e[19]!==y||e[20]!==v?(S=s.jsxs(s.Fragment,{children:[v,y]}),e[19]=y,e[20]=v,e[21]=S):S=e[21],S}function Vi(t){return t.preventDefault()}function qi(t){t.preventDefault(),t.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function Yi(t){const e=z.c(21),{value:n,onChange:i,placeholder:o,onKeyDown:l,className:r,isSearching:a,disabled:m}=t,c=o===void 0?"Search...":o;let d;e[0]!==r?(d=P("shrink-0 w-full border-b border-border h-12",r),e[0]=r,e[1]=d):d=e[1];const u=m?"cursor-not-allowed opacity-50":"cursor-text";let x;e[2]!==u?(x=P("flex items-center gap-2.5 h-12 px-4",u),e[2]=u,e[3]=x):x=e[3];let f;e[4]!==a?(f=a?s.jsx(Ot,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):s.jsx(qt,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=a,e[5]=f):f=e[5];let h;e[6]!==i?(h=j=>i(j.target.value),e[6]=i,e[7]=h):h=e[7];let g;e[8]!==m||e[9]!==l||e[10]!==c||e[11]!==h||e[12]!==n?(g=s.jsx("input",{type:"text",value:n,onChange:h,onKeyDown:l,placeholder:c,disabled:m,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=m,e[9]=l,e[10]=c,e[11]=h,e[12]=n,e[13]=g):g=e[13];let p;e[14]!==x||e[15]!==f||e[16]!==g?(p=s.jsxs("label",{className:x,children:[f,g]}),e[14]=x,e[15]=f,e[16]=g,e[17]=p):p=e[17];let b;return e[18]!==d||e[19]!==p?(b=s.jsx("div",{className:d,children:p}),e[18]=d,e[19]=p,e[20]=b):b=e[20],b}const Xi="Select an existing agent";function Qi(t){const e=z.c(5),{children:n}=t;let i;e[0]!==n?(i=s.jsx(ae,{asChild:!0,children:n}),e[0]=n,e[1]=i):i=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ce,{side:"right",sideOffset:8,children:Xi}),e[2]=o):o=e[2];let l;return e[3]!==i?(l=s.jsxs(de,{defaultOpen:!0,delayDuration:0,children:[i,o]}),e[3]=i,e[4]=l):l=e[4],l}function Ji(t){const e=ie(),{create:n}=Jt(),{locator:i}=X(),o=qe({strict:!1}),l=ke({strict:!1});return async r=>{const a=crypto.randomUUID(),m=r===l.virtualmcpid?Rn(t,i,o.taskId??""):null;try{await n({id:a,virtual_mcp_id:r,...m?{branch:m}:{}})}catch{}e({to:"/$org/$taskId",params:{org:t,taskId:a},search:{virtualmcpid:r}})}}function De(t){const e=z.c(20),{agent:n,selected:i,onClick:o}=t,l=i?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50";let r;e[0]!==l?(r=P("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",l),e[0]=l,e[1]=r):r=e[1];let a;e[2]!==n.icon||e[3]!==n.title?(a=s.jsx(me,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[2]=n.icon,e[3]=n.title,e[4]=a):a=e[4];let m;e[5]!==n.title?(m=s.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[5]=n.title,e[6]=m):m=e[6];let c;e[7]!==n.description?(c=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n.description}),e[7]=n.description,e[8]=c):c=e[8];let d;e[9]!==m||e[10]!==c?(d=s.jsxs("div",{className:"flex-1 min-w-0",children:[m,c]}),e[9]=m,e[10]=c,e[11]=d):d=e[11];let u;e[12]!==i?(u=i&&s.jsx(ve,{size:14,className:"ml-auto text-muted-foreground shrink-0"}),e[12]=i,e[13]=u):u=e[13];let x;return e[14]!==o||e[15]!==r||e[16]!==a||e[17]!==d||e[18]!==u?(x=s.jsxs("button",{type:"button",onClick:o,className:r,children:[a,d,u]}),e[14]=o,e[15]=r,e[16]=a,e[17]=d,e[18]=u,e[19]=x):x=e[19],x}function ht(t){const e=z.c(5),{children:n,action:i}=t;let o;e[0]!==n?(o=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n}),e[0]=n,e[1]=o):o=e[1];let l;return e[2]!==i||e[3]!==o?(l=s.jsxs("div",{className:"flex items-center justify-between px-3 pb-1 pt-2",children:[o,i]}),e[2]=i,e[3]=o,e[4]=l):l=e[4],l}function Zi(t){const e=z.c(27),{onClose:n,onSelectAgent:i,selectedAgentId:o,onImportFromGithub:l}=t,[r,a]=M.useState(""),m=Wt(),c=m??[],{org:d}=X(),{data:u}=se.useSession(),x=u?.user?.id??"anon",f=Un(m),h=Hn(),g=Ji(d.slug),p=Wn(m),b=r.toLowerCase(),j=c.filter(no).filter(K=>!p.has(K.id)).filter(so).filter(K=>!r||K.title.toLowerCase().includes(b)),v=j.filter(to),y=j.filter(eo),S=Ne(d.id),C=!r||S.title.toLowerCase().includes(b),_=!!(i&&C);let N;e[0]!==n||e[1]!==i?(N=()=>{i?.(null),n(),a("")},e[0]=n,e[1]=i,e[2]=N):N=e[2];const w=N,I=K=>{if(i){i(K.id),n(),a("");return}Gn({orgId:d.id,userId:x},K.id,f),h(),n(),a(""),g(K.id)},A="flex flex-col max-h-[min(640px,80dvh)]";let k;e[3]!==r?(k=s.jsx(Yi,{value:r,onChange:a,placeholder:"Search agents..."}),e[3]=r,e[4]=k):k=e[4];const $="overflow-y-auto flex-1 min-h-0 p-1.5 flex flex-col gap-0.5",O=i&&C&&S&&s.jsx(De,{agent:S,selected:!o||o===S.id,onClick:w}),E=(v.length>0||!r)&&s.jsx(ht,{action:s.jsxs("button",{type:"button",onClick:l,className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",children:[s.jsx(Pn,{className:"size-3.5"}),"Import"]}),children:"Code Agents"}),U=v.map(K=>s.jsx(De,{agent:K,selected:i?o===K.id:void 0,onClick:()=>I(K)},K.id)),R=y.length>0&&s.jsx(ht,{children:"Agents"}),F=y.map(K=>s.jsx(De,{agent:K,selected:i?o===K.id:void 0,onClick:()=>I(K)},K.id));let D;e[5]!==_||e[6]!==r||e[7]!==j.length?(D=j.length===0&&!_&&r&&s.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:"No agents found"}),e[5]=_,e[6]=r,e[7]=j.length,e[8]=D):D=e[8];let L;e[9]!==D||e[10]!==O||e[11]!==E||e[12]!==U||e[13]!==R||e[14]!==F?(L=s.jsxs("div",{className:$,children:[O,E,U,R,F,D]}),e[9]=D,e[10]=O,e[11]=E,e[12]=U,e[13]=R,e[14]=F,e[15]=L):L=e[15];let H;e[16]!==d.slug?(H={org:d.slug},e[16]=d.slug,e[17]=H):H=e[17];let G;e[18]!==n?(G=()=>n(),e[18]=n,e[19]=G):G=e[19];let W;e[20]!==H||e[21]!==G?(W=s.jsx("div",{className:"border-t border-border px-3 py-2.5",children:s.jsx(Mt,{to:"/$org/settings/agents",params:H,onClick:G,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:"See all agents"})}),e[20]=H,e[21]=G,e[22]=W):W=e[22];let Q;return e[23]!==L||e[24]!==W||e[25]!==k?(Q=s.jsxs("div",{className:A,children:[k,L,W]}),e[23]=L,e[24]=W,e[25]=k,e[26]=Q):Q=e[26],Q}function eo(t){return!es(t.metadata)}function to(t){return es(t.metadata)}function so(t){return!an(t.id)}function no(t){return!rn(t.id)}function io(t){const e=z.c(31);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const{compact:i,trigger:o,onSelectAgent:l,selectedAgentId:r,side:a,align:m}=n,c=i===void 0?!1:i,d=a===void 0?"right":a,u=m===void 0?"start":m,[x,f]=M.useState(!1),[h,g]=M.useState(!1),p=Qe(),{setOpenMobile:b}=re(),j=Bn(),v=j?"border border-border":void 0;let y;e[2]!==j?(y=E=>j?s.jsx(Qi,{children:E}):E,e[2]=j,e[3]=y):y=e[3];const S=y;let C;e[4]!==p||e[5]!==b?(C=()=>{f(!1),p&&b(!1)},e[4]=p,e[5]=b,e[6]=C):C=e[6];const _=C;let N;e[7]!==_?(N=()=>{_(),g(!0)},e[7]=_,e[8]=N):N=e[8];const w=N;let I;e[9]!==_||e[10]!==w||e[11]!==l||e[12]!==x||e[13]!==r?(I=x&&s.jsx(M.Suspense,{fallback:s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(ne,{className:"h-4 w-24"})}),children:s.jsx(Zi,{onClose:_,onSelectAgent:l,selectedAgentId:r,onImportFromGithub:w})}),e[9]=_,e[10]=w,e[11]=l,e[12]=x,e[13]=r,e[14]=I):I=e[14];const A=I;let k;e[15]!==u||e[16]!==c||e[17]!==v||e[18]!==j||e[19]!==p||e[20]!==x||e[21]!==A||e[22]!==d||e[23]!==o||e[24]!==S?(k=p?s.jsxs(s.Fragment,{children:[o?s.jsx("button",{type:"button",onClick:()=>f(!0),className:"contents",children:o}):c?S(s.jsx(ue,{"aria-label":"Browse agents",className:P(v),onClick:()=>{q("agent_browser_opened",{surface:"mobile_drawer"}),f(!0)},children:s.jsx(pe,{className:"size-4"})})):s.jsx(B,{children:S(s.jsxs(Y,{tooltip:j?void 0:"Browse agents",className:P(v),onClick:()=>{q("agent_browser_opened",{surface:"mobile_drawer"}),f(!0)},children:[s.jsx(pe,{}),s.jsx("span",{children:"New agent"})]}))}),s.jsx(Yt,{open:x,onOpenChange:f,direction:"bottom",children:s.jsxs(Xt,{className:"max-h-[85dvh] p-0",children:[s.jsx(Qt,{className:"sr-only",children:"Browse agents"}),A]})})]}):s.jsxs(Ae,{open:x,onOpenChange:E=>{E&&!x&&q("agent_browser_opened",{surface:"desktop_popover"}),f(E)},children:[o?s.jsx(xe,{asChild:!0,children:o}):c?S(s.jsx(xe,{asChild:!0,children:s.jsx(ue,{"aria-label":"Browse agents",className:P(v),children:s.jsx(pe,{className:"size-4"})})})):s.jsx(B,{children:S(s.jsx(xe,{asChild:!0,children:s.jsxs(Y,{tooltip:j?void 0:"Browse agents",className:P(v),children:[s.jsx(pe,{}),s.jsx("span",{children:"New agent"})]})}))}),s.jsx(Ie,{className:"w-[380px] p-0 overflow-hidden",side:d,align:u,children:A})]}),e[15]=u,e[16]=c,e[17]=v,e[18]=j,e[19]=p,e[20]=x,e[21]=A,e[22]=d,e[23]=o,e[24]=S,e[25]=k):k=e[25];let $;e[26]!==h?($=s.jsx(En,{open:h,onOpenChange:g,mode:"agent"}),e[26]=h,e[27]=$):$=e[27];let O;return e[28]!==$||e[29]!==k?(O=s.jsxs(s.Fragment,{children:[k,$]}),e[28]=$,e[29]=k,e[30]=O):O=e[30],O}const oo="wco-no-drag inline-flex items-center gap-1.5 min-w-0 rounded-md pl-1 pr-2 py-1.5 text-sm text-foreground hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50";function lo(t){const e=z.c(19),{agentId:n,fallback:i,onOpenHome:o,onPick:l}=t,r=st(n)??i??null,a=r?.title??"Super Agent",m=`Open ${a} home`,c=r?.icon??null;let d;e[0]!==c||e[1]!==a?(d=s.jsx(me,{icon:c,name:a,size:"xs"}),e[0]=c,e[1]=a,e[2]=d):d=e[2];let u;e[3]!==o||e[4]!==m||e[5]!==d?(u=s.jsx("button",{type:"button",onClick:o,"aria-label":m,className:"wco-no-drag flex items-center shrink-0 rounded-md p-1 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:d}),e[3]=o,e[4]=m,e[5]=d,e[6]=u):u=e[6];let x;e[7]!==a?(x=s.jsx("span",{className:"truncate font-medium max-w-[8rem]",children:a}),e[7]=a,e[8]=x):x=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(tt,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[9]=f):f=e[9];let h;e[10]!==x?(h=s.jsxs("button",{type:"button",className:oo,children:[x,f]}),e[10]=x,e[11]=h):h=e[11];let g;e[12]!==n||e[13]!==l||e[14]!==h?(g=s.jsx(io,{side:"bottom",align:"start",selectedAgentId:n,onSelectAgent:l,trigger:h}),e[12]=n,e[13]=l,e[14]=h,e[15]=g):g=e[15];let p;return e[16]!==u||e[17]!==g?(p=s.jsxs("div",{className:"flex min-w-0 items-center gap-0",children:[u,g]}),e[16]=u,e[17]=g,e[18]=p):p=e[18],p}function We(t){const e=z.c(26);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const{showName:i}=n,{org:o}=X(),{state:l,isMobile:r}=re(),a=ms().invitations.length>0,m=l==="collapsed"||r,c=a?`${o.name} — switch organization (pending invitation)`:`${o.name} — switch organization`;let d;e[2]!==o?(d=s.jsx(Te,{org:o,size:"sm"}),e[2]=o,e[3]=d):d=e[3];let u;e[4]!==a||e[5]!==m?(u=a&&s.jsx("span",{className:P("absolute -right-1 size-2.5 rounded-full bg-destructive ring-2 ring-background",m?"-top-1":"top-1/2 -translate-y-1/2")}),e[4]=a,e[5]=m,e[6]=u):u=e[6];let x;e[7]!==d||e[8]!==u?(x=s.jsxs("span",{className:"relative inline-flex",children:[d,u]}),e[7]=d,e[8]=u,e[9]=x):x=e[9];let f;e[10]!==o.name||e[11]!==i?(f=i&&s.jsx("span",{className:"truncate text-sm font-medium text-foreground max-w-[10rem]",children:o.name}),e[10]=o.name,e[11]=i,e[12]=f):f=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(tt,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[13]=h):h=e[13];let g;e[14]!==c||e[15]!==x||e[16]!==f?(g=s.jsx(ae,{asChild:!0,children:s.jsxs("button",{type:"button","aria-label":c,className:"wco-no-drag flex items-center gap-1.5 shrink-0 rounded-lg pl-[5px] pr-1.5 py-1.5 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[x,f,h]})}),e[14]=c,e[15]=x,e[16]=f,e[17]=g):g=e[17];let p;e[18]!==o.slug||e[19]!==g?(p=s.jsx(us,{orgParam:o.slug,trigger:g}),e[18]=o.slug,e[19]=g,e[20]=p):p=e[20];let b;e[21]!==o.name?(b=s.jsx(ce,{side:"bottom",children:o.name}),e[21]=o.name,e[22]=b):b=e[22];let j;return e[23]!==b||e[24]!==p?(j=s.jsxs(de,{children:[p,b]}),e[23]=b,e[24]=p,e[25]=j):j=e[25],j}function Oe(t){const e=z.c(24);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const{onNavigate:i}=n,{org:o}=X(),l=ie();let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[2]=r):r=e[2];const a=qe(r);let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m={strict:!1},e[3]=m):m=e[3];const c=ke(m),{threads:d}=nt(),{data:u}=se.useSession(),{setTaskId:x,createNewTask:f}=it();let h;e[4]!==o.id?(h=Ne(o.id),e[4]=o.id,e[5]=h):h=e[5];const g=h,p=g.id,b=a.taskId?c.virtualmcpid??p:p;let j;e[6]!==f||e[7]!==p||e[8]!==l||e[9]!==i||e[10]!==o.slug||e[11]!==u?.user?.id||e[12]!==x||e[13]!==d?(j=N=>{if(!N||N===p){l({to:"/$org",params:{org:o.slug}}),i?.();return}const w=Yn(d,N,u?.user?.id);w?x(w.id,N):f(N),i?.()},e[6]=f,e[7]=p,e[8]=l,e[9]=i,e[10]=o.slug,e[11]=u?.user?.id,e[12]=x,e[13]=d,e[14]=j):j=e[14];const v=j;let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("span",{className:"h-5 w-24 rounded bg-muted animate-pulse"}),e[15]=y):y=e[15];const S=b===p?g:void 0;let C;e[16]!==b||e[17]!==v?(C=()=>v(b),e[16]=b,e[17]=v,e[18]=C):C=e[18];let _;return e[19]!==b||e[20]!==v||e[21]!==S||e[22]!==C?(_=s.jsx(M.Suspense,{fallback:y,children:s.jsx(lo,{agentId:b,fallback:S,onOpenHome:C,onPick:v})}),e[19]=b,e[20]=v,e[21]=S,e[22]=C,e[23]=_):_=e[23],_}function pt(t){const e=z.c(18),{item:n,onClose:i}=t,o=n.isActive&&"z-10";let l;e[0]!==o?(l=P(o),e[0]=o,e[1]=l):l=e[1];let r;e[2]!==n||e[3]!==i?(r=()=>{n.onClick?.(),i()},e[2]=n,e[3]=i,e[4]=r):r=e[4];let a;e[5]!==n.icon?(a=s.jsx("span",{className:"[&>svg]:size-5 shrink-0",children:n.icon}),e[5]=n.icon,e[6]=a):a=e[6];let m;e[7]!==n.label?(m=s.jsx("span",{children:n.label}),e[7]=n.label,e[8]=m):m=e[8];let c;e[9]!==n.isActive||e[10]!==n.label||e[11]!==r||e[12]!==a||e[13]!==m?(c=s.jsxs(Y,{onClick:r,isActive:n.isActive,tooltip:n.label,className:"h-10! text-sm!",children:[a,m]}),e[9]=n.isActive,e[10]=n.label,e[11]=r,e[12]=a,e[13]=m,e[14]=c):c=e[14];let d;return e[15]!==l||e[16]!==c?(d=s.jsx(B,{className:l,children:c}),e[15]=l,e[16]=c,e[17]=d):d=e[17],d}function ro(t){const e=z.c(18),{section:n,onClose:i}=t;switch(n.type){case"divider":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(Pt,{className:"my-2"}),e[0]=o):o=e[0],o}case"spacer":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"flex-1"}),e[1]=o):o=e[1],o}case"group":{const o=n.group.label,l=n.group.defaultExpanded;let r;if(e[2]!==i||e[3]!==n.group.items){let m;e[5]!==i?(m=c=>s.jsx(pt,{item:c,onClose:i},c.key),e[5]=i,e[6]=m):m=e[6],r=n.group.items.map(m),e[2]=i,e[3]=n.group.items,e[4]=r}else r=e[4];let a;return e[7]!==n.group.defaultExpanded||e[8]!==n.group.label||e[9]!==r?(a=s.jsx(rs,{label:o,defaultExpanded:l,children:r}),e[7]=n.group.defaultExpanded,e[8]=n.group.label,e[9]=r,e[10]=a):a=e[10],a}case"items":{let o;if(e[11]!==i||e[12]!==n.items){let r;e[14]!==i?(r=a=>s.jsx(pt,{item:a,onClose:i},a.key),e[14]=i,e[15]=r):r=e[15],o=n.items.map(r),e[11]=i,e[12]=n.items,e[13]=o}else o=e[13];let l;return e[16]!==o?(l=s.jsx(Ye,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(Xe,{children:s.jsx(te,{className:"gap-1.5",children:o})})}),e[16]=o,e[17]=l):l=e[17],l}case"custom":return n.content}}function ao(t){const e=z.c(24),{sections:n,onClose:i,footer:o,additionalContent:l}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(We,{}),e[0]=r):r=e[0];let a;e[1]!==i?(a=s.jsx(Oe,{onNavigate:i}),e[1]=i,e[2]=a):a=e[2];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("div",{className:"flex-1"}),e[3]=m):m=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Ht,{size:16}),e[4]=c):c=e[4];let d;e[5]!==i?(d=s.jsx(ue,{onClick:i,"aria-label":"Close sidebar",children:c}),e[5]=i,e[6]=d):d=e[6];let u;e[7]!==a||e[8]!==d?(u=s.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-0.5 px-1.5",children:[r,a,m,d]}),e[7]=a,e[8]=d,e[9]=u):u=e[9];let x;if(e[10]!==i||e[11]!==n){let p;e[13]!==i?(p=(b,j)=>s.jsx(ro,{section:b,onClose:i},j),e[13]=i,e[14]=p):p=e[14],x=n.map(p),e[10]=i,e[11]=n,e[12]=x}else x=e[12];let f;e[15]!==l?(f=l&&s.jsx("div",{className:"mt-3 flex flex-col flex-1 min-h-0",children:l}),e[15]=l,e[16]=f):f=e[16];let h;e[17]!==x||e[18]!==f?(h=s.jsxs(Et,{className:"flex flex-col flex-1 px-2 py-2 gap-0",children:[x,f]}),e[17]=x,e[18]=f,e[19]=h):h=e[19];let g;return e[20]!==o||e[21]!==u||e[22]!==h?(g=s.jsxs("div",{className:"bg-sidebar flex h-full w-full flex-col","data-sidebar":"sidebar",children:[u,h,o]}),e[20]=o,e[21]=u,e[22]=h,e[23]=g):g=e[23],g}function fe(t){const e=z.c(26),{item:n,onClose:i}=t;let o;e[0]!==n.className?(o=P("flex items-center gap-2.5 px-3 py-2 rounded-md text-sm text-left w-full transition-colors text-foreground/80 hover:bg-sidebar-accent hover:text-foreground",n.className),e[0]=n.className,e[1]=o):o=e[1];const l=o;if(n.href){const d=n.external?"_blank":void 0,u=n.external?"noopener noreferrer":void 0;let x;e[2]!==n.icon?(x=s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n.icon}),e[2]=n.icon,e[3]=x):x=e[3];let f;e[4]!==n.label?(f=s.jsx("span",{className:"flex-1",children:n.label}),e[4]=n.label,e[5]=f):f=e[5];let h;return e[6]!==l||e[7]!==n.href||e[8]!==i||e[9]!==d||e[10]!==u||e[11]!==x||e[12]!==f?(h=s.jsxs("a",{href:n.href,target:d,rel:u,className:l,onClick:i,children:[x,f]}),e[6]=l,e[7]=n.href,e[8]=i,e[9]=d,e[10]=u,e[11]=x,e[12]=f,e[13]=h):h=e[13],h}let r;e[14]!==n||e[15]!==i?(r=()=>{n.onClick?.(),i()},e[14]=n,e[15]=i,e[16]=r):r=e[16];let a;e[17]!==n.icon?(a=s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n.icon}),e[17]=n.icon,e[18]=a):a=e[18];let m;e[19]!==n.label?(m=s.jsx("span",{className:"flex-1",children:n.label}),e[19]=n.label,e[20]=m):m=e[20];let c;return e[21]!==l||e[22]!==r||e[23]!==a||e[24]!==m?(c=s.jsxs("button",{type:"button",onClick:r,className:l,children:[a,m]}),e[21]=l,e[22]=r,e[23]=a,e[24]=m,e[25]=c):c=e[25],c}function co(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("span",{className:"shrink-0 inline-flex items-center rounded-full bg-warning/10 px-2 py-0.5 text-[10px] font-medium text-warning",children:"Impersonating"}),t[0]=e):e=t[0],e}function gt(t){const e=z.c(30),{user:n,userImage:i,isImpersonating:o,isMobile:l}=t,r=l?"py-4 border-b border-border":"py-3 mx-1 mt-1";let a;e[0]!==r?(a=P("flex items-center gap-3 px-4",r),e[0]=r,e[1]=a):a=e[1];const m=n?.name??"U";let c;e[2]!==m||e[3]!==i?(c=s.jsx(Ue,{url:i,fallback:m,shape:"circle",size:"sm",className:"shrink-0"}),e[2]=m,e[3]=i,e[4]=c):c=e[4];const d=n?.name??"User";let u;e[5]!==d?(u=s.jsx("p",{className:"text-sm font-medium truncate",children:d}),e[5]=d,e[6]=u):u=e[6];let x;e[7]!==o?(x=o&&s.jsx(co,{}),e[7]=o,e[8]=x):x=e[8];let f;e[9]!==u||e[10]!==x?(f=s.jsxs("div",{className:"flex items-center gap-2",children:[u,x]}),e[9]=u,e[10]=x,e[11]=f):f=e[11];const h=n?.email;let g;e[12]!==h?(g=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:h}),e[12]=h,e[13]=g):g=e[13];let p;e[14]!==g||e[15]!==f?(p=s.jsxs("div",{className:"flex-1 min-w-0",children:[f,g]}),e[14]=g,e[15]=f,e[16]=p):p=e[16];let b;e[17]!==n?(b=()=>{n?.id&&navigator.clipboard.writeText(n.id).then(mo)},e[17]=n,e[18]=b):b=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(He,{size:14}),e[19]=j):j=e[19];let v;e[20]!==b?(v=s.jsx(ae,{asChild:!0,children:s.jsx("button",{type:"button",tabIndex:-1,onClick:b,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:j})}),e[20]=b,e[21]=v):v=e[21];let y;e[22]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(ce,{side:"right",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[22]=y):y=e[22];let S;e[23]!==v?(S=s.jsx(Gt,{delayDuration:300,children:s.jsxs(de,{children:[v,y]})}),e[23]=v,e[24]=S):S=e[24];let C;return e[25]!==p||e[26]!==S||e[27]!==a||e[28]!==c?(C=s.jsxs("div",{className:a,children:[c,p,S]}),e[25]=p,e[26]=S,e[27]=a,e[28]=c,e[29]=C):C=e[29],C}function mo(){ee.success("User ID copied")}function bt(t){const e=z.c(32),{themeOptions:n,preferences:i,setPreferences:o,isMobile:l}=t,r=l?"size-8":"size-7",a=l?"px-3 py-3":"px-2 py-1.5";let m;e[0]!==a?(m=P("flex items-center justify-between border-t border-border/50",a),e[0]=a,e[1]=m):m=e[1];let c;if(e[2]!==r||e[3]!==i.theme||e[4]!==o||e[5]!==n){let y;e[7]!==r||e[8]!==i.theme||e[9]!==o?(y=S=>{const{value:C,icon:_,label:N}=S;return s.jsx("button",{type:"button","aria-label":N,onClick:()=>o(w=>({...w,theme:C})),className:P(r,"rounded-md flex items-center justify-center transition-colors",i.theme===C?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:_},C)},e[7]=r,e[8]=i.theme,e[9]=o,e[10]=y):y=e[10],c=n.map(y),e[2]=r,e[3]=i.theme,e[4]=o,e[5]=n,e[6]=c}else c=e[6];let d;e[11]!==c?(d=s.jsx("div",{className:"flex items-center gap-0.5",children:c}),e[11]=c,e[12]=d):d=e[12];const u=i.enableSounds?"Disable sounds":"Enable sounds";let x;e[13]!==o?(x=()=>o(uo),e[13]=o,e[14]=x):x=e[14];const f=i.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let h;e[15]!==r||e[16]!==f?(h=P(r,"rounded-md flex items-center justify-center transition-colors",f),e[15]=r,e[16]=f,e[17]=h):h=e[17];let g;e[18]!==i.enableSounds?(g=i.enableSounds?s.jsx(cn,{size:14}):s.jsx(dn,{size:14}),e[18]=i.enableSounds,e[19]=g):g=e[19];let p;e[20]!==u||e[21]!==x||e[22]!==h||e[23]!==g?(p=s.jsx("button",{type:"button","aria-label":u,onClick:x,className:h,children:g}),e[20]=u,e[21]=x,e[22]=h,e[23]=g,e[24]=p):p=e[24];let b;e[25]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","4.95.2"]}),e[25]=b):b=e[25];let j;e[26]!==p?(j=s.jsxs("div",{className:"flex items-center gap-2",children:[p,b]}),e[26]=p,e[27]=j):j=e[27];let v;return e[28]!==j||e[29]!==m||e[30]!==d?(v=s.jsxs("div",{className:m,children:[d,j]}),e[28]=j,e[29]=m,e[30]=d,e[31]=v):v=e[31],v}function uo(t){return{...t,enableSounds:!t.enableSounds}}function jt(t){const e=z.c(54),{user:n,userImage:i,menuItems:o,signOutItem:l,stopImpersonatingItem:r,isImpersonating:a,themeOptions:m,preferences:c,setPreferences:d,close:u,isMobile:x}=t;if(x){let y;e[0]!==a||e[1]!==n||e[2]!==i?(y=s.jsx(gt,{user:n,userImage:i,isImpersonating:a,isMobile:!0}),e[0]=a,e[1]=n,e[2]=i,e[3]=y):y=e[3];let S;if(e[4]!==u||e[5]!==o){let A;e[7]!==u?(A=k=>s.jsx(fe,{item:k,onClose:u},k.key),e[7]=u,e[8]=A):A=e[8],S=o.map(A),e[4]=u,e[5]=o,e[6]=S}else S=e[6];let C;e[9]!==u||e[10]!==r?(C=r&&s.jsx(fe,{item:r,onClose:u}),e[9]=u,e[10]=r,e[11]=C):C=e[11];let _;e[12]!==u||e[13]!==l?(_=s.jsx(fe,{item:l,onClose:u}),e[12]=u,e[13]=l,e[14]=_):_=e[14];let N;e[15]!==S||e[16]!==C||e[17]!==_?(N=s.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:s.jsxs("nav",{className:"flex flex-col px-2 pt-2 pb-2 gap-0.5",children:[S,C,_]})}),e[15]=S,e[16]=C,e[17]=_,e[18]=N):N=e[18];let w;e[19]!==c||e[20]!==d||e[21]!==m?(w=s.jsx(bt,{themeOptions:m,preferences:c,setPreferences:d,isMobile:!0}),e[19]=c,e[20]=d,e[21]=m,e[22]=w):w=e[22];let I;return e[23]!==y||e[24]!==N||e[25]!==w?(I=s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[y,N,w]}),e[23]=y,e[24]=N,e[25]=w,e[26]=I):I=e[26],I}let f;e[27]!==a||e[28]!==n||e[29]!==i?(f=s.jsx(gt,{user:n,userImage:i,isImpersonating:a,isMobile:!1}),e[27]=a,e[28]=n,e[29]=i,e[30]=f):f=e[30];let h;if(e[31]!==u||e[32]!==o){let y;e[34]!==u?(y=S=>s.jsx(fe,{item:S,onClose:u},S.key),e[34]=u,e[35]=y):y=e[35],h=o.map(y),e[31]=u,e[32]=o,e[33]=h}else h=e[33];let g;e[36]!==u||e[37]!==r?(g=r&&s.jsx(fe,{item:r,onClose:u}),e[36]=u,e[37]=r,e[38]=g):g=e[38];let p;e[39]!==u||e[40]!==l?(p=s.jsx(fe,{item:l,onClose:u}),e[39]=u,e[40]=l,e[41]=p):p=e[41];let b;e[42]!==h||e[43]!==g||e[44]!==p?(b=s.jsxs("nav",{className:"flex-1 flex flex-col px-2 pt-1 overflow-y-auto",children:[h,g,p]}),e[42]=h,e[43]=g,e[44]=p,e[45]=b):b=e[45];let j;e[46]!==c||e[47]!==d||e[48]!==m?(j=s.jsx(bt,{themeOptions:m,preferences:c,setPreferences:d,isMobile:!1}),e[46]=c,e[47]=d,e[48]=m,e[49]=j):j=e[49];let v;return e[50]!==f||e[51]!==b||e[52]!==j?(v=s.jsx("div",{className:"flex w-full flex-col overflow-hidden",children:s.jsxs("div",{className:"flex flex-col",children:[f,b,j]})}),e[50]=f,e[51]=b,e[52]=j,e[53]=v):v=e[53],v}function be(){const t=z.c(43),{data:e}=se.useSession(),{org:n}=X(),i=ie();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org",shouldThrow:!1},t[0]=o):o=t[0];const r=Ms(o)?.params.org,[a,m]=Ps(),c=Qe(),{isAdmin:d}=oi(),[u,x]=M.useState(!1),f=e?.user,h=f?.image,g=!!e?.session?.impersonatedBy;let p;t[1]===Symbol.for("react.memo_cache_sentinel")?(p=()=>x(!1),t[1]=p):p=t[1];const b=p;let j;t[2]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(ze,{size:16}),t[2]=j):j=t[2];let v;t[3]!==i||t[4]!==r?(v={key:"preferences",label:"Preferences",icon:j,onClick:()=>{i({to:"/$org/settings/profile",params:{org:r??""}})}},t[3]=i,t[4]=r,t[5]=v):v=t[5];let y;t[6]!==n||t[7]!==i?(y=n?[{key:"install-app",label:"Add to Home Screen",icon:s.jsx(Xn,{size:16}),onClick:()=>{i({to:"/$org/install",params:{org:n.slug}})}},{key:"connect-clients",label:"Connect to Agents",icon:s.jsx(Zn,{size:16}),onClick:()=>{i({to:"/$org/settings/connect",params:{org:n.slug}})}}]:[],t[6]=n,t[7]=i,t[8]=y):y=t[8];let S;t[9]===Symbol.for("react.memo_cache_sentinel")?(S={key:"terms",label:"Terms of Use",icon:s.jsx(Jn,{size:16}),href:"https://www.decocms.com/terms-of-use",external:!0},t[9]=S):S=t[9];let C;t[10]===Symbol.for("react.memo_cache_sentinel")?(C={key:"privacy",label:"Privacy Policy",icon:s.jsx(ni,{size:16}),href:"https://www.decocms.com/privacy-policy",external:!0},t[10]=C):C=t[10];let _;t[11]===Symbol.for("react.memo_cache_sentinel")?(_={key:"github",label:"decocms/studio",icon:s.jsx(Es,{className:"w-4 h-4"}),href:"https://github.com/decocms/studio",external:!0},t[11]=_):_=t[11];let N;t[12]===Symbol.for("react.memo_cache_sentinel")?(N={key:"community",label:"Community",icon:s.jsx(ii,{size:16}),href:"https://decocms.com/discord",external:!0},t[12]=N):N=t[12];let w;t[13]===Symbol.for("react.memo_cache_sentinel")?(w={key:"homepage",label:"Homepage",icon:s.jsx(Qn,{size:16}),href:"https://decocms.com",external:!0},t[13]=w):w=t[13];let I;t[14]!==d||t[15]!==i?(I=d?[{key:"admin-dashboard",label:"Admin Dashboard",icon:s.jsx(Kt,{size:16}),onClick:()=>i({to:"/_admin"}),className:"text-warning"}]:[],t[14]=d,t[15]=i,t[16]=I):I=t[16];let A;t[17]!==I||t[18]!==v||t[19]!==y?(A=[v,...y,S,C,_,N,w,...I],t[17]=I,t[18]=v,t[19]=y,t[20]=A):A=t[20];const k=A;let $;t[21]===Symbol.for("react.memo_cache_sentinel")?($={key:"logout",label:"Sign out",icon:s.jsx(ut,{size:16}),onClick:ho},t[21]=$):$=t[21];const O=$;let E;t[22]!==g?(E=g?{key:"stop-impersonating",label:"Stop impersonation",icon:s.jsx(ut,{size:16}),onClick:xo,className:"text-warning"}:null,t[22]=g,t[23]=E):E=t[23];const U=E;let R;t[24]===Symbol.for("react.memo_cache_sentinel")?(R={value:"light",icon:s.jsx(ti,{size:14}),label:"Light theme"},t[24]=R):R=t[24];let F;t[25]===Symbol.for("react.memo_cache_sentinel")?(F={value:"dark",icon:s.jsx(si,{size:14}),label:"Dark theme"},t[25]=F):F=t[25];let D;t[26]===Symbol.for("react.memo_cache_sentinel")?(D=[R,F,{value:"system",icon:s.jsx(Ge,{size:14}),label:"System theme"}],t[26]=D):D=t[26];const L=D;let H;t[27]!==g||t[28]!==c||t[29]!==k||t[30]!==a||t[31]!==m||t[32]!==U||t[33]!==f||t[34]!==h?(H={user:f,userImage:h,menuItems:k,signOutItem:O,stopImpersonatingItem:U,isImpersonating:g,themeOptions:L,preferences:a,setPreferences:m,close:b,isMobile:c},t[27]=g,t[28]=c,t[29]=k,t[30]=a,t[31]=m,t[32]=U,t[33]=f,t[34]=h,t[35]=H):H=t[35];const G=H;let W;return t[36]!==g||t[37]!==c||t[38]!==u||t[39]!==G||t[40]!==f?.name||t[41]!==h?(W=s.jsx(s.Fragment,{children:c?s.jsxs(Yt,{open:u,onOpenChange:x,direction:"bottom",children:[s.jsxs("button",{type:"button",onClick:()=>x(!0),className:P("flex items-center gap-3 w-full px-3 py-2.5 rounded-lg transition-colors text-sm text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground",g&&"border-2 border-dashed border-warning"),children:[s.jsx(Ue,{url:h,fallback:f?.name??"U",shape:"circle",size:"2xs",className:"shrink-0"}),s.jsx("span",{className:"truncate",children:f?.name??"Account"})]}),s.jsxs(Xt,{className:"h-[80dvh] p-0",children:[s.jsx(Qt,{className:"sr-only",children:"Account"}),s.jsx(jt,{...G})]})]}):s.jsxs(Ae,{open:u,onOpenChange:x,children:[s.jsx(xe,{asChild:!0,children:s.jsxs(Y,{tooltip:f?.name??"Account",className:P("rounded-md",g&&"border-2 border-dashed border-warning"),children:[s.jsx(Ue,{url:h,fallback:f?.name??"U",shape:"circle",size:"xs",className:"shrink-0"}),s.jsx("span",{className:"truncate",children:f?.name??"Account"})]})}),s.jsx(Ie,{side:"right",align:"end",sideOffset:18,collisionPadding:16,className:"w-[280px] p-0 flex flex-col max-h-[520px]",onCloseAutoFocus:fo,children:s.jsx(jt,{...G})})]})}),t[36]=g,t[37]=c,t[38]=u,t[39]=G,t[40]=f?.name,t[41]=h,t[42]=W):W=t[42],W}function fo(t){return t.preventDefault()}async function xo(){const{error:t}=await se.admin.stopImpersonating();if(t){ee.error(t.message||"Failed to stop impersonation");return}window.location.href="/"}function ho(){q("signed_out",{source:"account_popover"}),Ds(),se.signOut()}const po=["Browse and edit your Library files","Run your agents","Enable and call any MCP tool in this org"],go="Connect: ";function bo(){return typeof window>"u"?"unknown host":window.location.hostname}function jo(t){const e=z.c(45),{onClose:n}=t,{org:i}=X();let o;e[0]!==i.slug?(o=li(i.slug),e[0]=i.slug,e[1]=o):o=e[1];const l=o,r=ri(),[a,m]=M.useState(null),c=ft(),d=ft();let u;e[2]!==r||e[3]!==i.slug?(u=()=>{r.mutate({name:`${go}Claude Code on ${bo()}`,permissions:{"*":["*"]}},{onSuccess:U=>{const R=ai(i.slug,U.key);m(R),q("connect_studio_generate",{target:"claude-code"}),navigator.clipboard?.writeText(R).then(_o,So)},onError:yo})},e[2]=r,e[3]=i.slug,e[4]=u):u=e[4];const x=u;let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx("span",{className:"size-8 rounded-lg bg-special/15 text-special flex items-center justify-center shrink-0",children:s.jsx(ts,{size:17})}),e[5]=f):f=e[5];let h;e[6]!==i.name?(h=s.jsxs(Je,{className:"flex items-center gap-2.5",children:[f,"Connect ",i.name," to Claude"]}),e[6]=i.name,e[7]=h):h=e[7];let g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Ft,{children:"Hand Claude this org's MCP endpoint. Once linked, Claude can:"}),e[8]=g):g=e[8];let p;e[9]!==h?(p=s.jsxs(Rt,{children:[h,g]}),e[9]=h,e[10]=p):p=e[10];let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx("ul",{className:"flex flex-col gap-2 text-sm",children:po.map(vo)}),e[11]=b):b=e[11];let j;e[12]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(dt,{size:15,className:"text-muted-foreground"}),e[12]=j):j=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[j,"Claude Code",s.jsx("span",{className:"ml-auto text-[11px] font-medium text-special uppercase tracking-wide",children:"Recommended"})]}),e[13]=v):v=e[13];let y;e[14]!==a||e[15]!==c||e[16]!==r.isPending||e[17]!==x?(y=s.jsxs("section",{className:"rounded-xl border border-border bg-muted/30 p-4 flex flex-col gap-3",children:[v,a?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"rounded-lg border border-border bg-background p-3 max-h-32 overflow-y-auto",children:s.jsx("code",{className:"text-xs leading-relaxed break-all font-mono text-foreground/90 whitespace-pre-wrap",children:a})}),s.jsxs(le,{size:"sm",className:"gap-1.5 self-start",onClick:()=>{c.handleCopy(a),q("connect_studio_copy",{target:"claude-code"}),ee.success("Command copied — paste it in your terminal")},children:[c.copied?s.jsx(ve,{size:14}):s.jsx(He,{size:14}),c.copied?"Copied":"Copy command"]}),s.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-warning/40 bg-warning/10 px-3 py-2",children:[s.jsx(Kt,{size:14,className:"text-warning shrink-0 mt-0.5"}),s.jsxs("p",{className:"text-xs leading-relaxed text-foreground/80",children:["No login step — this command embeds a"," ",s.jsx("span",{className:"font-medium text-foreground",children:"full-access token"}),". Treat it like a password; revoke it any time in Settings → Connect."]})]})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"One command, no browser login. We'll mint a scoped access token and embed it so Claude Code connects instantly."}),s.jsxs(le,{size:"sm",className:"gap-1.5 self-start",disabled:r.isPending,onClick:x,children:[s.jsx(dt,{size:14}),r.isPending?"Generating…":"Generate connect command"]})]})]}),e[14]=a,e[15]=c,e[16]=r.isPending,e[17]=x,e[18]=y):y=e[18];let S,C;e[19]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[s.jsx(mn,{size:15,className:"text-muted-foreground"}),"Claude Desktop or claude.ai"]}),C=s.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"Add a custom connector in Settings → Connectors and paste this URL. Claude signs in with OAuth on first use."}),e[19]=S,e[20]=C):(S=e[19],C=e[20]);let _;e[21]!==l?(_=s.jsx("code",{className:"text-xs flex-1 min-w-0 truncate font-mono text-foreground/90",children:l}),e[21]=l,e[22]=_):_=e[22];let N;e[23]!==l||e[24]!==d?(N=()=>{d.handleCopy(l),q("connect_studio_copy",{target:"claude-connector"})},e[23]=l,e[24]=d,e[25]=N):N=e[25];let w;e[26]!==d.copied?(w=d.copied?s.jsx(ve,{size:14}):s.jsx(He,{size:14}),e[26]=d.copied,e[27]=w):w=e[27];let I;e[28]!==N||e[29]!==w?(I=s.jsx(le,{variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"Copy URL",onClick:N,children:w}),e[28]=N,e[29]=w,e[30]=I):I=e[30];let A;e[31]!==_||e[32]!==I?(A=s.jsxs("section",{className:"flex flex-col gap-2.5",children:[S,C,s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/30 pl-3 pr-1.5 py-1.5 min-w-0",children:[_,I]})]}),e[31]=_,e[32]=I,e[33]=A):A=e[33];let k;e[34]!==i.slug?(k={org:i.slug},e[34]=i.slug,e[35]=k):k=e[35];let $;e[36]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(et,{size:12}),e[36]=$):$=e[36];let O;e[37]!==n||e[38]!==k?(O=s.jsx("div",{className:"flex items-center border-t border-border pt-3",children:s.jsx(le,{asChild:!0,variant:"link",size:"sm",className:"px-0 text-xs gap-1",children:s.jsxs(Mt,{to:"/$org/settings/connect",params:k,onClick:n,children:["More clients & API keys ",$]})})}),e[37]=n,e[38]=k,e[39]=O):O=e[39];let E;return e[40]!==y||e[41]!==A||e[42]!==O||e[43]!==p?(E=s.jsxs("div",{className:"flex flex-col gap-4 min-w-0",children:[p,b,y,A,O]}),e[40]=y,e[41]=A,e[42]=O,e[43]=p,e[44]=E):E=e[44],E}function vo(t){return s.jsxs("li",{className:"flex items-center gap-2.5",children:[s.jsx("span",{className:"size-4 rounded-full bg-special/15 text-special flex items-center justify-center shrink-0",children:s.jsx(ve,{size:11,strokeWidth:3})}),s.jsx("span",{className:"text-foreground",children:t})]},t)}function yo(t){return ee.error(t.message)}function So(){return ee.success("Command ready — copy it below")}function _o(){return ee.success("Command copied — paste it in your terminal")}function No(t){const e=z.c(6),{open:n,onOpenChange:i}=t;let o;e[0]!==i?(o=s.jsx(Dt,{className:"max-w-lg gap-4",children:s.jsx(jo,{onClose:()=>i(!1)})}),e[0]=i,e[1]=o):o=e[1];let l;return e[2]!==i||e[3]!==n||e[4]!==o?(l=s.jsx(Ze,{open:n,onOpenChange:i,children:o}),e[2]=i,e[3]=n,e[4]=o,e[5]=l):l=e[5],l}function je(t){const e=z.c(43),{variant:n}=t===void 0?{}:t,i=n===void 0?"icon":n,o=On(),[l,r]=M.useState(!1);let a,m;if(e[0]!==o.capabilities||e[1]!==o.hostname||e[2]!==o.machineId||e[3]!==o.online){const v=ci(o.capabilities);a=o.online?"Desktop linked":"Connect desktop",m=o.online?s.jsxs("div",{className:"flex flex-col gap-0.5 text-xs",children:[s.jsx("span",{className:"font-medium",children:o.hostname??o.machineId??"Desktop linked"}),s.jsx("span",{className:"text-muted-foreground",children:v.length>0?`Available: ${v.join(", ")}`:"No CLI agents detected"})]}):s.jsx("span",{className:"text-xs",children:"Desktop disconnected"}),e[0]=o.capabilities,e[1]=o.hostname,e[2]=o.machineId,e[3]=o.online,e[4]=a,e[5]=m}else a=e[4],m=e[5];const c=m;if(i==="full"){let v,y;e[6]===Symbol.for("react.memo_cache_sentinel")?(v=()=>r(!0),y=s.jsx(Ge,{}),e[6]=v,e[7]=y):(v=e[6],y=e[7]);let S;e[8]!==a?(S=s.jsx("span",{children:a}),e[8]=a,e[9]=S):S=e[9];let C;e[10]!==o.online?(C=o.online&&s.jsx("span",{className:"ml-auto size-2 rounded-full bg-success animate-pulse"}),e[10]=o.online,e[11]=C):C=e[11];let _;e[12]!==a||e[13]!==S||e[14]!==C?(_=s.jsx(ae,{asChild:!0,children:s.jsxs(Y,{tooltip:a,onClick:v,children:[y,S,C]})}),e[12]=a,e[13]=S,e[14]=C,e[15]=_):_=e[15];let N;e[16]!==c?(N=s.jsx(ce,{side:"right",children:c}),e[16]=c,e[17]=N):N=e[17];let w;e[18]!==_||e[19]!==N?(w=s.jsxs(de,{children:[_,N]}),e[18]=_,e[19]=N,e[20]=w):w=e[20];let I;e[21]!==l?(I=s.jsx(xt,{open:l,onOpenChange:r}),e[21]=l,e[22]=I):I=e[22];let A;return e[23]!==I||e[24]!==w?(A=s.jsxs(s.Fragment,{children:[w,I]}),e[23]=I,e[24]=w,e[25]=A):A=e[25],A}let d;e[26]===Symbol.for("react.memo_cache_sentinel")?(d=()=>r(!0),e[26]=d):d=e[26];const u=o.online?"Desktop linked":"Connect your desktop";let x;e[27]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Ge,{size:16}),e[27]=x):x=e[27];let f;e[28]!==o.online?(f=o.online&&s.jsx("span",{className:"absolute top-1 right-1 size-2 rounded-full bg-success ring-2 ring-background animate-pulse"}),e[28]=o.online,e[29]=f):f=e[29];let h;e[30]!==u||e[31]!==f?(h=s.jsx(ae,{asChild:!0,children:s.jsxs(ue,{onClick:d,"aria-label":u,children:[x,f]})}),e[30]=u,e[31]=f,e[32]=h):h=e[32];let g;e[33]!==c?(g=s.jsx(ce,{side:"bottom",children:c}),e[33]=c,e[34]=g):g=e[34];let p;e[35]!==h||e[36]!==g?(p=s.jsxs(de,{children:[h,g]}),e[35]=h,e[36]=g,e[37]=p):p=e[37];let b;e[38]!==l?(b=s.jsx(xt,{open:l,onOpenChange:r}),e[38]=l,e[39]=b):b=e[39];let j;return e[40]!==b||e[41]!==p?(j=s.jsxs(s.Fragment,{children:[p,b]}),e[40]=b,e[41]=p,e[42]=j):j=e[42],j}class Co extends M.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,n){}render(){return this.state.hasError?null:this.props.children}}function wo(t){return t<=1?"text-destructive":t<=5?"text-warning":"text-foreground/70"}function ko(){const t=z.c(17),e=ie(),{org:n}=X(),{hasDecoKey:i,balanceDollars:o}=Kn();if(!i)return null;let l;t[0]!==o?(l=o!=null?`Credits: $${o.toFixed(2)}`:"Credits",t[0]=o,t[1]=l):l=t[1];let r;t[2]!==o?(r=P(o!=null&&wo(o)),t[2]=o,t[3]=r):r=t[3];let a;t[4]!==e||t[5]!==n.slug?(a=()=>e({to:"/$org/settings/ai-providers",params:{org:n.slug}}),t[4]=e,t[5]=n.slug,t[6]=a):a=t[6];let m;t[7]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(un,{}),t[7]=m):m=t[7];let c;t[8]!==o?(c=o!=null?`$${o.toFixed(2)}`:"Credits",t[8]=o,t[9]=c):c=t[9];let d;t[10]!==c?(d=s.jsx("span",{children:c}),t[10]=c,t[11]=d):d=t[11];let u;return t[12]!==l||t[13]!==r||t[14]!==a||t[15]!==d?(u=s.jsx(te,{children:s.jsx(B,{children:s.jsxs(Y,{tooltip:l,className:r,onClick:a,children:[m,d]})})}),t[12]=l,t[13]=r,t[14]=a,t[15]=d,t[16]=u):u=t[16],u}function vt(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Co,{children:s.jsx(M.Suspense,{fallback:null,children:s.jsx(ko,{})})}),t[0]=e):e=t[0],e}function Fe(){const t=z.c(7),e=ie(),{org:n}=X();let i;t[0]!==e||t[1]!==n.slug?(i=()=>e({to:"/$org/settings",params:{org:n.slug}}),t[0]=e,t[1]=n.slug,t[2]=i):i=t[2];let o,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ze,{}),l=s.jsx("span",{children:"Settings"}),t[3]=o,t[4]=l):(o=t[3],l=t[4]);let r;return t[5]!==i?(r=s.jsxs(Y,{tooltip:"Settings",onClick:i,children:[o,l]}),t[5]=i,t[6]=r):r=t[6],r}function Io(){const t=z.c(6),e=ie(),{org:n}=X();let i;t[0]!==e||t[1]!==n.slug?(i=()=>e({to:"/$org/settings",params:{org:n.slug}}),t[0]=e,t[1]=n.slug,t[2]=i):i=t[2];let o;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ze,{size:15}),t[3]=o):o=t[3];let l;return t[4]!==i?(l=s.jsx("button",{type:"button","aria-label":"Settings",onClick:i,className:"shrink-0 flex items-center justify-center size-7 rounded-md text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",children:o}),t[4]=i,t[5]=l):l=t[5],l}function yt(){const t=z.c(10),[e,n]=M.useState(!1),[i,o]=M.useState(!1);let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(B,{children:s.jsx(ss,{trigger:s.jsxs(Y,{tooltip:"Invite members",children:[s.jsx(Vt,{}),s.jsx("span",{children:"Invite members"})]})})}),t[0]=l):l=t[0];let r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(B,{children:s.jsxs(Y,{tooltip:"Add connection",onClick:()=>n(!0),children:[s.jsx(ei,{}),s.jsx("span",{children:"Add connection"})]})}),t[1]=r):r=t[1];let a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs(te,{className:"gap-0.5",children:[l,r,s.jsx(B,{children:s.jsxs(Y,{tooltip:"Connect to Claude",onClick:()=>{q("connect_studio_opened",{source:"sidebar_footer"}),o(!0)},children:[s.jsx(ts,{}),s.jsx("span",{children:"Connect to Claude"})]})})]}),t[2]=a):a=t[2];let m;t[3]!==e?(m=s.jsx(Vn,{open:e,onOpenChange:n,mode:"browse"}),t[3]=e,t[4]=m):m=t[4];let c;t[5]!==i?(c=s.jsx(No,{open:i,onOpenChange:o}),t[5]=i,t[6]=c):c=t[6];let d;return t[7]!==m||t[8]!==c?(d=s.jsxs(s.Fragment,{children:[a,m,c]}),t[7]=m,t[8]=c,t[9]=d):d=t[9],d}function St(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{className:"gap-0.5",children:s.jsx(B,{children:s.jsx(ss,{trigger:s.jsxs(Y,{tooltip:"Invite members",children:[s.jsx(Vt,{}),s.jsx("span",{children:"Invite members"})]})})})}),t[0]=e):e=t[0],e}function Ao(){const t=z.c(17),{state:e}=re(),n=e==="collapsed";if($e()){if(n){let x;t[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(St,{}),t[0]=x):x=t[0];let f;t[1]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(B,{children:s.jsx("div",{className:"flex justify-center",children:s.jsx(je,{})})}),t[1]=f):f=t[1];let h;t[2]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(B,{children:s.jsx(Fe,{})}),t[2]=h):h=t[2];let g;return t[3]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsxs(he,{className:"px-2 pb-3 gap-1",children:[x,s.jsxs(te,{children:[f,h,s.jsx(B,{children:s.jsx(be,{})})]})]}),t[3]=g):g=t[3],g}let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(St,{}),t[4]=c):c=t[4];let d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(B,{children:s.jsx(je,{variant:"full"})}),t[5]=d):d=t[5];let u;return t[6]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs(he,{className:"px-2 pb-3 gap-0.5",children:[c,s.jsxs(te,{className:"gap-0.5",children:[d,s.jsx(B,{children:s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(be,{})}),s.jsx(Io,{})]})})]})]}),t[6]=u):u=t[6],u}if(n){let c,d;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(yt,{}),d=s.jsx(vt,{}),t[7]=c,t[8]=d):(c=t[7],d=t[8]);let u;t[9]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(B,{children:s.jsx("div",{className:"flex justify-center",children:s.jsx(je,{})})}),t[9]=u):u=t[9];let x;t[10]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(B,{children:s.jsx(Fe,{})}),t[10]=x):x=t[10];let f;return t[11]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsxs(he,{className:"px-2 pb-3 gap-1",children:[c,d,s.jsxs(te,{children:[u,x,s.jsx(B,{children:s.jsx(be,{})})]})]}),t[11]=f):f=t[11],f}let o,l;t[12]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(yt,{}),l=s.jsx(vt,{}),t[12]=o,t[13]=l):(o=t[12],l=t[13]);let r;t[14]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(B,{children:s.jsx(je,{variant:"full"})}),t[14]=r):r=t[14];let a;t[15]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(B,{children:s.jsx(Fe,{})}),t[15]=a):a=t[15];let m;return t[16]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsxs(he,{className:"px-2 pb-3 gap-0.5",children:[o,l,s.jsxs(te,{className:"gap-0.5",children:[r,a,s.jsx(B,{children:s.jsx(be,{})})]})]}),t[16]=m):m=t[16],m}function zo(){const t=z.c(8),e=ie(),{org:n}=X(),{setOpenMobile:i}=re();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(te,{children:s.jsx(B,{children:s.jsx(be,{})})})}),t[0]=o):o=t[0];let l;t[1]!==e||t[2]!==n.slug||t[3]!==i?(l=()=>{e({to:"/$org/settings",params:{org:n.slug}}),i(!1)},t[1]=e,t[2]=n.slug,t[3]=i,t[4]=l):l=t[4];let r;t[5]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(ze,{className:"size-4"}),t[5]=r):r=t[5];let a;return t[6]!==l?(a=s.jsx(he,{className:"px-2 pb-3",children:s.jsxs("div",{className:"flex items-center gap-1",children:[o,s.jsx(ue,{"aria-label":"Settings",onClick:l,children:r})]})}),t[6]=l,t[7]=a):a=t[7],a}function _t(t){const e=z.c(15),{className:n,wrapperClassName:i,children:o}=t,[l,r]=M.useState(!1);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=b=>{b&&r(b.scrollHeight>b.clientHeight+1)},e[0]=a):a=e[0];const m=a;let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=b=>{const j=b.currentTarget;r(j.scrollHeight-j.scrollTop>j.clientHeight+1)},e[1]=c):c=e[1];const d=c;let u;e[2]!==i?(u=P("relative",i),e[2]=i,e[3]=u):u=e[3];let x;e[4]!==o||e[5]!==n?(x=s.jsx("div",{ref:m,onScroll:d,className:n,children:o}),e[4]=o,e[5]=n,e[6]=x):x=e[6];const f=l?"opacity-100":"opacity-0";let h;e[7]!==f?(h=P("pointer-events-none absolute right-0 bottom-0 left-0 h-10 bg-gradient-to-t from-sidebar to-transparent transition-opacity duration-150",f),e[7]=f,e[8]=h):h=e[8];let g;e[9]!==h?(g=s.jsx("div",{"aria-hidden":!0,className:h}),e[9]=h,e[10]=g):g=e[10];let p;return e[11]!==u||e[12]!==x||e[13]!==g?(p=s.jsxs("div",{className:u,children:[x,g]}),e[11]=u,e[12]=x,e[13]=g,e[14]=p):p=e[14],p}function $o(t){const e=z.c(8),{virtualMcpId:n,size:i,showAutomationBadge:o}=t,l=i===void 0?"sm":i;let r;e[0]!==l||e[1]!==n?(r=n?s.jsx(To,{virtualMcpId:n,size:l}):s.jsx(me,{icon:null,name:"?",size:l}),e[0]=l,e[1]=n,e[2]=r):r=e[2];let a;e[3]!==o?(a=o&&s.jsx("span",{"aria-label":"Automation-triggered",className:"absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full bg-blue-500 border border-blue-600 text-white",children:s.jsx(is,{size:10,className:"text-white"})}),e[3]=o,e[4]=a):a=e[4];let m;return e[5]!==r||e[6]!==a?(m=s.jsxs("div",{className:"relative shrink-0",children:[r,a]}),e[5]=r,e[6]=a,e[7]=m):m=e[7],m}function To(t){const e=z.c(6),{virtualMcpId:n,size:i}=t,o=st(n);if(!o){let a;return e[0]!==i?(a=s.jsx(me,{icon:null,name:"?",size:i}),e[0]=i,e[1]=a):a=e[1],a}const l=o.icon??null;let r;return e[2]!==o.title||e[3]!==i||e[4]!==l?(r=s.jsx(me,{icon:l,name:o.title,size:i}),e[2]=o.title,e[3]=i,e[4]=l,e[5]=r):r=e[5],r}function Nt(t){const e=z.c(36),{open:n,onOpenChange:i}=t,[o,l]=M.useState(""),{org:r}=X(),{setTaskId:a}=it(),m=ns();let c,d,u;e[0]!==r.id||e[1]!==o?(u=o.trim(),d=Fs,c=Tt.globalSearch(r.id,u),e[0]=r.id,e[1]=o,e[2]=c,e[3]=d,e[4]=u):(c=e[2],d=e[3],u=e[4]);const x=n&&u.length>0;let f;e[5]!==m||e[6]!==u?(f=async()=>await m.call("GLOBAL_SEARCH",{query:u,limit:20}),e[5]=m,e[6]=u,e[7]=f):f=e[7];let h;e[8]!==c||e[9]!==x||e[10]!==f?(h={queryKey:c,enabled:x,queryFn:f,staleTime:1e4},e[8]=c,e[9]=x,e[10]=f,e[11]=h):h=e[11];const{data:g,isFetching:p}=d(h);let b;e[12]!==g?.items?(b=g?.items??[],e[12]=g?.items,e[13]=b):b=e[13];const j=b;let v;e[14]!==i?(v=$=>{$||l(""),i($)},e[14]=i,e[15]=v):v=e[15];const y=v;let S;e[16]!==y||e[17]!==a?(S=$=>{y(!1),a($.id,$.virtual_mcp_id??void 0)},e[16]=y,e[17]=a,e[18]=S):S=e[18];const C=S;let _;e[19]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(Rt,{className:"sr-only",children:[s.jsx(Je,{children:"Search"}),s.jsx(Ft,{children:"Search across your organization's resources."})]}),e[19]=_):_=e[19];let N;e[20]!==o?(N=s.jsx(hi,{value:o,onValueChange:l,placeholder:"Search..."}),e[20]=o,e[21]=N):N=e[21];let w;e[22]!==C||e[23]!==p||e[24]!==j||e[25]!==u?(w=u?p&&j.length===0?s.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching…"}):j.length===0?s.jsx(fi,{children:"No results."}):j.map($=>$.type==="thread"?s.jsxs(xi,{value:`thread:${$.id}:${$.title}`,onSelect:()=>C($),className:"gap-2.5",children:[s.jsx($o,{virtualMcpId:$.virtual_mcp_id,size:"xs"}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("div",{className:"text-sm text-foreground truncate",children:$.title||"Untitled chat"})}),s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:new Date($.updated_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]},`thread:${$.id}`):null):s.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Start typing to search."}),e[22]=C,e[23]=p,e[24]=j,e[25]=u,e[26]=w):w=e[26];let I;e[27]!==w?(I=s.jsx(pi,{children:w}),e[27]=w,e[28]=I):I=e[28];let A;e[29]!==N||e[30]!==I?(A=s.jsxs(Dt,{className:"overflow-hidden p-0",closeButtonClassName:"hidden",children:[_,s.jsxs(gi,{shouldFilter:!1,className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:[N,I]})]}),e[29]=N,e[30]=I,e[31]=A):A=e[31];let k;return e[32]!==y||e[33]!==n||e[34]!==A?(k=s.jsx(Ze,{open:n,onOpenChange:y,children:A}),e[32]=y,e[33]=n,e[34]=A,e[35]=k):k=e[35],k}function Oo(t){return t==="ephemeral"||t.startsWith("thread:")}function fs(t){const e=z.c(40),{task:n,isActive:i,onClick:o,onArchive:l,showAutomationBadge:r,showAgentIcon:a,hideStatusIdle:m,indented:c}=t,d=vi(n.status),u=d.icon,x=n.metadata?.kind==="tool_call_run",f=st(x?void 0:n.virtual_mcp_id);let h;e[0]!==f?(h=qn(f),e[0]=f,e[1]=h):h=e[1];const g=h;yi(6e4);const p=r||!!n.trigger_id,b=n.id,j="button",v=0;let y;e[2]!==o?(y=L=>{L.target===L.currentTarget&&(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),o())},e[2]=o,e[3]=y):y=e[3];const S=c?"-ml-4 pl-6":"pl-[7px]",C=i?"bg-accent text-accent-foreground":"hover:bg-accent/60";let _;e[4]!==S||e[5]!==C?(_=P("group/row flex items-center gap-2 py-1.5 rounded-md cursor-pointer transition-colors",S,"focus-visible:outline-none focus-visible:inset-ring-2 focus-visible:inset-ring-ring/50",C),e[4]=S,e[5]=C,e[6]=_):_=e[6];let N;e[7]!==x||e[8]!==a||e[9]!==f?.icon||e[10]!==f?.title?(N=a&&!x&&s.jsx(me,{icon:f?.icon??null,name:f?.title??"?",size:"2xs"}),e[7]=x,e[8]=a,e[9]=f?.icon,e[10]=f?.title,e[11]=N):N=e[11];let w;e[12]!==p?(w=p&&s.jsx(is,{size:12,"aria-label":"Automation-triggered",className:"shrink-0 text-blue-500"}),e[12]=p,e[13]=w):w=e[13];const I=n.title||"Untitled task";let A;e[14]!==I?(A=s.jsx("div",{className:"text-sm text-foreground truncate",children:I}),e[14]=I,e[15]=A):A=e[15];let k;e[16]!==w||e[17]!==A?(k=s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[w,A]}),e[16]=w,e[17]=A,e[18]=k):k=e[18];let $;e[19]!==g||e[20]!==i||e[21]!==n.branch||e[22]!==n.updated_at?($=n.updated_at&&s.jsxs("div",{className:P("flex items-center gap-1 text-[11px] min-w-0",i?"text-accent-foreground/70":"text-muted-foreground/60"),children:[n.branch&&!Oo(n.branch)?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"truncate font-mono",children:n.branch}),s.jsx("span",{className:"shrink-0",children:"·"})]}):g?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"truncate",children:[g.owner,"/",g.name]}),s.jsx("span",{className:"shrink-0",children:"·"})]}):null,s.jsx("span",{className:"shrink-0",children:_i(new Date(n.updated_at))})]}),e[19]=g,e[20]=i,e[21]=n.branch,e[22]=n.updated_at,e[23]=$):$=e[23];let O;e[24]!==k||e[25]!==$?(O=s.jsxs("div",{className:"flex-1 min-w-0",children:[k,$]}),e[24]=k,e[25]=$,e[26]=O):O=e[26];const E="shrink-0 grid [grid-template-areas:'slot'] items-center justify-items-center",U=!m&&s.jsx("span",{className:P("[grid-area:slot] flex size-8 items-center justify-center pointer-events-none transition-opacity",l&&"group-hover/row:opacity-0"),"aria-label":d.label,children:s.jsx(u,{size:14,className:P(d.iconClassName,n.status==="in_progress"&&"animate-spin")})});let R;e[27]!==l?(R=l&&s.jsxs(de,{children:[s.jsx(ae,{asChild:!0,children:s.jsx("button",{type:"button","aria-label":"Archive task",onClick:L=>{L.stopPropagation(),l()},className:"[grid-area:slot] opacity-0 pointer-events-none group-hover/row:opacity-100 group-hover/row:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto transition-opacity flex size-8 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:s.jsx(Rs,{size:14})})}),s.jsx(ce,{side:"right",children:"Archive"})]}),e[27]=l,e[28]=R):R=e[28];let F;e[29]!==U||e[30]!==R?(F=s.jsxs("div",{className:E,children:[U,R]}),e[29]=U,e[30]=R,e[31]=F):F=e[31];let D;return e[32]!==o||e[33]!==O||e[34]!==F||e[35]!==y||e[36]!==_||e[37]!==N||e[38]!==n.id?(D=s.jsxs("div",{"data-task-id":b,role:j,tabIndex:v,onClick:o,onKeyDown:y,className:_,children:[N,O,F]}),e[32]=o,e[33]=O,e[34]=F,e[35]=y,e[36]=_,e[37]=N,e[38]=n.id,e[39]=D):D=e[39],D}const Ct=["requires_action","in_progress","failed","expired","completed"];function Mo(t){const e=new Map(Ct.map(n=>[n,[]]));for(const n of t){const i=n.status??"completed";(e.get(i)??e.get("completed")).push(n)}return Ct.map(n=>({status:n,threads:e.get(n)}))}const Po="sidebar.group.expanded.";function Eo(t,e){const n=z.c(3),[i,o]=we(`${Po}${t}`,e);let l;return n[0]!==i||n[1]!==o?(l=[i,o],n[0]=i,n[1]=o,n[2]=l):l=n[2],l}function xs(t){const e=z.c(12),{onClick:n,isFetching:i,indented:o}=t,l=o?"-ml-4 pl-6 pr-2":"px-2";let r;e[0]!==l?(r=P("flex items-center gap-2 py-1.5 rounded-md text-sm text-muted-foreground",l,"hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","transition-colors disabled:cursor-progress disabled:opacity-60"),e[0]=l,e[1]=r):r=e[1];let a;e[2]!==i?(a=i&&s.jsx(Ot,{size:14,className:"animate-spin"}),e[2]=i,e[3]=a):a=e[3];const m=i?"Loading…":"Show more";let c;e[4]!==m?(c=s.jsx("span",{children:m}),e[4]=m,e[5]=c):c=e[5];let d;return e[6]!==i||e[7]!==n||e[8]!==r||e[9]!==a||e[10]!==c?(d=s.jsxs("button",{type:"button","aria-label":"Show more tasks",onClick:n,disabled:i,className:r,children:[a,c]}),e[6]=i,e[7]=n,e[8]=r,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function Do(t,e,n,i){return[t,e,n,i.type,i.member,i.currentUserId??""].join("|")}function Fo(t){return t.member==="mine"&&!t.currentUserId}const hs=4;let _e=0;const Ke=[];function Ro(){for(;_e<hs&&Ke.length>0;){const t=Ke.shift();t&&t()}}function ps(t){return new Promise((e,n)=>{const i=()=>{_e++,t().then(e,n).finally(()=>{_e--,Ro()})};_e<hs?i():Ke.push(i)})}const Me=10;function wt(t,e,n,i,o){const l={hidden:!1};i.member==="mine"&&i.currentUserId&&(l.created_by=i.currentUserId),i.type==="automation"&&(l.has_trigger=!0),i.type==="manual"&&(l.has_trigger=!1);const r={where:l,limit:o,offset:n,orderBy:[{field:["updated_at"],direction:"desc"}]};return r.status=e,r}function Lo(t,e,n,i){let o=0;for(const l of t)gs(l,e,n,i)&&o++;return o}function Re(t,e,n,i){return Lo(t,e,n,i)}function Bo(t,e){return!!(t>=Me||t===0&&e)}function kt(t,e){return t<e}function Uo(t,e){return e===!1?!1:e===!0?!0:t}function gs(t,e,n,i){return!(t.hidden||(t.status??"completed")!==n||i.member==="mine"&&i.currentUserId&&t.created_by!==i.currentUserId||i.type==="automation"&&!t.trigger_id||i.type==="manual"&&t.trigger_id)}const Ce=new Map,Se=new Map;function Ho(t,e){return e?t>=Me?!0:null:!1}function It(t){return Ce.get(t)}function Go(t,e){Ce.set(t,e)}function Wo(t,e,n){const i=Ce.get(t);if(i!==void 0){n(i);return}let o=Se.get(t);o||(o=ps(e).then(l=>(Ce.set(t,l),Se.delete(t),l)).catch(()=>(Se.delete(t),Promise.reject(new Error("group probe failed")))),Se.set(t,o)),o.then(n,()=>n(!1))}function At(t){const e=t,n=Array.isArray(e.items)?e.items:[];return{items:n,hasMore:e.hasMore??n.length===Me,totalCount:typeof e.totalCount=="number"?e.totalCount:void 0}}function Ko(t,e,n,i,o){let l=0;for(const r of t)e.has(r.id)||gs(r,n,i,o)&&l++;return l}function Vo(t,e,n,i){const o=z.c(8),{org:l}=X(),r=Do(l.id,t,e,n);let a;o[0]!==n?(a=Fo(n),o[0]=n,o[1]=a):a=o[1];const m=a,[c,d]=M.useState({isFetching:!1,isProbing:!1,identity:r,probeSubscribedIdentity:null,serverHasMore:null});c.identity!==r&&d({isFetching:!1,isProbing:!1,identity:r,probeSubscribedIdentity:null,serverHasMore:null});const u=Dn(),{threads:x,hasMore:f}=nt(),h=Re(x,t,e,n),g=Bo(h,f),p=Ho(h,f),b=ns();if(c.identity===r&&c.serverHasMore===null){const _=p??It(r);_!==void 0&&d({isFetching:!1,isProbing:!1,identity:r,probeSubscribedIdentity:c.probeSubscribedIdentity,serverHasMore:_})}!m&&c.identity===r&&c.serverHasMore===null&&p===null&&It(r)===void 0&&c.probeSubscribedIdentity!==r&&(d(_=>_.identity===r?{..._,isProbing:!0,probeSubscribedIdentity:r}:_),Wo(r,async()=>{const _=wt(t,e,0,n,1),N=await b.call("COLLECTION_THREADS_LIST",_),{totalCount:w}=At(N),I=Re(u.threads.get(),t,e,n);return w===void 0?!1:kt(I,w)},_=>{d(N=>N.identity!==r?N:{...N,isProbing:!1,serverHasMore:_})}));const v=async function(){if(c.isFetching||c.isProbing||m)return;const N=r;d(w=>w.identity===N?{...w,isFetching:!0}:w);try{const w=Re(x,t,e,n),I=wt(t,e,w,n,Me),A=await ps(()=>b.call("COLLECTION_THREADS_LIST",I)),{items:k,hasMore:$,totalCount:O}=At(A),E=new Set(x.map(qo)),U=Ko(k,E,t,e,n),R=w;u.mergeThreads(k),d(F=>{if(F.identity!==N)return F;let D;return O!==void 0?D=kt(R+U,O):D=k.length===0||U===0?!1:$,Go(N,D),{...F,isFetching:!1,serverHasMore:D}})}catch(w){const I=w,A=I instanceof Error?I.message:String(I);ee.error(`Could not load more tasks: ${A}`),d(k=>k.identity===N?{...k,isFetching:!1}:k)}},y=c.isFetching||c.isProbing,S=!m&&!y&&Uo(g,c.serverHasMore);let C;return o[2]!==y||o[3]!==v||o[4]!==S||o[5]!==c.isProbing||o[6]!==c.serverHasMore?(C={hasMore:S,isFetching:y,isProbing:c.isProbing,serverHasMore:c.serverHasMore,loadMore:v},o[2]=y,o[3]=v,o[4]=S,o[5]=c.isProbing,o[6]=c.serverHasMore,o[7]=C):C=o[7],C}function qo(t){return t.id}function Yo(t){const e=z.c(20),{status:n,threads:i,activeTaskId:o,onSelectTask:l,onArchiveTask:r,canArchive:a,filters:m}=t,{isFetching:c,isProbing:d,loadMore:u,hasMore:x,serverHasMore:f}=Vo("status",n,m),[h,g]=M.useState(!1);!h&&i.length===0&&f===!0&&!c&&!d&&(g(!0),queueMicrotask(()=>{u()}));let p;if(e[0]!==o||e[1]!==a||e[2]!==m||e[3]!==r||e[4]!==l||e[5]!==i){let v;e[7]!==o||e[8]!==a||e[9]!==m||e[10]!==r||e[11]!==l?(v=y=>s.jsx(fs,{task:y,isActive:o===y.id,onClick:()=>l(y),onArchive:a&&y.created_by===m.currentUserId?()=>r(y):void 0,showAutomationBadge:!!y.trigger_id,showAgentIcon:!0,hideStatusIdle:!0,indented:!0},y.id),e[7]=o,e[8]=a,e[9]=m,e[10]=r,e[11]=l,e[12]=v):v=e[12],p=i.map(v),e[0]=o,e[1]=a,e[2]=m,e[3]=r,e[4]=l,e[5]=i,e[6]=p}else p=e[6];let b;e[13]!==x||e[14]!==c||e[15]!==u?(b=(x||c)&&s.jsx(xs,{onClick:()=>{u()},isFetching:c,indented:!0}),e[13]=x,e[14]=c,e[15]=u,e[16]=b):b=e[16];let j;return e[17]!==p||e[18]!==b?(j=s.jsxs(s.Fragment,{children:[p,b]}),e[17]=p,e[18]=b,e[19]=j):j=e[19],j}function Xo(t){const e=z.c(36),{status:n,threads:i,activeTaskId:o,onSelectTask:l,onArchiveTask:r,canArchive:a,filters:m}=t,c=Si[n],d=c.icon,[u,x]=Eo(`status-${n}`,!1);let f;e[0]!==u||e[1]!==x?(f=function(){x(!u)},e[0]=u,e[1]=x,e[2]=f):f=e[2];const h=f;let g;e[3]!==h?(g=N=>{N.target===N.currentTarget&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),h())},e[3]=h,e[4]=g):g=e[4];let p;e[5]!==d||e[6]!==c.iconClassName?(p=s.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:s.jsx(d,{size:12,className:c.iconClassName})}),e[5]=d,e[6]=c.iconClassName,e[7]=p):p=e[7];let b;e[8]!==u?(b=s.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground opacity-0 transition-opacity group-hover/group:opacity-100",children:u?s.jsx(tt,{size:14}):s.jsx(Ni,{size:14})}),e[8]=u,e[9]=b):b=e[9];let j;e[10]!==p||e[11]!==b?(j=s.jsxs("div",{className:"relative size-5 shrink-0 flex items-center justify-center",children:[p,b]}),e[10]=p,e[11]=b,e[12]=j):j=e[12];let v;e[13]!==c.label?(v=s.jsx("span",{className:"flex-1 truncate",children:c.label}),e[13]=c.label,e[14]=v):v=e[14];let y;e[15]!==i.length?(y=s.jsx("div",{className:"size-5 shrink-0 flex items-center justify-center",children:s.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:i.length})}),e[15]=i.length,e[16]=y):y=e[16];let S;e[17]!==u||e[18]!==h||e[19]!==g||e[20]!==j||e[21]!==v||e[22]!==y?(S=s.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":u,onClick:h,onKeyDown:g,className:"group/group flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-medium text-foreground cursor-pointer hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 transition-colors",children:[j,v,y]}),e[17]=u,e[18]=h,e[19]=g,e[20]=j,e[21]=v,e[22]=y,e[23]=S):S=e[23];let C;e[24]!==o||e[25]!==a||e[26]!==u||e[27]!==m||e[28]!==r||e[29]!==l||e[30]!==n||e[31]!==i?(C=u&&s.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:s.jsx(Yo,{status:n,threads:i,activeTaskId:o,onSelectTask:l,onArchiveTask:r,canArchive:a,filters:m})}),e[24]=o,e[25]=a,e[26]=u,e[27]=m,e[28]=r,e[29]=l,e[30]=n,e[31]=i,e[32]=C):C=e[32];let _;return e[33]!==S||e[34]!==C?(_=s.jsxs("div",{className:"flex flex-col gap-0.5",children:[S,C]}),e[33]=S,e[34]=C,e[35]=_):_=e[35],_}function zt(t){const e=z.c(38),{threads:n,groupBy:i,activeTaskId:o,onSelectTask:l,onArchiveTask:r,filters:a,hasMore:m,isFetchingMore:c,onLoadMore:d,filtersActive:u}=t;if(n.length===0&&!m&&!c){let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(ji,{className:"size-6 opacity-60"}),e[0]=p):p=e[0];const b=u?"No chats match your filters":"No chats yet";let j;return e[1]!==b?(j=s.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",children:[p,s.jsx("p",{className:"text-sm",children:b})]}),e[1]=b,e[2]=j):j=e[2],j}const x=n.length>1||m;if(i==="status"){let p;if(e[3]!==o||e[4]!==x||e[5]!==a||e[6]!==r||e[7]!==l||e[8]!==n){let j;e[10]!==o||e[11]!==x||e[12]!==a||e[13]!==r||e[14]!==l?(j=v=>s.jsx(Xo,{status:v.status,threads:v.threads,activeTaskId:o,onSelectTask:l,onArchiveTask:r,canArchive:x,filters:a},v.status),e[10]=o,e[11]=x,e[12]=a,e[13]=r,e[14]=l,e[15]=j):j=e[15],p=Mo(n).map(j),e[3]=o,e[4]=x,e[5]=a,e[6]=r,e[7]=l,e[8]=n,e[9]=p}else p=e[9];let b;return e[16]!==p?(b=s.jsx(s.Fragment,{children:p}),e[16]=p,e[17]=b):b=e[17],b}let f;if(e[18]!==o||e[19]!==x||e[20]!==a||e[21]!==r||e[22]!==l||e[23]!==n){let p;e[25]!==o||e[26]!==x||e[27]!==a||e[28]!==r||e[29]!==l?(p=b=>s.jsx(fs,{task:b,isActive:o===b.id,onClick:()=>l(b),onArchive:x&&b.created_by===a.currentUserId?()=>r(b):void 0,showAutomationBadge:!!b.trigger_id,showAgentIcon:!0},b.id),e[25]=o,e[26]=x,e[27]=a,e[28]=r,e[29]=l,e[30]=p):p=e[30],f=n.map(p),e[18]=o,e[19]=x,e[20]=a,e[21]=r,e[22]=l,e[23]=n,e[24]=f}else f=e[24];let h;e[31]!==m||e[32]!==c||e[33]!==d?(h=(m||c)&&s.jsx(xs,{onClick:d,isFetching:c}),e[31]=m,e[32]=c,e[33]=d,e[34]=h):h=e[34];let g;return e[35]!==f||e[36]!==h?(g=s.jsxs(s.Fragment,{children:[f,h]}),e[35]=f,e[36]=h,e[37]=g):g=e[37],g}function Qo(t,e,n){if(!n)return;const i=t.findIndex(o=>o.id===e);if(i!==-1){for(let o=i+1;o<t.length;o++){const l=t[o];if(l?.created_by===n)return l}for(let o=i-1;o>=0;o--){const l=t[o];if(l?.created_by===n)return l}}}function $t(t){const e=z.c(17),{label:n,onClick:i,active:o,children:l}=t,[r,a]=M.useState(!1);let m,c,d,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=()=>a(!0),c=()=>a(!1),d=()=>a(!0),u=()=>a(!1),e[0]=m,e[1]=c,e[2]=d,e[3]=u):(m=e[0],c=e[1],d=e[2],u=e[3]);const x=o&&"bg-sidebar-accent text-foreground";let f;e[4]!==x?(f=P("md:size-[34px] rounded-lg",x),e[4]=x,e[5]=f):f=e[5];let h;e[6]!==l||e[7]!==n||e[8]!==i||e[9]!==f?(h=s.jsx(ae,{asChild:!0,children:s.jsx(ue,{"aria-label":n,onClick:i,onPointerEnter:m,onPointerLeave:c,onFocus:d,onBlur:u,className:f,children:l})}),e[6]=l,e[7]=n,e[8]=i,e[9]=f,e[10]=h):h=e[10];let g;e[11]!==n?(g=s.jsx(ce,{side:"bottom",children:n}),e[11]=n,e[12]=g):g=e[12];let p;return e[13]!==r||e[14]!==h||e[15]!==g?(p=s.jsxs(de,{open:r,children:[h,g]}),e[13]=r,e[14]=h,e[15]=g,e[16]=p):p=e[16],p}function Le(t){const e=z.c(13),{label:n,value:i,onChange:o,options:l}=t;let r;e[0]!==n?(r=s.jsx("span",{className:"text-sm text-muted-foreground",children:n}),e[0]=n,e[1]=r):r=e[1];let a;e[2]!==o?(a=u=>u&&o(u),e[2]=o,e[3]=a):a=e[3];let m;e[4]!==l?(m=l.map(Jo),e[4]=l,e[5]=m):m=e[5];let c;e[6]!==a||e[7]!==m||e[8]!==i?(c=s.jsx(ui,{type:"single",size:"sm",value:i,onValueChange:a,className:"gap-0.5 rounded-lg border border-border bg-muted/50 p-0.5",children:m}),e[6]=a,e[7]=m,e[8]=i,e[9]=c):c=e[9];let d;return e[10]!==r||e[11]!==c?(d=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r,c]}),e[10]=r,e[11]=c,e[12]=d):d=e[12],d}function Jo(t){return s.jsxs(mi,{value:t.value,className:"h-6 gap-1.5 rounded-md border border-transparent px-2 text-xs font-medium text-muted-foreground hover:bg-transparent data-[state=on]:border-border data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm",children:[t.icon,t.label]},t.value)}function bs({onNavigate:t}={}){const{data:e}=se.useSession(),n=e?.user?.id,{org:i}=X(),o=Bt({connectionId:Ut,orgId:i.id,orgSlug:i.slug}),l=Ne(i.id).id,r=Wt(),{threads:a,hasMore:m,isFetchingMore:c,fetchNextPage:d}=nt(),u=a.filter(T=>!T.hidden),{hide:x,setScope:f}=Jt(),h=ie(),{setTaskId:g,createNewTask:p}=it(),b=qe({strict:!1}),j=ke({strict:!1}),v=b.taskId??null,y=j.virtualmcpid??a.find(T=>T.id===v)?.virtual_mcp_id??null,S=()=>{t?.()},C=[...u].sort((T,V)=>(V.updated_at??"").localeCompare(T.updated_at??"")),[_,N]=M.useState("all"),[w,I]=M.useState("flat"),[A,k]=we("sidebar-threads-scope-all",!1),[$,O]=M.useState(!1),[E,U]=M.useState(!1),R={type:_,member:"mine",currentUserId:n??null},F={};A||(F.created_by="me"),f(F);const D=T=>n?T.filter(V=>V.created_by===n):[],L=T=>_==="automation"?T.filter(V=>!!V.trigger_id):_==="manual"?T.filter(V=>!V.trigger_id):T,H=D(C),G=L(H),W=L(C),Q=A?W:G,K=T=>{if(n&&T.created_by&&T.created_by!==n)return;const V=T.id===v;if(x(T.id),Ln(T.id),!V)return;const oe=Qo(Q,T.id,n);S(),oe?g(oe.id,oe.virtual_mcp_id):h({to:"/$org",params:{org:i.slug}})},Pe=T=>{S(),g(T.id,T.virtual_mcp_id)},vs=async T=>{try{const V=await o.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:T,limit:1,offset:0}});return((V.structuredContent??V).items?.length??0)===0}catch{return!1}},lt=async()=>{const T=y??l;q("sidebar_new_thread_clicked",{virtual_mcp_id:T});const V=H.find(oe=>oe.virtual_mcp_id===T&&oe.title==="New chat");if(V&&await vs(V.id)){S(),g(V.id,T);return}S(),p(T)},{state:ys,isMobile:rt,toggleSidebar:Ss}=re();if(ys==="collapsed"&&!rt){const T=Ne(i.id),V=new Map((r??[]).map(J=>[J.id,J])),oe=J=>(J?V.get(J):void 0)??(J===l?T:void 0);return s.jsxs("div",{className:"flex flex-col min-h-0 flex-1 -mt-1 w-[calc(var(--sidebar-width-icon)-1rem)]",children:[s.jsx("div",{className:"flex h-12 shrink-0 items-center justify-center",children:s.jsx(us,{orgParam:i.slug,side:"right",align:"start",trigger:s.jsx(Y,{tooltip:i.name,children:s.jsx(Te,{org:i,size:"sm"})})})}),s.jsxs(te,{className:"mt-2 min-h-0 gap-1.5 overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[s.jsx(B,{children:s.jsx(Y,{"aria-label":"Toggle sidebar",tooltip:"Toggle sidebar",onClick:Ss,children:s.jsx(Ht,{size:16})})}),s.jsx(B,{children:s.jsx(Y,{"aria-label":"New chat",tooltip:"New chat",onClick:()=>{lt()},children:s.jsx(mt,{size:16})})}),Q.map(J=>{const ct=oe(J.virtual_mcp_id);return s.jsx(B,{children:s.jsx(Y,{"aria-label":J.title||"New chat",tooltip:J.title||"New chat",isActive:J.id===v,onClick:()=>Pe(J),children:s.jsx(me,{icon:ct?.icon??null,name:ct?.title??"Agent",size:"xs"})})},J.id)})]})]})}const ye=w!=="flat"||_!=="all"||A===!0,_s=s.jsxs(Ae,{children:[s.jsxs(de,{children:[s.jsx(ae,{asChild:!0,children:s.jsx(xe,{asChild:!0,children:s.jsxs(ue,{"aria-label":"Filter chats",active:ye,className:"md:size-[34px] rounded-lg",children:[s.jsx(di,{size:16}),ye&&s.jsx("span",{className:"absolute right-1 top-1 size-1.5 rounded-full bg-primary ring-2 ring-sidebar"})]})})}),s.jsx(ce,{side:"bottom",children:"Filter chats"})]}),s.jsxs(Ie,{align:"start",className:"w-64 flex flex-col gap-3 p-3",children:[s.jsx(Le,{label:"View",value:w,onChange:T=>{q("tasks_panel_group_by_changed",{to_value:T}),I(T)},options:[{value:"flat",label:"List",icon:s.jsx(xn,{size:13})},{value:"status",label:"Status",icon:s.jsx(hn,{size:13})}]}),s.jsx(Le,{label:"Type",value:_,onChange:T=>{q("tasks_panel_filter_changed",{to_value:T}),N(T)},options:[{value:"all",label:"All"},{value:"manual",label:"Chats"},{value:"automation",label:"Auto"}]}),s.jsx(Le,{label:"Scope",value:A?"team":"mine",onChange:T=>k(T==="team"),options:[{value:"mine",label:"Mine"},{value:"team",label:"Team"}]})]})]}),at=T=>s.jsx(Gt,{delayDuration:300,children:s.jsxs("div",{className:P("shrink-0 flex items-center justify-between",T?"h-10":"h-10 md:h-[34px] mb-2"),children:[s.jsxs("div",{className:"flex items-center gap-0.5",children:[!T&&s.jsx(os,{className:"md:size-[34px] rounded-lg"}),_s]}),s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx($t,{label:"Search chats",onClick:()=>{q("tasks_panel_search_opened"),U(!0),O(!0)},children:s.jsx(fn,{size:16})}),s.jsx($t,{label:"New chat",onClick:()=>{lt()},children:s.jsx(mt,{size:16})})]})]})});return rt?s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[at(!0),s.jsx(_t,{wrapperClassName:"flex-1 min-h-0",className:"flex flex-col gap-0.5 overflow-y-auto overscroll-contain px-1 h-full",children:s.jsx(zt,{threads:Q,groupBy:w,activeTaskId:v,onSelectTask:Pe,onArchiveTask:K,filters:R,hasMore:m,isFetchingMore:c,onLoadMore:()=>{d()},filtersActive:ye})}),E&&s.jsx(Nt,{open:$,onOpenChange:O})]}):s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[at(!1),s.jsx("div",{className:"flex-1 min-h-0 flex flex-col gap-0.5 -mr-2 pr-2",children:s.jsx(_t,{wrapperClassName:"flex-1 min-h-0",className:"flex flex-col gap-0.5 overflow-y-auto overscroll-contain h-full",children:s.jsx(zt,{threads:Q,groupBy:w,activeTaskId:v,onSelectTask:Pe,onArchiveTask:K,filters:R,hasMore:m,isFetchingMore:c,onLoadMore:()=>{d()},filtersActive:ye})})}),E&&s.jsx(Nt,{open:$,onOpenChange:O})]})}const Zo=5,el=[{nameWidth:"w-24",taskRows:2},{nameWidth:"w-28",taskRows:0},{nameWidth:"w-20",taskRows:1},{nameWidth:"w-32",taskRows:0},{nameWidth:"w-24",taskRows:0}];function js(){const t=z.c(3),{state:e}=re();if(e==="collapsed"){let o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"flex flex-col gap-1.5",children:Array.from({length:Zo}).map(nl)}),t[0]=o):o=t[0],o}let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"shrink-0 px-1 h-10 md:h-7 mb-2 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ne,{className:"size-6 rounded-md"}),s.jsx(ne,{className:"size-6 rounded-md"}),s.jsx(ne,{className:"size-6 rounded-md"})]}),s.jsx(ne,{className:"h-6 w-20 rounded-md"})]}),t[1]=n):n=t[1];let i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n,s.jsx("div",{className:"flex flex-col gap-0.5",children:el.map(tl)})]}),t[2]=i):i=t[2],i}function tl(t,e){return s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[s.jsx(ne,{className:"size-5 rounded-full shrink-0"}),s.jsx(ne,{className:P("h-3",t.nameWidth,"rounded-sm")})]}),t.taskRows>0&&s.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:Array.from({length:t.taskRows}).map(sl)})]},e)}function sl(t,e){return s.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5",children:s.jsx(ne,{className:"h-3 flex-1 rounded-sm"})},e)}function nl(t,e){return s.jsx(ne,{className:"size-10 rounded-lg mx-auto"},e)}function il(){const t=z.c(2);if($e()){let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(We,{showName:!0}),t[0]=i):i=t[0],i}let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs(s.Fragment,{children:[s.jsx(We,{}),s.jsx(Oe,{})]}),t[1]=n):n=t[1],n}function ol(){const t=z.c(5),e=ls();let n,i;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Ao,{}),i=s.jsx(il,{}),t[0]=n,t[1]=i):(n=t[0],i=t[1]);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(Ve,{children:s.jsx(M.Suspense,{fallback:s.jsx(js,{}),children:s.jsx(bs,{})})}),t[2]=o):o=t[2];let l;return t[3]!==e?(l=s.jsx(Zt,{children:s.jsx(cs,{sections:e,footer:n,header:i,additionalContent:o})}),t[3]=e,t[4]=l):l=t[4],l}function ll(t){const e=z.c(8),{onClose:n}=t,i=ls();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(zo,{}),e[0]=o):o=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(js,{}),e[1]=l):l=e[1];let r;e[2]!==n?(r=s.jsx(Ve,{children:s.jsx(M.Suspense,{fallback:l,children:s.jsx(bs,{onNavigate:n})})}),e[2]=n,e[3]=r):r=e[3];let a;return e[4]!==n||e[5]!==i||e[6]!==r?(a=s.jsx(Zt,{children:s.jsx(ao,{sections:i,onClose:n,footer:o,additionalContent:r})}),e[4]=n,e[5]=i,e[6]=r,e[7]=a):a=e[7],a}const rl="sidebar.open";function al(){const t=z.c(1),{state:e}=re(),n=$e();if(e!=="collapsed"||n)return null;let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Oe,{}),t[0]=i):i=t[0],i}function cl(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Bs,{}),t[0]=e):e=t[0],e}function Oa(){const t=z.c(43),e=Qe(),n=$e();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},t[0]=i):i=t[0];const{connect:o,siteUrl:l}=ke(i),r=o==="1",[a,m]=we(rl,!1),{width:c,wrapperRef:d,onStartResize:u,resetWidth:x}=Oi(),f=!e;let h,g;t[1]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsxs(Z.LeftColumn,{children:[s.jsx(al,{}),s.jsx(Z.TogglesSlot,{})]}),g=s.jsx(Z.CenterSlot,{}),t[1]=h,t[2]=g):(h=t[1],g=t[2]);let p;t[3]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsxs(Z.Header,{children:[h,g,s.jsxs(Z.RightColumn,{children:[s.jsx("div",{className:"min-w-0 flex-1 overflow-x-auto [scrollbar-width:none] flex justify-end items-center gap-0.5",children:s.jsx(Z.TabsSlot,{})}),s.jsx(Z.RightSlot,{})]})]}),t[3]=p):p=t[3];const b=p;let j;t[4]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(os,{}),t[4]=j):j=t[4];let v;t[5]!==n?(v=!n&&s.jsx("div",{className:"flex min-w-0 flex-1 items-center",children:s.jsx(Oe,{})}),t[5]=n,t[6]=v):v=t[6];let y,S,C,_,N;t[7]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(je,{}),C=s.jsx(Z.TogglesSlot,{}),_=s.jsx(Z.TabsSlot,{className:"shrink-0"}),N=s.jsx(Z.CenterSlot,{}),y=s.jsx(Z.RightSlot,{}),t[7]=y,t[8]=S,t[9]=C,t[10]=_,t[11]=N):(y=t[7],S=t[8],C=t[9],_=t[10],N=t[11]);let w;t[12]!==v?(w=s.jsx(Z.Header,{className:"grid-cols-1 px-1",children:s.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1",children:[j,v,S,C,_,N,y]})}),t[12]=v,t[13]=w):w=t[13];const I=w;let A;t[14]===Symbol.for("react.memo_cache_sentinel")?(A={background:"transparent",containerType:"inline-size"},t[14]=A):A=t[14];let k;t[15]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Gs,{className:"flex flex-col min-h-0",style:A,children:s.jsx("div",{className:"flex flex-col h-full min-h-0",children:s.jsx("div",{className:"relative flex-1 min-h-0 flex flex-row",children:s.jsx(M.Suspense,{fallback:s.jsx(cl,{}),children:s.jsx(Ls,{})})})})}),t[15]=k):k=t[15];const $=k,O=!f&&(e?I:b),E=`${c}px`;let U;t[16]!==E?(U={"--sidebar-width":E,"--sidebar-width-icon":"3.125rem"},t[16]=E,t[17]=U):U=t[17];const R=U;let F;t[18]!==e||t[19]!==u||t[20]!==x?(F=!e&&s.jsxs(s.Fragment,{children:[s.jsx(ol,{}),s.jsx(zi,{onPointerDown:u,onDoubleClick:x})]}),t[18]=e,t[19]=u,t[20]=x,t[21]=F):F=t[21];let D;t[22]!==f?(D=f?s.jsxs("div",{className:"flex flex-col flex-1 min-w-0 min-h-0 h-full",children:[b,$]}):$,t[22]=f,t[23]=D):D=t[23];let L;t[24]!==R||t[25]!==F||t[26]!==D||t[27]!==d?(L=s.jsxs(Ws,{ref:d,className:"flex-1 bg-sidebar relative min-h-0",style:R,children:[F,D]}),t[24]=R,t[25]=F,t[26]=D,t[27]=d,t[28]=L):L=t[28];let H;t[29]!==e?(H=e&&s.jsx(bi,{renderSidebar:dl}),t[29]=e,t[30]=H):H=t[30];let G;t[31]!==l||t[32]!==r?(G=r&&s.jsx(Ci,{siteUrl:l}),t[31]=l,t[32]=r,t[33]=G):G=t[33];let W;t[34]!==O||t[35]!==L||t[36]!==H||t[37]!==G?(W=s.jsx(Mn,{children:s.jsxs("div",{className:"app-shell-root flex flex-col h-dvh overflow-hidden",children:[O,L,H,G]})}),t[34]=O,t[35]=L,t[36]=H,t[37]=G,t[38]=W):W=t[38];let Q;return t[39]!==m||t[40]!==a||t[41]!==W?(Q=s.jsx(Fn,{children:s.jsx(Z.Provider,{children:s.jsx(Ks,{open:a,onOpenChange:m,children:W})})}),t[39]=m,t[40]=a,t[41]=W,t[42]=Q):Q=t[42],Q}function dl(t){const{onClose:e}=t;return s.jsx("div",{className:"flex h-full",children:s.jsx("div",{className:"w-full bg-sidebar flex flex-col overflow-y-auto group/sidebar","data-state":"expanded",children:s.jsx(ll,{onClose:e})})})}export{Oa as default};