decocms 2.292.2 → 2.293.0

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 (238) hide show
  1. package/dist/client/assets/{AlertCircle-De2C9wZC.js → AlertCircle-DnJbX_0w.js} +1 -1
  2. package/dist/client/assets/{ArrowNarrowLeft-bSu4Kz2F.js → ArrowNarrowLeft-M9-X6Sxy.js} +1 -1
  3. package/dist/client/assets/{ArrowUpRight-DT3QLsvt.js → ArrowUpRight-BQK-oA7E.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-BIi7toDZ.js → CheckCircle-BTDGGZJo.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-DmIUGcFl.js → ChevronDown-D098IDk9.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-CIh2nJ4L.js → ChevronRight-DIr3-XeU.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-BYOoc7wr.js → ChevronUp-qt4sL4uC.js} +1 -1
  8. package/dist/client/assets/{Container-BerLGLgK.js → Container-BvdKvtbe.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-CDho1dav.js → DotsVertical-DGFUAKYN.js} +1 -1
  10. package/dist/client/assets/{LinkExternal01-CcTNZj2P.js → LinkExternal01-CS_vTEL0.js} +1 -1
  11. package/dist/client/assets/{Lock01-B-vCOiSg.js → Lock01-DepQhBci.js} +1 -1
  12. package/dist/client/assets/{Palette-CqW3vcqn.js → Palette-SeD4BOqL.js} +1 -1
  13. package/dist/client/assets/{Play-CrdOw1Iv.js → Play-B2WhNMxb.js} +1 -1
  14. package/dist/client/assets/{Plus-Zv0hv0Vg.js → Plus-6a_0gFD5.js} +1 -1
  15. package/dist/client/assets/{RefreshCcw01-COL3SGLi.js → RefreshCcw01-CmGHOB_j.js} +1 -1
  16. package/dist/client/assets/{SearchMd-BjteSZXQ.js → SearchMd-B4RJoOIR.js} +1 -1
  17. package/dist/client/assets/{Settings02-w5kxVqcK.js → Settings02-86F4b3dQ.js} +1 -1
  18. package/dist/client/assets/{Shield01-DodcxEya.js → Shield01-CzaXyqoU.js} +1 -1
  19. package/dist/client/assets/{Star01-BhFELsp4.js → Star01-BsL_E8DX.js} +1 -1
  20. package/dist/client/assets/{Sun-DY_ADcda.js → Sun-CoYtwe4c.js} +1 -1
  21. package/dist/client/assets/{Tool01-B5mm7tYF.js → Tool01-Cxeqfwwz.js} +1 -1
  22. package/dist/client/assets/{Trash01-DuRnWn1E.js → Trash01-Crqeojj8.js} +1 -1
  23. package/dist/client/assets/{User01-CQoJwY3u.js → User01-lfQ-qZIG.js} +1 -1
  24. package/dist/client/assets/{Users03-DfcHW1oz.js → Users03-BEcIfaLP.js} +1 -1
  25. package/dist/client/assets/{X-Bgfd1eh0.js → X-DSm8Y-S-.js} +1 -1
  26. package/dist/client/assets/{XCircle-DUufUsoh.js → XCircle-D0NNu2cU.js} +1 -1
  27. package/dist/client/assets/{XClose-BQJEwJET.js → XClose-8tp9nQPE.js} +1 -1
  28. package/dist/client/assets/{Zap-CDLB-lxK.js → Zap-GnwBp_Qp.js} +1 -1
  29. package/dist/client/assets/{ZapSquare-BFGlmWLE.js → ZapSquare-DgxRVJjy.js} +1 -1
  30. package/dist/client/assets/accordion-CJq3HBrS.js +1 -0
  31. package/dist/client/assets/agent-icon-DxobcFDr.js +1 -0
  32. package/dist/client/assets/agents-list-eEeKypKu.js +1 -0
  33. package/dist/client/assets/ai-providers-D_bgIPsh.js +1 -0
  34. package/dist/client/assets/{alert-dialog-rItivTOb.js → alert-dialog-CscciHzk.js} +2 -2
  35. package/dist/client/assets/{auth-catchall-BGNYNNAk.js → auth-catchall-DZZidYw0.js} +1 -1
  36. package/dist/client/assets/{automation-list-row-lCQuQb2Q.js → automation-list-row-Br_pkbGs.js} +1 -1
  37. package/dist/client/assets/automations-Ch3eQvio.js +1 -0
  38. package/dist/client/assets/{avatar-UVBUP_wG.js → avatar-BQ09Qk0Z.js} +1 -1
  39. package/dist/client/assets/{badge-nX1O9Qf1.js → badge-Clg4Tzdw.js} +1 -1
  40. package/dist/client/assets/brand-context-DZl3n4iE.js +1 -0
  41. package/dist/client/assets/{card-B6kxnNb0.js → card-DUOq7Rl6.js} +1 -1
  42. package/dist/client/assets/chat-context-CfrtTY3a.js +31 -0
  43. package/dist/client/assets/{checkbox-CTi7T5x-.js → checkbox-D2GZcsVt.js} +1 -1
  44. package/dist/client/assets/collection-detail-ChjtG6Ga.js +1 -0
  45. package/dist/client/assets/collection-display-button-BZwsY1Wv.js +1 -0
  46. package/dist/client/assets/{collection-search-BVB_BOr-.js → collection-search-CzSQR8Hb.js} +1 -1
  47. package/dist/client/assets/{collection-search-DHiaU-oT.js → collection-search-DW3g3zGc.js} +1 -1
  48. package/dist/client/assets/{collection-table-wrapper-Cqd6KCzo.js → collection-table-wrapper-B84Op-Zk.js} +1 -1
  49. package/dist/client/assets/{collection-tabs-CczYJtOJ.js → collection-tabs-DVyOXsXh.js} +1 -1
  50. package/dist/client/assets/{collections-Czgjy6V_.js → collections-CzE8C7FB.js} +1 -1
  51. package/dist/client/assets/{command-C1riJax0.js → command-ChcvD0z3.js} +1 -1
  52. package/dist/client/assets/{connection-card-MQF8JSkw.js → connection-card-C2vEoZIt.js} +1 -1
  53. package/dist/client/assets/connection-detail-BGY9VwYa.js +1 -0
  54. package/dist/client/assets/connection-form-helpers-CgA-QNzF.js +1 -0
  55. package/dist/client/assets/connections-DRgi7C4U.js +1 -0
  56. package/dist/client/assets/{constants-CMKJaZow.js → constants-CrD_AMxD.js} +1 -1
  57. package/dist/client/assets/{constants-puxzW8Tt.js → constants-nJzh8CYx.js} +2 -2
  58. package/dist/client/assets/{dialog-CAwNCLeY.js → dialog-CVDAkUpR.js} +1 -1
  59. package/dist/client/assets/domain-settings-ClmaftJG.js +1 -0
  60. package/dist/client/assets/{drawer-Co7qhpAL.js → drawer-CFg3CiQr.js} +1 -1
  61. package/dist/client/assets/dropdown-menu-gP2-wJTw.js +1 -0
  62. package/dist/client/assets/dynamic-plugin-layout-DZA29J1C.js +1 -0
  63. package/dist/client/assets/{empty-state-DIogXxVN.js → empty-state-C2PUUqhT.js} +1 -1
  64. package/dist/client/assets/{empty-state-Bio4MAFs.js → empty-state-CPpC79-7.js} +1 -1
  65. package/dist/client/assets/{extract-connection-data-BFIbyEiI.js → extract-connection-data-5g73Imwy.js} +1 -1
  66. package/dist/client/assets/features-CeA9UMCz.js +1 -0
  67. package/dist/client/assets/form-yPmbpUVF.js +1 -0
  68. package/dist/client/assets/general-CX6-dTKZ.js +1 -0
  69. package/dist/client/assets/index-B3vDeqTk.js +1 -0
  70. package/dist/client/assets/{index-DFoLVe7P.js → index-BYM0cbyk.js} +3 -3
  71. package/dist/client/assets/{index-BiFex3ig.js → index-BdUJIICa.js} +1 -1
  72. package/dist/client/assets/index-BzSFWy5-.js +189 -0
  73. package/dist/client/assets/index-C3hSkh4S.js +1 -0
  74. package/dist/client/assets/index-CXbGCxBV.js +547 -0
  75. package/dist/client/assets/{index-mWgQ602E.js → index-CfanpUI7.js} +3 -3
  76. package/dist/client/assets/{index-BhZeUpb1.js → index-CqrrK0SQ.js} +1 -1
  77. package/dist/client/assets/{index-DcnXzgrr.js → index-CsTWePfc.js} +1 -1
  78. package/dist/client/assets/index-DImBkhtD.js +1 -0
  79. package/dist/client/assets/index-Dbs2wH7N.js +1 -0
  80. package/dist/client/assets/index-DkZMRzTR.js +1 -0
  81. package/dist/client/assets/index-Dkaetwrr.js +142 -0
  82. package/dist/client/assets/{index-DdEYcoGw.js → index-Dlk19fTc.js} +1 -1
  83. package/dist/client/assets/index-b9vWbQjO.js +1 -0
  84. package/dist/client/assets/{index-C4KOdiuW.js → index-gKZjkMnf.js} +26 -26
  85. package/dist/client/assets/{infiniteQueryObserver-DS8PEXT3.js → infiniteQueryObserver-B9PWohpE.js} +1 -1
  86. package/dist/client/assets/{input-DrxCctpM.js → input-Cet4kRAV.js} +1 -1
  87. package/dist/client/assets/{integration-icon-B-ypwxt-.js → integration-icon-BYjt2zM8.js} +1 -1
  88. package/dist/client/assets/{label-qumw5kFa.js → label-CaWfIbuT.js} +1 -1
  89. package/dist/client/assets/layout-BgwHTi9m.js +1 -0
  90. package/dist/client/assets/lean-canvas-recruit-modal-CNtMOKiS.js +116 -0
  91. package/dist/client/assets/{login-zoPe2LeA.js → login-DDBhfkxa.js} +1 -1
  92. package/dist/client/assets/{members-BrCn_crL.js → members-CpZry3vM.js} +1 -1
  93. package/dist/client/assets/{monaco-editor-C80vYwBa.js → monaco-editor-D2GSkzL1.js} +1 -1
  94. package/dist/client/assets/{monitoring-stats-row-DoiRCC4f.js → monitoring-stats-row-B9-AgFrN.js} +1 -1
  95. package/dist/client/assets/{oauth-callback-CNmuoGWl.js → oauth-callback-ZTQDmTMI.js} +1 -1
  96. package/dist/client/assets/{oauth-callback-ai-provider-CsQrJZmR.js → oauth-callback-ai-provider-Gd1uARX2.js} +1 -1
  97. package/dist/client/assets/{onboarding-C7clLSW8.js → onboarding-8fDDt_RN.js} +1 -1
  98. package/dist/client/assets/{org-layout-BmM2YD3_.js → org-layout-Bw77z4Sw.js} +1 -1
  99. package/dist/client/assets/org-plugin-layout-BIXLREf_.js +1 -0
  100. package/dist/client/assets/{task-status-DhB__zcV.js → pair-CSF6pLZy.js} +40 -40
  101. package/dist/client/assets/plugin-empty-state-D452cObw.js +1 -0
  102. package/dist/client/assets/plugin-header-DesRdhcy.js +1 -0
  103. package/dist/client/assets/{plugin-layout-BZBMQxU7.js → plugin-layout-cW34W41Y.js} +1 -1
  104. package/dist/client/assets/{popover-BdnMz9At.js → popover-dpRZqzOJ.js} +1 -1
  105. package/dist/client/assets/profile-AXVJhA8D.js +1 -0
  106. package/dist/client/assets/project-app-view-C0WWCGe_.js +1 -0
  107. package/dist/client/assets/registry-91e7KTfr.js +2 -0
  108. package/dist/client/assets/{registry-layout-DF08kMn2.js → registry-layout-DWruz43b.js} +1 -1
  109. package/dist/client/assets/required-auth-layout-DVgyyuV-.js +1 -0
  110. package/dist/client/assets/{reset-password-KFV68Ks-.js → reset-password-jjqpZRxZ.js} +1 -1
  111. package/dist/client/assets/roles-Bf8vBKyU.js +1 -0
  112. package/dist/client/assets/scroll-area-CH9Vosbx.js +1 -0
  113. package/dist/client/assets/{search-input-CbSuDoZL.js → search-input-BTdLweUR.js} +1 -1
  114. package/dist/client/assets/select-B6R2tTSM.js +1 -0
  115. package/dist/client/assets/{select-model-BLp2y3cG.js → select-model-BMdrDFa3.js} +1 -1
  116. package/dist/client/assets/settings-layout-CnrVmFqe.js +1 -0
  117. package/dist/client/assets/{settings-section-CKsKmGWh.js → settings-section-Z9FmAPIg.js} +1 -1
  118. package/dist/client/assets/shell-layout-DaB5J-du.js +1 -0
  119. package/dist/client/assets/{skeleton-BKGbLlxs.js → skeleton-BhVqr-eG.js} +1 -1
  120. package/dist/client/assets/sso-DZJw-CAn.js +1 -0
  121. package/dist/client/assets/store-D-L6Gt6i.js +1 -0
  122. package/dist/client/assets/store-registry-DdZCk03l.js +2 -0
  123. package/dist/client/assets/{switch-DNv5M4ZB.js → switch-D_DqyrYW.js} +1 -1
  124. package/dist/client/assets/{table-CaLu-Lo8.js → table-D1_6e_tY.js} +1 -1
  125. package/dist/client/assets/{tabs-Ds3m3VsK.js → tabs-Bu_QsdLq.js} +1 -1
  126. package/dist/client/assets/task-status-DKnoaN0K.js +1 -0
  127. package/dist/client/assets/{textarea-D8dnqUDV.js → textarea-BPX5qWaA.js} +1 -1
  128. package/dist/client/assets/{toggle-group-DiaVR0jE.js → toggle-group-BJxlfhsN.js} +1 -1
  129. package/dist/client/assets/tools-list-CjPOU8GA.js +1 -0
  130. package/dist/client/assets/tooltip-DlUl6zVU.js +1 -0
  131. package/dist/client/assets/{types-Cj_XQKsH.js → types-CUVoLk-m.js} +6 -6
  132. package/dist/client/assets/{use-ai-providers-CiKg1J6I.js → use-ai-providers-CKSasQTP.js} +1 -1
  133. package/dist/client/assets/{use-collections-BgcKlAB6.js → use-collections-DKaygmj-.js} +1 -1
  134. package/dist/client/assets/{use-connection-D0OofLda.js → use-connection-DLwIHVYP.js} +1 -1
  135. package/dist/client/assets/{use-copy-DU9Tefqq.js → use-copy-CLL1wnsg.js} +1 -1
  136. package/dist/client/assets/use-create-virtual-mcp-B693GvUD.js +1 -0
  137. package/dist/client/assets/{use-decopilot-events-ClmBUkq4.js → use-decopilot-events-NXGOEGvZ.js} +1 -1
  138. package/dist/client/assets/{use-delete-connection-D8siAEqJ.js → use-delete-connection-DN8HxHVx.js} +1 -1
  139. package/dist/client/assets/{use-infinite-scroll-8BgvLQv0.js → use-infinite-scroll-B32XN73V.js} +1 -1
  140. package/dist/client/assets/{use-list-state-BEoAeszV.js → use-list-state-Cwr5OloB.js} +1 -1
  141. package/dist/client/assets/{use-mcp-tools-D1ScXFUK.js → use-mcp-tools-CyPVbfii.js} +1 -1
  142. package/dist/client/assets/{use-members-BzwLO50s.js → use-members-C8bjIWu8.js} +1 -1
  143. package/dist/client/assets/use-navigate-to-agent-DuF5pNCT.js +1 -0
  144. package/dist/client/assets/{use-org-sso-D0nq7yh3.js → use-org-sso-pbiXxD33.js} +1 -1
  145. package/dist/client/assets/{use-organization-roles-Dl9VoSUw.js → use-organization-roles-7NVaQG9M.js} +1 -1
  146. package/dist/client/assets/{use-organization-settings-C1HGFbFZ.js → use-organization-settings-DpXizr85.js} +1 -1
  147. package/dist/client/assets/{use-registry-connections-DzXuLNdG.js → use-registry-connections-BFqaVIUz.js} +1 -1
  148. package/dist/client/assets/{use-status-sounds-BC_OJyRi.js → use-status-sounds-DVyydX5_.js} +1 -1
  149. package/dist/client/assets/{use-tasks-BtGSWUvO.js → use-tasks-tzb1zUeQ.js} +1 -1
  150. package/dist/client/assets/use-view-mode-D9sT86SW.js +1 -0
  151. package/dist/client/assets/{use-virtual-mcp-D1fXVRo5.js → use-virtual-mcp-SIWEo5E_.js} +1 -1
  152. package/dist/client/assets/useInfiniteQuery-B3rxurAJ.js +1 -0
  153. package/dist/client/assets/useSuspenseInfiniteQuery-KPnhOQU0.js +1 -0
  154. package/dist/client/assets/{user-DAufXs4h.js → user-DxM-AJLw.js} +1 -1
  155. package/dist/client/assets/view-mode-toggle-CussfoqD.js +1 -0
  156. package/dist/client/assets/workflow-a5DJAs_-.js +1 -0
  157. package/dist/client/assets/workflow-detail-DqMXf6Es.js +1 -0
  158. package/dist/client/index.html +1 -1
  159. package/dist/server/cli.js +1 -1
  160. package/package.json +1 -1
  161. package/dist/client/assets/accordion-zVtel299.js +0 -1
  162. package/dist/client/assets/agent-icon-DSfidSus.js +0 -1
  163. package/dist/client/assets/agents-list-vffTTABq.js +0 -1
  164. package/dist/client/assets/ai-providers-t0YXr9kj.js +0 -1
  165. package/dist/client/assets/automations-C7xJbJSO.js +0 -1
  166. package/dist/client/assets/brand-context-7PuYXROc.js +0 -1
  167. package/dist/client/assets/chat-context-KGI8H-cg.js +0 -30
  168. package/dist/client/assets/collection-detail-D_GfRl2U.js +0 -1
  169. package/dist/client/assets/collection-display-button-DtLA-_Qf.js +0 -1
  170. package/dist/client/assets/connection-detail-Kmft9f88.js +0 -1
  171. package/dist/client/assets/connection-form-helpers-DMZ5iUjm.js +0 -1
  172. package/dist/client/assets/connections-Qfmncrnr.js +0 -1
  173. package/dist/client/assets/domain-settings-ZwlKCgS9.js +0 -1
  174. package/dist/client/assets/dropdown-menu-CiJ99ly5.js +0 -1
  175. package/dist/client/assets/dynamic-plugin-layout-SGNBzqAT.js +0 -1
  176. package/dist/client/assets/features-QRbg1n3B.js +0 -1
  177. package/dist/client/assets/form-FdRX5pG1.js +0 -1
  178. package/dist/client/assets/general-Cc1ql58y.js +0 -1
  179. package/dist/client/assets/github-repo-picker-QAmOQiwy.js +0 -116
  180. package/dist/client/assets/index-L8A_STvx.js +0 -1
  181. package/dist/client/assets/index-SoZ9vkB3.js +0 -735
  182. package/dist/client/assets/index-mcaIOSGF.js +0 -1
  183. package/dist/client/assets/layout-BHQW603q.js +0 -1
  184. package/dist/client/assets/org-plugin-layout-Csh0KNUp.js +0 -1
  185. package/dist/client/assets/plugin-empty-state-DxSYI7WM.js +0 -1
  186. package/dist/client/assets/plugin-header-D0WCyAas.js +0 -1
  187. package/dist/client/assets/profile-BZlcE9Y0.js +0 -1
  188. package/dist/client/assets/project-app-view-B8g2l52t.js +0 -1
  189. package/dist/client/assets/registry-oDwGjrMT.js +0 -2
  190. package/dist/client/assets/required-auth-layout-DAzAQKek.js +0 -1
  191. package/dist/client/assets/roles-CMvkTrhY.js +0 -1
  192. package/dist/client/assets/scroll-area-BlUv7zcB.js +0 -142
  193. package/dist/client/assets/select-W23RccQR.js +0 -1
  194. package/dist/client/assets/settings-layout-b1Br3189.js +0 -1
  195. package/dist/client/assets/shell-layout-BUuy9S_L.js +0 -1
  196. package/dist/client/assets/sso-aoLg93_m.js +0 -1
  197. package/dist/client/assets/store-DGgyYg8C.js +0 -1
  198. package/dist/client/assets/store-registry-Dbm0_etm.js +0 -2
  199. package/dist/client/assets/tools-list-CVgYt-8F.js +0 -1
  200. package/dist/client/assets/use-create-virtual-mcp-DAB2T3vN.js +0 -1
  201. package/dist/client/assets/use-mobile-DvmdhkH5.js +0 -1
  202. package/dist/client/assets/use-navigate-to-agent-Dg24R1Fh.js +0 -1
  203. package/dist/client/assets/use-view-mode-BnyE0_EO.js +0 -1
  204. package/dist/client/assets/useInfiniteQuery-H3t_tPfZ.js +0 -1
  205. package/dist/client/assets/useSuspenseInfiniteQuery-BAnABuH7.js +0 -1
  206. package/dist/client/assets/view-mode-toggle-LshbVzEB.js +0 -1
  207. package/dist/client/assets/workflow-Dt2CIq6i.js +0 -1
  208. package/dist/client/assets/workflow-detail-BZ0JnpLY.js +0 -1
  209. package/dist/server/node_modules/pg-int8/LICENSE +0 -13
  210. package/dist/server/node_modules/pg-int8/README.md +0 -16
  211. package/dist/server/node_modules/pg-int8/index.js +0 -100
  212. package/dist/server/node_modules/pg-int8/package.json +0 -24
  213. package/dist/server/node_modules/postgres-array/index.d.ts +0 -4
  214. package/dist/server/node_modules/postgres-array/index.js +0 -97
  215. package/dist/server/node_modules/postgres-array/license +0 -21
  216. package/dist/server/node_modules/postgres-array/package.json +0 -35
  217. package/dist/server/node_modules/postgres-array/readme.md +0 -43
  218. package/dist/server/node_modules/postgres-bytea/index.js +0 -33
  219. package/dist/server/node_modules/postgres-bytea/license +0 -21
  220. package/dist/server/node_modules/postgres-bytea/package.json +0 -34
  221. package/dist/server/node_modules/postgres-bytea/readme.md +0 -34
  222. package/dist/server/node_modules/postgres-date/index.js +0 -116
  223. package/dist/server/node_modules/postgres-date/license +0 -21
  224. package/dist/server/node_modules/postgres-date/package.json +0 -33
  225. package/dist/server/node_modules/postgres-date/readme.md +0 -49
  226. package/dist/server/node_modules/split2/LICENSE +0 -13
  227. package/dist/server/node_modules/split2/README.md +0 -85
  228. package/dist/server/node_modules/split2/bench.js +0 -27
  229. package/dist/server/node_modules/split2/index.js +0 -141
  230. package/dist/server/node_modules/split2/package.json +0 -39
  231. package/dist/server/node_modules/split2/test.js +0 -409
  232. package/dist/server/node_modules/xtend/.jshintrc +0 -30
  233. package/dist/server/node_modules/xtend/LICENSE +0 -20
  234. package/dist/server/node_modules/xtend/README.md +0 -32
  235. package/dist/server/node_modules/xtend/immutable.js +0 -19
  236. package/dist/server/node_modules/xtend/mutable.js +0 -17
  237. package/dist/server/node_modules/xtend/package.json +0 -55
  238. package/dist/server/node_modules/xtend/test.js +0 -103
@@ -1,4 +1,4 @@
1
- import{cp as Fe,bn as Os,y as oe,aC as ge,a_ as ti,bS as _i,aK as Ie,bl as mt,a$ as qe,_ as mr,cq as rn,v as _e,cr as Ii,cs as ws,ct as ec,bQ as tc,cu as ia,cv as nc,cw as rc,cx as ic,cy as fn,cz as Tr,cA as xs,bL as sa,bD as sc,aJ as ze,bR as oc,aI as On,bb as Ci,cB as ac,r as N,j as w,cC as oa,cD as lc}from"./index-C4KOdiuW.js";import{e as cc,f as uc,n as fc,h as dc,C as hc,A as pc}from"./constants-puxzW8Tt.js";import{B as Ti,c as Pi}from"./collections-Czgjy6V_.js";import{R as Es}from"./index-BiFex3ig.js";var mc=class{apply(e,t){if(!t.type)return;const n=Array.isArray(t.type)?t.type:[t.type],r=new Set(n);if(r.has("string")||(e.string=!1),!r.has("number")&&!r.has("integer")&&(e.number=!1),r.has("boolean")||(e.boolean=!1),r.has("null")||(e.null=!1),r.has("array")||(e.array=!1),r.has("object")||(e.object=!1),r.has("integer")&&e.number!==!1){const i=e.number||ge();i instanceof rn&&(e.number=i.int())}}},yc=class{apply(e,t){if(t.const===void 0)return;const n=t.const;e.string=!1,e.number=!1,e.boolean=!1,e.null=!1,e.array=!1,e.object=!1,typeof n=="string"?e.string=qe(n):typeof n=="number"?e.number=qe(n):typeof n=="boolean"?e.boolean=qe(n):n===null?e.null=_i():Array.isArray(n)?e.array=void 0:typeof n=="object"&&(e.object=void 0)}},gc=class{apply(e,t){if(!t.enum)return;if(t.enum.length===0){t.type||(e.string=!1,e.number=!1,e.boolean=!1,e.null=!1,e.array=!1,e.object=!1);return}const n={string:t.enum.filter(r=>typeof r=="string"),number:t.enum.filter(r=>typeof r=="number"),boolean:t.enum.filter(r=>typeof r=="boolean"),null:t.enum.filter(r=>r===null),array:t.enum.filter(r=>Array.isArray(r)),object:t.enum.filter(r=>typeof r=="object"&&r!==null&&!Array.isArray(r))};e.string=this.createTypeSchema(n.string,"string"),e.number=this.createTypeSchema(n.number,"number"),e.boolean=this.createTypeSchema(n.boolean,"boolean"),e.null=n.null.length>0?_i():!1,e.array=n.array.length>0?void 0:!1,e.object=n.object.length>0?void 0:!1}createTypeSchema(e,t){if(e.length===0)return!1;if(e.length===1)return qe(e[0]);if(t==="string")return mr(e);if(t==="number"){const[n,r,...i]=e;return mt([qe(n),qe(r),...i.map(s=>qe(s))])}return t==="boolean"?mt([qe(!0),qe(!1)]):!1}},bc=class{apply(e,t){const n=t;if(n.type==="string"&&n.format==="binary"&&n.contentEncoding==="binary"){let r=ic();n.minLength!==void 0&&(r=r.min(n.minLength)),n.maxLength!==void 0&&(r=r.max(n.maxLength)),n.contentMediaType!==void 0&&(r=r.mime(n.contentMediaType)),e.file=r,e.string=!1}}},Sc=class{apply(e,t){const n=t;t.type===void 0&&(n.minLength!==void 0||n.maxLength!==void 0||n.pattern!==void 0)&&e.string===void 0&&(e.string=oe())}},vc=class{apply(e,t){const n=t;if(n.minLength!==void 0&&e.string!==!1){const r=e.string||oe();r instanceof Ii&&(e.string=r.refine(i=>Array.from(i).length>=n.minLength,{message:`String must be at least ${n.minLength} characters long`}))}}},Oc=class{apply(e,t){const n=t;if(n.maxLength!==void 0&&e.string!==!1){const r=e.string||oe();r instanceof Ii&&(e.string=r.refine(i=>Array.from(i).length<=n.maxLength,{message:`String must be at most ${n.maxLength} characters long`}))}}},wc=class{apply(e,t){const n=t;if(n.pattern&&e.string!==!1){const r=e.string||oe();if(r instanceof Ii){const i=new RegExp(n.pattern);e.string=r.regex(i)}}}},xc=class{apply(e,t){const n=t;if(n.minimum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.min(n.minimum))}}},Ec=class{apply(e,t){const n=t;if(n.maximum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.max(n.maximum))}}},Ac=class{apply(e,t){const n=t;if(n.exclusiveMinimum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(typeof n.exclusiveMinimum=="number"?e.number=r.gt(n.exclusiveMinimum):e.number=!1)}}},_c=class{apply(e,t){const n=t;if(n.exclusiveMaximum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(typeof n.exclusiveMaximum=="number"?e.number=r.lt(n.exclusiveMaximum):e.number=!1)}}},Ic=class{apply(e,t){const n=t;if(n.multipleOf!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.refine(i=>{if(n.multipleOf===0)return!1;const s=i/n.multipleOf,o=Math.round(s),a=Math.min(Math.abs(i)*Number.EPSILON*10,Math.abs(n.multipleOf)*Number.EPSILON*10);return Math.abs(s-o)<=a/Math.abs(n.multipleOf)},{message:`Must be a multiple of ${n.multipleOf}`}))}}},Cc=class{apply(e,t){const n=t;t.type===void 0&&(n.minItems!==void 0||n.maxItems!==void 0||n.items!==void 0||n.prefixItems!==void 0)&&e.array===void 0&&(e.array=Ie(Fe()))}},Tc=class{apply(e,t){const n=t;n.minItems!==void 0&&e.array!==!1&&(e.array=(e.array||Ie(Fe())).min(n.minItems))}},Pc=class{apply(e,t){const n=t;n.maxItems!==void 0&&e.array!==!1&&(e.array=(e.array||Ie(Fe())).max(n.maxItems))}},Fc=class{apply(e,t){const n=t;if(e.array!==!1)if(Array.isArray(n.items))e.array=e.array||Ie(Fe());else if(n.items&&typeof n.items!="boolean"&&!n.prefixItems){const r=Ae(n.items);let i=Ie(r);if(e.array&&e.array instanceof ec){const s=e.array._def;s.checks&&s.checks.forEach(o=>{if(o._zod&&o._zod.def){const a=o._zod.def;a.check==="min_length"&&a.minimum!==void 0?i=i.min(a.minimum):a.check==="max_length"&&a.maximum!==void 0&&(i=i.max(a.maximum))}})}e.array=i}else typeof n.items=="boolean"&&n.items===!1?n.prefixItems?e.array=e.array||Ie(Fe()):e.array=Ie(Fe()).max(0):typeof n.items=="boolean"&&n.items===!0?e.array=e.array||Ie(Fe()):n.prefixItems&&(e.array=e.array||Ie(Fe()))}},jc=class{apply(e,t){if(t.type!=="array")return;const n=t;if(!Array.isArray(n.items)||e.array===!1)return;const r=n.items.map(s=>Ae(s));let i;r.length===0?i=ws([]):i=ws(r),n.minItems!==void 0&&n.minItems>r.length&&(i=!1),n.maxItems!==void 0&&n.maxItems<r.length&&(i=!1),e.tuple=i,e.array=!1}},$c=class{apply(e,t){const n=t;e.object!==!1&&(n.properties||n.required||n.additionalProperties!==void 0)&&(e.object=e.object||_e({}).passthrough())}},Dc=class{apply(e,t){const n=t;t.type===void 0&&(n.maxProperties!==void 0||n.minProperties!==void 0)&&e.object===void 0&&(e.object=_e({}).passthrough())}},Nc=class{apply(e,t){const n=t;if(n.maxProperties!==void 0&&e.object!==!1){const r=e.object||_e({}).passthrough();e.object=r.refine(i=>Object.keys(i).length<=n.maxProperties,{message:`Object must have at most ${n.maxProperties} properties`})}}},Rc=class{apply(e,t){const n=t;if(n.minProperties!==void 0&&e.object!==!1){const r=e.object||_e({}).passthrough();e.object=r.refine(i=>Object.keys(i).length>=n.minProperties,{message:`Object must have at least ${n.minProperties} properties`})}}};function Tn(e,t){if(e===t)return!0;if(e==null||t==null)return e===t;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((n,r)=>Tn(n,t[r]));if(typeof e=="object"&&typeof t=="object"){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(i=>r.includes(i)&&Tn(e[i],t[i]))}return!1}function Mc(){return e=>{if(!Array.isArray(e))return!0;const t=[];return e.every(n=>t.some(i=>Tn(n,i))?!1:(t.push(n),!0))}}function cr(e,t){return e.safeParse(t).success}var Uc=class{apply(e,t){if(!t.not)return e;const n=Ae(t.not);return e.refine(r=>!cr(n,r),{message:"Value must not match the 'not' schema"})}},kc=class{apply(e,t){return t.uniqueItems!==!0?e:e.refine(Mc(),{message:"Array items must be unique"})}},Lc=class{apply(e,t){return!t.allOf||t.allOf.length===0?e:t.allOf.map(r=>Ae(r)).reduce((r,i)=>ia(r,i),e)}},Bc=class{apply(e,t){if(!t.anyOf||t.anyOf.length===0)return e;const n=t.anyOf.length===1?Ae(t.anyOf[0]):mt([Ae(t.anyOf[0]),Ae(t.anyOf[1]),...t.anyOf.slice(2).map(r=>Ae(r))]);return ia(e,n)}},Wc=class{apply(e,t){if(!t.oneOf||t.oneOf.length===0)return e;const n=t.oneOf.map(r=>Ae(r));return e.refine(r=>{let i=0;for(const s of n)if(s.safeParse(r).success&&(i++,i>1))return!1;return i===1},{message:"Value must match exactly one of the oneOf schemas"})}},qc=class{apply(e,t){const n=t;if(n.prefixItems&&Array.isArray(n.prefixItems)){const i=n.prefixItems.map(s=>Ae(s));return e.refine(s=>{if(!Array.isArray(s))return!0;for(let o=0;o<Math.min(s.length,i.length);o++)if(!cr(i[o],s[o]))return!1;if(s.length>i.length){if(typeof n.items=="boolean"&&n.items===!1)return!1;if(n.items&&typeof n.items=="object"&&!Array.isArray(n.items)){const o=Ae(n.items);for(let a=i.length;a<s.length;a++)if(!cr(o,s[a]))return!1}}return!0},{message:"Array does not match prefixItems schema"})}return e}},Vc=class{apply(e,t){const n=t;if(!n.properties&&!n.required&&n.additionalProperties!==!1)return e;if(e instanceof nc||e instanceof rc){const r={};if(n.properties)for(const[i,s]of Object.entries(n.properties))s!==void 0&&(r[i]=Ae(s));if(n.required&&Array.isArray(n.required)){const i=new Set(n.required);for(const s of Object.keys(r))i.has(s)||(r[s]=r[s].optional())}else for(const i of Object.keys(r))r[i]=r[i].optional();return n.additionalProperties===!1?_e(r):_e(r).passthrough()}return e.refine(r=>{if(typeof r!="object"||r===null||Array.isArray(r))return!0;if(n.properties){for(const[i,s]of Object.entries(n.properties))if(s!==void 0&&Object.getOwnPropertyDescriptor(r,i)!==void 0&&!Ae(s).safeParse(r[i]).success)return!1}if(n.required&&Array.isArray(n.required)){for(const i of n.required)if(!(Object.getOwnPropertyDescriptor(r,i)!==void 0))return!1}if(n.additionalProperties===!1&&n.properties){const i=new Set(Object.keys(n.properties));for(const s in r)if(!i.has(s))return!1}return!0},{message:"Object constraints validation failed"})}},Hc=class{apply(e,t){if(!t.enum||t.enum.length===0)return e;const n=t.enum.filter(r=>Array.isArray(r)||typeof r=="object"&&r!==null);return n.length===0?e:e.refine(r=>typeof r!="object"||r===null?!0:n.some(i=>Tn(r,i)),{message:"Value must match one of the enum values"})}},Kc=class{apply(e,t){if(t.const===void 0)return e;const n=t.const;return typeof n!="object"||n===null?e:e.refine(r=>Tn(r,n),{message:"Value must equal the const value"})}},Gc=class{apply(e,t){return t.description&&(e=e.describe(t.description)),e}},zc=class{apply(e,t){var n;const r=t;return!((n=r.required)!=null&&n.includes("__proto__"))||t.type!==void 0?e:Fe().refine(i=>this.validateRequired(i,r.required),{message:"Missing required properties"})}validateRequired(e,t){return typeof e!="object"||e===null||Array.isArray(e)?!0:t.every(n=>Object.prototype.hasOwnProperty.call(e,n))}},Yc=class{apply(e,t){var n;const r=t;if(r.contains===void 0)return e;const i=Ae(r.contains),s=(n=r.minContains)!=null?n:1,o=r.maxContains;return e.refine(a=>{if(!Array.isArray(a))return!0;let l=0;for(const c of a)cr(i,c)&&l++;return!(l<s||o!==void 0&&l>o)},{message:"Array must contain required items matching the schema"})}},Jc=class{apply(e,t){const{default:n}=t;return n===void 0||!e.safeParse(n).success?e:e.default(n)}},Zc=[new yc,new gc,new mc,new bc,new Sc,new Cc,new Dc,new vc,new Oc,new wc,new xc,new Ec,new Ac,new _c,new Ic,new jc,new Tc,new Pc,new Fc,new Nc,new Rc,new $c],Xc=[new zc,new Hc,new Kc,new Lc,new Bc,new Wc,new qc,new Vc,new Yc,new Uc,new kc,new Jc,new Gc];function Ae(e){if(typeof e=="boolean")return e?Fe():Os();const t={};for(const i of Zc)i.apply(t,e);const n=[];if(t.string!==!1&&n.push(t.string||oe()),t.number!==!1&&n.push(t.number||ge()),t.boolean!==!1&&n.push(t.boolean||ti()),t.null!==!1&&n.push(t.null||_i()),t.array!==!1&&n.push(t.array||Ie(Fe())),t.tuple!==!1&&t.tuple!==void 0&&n.push(t.tuple),t.object!==!1)if(t.object)n.push(t.object);else{const i=tc(s=>typeof s=="object"&&s!==null&&!Array.isArray(s),"Must be an object, not an array");n.push(i)}t.file!==!1&&t.file!==void 0&&n.push(t.file);let r;n.length===0?r=Os():n.length===1?r=n[0]:Object.keys(e).some(s=>s!=="$schema"&&s!=="title"&&s!=="description")?r=mt(n):r=Fe();for(const i of Xc)r=i.apply(r,e);return r}class As extends Event{constructor(t,n){var r,i;super(t),this.code=(r=n?.code)!=null?r:void 0,this.message=(i=n?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,n,r){return r(_s(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(_s(this),n)}}function Qc(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function ni(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(ni).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${ni(e.cause)}`:e.message:`${e}`}function _s(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var aa=e=>{throw TypeError(e)},Fi=(e,t,n)=>t.has(e)||aa("Cannot "+n),G=(e,t,n)=>(Fi(e,t,"read from private field"),n?n.call(e):t.get(e)),Se=(e,t,n)=>t.has(e)?aa("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),he=(e,t,n,r)=>(Fi(e,t,"write to private field"),t.set(e,n),n),Qe=(e,t,n)=>(Fi(e,t,"access private method"),n),Ce,Et,kt,Qn,ur,wn,qt,xn,ct,Lt,Gt,Bt,mn,Re,ri,ii,si,Is,oi,ai,yn,li,ci;class er extends EventTarget{constructor(t,n){var r,i;super(),Se(this,Re),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Se(this,Ce),Se(this,Et),Se(this,kt),Se(this,Qn),Se(this,ur),Se(this,wn),Se(this,qt),Se(this,xn,null),Se(this,ct),Se(this,Lt),Se(this,Gt,null),Se(this,Bt,null),Se(this,mn,null),Se(this,ii,async s=>{var o;G(this,Lt).reset();const{body:a,redirected:l,status:c,headers:u}=s;if(c===204){Qe(this,Re,yn).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?he(this,kt,new URL(s.url)):he(this,kt,void 0),c!==200){Qe(this,Re,yn).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){Qe(this,Re,yn).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(G(this,Ce)===this.CLOSED)return;he(this,Ce,this.OPEN);const f=new Event("open");if((o=G(this,mn))==null||o.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){Qe(this,Re,yn).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}const h=new TextDecoder,m=a.getReader();let d=!0;do{const{done:p,value:y}=await m.read();y&&G(this,Lt).feed(h.decode(y,{stream:!p})),p&&(d=!1,G(this,Lt).reset(),Qe(this,Re,li).call(this))}while(d)}),Se(this,si,s=>{he(this,ct,void 0),!(s.name==="AbortError"||s.type==="aborted")&&Qe(this,Re,li).call(this,ni(s))}),Se(this,oi,s=>{typeof s.id=="string"&&he(this,xn,s.id);const o=new MessageEvent(s.event||"message",{data:s.data,origin:G(this,kt)?G(this,kt).origin:G(this,Et).origin,lastEventId:s.id||""});G(this,Bt)&&(!s.event||s.event==="message")&&G(this,Bt).call(this,o),this.dispatchEvent(o)}),Se(this,ai,s=>{he(this,wn,s)}),Se(this,ci,()=>{he(this,qt,void 0),G(this,Ce)===this.CONNECTING&&Qe(this,Re,ri).call(this)});try{if(t instanceof URL)he(this,Et,t);else if(typeof t=="string")he(this,Et,new URL(t,eu()));else throw new Error("Invalid URL")}catch{throw Qc("An invalid or illegal string was specified")}he(this,Lt,cc({onEvent:G(this,oi),onRetry:G(this,ai)})),he(this,Ce,this.CONNECTING),he(this,wn,3e3),he(this,ur,(r=n?.fetch)!=null?r:globalThis.fetch),he(this,Qn,(i=n?.withCredentials)!=null?i:!1),Qe(this,Re,ri).call(this)}get readyState(){return G(this,Ce)}get url(){return G(this,Et).href}get withCredentials(){return G(this,Qn)}get onerror(){return G(this,Gt)}set onerror(t){he(this,Gt,t)}get onmessage(){return G(this,Bt)}set onmessage(t){he(this,Bt,t)}get onopen(){return G(this,mn)}set onopen(t){he(this,mn,t)}addEventListener(t,n,r){const i=n;super.addEventListener(t,i,r)}removeEventListener(t,n,r){const i=n;super.removeEventListener(t,i,r)}close(){G(this,qt)&&clearTimeout(G(this,qt)),G(this,Ce)!==this.CLOSED&&(G(this,ct)&&G(this,ct).abort(),he(this,Ce,this.CLOSED),he(this,ct,void 0))}}Ce=new WeakMap,Et=new WeakMap,kt=new WeakMap,Qn=new WeakMap,ur=new WeakMap,wn=new WeakMap,qt=new WeakMap,xn=new WeakMap,ct=new WeakMap,Lt=new WeakMap,Gt=new WeakMap,Bt=new WeakMap,mn=new WeakMap,Re=new WeakSet,ri=function(){he(this,Ce,this.CONNECTING),he(this,ct,new AbortController),G(this,ur)(G(this,Et),Qe(this,Re,Is).call(this)).then(G(this,ii)).catch(G(this,si))},ii=new WeakMap,si=new WeakMap,Is=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...G(this,xn)?{"Last-Event-ID":G(this,xn)}:void 0},cache:"no-store",signal:(e=G(this,ct))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},oi=new WeakMap,ai=new WeakMap,yn=function(e,t){var n;G(this,Ce)!==this.CLOSED&&he(this,Ce,this.CLOSED);const r=new As("error",{code:t,message:e});(n=G(this,Gt))==null||n.call(this,r),this.dispatchEvent(r)},li=function(e,t){var n;if(G(this,Ce)===this.CLOSED)return;he(this,Ce,this.CONNECTING);const r=new As("error",{code:t,message:e});(n=G(this,Gt))==null||n.call(this,r),this.dispatchEvent(r),he(this,qt,setTimeout(G(this,ci),G(this,wn)))},ci=new WeakMap,er.CONNECTING=0,er.OPEN=1,er.CLOSED=2;function eu(){const e="document"in globalThis?globalThis.document:void 0;return e&&typeof e=="object"&&"baseURI"in e&&typeof e.baseURI=="string"?e.baseURI:void 0}class tu extends Error{constructor(t,n,r){super(`SSE error: ${n}`),this.code=t,this.event=r}}class nu{constructor(t,n){this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=n?.eventSourceInit,this._requestInit=n?.requestInit,this._authProvider=n?.authProvider,this._fetch=n?.fetch,this._fetchWithInit=uc(n?.fetch,n?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new fn("No auth provider");let t;try{t=await Tr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw this.onerror?.(n),n}if(t!=="AUTHORIZED")throw new fn;return await this._startOrAuth()}async _commonHeaders(){const t={};if(this._authProvider){const r=await this._authProvider.tokens();r&&(t.Authorization=`Bearer ${r.access_token}`)}this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);const n=fc(this._requestInit?.headers);return new Headers({...t,...n})}_startOrAuth(){const t=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((n,r)=>{this._eventSource=new er(this._url.href,{...this._eventSourceInit,fetch:async(i,s)=>{const o=await this._commonHeaders();o.set("Accept","text/event-stream");const a=await t(i,{...s,headers:o});if(a.status===401&&a.headers.has("www-authenticate")){const{resourceMetadataUrl:l,scope:c}=xs(a);this._resourceMetadataUrl=l,this._scope=c}return a}}),this._abortController=new AbortController,this._eventSource.onerror=i=>{if(i.code===401&&this._authProvider){this._authThenStart().then(n,r);return}const s=new tu(i.code,i.message,i);r(s),this.onerror?.(s)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",i=>{const s=i;try{if(this._endpoint=new URL(s.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(o){r(o),this.onerror?.(o),this.close();return}n()}),this._eventSource.onmessage=i=>{const s=i;let o;try{o=sa.parse(JSON.parse(s.data))}catch(a){this.onerror?.(a);return}this.onmessage?.(o)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(t){if(!this._authProvider)throw new fn("No auth provider");if(await Tr(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fn("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(t){if(!this._endpoint)throw new Error("Not connected");try{const n=await this._commonHeaders();n.set("content-type","application/json");const r={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(t),signal:this._abortController?.signal},i=await(this._fetch??fetch)(this._endpoint,r);if(!i.ok){const s=await i.text().catch(()=>null);if(i.status===401&&this._authProvider){const{resourceMetadataUrl:o,scope:a}=xs(i);if(this._resourceMetadataUrl=o,this._scope=a,await Tr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fn;return this.send(t)}throw new Error(`Error POSTing to endpoint (HTTP ${i.status}): ${s}`)}await i.body?.cancel()}catch(n){throw this.onerror?.(n),n}}setProtocolVersion(t){this._protocolVersion=t}}const ru="mcp";class iu{constructor(t){this._url=t}start(){if(this._socket)throw new Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((t,n)=>{this._socket=new WebSocket(this._url,ru),this._socket.onerror=r=>{const i="error"in r?r.error:new Error(`WebSocket error: ${JSON.stringify(r)}`);n(i),this.onerror?.(i)},this._socket.onopen=()=>{t()},this._socket.onclose=()=>{this.onclose?.()},this._socket.onmessage=r=>{let i;try{i=sa.parse(JSON.parse(r.data))}catch(s){this.onerror?.(s);return}this.onmessage?.(i)}})}async close(){this._socket?.close()}send(t){return new Promise((n,r)=>{if(!this._socket){r(new Error("Not connected"));return}this._socket?.send(JSON.stringify(t)),n()})}}class su extends dc{constructor(t,n){super(t,n)}send(t,n){const r=ou(t);return r?.type==="emit"?(this.onmessage?.(r.message),Promise.resolve()):r?.type==="suppress"?Promise.resolve():super.send(t,n)}}function ou(e){const t=e;if(!t||typeof t!="object"||!("method"in t))return null;switch(t.method){case"initialize":{const n=t?.params?.protocolVersion;return n?{type:"emit",message:{result:{protocolVersion:n,capabilities:{tools:{}},serverInfo:{name:"deco-chat-server",version:"1.0.0"}},jsonrpc:t.jsonrpc??"2.0",id:t.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}class au extends hc{constructor(t,n){super(t,n)}async listTools(t,n){return await this.request({method:"tools/list",params:t},sc,n)}}const lu=async(e,t,n)=>{const r=cu(e.connection,t,n);if(!r)throw new Error("Unknown MCP connection type");const i=new au({name:e?.name??"MCP Client",version:"1.0.0"});return await i.connect(r),{client:i}},cu=(e,t,n)=>{if(e.type==="Websocket")return new iu(new URL(e.url));if(e.type!=="SSE"&&e.type!=="HTTP")return null;const i={...e.token?{authorization:`Bearer ${e.token}`}:{},...n??{},..."headers"in e?e.headers||{}:{}};if(e.type==="SSE"){const s={requestInit:{headers:i,signal:t}};return e.token&&(s.eventSourceInit={fetch:(o,a)=>fetch(o,{...a,headers:{...i,Accept:"text/event-stream"},signal:t})}),new nu(new URL(e.url),s)}return new su(new URL(e.url),{requestInit:{headers:i,signal:t,credentials:"include"}})},Cs=e=>{try{return JSON.parse(e)}catch{return e}},zn=new Map,Ts=(e,t)=>({...e,id:e.name,inputSchema:e.inputSchema?Ae(e.inputSchema):void 0,outputSchema:e.outputSchema?Ae(e.outputSchema):void 0,execute:n=>t(n.context,e.name)});function uu(e){const t=n=>"connection"in e?lu({connection:e.connection},void 0,n):e.client;return new Proxy({},{get(n,r){if(r==="toJSON")return null;if(typeof r!="string")throw new Error("Name must be a string");if(r==="listTools")return a;async function i(l,c=r){const u=e?.debugId?.(),f=u?{"x-trace-debug-id":u}:void 0,{client:h}=await t(f),{structuredContent:m,isError:d,content:p}=await h.callTool({name:String(c),arguments:l});if(d){const S=p?.[0]?.text,O=typeof S=="string"?Cs(S):null,E=O?.code&&typeof e?.getErrorByStatusCode=="function"?e.getErrorByStatusCode(O.code,O.message,O.traceId):null;throw E||new Error(`Tool ${String(c)} returned an error: ${JSON.stringify(m??p)}`)}if(m!==void 0)return m;const y=p?.[0]?.text;return typeof y=="string"?Cs(y):void 0}async function s(){const{client:l}=await t(),{tools:c}=await l.listTools();return c}async function o(){if(!("connection"in e))return s();const l=e.connection,c=JSON.stringify(l);try{return zn.has(c)||zn.set(c,s()),await zn.get(c)}catch(u){console.error("Failed to list tools",u),zn.delete(c);return}}async function a(){return(await o()??[]).map(c=>Ts(c,i))}return i.asTool=async()=>{const c=(await o()??[]).find(u=>u.name===r);if(!c)throw new Error(`Tool ${r} not found`);return Ts(c,i)},i}})}new Proxy({},{get(e,t){return t==="toJSON"?null:t==="forConnection"?n=>fu({connection:n}):global[t]}});function fu(e){return uu(e)}const du=_e({toolName:oe().describe("Name of the tool to invoke on that connection"),transformCode:oe().optional().describe("Pure TypeScript function for data transformation of the tool call result. Must be a TypeScript file that declares the Output interface and exports a default function: `interface Output { ... } export default async function(stepInput): Output { ... }`\n The stepInput will match with the tool call outputSchema. If transformCode is not provided, the tool call result will be used as the step output.\n Providing an transformCode is recommended because it both allows you to transform the data and validate it against a JSON Schema - tools are ephemeral and may return unexpected data.")}),hu=_e({code:oe().describe(`Pure TypeScript function for data transformation. Useful to merge data from multiple steps and transform it. Must be a TypeScript file that declares the Output interface and exports a default function: \`interface Output { ... } export default async function(stepInput): Output { ... }\`
1
+ import{cp as Fe,bn as Os,J as oe,I as ge,a_ as ti,bS as _i,aK as Ie,bl as mt,a$ as qe,ap as mr,cq as rn,H as _e,cr as Ii,cs as ws,ct as ec,bQ as tc,cu as ia,cv as nc,cw as rc,cx as ic,cy as fn,cz as Tr,cA as xs,bL as sa,bD as sc,aJ as ze,bR as oc,aI as On,bb as Ci,cB as ac,r as N,j as w,cC as oa,cD as lc}from"./index-gKZjkMnf.js";import{e as cc,f as uc,n as fc,h as dc,C as hc,A as pc}from"./constants-nJzh8CYx.js";import{B as Ti,c as Pi}from"./collections-CzE8C7FB.js";import{R as Es}from"./index-BdUJIICa.js";var mc=class{apply(e,t){if(!t.type)return;const n=Array.isArray(t.type)?t.type:[t.type],r=new Set(n);if(r.has("string")||(e.string=!1),!r.has("number")&&!r.has("integer")&&(e.number=!1),r.has("boolean")||(e.boolean=!1),r.has("null")||(e.null=!1),r.has("array")||(e.array=!1),r.has("object")||(e.object=!1),r.has("integer")&&e.number!==!1){const i=e.number||ge();i instanceof rn&&(e.number=i.int())}}},yc=class{apply(e,t){if(t.const===void 0)return;const n=t.const;e.string=!1,e.number=!1,e.boolean=!1,e.null=!1,e.array=!1,e.object=!1,typeof n=="string"?e.string=qe(n):typeof n=="number"?e.number=qe(n):typeof n=="boolean"?e.boolean=qe(n):n===null?e.null=_i():Array.isArray(n)?e.array=void 0:typeof n=="object"&&(e.object=void 0)}},gc=class{apply(e,t){if(!t.enum)return;if(t.enum.length===0){t.type||(e.string=!1,e.number=!1,e.boolean=!1,e.null=!1,e.array=!1,e.object=!1);return}const n={string:t.enum.filter(r=>typeof r=="string"),number:t.enum.filter(r=>typeof r=="number"),boolean:t.enum.filter(r=>typeof r=="boolean"),null:t.enum.filter(r=>r===null),array:t.enum.filter(r=>Array.isArray(r)),object:t.enum.filter(r=>typeof r=="object"&&r!==null&&!Array.isArray(r))};e.string=this.createTypeSchema(n.string,"string"),e.number=this.createTypeSchema(n.number,"number"),e.boolean=this.createTypeSchema(n.boolean,"boolean"),e.null=n.null.length>0?_i():!1,e.array=n.array.length>0?void 0:!1,e.object=n.object.length>0?void 0:!1}createTypeSchema(e,t){if(e.length===0)return!1;if(e.length===1)return qe(e[0]);if(t==="string")return mr(e);if(t==="number"){const[n,r,...i]=e;return mt([qe(n),qe(r),...i.map(s=>qe(s))])}return t==="boolean"?mt([qe(!0),qe(!1)]):!1}},bc=class{apply(e,t){const n=t;if(n.type==="string"&&n.format==="binary"&&n.contentEncoding==="binary"){let r=ic();n.minLength!==void 0&&(r=r.min(n.minLength)),n.maxLength!==void 0&&(r=r.max(n.maxLength)),n.contentMediaType!==void 0&&(r=r.mime(n.contentMediaType)),e.file=r,e.string=!1}}},Sc=class{apply(e,t){const n=t;t.type===void 0&&(n.minLength!==void 0||n.maxLength!==void 0||n.pattern!==void 0)&&e.string===void 0&&(e.string=oe())}},vc=class{apply(e,t){const n=t;if(n.minLength!==void 0&&e.string!==!1){const r=e.string||oe();r instanceof Ii&&(e.string=r.refine(i=>Array.from(i).length>=n.minLength,{message:`String must be at least ${n.minLength} characters long`}))}}},Oc=class{apply(e,t){const n=t;if(n.maxLength!==void 0&&e.string!==!1){const r=e.string||oe();r instanceof Ii&&(e.string=r.refine(i=>Array.from(i).length<=n.maxLength,{message:`String must be at most ${n.maxLength} characters long`}))}}},wc=class{apply(e,t){const n=t;if(n.pattern&&e.string!==!1){const r=e.string||oe();if(r instanceof Ii){const i=new RegExp(n.pattern);e.string=r.regex(i)}}}},xc=class{apply(e,t){const n=t;if(n.minimum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.min(n.minimum))}}},Ec=class{apply(e,t){const n=t;if(n.maximum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.max(n.maximum))}}},Ac=class{apply(e,t){const n=t;if(n.exclusiveMinimum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(typeof n.exclusiveMinimum=="number"?e.number=r.gt(n.exclusiveMinimum):e.number=!1)}}},_c=class{apply(e,t){const n=t;if(n.exclusiveMaximum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(typeof n.exclusiveMaximum=="number"?e.number=r.lt(n.exclusiveMaximum):e.number=!1)}}},Ic=class{apply(e,t){const n=t;if(n.multipleOf!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.refine(i=>{if(n.multipleOf===0)return!1;const s=i/n.multipleOf,o=Math.round(s),a=Math.min(Math.abs(i)*Number.EPSILON*10,Math.abs(n.multipleOf)*Number.EPSILON*10);return Math.abs(s-o)<=a/Math.abs(n.multipleOf)},{message:`Must be a multiple of ${n.multipleOf}`}))}}},Cc=class{apply(e,t){const n=t;t.type===void 0&&(n.minItems!==void 0||n.maxItems!==void 0||n.items!==void 0||n.prefixItems!==void 0)&&e.array===void 0&&(e.array=Ie(Fe()))}},Tc=class{apply(e,t){const n=t;n.minItems!==void 0&&e.array!==!1&&(e.array=(e.array||Ie(Fe())).min(n.minItems))}},Pc=class{apply(e,t){const n=t;n.maxItems!==void 0&&e.array!==!1&&(e.array=(e.array||Ie(Fe())).max(n.maxItems))}},Fc=class{apply(e,t){const n=t;if(e.array!==!1)if(Array.isArray(n.items))e.array=e.array||Ie(Fe());else if(n.items&&typeof n.items!="boolean"&&!n.prefixItems){const r=Ae(n.items);let i=Ie(r);if(e.array&&e.array instanceof ec){const s=e.array._def;s.checks&&s.checks.forEach(o=>{if(o._zod&&o._zod.def){const a=o._zod.def;a.check==="min_length"&&a.minimum!==void 0?i=i.min(a.minimum):a.check==="max_length"&&a.maximum!==void 0&&(i=i.max(a.maximum))}})}e.array=i}else typeof n.items=="boolean"&&n.items===!1?n.prefixItems?e.array=e.array||Ie(Fe()):e.array=Ie(Fe()).max(0):typeof n.items=="boolean"&&n.items===!0?e.array=e.array||Ie(Fe()):n.prefixItems&&(e.array=e.array||Ie(Fe()))}},jc=class{apply(e,t){if(t.type!=="array")return;const n=t;if(!Array.isArray(n.items)||e.array===!1)return;const r=n.items.map(s=>Ae(s));let i;r.length===0?i=ws([]):i=ws(r),n.minItems!==void 0&&n.minItems>r.length&&(i=!1),n.maxItems!==void 0&&n.maxItems<r.length&&(i=!1),e.tuple=i,e.array=!1}},$c=class{apply(e,t){const n=t;e.object!==!1&&(n.properties||n.required||n.additionalProperties!==void 0)&&(e.object=e.object||_e({}).passthrough())}},Dc=class{apply(e,t){const n=t;t.type===void 0&&(n.maxProperties!==void 0||n.minProperties!==void 0)&&e.object===void 0&&(e.object=_e({}).passthrough())}},Nc=class{apply(e,t){const n=t;if(n.maxProperties!==void 0&&e.object!==!1){const r=e.object||_e({}).passthrough();e.object=r.refine(i=>Object.keys(i).length<=n.maxProperties,{message:`Object must have at most ${n.maxProperties} properties`})}}},Rc=class{apply(e,t){const n=t;if(n.minProperties!==void 0&&e.object!==!1){const r=e.object||_e({}).passthrough();e.object=r.refine(i=>Object.keys(i).length>=n.minProperties,{message:`Object must have at least ${n.minProperties} properties`})}}};function Tn(e,t){if(e===t)return!0;if(e==null||t==null)return e===t;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((n,r)=>Tn(n,t[r]));if(typeof e=="object"&&typeof t=="object"){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(i=>r.includes(i)&&Tn(e[i],t[i]))}return!1}function Mc(){return e=>{if(!Array.isArray(e))return!0;const t=[];return e.every(n=>t.some(i=>Tn(n,i))?!1:(t.push(n),!0))}}function cr(e,t){return e.safeParse(t).success}var Uc=class{apply(e,t){if(!t.not)return e;const n=Ae(t.not);return e.refine(r=>!cr(n,r),{message:"Value must not match the 'not' schema"})}},kc=class{apply(e,t){return t.uniqueItems!==!0?e:e.refine(Mc(),{message:"Array items must be unique"})}},Lc=class{apply(e,t){return!t.allOf||t.allOf.length===0?e:t.allOf.map(r=>Ae(r)).reduce((r,i)=>ia(r,i),e)}},Bc=class{apply(e,t){if(!t.anyOf||t.anyOf.length===0)return e;const n=t.anyOf.length===1?Ae(t.anyOf[0]):mt([Ae(t.anyOf[0]),Ae(t.anyOf[1]),...t.anyOf.slice(2).map(r=>Ae(r))]);return ia(e,n)}},Wc=class{apply(e,t){if(!t.oneOf||t.oneOf.length===0)return e;const n=t.oneOf.map(r=>Ae(r));return e.refine(r=>{let i=0;for(const s of n)if(s.safeParse(r).success&&(i++,i>1))return!1;return i===1},{message:"Value must match exactly one of the oneOf schemas"})}},qc=class{apply(e,t){const n=t;if(n.prefixItems&&Array.isArray(n.prefixItems)){const i=n.prefixItems.map(s=>Ae(s));return e.refine(s=>{if(!Array.isArray(s))return!0;for(let o=0;o<Math.min(s.length,i.length);o++)if(!cr(i[o],s[o]))return!1;if(s.length>i.length){if(typeof n.items=="boolean"&&n.items===!1)return!1;if(n.items&&typeof n.items=="object"&&!Array.isArray(n.items)){const o=Ae(n.items);for(let a=i.length;a<s.length;a++)if(!cr(o,s[a]))return!1}}return!0},{message:"Array does not match prefixItems schema"})}return e}},Vc=class{apply(e,t){const n=t;if(!n.properties&&!n.required&&n.additionalProperties!==!1)return e;if(e instanceof nc||e instanceof rc){const r={};if(n.properties)for(const[i,s]of Object.entries(n.properties))s!==void 0&&(r[i]=Ae(s));if(n.required&&Array.isArray(n.required)){const i=new Set(n.required);for(const s of Object.keys(r))i.has(s)||(r[s]=r[s].optional())}else for(const i of Object.keys(r))r[i]=r[i].optional();return n.additionalProperties===!1?_e(r):_e(r).passthrough()}return e.refine(r=>{if(typeof r!="object"||r===null||Array.isArray(r))return!0;if(n.properties){for(const[i,s]of Object.entries(n.properties))if(s!==void 0&&Object.getOwnPropertyDescriptor(r,i)!==void 0&&!Ae(s).safeParse(r[i]).success)return!1}if(n.required&&Array.isArray(n.required)){for(const i of n.required)if(!(Object.getOwnPropertyDescriptor(r,i)!==void 0))return!1}if(n.additionalProperties===!1&&n.properties){const i=new Set(Object.keys(n.properties));for(const s in r)if(!i.has(s))return!1}return!0},{message:"Object constraints validation failed"})}},Hc=class{apply(e,t){if(!t.enum||t.enum.length===0)return e;const n=t.enum.filter(r=>Array.isArray(r)||typeof r=="object"&&r!==null);return n.length===0?e:e.refine(r=>typeof r!="object"||r===null?!0:n.some(i=>Tn(r,i)),{message:"Value must match one of the enum values"})}},Kc=class{apply(e,t){if(t.const===void 0)return e;const n=t.const;return typeof n!="object"||n===null?e:e.refine(r=>Tn(r,n),{message:"Value must equal the const value"})}},Gc=class{apply(e,t){return t.description&&(e=e.describe(t.description)),e}},zc=class{apply(e,t){var n;const r=t;return!((n=r.required)!=null&&n.includes("__proto__"))||t.type!==void 0?e:Fe().refine(i=>this.validateRequired(i,r.required),{message:"Missing required properties"})}validateRequired(e,t){return typeof e!="object"||e===null||Array.isArray(e)?!0:t.every(n=>Object.prototype.hasOwnProperty.call(e,n))}},Yc=class{apply(e,t){var n;const r=t;if(r.contains===void 0)return e;const i=Ae(r.contains),s=(n=r.minContains)!=null?n:1,o=r.maxContains;return e.refine(a=>{if(!Array.isArray(a))return!0;let l=0;for(const c of a)cr(i,c)&&l++;return!(l<s||o!==void 0&&l>o)},{message:"Array must contain required items matching the schema"})}},Jc=class{apply(e,t){const{default:n}=t;return n===void 0||!e.safeParse(n).success?e:e.default(n)}},Zc=[new yc,new gc,new mc,new bc,new Sc,new Cc,new Dc,new vc,new Oc,new wc,new xc,new Ec,new Ac,new _c,new Ic,new jc,new Tc,new Pc,new Fc,new Nc,new Rc,new $c],Xc=[new zc,new Hc,new Kc,new Lc,new Bc,new Wc,new qc,new Vc,new Yc,new Uc,new kc,new Jc,new Gc];function Ae(e){if(typeof e=="boolean")return e?Fe():Os();const t={};for(const i of Zc)i.apply(t,e);const n=[];if(t.string!==!1&&n.push(t.string||oe()),t.number!==!1&&n.push(t.number||ge()),t.boolean!==!1&&n.push(t.boolean||ti()),t.null!==!1&&n.push(t.null||_i()),t.array!==!1&&n.push(t.array||Ie(Fe())),t.tuple!==!1&&t.tuple!==void 0&&n.push(t.tuple),t.object!==!1)if(t.object)n.push(t.object);else{const i=tc(s=>typeof s=="object"&&s!==null&&!Array.isArray(s),"Must be an object, not an array");n.push(i)}t.file!==!1&&t.file!==void 0&&n.push(t.file);let r;n.length===0?r=Os():n.length===1?r=n[0]:Object.keys(e).some(s=>s!=="$schema"&&s!=="title"&&s!=="description")?r=mt(n):r=Fe();for(const i of Xc)r=i.apply(r,e);return r}class As extends Event{constructor(t,n){var r,i;super(t),this.code=(r=n?.code)!=null?r:void 0,this.message=(i=n?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,n,r){return r(_s(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(_s(this),n)}}function Qc(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function ni(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(ni).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${ni(e.cause)}`:e.message:`${e}`}function _s(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var aa=e=>{throw TypeError(e)},Fi=(e,t,n)=>t.has(e)||aa("Cannot "+n),G=(e,t,n)=>(Fi(e,t,"read from private field"),n?n.call(e):t.get(e)),Se=(e,t,n)=>t.has(e)?aa("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),he=(e,t,n,r)=>(Fi(e,t,"write to private field"),t.set(e,n),n),Qe=(e,t,n)=>(Fi(e,t,"access private method"),n),Ce,Et,kt,Qn,ur,wn,qt,xn,ct,Lt,Gt,Bt,mn,Re,ri,ii,si,Is,oi,ai,yn,li,ci;class er extends EventTarget{constructor(t,n){var r,i;super(),Se(this,Re),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Se(this,Ce),Se(this,Et),Se(this,kt),Se(this,Qn),Se(this,ur),Se(this,wn),Se(this,qt),Se(this,xn,null),Se(this,ct),Se(this,Lt),Se(this,Gt,null),Se(this,Bt,null),Se(this,mn,null),Se(this,ii,async s=>{var o;G(this,Lt).reset();const{body:a,redirected:l,status:c,headers:u}=s;if(c===204){Qe(this,Re,yn).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?he(this,kt,new URL(s.url)):he(this,kt,void 0),c!==200){Qe(this,Re,yn).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){Qe(this,Re,yn).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(G(this,Ce)===this.CLOSED)return;he(this,Ce,this.OPEN);const f=new Event("open");if((o=G(this,mn))==null||o.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){Qe(this,Re,yn).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}const h=new TextDecoder,m=a.getReader();let d=!0;do{const{done:p,value:y}=await m.read();y&&G(this,Lt).feed(h.decode(y,{stream:!p})),p&&(d=!1,G(this,Lt).reset(),Qe(this,Re,li).call(this))}while(d)}),Se(this,si,s=>{he(this,ct,void 0),!(s.name==="AbortError"||s.type==="aborted")&&Qe(this,Re,li).call(this,ni(s))}),Se(this,oi,s=>{typeof s.id=="string"&&he(this,xn,s.id);const o=new MessageEvent(s.event||"message",{data:s.data,origin:G(this,kt)?G(this,kt).origin:G(this,Et).origin,lastEventId:s.id||""});G(this,Bt)&&(!s.event||s.event==="message")&&G(this,Bt).call(this,o),this.dispatchEvent(o)}),Se(this,ai,s=>{he(this,wn,s)}),Se(this,ci,()=>{he(this,qt,void 0),G(this,Ce)===this.CONNECTING&&Qe(this,Re,ri).call(this)});try{if(t instanceof URL)he(this,Et,t);else if(typeof t=="string")he(this,Et,new URL(t,eu()));else throw new Error("Invalid URL")}catch{throw Qc("An invalid or illegal string was specified")}he(this,Lt,cc({onEvent:G(this,oi),onRetry:G(this,ai)})),he(this,Ce,this.CONNECTING),he(this,wn,3e3),he(this,ur,(r=n?.fetch)!=null?r:globalThis.fetch),he(this,Qn,(i=n?.withCredentials)!=null?i:!1),Qe(this,Re,ri).call(this)}get readyState(){return G(this,Ce)}get url(){return G(this,Et).href}get withCredentials(){return G(this,Qn)}get onerror(){return G(this,Gt)}set onerror(t){he(this,Gt,t)}get onmessage(){return G(this,Bt)}set onmessage(t){he(this,Bt,t)}get onopen(){return G(this,mn)}set onopen(t){he(this,mn,t)}addEventListener(t,n,r){const i=n;super.addEventListener(t,i,r)}removeEventListener(t,n,r){const i=n;super.removeEventListener(t,i,r)}close(){G(this,qt)&&clearTimeout(G(this,qt)),G(this,Ce)!==this.CLOSED&&(G(this,ct)&&G(this,ct).abort(),he(this,Ce,this.CLOSED),he(this,ct,void 0))}}Ce=new WeakMap,Et=new WeakMap,kt=new WeakMap,Qn=new WeakMap,ur=new WeakMap,wn=new WeakMap,qt=new WeakMap,xn=new WeakMap,ct=new WeakMap,Lt=new WeakMap,Gt=new WeakMap,Bt=new WeakMap,mn=new WeakMap,Re=new WeakSet,ri=function(){he(this,Ce,this.CONNECTING),he(this,ct,new AbortController),G(this,ur)(G(this,Et),Qe(this,Re,Is).call(this)).then(G(this,ii)).catch(G(this,si))},ii=new WeakMap,si=new WeakMap,Is=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...G(this,xn)?{"Last-Event-ID":G(this,xn)}:void 0},cache:"no-store",signal:(e=G(this,ct))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},oi=new WeakMap,ai=new WeakMap,yn=function(e,t){var n;G(this,Ce)!==this.CLOSED&&he(this,Ce,this.CLOSED);const r=new As("error",{code:t,message:e});(n=G(this,Gt))==null||n.call(this,r),this.dispatchEvent(r)},li=function(e,t){var n;if(G(this,Ce)===this.CLOSED)return;he(this,Ce,this.CONNECTING);const r=new As("error",{code:t,message:e});(n=G(this,Gt))==null||n.call(this,r),this.dispatchEvent(r),he(this,qt,setTimeout(G(this,ci),G(this,wn)))},ci=new WeakMap,er.CONNECTING=0,er.OPEN=1,er.CLOSED=2;function eu(){const e="document"in globalThis?globalThis.document:void 0;return e&&typeof e=="object"&&"baseURI"in e&&typeof e.baseURI=="string"?e.baseURI:void 0}class tu extends Error{constructor(t,n,r){super(`SSE error: ${n}`),this.code=t,this.event=r}}class nu{constructor(t,n){this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=n?.eventSourceInit,this._requestInit=n?.requestInit,this._authProvider=n?.authProvider,this._fetch=n?.fetch,this._fetchWithInit=uc(n?.fetch,n?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new fn("No auth provider");let t;try{t=await Tr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw this.onerror?.(n),n}if(t!=="AUTHORIZED")throw new fn;return await this._startOrAuth()}async _commonHeaders(){const t={};if(this._authProvider){const r=await this._authProvider.tokens();r&&(t.Authorization=`Bearer ${r.access_token}`)}this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);const n=fc(this._requestInit?.headers);return new Headers({...t,...n})}_startOrAuth(){const t=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((n,r)=>{this._eventSource=new er(this._url.href,{...this._eventSourceInit,fetch:async(i,s)=>{const o=await this._commonHeaders();o.set("Accept","text/event-stream");const a=await t(i,{...s,headers:o});if(a.status===401&&a.headers.has("www-authenticate")){const{resourceMetadataUrl:l,scope:c}=xs(a);this._resourceMetadataUrl=l,this._scope=c}return a}}),this._abortController=new AbortController,this._eventSource.onerror=i=>{if(i.code===401&&this._authProvider){this._authThenStart().then(n,r);return}const s=new tu(i.code,i.message,i);r(s),this.onerror?.(s)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",i=>{const s=i;try{if(this._endpoint=new URL(s.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(o){r(o),this.onerror?.(o),this.close();return}n()}),this._eventSource.onmessage=i=>{const s=i;let o;try{o=sa.parse(JSON.parse(s.data))}catch(a){this.onerror?.(a);return}this.onmessage?.(o)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(t){if(!this._authProvider)throw new fn("No auth provider");if(await Tr(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fn("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(t){if(!this._endpoint)throw new Error("Not connected");try{const n=await this._commonHeaders();n.set("content-type","application/json");const r={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(t),signal:this._abortController?.signal},i=await(this._fetch??fetch)(this._endpoint,r);if(!i.ok){const s=await i.text().catch(()=>null);if(i.status===401&&this._authProvider){const{resourceMetadataUrl:o,scope:a}=xs(i);if(this._resourceMetadataUrl=o,this._scope=a,await Tr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fn;return this.send(t)}throw new Error(`Error POSTing to endpoint (HTTP ${i.status}): ${s}`)}await i.body?.cancel()}catch(n){throw this.onerror?.(n),n}}setProtocolVersion(t){this._protocolVersion=t}}const ru="mcp";class iu{constructor(t){this._url=t}start(){if(this._socket)throw new Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((t,n)=>{this._socket=new WebSocket(this._url,ru),this._socket.onerror=r=>{const i="error"in r?r.error:new Error(`WebSocket error: ${JSON.stringify(r)}`);n(i),this.onerror?.(i)},this._socket.onopen=()=>{t()},this._socket.onclose=()=>{this.onclose?.()},this._socket.onmessage=r=>{let i;try{i=sa.parse(JSON.parse(r.data))}catch(s){this.onerror?.(s);return}this.onmessage?.(i)}})}async close(){this._socket?.close()}send(t){return new Promise((n,r)=>{if(!this._socket){r(new Error("Not connected"));return}this._socket?.send(JSON.stringify(t)),n()})}}class su extends dc{constructor(t,n){super(t,n)}send(t,n){const r=ou(t);return r?.type==="emit"?(this.onmessage?.(r.message),Promise.resolve()):r?.type==="suppress"?Promise.resolve():super.send(t,n)}}function ou(e){const t=e;if(!t||typeof t!="object"||!("method"in t))return null;switch(t.method){case"initialize":{const n=t?.params?.protocolVersion;return n?{type:"emit",message:{result:{protocolVersion:n,capabilities:{tools:{}},serverInfo:{name:"deco-chat-server",version:"1.0.0"}},jsonrpc:t.jsonrpc??"2.0",id:t.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}class au extends hc{constructor(t,n){super(t,n)}async listTools(t,n){return await this.request({method:"tools/list",params:t},sc,n)}}const lu=async(e,t,n)=>{const r=cu(e.connection,t,n);if(!r)throw new Error("Unknown MCP connection type");const i=new au({name:e?.name??"MCP Client",version:"1.0.0"});return await i.connect(r),{client:i}},cu=(e,t,n)=>{if(e.type==="Websocket")return new iu(new URL(e.url));if(e.type!=="SSE"&&e.type!=="HTTP")return null;const i={...e.token?{authorization:`Bearer ${e.token}`}:{},...n??{},..."headers"in e?e.headers||{}:{}};if(e.type==="SSE"){const s={requestInit:{headers:i,signal:t}};return e.token&&(s.eventSourceInit={fetch:(o,a)=>fetch(o,{...a,headers:{...i,Accept:"text/event-stream"},signal:t})}),new nu(new URL(e.url),s)}return new su(new URL(e.url),{requestInit:{headers:i,signal:t,credentials:"include"}})},Cs=e=>{try{return JSON.parse(e)}catch{return e}},zn=new Map,Ts=(e,t)=>({...e,id:e.name,inputSchema:e.inputSchema?Ae(e.inputSchema):void 0,outputSchema:e.outputSchema?Ae(e.outputSchema):void 0,execute:n=>t(n.context,e.name)});function uu(e){const t=n=>"connection"in e?lu({connection:e.connection},void 0,n):e.client;return new Proxy({},{get(n,r){if(r==="toJSON")return null;if(typeof r!="string")throw new Error("Name must be a string");if(r==="listTools")return a;async function i(l,c=r){const u=e?.debugId?.(),f=u?{"x-trace-debug-id":u}:void 0,{client:h}=await t(f),{structuredContent:m,isError:d,content:p}=await h.callTool({name:String(c),arguments:l});if(d){const S=p?.[0]?.text,O=typeof S=="string"?Cs(S):null,E=O?.code&&typeof e?.getErrorByStatusCode=="function"?e.getErrorByStatusCode(O.code,O.message,O.traceId):null;throw E||new Error(`Tool ${String(c)} returned an error: ${JSON.stringify(m??p)}`)}if(m!==void 0)return m;const y=p?.[0]?.text;return typeof y=="string"?Cs(y):void 0}async function s(){const{client:l}=await t(),{tools:c}=await l.listTools();return c}async function o(){if(!("connection"in e))return s();const l=e.connection,c=JSON.stringify(l);try{return zn.has(c)||zn.set(c,s()),await zn.get(c)}catch(u){console.error("Failed to list tools",u),zn.delete(c);return}}async function a(){return(await o()??[]).map(c=>Ts(c,i))}return i.asTool=async()=>{const c=(await o()??[]).find(u=>u.name===r);if(!c)throw new Error(`Tool ${r} not found`);return Ts(c,i)},i}})}new Proxy({},{get(e,t){return t==="toJSON"?null:t==="forConnection"?n=>fu({connection:n}):global[t]}});function fu(e){return uu(e)}const du=_e({toolName:oe().describe("Name of the tool to invoke on that connection"),transformCode:oe().optional().describe("Pure TypeScript function for data transformation of the tool call result. Must be a TypeScript file that declares the Output interface and exports a default function: `interface Output { ... } export default async function(stepInput): Output { ... }`\n The stepInput will match with the tool call outputSchema. If transformCode is not provided, the tool call result will be used as the step output.\n Providing an transformCode is recommended because it both allows you to transform the data and validate it against a JSON Schema - tools are ephemeral and may return unexpected data.")}),hu=_e({code:oe().describe(`Pure TypeScript function for data transformation. Useful to merge data from multiple steps and transform it. Must be a TypeScript file that declares the Output interface and exports a default function: \`interface Output { ... } export default async function(stepInput): Output { ... }\`
2
2
  The stepInput is the resolved value of the references in the input field. Example:
3
3
  {
4
4
  "input": {
@@ -0,0 +1 @@
1
+ import{e as C,s as pe,f as ve,U as It,g as We,d as qe,W as ys,X as _s,Y as Ss,j as n,Z as Cs,c as J,t as se,r as b,$ as Mt,a0 as $t,H as Ns,J as ks,C as ws,z as Is,a as Ms,B as et,b as Se,a1 as $s,P as Tt,x as je,a2 as Ts,a3 as As,o as Re,a4 as Ps,a5 as Os,a6 as zs,a7 as Rs,a8 as Oe,a9 as Es,aa as Ds,ab as Ls,ac as Fs,ad as At,ae as Us,af as Gs,ag as Bs,ah as Hs,ai as Vs,aj as Ks,ak as Ws,al as qs,am as Qs,an as Ys,ao as Ee,L as Xs,E as it,K as Pt}from"./index-gKZjkMnf.js";import{p as Js,g as Zs,D as en,E as mt,F as ft,G as tn,H as xt,I as sn,A as Pe,J as nn,k as on,K as rn,L as ln}from"./agent-icon-DxobcFDr.js";import{i as an,f as De,g as Le,h as ge,u as Qe,j as he,k as ie,l as Ot,m as zt,n as cn,o as Rt,p as Et}from"./index-C3hSkh4S.js";import{u as Dt,r as Lt}from"./shell-layout-DaB5J-du.js";import{f as dn,g as un,h as mn}from"./pair-CSF6pLZy.js";import{S as Ve}from"./skeleton-BhVqr-eG.js";import{b as lt,P as at,a as ct}from"./popover-dpRZqzOJ.js";import{b as Ft,a as Ut,D as Gt}from"./drawer-CFg3CiQr.js";import{A as pt}from"./avatar-BQ09Qk0Z.js";import{u as Bt,a as tt,b as st,c as ht,T as nt}from"./tooltip-DlUl6zVU.js";import{i as Ht}from"./ChevronDown-D098IDk9.js";import{c as gt,a as fn,e as xn}from"./XCircle-D0NNu2cU.js";import{i as pn,b as hn,n as gn}from"./ZapSquare-DgxRVJjy.js";import{n as bn,a as jn,i as vn}from"./Sun-CoYtwe4c.js";import{s as Ke}from"./Plus-6a_0gFD5.js";import{a as Ye}from"./Settings02-86F4b3dQ.js";import{i as yn}from"./Shield01-CzaXyqoU.js";import{a as Vt}from"./Users03-BEcIfaLP.js";import{f as _n,a as Sn,b as Cn,c as Nn,d as kn,e as wn,A as In}from"./alert-dialog-CscciHzk.js";import{F as Mn,a as $n,b as Tn,c as An,d as Pn,e as On,f as zn}from"./form-yPmbpUVF.js";import{I as Rn}from"./input-Cet4kRAV.js";import{S as En}from"./index-Dkaetwrr.js";import"./index-CqrrK0SQ.js";import{s as Dn}from"./XClose-8tp9nQPE.js";import{S as Kt,u as Wt,W as ze,i as Ln,b as Fn}from"./constants-nJzh8CYx.js";import{u as Un}from"./use-mcp-tools-CyPVbfii.js";import{u as Gn}from"./use-ai-providers-CKSasQTP.js";import{A as Bn,b as Hn,S as Vn,c as Kn,d as Wn,C as qn}from"./index-CXbGCxBV.js";import{u as Qn,a as bt,K as Yn,P as Xn,S as Jn,v as Zn,D as eo,c as to,s as so,b as no,d as oo,C as ro,e as io}from"./collection-search-DW3g3zGc.js";import{i as jt}from"./X-DSm8Y-S-.js";import{b as qt,u as Qt}from"./use-virtual-mcp-SIWEo5E_.js";import{u as Yt,a as lo}from"./use-navigate-to-agent-DuF5pNCT.js";import{u as ao}from"./use-create-virtual-mcp-B693GvUD.js";import{I as co,a as uo,S as mo,L as fo,b as xo,G as po}from"./lean-canvas-recruit-modal-CNtMOKiS.js";import{u as Xt}from"./use-tasks-tzb1zUeQ.js";import{e as ot,f as ho}from"./chat-context-CfrtTY3a.js";import{i as go}from"./ChevronRight-DIr3-XeU.js";import{E as bo}from"./empty-state-CPpC79-7.js";import{u as jo}from"./use-decopilot-events-NXGOEGvZ.js";import{g as Jt,a as vt,b as yt,h as _t,D as St}from"./dropdown-menu-gP2-wJTw.js";import{i as vo}from"./Zap-GnwBp_Qp.js";import{g as yo}from"./task-status-DKnoaN0K.js";function Zt(){const t=C.c(77),{org:e}=pe(),s=ve(),o=It(),{setTasksOpen:r,openTab:i}=Dt(),l=e.slug,a=pe().project;let c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c={strict:!1},t[0]=c):c=t[0];const u=We(c);let d;t[1]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},t[1]=d):d=t[1];const m=qe(d),x=o.location.pathname;let f;t[2]!==a.enabledPlugins?(f=a.enabledPlugins??[],t[2]=a.enabledPlugins,t[3]=f):f=t[3];const p=f;let j;t[4]!==a.ui?(j=a.ui?.pinnedViews??[],t[4]=a.ui,t[5]=j):j=t[5];const I=j;let g,k,h,S;if(t[6]!==a.id||t[7]!==p||t[8]!==s||t[9]!==l||t[10]!==u.pluginId||t[11]!==u.taskId||t[12]!==m.virtualmcpid){let N;t[17]!==p?(N=X=>p.includes(X.pluginId),t[17]=p,t[18]=N):N=t[18];const K=ys.filter(N),W=m.virtualmcpid??a.id;k=!!m.virtualmcpid;const G=u.taskId??"",Y=u.pluginId;let ee;t[19]!==Y?(ee=X=>Y===X,t[19]=Y,t[20]=ee):ee=t[20],g=ee;let Z;t[21]!==G||t[22]!==s||t[23]!==l||t[24]!==W?(Z=X=>{const oe=G||crypto.randomUUID();s({to:"/$org/$taskId/$pluginId",params:{org:l,taskId:oe,pluginId:X},search:ae=>({...ae,virtualmcpid:W})})},t[21]=G,t[22]=s,t[23]=l,t[24]=W,t[25]=Z):Z=t[25],h=Z;let ne;t[26]!==g||t[27]!==h?(ne=X=>({key:X.pluginId,label:X.label,icon:X.icon,isActive:g(X.pluginId),onClick:()=>h(X.pluginId)}),t[26]=g,t[27]=h,t[28]=ne):ne=t[28],S=K.map(ne),t[6]=a.id,t[7]=p,t[8]=s,t[9]=l,t[10]=u.pluginId,t[11]=u.taskId,t[12]=m.virtualmcpid,t[13]=g,t[14]=k,t[15]=h,t[16]=S}else g=t[13],k=t[14],h=t[15],S=t[16];const y=S;let v;if(t[29]!==p||t[30]!==g||t[31]!==h){let N;t[33]!==p?(N=G=>p.includes(G.pluginId),t[33]=p,t[34]=N):N=t[34];const K=_s.filter(N);let W;t[35]!==g||t[36]!==h?(W=G=>({type:"group",group:{id:`${G.pluginId}-${G.id}`,label:G.label,items:G.items.map((Y,ee)=>({key:`${G.pluginId}-${G.id}-${ee}`,label:Y.label,icon:Y.icon,isActive:g(G.pluginId),onClick:()=>h(G.pluginId)})),defaultExpanded:G.defaultExpanded??!0}}),t[35]=g,t[36]=h,t[37]=W):W=t[37],v=K.map(W),t[29]=p,t[30]=g,t[31]=h,t[32]=v}else v=t[32];const _=v;let M;if(t[38]!==i||t[39]!==I){let N;t[41]!==i?(N=K=>{const W=Js(K.icon),G=W.type==="icon"?Zs(W.name):null;return{key:`app-${K.connectionId}-${K.toolName}`,label:K.label||K.toolName,icon:G?n.jsx(G,{size:16,className:"text-muted-foreground"}):W.type==="url"?n.jsx("img",{src:W.url,alt:"",className:"size-4 rounded"}):n.jsx(an,{size:16,className:"text-muted-foreground"}),isActive:!1,onClick:()=>i(dn(K.connectionId,K.toolName))}},t[41]=i,t[42]=N):N=t[42],M=I.map(N),t[38]=i,t[39]=I,t[40]=M}else M=t[40];const D=M;let w;t[43]!==D?(w=D.length>0?{type:"group",group:{id:"apps",label:"Apps",items:D,defaultExpanded:!0}}:null,t[43]=D,t[44]=w):w=t[44];const $=w;let O;t[45]===Symbol.for("react.memo_cache_sentinel")?(O=n.jsx(en,{className:"size-4!"}),t[45]=O):O=t[45];const T=x===`/${l}`||x===`/${l}/`;let A;t[46]!==s||t[47]!==l||t[48]!==r?(A=()=>{r(!1),s({to:"/$org",params:{org:l}})},t[46]=s,t[47]=l,t[48]=r,t[49]=A):A=t[49];let P;t[50]!==A||t[51]!==T?(P={key:"home",label:"Home",icon:O,isActive:T,onClick:A},t[50]=A,t[51]=T,t[52]=P):P=t[52];const z=P;let L;t[53]!==p?(L=p.includes(Ss),t[53]=p,t[54]=L):L=t[54];const R=L;let B;t[55]===Symbol.for("react.memo_cache_sentinel")?(B=n.jsx(Cs,{className:"size-4!"}),t[55]=B):B=t[55];let U;t[56]!==l||t[57]!==x?(U=x.startsWith(`/${l}/settings/workflows`),t[56]=l,t[57]=x,t[58]=U):U=t[58];let F;t[59]!==s||t[60]!==l?(F=()=>s({to:"/$org/settings/workflows",params:{org:l}}),t[59]=s,t[60]=l,t[61]=F):F=t[61];let H;t[62]!==U||t[63]!==F?(H={key:"workflows",label:"Workflows",icon:B,isActive:U,onClick:F},t[62]=U,t[63]=F,t[64]=H):H=t[64];const V=H;let q;if(t[65]!==z||t[66]!==k||t[67]!==R||t[68]!==V){const N=[z];k&&R&&N.push(V),q={type:"items",items:N},t[65]=z,t[66]=k,t[67]=R,t[68]=V,t[69]=q}else q=t[69];let Q;if(t[70]!==$||t[71]!==_||t[72]!==y||t[73]!==q){if(Q=[q],y.length>0){let N;t[75]!==y?(N={type:"items",items:y},t[75]=y,t[76]=N):N=t[76],Q.push(N)}_.length>0&&Q.push(..._),$&&Q.push($),t[70]=$,t[71]=_,t[72]=y,t[73]=q,t[74]=Q}else Q=t[74];return Q}function es(t){const e=C.c(3),{children:s}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("div",{className:"flex h-6 items-center",children:n.jsx("div",{className:"h-0.5 w-16 rounded-full bg-sidebar-foreground/15"})}),e[0]=o):o=e[0];let r;return e[1]!==s?(r=n.jsxs(De,{className:"pt-0 pr-0 pb-2 pl-0 mt-2",children:[o,n.jsx(Le,{children:n.jsx(ge,{className:"gap-0.5",children:s})})]}),e[1]=s,e[2]=r):r=e[2],r}function _o(){const t=C.c(7),s=Mt().logo??$t,o=typeof s=="string"?s:s.light,r=typeof s=="string"?s:s.dark;let i;t[0]!==o?(i=n.jsx("img",{src:o,alt:"Logo",className:"size-6 object-contain dark:hidden"}),t[0]=o,t[1]=i):i=t[1];let l;t[2]!==r?(l=n.jsx("img",{src:r,alt:"Logo",className:"size-6 object-contain hidden dark:block"}),t[2]=r,t[3]=l):l=t[3];let a;return t[4]!==i||t[5]!==l?(a=n.jsx(Rt,{className:"flex items-center justify-center shrink-0 px-2 pb-0",children:n.jsxs("div",{className:"flex w-full aspect-square items-center justify-center",children:[i,l]})}),t[4]=i,t[5]=l,t[6]=a):a=t[6],a}function ts(t){const e=C.c(15),{item:s}=t,{isMobile:o,setOpenMobile:r}=Qe();let i;e[0]!==o||e[1]!==s||e[2]!==r?(i=()=>{se("nav_item_clicked",{nav_key:s.key,nav_label:s.label,is_active:!!s.isActive,is_mobile:o}),s.onClick?.(),o&&r(!1)},e[0]=o,e[1]=s,e[2]=r,e[3]=i):i=e[3];const l=i,a=s.key,c=s.isActive&&"z-10";let u;e[4]!==c?(u=J(c),e[4]=c,e[5]=u):u=e[5];let d;e[6]!==l||e[7]!==s.icon||e[8]!==s.isActive||e[9]!==s.label?(d=n.jsx(he,{onClick:l,isActive:s.isActive,tooltip:s.label,className:"bg-muted/75",children:s.icon}),e[6]=l,e[7]=s.icon,e[8]=s.isActive,e[9]=s.label,e[10]=d):d=e[10];let m;return e[11]!==s.key||e[12]!==u||e[13]!==d?(m=n.jsx(ie,{className:u,children:d},a),e[11]=s.key,e[12]=u,e[13]=d,e[14]=m):m=e[14],m}function So(t){const e=C.c(12),{section:s}=t;switch(s.type){case"divider":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(Ot,{className:"my-2"}),e[0]=o):o=e[0],o}case"spacer":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("div",{className:"flex-1"}),e[1]=o):o=e[1],o}case"group":{const o=s.group.label,r=s.group.defaultExpanded;let i;e[2]!==s.group.items?(i=s.group.items.map(No),e[2]=s.group.items,e[3]=i):i=e[3];let l;return e[4]!==s.group.defaultExpanded||e[5]!==s.group.label||e[6]!==i?(l=n.jsx(es,{label:o,defaultExpanded:r,children:i}),e[4]=s.group.defaultExpanded,e[5]=s.group.label,e[6]=i,e[7]=l):l=e[7],l}case"items":{let o;e[8]!==s.items?(o=s.items.map(Co),e[8]=s.items,e[9]=o):o=e[9];let r;return e[10]!==o?(r=n.jsx(De,{className:"pt-0 pr-0 pb-0 pl-0",children:n.jsx(Le,{children:n.jsx(ge,{className:"gap-1.5",children:o})})}),e[10]=o,e[11]=r):r=e[11],r}}}function Co(t){return n.jsx(ts,{item:t},t.key)}function No(t){return n.jsx(ts,{item:t},t.key)}function ko(t){const e=C.c(14),{sections:s,header:o,footer:r,additionalContent:i,variant:l,contentClassName:a}=t,c=l===void 0?"sidebar":l;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(b.Suspense,{fallback:n.jsx("div",{className:"h-10 shrink-0"}),children:n.jsx(_o,{})}),e[0]=u):u=e[0];let d;e[1]!==a?(d=J("flex flex-col flex-1 px-2 py-2 gap-0",a),e[1]=a,e[2]=d):d=e[2];let m;e[3]!==s?(m=s.map(wo),e[3]=s,e[4]=m):m=e[4];let x;e[5]!==i||e[6]!==d||e[7]!==m?(x=n.jsxs(zt,{className:d,children:[m,i]}),e[5]=i,e[6]=d,e[7]=m,e[8]=x):x=e[8];let f;return e[9]!==r||e[10]!==o||e[11]!==x||e[12]!==c?(f=n.jsxs(cn,{variant:c,children:[u,o,x,r]}),e[9]=r,e[10]=o,e[11]=x,e[12]=c,e[13]=f):f=e[13],f}function wo(t,e){return n.jsx(So,{section:t},e)}function ss(t){const e=C.c(2);let s;return e[0]!==t?(s=n.jsx(ko,{...t}),e[0]=t,e[1]=s):s=e[1],s}ss.Skeleton=function(){return n.jsx("div",{className:"flex flex-col gap-0.5",children:Array.from({length:8}).map((e,s)=>n.jsx("div",{className:"w-full h-8",children:n.jsx(Ve,{className:"h-full bg-sidebar-accent rounded-md"})},s))})};function Io(){const t=C.c(7),s=Mt().logo??$t,o=typeof s=="string"?s:s.light,r=typeof s=="string"?s:s.dark;let i;t[0]!==o?(i=n.jsx("img",{src:o,alt:"Logo",className:"size-6 object-contain dark:hidden"}),t[0]=o,t[1]=i):i=t[1];let l;t[2]!==r?(l=n.jsx("img",{src:r,alt:"Logo",className:"size-6 object-contain hidden dark:block"}),t[2]=r,t[3]=l):l=t[3];let a;return t[4]!==i||t[5]!==l?(a=n.jsx(Rt,{className:"flex items-center justify-center shrink-0 px-2 pb-0",children:n.jsxs("div",{className:"flex w-full aspect-square items-center justify-center",children:[i,l]})}),t[4]=i,t[5]=l,t[6]=a):a=t[6],a}function Ct(t){const e=C.c(15),{item:s,onClose:o}=t,r=s.isActive&&"z-10";let i;e[0]!==r?(i=J(r),e[0]=r,e[1]=i):i=e[1];let l;e[2]!==s||e[3]!==o?(l=()=>{s.onClick?.(),o()},e[2]=s,e[3]=o,e[4]=l):l=e[4];let a;e[5]!==s.icon?(a=n.jsx("span",{className:"[&>svg]:size-8",children:s.icon}),e[5]=s.icon,e[6]=a):a=e[6];let c;e[7]!==s.isActive||e[8]!==s.label||e[9]!==l||e[10]!==a?(c=n.jsx(he,{onClick:l,isActive:s.isActive,tooltip:s.label,className:"bg-muted/75",children:a}),e[7]=s.isActive,e[8]=s.label,e[9]=l,e[10]=a,e[11]=c):c=e[11];let u;return e[12]!==i||e[13]!==c?(u=n.jsx(ie,{className:i,children:c}),e[12]=i,e[13]=c,e[14]=u):u=e[14],u}function Mo(t){const e=C.c(18),{section:s,onClose:o}=t;switch(s.type){case"divider":{let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(Ot,{className:"my-2"}),e[0]=r):r=e[0],r}case"spacer":{let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("div",{className:"flex-1"}),e[1]=r):r=e[1],r}case"group":{const r=s.group.label,i=s.group.defaultExpanded;let l;if(e[2]!==o||e[3]!==s.group.items){let c;e[5]!==o?(c=u=>n.jsx(Ct,{item:u,onClose:o},u.key),e[5]=o,e[6]=c):c=e[6],l=s.group.items.map(c),e[2]=o,e[3]=s.group.items,e[4]=l}else l=e[4];let a;return e[7]!==s.group.defaultExpanded||e[8]!==s.group.label||e[9]!==l?(a=n.jsx(es,{label:r,defaultExpanded:i,children:l}),e[7]=s.group.defaultExpanded,e[8]=s.group.label,e[9]=l,e[10]=a):a=e[10],a}case"items":{let r;if(e[11]!==o||e[12]!==s.items){let l;e[14]!==o?(l=a=>n.jsx(Ct,{item:a,onClose:o},a.key),e[14]=o,e[15]=l):l=e[15],r=s.items.map(l),e[11]=o,e[12]=s.items,e[13]=r}else r=e[13];let i;return e[16]!==r?(i=n.jsx(De,{className:"pt-0 pr-0 pb-0 pl-0",children:n.jsx(Le,{children:n.jsx(ge,{className:"gap-1.5",children:r})})}),e[16]=r,e[17]=i):i=e[17],i}}}function $o(t){const e=C.c(12),{sections:s,onClose:o,footer:r,additionalContent:i}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(b.Suspense,{fallback:n.jsx("div",{className:"h-10 shrink-0"}),children:n.jsx(Io,{})}),e[0]=l):l=e[0];let a;if(e[1]!==o||e[2]!==s){let d;e[4]!==o?(d=(m,x)=>n.jsx(Mo,{section:m,onClose:o},x),e[4]=o,e[5]=d):d=e[5],a=s.map(d),e[1]=o,e[2]=s,e[3]=a}else a=e[3];let c;e[6]!==i||e[7]!==a?(c=n.jsxs(zt,{className:"flex flex-col flex-1 px-2 py-2 gap-0",children:[a,i]}),e[6]=i,e[7]=a,e[8]=c):c=e[8];let u;return e[9]!==r||e[10]!==c?(u=n.jsxs("div",{className:"bg-sidebar flex h-full w-full flex-col","data-sidebar":"sidebar",children:[l,c,r]}),e[9]=r,e[10]=c,e[11]=u):u=e[11],u}function ns(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const To=Ns({name:ks().min(2,"Organization name is required")});function Ao(t){const e=C.c(41),{open:s,onOpenChange:o}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={resolver:ws(To),defaultValues:{name:""}},e[0]=r):r=e[0];const i=Is(r);let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l={mutationFn:Oo,onSuccess:Po},e[1]=l):l=e[1];const a=Ms(l),c=a.error instanceof Error?a.error.message:a.error?"Failed to create organization.":null;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsxs(Cn,{children:[n.jsx(Nn,{children:"Create a new organization"}),n.jsx(kn,{children:"Set up a new organization to collaborate with others."})]}),e[2]=u):u=e[2];let d;if(e[3]!==a||e[4]!==i){let _;e[6]!==a?(_=M=>a.mutateAsync(M),e[6]=a,e[7]=_):_=e[7],d=i.handleSubmit(_),e[3]=a,e[4]=i,e[5]=d}else d=e[5];let m;e[8]!==i.formState.isSubmitting?(m=_=>{const{field:M}=_;return n.jsxs(Tn,{children:[n.jsx(An,{children:"Organization Name"}),n.jsx(Pn,{children:n.jsx(Rn,{...M,placeholder:"Acme Inc.",disabled:i.formState.isSubmitting})}),n.jsx(On,{children:"The name of your company or organization"}),M.value&&n.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Organization URL:"," ",n.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",ns(M.value)]})]}),n.jsx(zn,{})]})},e[8]=i.formState.isSubmitting,e[9]=m):m=e[9];let x;e[10]!==i.control||e[11]!==m?(x=n.jsx(Mn,{control:i.control,name:"name",render:m}),e[10]=i.control,e[11]=m,e[12]=x):x=e[12];let f;e[13]!==c?(f=c&&n.jsx("div",{className:"text-destructive text-sm mt-2",children:c}),e[13]=c,e[14]=f):f=e[14];let p;e[15]!==a||e[16]!==i?(p=()=>{a.reset(),i.reset()},e[15]=a,e[16]=i,e[17]=p):p=e[17];let j;e[18]!==i.formState.isSubmitting||e[19]!==p?(j=n.jsx(_n,{disabled:i.formState.isSubmitting,onClick:p,children:"Cancel"}),e[18]=i.formState.isSubmitting,e[19]=p,e[20]=j):j=e[20];const I=!i.formState.isValid||i.formState.isSubmitting;let g;e[21]!==i.formState.isSubmitting?(g=i.formState.isSubmitting?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(En,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=i.formState.isSubmitting,e[22]=g):g=e[22];let k;e[23]!==I||e[24]!==g?(k=n.jsx(et,{type:"submit",variant:"default",disabled:I,children:g}),e[23]=I,e[24]=g,e[25]=k):k=e[25];let h;e[26]!==k||e[27]!==j?(h=n.jsxs(wn,{children:[j,k]}),e[26]=k,e[27]=j,e[28]=h):h=e[28];let S;e[29]!==h||e[30]!==d||e[31]!==x||e[32]!==f?(S=n.jsxs("form",{className:"space-y-6",onSubmit:d,autoComplete:"off",children:[x,f,h]}),e[29]=h,e[30]=d,e[31]=x,e[32]=f,e[33]=S):S=e[33];let y;e[34]!==i||e[35]!==S?(y=n.jsxs(Sn,{children:[u,n.jsx($n,{...i,children:S})]}),e[34]=i,e[35]=S,e[36]=y):y=e[36];let v;return e[37]!==o||e[38]!==s||e[39]!==y?(v=n.jsx(In,{open:s,onOpenChange:o,children:y}),e[37]=o,e[38]=s,e[39]=y,e[40]=v):v=e[40],v}function Po(t){const{orgSlug:e}=t;window.location.href=`/${e}`}async function Oo(t){const e=ns(t.name);if(!e)throw new Error("Organization slug is invalid");const s=await Se.organization.create({name:t.name,slug:e});if(s?.error)throw new Error(s.error.message||"Failed to create organization");const o=s?.data?.slug??e;if(!o)throw new Error("Failed to create organization");return{orgSlug:o}}function rt(t){let e=0;for(let o=0;o<t.length;o++)e=t.charCodeAt(o)+((e<<5)-e);const s=Math.abs(e)%360;return{backgroundColor:`hsl(${s} 55% 70%)`,color:`hsl(${s} 55% 20%)`}}function zo(t){const e=C.c(13),{org:s,size:o}=t,r=o===void 0?"sm":o,i=r==="xs"?"size-5":"size-6",l=r==="xs"?"text-[9px]":"text-xs";let a;e[0]!==i?(a=J(i,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=i,e[1]=a):a=e[1];let c;e[2]!==s.logo||e[3]!==s.name?(c=s.logo?void 0:rt(s.name),e[2]=s.logo,e[3]=s.name,e[4]=c):c=e[4];let u;e[5]!==s.logo||e[6]!==s.name||e[7]!==l?(u=s.logo?n.jsx("img",{src:s.logo,alt:"",className:"size-full object-cover"}):n.jsx("span",{className:J("font-semibold leading-none",l),children:s.name.slice(0,2).toUpperCase()}),e[5]=s.logo,e[6]=s.name,e[7]=l,e[8]=u):u=e[8];let d;return e[9]!==a||e[10]!==c||e[11]!==u?(d=n.jsx("div",{className:a,style:c,children:u}),e[9]=a,e[10]=c,e[11]=u,e[12]=d):d=e[12],d}function Be(t){const e=C.c(22),{item:s,onClose:o}=t;if(s.href){const c=s.external?"_blank":void 0,u=s.external?"noopener noreferrer":void 0;let d;e[0]!==s.icon?(d=n.jsx("span",{className:"shrink-0 text-muted-foreground",children:s.icon}),e[0]=s.icon,e[1]=d):d=e[1];let m;e[2]!==s.label?(m=n.jsx("span",{className:"flex-1",children:s.label}),e[2]=s.label,e[3]=m):m=e[3];let x;return e[4]!==s.href||e[5]!==o||e[6]!==c||e[7]!==u||e[8]!==d||e[9]!==m?(x=n.jsxs("a",{href:s.href,target:c,rel:u,className:"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",onClick:o,children:[d,m]}),e[4]=s.href,e[5]=o,e[6]=c,e[7]=u,e[8]=d,e[9]=m,e[10]=x):x=e[10],x}let r;e[11]!==s||e[12]!==o?(r=()=>{s.onClick?.(),o()},e[11]=s,e[12]=o,e[13]=r):r=e[13];let i;e[14]!==s.icon?(i=n.jsx("span",{className:"shrink-0 text-muted-foreground",children:s.icon}),e[14]=s.icon,e[15]=i):i=e[15];let l;e[16]!==s.label?(l=n.jsx("span",{className:"flex-1",children:s.label}),e[16]=s.label,e[17]=l):l=e[17];let a;return e[18]!==r||e[19]!==i||e[20]!==l?(a=n.jsxs("button",{type:"button",onClick:r,className:"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",children:[i,l]}),e[18]=r,e[19]=i,e[20]=l,e[21]=a):a=e[21],a}function Nt(t){const e=C.c(16),{sortedOrgs:s,orgParam:o,onSelectOrg:r,onCreateOrg:i}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("span",{className:"text-sm font-medium text-muted-foreground/60",children:"Your Organizations"}),e[0]=l):l=e[0];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Ke,{size:16}),e[1]=a):a=e[1];let c;e[2]!==i?(c=n.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[l,n.jsx("button",{type:"button",onClick:i,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:a})]}),e[2]=i,e[3]=c):c=e[3];let u;if(e[4]!==r||e[5]!==o||e[6]!==s){let x;e[8]!==r||e[9]!==o?(x=f=>n.jsxs("button",{type:"button",onClick:()=>r(f.slug),className:J("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",f.slug===o?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[n.jsx(zo,{org:f,size:"sm"}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("p",{className:"text-sm font-medium truncate",children:f.name}),n.jsx("p",{className:"text-xs text-muted-foreground truncate",children:f.slug})]}),f.slug===o&&n.jsx(Ht,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},f.id),e[8]=r,e[9]=o,e[10]=x):x=e[10],u=s.map(x),e[4]=r,e[5]=o,e[6]=s,e[7]=u}else u=e[7];let d;e[11]!==u?(d=n.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1",children:u}),e[11]=u,e[12]=d):d=e[12];let m;return e[13]!==c||e[14]!==d?(m=n.jsxs(n.Fragment,{children:[c,d]}),e[13]=c,e[14]=d,e[15]=m):m=e[15],m}function kt(t){const e=C.c(142),{user:s,userImage:o,menuItems:r,signOutItem:i,themeOptions:l,preferences:a,setPreferences:c,sortedOrgs:u,orgParam:d,onSelectOrg:m,onCreateOrg:x,close:f,isMobile:p}=t;if(p){const G=s?.name??"U";let Y;e[0]!==G||e[1]!==o?(Y=n.jsx(pt,{url:o,fallback:G,shape:"circle",size:"sm",className:"shrink-0"}),e[0]=G,e[1]=o,e[2]=Y):Y=e[2];const ee=s?.name??"User";let Z;e[3]!==ee?(Z=n.jsx("p",{className:"text-sm font-medium truncate",children:ee}),e[3]=ee,e[4]=Z):Z=e[4];const ne=s?.email;let X;e[5]!==ne?(X=n.jsx("p",{className:"text-xs text-muted-foreground truncate",children:ne}),e[5]=ne,e[6]=X):X=e[6];let oe;e[7]!==Z||e[8]!==X?(oe=n.jsxs("div",{className:"flex-1 min-w-0",children:[Z,X]}),e[7]=Z,e[8]=X,e[9]=oe):oe=e[9];let ae;e[10]!==s?(ae=()=>{s?.id&&navigator.clipboard.writeText(s.id).then(Lo)},e[10]=s,e[11]=ae):ae=e[11];let Ne;e[12]===Symbol.for("react.memo_cache_sentinel")?(Ne=n.jsx(gt,{size:14}),e[12]=Ne):Ne=e[12];let ce;e[13]!==ae?(ce=n.jsx(tt,{asChild:!0,children:n.jsx("button",{type:"button",tabIndex:-1,onClick:ae,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:Ne})}),e[13]=ae,e[14]=ce):ce=e[14];let ye;e[15]===Symbol.for("react.memo_cache_sentinel")?(ye=n.jsx(st,{side:"right",children:n.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[15]=ye):ye=e[15];let _e;e[16]!==ce?(_e=n.jsx(ht,{delayDuration:300,children:n.jsxs(nt,{children:[ce,ye]})}),e[16]=ce,e[17]=_e):_e=e[17];let re;e[18]!==_e||e[19]!==Y||e[20]!==oe?(re=n.jsxs("div",{className:"flex items-center gap-3 px-4 py-4 border-b border-border",children:[Y,oe,_e]}),e[18]=_e,e[19]=Y,e[20]=oe,e[21]=re):re=e[21];let de;e[22]!==x||e[23]!==m||e[24]!==d||e[25]!==u?(de=n.jsx("div",{className:"border-b border-border pb-2",children:n.jsx(Nt,{sortedOrgs:u,orgParam:d,onSelectOrg:m,onCreateOrg:x})}),e[22]=x,e[23]=m,e[24]=d,e[25]=u,e[26]=de):de=e[26];let ue;if(e[27]!==f||e[28]!==r){let be;e[30]!==f?(be=Ge=>n.jsx(Be,{item:Ge,onClose:f},Ge.key),e[30]=f,e[31]=be):be=e[31],ue=r.map(be),e[27]=f,e[28]=r,e[29]=ue}else ue=e[29];let me;e[32]!==f||e[33]!==i?(me=n.jsx(Be,{item:i,onClose:f}),e[32]=f,e[33]=i,e[34]=me):me=e[34];let fe;e[35]!==ue||e[36]!==me?(fe=n.jsxs("nav",{className:"flex flex-col px-2 pt-2 pb-2 gap-0.5",children:[ue,me]}),e[35]=ue,e[36]=me,e[37]=fe):fe=e[37];let xe;e[38]!==de||e[39]!==fe?(xe=n.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[de,fe]}),e[38]=de,e[39]=fe,e[40]=xe):xe=e[40];let E;if(e[41]!==a.theme||e[42]!==c||e[43]!==l){let be;e[45]!==a.theme||e[46]!==c?(be=Ge=>{const{value:Ze,icon:bs,label:js}=Ge;return n.jsx("button",{type:"button","aria-label":js,onClick:()=>c(vs=>({...vs,theme:Ze})),className:J("size-8 rounded-md flex items-center justify-center transition-colors",a.theme===Ze?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:bs},Ze)},e[45]=a.theme,e[46]=c,e[47]=be):be=e[47],E=l.map(be),e[41]=a.theme,e[42]=c,e[43]=l,e[44]=E}else E=e[44];let ke;e[48]!==E?(ke=n.jsx("div",{className:"flex items-center gap-0.5",children:E}),e[48]=E,e[49]=ke):ke=e[49];const Xe=a.enableSounds?"Disable sounds":"Enable sounds";let we;e[50]!==c?(we=()=>c(Do),e[50]=c,e[51]=we):we=e[51];const Je=a.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let Ie;e[52]!==Je?(Ie=J("size-8 rounded-md flex items-center justify-center transition-colors",Je),e[52]=Je,e[53]=Ie):Ie=e[53];let Me;e[54]!==a.enableSounds?(Me=a.enableSounds?n.jsx(mt,{size:14}):n.jsx(ft,{size:14}),e[54]=a.enableSounds,e[55]=Me):Me=e[55];let $e;e[56]!==Xe||e[57]!==we||e[58]!==Ie||e[59]!==Me?($e=n.jsx("button",{type:"button","aria-label":Xe,onClick:we,className:Ie,children:Me}),e[56]=Xe,e[57]=we,e[58]=Ie,e[59]=Me,e[60]=$e):$e=e[60];let Fe;e[61]===Symbol.for("react.memo_cache_sentinel")?(Fe=n.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","2.293.0"]}),e[61]=Fe):Fe=e[61];let Te;e[62]!==$e?(Te=n.jsxs("div",{className:"flex items-center gap-2",children:[$e,Fe]}),e[62]=$e,e[63]=Te):Te=e[63];let Ae;e[64]!==ke||e[65]!==Te?(Ae=n.jsxs("div",{className:"flex items-center justify-between px-3 py-3 border-t border-border/50",children:[ke,Te]}),e[64]=ke,e[65]=Te,e[66]=Ae):Ae=e[66];let Ue;return e[67]!==re||e[68]!==xe||e[69]!==Ae?(Ue=n.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[re,xe,Ae]}),e[67]=re,e[68]=xe,e[69]=Ae,e[70]=Ue):Ue=e[70],Ue}const j=s?.name??"U";let I;e[71]!==j||e[72]!==o?(I=n.jsx(pt,{url:o,fallback:j,shape:"circle",size:"sm",className:"shrink-0"}),e[71]=j,e[72]=o,e[73]=I):I=e[73];const g=s?.name??"User";let k;e[74]!==g?(k=n.jsx("p",{className:"text-sm font-medium truncate",children:g}),e[74]=g,e[75]=k):k=e[75];const h=s?.email;let S;e[76]!==h?(S=n.jsx("p",{className:"text-xs text-muted-foreground truncate",children:h}),e[76]=h,e[77]=S):S=e[77];let y;e[78]!==k||e[79]!==S?(y=n.jsxs("div",{className:"flex-1 min-w-0",children:[k,S]}),e[78]=k,e[79]=S,e[80]=y):y=e[80];let v;e[81]!==s?(v=()=>{s?.id&&navigator.clipboard.writeText(s.id).then(Eo)},e[81]=s,e[82]=v):v=e[82];let _;e[83]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(gt,{size:14}),e[83]=_):_=e[83];let M;e[84]!==v?(M=n.jsx(tt,{asChild:!0,children:n.jsx("button",{type:"button",tabIndex:-1,onClick:v,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:_})}),e[84]=v,e[85]=M):M=e[85];let D;e[86]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx(st,{side:"right",children:n.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[86]=D):D=e[86];let w;e[87]!==M?(w=n.jsx(ht,{delayDuration:300,children:n.jsxs(nt,{children:[M,D]})}),e[87]=M,e[88]=w):w=e[88];let $;e[89]!==w||e[90]!==I||e[91]!==y?($=n.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 mx-1 mt-1",children:[I,y,w]}),e[89]=w,e[90]=I,e[91]=y,e[92]=$):$=e[92];let O;if(e[93]!==f||e[94]!==r){let G;e[96]!==f?(G=Y=>n.jsx(Be,{item:Y,onClose:f},Y.key),e[96]=f,e[97]=G):G=e[97],O=r.map(G),e[93]=f,e[94]=r,e[95]=O}else O=e[95];let T;e[98]!==f||e[99]!==i?(T=n.jsx(Be,{item:i,onClose:f}),e[98]=f,e[99]=i,e[100]=T):T=e[100];let A;e[101]!==O||e[102]!==T?(A=n.jsxs("nav",{className:"flex-1 flex flex-col px-2 pt-1 overflow-y-auto",children:[O,T]}),e[101]=O,e[102]=T,e[103]=A):A=e[103];let P;if(e[104]!==a.theme||e[105]!==c||e[106]!==l){let G;e[108]!==a.theme||e[109]!==c?(G=Y=>{const{value:ee,icon:Z,label:ne}=Y;return n.jsx("button",{type:"button","aria-label":ne,onClick:()=>c(X=>({...X,theme:ee})),className:J("size-7 rounded-md flex items-center justify-center transition-colors",a.theme===ee?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:Z},ee)},e[108]=a.theme,e[109]=c,e[110]=G):G=e[110],P=l.map(G),e[104]=a.theme,e[105]=c,e[106]=l,e[107]=P}else P=e[107];let z;e[111]!==P?(z=n.jsx("div",{className:"flex items-center gap-0.5",children:P}),e[111]=P,e[112]=z):z=e[112];const L=a.enableSounds?"Disable sounds":"Enable sounds";let R;e[113]!==c?(R=()=>c(Ro),e[113]=c,e[114]=R):R=e[114];const B=a.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let U;e[115]!==B?(U=J("size-7 rounded-md flex items-center justify-center transition-colors",B),e[115]=B,e[116]=U):U=e[116];let F;e[117]!==a.enableSounds?(F=a.enableSounds?n.jsx(mt,{size:14}):n.jsx(ft,{size:14}),e[117]=a.enableSounds,e[118]=F):F=e[118];let H;e[119]!==L||e[120]!==R||e[121]!==U||e[122]!==F?(H=n.jsx("button",{type:"button","aria-label":L,onClick:R,className:U,children:F}),e[119]=L,e[120]=R,e[121]=U,e[122]=F,e[123]=H):H=e[123];let V;e[124]===Symbol.for("react.memo_cache_sentinel")?(V=n.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","2.293.0"]}),e[124]=V):V=e[124];let q;e[125]!==H?(q=n.jsxs("div",{className:"flex items-center gap-2",children:[H,V]}),e[125]=H,e[126]=q):q=e[126];let Q;e[127]!==z||e[128]!==q?(Q=n.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 border-t border-border/50",children:[z,q]}),e[127]=z,e[128]=q,e[129]=Q):Q=e[129];let N;e[130]!==$||e[131]!==A||e[132]!==Q?(N=n.jsxs("div",{className:"w-60 shrink-0 flex flex-col border-r border-border bg-sidebar/75",children:[$,A,Q]}),e[130]=$,e[131]=A,e[132]=Q,e[133]=N):N=e[133];let K;e[134]!==x||e[135]!==m||e[136]!==d||e[137]!==u?(K=n.jsx("div",{className:"flex-1 flex flex-col min-w-0 min-h-0 overflow-hidden",children:n.jsx(Nt,{sortedOrgs:u,orgParam:d,onSelectOrg:m,onCreateOrg:x})}),e[134]=x,e[135]=m,e[136]=d,e[137]=u,e[138]=K):K=e[138];let W;return e[139]!==N||e[140]!==K?(W=n.jsxs("div",{className:"flex min-h-[380px] w-full overflow-hidden",children:[N,K]}),e[139]=N,e[140]=K,e[141]=W):W=e[141],W}function Ro(t){return{...t,enableSounds:!t.enableSounds}}function Eo(){je.success("User ID copied")}function Do(t){return{...t,enableSounds:!t.enableSounds}}function Lo(){je.success("User ID copied")}function os(){const t=C.c(50),{data:e}=Se.useSession(),{data:s}=Se.useListOrganizations(),o=ve();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org",shouldThrow:!1},t[0]=r):r=t[0];const l=$s(r)?.params.org,[a,c]=Tt(),u=Bt(),[d,m]=b.useState(!1),[x,f]=b.useState(!1),p=e?.user,j=p?.image;let I;if(t[1]!==u||t[2]!==o||t[3]!==d||t[4]!==l||t[5]!==s||t[6]!==a||t[7]!==c||t[8]!==p||t[9]!==j){const h=s?.find(W=>W.slug===l);let S;if(t[11]!==l||t[12]!==s){let W;t[14]!==l?(W=(G,Y)=>G.slug===l?-1:Y.slug===l?1:G.name.localeCompare(Y.name),t[14]=l,t[15]=W):W=t[15],S=[...s??[]].sort(W),t[11]=l,t[12]=s,t[13]=S}else S=t[13];const y=S;let v;t[16]!==o?(v=W=>{m(!1),o({to:"/$org",params:{org:W}})},t[16]=o,t[17]=v):v=t[17];const _=v;let M;t[18]===Symbol.for("react.memo_cache_sentinel")?(M=()=>m(!1),t[18]=M):M=t[18];const D=M;let w;t[19]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(Ye,{size:16}),t[19]=w):w=t[19];let $;t[20]!==o||t[21]!==l?($={key:"preferences",label:"Preferences",icon:w,onClick:()=>{o({to:"/$org/settings/profile",params:{org:l??""}})}},t[20]=o,t[21]=l,t[22]=$):$=t[22];let O;t[23]===Symbol.for("react.memo_cache_sentinel")?(O={key:"terms",label:"Terms of Use",icon:n.jsx(tn,{size:16}),href:"https://www.decocms.com/terms-of-use",external:!0},t[23]=O):O=t[23];let T;t[24]===Symbol.for("react.memo_cache_sentinel")?(T={key:"privacy",label:"Privacy Policy",icon:n.jsx(yn,{size:16}),href:"https://www.decocms.com/privacy-policy",external:!0},t[24]=T):T=t[24];let A;t[25]===Symbol.for("react.memo_cache_sentinel")?(A={key:"github",label:"decocms/studio",icon:n.jsx(Ts,{className:"w-4 h-4"}),href:"https://github.com/decocms/studio",external:!0},t[25]=A):A=t[25];let P;t[26]===Symbol.for("react.memo_cache_sentinel")?(P={key:"community",label:"Community",icon:n.jsx(Vt,{size:16}),href:"https://decocms.com/discord",external:!0},t[26]=P):P=t[26];let z;t[27]===Symbol.for("react.memo_cache_sentinel")?(z={key:"homepage",label:"Homepage",icon:n.jsx(fn,{size:16}),href:"https://decocms.com",external:!0},t[27]=z):z=t[27];let L;t[28]!==$?(L=[$,O,T,A,P,z],t[28]=$,t[29]=L):L=t[29];const R=L;let B;t[30]===Symbol.for("react.memo_cache_sentinel")?(B={key:"logout",label:"Sign out",icon:n.jsx(pn,{size:16}),onClick:Uo},t[30]=B):B=t[30];const U=B;let F;t[31]===Symbol.for("react.memo_cache_sentinel")?(F={value:"light",icon:n.jsx(bn,{size:14}),label:"Light theme"},t[31]=F):F=t[31];let H;t[32]===Symbol.for("react.memo_cache_sentinel")?(H={value:"dark",icon:n.jsx(jn,{size:14}),label:"Dark theme"},t[32]=H):H=t[32];let V;t[33]===Symbol.for("react.memo_cache_sentinel")?(V=[F,H,{value:"system",icon:n.jsx(vn,{size:14}),label:"System theme"}],t[33]=V):V=t[33];const q=V;let Q;t[34]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>{m(!1),f(!0)},t[34]=Q):Q=t[34];let N;t[35]!==_||t[36]!==u||t[37]!==R||t[38]!==l||t[39]!==a||t[40]!==c||t[41]!==y||t[42]!==p||t[43]!==j?(N={user:p,userImage:j,menuItems:R,signOutItem:U,themeOptions:q,preferences:a,setPreferences:c,sortedOrgs:y,orgParam:l,onSelectOrg:_,onCreateOrg:Q,close:D,isMobile:u},t[35]=_,t[36]=u,t[37]=R,t[38]=l,t[39]=a,t[40]=c,t[41]=y,t[42]=p,t[43]=j,t[44]=N):N=t[44];const K=N;I=u?n.jsxs(Ft,{open:d,onOpenChange:m,direction:"bottom",children:[n.jsxs("button",{type:"button",onClick:()=>m(!0),className:"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",children:[n.jsx("div",{className:"shrink-0 size-5 rounded-md flex items-center justify-center border border-border/50 overflow-hidden",style:h?.logo?void 0:rt(h?.name??""),children:h?.logo?n.jsx("img",{src:h.logo,alt:"",className:"size-full object-cover"}):n.jsx("span",{className:"font-semibold leading-none text-[8px]",children:(h?.name??"?").slice(0,2).toUpperCase()})}),n.jsx("span",{className:"truncate",children:h?.name??"Account"})]}),n.jsxs(Ut,{className:"h-[80dvh] p-0",children:[n.jsx(Gt,{className:"sr-only",children:"Account"}),n.jsx(kt,{...K})]})]}):n.jsxs(lt,{open:d,onOpenChange:m,children:[n.jsx(at,{asChild:!0,children:n.jsx(he,{tooltip:h?.name??"Account",className:"rounded-md",children:n.jsx("div",{className:"shrink-0 size-6 rounded-md flex items-center justify-center border border-border/50 overflow-hidden",style:h?.logo?void 0:rt(h?.name??""),children:h?.logo?n.jsx("img",{src:h.logo,alt:"",className:"size-full object-cover"}):n.jsx("span",{className:"font-semibold leading-none text-[9px]",children:(h?.name??"?").slice(0,2).toUpperCase()})})})}),n.jsx(ct,{side:"right",align:"end",sideOffset:18,collisionPadding:16,className:"w-[520px] p-0 flex max-h-[520px]",onCloseAutoFocus:Fo,children:n.jsx(kt,{...K})})]}),t[1]=u,t[2]=o,t[3]=d,t[4]=l,t[5]=s,t[6]=a,t[7]=c,t[8]=p,t[9]=j,t[10]=I}else I=t[10];let g;t[45]!==x?(g=n.jsx(Ao,{open:x,onOpenChange:f}),t[45]=x,t[46]=g):g=t[46];let k;return t[47]!==I||t[48]!==g?(k=n.jsxs(n.Fragment,{children:[I,g]}),t[47]=I,t[48]=g,t[49]=k):k=t[49],k}function Fo(t){return t.preventDefault()}function Uo(){se("signed_out",{source:"account_popover"}),Se.signOut()}function Go({invitation:t}){const[e,s]=b.useState(!1),[o,r]=b.useState(!1),i=Re(),l=async()=>{s(!0);try{const c=await Se.organization.acceptInvitation({invitationId:t.id});if(c.error)je.error(c.error.message),s(!1);else{const u=await Se.organization.setActive({organizationId:t.organizationId});je.success("Invitation accepted!");const d=u?.data?.slug;window.location.href=d?`/${d}`:"/"}}catch{je.error("Failed to accept invitation"),s(!1)}},a=async()=>{r(!0);try{const c=await Se.organization.rejectInvitation({invitationId:t.id});c.error?(je.error(c.error.message),r(!1)):(je.success("Invitation declined"),i.invalidateQueries())}catch{je.error("Failed to decline invitation"),r(!1)}};return n.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-border last:border-0 hover:bg-muted/25 transition-colors",children:[n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:"You've been invited to join"}),n.jsx("p",{className:"text-sm font-medium truncate",children:t.organizationName??"Unknown organization"})]}),n.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[n.jsx(et,{size:"icon",variant:"ghost",className:"size-7 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-950",onClick:l,disabled:e||o,"aria-label":"Accept invitation",children:n.jsx(Ht,{size:14})}),n.jsx(et,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:a,disabled:e||o,"aria-label":"Decline invitation",children:n.jsx(Dn,{size:14})})]})]})}function Bo(){const t=b.useContext(As),{data:e}=t.hooks.useListUserInvitations();return(e??[]).filter(o=>o.status==="pending"&&new Date(o.expiresAt)>new Date)}class Ho extends b.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,s){}render(){return this.state.hasError?null:this.props.children}}function Vo(t){return t<=1?"text-destructive":t<=5?"text-amber-500 dark:text-amber-400":"text-foreground/70"}function Ko(){const t=C.c(19),e=ve(),{org:s}=pe();let o;t[0]!==s.id?(o={connectionId:Kt,orgId:s.id},t[0]=s.id,t[1]=o):o=t[1];const r=Wt(o);let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i={providerId:"deco"},t[2]=i):i=t[2];let l;t[3]!==r?(l={client:r,toolName:"AI_PROVIDER_CREDITS",toolArguments:i,staleTime:6e4,select:Wo},t[3]=r,t[4]=l):l=t[4];const{data:a,isPending:c,isError:u}=Un(l),d=a?.balanceCents!=null?a.balanceCents/100:null;let m;t[5]!==d||t[6]!==u||t[7]!==c?(m=c||u||d==null?"Credits":`Credits: $${d.toFixed(2)}`,t[5]=d,t[6]=u,t[7]=c,t[8]=m):m=t[8];const x=m;let f;t[9]!==d?(f=J(d!=null&&Vo(d)),t[9]=d,t[10]=f):f=t[10];let p;t[11]!==e||t[12]!==s.slug?(p=()=>e({to:"/$org/settings/ai-providers",params:{org:s.slug}}),t[11]=e,t[12]=s.slug,t[13]=p):p=t[13];let j;t[14]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(sn,{size:24}),t[14]=j):j=t[14];let I;return t[15]!==f||t[16]!==p||t[17]!==x?(I=n.jsx(ge,{children:n.jsx(ie,{children:n.jsx(he,{tooltip:x,className:f,onClick:p,children:j})})}),t[15]=f,t[16]=p,t[17]=x,t[18]=I):I=t[18],I}function Wo(t){return t.structuredContent}function qo(){const t=C.c(1);if(!Gn().some(Qo))return null;let o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(Ko,{}),t[0]=o):o=t[0],o}function Qo(t){return t.providerId==="deco"}function Yo(){const t=C.c(3),[e,s]=b.useState(!1);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(ge,{children:n.jsx(ie,{children:n.jsx(he,{tooltip:"Connections",onClick:()=>{se("connections_dialog_opened",{source:"sidebar_footer",mode:"browse"}),s(!0)},children:n.jsx(hn,{size:24})})})}),t[0]=o):o=t[0];let r;return t[1]!==e?(r=n.jsxs(n.Fragment,{children:[o,n.jsx(Bn,{mode:"browse",open:e,onOpenChange:s,defaultTab:"all"})]}),t[1]=e,t[2]=r):r=t[2],r}function Xo(){const t=C.c(11),e=Bo();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(xt,{size:24}),t[0]=s):s=t[0];let o;t[1]!==e.length?(o=e.length>0&&n.jsx("span",{className:"absolute top-1 right-1 size-2 rounded-full bg-red-500 pointer-events-none"}),t[1]=e.length,t[2]=o):o=t[2];let r;t[3]!==o?(r=n.jsx(ge,{children:n.jsx(ie,{children:n.jsx(at,{asChild:!0,children:n.jsxs(he,{tooltip:"Inbox",className:"relative",children:[s,o]})})})}),t[3]=o,t[4]=r):r=t[4];let i;t[5]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("div",{className:"px-4 py-3 border-b border-border shrink-0",children:n.jsx("h3",{className:"text-sm font-medium",children:"Inbox"})}),t[5]=i):i=t[5];let l;t[6]!==e?(l=n.jsxs(ct,{side:"right",align:"start",sideOffset:16,collisionPadding:16,className:"w-[min(400px,calc(100vw-2rem))] p-0 h-[min(650px,calc(100dvh-4rem))] flex flex-col",children:[i,e.length===0?n.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[n.jsx(xt,{size:24,className:"text-muted-foreground/50"}),n.jsx("p",{className:"text-sm font-medium text-foreground",children:"No invites pending"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Organization invitations will appear here"})]}):n.jsx("div",{className:"overflow-y-auto flex-1",children:e.map(Jo)})]}),t[6]=e,t[7]=l):l=t[7];let a;return t[8]!==r||t[9]!==l?(a=n.jsxs(lt,{children:[r,l]}),t[8]=r,t[9]=l,t[10]=a):a=t[10],a}function Jo(t){return n.jsx(Go,{invitation:t},t.id)}function Zo(){const t=C.c(6),e=ve(),{org:s}=pe();let o;t[0]!==e||t[1]!==s.slug?(o=()=>e({to:"/$org/settings",params:{org:s.slug}}),t[0]=e,t[1]=s.slug,t[2]=o):o=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(Ye,{size:24}),t[3]=r):r=t[3];let i;return t[4]!==o?(i=n.jsx(ge,{children:n.jsx(ie,{children:n.jsx(he,{tooltip:"Settings",onClick:o,children:r})})}),t[4]=o,t[5]=i):i=t[5],i}function er(){const t=C.c(5);let e,s,o,r;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Ho,{children:n.jsx(b.Suspense,{fallback:null,children:n.jsx(qo,{})})}),s=n.jsx(Yo,{}),o=n.jsx(Xo,{}),r=n.jsx(Zo,{}),t[0]=e,t[1]=s,t[2]=o,t[3]=r):(e=t[0],s=t[1],o=t[2],r=t[3]);let i;return t[4]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsxs(Et,{className:"px-2 pb-3 gap-1",children:[e,s,o,r,n.jsx(ge,{children:n.jsx(ie,{children:n.jsx(os,{})})})]}),t[4]=i):i=t[4],i}function tr(){const t=C.c(10),e=ve(),{org:s}=pe(),{setOpenMobile:o}=Qe();let r;t[0]!==e||t[1]!==s.slug||t[2]!==o?(r=()=>{e({to:"/$org/settings",params:{org:s.slug}}),o(!1)},t[0]=e,t[1]=s.slug,t[2]=o,t[3]=r):r=t[3];let i;t[4]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(Ye,{}),t[4]=i):i=t[4];let l;t[5]!==r?(l=n.jsx(ie,{children:n.jsx(he,{tooltip:"Settings",onClick:r,children:i})}),t[5]=r,t[6]=l):l=t[6];let a;t[7]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(ie,{children:n.jsx(os,{})}),t[7]=a):a=t[7];let c;return t[8]!==l?(c=n.jsx(Et,{children:n.jsxs(ge,{children:[l,a]})}),t[8]=l,t[9]=c):c=t[9],c}var dt="ContextMenu",[sr]=Us(dt,[At]),te=At(),[nr,rs]=sr(dt),is=t=>{const{__scopeContextMenu:e,children:s,onOpenChange:o,dir:r,modal:i=!0}=t,[l,a]=b.useState(!1),c=te(e),u=Ps(o),d=b.useCallback(m=>{a(m),u(m)},[u]);return n.jsx(nr,{scope:e,open:l,onOpenChange:d,modal:i,children:n.jsx(Os,{...c,dir:r,open:l,onOpenChange:d,modal:i,children:s})})};is.displayName=dt;var ls="ContextMenuTrigger",as=b.forwardRef((t,e)=>{const{__scopeContextMenu:s,disabled:o=!1,...r}=t,i=rs(ls,s),l=te(s),a=b.useRef({x:0,y:0}),c=b.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),u=b.useRef(0),d=b.useCallback(()=>window.clearTimeout(u.current),[]),m=x=>{a.current={x:x.clientX,y:x.clientY},i.onOpenChange(!0)};return b.useEffect(()=>d,[d]),b.useEffect(()=>{o&&d()},[o,d]),n.jsxs(n.Fragment,{children:[n.jsx(zs,{...l,virtualRef:c}),n.jsx(Rs.span,{"data-state":i.open?"open":"closed","data-disabled":o?"":void 0,...r,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:o?t.onContextMenu:Oe(t.onContextMenu,x=>{d(),m(x),x.preventDefault()}),onPointerDown:o?t.onPointerDown:Oe(t.onPointerDown,He(x=>{d(),u.current=window.setTimeout(()=>m(x),700)})),onPointerMove:o?t.onPointerMove:Oe(t.onPointerMove,He(d)),onPointerCancel:o?t.onPointerCancel:Oe(t.onPointerCancel,He(d)),onPointerUp:o?t.onPointerUp:Oe(t.onPointerUp,He(d))})]})});as.displayName=ls;var or="ContextMenuPortal",cs=t=>{const{__scopeContextMenu:e,...s}=t,o=te(e);return n.jsx(Es,{...o,...s})};cs.displayName=or;var ds="ContextMenuContent",us=b.forwardRef((t,e)=>{const{__scopeContextMenu:s,...o}=t,r=rs(ds,s),i=te(s),l=b.useRef(!1);return n.jsx(Ds,{...i,...o,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:a=>{t.onCloseAutoFocus?.(a),!a.defaultPrevented&&l.current&&a.preventDefault(),l.current=!1},onInteractOutside:a=>{t.onInteractOutside?.(a),!a.defaultPrevented&&!r.modal&&(l.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});us.displayName=ds;var rr="ContextMenuGroup",ir=b.forwardRef((t,e)=>{const{__scopeContextMenu:s,...o}=t,r=te(s);return n.jsx(Gs,{...r,...o,ref:e})});ir.displayName=rr;var lr="ContextMenuLabel",ar=b.forwardRef((t,e)=>{const{__scopeContextMenu:s,...o}=t,r=te(s);return n.jsx(Bs,{...r,...o,ref:e})});ar.displayName=lr;var cr="ContextMenuItem",ms=b.forwardRef((t,e)=>{const{__scopeContextMenu:s,...o}=t,r=te(s);return n.jsx(Ls,{...r,...o,ref:e})});ms.displayName=cr;var dr="ContextMenuCheckboxItem",ur=b.forwardRef((t,e)=>{const{__scopeContextMenu:s,...o}=t,r=te(s);return n.jsx(Hs,{...r,...o,ref:e})});ur.displayName=dr;var mr="ContextMenuRadioGroup",fr=b.forwardRef((t,e)=>{const{__scopeContextMenu:s,...o}=t,r=te(s);return n.jsx(Vs,{...r,...o,ref:e})});fr.displayName=mr;var xr="ContextMenuRadioItem",pr=b.forwardRef((t,e)=>{const{__scopeContextMenu:s,...o}=t,r=te(s);return n.jsx(Ks,{...r,...o,ref:e})});pr.displayName=xr;var hr="ContextMenuItemIndicator",gr=b.forwardRef((t,e)=>{const{__scopeContextMenu:s,...o}=t,r=te(s);return n.jsx(Ws,{...r,...o,ref:e})});gr.displayName=hr;var br="ContextMenuSeparator",fs=b.forwardRef((t,e)=>{const{__scopeContextMenu:s,...o}=t,r=te(s);return n.jsx(Fs,{...r,...o,ref:e})});fs.displayName=br;var jr="ContextMenuArrow",vr=b.forwardRef((t,e)=>{const{__scopeContextMenu:s,...o}=t,r=te(s);return n.jsx(qs,{...r,...o,ref:e})});vr.displayName=jr;var yr="ContextMenuSubTrigger",_r=b.forwardRef((t,e)=>{const{__scopeContextMenu:s,...o}=t,r=te(s);return n.jsx(Qs,{...r,...o,ref:e})});_r.displayName=yr;var Sr="ContextMenuSubContent",Cr=b.forwardRef((t,e)=>{const{__scopeContextMenu:s,...o}=t,r=te(s);return n.jsx(Ys,{...r,...o,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Cr.displayName=Sr;function He(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var Nr=is,kr=as,wr=cs,Ir=us,Mr=ms,$r=fs;function Tr(t){const e=C.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let o;return e[2]!==s?(o=n.jsx(Nr,{"data-slot":"context-menu",...s}),e[2]=s,e[3]=o):o=e[3],o}function Ar(t){const e=C.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let o;return e[2]!==s?(o=n.jsx(kr,{"data-slot":"context-menu-trigger",...s}),e[2]=s,e[3]=o):o=e[3],o}function Pr(t){const e=C.c(8);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let r;e[3]!==s?(r=J("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",s),e[3]=s,e[4]=r):r=e[4];let i;return e[5]!==o||e[6]!==r?(i=n.jsx(wr,{children:n.jsx(Ir,{"data-slot":"context-menu-content",className:r,...o})}),e[5]=o,e[6]=r,e[7]=i):i=e[7],i}function wt(t){const e=C.c(12);let s,o,r,i;e[0]!==t?({className:s,inset:o,variant:i,...r}=t,e[0]=t,e[1]=s,e[2]=o,e[3]=r,e[4]=i):(s=e[1],o=e[2],r=e[3],i=e[4]);const l=i===void 0?"default":i;let a;e[5]!==s?(a=J("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",s),e[5]=s,e[6]=a):a=e[6];let c;return e[7]!==o||e[8]!==r||e[9]!==a||e[10]!==l?(c=n.jsx(Mr,{"data-slot":"context-menu-item","data-inset":o,"data-variant":l,className:a,...r}),e[7]=o,e[8]=r,e[9]=a,e[10]=l,e[11]=c):c=e[11],c}function Or(t){const e=C.c(8);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let r;e[3]!==s?(r=J("bg-border -mx-1 my-1 h-px",s),e[3]=s,e[4]=r):r=e[4];let i;return e[5]!==o||e[6]!==r?(i=n.jsx($r,{"data-slot":"context-menu-separator",className:r,...o}),e[5]=o,e[6]=r,e[7]=i):i=e[7],i}function zr(t){const e=ve(),s=Re(),o=Xt(),{locator:r}=pe(),i=We({strict:!1}),l=qe({strict:!1});return async a=>{const c=crypto.randomUUID(),u=a===l.virtualmcpid?Lt(s,r,i.taskId??""):null;try{await o.create.mutateAsync({id:c,virtual_mcp_id:a,...u?{branch:u}:{}})}catch{}e({to:"/$org/$taskId",params:{org:t,taskId:c},search:{virtualmcpid:a}})}}function Rr({agent:t,org:e,onUnpin:s,isDragging:o}){const r=ve(),{isMobile:i,setOpenMobile:l}=Qe(),a=Hn(e),u=It({select:h=>h.location.pathname}).startsWith(`/${e}/${t.id}`),[d,m]=b.useState(null),x=b.useRef(null),f=b.useRef(null),p=b.useRef(!1);p.current=!!o,o&&(d||f.current)&&(f.current&&(clearTimeout(f.current),f.current=null),d&&m(null));const j=h=>{if(p.current)return;const S=h.currentTarget.getBoundingClientRect();f.current=setTimeout(()=>{p.current||m(S)},550)},I=h=>{f.current&&(clearTimeout(f.current),f.current=null),!(x.current&&h.relatedTarget instanceof Node&&x.current.contains(h.relatedTarget))&&m(null)},g=d?Math.round(d.height*.9):0,k=d?d.width+g:0;return n.jsx(Tr,{children:n.jsxs(ie,{className:J(d&&"z-[55]"),children:[n.jsx(Ar,{asChild:!0,children:n.jsx(he,{tooltip:d?void 0:t.title,isActive:u,onClick:async()=>{i&&l(!1);const{resumed:h}=await a(t.id);se("sidebar_agent_pin_clicked",{agent_id:t.id,agent_title:t.title,resumed:h})},onMouseEnter:j,onMouseLeave:I,children:n.jsx(Pe,{icon:t.icon,name:t.title,size:"xs",className:"w-full h-full [&_svg]:w-1/2 [&_svg]:h-1/2"})})}),n.jsxs(Pr,{children:[n.jsxs(wt,{onClick:()=>{const h=crypto.randomUUID();r({to:"/$org/$taskId",params:{org:e,taskId:h},search:{virtualmcpid:t.id}})},children:[n.jsx(Ye,{size:14}),"Settings"]}),n.jsx(Or,{}),n.jsxs(wt,{onClick:()=>{s(),u&&r({to:"/$org",params:{org:e}})},className:"",children:[n.jsx(jt,{size:14}),"Unpin"]})]}),d&&Ee.createPortal(n.jsx("button",{ref:x,type:"button",onMouseLeave:()=>m(null),onClick:h=>{h.stopPropagation(),m(null),s(),r({to:"/$org",params:{org:e}})},className:J("flex items-center justify-center","bg-sidebar-accent text-muted-foreground","rounded-xl cursor-pointer","animate-in fade-in-0 slide-in-from-right-2","duration-150 [animation-timing-function:cubic-bezier(0.165,0.84,0.44,1)]","hover:text-foreground transition-colors"),style:{position:"fixed",top:d.top,left:d.left,height:d.height,width:k,paddingLeft:d.width,zIndex:50,boxShadow:"inset 0 0 0.5px 1px hsla(0, 0%, 100%, 0.075), 0 0 0 0.5px hsla(0, 0%, 0%, 0.12)"},children:n.jsx(jt,{size:14})}),document.body)]})})}function Er(t){const e=C.c(18);let s;e[0]!==t.agent.id?(s={id:t.agent.id},e[0]=t.agent.id,e[1]=s):s=e[1];const{attributes:o,listeners:r,setNodeRef:i,transform:l,transition:a,isDragging:c}=oo(s);let u;e[2]!==l?(u=ro.Transform.toString(l?{...l,x:0}:null),e[2]=l,e[3]=u):u=e[3];const d=c?.5:void 0,m=c?100:void 0;let x;e[4]!==u||e[5]!==d||e[6]!==m||e[7]!==a?(x={transform:u,transition:a,opacity:d,zIndex:m},e[4]=u,e[5]=d,e[6]=m,e[7]=a,e[8]=x):x=e[8];const f=x;let p;e[9]!==c||e[10]!==t?(p=n.jsx(Rr,{...t,isDragging:c}),e[9]=c,e[10]=t,e[11]=p):p=e[11];let j;return e[12]!==o||e[13]!==r||e[14]!==i||e[15]!==f||e[16]!==p?(j=n.jsx("div",{ref:i,style:f,...o,...r,tabIndex:-1,className:"w-full",children:p}),e[12]=o,e[13]=r,e[14]=i,e[15]=f,e[16]=p,e[17]=j):j=e[17],j}function Dr(t){const e=C.c(9),{agent:s,onClick:o}=t;let r;e[0]!==s.icon||e[1]!==s.title?(r=n.jsx(Pe,{icon:s.icon,name:s.title,size:"md",className:"transition-transform group-hover:scale-105"}),e[0]=s.icon,e[1]=s.title,e[2]=r):r=e[2];let i;e[3]!==s.title?(i=n.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground line-clamp-2 w-full",children:s.title}),e[3]=s.title,e[4]=i):i=e[4];let l;return e[5]!==o||e[6]!==r||e[7]!==i?(l=n.jsxs("button",{type:"button",onClick:o,className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group",children:[r,i]}),e[5]=o,e[6]=r,e[7]=i,e[8]=l):l=e[8],l}function Lr(t){const e=C.c(80),{onClose:s,onOpenImportDeco:o,onOpenGithubImport:r,onOpenSelfHealing:i,onOpenDiagnosticsModal:l,onOpenLeanCanvasModal:a,onOpenStudioPackModal:c,onOpenAiImageModal:u,onOpenAiResearchModal:d}=t,[m,x]=b.useState(""),f=qt(),{org:p}=pe();let j;e[0]!==f?(j=f.filter(Wr).map(Kr),e[0]=f,e[1]=j):j=e[1];const I=j,{pin:g,isPinned:k}=Yt(p.id,I);let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={navigateOnCreate:!0},e[2]=h):h=e[2];const{createVirtualMCP:S,isCreating:y}=ao(h),[v]=Tt(),_=zr(p.slug),M=lo();let D,w,$,O,T,A,P,z;if(e[3]!==f||e[4]!==S||e[5]!==y||e[6]!==k||e[7]!==M||e[8]!==_||e[9]!==s||e[10]!==u||e[11]!==d||e[12]!==l||e[13]!==r||e[14]!==o||e[15]!==a||e[16]!==i||e[17]!==c||e[18]!==g||e[19]!==v.experimental_vibecode||e[20]!==m){const V=m.toLowerCase();z=f.filter(Vr).filter(E=>!m||E.title.toLowerCase().includes(V));let q;e[29]!==f?(q=f.some(Hr),e[29]=f,e[30]=q):q=e[30];const Q=q;D=ze.filter(E=>(!m||E.title.toLowerCase().includes(V))&&!(E.id==="studio-pack"&&Q)&&!(E.id==="self-healing-storefront"&&!v.experimental_vibecode));let N;e[31]===Symbol.for("react.memo_cache_sentinel")?(N=ze.find(Br),e[31]=N):N=e[31];const K=N,W=K?f.find(E=>E.metadata?.type===K.id):void 0;let G;e[32]===Symbol.for("react.memo_cache_sentinel")?(G=ze.find(Gr),e[32]=G):G=e[32];const Y=G,ee=Y?f.find(E=>E.metadata?.type===Y.id):void 0;let Z;e[33]===Symbol.for("react.memo_cache_sentinel")?(Z=ze.find(Ur),e[33]=Z):Z=e[33];const ne=Z,X=ne?f.find(E=>E.metadata?.type===ne.id):void 0;let oe;e[34]===Symbol.for("react.memo_cache_sentinel")?(oe=ze.find(Fr),e[34]=oe):oe=e[34];const ae=oe,Ne=ae?f.find(E=>E.metadata?.type===ae.id):void 0;let ce;e[35]!==k||e[36]!==_||e[37]!==s||e[38]!==g?(ce=E=>{k(E.id)||g(E.id),s(),x(""),_(E.id)},e[35]=k,e[36]=_,e[37]=s,e[38]=g,e[39]=ce):ce=e[39];const ye=ce,_e=E=>{s(),x(""),E==="self-healing-storefront"?i():E==="site-editor"?o():E==="site-diagnostics"?W?M(W.id):l():E==="lean-canvas"?ee?M(ee.id):a():E==="ai-image"?X?M(X.id):u():E==="ai-research"?Ne?M(Ne.id):d():E==="studio-pack"?c():_(E)};A="flex flex-col max-h-[min(640px,80dvh)]",e[40]!==m?(P=n.jsx(io,{value:m,onChange:x,placeholder:"Search agents..."}),e[40]=m,e[41]=P):P=e[41],w="overflow-y-auto flex-1 min-h-0 px-3 pb-3",e[42]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx("div",{className:"px-1 pt-3 pb-2",children:n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Agents"})}),e[42]=$):$=e[42];let re;e[43]!==S||e[44]!==s?(re=async()=>{se("agent_create_new_clicked",{source:"browse_popover"}),await S(),s()},e[43]=S,e[44]=s,e[45]=re):re=e[45];let de,ue;e[46]===Symbol.for("react.memo_cache_sentinel")?(de=n.jsx("div",{className:"w-12 h-12 rounded-xl border-2 border-dashed border-border flex items-center justify-center shrink-0 transition-transform group-hover:scale-105",children:n.jsx(Ke,{size:16,className:"text-muted-foreground"})}),ue=n.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground",children:"Create new"}),e[46]=de,e[47]=ue):(de=e[46],ue=e[47]);let me;e[48]!==y||e[49]!==re?(me=n.jsxs("button",{type:"button",disabled:y,onClick:re,className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group disabled:opacity-50 disabled:cursor-not-allowed",children:[de,ue]}),e[48]=y,e[49]=re,e[50]=me):me=e[50];let fe;e[51]!==s||e[52]!==r||e[53]!==v.experimental_vibecode?(fe=v.experimental_vibecode&&n.jsxs("button",{type:"button",onClick:()=>{se("agent_import_clicked",{source:"github"}),r(),s()},className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl border-2 border-border flex items-center justify-center shrink-0 transition-transform group-hover:scale-105",children:n.jsx(po,{className:"size-5 text-muted-foreground"})}),n.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground",children:"Import GitHub"})]}),e[51]=s,e[52]=r,e[53]=v.experimental_vibecode,e[54]=fe):fe=e[54];let xe;e[55]!==ye?(xe=E=>n.jsx(Dr,{agent:E,onClick:()=>ye(E)},E.id),e[55]=ye,e[56]=xe):xe=e[56],O=n.jsxs("div",{className:"grid grid-cols-3 gap-1",children:[me,fe,z.map(xe)]}),T=D.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"px-1 pt-4 pb-2",children:n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Agent templates"})}),n.jsx("div",{className:"grid grid-cols-3 gap-1",children:D.map(E=>n.jsxs("button",{type:"button",onClick:()=>{se("agent_template_clicked",{template_id:E.id,template_title:E.title}),_e(E.id)},className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group disabled:opacity-50 disabled:cursor-not-allowed",children:[n.jsx(Pe,{icon:E.icon,name:E.title,size:"md",className:"transition-transform group-hover:scale-105"}),n.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground line-clamp-2 w-full",children:E.title})]},E.id))})]}),e[3]=f,e[4]=S,e[5]=y,e[6]=k,e[7]=M,e[8]=_,e[9]=s,e[10]=u,e[11]=d,e[12]=l,e[13]=r,e[14]=o,e[15]=a,e[16]=i,e[17]=c,e[18]=g,e[19]=v.experimental_vibecode,e[20]=m,e[21]=D,e[22]=w,e[23]=$,e[24]=O,e[25]=T,e[26]=A,e[27]=P,e[28]=z}else D=e[21],w=e[22],$=e[23],O=e[24],T=e[25],A=e[26],P=e[27],z=e[28];let L;e[57]!==D||e[58]!==y||e[59]!==m||e[60]!==z.length?(L=z.length===0&&D.length===0&&!y&&n.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:m?"No agents found":"No agents yet"}),e[57]=D,e[58]=y,e[59]=m,e[60]=z.length,e[61]=L):L=e[61];let R;e[62]!==w||e[63]!==$||e[64]!==O||e[65]!==T||e[66]!==L?(R=n.jsxs("div",{className:w,children:[$,O,T,L]}),e[62]=w,e[63]=$,e[64]=O,e[65]=T,e[66]=L,e[67]=R):R=e[67];let B;e[68]!==p.slug?(B={org:p.slug},e[68]=p.slug,e[69]=B):B=e[69];let U;e[70]!==s?(U=()=>s(),e[70]=s,e[71]=U):U=e[71];let F;e[72]!==B||e[73]!==U?(F=n.jsx("div",{className:"border-t border-border px-3 py-2.5",children:n.jsx(Xs,{to:"/$org/settings/agents",params:B,onClick:U,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:"See all agents"})}),e[72]=B,e[73]=U,e[74]=F):F=e[74];let H;return e[75]!==R||e[76]!==F||e[77]!==A||e[78]!==P?(H=n.jsxs("div",{className:A,children:[P,R,F]}),e[75]=R,e[76]=F,e[77]=A,e[78]=P,e[79]=H):H=e[79],H}function Fr(t){return t.id==="ai-research"}function Ur(t){return t.id==="ai-image"}function Gr(t){return t.id==="lean-canvas"}function Br(t){return t.id==="site-diagnostics"}function Hr(t){return Fn(t.id)}function Vr(t){return!Ln(t.id)}function Kr(t){return t.id}function Wr(t){return t.pinned}function qr(){const t=C.c(36),[e,s]=b.useState(!1),[o,r]=b.useState(!1),[i,l]=b.useState(!1),[a,c]=b.useState(!1),[u,d]=b.useState(!1),[m,x]=b.useState(!1),[f,p]=b.useState(!1),[j,I]=b.useState(!1),[g,k]=b.useState(!1),h=Bt(),{setOpenMobile:S}=Qe();let y;t[0]!==h||t[1]!==S?(y=()=>{s(!1),h&&S(!1)},t[0]=h,t[1]=S,t[2]=y):y=t[2];const v=y;let _;t[3]!==v||t[4]!==e?(_=e&&n.jsx(b.Suspense,{fallback:n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx(Ve,{className:"h-4 w-24"})}),children:n.jsx(Lr,{onClose:v,onOpenImportDeco:()=>r(!0),onOpenGithubImport:()=>{l(!0),v()},onOpenSelfHealing:()=>{c(!0),v()},onOpenDiagnosticsModal:()=>d(!0),onOpenLeanCanvasModal:()=>x(!0),onOpenStudioPackModal:()=>p(!0),onOpenAiImageModal:()=>I(!0),onOpenAiResearchModal:()=>k(!0)})}),t[3]=v,t[4]=e,t[5]=_):_=t[5];const M=_;let D;t[6]!==h||t[7]!==e||t[8]!==M?(D=h?n.jsxs(n.Fragment,{children:[n.jsx(ie,{children:n.jsx(he,{tooltip:"Browse agents",className:"bg-muted/75 hover:bg-sidebar-accent",onClick:()=>{se("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},children:n.jsx(Ke,{className:"!opacity-100"})})}),n.jsx(Ft,{open:e,onOpenChange:s,direction:"bottom",children:n.jsxs(Ut,{className:"max-h-[85dvh] p-0",children:[n.jsx(Gt,{className:"sr-only",children:"Browse agents"}),M]})})]}):n.jsxs(lt,{open:e,onOpenChange:B=>{B&&!e&&se("agent_browser_opened",{surface:"desktop_popover"}),s(B)},children:[n.jsx(ie,{children:n.jsx(at,{asChild:!0,children:n.jsx(he,{tooltip:"Browse agents",className:"bg-muted/75 hover:bg-sidebar-accent",children:n.jsx(Ke,{className:"!opacity-100"})})})}),n.jsx(ct,{className:"w-[380px] p-0 overflow-hidden",side:"right",align:"start",children:M})]}),t[6]=h,t[7]=e,t[8]=M,t[9]=D):D=t[9];let w;t[10]!==o?(w=n.jsx(co,{open:o,onOpenChange:r}),t[10]=o,t[11]=w):w=t[11];let $;t[12]!==i?($=n.jsx(uo,{open:i,onOpenChange:l}),t[12]=i,t[13]=$):$=t[13];let O;t[14]!==a?(O=n.jsx(Vn,{open:a,onOpenChange:c}),t[14]=a,t[15]=O):O=t[15];let T;t[16]!==u?(T=n.jsx(mo,{open:u,onOpenChange:d}),t[16]=u,t[17]=T):T=t[17];let A;t[18]!==m?(A=n.jsx(fo,{open:m,onOpenChange:x}),t[18]=m,t[19]=A):A=t[19];let P;t[20]!==f?(P=n.jsx(xo,{open:f,onOpenChange:p}),t[20]=f,t[21]=P):P=t[21];let z;t[22]!==j?(z=n.jsx(Kn,{open:j,onOpenChange:I}),t[22]=j,t[23]=z):z=t[23];let L;t[24]!==g?(L=n.jsx(Wn,{open:g,onOpenChange:k}),t[24]=g,t[25]=L):L=t[25];let R;return t[26]!==L||t[27]!==D||t[28]!==w||t[29]!==$||t[30]!==O||t[31]!==T||t[32]!==A||t[33]!==P||t[34]!==z?(R=n.jsxs(n.Fragment,{children:[D,w,$,O,T,A,P,z,L]}),t[26]=L,t[27]=D,t[28]=w,t[29]=$,t[30]=O,t[31]=T,t[32]=A,t[33]=P,t[34]=z,t[35]=R):R=t[35],R}function Qr(){const t=C.c(34),e=qt(),{org:s}=pe();let o;t[0]!==e?(o=e.filter(Zr).map(Jr),t[0]=e,t[1]=o):o=t[1];const r=o,{pinnedIds:i,unpin:l,reorder:a}=Yt(s.id,r),c=new Map(e.map(Xr)),u=i.map(R=>c.get(R)).filter(Yr);let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d={activationConstraint:{distance:5}},t[2]=d):d=t[2];let m;t[3]===Symbol.for("react.memo_cache_sentinel")?(m={coordinateGetter:so},t[3]=m):m=t[3];const x=Qn(bt(Xn,d),bt(Yn,m));let f;t[4]!==i||t[5]!==a?(f=R=>{const{active:B,over:U}=R;if(!U||B.id===U.id)return;const F=i.indexOf(B.id),H=i.indexOf(U.id);F===-1||H===-1||a(no([...i],F,H))},t[4]=i,t[5]=a,t[6]=f):f=t[6];const p=f,j=De,I="py-0 px-0 mt-2 flex-1 min-h-0";let g;t[7]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx("div",{className:"h-px bg-border mx-2 mb-2"}),t[7]=g):g=t[7];const k=Le,h="flex flex-1 min-h-0 flex-col overflow-y-auto [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",S=ge,y="gap-2";let v;t[8]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(qr,{}),t[8]=v):v=t[8];const _=eo,M=to,D=Jn,w=Zn;let $;t[9]!==s.slug||t[10]!==l?($=R=>n.jsx(Er,{agent:R,org:s.slug,onUnpin:()=>l(R.id)},R.id),t[9]=s.slug,t[10]=l,t[11]=$):$=t[11];const O=u.map($);let T;t[12]!==D||t[13]!==i||t[14]!==w||t[15]!==O?(T=n.jsx(D,{items:i,strategy:w,children:O}),t[12]=D,t[13]=i,t[14]=w,t[15]=O,t[16]=T):T=t[16];let A;t[17]!==_||t[18]!==p||t[19]!==x||t[20]!==T||t[21]!==M?(A=n.jsx(_,{sensors:x,collisionDetection:M,onDragEnd:p,children:T}),t[17]=_,t[18]=p,t[19]=x,t[20]=T,t[21]=M,t[22]=A):A=t[22];let P;t[23]!==S||t[24]!==A||t[25]!==v?(P=n.jsxs(S,{className:y,children:[v,A]}),t[23]=S,t[24]=A,t[25]=v,t[26]=P):P=t[26];let z;t[27]!==k||t[28]!==P?(z=n.jsx(k,{className:h,children:P}),t[27]=k,t[28]=P,t[29]=z):z=t[29];let L;return t[30]!==j||t[31]!==z||t[32]!==g?(L=n.jsxs(j,{className:I,children:[g,z]}),t[30]=j,t[31]=z,t[32]=g,t[33]=L):L=t[33],L}function Yr(t){return!!t}function Xr(t){return[t.id,t]}function Jr(t){return t.id}function Zr(t){return t.pinned}function xs(){const t=C.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(b.Suspense,{fallback:n.jsx(De,{className:"py-0 px-0",children:n.jsx(Le,{children:n.jsx(ge,{className:"gap-2",children:n.jsx(ie,{children:n.jsxs("div",{className:"flex items-center gap-2 px-2 py-2",children:[n.jsx(Ve,{className:"h-4 w-4 rounded"}),n.jsx(Ve,{className:"h-4 flex-1"})]})})})})}),children:n.jsx(Qr,{})}),t[0]=e):e=t[0],e}function yl(){const t=C.c(4),e=Zt();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(er,{}),t[0]=s):s=t[0];let o;t[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(it,{children:n.jsx(b.Suspense,{fallback:null,children:n.jsx(xs,{})})}),t[1]=o):o=t[1];let r;return t[2]!==e?(r=n.jsx(ss,{sections:e,footer:s,additionalContent:o}),t[2]=e,t[3]=r):r=t[3],r}function _l(t){const e=C.c(5),{onClose:s}=t,o=Zt();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(tr,{}),e[0]=r):r=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(it,{children:n.jsx(b.Suspense,{fallback:null,children:n.jsx(xs,{})})}),e[1]=i):i=e[1];let l;return e[2]!==s||e[3]!==o?(l=n.jsx($o,{sections:o,onClose:s,footer:r,additionalContent:i}),e[2]=s,e[3]=o,e[4]=l):l=e[4],l}function ei(t,e){return t===1?!0:t===0?!1:e}function ti(t){const e=t.entityMetadata?.defaultMainView??null,s=e==null||e.type==="chat",o=t.mainParamPresent?t.mainParamValue!=="0":!s,r=s?!0:t.entityMetadata?.chatDefaultOpen??!1;return{mainOpen:o,chatOpen:r}}function Sl(t,e){return t&&e?{chat:45,main:55}:t&&!e?{chat:100,main:0}:!t&&e?{chat:0,main:100}:{chat:0,main:0}}function si(t,e){return t===1?!0:t===0?!1:e}function Cl(t,e){const s=ve(),o=qe({strict:!1}),r=We({strict:!1}),i=Re(),l=Xt(),{locator:a}=pe(),{virtualMcpId:c,orgSlug:u,isAgentRoute:d}=e,m=ti({entityMetadata:t,mainParamPresent:o.main!==void 0,mainParamValue:o.main}),x=si(o.chat,m.chatOpen),f=m.mainOpen,p=b.useRef(crypto.randomUUID()),j=r.taskId??p.current,I="/$org/$taskId",g=w=>({org:u,taskId:w}),k=d?{virtualmcpid:c}:{},h=(w,$)=>{s({to:I,params:g(j),search:O=>({...O,...w}),replace:$?.replace??!1})},S=(w,$)=>{s({to:I,params:g(w),search:O=>{const T={};return $?T.virtualmcpid=$:d&&(T.virtualmcpid=c),O.tasks&&(T.tasks=O.tasks),T}})},y=()=>{f?h({main:"0"},{replace:!0}):h({main:un(t)},{replace:!0})},v=()=>{h({chat:x?0:1},{replace:!0})},_=()=>{x||h({chat:1},{replace:!0})},M=async()=>{const w=crypto.randomUUID(),$=Lt(i,a,j);try{await l.create.mutateAsync({id:w,virtual_mcp_id:c,...$?{branch:$}:{}})}catch{}s({to:I,params:g(w),search:O=>{const T={...k,chat:1};return O.tasks&&(T.tasks=O.tasks),T}})},D=w=>{h({main:w},{replace:!0})};return{taskId:j,mainOpen:f,chatOpen:x,mainParam:o.main,setTaskId:S,toggleMain:y,toggleChat:v,openChat:_,createNewTask:M,openTab:D}}const ut=b.createContext(null);function Nl(t){const e=C.c(15),{children:s}=t,o=ve();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[0]=r):r=e[0];const i=qe(r);let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l={owner:"all",status:"open"},e[1]=l):l=e[1];const{tasks:a}=ot(l);let c;e[2]!==i.tasks||e[3]!==a.length?(c=()=>ei(i.tasks,a.length>0),e[2]=i.tasks,e[3]=a.length,e[4]=c):c=e[4];const[u,d]=b.useState(c);let m,x;e[5]!==o||e[6]!==u?(m=()=>{o({search:(g=>({...g,tasks:u?1:0})),replace:!0})},x=[u,o],e[5]=o,e[6]=u,e[7]=m,e[8]=x):(m=e[7],x=e[8]),b.useEffect(m,x);let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=()=>d(ni),e[9]=f):f=e[9];const p=f;let j;e[10]!==u?(j={tasksOpen:u,toggleTasks:p},e[10]=u,e[11]=j):j=e[11];let I;return e[12]!==s||e[13]!==j?(I=n.jsx(ut.Provider,{value:j,children:s}),e[12]=s,e[13]=j,e[14]=I):I=e[14],I}function ni(t){return!t}function kl(){const t=b.useContext(ut);if(!t)throw new Error("useTasksPanelState must be used inside <TasksPanelStateProvider>");return t}function wl(){return b.useContext(ut)}const ps=b.createContext(null);function Ce(){const t=b.use(ps);if(!t)throw new Error("Toolbar.* must be used inside <Toolbar>");return t}function le(t){const e=C.c(10),{children:s}=t,[o,r]=b.useState(null),[i,l]=b.useState(null),[a,c]=b.useState(null),[u,d]=b.useState(null);let m;e[0]!==a||e[1]!==u||e[2]!==i||e[3]!==o?(m={togglesEl:o,setTogglesEl:r,tabsEl:i,setTabsEl:l,centerEl:a,setCenterEl:c,rightEl:u,setRightEl:d},e[0]=a,e[1]=u,e[2]=i,e[3]=o,e[4]=m):m=e[4];let x;e[5]!==s?(x=n.jsx("div",{className:"flex flex-col h-full min-h-0",children:s}),e[5]=s,e[6]=x):x=e[6];let f;return e[7]!==m||e[8]!==x?(f=n.jsx(ps,{value:m,children:x}),e[7]=m,e[8]=x,e[9]=f):f=e[9],f}function oi(t){const e=C.c(2),{children:s}=t;let o;return e[0]!==s?(o=n.jsx("div",{className:"shrink-0 grid grid-cols-3 items-center pl-1 pr-2 pt-0.25 h-12",children:s}),e[0]=s,e[1]=o):o=e[1],o}function ri(t){const e=C.c(2),{children:s}=t;let o;return e[0]!==s?(o=n.jsx("div",{className:"flex items-center gap-0.5 min-w-0 justify-self-start",children:s}),e[0]=s,e[1]=o):o=e[1],o}function ii(t){const e=C.c(2),{children:s}=t;let o;return e[0]!==s?(o=n.jsx("div",{className:"flex items-center justify-end gap-0.5 min-w-0 justify-self-end",children:s}),e[0]=s,e[1]=o):o=e[1],o}function li(){const t=C.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("button",{type:"button",onClick:ci,className:"flex size-7 shrink-0 items-center justify-center rounded-md text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Go back",children:n.jsx(gn,{size:16})}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs(n.Fragment,{children:[e,n.jsx("button",{type:"button",onClick:ai,className:"flex size-7 shrink-0 items-center justify-center rounded-md text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Go forward",children:n.jsx(go,{size:16})})]}),t[1]=s):s=t[1],s}function ai(){return window.history.forward()}function ci(){return window.history.back()}function di(){const t=C.c(2),{setCenterEl:e}=Ce();let s;return t[0]!==e?(s=n.jsx("div",{ref:e,className:"min-w-0 flex items-center justify-center gap-2"}),t[0]=e,t[1]=s):s=t[1],s}function ui(t){const e=C.c(3),{children:s}=t,{centerEl:o}=Ce();if(!o)return null;let r;return e[0]!==o||e[1]!==s?(r=Ee.createPortal(s,o),e[0]=o,e[1]=s,e[2]=r):r=e[2],r}function mi(){const t=C.c(2),{setTabsEl:e}=Ce();let s;return t[0]!==e?(s=n.jsx("div",{ref:e,className:"shrink-0 flex items-center overflow-x-auto"}),t[0]=e,t[1]=s):s=t[1],s}function fi(t){const e=C.c(3),{children:s}=t,{tabsEl:o}=Ce();if(!o)return null;let r;return e[0]!==s||e[1]!==o?(r=Ee.createPortal(s,o),e[0]=s,e[1]=o,e[2]=r):r=e[2],r}function xi(){const t=C.c(2),{setTogglesEl:e}=Ce();let s;return t[0]!==e?(s=n.jsx("div",{ref:e,className:"flex items-center gap-0.5 shrink-0 ml-0.5"}),t[0]=e,t[1]=s):s=t[1],s}function pi(t){const e=C.c(3),{children:s}=t,{togglesEl:o}=Ce();if(!o)return null;let r;return e[0]!==s||e[1]!==o?(r=Ee.createPortal(s,o),e[0]=s,e[1]=o,e[2]=r):r=e[2],r}function hi(){const t=C.c(2),{setRightEl:e}=Ce();let s;return t[0]!==e?(s=n.jsx("div",{ref:e,className:"flex items-center justify-end gap-0.5 shrink-0"}),t[0]=e,t[1]=s):s=t[1],s}function gi(t){const e=C.c(3),{children:s}=t,{rightEl:o}=Ce();if(!o)return null;let r;return e[0]!==s||e[1]!==o?(r=Ee.createPortal(s,o),e[0]=s,e[1]=o,e[2]=r):r=e[2],r}le.Header=oi;le.LeftColumn=ri;le.RightColumn=ii;le.Nav=li;le.CenterSlot=di;le.Center=ui;le.TabsSlot=mi;le.Tabs=fi;le.TogglesSlot=xi;le.Toggles=pi;le.RightSlot=hi;le.Right=gi;function bi(){const t=C.c(6),{org:e,locator:s}=pe(),o=Re();let r;t[0]!==s||t[1]!==o?(r=()=>{o.invalidateQueries({queryKey:Pt.tasksPrefix(s)})},t[0]=s,t[1]=o,t[2]=r):r=t[2];let i;t[3]!==e.id||t[4]!==r?(i={orgId:e.id,onTaskStatus:r},t[3]=e.id,t[4]=r,t[5]=i):i=t[5],jo(i)}function ji(t){const e=C.c(8),{virtualMcpId:s,size:o,showAutomationBadge:r}=t,i=o===void 0?"sm":o;let l;e[0]!==i||e[1]!==s?(l=s?n.jsx(vi,{virtualMcpId:s,size:i}):n.jsx(Pe,{icon:null,name:"?",size:i}),e[0]=i,e[1]=s,e[2]=l):l=e[2];let a;e[3]!==r?(a=r&&n.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:n.jsx(vo,{size:10,className:"text-white"})}),e[3]=r,e[4]=a):a=e[4];let c;return e[5]!==l||e[6]!==a?(c=n.jsxs("div",{className:"relative shrink-0",children:[l,a]}),e[5]=l,e[6]=a,e[7]=c):c=e[7],c}function vi(t){const e=C.c(6),{virtualMcpId:s,size:o}=t,r=Qt(s);if(!r){let a;return e[0]!==o?(a=n.jsx(Pe,{icon:null,name:"?",size:o}),e[0]=o,e[1]=a):a=e[1],a}const i=r.icon??null;let l;return e[2]!==r.title||e[3]!==o||e[4]!==i?(l=n.jsx(Pe,{icon:i,name:r.title,size:o}),e[2]=r.title,e[3]=o,e[4]=i,e[5]=l):l=e[5],l}function yi(t){const e=t?.metadata?.githubRepo;return e?.connectionId&&t?.connections?.some(o=>o.connection_id===e.connectionId)?e:null}function _i(t){const e=C.c(47),{task:s,isActive:o,onClick:r,onArchive:i,showAutomationBadge:l}=t,a=yo(s.status),c=a.icon,u=Qt(s.virtual_mcp_id);let d;e[0]!==u?(d=yi(u),e[0]=u,e[1]=d):d=e[1];const m=d,x=b.useRef(null);let f;e[2]!==o?(f=()=>{if(!o)return;const V=x.current;V&&(V.focus({preventScroll:!0}),V.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"}))},e[2]=o,e[3]=f):f=e[3];let p;e[4]!==o||e[5]!==s.id?(p=[o,s.id],e[4]=o,e[5]=s.id,e[6]=p):p=e[6],b.useEffect(f,p);const j="button",I=0;let g;e[7]!==r?(g=V=>{V.target===V.currentTarget&&(V.key==="Enter"||V.key===" ")&&(V.preventDefault(),r())},e[7]=r,e[8]=g):g=e[8];const k=o?"bg-accent":"hover:bg-accent/60";let h;e[9]!==k?(h=J("group/row flex items-center gap-3 px-2 py-1.5 rounded-md cursor-pointer transition-colors",k),e[9]=k,e[10]=h):h=e[10];let S;e[11]!==l||e[12]!==s.virtual_mcp_id?(S=n.jsx(ji,{virtualMcpId:s.virtual_mcp_id,size:"xs",showAutomationBadge:l}),e[11]=l,e[12]=s.virtual_mcp_id,e[13]=S):S=e[13];const y=s.title||"Untitled task";let v;e[14]!==y?(v=n.jsx("div",{className:"text-sm text-foreground truncate",children:y}),e[14]=y,e[15]=v):v=e[15];let _;e[16]!==m||e[17]!==s.branch||e[18]!==s.updated_at?(_=s.updated_at&&n.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground min-w-0",children:[s.branch?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"truncate font-mono",children:s.branch}),n.jsx("span",{className:"shrink-0",children:"·"})]}):m?n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"truncate",children:[m.owner,"/",m.name]}),n.jsx("span",{className:"shrink-0",children:"·"})]}):null,n.jsx("span",{className:"shrink-0",children:mn(new Date(s.updated_at))})]}),e[16]=m,e[17]=s.branch,e[18]=s.updated_at,e[19]=_):_=e[19];let M;e[20]!==v||e[21]!==_?(M=n.jsxs("div",{className:"flex-1 min-w-0",children:[v,_]}),e[20]=v,e[21]=_,e[22]=M):M=e[22];const D="shrink-0 grid [grid-template-areas:'slot'] items-center justify-items-center",w="[grid-area:slot] flex size-7 items-center justify-center group-hover/row:invisible",$=a.label,O=14,T=J(a.iconClassName,s.status==="in_progress"&&"animate-spin");let A;e[23]!==c||e[24]!==T?(A=n.jsx(c,{size:O,className:T}),e[23]=c,e[24]=T,e[25]=A):A=e[25];let P;e[26]!==a||e[27]!==A?(P=n.jsx("span",{className:w,"aria-label":$,children:A}),e[26]=a,e[27]=A,e[28]=P):P=e[28];let z;e[29]!==i?(z=V=>{V.stopPropagation(),i()},e[29]=i,e[30]=z):z=e[30];let L;e[31]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx(nn,{size:14}),e[31]=L):L=e[31];let R;e[32]!==z?(R=n.jsx(tt,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":"Archive task",onClick:z,className:"[grid-area:slot] invisible group-hover/row:visible flex size-7 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted",children:L})}),e[32]=z,e[33]=R):R=e[33];let B;e[34]===Symbol.for("react.memo_cache_sentinel")?(B=n.jsx(st,{side:"right",children:"Archive"}),e[34]=B):B=e[34];let U;e[35]!==R?(U=n.jsxs(nt,{children:[R,B]}),e[35]=R,e[36]=U):U=e[36];let F;e[37]!==P||e[38]!==U?(F=n.jsxs("div",{className:D,children:[P,U]}),e[37]=P,e[38]=U,e[39]=F):F=e[39];let H;return e[40]!==r||e[41]!==M||e[42]!==F||e[43]!==g||e[44]!==h||e[45]!==S?(H=n.jsxs("div",{ref:x,role:j,tabIndex:I,onClick:r,onKeyDown:g,className:h,children:[S,M,F]}),e[40]=r,e[41]=M,e[42]=F,e[43]=g,e[44]=h,e[45]=S,e[46]=H):H=e[46],H}const hs={all:"All tasks",manual:"Chats",automation:"Automation"},gs={all:"All members",mine:"Mine only"};function Si(t){const e=C.c(59),{title:s,tasks:o,activeTaskId:r,onSelect:i,onArchive:l,onNew:a,showNewButton:c,showAutomationBadge:u,emptyLabel:d,currentUserId:m}=t,[x,f]=b.useState("all"),[p,j]=b.useState("mine");let I;e[0]!==m||e[1]!==p||e[2]!==o?(I=p==="mine"&&m?o.filter(N=>N.created_by===m):o,e[0]=m,e[1]=p,e[2]=o,e[3]=I):I=e[3];const g=I;let k;e[4]!==x||e[5]!==g?(k=x==="automation"?g.filter(wi):x==="manual"?g.filter(ki):g,e[4]=x,e[5]=g,e[6]=k):k=e[6];const h=k;let S;e[7]!==s?(S=n.jsx("span",{children:s}),e[7]=s,e[8]=S):S=e[8];let y;e[9]!==p?(y=n.jsx(vt,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":"Filter by member",className:"flex size-8 items-center justify-center rounded-md hover:bg-muted hover:text-foreground",children:p==="mine"?n.jsx(rn,{size:16}):n.jsx(Vt,{size:16})})}),e[9]=p,e[10]=y):y=e[10];let v;e[11]!==p?(v=N=>{const K=N;K!==p&&se("tasks_panel_member_filter_changed",{to_value:K}),j(K)},e[11]=p,e[12]=v):v=e[12];let _;e[13]===Symbol.for("react.memo_cache_sentinel")?(_=Object.keys(gs),e[13]=_):_=e[13];let M;e[14]===Symbol.for("react.memo_cache_sentinel")?(M=_.map(Ni),e[14]=M):M=e[14];let D;e[15]!==p||e[16]!==v?(D=n.jsx(yt,{align:"end",children:n.jsx(_t,{value:p,onValueChange:v,children:M})}),e[15]=p,e[16]=v,e[17]=D):D=e[17];let w;e[18]!==y||e[19]!==D?(w=n.jsxs(St,{children:[y,D]}),e[18]=y,e[19]=D,e[20]=w):w=e[20];const $=x!=="all"&&"text-purple-500";let O;e[21]!==$?(O=J("flex size-8 items-center justify-center rounded-md hover:bg-muted hover:text-foreground",$),e[21]=$,e[22]=O):O=e[22];let T;e[23]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx(xn,{size:16}),e[23]=T):T=e[23];let A;e[24]!==O?(A=n.jsx(vt,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":"Filter tasks",className:O,children:T})}),e[24]=O,e[25]=A):A=e[25];let P;e[26]!==x?(P=N=>{const K=N;K!==x&&se("tasks_panel_filter_changed",{to_value:K}),f(K)},e[26]=x,e[27]=P):P=e[27];let z;e[28]===Symbol.for("react.memo_cache_sentinel")?(z=Object.keys(hs),e[28]=z):z=e[28];let L;e[29]===Symbol.for("react.memo_cache_sentinel")?(L=z.map(Ci),e[29]=L):L=e[29];let R;e[30]!==x||e[31]!==P?(R=n.jsx(yt,{align:"end",children:n.jsx(_t,{value:x,onValueChange:P,children:L})}),e[30]=x,e[31]=P,e[32]=R):R=e[32];let B;e[33]!==A||e[34]!==R?(B=n.jsxs(St,{children:[A,R]}),e[33]=A,e[34]=R,e[35]=B):B=e[35];let U;e[36]!==a||e[37]!==c||e[38]!==s?(U=c&&a&&n.jsx("button",{type:"button",onClick:()=>{se("tasks_panel_new_clicked"),a()},"aria-label":`New ${s.toLowerCase()}`,className:"flex size-8 items-center justify-center rounded-md hover:bg-muted hover:text-foreground",children:n.jsx(on,{size:16})}),e[36]=a,e[37]=c,e[38]=s,e[39]=U):U=e[39];let F;e[40]!==B||e[41]!==U||e[42]!==w?(F=n.jsxs("div",{className:"flex items-center gap-0.5",children:[w,B,U]}),e[40]=B,e[41]=U,e[42]=w,e[43]=F):F=e[43];let H;e[44]!==F||e[45]!==S?(H=n.jsxs("div",{className:"shrink-0 pl-2 pr-1.5 h-7 flex items-center justify-between text-xs font-medium text-muted-foreground mb-1",children:[S,F]}),e[44]=F,e[45]=S,e[46]=H):H=e[46];let V;e[47]!==r||e[48]!==d||e[49]!==l||e[50]!==i||e[51]!==u||e[52]!==h?(V=h.length===0&&d?n.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground/70",children:d}):h.map(N=>n.jsx(_i,{task:N,isActive:r===N.id,onClick:()=>{r!==N.id&&se("tasks_panel_task_clicked",{thread_id:N.id,virtual_mcp_id:N.virtual_mcp_id??null,from_automation:!!N.fromAutomation}),i(N)},onArchive:()=>{se("tasks_panel_task_archived",{thread_id:N.id,virtual_mcp_id:N.virtual_mcp_id??null}),l(N)},showAutomationBadge:u||N.fromAutomation},N.id)),e[47]=r,e[48]=d,e[49]=l,e[50]=i,e[51]=u,e[52]=h,e[53]=V):V=e[53];let q;e[54]!==V?(q=n.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto flex flex-col gap-0.5",children:V}),e[54]=V,e[55]=q):q=e[55];let Q;return e[56]!==H||e[57]!==q?(Q=n.jsxs("div",{className:"flex flex-col h-full min-h-0 mt-1",children:[H,q]}),e[56]=H,e[57]=q,e[58]=Q):Q=e[58],Q}function Ci(t){return n.jsx(Jt,{value:t,children:hs[t]},t)}function Ni(t){return n.jsx(Jt,{value:t,children:gs[t]},t)}function ki(t){return!t.fromAutomation}function wi(t){return t.fromAutomation}function Ii(){const t=C.c(22);bi();const{data:e}=Se.useSession(),s=e?.user?.id;let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={owner:"me",status:"open",hasTrigger:!1},t[0]=o):o=t[0];const{tasks:r}=ot(o);let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i={owner:"all",status:"open",hasTrigger:!0},t[1]=i):i=t[1];const{tasks:l}=ot(i),{setTaskId:a,createNewTask:c}=Dt();let u;t[2]===Symbol.for("react.memo_cache_sentinel")?(u={strict:!1},t[2]=u):u=t[2];const d=We(u),{locator:m,org:x}=pe(),f=Re();let p;t[3]!==x.id?(p={connectionId:Kt,orgId:x.id},t[3]=x.id,t[4]=p):p=t[4];const j=Wt(p),I=d.taskId??null;let g;t[5]!==l||t[6]!==r?(g=[...r,...l.map($i)].sort(Mi),t[5]=l,t[6]=r,t[7]=g):g=t[7];const k=g;let h;t[8]!==j||t[9]!==m||t[10]!==f?(h=async _=>{try{await ho(j,_.id,{hidden:!0}),f.invalidateQueries({queryKey:Pt.tasksPrefix(m)})}catch(M){const w=M;je.error(`Failed to archive task: ${w.message}`)}},t[8]=j,t[9]=m,t[10]=f,t[11]=h):h=t[11];const S=h;if(k.length===0){let _;return t[12]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx("div",{className:"h-full flex items-center justify-center p-4",children:n.jsx(bo,{image:n.jsx(ln,{size:48,className:"text-muted-foreground"}),title:"No tasks yet",description:"Start a conversation to create your first task."})}),t[12]=_):_=t[12],_}let y;t[13]!==a?(y=_=>a(_.id,_.virtual_mcp_id),t[13]=a,t[14]=y):y=t[14];let v;return t[15]!==I||t[16]!==k||t[17]!==c||t[18]!==s||t[19]!==S||t[20]!==y?(v=n.jsx("div",{className:"flex flex-col h-full min-h-0 p-2 gap-3",children:n.jsx(Si,{title:"Tasks",tasks:k,activeTaskId:I,onSelect:y,onArchive:S,onNew:c,showNewButton:!0,currentUserId:s})}),t[15]=I,t[16]=k,t[17]=c,t[18]=s,t[19]=S,t[20]=y,t[21]=v):v=t[21],v}function Mi(t,e){return(e.updated_at??"").localeCompare(t.updated_at??"")}function $i(t){return{...t,fromAutomation:!0}}function Ti(){const t=C.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex flex-col h-full p-2 gap-1.5",children:Array.from({length:6}).map(Ai)}),t[0]=e):e=t[0],e}function Ai(t,e){return n.jsx("div",{className:"h-10 rounded-md bg-muted/60 animate-pulse"},e)}function Il(){const t=C.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(qn.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(it,{fallback:e,children:n.jsx(b.Suspense,{fallback:n.jsx(Ti,{}),children:n.jsx(Ii,{})})}),t[1]=s):s=t[1],s}export{yl as S,Il as T,Nl as a,le as b,Sl as c,wl as d,Cl as e,_l as f,yi as g,kl as u};