decocms 4.582.1 → 4.583.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 (552) hide show
  1. package/dist/client/assets/{AlertCircle-DT2ZDuIl.js → AlertCircle-BfuEGc37.js} +1 -1
  2. package/dist/client/assets/{AreaChart-DcNurrpT.js → AreaChart-DR454FhG.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-DR_MRxUB.js → ArrowLeft-Ccyza8AK.js} +1 -1
  4. package/dist/client/assets/ArrowRight-BfJPk4p9.js +1 -0
  5. package/dist/client/assets/{ArrowUp-BdtMKnAz.js → ArrowUp-Cfwuhrfj.js} +1 -1
  6. package/dist/client/assets/{BookOpen01-DejCO54_.js → BookOpen01-vaPiqXWZ.js} +1 -1
  7. package/dist/client/assets/{CartesianChart-43C3tGyF.js → CartesianChart-Vg3-F_Bi.js} +1 -1
  8. package/dist/client/assets/{CategoricalChart-GawOpO41.js → CategoricalChart-gtbFaKuM.js} +1 -1
  9. package/dist/client/assets/{CheckCircle-CM--cqi0.js → CheckCircle-WpYwhp7A.js} +1 -1
  10. package/dist/client/assets/ChevronDown-Kpzb5_P-.js +1 -0
  11. package/dist/client/assets/{ChevronSelectorVertical-BJDM_s_Z.js → ChevronSelectorVertical-DNPn4Jhl.js} +1 -1
  12. package/dist/client/assets/ChevronUp-CwLphDxo.js +1 -0
  13. package/dist/client/assets/{CreditCard01-BKZ9QJb-.js → CreditCard01-CDUEuZ6_.js} +1 -1
  14. package/dist/client/assets/Eye-BeTcpGN-.js +1 -0
  15. package/dist/client/assets/File02-D8jC2XAm.js +1 -0
  16. package/dist/client/assets/{Globe04-BZJYx7x5.js → Globe04-CM5K7y4B.js} +1 -1
  17. package/dist/client/assets/Image01-0Jwady1a.js +1 -0
  18. package/dist/client/assets/{Key01-CC_tghZO.js → Key01-Dqvoolzt.js} +1 -1
  19. package/dist/client/assets/LayoutLeft-Nn_BPz0l.js +1 -0
  20. package/dist/client/assets/LinkBroken01-6J7zZ1XX.js +1 -0
  21. package/dist/client/assets/Minimize01-Dylk6LHz.js +1 -0
  22. package/dist/client/assets/{Minus-Bj5yI5D8.js → Minus-BFZz-RWg.js} +1 -1
  23. package/dist/client/assets/{Monitor01-DeK03po-.js → Monitor01-ZIydqkip.js} +1 -1
  24. package/dist/client/assets/{Play-kYcUI1An.js → Play-CkrBckKV.js} +1 -1
  25. package/dist/client/assets/{Plus-DEeR8qC2.js → Plus-C8Idvwpa.js} +1 -1
  26. package/dist/client/assets/{ReferenceLine-DbQts9AQ.js → ReferenceLine-2ZGA3m5C.js} +1 -1
  27. package/dist/client/assets/{SearchMd-DVpGBR2l.js → SearchMd-G9SUUXxg.js} +1 -1
  28. package/dist/client/assets/{ShoppingBag01-BV5nZGeU.js → ShoppingBag01-sbzM0fY9.js} +1 -1
  29. package/dist/client/assets/{Sun-Ba2OXmDv.js → Sun-Bvg5JrAI.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-Cp1oX99F.js → SwitchHorizontal01-BbD-SqO6.js} +1 -1
  31. package/dist/client/assets/Tool01-DOjdBvJ6.js +1 -0
  32. package/dist/client/assets/{Tooltip-DNR0eew9.js → Tooltip-buu7_uLC.js} +1 -1
  33. package/dist/client/assets/{Trash01-CgZrkZ3U.js → Trash01-BRIjyxCC.js} +1 -1
  34. package/dist/client/assets/TrendUp01-DLgSqdSd.js +1 -0
  35. package/dist/client/assets/{Upload01-DDoiK0tv.js → Upload01-Dd-OapHB.js} +1 -1
  36. package/dist/client/assets/UserCheck01-DVOI9Qq6.js +1 -0
  37. package/dist/client/assets/{UserSquare-DEjJtCDR.js → UserSquare-CRBGeews.js} +1 -1
  38. package/dist/client/assets/{Users01-DVMhWmct.js → Users01-bZ_S-kH7.js} +1 -1
  39. package/dist/client/assets/{XClose-xYIhBL8b.js → XClose-CWGS9q3D.js} +1 -1
  40. package/dist/client/assets/{Zap-BsuEhLd3.js → Zap-BxaAY56U.js} +1 -1
  41. package/dist/client/assets/{access-gate-BYQd4796.js → access-gate-BpukTmFQ.js} +1 -1
  42. package/dist/client/assets/{add-connection-dialog-C86xZwTt.js → add-connection-dialog-BfsrivZp.js} +1 -1
  43. package/dist/client/assets/agent-app-ZmiqpLI8.js +1 -0
  44. package/dist/client/assets/agent-assets-CxDlSc-F.js +1 -0
  45. package/dist/client/assets/agent-automation-Cvq2MsBo.js +20 -0
  46. package/dist/client/assets/agent-automations-DqPMEPTu.js +1 -0
  47. package/dist/client/assets/agent-blog-CBUzxo-R.js +2 -0
  48. package/dist/client/assets/agent-blog-post-Bi0pzlIG.js +2 -0
  49. package/dist/client/assets/agent-calendar-D817wzif.js +1 -0
  50. package/dist/client/assets/{agent-capabilities-B40k722B.js → agent-capabilities-COfZW6Pr.js} +1 -1
  51. package/dist/client/assets/agent-connect-sources-DEAtqQDn.js +1 -0
  52. package/dist/client/assets/agent-deck-DLJ_JEHY.js +1 -0
  53. package/dist/client/assets/agent-e2e-B_mxpyua.js +1 -0
  54. package/dist/client/assets/agent-experiments-CC4vS2Ak.js +1 -0
  55. package/dist/client/assets/agent-file-DaY3pEIy.js +1 -0
  56. package/dist/client/assets/agent-hosting-CNynwqai.js +1 -0
  57. package/dist/client/assets/agent-icon-DE4TWlDl.js +1 -0
  58. package/dist/client/assets/agent-library-53yJ_N0C.js +1 -0
  59. package/dist/client/assets/agent-library-file-CmdRdcgJ.js +1 -0
  60. package/dist/client/assets/agent-overview-Bjahi54k.js +1 -0
  61. package/dist/client/assets/agent-releases-De-C-EMX.js +2 -0
  62. package/dist/client/assets/agent-settings-Bmfo6yEF.js +1 -0
  63. package/dist/client/assets/{agent-site-editor-CS9MMMbk.js → agent-site-editor-B5E5lU9u.js} +2 -2
  64. package/dist/client/assets/agent-site-editor-code-BzQzaZAE.js +2 -0
  65. package/dist/client/assets/agent-site-editor-content-D03NaTwn.js +1 -0
  66. package/dist/client/assets/agent-site-editor-preview-wStmeJD1.js +1 -0
  67. package/dist/client/assets/agent-view-Dh2W4gDj.js +1 -0
  68. package/dist/client/assets/agent-view-guard-25E2XJRr.js +1 -0
  69. package/dist/client/assets/ai-providers-E4UhWu6J.js +1 -0
  70. package/dist/client/assets/{alert-DFQMLwuf.js → alert-GV95Dsn9.js} +1 -1
  71. package/dist/client/assets/analytics-sections-C9-8NbQC.js +1 -0
  72. package/dist/client/assets/api-keys-BU9wHAPs.js +1 -0
  73. package/dist/client/assets/api-keys-C8ArQ5p_.js +1 -0
  74. package/dist/client/assets/app-editor-kEra9PRa.js +1 -0
  75. package/dist/client/assets/{asset-utils-DxQXeDgB.js → asset-utils-DWvcPbEZ.js} +1 -1
  76. package/dist/client/assets/{auth-catchall-ChHXwieU.js → auth-catchall-Dy37bIqg.js} +1 -1
  77. package/dist/client/assets/{auth-entry-BUy5eNSm.js → auth-entry-BHlmJEBv.js} +1 -1
  78. package/dist/client/assets/{auth-Br21RAsk.js → auth-gL3R1YGn.js} +1 -1
  79. package/dist/client/assets/{auth-split-layout-DXcvh-93.js → auth-split-layout-ckQyQHcL.js} +1 -1
  80. package/dist/client/assets/{authenticate-and-persist-oauth-CTJV9ez5.js → authenticate-and-persist-oauth-C7oT67KU.js} +1 -1
  81. package/dist/client/assets/automation-list-row-DriFJJzl.js +1 -0
  82. package/dist/client/assets/{automation-runs-BluUkmKT.js → automation-runs-C37do2Pw.js} +1 -1
  83. package/dist/client/assets/automations-tDs_UhVP.js +1 -0
  84. package/dist/client/assets/{badge-C2zO_tAX.js → badge-BG-k6t3T.js} +1 -1
  85. package/dist/client/assets/{block-document-DTM21O-Q.js → block-document-pPtike34.js} +3 -3
  86. package/dist/client/assets/{blocks-preview-workspace-context-0qX3i0Hw.js → blocks-preview-workspace-context-BBjk2tme.js} +1 -1
  87. package/dist/client/assets/{blocks-tab-states-BZoxOO-H.js → blocks-tab-states-GP0NCNYs.js} +1 -1
  88. package/dist/client/assets/{blog-preview-url-Bcn3MddY.js → blog-preview-url-CwSXxQWr.js} +1 -1
  89. package/dist/client/assets/blog-schema-DOB707mb.js +1 -0
  90. package/dist/client/assets/{blog-source-gate-DcD3mNPu.js → blog-source-gate-3rG_0gJI.js} +1 -1
  91. package/dist/client/assets/blog-view-gate-Be4DtolQ.js +1 -0
  92. package/dist/client/assets/buckets-BZrhNTRn.js +1 -0
  93. package/dist/client/assets/{build-improve-prompt-doc-BYTmOiJ8.js → build-improve-prompt-doc-DVbQXrhG.js} +1 -1
  94. package/dist/client/assets/calendar-CcuaFZRF.js +1 -0
  95. package/dist/client/assets/{capability-load-error-CHW06qRY.js → capability-load-error-Bcs21XUc.js} +1 -1
  96. package/dist/client/assets/category-editor-CnJqxifY.js +1 -0
  97. package/dist/client/assets/{category-tree-EQNjX_vh.js → category-tree-D2ejZxYL.js} +1 -1
  98. package/dist/client/assets/{chart-DP-afdSL.js → chart-B2B-jcI-.js} +1 -1
  99. package/dist/client/assets/chat-context-CiT7AzBS.js +43 -0
  100. package/dist/client/assets/{chat-draft-BnT_bTVf.js → chat-draft-BNZV2YjB.js} +1 -1
  101. package/dist/client/assets/{checkbox-Dn6r2X61.js → checkbox-DSC8VbDf.js} +1 -1
  102. package/dist/client/assets/choose-editor-uAW7DjQg.js +1 -0
  103. package/dist/client/assets/{cli-auth-success-BWjEoABt.js → cli-auth-success-B897Xynp.js} +1 -1
  104. package/dist/client/assets/cms-settings-editor-B4pAxgqZ.js +1 -0
  105. package/dist/client/assets/{cms-store-drafts-DC7_MPeX.js → cms-store-drafts-CtClpzKs.js} +1 -1
  106. package/dist/client/assets/{collapsible-waKUBV3F.js → collapsible-DrV9qsGN.js} +1 -1
  107. package/dist/client/assets/collection-detail-DucMHrT0.js +1 -0
  108. package/dist/client/assets/{collection-display-button-CpOX39FE.js → collection-display-button-BHyM7wC2.js} +1 -1
  109. package/dist/client/assets/{collection-search-CKJ8zcS9.js → collection-search-BbCHAL7t.js} +1 -1
  110. package/dist/client/assets/{collection-table-wrapper-DX64SyX5.js → collection-table-wrapper-BlLHObjj.js} +1 -1
  111. package/dist/client/assets/{collection-tabs-DL3FYMaD.js → collection-tabs-BXeEDC1Y.js} +1 -1
  112. package/dist/client/assets/{combobox-CZTRaybI.js → combobox-DugO3-8Q.js} +1 -1
  113. package/dist/client/assets/{command-B0-oLV0k.js → command-Bo6EGcaE.js} +1 -1
  114. package/dist/client/assets/{companion-mcps-section-CAkQdc3e.js → companion-mcps-section-CsXLIG2Z.js} +1 -1
  115. package/dist/client/assets/config-CdVwRL_a.js +1 -0
  116. package/dist/client/assets/{client-icons-B7ckFhTB.js → connect-key--cfk-fLm.js} +1 -1
  117. package/dist/client/assets/{connect-layout-By1LwNsY.js → connect-layout-BPppRISp.js} +1 -1
  118. package/dist/client/assets/connect-lufub1FU.js +9 -0
  119. package/dist/client/assets/{connect-source-dialog-Clx35W2U.js → connect-source-dialog-CfsFTEbG.js} +1 -1
  120. package/dist/client/assets/{connection-CwOP2DkA.js → connection-BLQs5hMz.js} +1 -1
  121. package/dist/client/assets/{connection-card-DxEnheWw.js → connection-card-vLs08dR6.js} +1 -1
  122. package/dist/client/assets/connection-detail-CLkPYY1x.js +1 -0
  123. package/dist/client/assets/{connection-form-helpers-DsiTws_r.js → connection-form-helpers-BSIh8Ep0.js} +1 -1
  124. package/dist/client/assets/connection-slug-CmPPcsjf.js +1 -0
  125. package/dist/client/assets/connections-C4ZbA0RY.js +1 -0
  126. package/dist/client/assets/{content-tab-D3gTzU_j.js → content-tab-C-pzFX10.js} +4 -4
  127. package/dist/client/assets/context-3bSluoDN.js +1 -0
  128. package/dist/client/assets/{context-menu-BAywIeQG.js → context-menu-CzIORBDb.js} +1 -1
  129. package/dist/client/assets/{context-shell-C8ZPCYjw.js → context-shell-3lL8N_R5.js} +4 -4
  130. package/dist/client/assets/{create-organization-dialog-BpL43B76.js → create-organization-dialog-k086v-9Q.js} +1 -1
  131. package/dist/client/assets/daily-pulse-P6H0d8QI.js +1 -0
  132. package/dist/client/assets/{delete-copy-UjfjjP4_.js → delete-copy-BQaedVkX.js} +1 -1
  133. package/dist/client/assets/{device-hint-AWxEadtg.js → device-hint-CvnqGHIy.js} +1 -1
  134. package/dist/client/assets/discover-qzwfuJLu.js +1 -0
  135. package/dist/client/assets/{domain-settings-BCvvef40.js → domain-settings-y3u2iu2W.js} +1 -1
  136. package/dist/client/assets/{drawer-CfOCKnhq.js → drawer-CarQd6Jb.js} +1 -1
  137. package/dist/client/assets/{editor-COFIs9XE.js → editor-DYk_2MJQ.js} +1 -1
  138. package/dist/client/assets/{editor-classes-aqVUSPbm.js → editor-classes-DVIoQu74.js} +1 -1
  139. package/dist/client/assets/{empty-message-CirmMDhM.js → empty-message-C90DlePv.js} +1 -1
  140. package/dist/client/assets/{empty-state-C7Sg1bax.js → empty-state-B67nwURy.js} +1 -1
  141. package/dist/client/assets/{empty-state-CFvQY7HR.js → empty-state-XAK3RjVy.js} +1 -1
  142. package/dist/client/assets/experiments-tab-choice-D8ZqCESL.js +1 -0
  143. package/dist/client/assets/{extract-connection-data-CFxfI9gN.js → extract-connection-data-D6CjTXbp.js} +1 -1
  144. package/dist/client/assets/feature-gate-CCvZeJRu.js +1 -0
  145. package/dist/client/assets/{feature-paywall-AtUr_EOu.js → feature-paywall-DzmzZ5s3.js} +1 -1
  146. package/dist/client/assets/file-explorer-BqxAkXtr.js +2 -0
  147. package/dist/client/assets/{file-preview-PSKf9fIz.js → file-preview-C0yEEExh.js} +1 -1
  148. package/dist/client/assets/file-share-button-CowSSkLB.js +3 -0
  149. package/dist/client/assets/{file-type-icon-3Zm8W435.js → file-type-icon-CEP8k4gh.js} +1 -1
  150. package/dist/client/assets/folder-icon-CmtFeppJ.js +1 -0
  151. package/dist/client/assets/{form-BZ7xdssd.js → form-8GAe5FIZ.js} +1 -1
  152. package/dist/client/assets/{frame-navigation-8oPGH7NY.js → frame-navigation-BpI5RQJq.js} +1 -1
  153. package/dist/client/assets/gateway-client-BqPME1T5.js +1 -0
  154. package/dist/client/assets/general-DbhKzHt5.js +1 -0
  155. package/dist/client/assets/{github-icon-DH5Sm3NR.js → github-icon-BH4kK9If.js} +1 -1
  156. package/dist/client/assets/{held-block-view-BR-UYX4S.js → held-block-view-MI6LUwjK.js} +3 -3
  157. package/dist/client/assets/home-_NmLJi-9.js +1 -0
  158. package/dist/client/assets/home-overview-CTEEkh3w.js +1 -0
  159. package/dist/client/assets/{hosted-reconcile-C5UVxzTP.js → hosted-reconcile-BbIfIwl1.js} +1 -1
  160. package/dist/client/assets/{icon-button-BfibpDoO.js → icon-button-Dd8gTd4-.js} +1 -1
  161. package/dist/client/assets/index-B-OtHlgY.js +4 -0
  162. package/dist/client/assets/{index-BXpXjiyK.js → index-BRHz7VD8.js} +1 -1
  163. package/dist/client/assets/{index-dsAQGF7D.js → index-BY10zRfl.js} +1 -1
  164. package/dist/client/assets/index-B_-z8Lrt.js +1 -0
  165. package/dist/client/assets/{index-DF1Gszum.js → index-C17JTAPe.js} +2 -2
  166. package/dist/client/assets/{index-n1AjR0vt.js → index-CADsC-mK.js} +2 -2
  167. package/dist/client/assets/{index-BpLEscAk.js → index-CYjM_f4V.js} +1 -1
  168. package/dist/client/assets/{index-Db96seLi.js → index-CZQ-Wgjf.js} +1 -1
  169. package/dist/client/assets/{index-BP527m3V.js → index-CwntHk8S.js} +13 -13
  170. package/dist/client/assets/index-DClpdtOI.js +1 -0
  171. package/dist/client/assets/{index-Ds3fsbcX.js → index-DEOQXzn-.js} +1 -1
  172. package/dist/client/assets/{index-DZi8I8ot.js → index-DIHnNoyA.js} +1 -1
  173. package/dist/client/assets/{index-DoH06YKc.js → index-DPCC7KEx.js} +1 -1
  174. package/dist/client/assets/{index-CQ7e2YEj.js → index-Dez-6rcd.js} +1 -1
  175. package/dist/client/assets/index-Dkr4Q9bE.js +1 -0
  176. package/dist/client/assets/{index-CmzG_GaM.js → index-Do3hK3is.js} +1 -1
  177. package/dist/client/assets/{index-jQ2gY_fm.js → index-km18CQ4q.js} +1 -1
  178. package/dist/client/assets/index-pbgcO64n.css +1 -0
  179. package/dist/client/assets/{index-redirect-QRKsjVCi.js → index-redirect-CTR6WNPG.js} +1 -1
  180. package/dist/client/assets/{infiniteQueryObserver-BFZQsptZ.js → infiniteQueryObserver-DdeQTeaz.js} +1 -1
  181. package/dist/client/assets/infra-billing-tXzfTwHJ.js +1 -0
  182. package/dist/client/assets/input-CxFJosPu.js +17 -0
  183. package/dist/client/assets/{input-C1HwcZTs.js → input-DXyNd1dE.js} +1 -1
  184. package/dist/client/assets/{integration-icon-XUOEUOb8.js → integration-icon-BCAGJ22m.js} +1 -1
  185. package/dist/client/assets/item-actions-B4f3ZYnI.js +1 -0
  186. package/dist/client/assets/{jira-icon-B48lqxRs.js → jira-icon-B0PrtQPW.js} +1 -1
  187. package/dist/client/assets/{label-DSlWCd9e.js → label-BFX3DXnu.js} +1 -1
  188. package/dist/client/assets/{layout-QjOyVmz4.js → layout-GEd6141D.js} +1 -1
  189. package/dist/client/assets/{legacy-admin-welcome-dialog-DWeHIzCA.js → legacy-admin-welcome-dialog-CjbAHNU0.js} +1 -1
  190. package/dist/client/assets/legacy-agents-deep-BRMRDtxS.js +1 -0
  191. package/dist/client/assets/{legacy-main-redirect-h5ds91_H.js → legacy-main-redirect-Cpcnm12P.js} +1 -1
  192. package/dist/client/assets/library-GlSV21no.js +1 -0
  193. package/dist/client/assets/{library-tab-DI2mHZkf.js → library-tab-DiZQg1qQ.js} +2 -2
  194. package/dist/client/assets/{login-DgKeSKz2.js → login-DUNIcOhP.js} +1 -1
  195. package/dist/client/assets/{markdown-BTKw4nl8.js → markdown-sWsq0zMA.js} +5 -5
  196. package/dist/client/assets/{mcp-app-renderer-BT9_tzyT.js → mcp-app-renderer-DSMzeo3v.js} +1 -1
  197. package/dist/client/assets/{mcp-oauth-BQRDLkqA.js → mcp-oauth-Cal4irlG.js} +1 -1
  198. package/dist/client/assets/{mcp-oauth-1Tp9szFm.js → mcp-oauth-DFWIYz5V.js} +1 -1
  199. package/dist/client/assets/members-D9DcuyAK.js +1 -0
  200. package/dist/client/assets/memory-DYN3365K.js +7 -0
  201. package/dist/client/assets/mock-board-llSJ1DSL.js +10 -0
  202. package/dist/client/assets/{monaco-editor-DTLNzmeB.js → monaco-editor-4_N5zBDQ.js} +1 -1
  203. package/dist/client/assets/{monitoring-CRmBvi8F.js → monitoring-5YgUKCBd.js} +2 -2
  204. package/dist/client/assets/{monitoring-stats-row-G2RBze7B.js → monitoring-stats-row-BCaHkQz9.js} +1 -1
  205. package/dist/client/assets/multi-select-B4K-daTY.js +1 -0
  206. package/dist/client/assets/{mustache-p2j_fCOZ.js → mustache-B8t03rZ4.js} +1 -1
  207. package/dist/client/assets/{named-rule-step-BJ5LyK07.js → named-rule-step-P0BFUtVs.js} +1 -1
  208. package/dist/client/assets/named-rule-view-CvRYAekO.js +1 -0
  209. package/dist/client/assets/new-project-dialog-DI67z-Vr.js +1 -0
  210. package/dist/client/assets/new-project-store-DoliA5Iq.js +1 -0
  211. package/dist/client/assets/{oauth-callback-Cg1KjIf_.js → oauth-callback-DtdbhW3N.js} +1 -1
  212. package/dist/client/assets/{oauth-callback-ai-provider-hOquTBPU.js → oauth-callback-ai-provider-iNwVQAC1.js} +1 -1
  213. package/dist/client/assets/{oauth-consent-CzhJum4d.js → oauth-consent-Co0jE424.js} +1 -1
  214. package/dist/client/assets/{onboarding-FLu6ztJj.js → onboarding-Dn4ndntc.js} +1 -1
  215. package/dist/client/assets/openai-conversation-D43N7JcR.js +3 -0
  216. package/dist/client/assets/{optimistic-project-sidebar-views-D6axz004.js → optimistic-project-sidebar-views-PUKP14F8.js} +1 -1
  217. package/dist/client/assets/order-monitor-day-fHekYy64.js +1 -0
  218. package/dist/client/assets/{organization-choice-dV-mJr-d.js → organization-choice-Ctd80SL2.js} +1 -1
  219. package/dist/client/assets/orgs-BQeWnD4l.js +1 -0
  220. package/dist/client/assets/own-accounts-section-CwzdBIu0.js +1 -0
  221. package/dist/client/assets/pair-Du2wOAPA.js +48 -0
  222. package/dist/client/assets/{parse-sections-Cy8SKsEh.js → parse-sections-DUEfhNb0.js} +4 -4
  223. package/dist/client/assets/plan-BDh0er6r.js +1 -0
  224. package/dist/client/assets/{plan-ladder-xVKcSuhD.js → plan-ladder-cJHOFEt_.js} +1 -1
  225. package/dist/client/assets/{plan-usage-card-Cxjcl-tF.js → plan-usage-card-DnCWaNBs.js} +1 -1
  226. package/dist/client/assets/{popover-CelLmvH8.js → popover-XZWwzjJe.js} +1 -1
  227. package/dist/client/assets/post-calendar-Cq2VElZ4.js +1 -0
  228. package/dist/client/assets/{post-editor-DkdXE0U4.js → post-editor-ChZHYnmE.js} +2 -2
  229. package/dist/client/assets/preview-content-Ct9U0F_F.js +1 -0
  230. package/dist/client/assets/{preview-dialog-BTVSDgVC.js → preview-dialog-BlN_MeAY.js} +1 -1
  231. package/dist/client/assets/{preview-panel-COaKD6oK.js → preview-panel-CMaIBxrS.js} +1 -1
  232. package/dist/client/assets/preview-tab-rp6yyGU1.js +557 -0
  233. package/dist/client/assets/product-picker-dialog-Cp5iroCv.js +1 -0
  234. package/dist/client/assets/profile-BvhSJiAV.js +1 -0
  235. package/dist/client/assets/project-app-view-BPtWGCfo.js +1 -0
  236. package/dist/client/assets/project-apps-CDSLxQ6C.js +1 -0
  237. package/dist/client/assets/{project-icon-TEwy-duh.js → project-icon-C_Qws_Ah.js} +1 -1
  238. package/dist/client/assets/{project-index-DqRiC0zN.js → project-index-dmu51Z_5.js} +1 -1
  239. package/dist/client/assets/project-reports-BVUPVqwF.js +1 -0
  240. package/dist/client/assets/project-tasks-i5QwXcB1.js +1 -0
  241. package/dist/client/assets/projects-9cB_xTYP.js +1 -0
  242. package/dist/client/assets/{projects-empty-state-OMTDG8SV.js → projects-empty-state-ZoaV8gjs.js} +1 -1
  243. package/dist/client/assets/{prompts-TP7YCuz6.js → prompts-DfPwtsSz.js} +1 -1
  244. package/dist/client/assets/record-editor-BQX3fl3B.js +1 -0
  245. package/dist/client/assets/redirect-editor-DmgDoBZW.js +1 -0
  246. package/dist/client/assets/{reports-CvxegUiQ.js → reports-B7Mq5ojT.js} +1 -1
  247. package/dist/client/assets/reports-Dmcxcdt8.js +1 -0
  248. package/dist/client/assets/reports-onboarding-DnVjGniS.js +1 -0
  249. package/dist/client/assets/reports-tab-D7WrLBuD.js +2 -0
  250. package/dist/client/assets/repositories-B6qJORdw.js +1 -0
  251. package/dist/client/assets/repositories-CKo-J8oc.js +1 -0
  252. package/dist/client/assets/{repository-binding-DGc5VhVW.js → repository-binding-Cqb4hBI0.js} +1 -1
  253. package/dist/client/assets/{repository-picker-DO5Hy-o-.js → repository-picker-B967M4cj.js} +1 -1
  254. package/dist/client/assets/{require-capability-CCGZ96D-.js → require-capability-CnRgBqvn.js} +1 -1
  255. package/dist/client/assets/{required-auth-layout-DoMwdVaZ.js → required-auth-layout-DwZV69de.js} +1 -1
  256. package/dist/client/assets/{reset-password-B672rI1V.js → reset-password-DBlLRH7P.js} +1 -1
  257. package/dist/client/assets/resizable-Ddu9Pik_.js +1 -0
  258. package/dist/client/assets/resolve-tab-icon-C5v6XuFJ.js +1 -0
  259. package/dist/client/assets/{review-settings-B8FCs2a_.js → review-settings-_NtVHX9D.js} +1 -1
  260. package/dist/client/assets/{role-color-CPDxseg4.js → role-color-CYCY1ZHM.js} +1 -1
  261. package/dist/client/assets/roles-BOIysbZW.js +1 -0
  262. package/dist/client/assets/route-B2eUAr3E.js +1 -0
  263. package/dist/client/assets/route-DjNFlT9m.js +1 -0
  264. package/dist/client/assets/route-l3dfZAcw.js +1 -0
  265. package/dist/client/assets/route-page-header-x4fiBRQK.js +1 -0
  266. package/dist/client/assets/{sandbox-git-api-3zULVhcU.js → sandbox-git-api-CX3IYPAX.js} +1 -1
  267. package/dist/client/assets/{sandbox-lifecycle-context-BEzUu66E.js → sandbox-lifecycle-context-CsmYXarj.js} +1 -1
  268. package/dist/client/assets/save-status-DM-afM9Q.js +1 -0
  269. package/dist/client/assets/{schema-DIJe3qA1.js → schema-Bh0CFZUA.js} +1 -1
  270. package/dist/client/assets/{schema-BtzAS_P2.js → schema-CsGAsuNy.js} +1 -1
  271. package/dist/client/assets/{scroll-area-mVo2jhxQ.js → scroll-area-DkuLv9J_.js} +1 -1
  272. package/dist/client/assets/{search-input-ChnwrZA6.js → search-input-Yj0UUhbr.js} +1 -1
  273. package/dist/client/assets/{search-toggle-CC4Rs40x.js → search-toggle-CTqn74j5.js} +1 -1
  274. package/dist/client/assets/{secret-picker-CWGbJrCR.js → secret-picker-FNSDTzDT.js} +1 -1
  275. package/dist/client/assets/secrets-DnkJAwly.js +1 -0
  276. package/dist/client/assets/{section-array-field-4mOiVd7b.js → section-array-field-DbmoEjb3.js} +1 -1
  277. package/dist/client/assets/sections-Bk5O8laV.js +1 -0
  278. package/dist/client/assets/sections-editor-BYa3JqlT.js +1 -0
  279. package/dist/client/assets/select-DqZVtjvu.js +1 -0
  280. package/dist/client/assets/{select-model-BqTl5eD-.js → select-model-D_3F7ch9.js} +1 -1
  281. package/dist/client/assets/{seo-editor-iaqzR9NS.js → seo-editor-alLFkZ3V.js} +1 -1
  282. package/dist/client/assets/{separator-CwN-gidC.js → separator-DOH2DVT3.js} +1 -1
  283. package/dist/client/assets/session-runtime-DaEm9VzJ.js +1 -0
  284. package/dist/client/assets/settings-tab-Dnn9Ngte.js +1 -0
  285. package/dist/client/assets/{sheet-1BLiVjE3.js → sheet-B3BCtfXu.js} +1 -1
  286. package/dist/client/assets/shell-layout-BMy93BCc.js +1 -0
  287. package/dist/client/assets/{site-draft-actions-GLib44bU.js → site-draft-actions-C2zLtAMz.js} +5 -5
  288. package/dist/client/assets/site-draft-view-ikG8CMuB.js +1 -0
  289. package/dist/client/assets/site-editor-B8VlT5Kv.js +1 -0
  290. package/dist/client/assets/site-editor-toast-GAJZE2A0.js +1 -0
  291. package/dist/client/assets/skills-dIhMA0Ze.js +1 -0
  292. package/dist/client/assets/{slider-BKrw7nqs.js → slider-DirLi5JL.js} +1 -1
  293. package/dist/client/assets/{sortable.esm-CA_k0RaZ.js → sortable.esm-B3zbNG6q.js} +1 -1
  294. package/dist/client/assets/sso-tZNmyRgp.js +1 -0
  295. package/dist/client/assets/{suggestion-BdOz28RC.js → suggestion-bCd1m59t.js} +1 -1
  296. package/dist/client/assets/{super-agent-icon-DExAOD4i.js → super-agent-icon-AJ6ZRe5V.js} +1 -1
  297. package/dist/client/assets/{switch-B60LgmjA.js → switch-BviC1co2.js} +1 -1
  298. package/dist/client/assets/{synced-repos-DfFbkdSN.js → synced-repos-DsEdkMaA.js} +1 -1
  299. package/dist/client/assets/{tab-icon-glyph-MzzsG5oc.js → tab-icon-glyph-DkjrfS6l.js} +1 -1
  300. package/dist/client/assets/{table-KEskYvtS.js → table-DX15DDx1.js} +1 -1
  301. package/dist/client/assets/{tabs-DXm_rA9S.js → tabs-BiFBpWbA.js} +1 -1
  302. package/dist/client/assets/task-board-DD2iUGL4.js +1 -0
  303. package/dist/client/assets/{core.esm-YEEWezEY.js → task-key-DP7js_2-.js} +2 -2
  304. package/dist/client/assets/task-route-Bfb6XWlb.js +1 -0
  305. package/dist/client/assets/{task-status-Bn4DeOrT.js → task-status-CBWakThc.js} +1 -1
  306. package/dist/client/assets/taskboard-analytics-B5XiM0gZ.js +1 -0
  307. package/dist/client/assets/{tasks-fWq-fqoJ.js → tasks-BPwrQv5-.js} +3 -3
  308. package/dist/client/assets/tasks-ip1BqsyR.js +1 -0
  309. package/dist/client/assets/{textarea-CRgCAK3p.js → textarea-BoSVR1xB.js} +1 -1
  310. package/dist/client/assets/thread-analytics-B3wSdPFK.js +1 -0
  311. package/dist/client/assets/thread-button-CIHD7120.js +1 -0
  312. package/dist/client/assets/{thread-intent-DrRX6nG0.js → thread-intent-DpzwhK2y.js} +6 -6
  313. package/dist/client/assets/thread-route-Bdw4g7Hg.js +1 -0
  314. package/dist/client/assets/thread-route-D4mea9ep.js +1 -0
  315. package/dist/client/assets/thread-sheet-body-C1_HCALD.js +1 -0
  316. package/dist/client/assets/time-range-picker-B9_5lQqT.js +1 -0
  317. package/dist/client/assets/{toggle-group-JYZ1PCaE.js → toggle-group-l7lV2Oqp.js} +1 -1
  318. package/dist/client/assets/{tool-set-selector-DTAr1xzz.js → tool-set-selector-BQISxiF9.js} +1 -1
  319. package/dist/client/assets/{toolbar-icon-button-B0M5XFng.js → toolbar-icon-button-CflJ2Qid.js} +1 -1
  320. package/dist/client/assets/{tooltip-D9qNlq6S.js → tooltip-BTd3W-2Z.js} +1 -1
  321. package/dist/client/assets/{tooltipContext-B94TDN-Q.js → tooltipContext-De8eALzu.js} +1 -1
  322. package/dist/client/assets/{track-DJVHN5Lv.js → track-BBHYiJkY.js} +1 -1
  323. package/dist/client/assets/{types-BfPC7vnd.js → types-C8b3acwX.js} +1 -1
  324. package/dist/client/assets/{url-slug-Bts08KOo.js → url-slug-gNlq1cKV.js} +1 -1
  325. package/dist/client/assets/{usage-stats-CK4hgSt6.js → usage-stats-Bk_1jh1-.js} +2 -2
  326. package/dist/client/assets/{use-ai-providers-CxZCPqVC.js → use-ai-providers-Cya2RotC.js} +1 -1
  327. package/dist/client/assets/use-api-keys-BdlPKuv4.js +1 -0
  328. package/dist/client/assets/use-apply-named-rule-CcoLpt-_.js +1 -0
  329. package/dist/client/assets/use-ask-in-chat-B_ARVX9A.js +1 -0
  330. package/dist/client/assets/{use-automations-B7d02VWl.js → use-automations-CerQ9Qaj.js} +1 -1
  331. package/dist/client/assets/{use-autosave-DOc72aWE.js → use-autosave-CQa7WbXM.js} +1 -1
  332. package/dist/client/assets/use-blocks-v8-project-BedqZgtc.js +1 -0
  333. package/dist/client/assets/use-blog-view-9s3Vkx1q.js +1 -0
  334. package/dist/client/assets/use-chat-layout-state-CWt5k1nY.js +1 -0
  335. package/dist/client/assets/{use-cms-publish-actions-DimSJzWP.js → use-cms-publish-actions-7QluCfa8.js} +4 -4
  336. package/dist/client/assets/use-connect-companion-B8Oqj7MQ.js +1 -0
  337. package/dist/client/assets/{use-connection-CFmR-X06.js → use-connection-2s3z_IKD.js} +1 -1
  338. package/dist/client/assets/{use-content-sync-BEqIA-0g.js → use-content-sync-DxzP8nN9.js} +1 -1
  339. package/dist/client/assets/{use-copy-PziytufC.js → use-copy-sOY8Yuot.js} +1 -1
  340. package/dist/client/assets/use-current-view-EjRzX02x.js +1 -0
  341. package/dist/client/assets/{use-date-fns-locale-BVsHKqDt.js → use-date-fns-locale-DjDbgiCF.js} +1 -1
  342. package/dist/client/assets/{use-debounced-autosave-CU3dUlJX.js → use-debounced-autosave--lHIRoNY.js} +1 -1
  343. package/dist/client/assets/{use-debounced-value-DJ5YZsat.js → use-debounced-value-RJW46-1q.js} +1 -1
  344. package/dist/client/assets/{use-deco-credits-_9aC49vI.js → use-deco-credits-d4Nbb0l0.js} +1 -1
  345. package/dist/client/assets/use-decopilot-events-BGpwG8Pb.js +1 -0
  346. package/dist/client/assets/use-delete-block-BR5smTsV.js +1 -0
  347. package/dist/client/assets/{use-delete-connection-Bp9D22pQ.js → use-delete-connection-DHkW3H9t.js} +1 -1
  348. package/dist/client/assets/{use-deployment-admin-D8TSoW7b.js → use-deployment-admin-j92yIioi.js} +1 -1
  349. package/dist/client/assets/{use-entitlements-Chh3D10H.js → use-entitlements-DtyegfyM.js} +1 -1
  350. package/dist/client/assets/use-fast-preview-draft-url-B4HFa9pK.js +1 -0
  351. package/dist/client/assets/{use-file-configs-8VTVKs7P.js → use-file-configs-CzyibAGV.js} +1 -1
  352. package/dist/client/assets/{use-id-selection-LGL3_97F.js → use-id-selection-DSQKok9P.js} +1 -1
  353. package/dist/client/assets/use-in-settings-DLJEfljS.js +1 -0
  354. package/dist/client/assets/{use-inbox-feed-DjVLN02v.js → use-inbox-feed-BNnBKFlA.js} +1 -1
  355. package/dist/client/assets/{use-infinite-scroll-BBVWbqWO.js → use-infinite-scroll-D1tYrKq7.js} +1 -1
  356. package/dist/client/assets/{use-join-requests-4dddz-2V.js → use-join-requests-CSjMfH5p.js} +1 -1
  357. package/dist/client/assets/use-main-panel-tabs-CllMGKzI.js +1 -0
  358. package/dist/client/assets/use-mcp-auth-status-DS0pbV57.js +1 -0
  359. package/dist/client/assets/{use-mcp-client-CaYmuD4l.js → use-mcp-client-Cvc3WWPF.js} +2 -2
  360. package/dist/client/assets/{use-mcp-prompts-lHtFGIni.js → use-mcp-prompts-Ck1uv43A.js} +1 -1
  361. package/dist/client/assets/{use-mcp-tools-COoBOTb8.js → use-mcp-tools-BIzewITl.js} +1 -1
  362. package/dist/client/assets/{use-mobile-B0YlxBUo.js → use-mobile-CG2XwDbe.js} +1 -1
  363. package/dist/client/assets/{use-move-blocks-CRsMTnFT.js → use-move-blocks-Dv6zyDyx.js} +1 -1
  364. package/dist/client/assets/{use-navigate-to-agent-D9u86crS.js → use-navigate-to-agent-BFBISUMc.js} +1 -1
  365. package/dist/client/assets/use-never-published-D3zJmakm.js +1 -0
  366. package/dist/client/assets/{use-org-fs-Cv09aZqm.js → use-org-fs-BfE7L8cf.js} +1 -1
  367. package/dist/client/assets/use-org-notice-DghJzmC_.js +1 -0
  368. package/dist/client/assets/{use-org-repo-syncs-CKUvsIrW.js → use-org-repo-syncs-CU3MGWk9.js} +1 -1
  369. package/dist/client/assets/{use-org-sso-CBrdU305.js → use-org-sso-C8BMUr72.js} +1 -1
  370. package/dist/client/assets/{use-organization-settings-BWLJTTpw.js → use-organization-settings-Ddjh427l.js} +1 -1
  371. package/dist/client/assets/use-panel-navigate-V2MXWXLu.js +1 -0
  372. package/dist/client/assets/use-project-native-view-presence-EdJBeOw9.js +1 -0
  373. package/dist/client/assets/use-project-scope-COzEo5Zz.js +1 -0
  374. package/dist/client/assets/use-recent-apps-BpR_nbgz.js +1 -0
  375. package/dist/client/assets/{use-reports-diagnostic-CgjecoRR.js → use-reports-diagnostic-DYf7sFCj.js} +1 -1
  376. package/dist/client/assets/use-sandbox-events-cbWqZuIm.js +2 -0
  377. package/dist/client/assets/{use-secrets-D46GKExN.js → use-secrets-BamKWPUs.js} +1 -1
  378. package/dist/client/assets/{use-section-preview-base-BO578O9L.js → use-section-preview-base-Cy_X_Jjl.js} +1 -1
  379. package/dist/client/assets/use-sidebar-collapsed-CGkkkrTj.js +1 -0
  380. package/dist/client/assets/{use-tags-LwHF4ikl.js → use-tags-staoqXQp.js} +1 -1
  381. package/dist/client/assets/{use-task-board-analytics-TZTLLgky.js → use-task-board-analytics-C5Dsg-uV.js} +1 -1
  382. package/dist/client/assets/{use-task-board-item-prs-BW_n16vt.js → use-task-board-item-prs-DsFjq28v.js} +1 -1
  383. package/dist/client/assets/use-task-board-items-OgSDu-ag.js +1 -0
  384. package/dist/client/assets/{use-task-board-prompts-CHIblyN4.js → use-task-board-prompts-Bn4-yS6Z.js} +1 -1
  385. package/dist/client/assets/{use-task-metadata-DdKhuIQ3.js → use-task-metadata-Bc8o5Sts.js} +1 -1
  386. package/dist/client/assets/{use-thread-outputs-DsjZa1n5.js → use-thread-outputs-Co5bznxQ.js} +1 -1
  387. package/dist/client/assets/use-view-draft-kind-BdwsMdex.js +1 -0
  388. package/dist/client/assets/use-voice-input-CwLNuWlo.js +1 -0
  389. package/dist/client/assets/useInfiniteQuery-BagPKS5m.js +1 -0
  390. package/dist/client/assets/{useQueries-B8jtB-RW.js → useQueries-BjVZ4kPO.js} +1 -1
  391. package/dist/client/assets/useSuspenseInfiniteQuery-BUmkwIx5.js +1 -0
  392. package/dist/client/assets/{users-zlgoDQuW.js → users-CPRHIyd2.js} +1 -1
  393. package/dist/client/assets/utils-DPEBLDgi.js +4 -0
  394. package/dist/client/assets/variant-calendar-Dlw46bNO.js +1 -0
  395. package/dist/client/assets/{variant-matcher-override-BKIrGg8S.js → variant-matcher-override-ChW3ijK5.js} +1 -1
  396. package/dist/client/assets/{view-header-OfKMmhb0.js → view-header-D4oknAV1.js} +1 -1
  397. package/dist/client/assets/virtual-mcp-nhrh3mtw.js +1 -0
  398. package/dist/client/assets/{watch-sse-pool-B39Ow5tK.js → watch-sse-pool-CTgVk3NA.js} +1 -1
  399. package/dist/client/index.html +2 -2
  400. package/dist/server/server.js +1 -1
  401. package/package.json +1 -1
  402. package/dist/client/assets/ChevronUp-DM7pn8nV.js +0 -1
  403. package/dist/client/assets/LinkBroken01-4l2zZef9.js +0 -1
  404. package/dist/client/assets/Tool01-BlUlKjGy.js +0 -1
  405. package/dist/client/assets/agent-app-qCE6mpox.js +0 -1
  406. package/dist/client/assets/agent-assets-BERkZgBg.js +0 -1
  407. package/dist/client/assets/agent-automation-B3znFoJv.js +0 -20
  408. package/dist/client/assets/agent-automations-BI5n1DEk.js +0 -1
  409. package/dist/client/assets/agent-blog-DFA4iTY2.js +0 -2
  410. package/dist/client/assets/agent-blog-post-CJzR6SRp.js +0 -2
  411. package/dist/client/assets/agent-calendar-DCBRCsam.js +0 -1
  412. package/dist/client/assets/agent-connect-sources-BvH_YwiD.js +0 -1
  413. package/dist/client/assets/agent-deck-C_9xRnWL.js +0 -1
  414. package/dist/client/assets/agent-e2e-B2FpHDAG.js +0 -1
  415. package/dist/client/assets/agent-experiments-BDFLMLOM.js +0 -1
  416. package/dist/client/assets/agent-file-CAkn0Q5x.js +0 -1
  417. package/dist/client/assets/agent-hosting-D0d8gHPR.js +0 -1
  418. package/dist/client/assets/agent-icon-CpMz1pSC.js +0 -1
  419. package/dist/client/assets/agent-library-Cs6jlCDK.js +0 -1
  420. package/dist/client/assets/agent-library-file-DV2qsJC9.js +0 -1
  421. package/dist/client/assets/agent-overview-IBMGymrh.js +0 -1
  422. package/dist/client/assets/agent-releases-k0DaB9LQ.js +0 -2
  423. package/dist/client/assets/agent-settings-DF71XJZP.js +0 -1
  424. package/dist/client/assets/agent-site-editor-code-gfgfb7xF.js +0 -2
  425. package/dist/client/assets/agent-site-editor-content-C07hh63_.js +0 -1
  426. package/dist/client/assets/agent-site-editor-preview-CFg2FnqN.js +0 -1
  427. package/dist/client/assets/agent-view-CzQtfKwQ.js +0 -1
  428. package/dist/client/assets/agent-view-guard-XdI97YrW.js +0 -1
  429. package/dist/client/assets/ai-providers-DoacYpUR.js +0 -1
  430. package/dist/client/assets/analytics-sections-DNjeT1Pf.js +0 -1
  431. package/dist/client/assets/api-keys-Bbyyi1IV.js +0 -1
  432. package/dist/client/assets/api-keys-CLzhmgUv.js +0 -1
  433. package/dist/client/assets/app-editor-Cd7oWsvo.js +0 -1
  434. package/dist/client/assets/automation-list-row-COaiktOt.js +0 -1
  435. package/dist/client/assets/automations-BvZ8wxJr.js +0 -1
  436. package/dist/client/assets/blog-schema-PWQlG4FM.js +0 -1
  437. package/dist/client/assets/blog-view-gate-BpiHsFQi.js +0 -1
  438. package/dist/client/assets/buckets-r-Vn310N.js +0 -1
  439. package/dist/client/assets/calendar-DkvAGmxG.js +0 -1
  440. package/dist/client/assets/category-editor-D53-0-dG.js +0 -1
  441. package/dist/client/assets/chat-context-Na_9rQo_.js +0 -39
  442. package/dist/client/assets/choose-editor-DFYfaLQ4.js +0 -1
  443. package/dist/client/assets/cms-settings-editor-BLtwrg_Q.js +0 -1
  444. package/dist/client/assets/collection-detail-BdQUzwBw.js +0 -1
  445. package/dist/client/assets/config-DhSdzr_l.js +0 -1
  446. package/dist/client/assets/connect-DwtFEmWa.js +0 -9
  447. package/dist/client/assets/connection-detail-Bm5pNgz3.js +0 -1
  448. package/dist/client/assets/connection-slug-CqKJM07D.js +0 -1
  449. package/dist/client/assets/connections-8N6-U8BU.js +0 -1
  450. package/dist/client/assets/context-CdMMXT5s.js +0 -1
  451. package/dist/client/assets/discover-DhvRjqxh.js +0 -1
  452. package/dist/client/assets/experiments-tab-choice-Ch-KXcUZ.js +0 -1
  453. package/dist/client/assets/feature-gate-BsIQ70jm.js +0 -1
  454. package/dist/client/assets/file-explorer-DpEdUCiL.js +0 -2
  455. package/dist/client/assets/file-share-button-D9sAYI1R.js +0 -3
  456. package/dist/client/assets/folder-icon-D4-RUOt8.js +0 -1
  457. package/dist/client/assets/general-Bt-teqGz.js +0 -1
  458. package/dist/client/assets/home-CIpHO2ej.js +0 -1
  459. package/dist/client/assets/home-overview-9H7C1hoB.js +0 -1
  460. package/dist/client/assets/index-BqWale_V.css +0 -1
  461. package/dist/client/assets/index-DCl7HPjQ.js +0 -1
  462. package/dist/client/assets/index-DN9fxTzN.js +0 -1
  463. package/dist/client/assets/index-DuYneP0E.js +0 -1
  464. package/dist/client/assets/index-tLhNg31B.js +0 -4
  465. package/dist/client/assets/infra-billing-C3ShZZOT.js +0 -1
  466. package/dist/client/assets/input-GqBshPf5.js +0 -17
  467. package/dist/client/assets/item-actions-BfBBT1Qz.js +0 -1
  468. package/dist/client/assets/legacy-agents-deep-COHFWDWb.js +0 -1
  469. package/dist/client/assets/library-BMXElwFo.js +0 -1
  470. package/dist/client/assets/members-DQZtkBei.js +0 -1
  471. package/dist/client/assets/memory-B82F2Q7k.js +0 -7
  472. package/dist/client/assets/mock-board-B7BOXAS7.js +0 -10
  473. package/dist/client/assets/multi-select-ykLyfeEh.js +0 -1
  474. package/dist/client/assets/named-rule-view-BBEm0z_K.js +0 -1
  475. package/dist/client/assets/new-project-dialog-C3JFSI1q.js +0 -1
  476. package/dist/client/assets/openai-conversation-DhsFXaEr.js +0 -3
  477. package/dist/client/assets/order-monitor-day-CQJg9ymu.js +0 -1
  478. package/dist/client/assets/orgs-DafOcWKJ.js +0 -1
  479. package/dist/client/assets/own-accounts-section-BitxRWkd.js +0 -1
  480. package/dist/client/assets/pair-Dsc6GXhQ.js +0 -48
  481. package/dist/client/assets/plan-5t2sCqh-.js +0 -1
  482. package/dist/client/assets/post-calendar-DkUmj6jK.js +0 -1
  483. package/dist/client/assets/preview-content-Di9jV9fD.js +0 -1
  484. package/dist/client/assets/preview-tab-BFi8NHe-.js +0 -557
  485. package/dist/client/assets/product-picker-dialog-tqTphLK7.js +0 -1
  486. package/dist/client/assets/profile-ItK6hTrx.js +0 -1
  487. package/dist/client/assets/project-app-view-CMAf9Mlz.js +0 -1
  488. package/dist/client/assets/project-apps-ByyLejju.js +0 -1
  489. package/dist/client/assets/project-reports-CPvLPQcs.js +0 -1
  490. package/dist/client/assets/project-tasks-B88cPPXW.js +0 -1
  491. package/dist/client/assets/projects-FY3sblQl.js +0 -1
  492. package/dist/client/assets/record-editor-IJLTcCdR.js +0 -1
  493. package/dist/client/assets/redirect-editor-B2-M7doi.js +0 -1
  494. package/dist/client/assets/reports-ODcJFAP-.js +0 -1
  495. package/dist/client/assets/reports-onboarding-BicRsxJF.js +0 -1
  496. package/dist/client/assets/reports-tab-CCY5hBR2.js +0 -2
  497. package/dist/client/assets/repositories-C0edGPcS.js +0 -1
  498. package/dist/client/assets/repositories-V6vmPwSM.js +0 -1
  499. package/dist/client/assets/resizable-DrLaW_Jl.js +0 -1
  500. package/dist/client/assets/resolve-tab-icon-CfRdrLF-.js +0 -1
  501. package/dist/client/assets/roles-BYqU9-We.js +0 -1
  502. package/dist/client/assets/route-BXYvPulM.js +0 -1
  503. package/dist/client/assets/route-Bh9fCZXT.js +0 -1
  504. package/dist/client/assets/route-a1KQq-lz.js +0 -1
  505. package/dist/client/assets/save-status-Cx3aKwGu.js +0 -1
  506. package/dist/client/assets/secrets-DE59ARp-.js +0 -1
  507. package/dist/client/assets/sections-B1sv3rvB.js +0 -1
  508. package/dist/client/assets/sections-editor-sTEVWcAy.js +0 -1
  509. package/dist/client/assets/select-BNoZ1cwH.js +0 -1
  510. package/dist/client/assets/settings-tab-H1Nf96Yz.js +0 -1
  511. package/dist/client/assets/shell-layout-BHtZVBED.js +0 -1
  512. package/dist/client/assets/site-draft-view-CKK7PKoH.js +0 -1
  513. package/dist/client/assets/site-editor-Bl3uFRW-.js +0 -1
  514. package/dist/client/assets/site-editor-toast-BXRGIPuY.js +0 -1
  515. package/dist/client/assets/skills-Q6l6j9x7.js +0 -1
  516. package/dist/client/assets/sso-C4bCFgaT.js +0 -1
  517. package/dist/client/assets/task-board-CdhOR9bl.js +0 -1
  518. package/dist/client/assets/task-key-BCHdFiOO.js +0 -1
  519. package/dist/client/assets/task-route-DeSbQRkP.js +0 -1
  520. package/dist/client/assets/taskboard-analytics-CRI_d1NW.js +0 -1
  521. package/dist/client/assets/tasks-DGRURa32.js +0 -1
  522. package/dist/client/assets/thread-analytics-aoAc3KR6.js +0 -1
  523. package/dist/client/assets/thread-route-D404Xl1w.js +0 -1
  524. package/dist/client/assets/thread-route-L_F2dRjs.js +0 -1
  525. package/dist/client/assets/thread-sheet-body-D3DOFB6A.js +0 -1
  526. package/dist/client/assets/time-range-picker-DouTd8PJ.js +0 -1
  527. package/dist/client/assets/tool-namespace-BBpCD9sF.js +0 -1
  528. package/dist/client/assets/use-apply-named-rule-h1W6SPpC.js +0 -1
  529. package/dist/client/assets/use-ask-in-chat-D4gRql_N.js +0 -1
  530. package/dist/client/assets/use-blocks-v8-project-BLLvbZl2.js +0 -1
  531. package/dist/client/assets/use-chat-layout-state-DQhX2zdi.js +0 -1
  532. package/dist/client/assets/use-connect-companion-CqTyzSlz.js +0 -1
  533. package/dist/client/assets/use-decopilot-events-B84nN_Z6.js +0 -1
  534. package/dist/client/assets/use-delete-block-BbJuByhU.js +0 -1
  535. package/dist/client/assets/use-fast-preview-draft-url-DRtzWCS3.js +0 -1
  536. package/dist/client/assets/use-main-panel-tabs-Bq834oWY.js +0 -1
  537. package/dist/client/assets/use-mcp-auth-status-ewp8JzH8.js +0 -1
  538. package/dist/client/assets/use-never-published-BRSQAhRd.js +0 -1
  539. package/dist/client/assets/use-project-native-view-presence-D5R7YysD.js +0 -1
  540. package/dist/client/assets/use-project-scope-Dzg0nsjs.js +0 -1
  541. package/dist/client/assets/use-recent-apps-BKAftwoT.js +0 -1
  542. package/dist/client/assets/use-sandbox-events-BtXLDGZr.js +0 -2
  543. package/dist/client/assets/use-sidebar-collapsed-x7SsKYNl.js +0 -1
  544. package/dist/client/assets/use-task-board-events-U_kvLTo1.js +0 -1
  545. package/dist/client/assets/use-task-board-items-B66t-aAy.js +0 -1
  546. package/dist/client/assets/use-view-draft-kind-BtHf66Jj.js +0 -1
  547. package/dist/client/assets/use-voice-input-Li611DFd.js +0 -1
  548. package/dist/client/assets/useInfiniteQuery-CN2uIy97.js +0 -1
  549. package/dist/client/assets/useSuspenseInfiniteQuery-ECHIzp7d.js +0 -1
  550. package/dist/client/assets/utils-DONok1LX.js +0 -4
  551. package/dist/client/assets/variant-calendar-CjAgTw5u.js +0 -1
  552. package/dist/client/assets/virtual-mcp-BKUZFB3-.js +0 -1
@@ -0,0 +1 @@
1
+ import{c as s}from"./index-CwntHk8S.js";import{u as v,H as g,ae as h,aG as b,aH as P,aI as S,N as w}from"./site-editor-toast-GAJZE2A0.js";import{u as D}from"./use-voice-input-CwLNuWlo.js";function d(e){const t=s.c(3),u=D(e?.virtualMcpId).runtime==="cms",l=v(e?.virtualMcpId,e?.branch),o=l.kind==="protocol"&&l.source==="github",n=b(e),c=P(o?e:null);if(!e||!u)return null;if(o)return c;let i;return t[0]!==n||t[1]!==e?(i=n?S({...e,...n}):null,t[0]=n,t[1]=e,t[2]=i):i=t[2],i}function U(e){const t=s.c(3),u=d(e),l=v(e.virtualMcpId,e.branch),o=l.kind==="protocol"&&l.source==="github";let n;t[0]!==e.orgSlug||t[1]!==e.virtualMcpId?(n=g(e.orgSlug,e.virtualMcpId),t[0]=e.orgSlug,t[1]=e.virtualMcpId,t[2]=n):n=t[2];const c=h(n,o?u:null);return o?c:u}function R(e){const t=s.c(11);let u;t[0]!==e?(u=e?{orgSlug:e.orgSlug,virtualMcpId:e.virtualMcpId,branch:e.branch}:null,t[0]=e,t[1]=u):u=t[1];const l=d(u),o=e?.previewServerUrl??null;let n=null;if(o)try{let f;t[2]!==o?(f=new URL(o),t[2]=o,t[3]=f):f=t[3],n=f.host}catch{n=null}let c;t[4]!==l||t[5]!==e||t[6]!==o?(c=e&&o&&l?w(new URL(e.path,o).toString(),l):null,t[4]=l,t[5]=e,t[6]=o,t[7]=c):c=t[7];const i=c;let r;return t[8]!==n||t[9]!==i?(r={url:i,host:n},t[8]=n,t[9]=i,t[10]=r):r=t[10],r}export{R as a,d as b,U as u};
@@ -1 +1 @@
1
- import{c as r,a4 as f,ak as d,K as C,i as E,V as I,q as F,e as g}from"./index-BP527m3V.js";function m(){const e=r.c(7),{org:t}=f(),o=d();let n;e[0]!==t.id?(n=C.fileConfigs(t.id),e[0]=t.id,e[1]=n):n=e[1];let i;e[2]!==o?(i=()=>o.call("FILE_CONFIG_LIST",{}),e[2]=o,e[3]=i):i=e[3];let s;e[4]!==n||e[5]!==i?(s={queryKey:n,staleTime:6e4,queryFn:i},e[4]=n,e[5]=i,e[6]=s):s=e[6];const{data:l}=I(s);return l.configs}function _(e){const t=r.c(10);let o;t[0]!==e?(o=e===void 0?{}:e,t[0]=e,t[1]=o):o=t[1];const{enabled:n}=o,i=n===void 0?!0:n,{org:s}=f(),l=d();let u;t[2]!==s.id?(u=C.fileConfigs(s.id),t[2]=s.id,t[3]=u):u=t[3];const y=i&&!!s.id;let c;t[4]!==l?(c=()=>l.call("FILE_CONFIG_LIST",{}),t[4]=l,t[5]=c):c=t[5];let a;return t[6]!==u||t[7]!==y||t[8]!==c?(a={queryKey:u,enabled:y,staleTime:6e4,queryFn:c},t[6]=u,t[7]=y,t[8]=c,t[9]=a):a=t[9],E(a)}function L(){const e=r.c(8),{org:t}=f(),o=d(),n=F();let i;e[0]!==o?(i=u=>o.call("FILE_CONFIG_CREATE",{...u}),e[0]=o,e[1]=i):i=e[1];let s;e[2]!==t||e[3]!==n?(s=()=>{n.invalidateQueries({queryKey:C.fileConfigs(t.id)})},e[2]=t,e[3]=n,e[4]=s):s=e[4];let l;return e[5]!==i||e[6]!==s?(l={mutationFn:i,onSuccess:s},e[5]=i,e[6]=s,e[7]=l):l=e[7],g(l)}function S(){const e=r.c(8),{org:t}=f(),o=d(),n=F();let i;e[0]!==o?(i=u=>o.call("FILE_CONFIG_DELETE",{id:u}),e[0]=o,e[1]=i):i=e[1];let s;e[2]!==t||e[3]!==n?(s=()=>{n.invalidateQueries({queryKey:C.fileConfigs(t.id)})},e[2]=t,e[3]=n,e[4]=s):s=e[4];let l;return e[5]!==i||e[6]!==s?(l={mutationFn:i,onSuccess:s},e[5]=i,e[6]=s,e[7]=l):l=e[7],g(l)}export{m as a,L as b,S as c,_ as u};
1
+ import{c as r,a4 as f,ak as d,K as C,i as E,V as I,q as F,e as g}from"./index-CwntHk8S.js";function m(){const e=r.c(7),{org:t}=f(),o=d();let n;e[0]!==t.id?(n=C.fileConfigs(t.id),e[0]=t.id,e[1]=n):n=e[1];let i;e[2]!==o?(i=()=>o.call("FILE_CONFIG_LIST",{}),e[2]=o,e[3]=i):i=e[3];let s;e[4]!==n||e[5]!==i?(s={queryKey:n,staleTime:6e4,queryFn:i},e[4]=n,e[5]=i,e[6]=s):s=e[6];const{data:l}=I(s);return l.configs}function _(e){const t=r.c(10);let o;t[0]!==e?(o=e===void 0?{}:e,t[0]=e,t[1]=o):o=t[1];const{enabled:n}=o,i=n===void 0?!0:n,{org:s}=f(),l=d();let u;t[2]!==s.id?(u=C.fileConfigs(s.id),t[2]=s.id,t[3]=u):u=t[3];const y=i&&!!s.id;let c;t[4]!==l?(c=()=>l.call("FILE_CONFIG_LIST",{}),t[4]=l,t[5]=c):c=t[5];let a;return t[6]!==u||t[7]!==y||t[8]!==c?(a={queryKey:u,enabled:y,staleTime:6e4,queryFn:c},t[6]=u,t[7]=y,t[8]=c,t[9]=a):a=t[9],E(a)}function L(){const e=r.c(8),{org:t}=f(),o=d(),n=F();let i;e[0]!==o?(i=u=>o.call("FILE_CONFIG_CREATE",{...u}),e[0]=o,e[1]=i):i=e[1];let s;e[2]!==t||e[3]!==n?(s=()=>{n.invalidateQueries({queryKey:C.fileConfigs(t.id)})},e[2]=t,e[3]=n,e[4]=s):s=e[4];let l;return e[5]!==i||e[6]!==s?(l={mutationFn:i,onSuccess:s},e[5]=i,e[6]=s,e[7]=l):l=e[7],g(l)}function S(){const e=r.c(8),{org:t}=f(),o=d(),n=F();let i;e[0]!==o?(i=u=>o.call("FILE_CONFIG_DELETE",{id:u}),e[0]=o,e[1]=i):i=e[1];let s;e[2]!==t||e[3]!==n?(s=()=>{n.invalidateQueries({queryKey:C.fileConfigs(t.id)})},e[2]=t,e[3]=n,e[4]=s):s=e[4];let l;return e[5]!==i||e[6]!==s?(l={mutationFn:i,onSuccess:s},e[5]=i,e[6]=s,e[7]=l):l=e[7],g(l)}export{m as a,L as b,S as c,_ as u};
@@ -1 +1 @@
1
- import{c as x,r as I}from"./index-BP527m3V.js";function m(n){const e=x.c(15),[s,r]=I.useState(null);let d;e[0]!==n||e[1]!==s?(d=s!==null?n.findIndex(l=>l.id===s):-1,e[0]=n,e[1]=s,e[2]=d):d=e[2];const t=d,i=t!==-1?n[t]:null,a=i!==null;let u,f;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=l=>r(l),f=()=>r(null),e[3]=u,e[4]=f):(u=e[3],f=e[4]);let c,o;e[5]!==t||e[6]!==n?(c=()=>{const l=n[t-1];t>0&&l&&r(l.id)},o=()=>{const l=n[t+1];t!==-1&&l&&r(l.id)},e[5]=t,e[6]=n,e[7]=c,e[8]=o):(c=e[7],o=e[8]);let p;return e[9]!==t||e[10]!==i||e[11]!==a||e[12]!==c||e[13]!==o?(p={selected:i,index:t,isOpen:a,select:u,close:f,prev:c,next:o},e[9]=t,e[10]=i,e[11]=a,e[12]=c,e[13]=o,e[14]=p):p=e[14],p}export{m as u};
1
+ import{c as x,r as I}from"./index-CwntHk8S.js";function m(n){const e=x.c(15),[s,r]=I.useState(null);let d;e[0]!==n||e[1]!==s?(d=s!==null?n.findIndex(l=>l.id===s):-1,e[0]=n,e[1]=s,e[2]=d):d=e[2];const t=d,i=t!==-1?n[t]:null,a=i!==null;let u,f;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=l=>r(l),f=()=>r(null),e[3]=u,e[4]=f):(u=e[3],f=e[4]);let c,o;e[5]!==t||e[6]!==n?(c=()=>{const l=n[t-1];t>0&&l&&r(l.id)},o=()=>{const l=n[t+1];t!==-1&&l&&r(l.id)},e[5]=t,e[6]=n,e[7]=c,e[8]=o):(c=e[7],o=e[8]);let p;return e[9]!==t||e[10]!==i||e[11]!==a||e[12]!==c||e[13]!==o?(p={selected:i,index:t,isOpen:a,select:u,close:f,prev:c,next:o},e[9]=t,e[10]=i,e[11]=a,e[12]=c,e[13]=o,e[14]=p):p=e[14],p}export{m as u};
@@ -0,0 +1 @@
1
+ import{c as s,a6 as o}from"./index-CwntHk8S.js";function n(){const t=s.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/settings",shouldThrow:!1},t[0]=e):e=t[0],!!o(e)}export{n as u};
@@ -1 +1 @@
1
- import{c as b,a4 as M,ak as S,q as T,e as v,a as q,r as A,K}from"./index-BP527m3V.js";import{u as O}from"./useInfiniteQuery-CN2uIy97.js";import{n as Q}from"./watch-sse-pool-B39Ow5tK.js";const R=6e4;function E(e,n){return e.call("NOTIFICATION_LIST",n?{cursor:n}:{})}function L(e,n){if(!e)return e;const r=n?new Set(n):null;let i=0;const a=e.pages.map(t=>{const u=t.notifications.filter(c=>r&&!r.has(c.id)?!0:(i++,!1));return{...t,notifications:u}}),o=r?Math.max(0,(e.pages[0]?.unreadCount??0)-i):0;return{...e,pages:a.map(t=>({...t,unreadCount:o}))}}function w(e,n){const r=b.c(4),{data:i}=q.useSession(),a=i?.user?.id;let o;r[0]!==n||r[1]!==e||r[2]!==a?(o=t=>!e||!a?B:Q.subscribe(e,c=>{try{if(JSON.parse(c.data).subject!==a)return}catch{return}n(),t()},n),r[0]=n,r[1]=e,r[2]=a,r[3]=o):o=r[3],A.useSyncExternalStore(o,j,D)}function D(){return 0}function j(){return 0}function B(){}function G(){const e=b.c(37),{locator:n,org:r}=M(),i=S(),a=T();let o;e[0]!==n?(o=K.notifications(n),e[0]=n,e[1]=o):o=e[1];const t=o;let u;e[2]!==i?(u=l=>{const{pageParam:_}=l;return E(i,_)},e[2]=i,e[3]=u):u=e[3];let c;e[4]!==t||e[5]!==u?(c={queryKey:t,queryFn:u,initialPageParam:void 0,getNextPageParam:V,refetchInterval:R},e[4]=t,e[5]=u,e[6]=c):c=e[6];const s=O(c);let I;e[7]!==a||e[8]!==t?(I=()=>a.invalidateQueries({queryKey:t,refetchType:"active"}),e[7]=a,e[8]=t,e[9]=I):I=e[9],w(r.slug,I);let f;e[10]!==i?(f=l=>i.call("NOTIFICATION_MARK_READ",l?{ids:l}:{}),e[10]=i,e[11]=f):f=e[11];let m,p;e[12]!==a||e[13]!==t?(m=async l=>{await a.cancelQueries({queryKey:t}),a.setQueryData(t,_=>L(_,l))},p=()=>a.invalidateQueries({queryKey:t}),e[12]=a,e[13]=t,e[14]=m,e[15]=p):(m=e[14],p=e[15]);let y;e[16]!==f||e[17]!==m||e[18]!==p?(y={mutationFn:f,onMutate:m,onSettled:p},e[16]=f,e[17]=m,e[18]=p,e[19]=y):y=e[19];const P=v(y);let N;e[20]!==s.data?.pages?(N=s.data?.pages??[],e[20]=s.data?.pages,e[21]=N):N=e[21];const C=N;let d;e[22]!==C?(d=C.flatMap($),e[22]=C,e[23]=d):d=e[23];const F=C[0]?.unreadCount??0;let g;e[24]!==s?(g=()=>{s.hasNextPage&&!s.isFetchingNextPage&&s.fetchNextPage()},e[24]=s,e[25]=g):g=e[25];let h,x;e[26]!==P?(h=()=>P.mutate(null),x=l=>P.mutate([l]),e[26]=P,e[27]=h,e[28]=x):(h=e[27],x=e[28]);let k;return e[29]!==s.hasNextPage||e[30]!==s.isFetchingNextPage||e[31]!==F||e[32]!==g||e[33]!==h||e[34]!==x||e[35]!==d?(k={updates:d,redDotCount:F,hasMore:s.hasNextPage,isFetchingMore:s.isFetchingNextPage,fetchMore:g,markAllRead:h,markRead:x},e[29]=s.hasNextPage,e[30]=s.isFetchingNextPage,e[31]=F,e[32]=g,e[33]=h,e[34]=x,e[35]=d,e[36]=k):k=e[36],k}function $(e){return e.notifications.map(J)}function J(e){return{id:e.id,taskBoardItemId:e.taskBoardItemId,taskTitle:e.taskTitle,taskKeySeq:e.taskKeySeq,action:e.type,actorName:e.actorName,actorImage:e.actorImage,occurredAt:e.createdAt}}function V(e){return e.nextCursor??void 0}export{G as u};
1
+ import{c as b,a4 as M,ak as S,q as T,e as v,a as q,r as A,K}from"./index-CwntHk8S.js";import{u as O}from"./useInfiniteQuery-BagPKS5m.js";import{n as Q}from"./watch-sse-pool-CTgVk3NA.js";const R=6e4;function E(e,n){return e.call("NOTIFICATION_LIST",n?{cursor:n}:{})}function L(e,n){if(!e)return e;const r=n?new Set(n):null;let i=0;const a=e.pages.map(t=>{const u=t.notifications.filter(c=>r&&!r.has(c.id)?!0:(i++,!1));return{...t,notifications:u}}),o=r?Math.max(0,(e.pages[0]?.unreadCount??0)-i):0;return{...e,pages:a.map(t=>({...t,unreadCount:o}))}}function w(e,n){const r=b.c(4),{data:i}=q.useSession(),a=i?.user?.id;let o;r[0]!==n||r[1]!==e||r[2]!==a?(o=t=>!e||!a?B:Q.subscribe(e,c=>{try{if(JSON.parse(c.data).subject!==a)return}catch{return}n(),t()},n),r[0]=n,r[1]=e,r[2]=a,r[3]=o):o=r[3],A.useSyncExternalStore(o,j,D)}function D(){return 0}function j(){return 0}function B(){}function G(){const e=b.c(37),{locator:n,org:r}=M(),i=S(),a=T();let o;e[0]!==n?(o=K.notifications(n),e[0]=n,e[1]=o):o=e[1];const t=o;let u;e[2]!==i?(u=l=>{const{pageParam:_}=l;return E(i,_)},e[2]=i,e[3]=u):u=e[3];let c;e[4]!==t||e[5]!==u?(c={queryKey:t,queryFn:u,initialPageParam:void 0,getNextPageParam:V,refetchInterval:R},e[4]=t,e[5]=u,e[6]=c):c=e[6];const s=O(c);let I;e[7]!==a||e[8]!==t?(I=()=>a.invalidateQueries({queryKey:t,refetchType:"active"}),e[7]=a,e[8]=t,e[9]=I):I=e[9],w(r.slug,I);let f;e[10]!==i?(f=l=>i.call("NOTIFICATION_MARK_READ",l?{ids:l}:{}),e[10]=i,e[11]=f):f=e[11];let m,p;e[12]!==a||e[13]!==t?(m=async l=>{await a.cancelQueries({queryKey:t}),a.setQueryData(t,_=>L(_,l))},p=()=>a.invalidateQueries({queryKey:t}),e[12]=a,e[13]=t,e[14]=m,e[15]=p):(m=e[14],p=e[15]);let y;e[16]!==f||e[17]!==m||e[18]!==p?(y={mutationFn:f,onMutate:m,onSettled:p},e[16]=f,e[17]=m,e[18]=p,e[19]=y):y=e[19];const P=v(y);let N;e[20]!==s.data?.pages?(N=s.data?.pages??[],e[20]=s.data?.pages,e[21]=N):N=e[21];const C=N;let d;e[22]!==C?(d=C.flatMap($),e[22]=C,e[23]=d):d=e[23];const F=C[0]?.unreadCount??0;let g;e[24]!==s?(g=()=>{s.hasNextPage&&!s.isFetchingNextPage&&s.fetchNextPage()},e[24]=s,e[25]=g):g=e[25];let h,x;e[26]!==P?(h=()=>P.mutate(null),x=l=>P.mutate([l]),e[26]=P,e[27]=h,e[28]=x):(h=e[27],x=e[28]);let k;return e[29]!==s.hasNextPage||e[30]!==s.isFetchingNextPage||e[31]!==F||e[32]!==g||e[33]!==h||e[34]!==x||e[35]!==d?(k={updates:d,redDotCount:F,hasMore:s.hasNextPage,isFetchingMore:s.isFetchingNextPage,fetchMore:g,markAllRead:h,markRead:x},e[29]=s.hasNextPage,e[30]=s.isFetchingNextPage,e[31]=F,e[32]=g,e[33]=h,e[34]=x,e[35]=d,e[36]=k):k=e[36],k}function $(e){return e.notifications.map(J)}function J(e){return{id:e.id,taskBoardItemId:e.taskBoardItemId,taskTitle:e.taskTitle,taskKeySeq:e.taskKeySeq,action:e.type,actorName:e.actorName,actorImage:e.actorImage,occurredAt:e.createdAt}}function V(e){return e.nextCursor??void 0}export{G as u};
@@ -1 +1 @@
1
- import{r as e}from"./index-BP527m3V.js";function v(n,u,c=!1,s){const r=e.useRef(null),o=e.useRef(null),f=e.useRef(n),i=e.useRef(u),R=e.useRef(c),l=e.useRef(s);f.current=n,i.current=u,R.current=c,l.current=s;const[p]=e.useState(()=>t=>{o.current=t,r.current&&(r.current.disconnect(),r.current=null),t&&queueMicrotask(()=>{if(o.current!==t)return;const a=new IntersectionObserver(x=>{x[0]?.isIntersecting&&i.current&&!R.current&&f.current()},{root:l.current?.current??null,rootMargin:"0px 0px 200px 0px"});a.observe(t),r.current=a})});return p}export{v as u};
1
+ import{r as e}from"./index-CwntHk8S.js";function v(n,u,c=!1,s){const r=e.useRef(null),o=e.useRef(null),f=e.useRef(n),i=e.useRef(u),R=e.useRef(c),l=e.useRef(s);f.current=n,i.current=u,R.current=c,l.current=s;const[p]=e.useState(()=>t=>{o.current=t,r.current&&(r.current.disconnect(),r.current=null),t&&queueMicrotask(()=>{if(o.current!==t)return;const a=new IntersectionObserver(x=>{x[0]?.isIntersecting&&i.current&&!R.current&&f.current()},{root:l.current?.current??null,rootMargin:"0px 0px 200px 0px"});a.observe(t),r.current=a})});return p}export{v as u};
@@ -1 +1 @@
1
- import{c as O,a4 as T,ak as v,av as A,K as I,i as _,q as J,b as Q,e as N,t as p}from"./index-BP527m3V.js";function j(){const e=O.c(10),{org:u}=T(),d=v(),{capabilities:c,isPrivileged:f}=A(),s=f||!!c["members:manage"];let i;e[0]!==u.id?(i=I.organizationJoinRequests(u.id),e[0]=u.id,e[1]=i):i=e[1];let t;e[2]!==d?(t=()=>d.call("ORGANIZATION_JOIN_REQUEST_LIST",{}),e[2]=d,e[3]=t):t=e[3];const o=!!u.id&&s;let n;e[4]!==i||e[5]!==t||e[6]!==o?(n={queryKey:i,queryFn:t,enabled:o},e[4]=i,e[5]=t,e[6]=o,e[7]=n):n=e[7];const{data:a}=_(n);let l;return e[8]!==a?.requests?(l=a?.requests??[],e[8]=a?.requests,e[9]=l):l=e[9],l}function F(){const e=O.c(29),{org:u,locator:d}=T(),c=v(),f=J(),s=Q();let i;e[0]!==d||e[1]!==u||e[2]!==f?(i=()=>{f.invalidateQueries({queryKey:I.organizationJoinRequests(u.id)}),f.invalidateQueries({queryKey:I.members(d)})},e[0]=d,e[1]=u,e[2]=f,e[3]=i):i=e[3];const t=i;let o;e[4]!==c?(o=r=>c.call("ORGANIZATION_JOIN_REQUEST_APPROVE",{requestId:r}),e[4]=c,e[5]=o):o=e[5];let n;e[6]!==t||e[7]!==s?(n=()=>{t(),p.success(s("settings.joinRequestsSection.approved"))},e[6]=t,e[7]=s,e[8]=n):n=e[8];let a;e[9]!==s?(a=r=>p.error(r instanceof Error?r.message:s("settings.joinRequestsSection.approveFailed")),e[9]=s,e[10]=a):a=e[10];let l;e[11]!==o||e[12]!==n||e[13]!==a?(l={mutationFn:o,onSuccess:n,onError:a},e[11]=o,e[12]=n,e[13]=a,e[14]=l):l=e[14];const y=N(l);let q;e[15]!==c?(q=r=>c.call("ORGANIZATION_JOIN_REQUEST_DENY",{requestId:r}),e[15]=c,e[16]=q):q=e[16];let R;e[17]!==t||e[18]!==s?(R=()=>{t(),p.success(s("settings.joinRequestsSection.denied"))},e[17]=t,e[18]=s,e[19]=R):R=e[19];let g;e[20]!==s?(g=r=>p.error(r instanceof Error?r.message:s("settings.joinRequestsSection.denyFailed")),e[20]=s,e[21]=g):g=e[21];let E;e[22]!==q||e[23]!==R||e[24]!==g?(E={mutationFn:q,onSuccess:R,onError:g},e[22]=q,e[23]=R,e[24]=g,e[25]=E):E=e[25];const S=N(E);let m;return e[26]!==y||e[27]!==S?(m={approve:y,deny:S},e[26]=y,e[27]=S,e[28]=m):m=e[28],m}export{F as a,j as u};
1
+ import{c as O,a4 as T,ak as v,av as A,K as I,i as _,q as J,b as Q,e as N,t as p}from"./index-CwntHk8S.js";function j(){const e=O.c(10),{org:u}=T(),d=v(),{capabilities:c,isPrivileged:f}=A(),s=f||!!c["members:manage"];let i;e[0]!==u.id?(i=I.organizationJoinRequests(u.id),e[0]=u.id,e[1]=i):i=e[1];let t;e[2]!==d?(t=()=>d.call("ORGANIZATION_JOIN_REQUEST_LIST",{}),e[2]=d,e[3]=t):t=e[3];const o=!!u.id&&s;let n;e[4]!==i||e[5]!==t||e[6]!==o?(n={queryKey:i,queryFn:t,enabled:o},e[4]=i,e[5]=t,e[6]=o,e[7]=n):n=e[7];const{data:a}=_(n);let l;return e[8]!==a?.requests?(l=a?.requests??[],e[8]=a?.requests,e[9]=l):l=e[9],l}function F(){const e=O.c(29),{org:u,locator:d}=T(),c=v(),f=J(),s=Q();let i;e[0]!==d||e[1]!==u||e[2]!==f?(i=()=>{f.invalidateQueries({queryKey:I.organizationJoinRequests(u.id)}),f.invalidateQueries({queryKey:I.members(d)})},e[0]=d,e[1]=u,e[2]=f,e[3]=i):i=e[3];const t=i;let o;e[4]!==c?(o=r=>c.call("ORGANIZATION_JOIN_REQUEST_APPROVE",{requestId:r}),e[4]=c,e[5]=o):o=e[5];let n;e[6]!==t||e[7]!==s?(n=()=>{t(),p.success(s("settings.joinRequestsSection.approved"))},e[6]=t,e[7]=s,e[8]=n):n=e[8];let a;e[9]!==s?(a=r=>p.error(r instanceof Error?r.message:s("settings.joinRequestsSection.approveFailed")),e[9]=s,e[10]=a):a=e[10];let l;e[11]!==o||e[12]!==n||e[13]!==a?(l={mutationFn:o,onSuccess:n,onError:a},e[11]=o,e[12]=n,e[13]=a,e[14]=l):l=e[14];const y=N(l);let q;e[15]!==c?(q=r=>c.call("ORGANIZATION_JOIN_REQUEST_DENY",{requestId:r}),e[15]=c,e[16]=q):q=e[16];let R;e[17]!==t||e[18]!==s?(R=()=>{t(),p.success(s("settings.joinRequestsSection.denied"))},e[17]=t,e[18]=s,e[19]=R):R=e[19];let g;e[20]!==s?(g=r=>p.error(r instanceof Error?r.message:s("settings.joinRequestsSection.denyFailed")),e[20]=s,e[21]=g):g=e[21];let E;e[22]!==q||e[23]!==R||e[24]!==g?(E={mutationFn:q,onSuccess:R,onError:g},e[22]=q,e[23]=R,e[24]=g,e[25]=E):E=e[25];const S=N(E);let m;return e[26]!==y||e[27]!==S?(m={approve:y,deny:S},e[26]=y,e[27]=S,e[28]=m):m=e[28],m}export{F as a,j as u};
@@ -0,0 +1 @@
1
+ import{c as Ee,b as He,u as Le,a4 as Oe,h3 as Be,h4 as Ke,h5 as le,h6 as de,aj as $e,ag as me,h7 as qe,h8 as Qe,r as Y,eq as We,U as pe,h9 as _e,ha as ze}from"./index-CwntHk8S.js";import{a as Ge}from"./use-chat-layout-state-CWt5k1nY.js";import{b as Je}from"./agent-icon-DE4TWlDl.js";import{i as Xe}from"./Monitor01-ZIydqkip.js";import{b as Ye}from"./use-connection-2s3z_IKD.js";import{a as Ze}from"./use-mcp-client-Cvc3WWPF.js";import{u as et}from"./use-mcp-tools-BIzewITl.js";import{b as tt}from"./repository-binding-Cqb4hBI0.js";import{g as at}from"./types-C8b3acwX.js";import{t as ot}from"./utils-CVEq3hMx.js";import{a as R}from"./agent-capabilities-COfZW6Pr.js";import"./index-DClpdtOI.js";import{u as nt}from"./use-sandbox-events-cbWqZuIm.js";import{F as ue}from"./file-type-icon-CEP8k4gh.js";import{a as st,u as it}from"./use-panel-navigate-V2MXWXLu.js";import{r as Z}from"./resolve-tab-icon-C5v6XuFJ.js";import{u as ct}from"./use-task-metadata-Bc8o5Sts.js";import{r as rt}from"./preview-source-BsRLGWUP.js";import{i as lt,n as dt,s as mt}from"./use-org-notice-DghJzmC_.js";import{u as pt}from"./use-voice-input-CwLNuWlo.js";import{u as ut}from"./use-organization-settings-Ddjh427l.js";import{a as ft}from"./use-project-scope-COzEo5Zz.js";import{c as bt,u as Tt,d as It,e as vt,f as ht}from"./use-project-native-view-presence-EdJBeOw9.js";import{c as Pt}from"./chat-context-CiT7AzBS.js";import{r as gt}from"./virtual-mcp-nhrh3mtw.js";function Xt(o){const e=Ee.c(35),d=He(),{openPanel:f,closePanel:F}=st();let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={strict:!1},e[0]=b):b=e[0];const fe=Le(b),ee=it(),te=Ge(),i=tt(o.virtualMcpId),T=ct(o.taskId),{org:n}=Oe(),{currentBranch:be,activeTask:I}=Pt(),m=i?.metadata.ui?.layout??null,c=m?.tabs??[],r=i?.id?Be(i.id):null,v=T?.expanded_tools??[],h=ut(),{scopeId:Te,project:Ie}=ft(),U=bt(Te,Ie,i),P=Tt(U.project),ae=It(U.resolvedScopeId,R(U.project?.metadata),P.presence);let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g={includeVirtual:!0},e[1]=g):g=e[1];const p=Ye(g),ve=nt(),x=I?.branch??be;let y;e[2]!==I?.metadata||e[3]!==o.taskId||e[4]!==i?.metadata||e[5]!==T||e[6]!==x?(y=rt({threadId:o.taskId,sandboxBranch:x,agentHasRepo:R(i?.metadata),threadHasRepo:R(T)||R(I?.metadata)}),e[2]=I?.metadata,e[3]=o.taskId,e[4]=i?.metadata,e[5]=T,e[6]=x,e[7]=y):y=e[7];const he=y,E=ve.lifecycle.phase==="running",{runtime:Pe,resolved:oe}=pt(o.virtualMcpId),H=!!r&&E;let k;e[8]!==H?(k={enabled:H},e[8]=H,e[9]=k):k=e[9];const ne=Ze({connectionId:r,orgId:n.id,orgSlug:n.slug},k),L=ne,O=!!ne&&E;let w;e[10]!==L||e[11]!==O?(w={client:L,enabled:O},e[10]=L,e[11]=O,e[12]=w):w=e[12];const{data:ge}=et(w),se=r&&E?(ge?.tools??[]).filter(Vt).map(t=>({connectionId:r,toolName:t.name,label:ot(t.name),icon:null})):[],B=se[0],ye=B?se:[],u=B&&r?{type:"ext-apps",id:r,toolName:B.toolName}:m?.defaultMainView??null,ke=gt(m),ie={assets:P.assetsPending,siteAccess:P.siteAccessPending,blog:P.blogPending},{activeTab:V,mainOpen:l}=Ke({panelTabId:ee,mainPanelParam:fe.mainpanel,routeDefaultMain:te,metadata:u||m?{defaultMainView:u,tabs:c.map(wt)}:null}),we=u||m?{defaultMainView:u,tabs:c.map(kt)}:null,C=dt({hasSource:he==="repo"||h,runtime:Pe,cmsMode:ke}),Ve=C.includes("content"),Ce=le(we),Me=u?.type,ce=vt(Me,ae,ie,C,oe),K=ce?le(null):Ce,Se=ht(V,ae,ie),Ne=!C.includes("code")&&oe&&de(V)!==null,a=!ee&&!te&&ce||V==="content"&&!Ve||Ne||Se?K:V,$=$e(a);let M;e[13]!==d?(M=t=>d(t==="site-editor"?"common.mainPanelTabs.preview":t==="content"?"common.mainPanelTabs.content":"common.mainPanelTabs.code"),e[13]=d,e[14]=M):M=e[14];const je=M,q=new Map;for(const t of v){const s=me(t.appId,t.toolName);q.set(s,{id:s,title:t.toolName,appId:t.appId,iconKey:t.toolName})}for(const t of ye){if(t.toolName==="fetch_assets")continue;const s=me(t.connectionId,t.toolName);q.set(s,{id:s,title:t.label||t.toolName,appId:t.connectionId,iconKey:t.toolName,iconUrl:t.icon??null})}const Q=qe(a),W=Q?Q.key.split("/").pop()??Q.key:null,Ae=W?[{id:a,title:W,kind:"file",icon:{kind:"component",Component:t=>Y.createElement(ue,{filename:W,...t})}}]:[],S=Qe(a),De=S?[{id:a,title:(S.path.split("/").pop()??S.path).replace(/\.html$/i,""),kind:"file",icon:{kind:"component",Component:t=>Y.createElement(S.path.startsWith("pages/")?Je:Xe,t)}}]:[],_=We(a),z=_?_.path.split("/").pop()??_.path:null,Re=z?[{id:a,title:z,kind:"file",icon:{kind:"component",Component:t=>Y.createElement(ue,{filename:z,...t})}}]:[],Fe=lt(a)?C.map(t=>({id:t==="code"&&de(a)?a:t,title:je(t),kind:"system",icon:Z({tabId:t,kind:"system",connections:p})})):[];let N;e[15]!==p?(N=t=>({id:_e(t.id),title:t.title,kind:"agent",icon:Z({tabId:t.id,kind:"agent",appId:t.view.appId,connections:p})}),e[15]=p,e[16]=N):N=e[16];const Ue=[...Fe,...Ae,...De,...Re,...c.map(N),...Array.from(q.values()).map(t=>({id:t.id,title:t.title,kind:"expanded",icon:Z({tabId:t.iconKey,kind:"expanded",appId:t.appId,iconUrl:t.iconUrl,connections:p})}))],re=new Set,G=Ue.filter(t=>re.has(t.id)?!1:(re.add(t.id),!0)),xe=o.virtualMcpId;let j;e[17]!==n.id?(j=pe(n.id),e[17]=n.id,e[18]=j):j=e[18];const J=xe===j;let A;e[19]!==a||e[20]!==F||e[21]!==l||e[22]!==J||e[23]!==f||e[24]!==n.id||e[25]!==h?(A=t=>{if(mt({reportsOnly:h,onReportAgent:J,tabId:t})){f(t,{virtualmcpid:pe(n.id),search:yt});return}const s=ze({clickedId:t,activeTab:a,mainOpen:l});"close"in s?F():f(s.tabId)},e[19]=a,e[20]=F,e[21]=l,e[22]=J,e[23]=f,e[24]=n.id,e[25]=h,e[26]=A):A=e[26];const X=A;let D;return e[27]!==a||e[28]!==$||e[29]!==v||e[30]!==c||e[31]!==l||e[32]!==X||e[33]!==G?(D={activeTab:a,mainOpen:l,setActiveTab:X,layoutTabs:c,expandedTools:v,automationTabParsed:$,tabs:G},e[27]=a,e[28]=$,e[29]=v,e[30]=c,e[31]=l,e[32]=X,e[33]=G,e[34]=D):D=e[34],D}function yt(o){return{...o,thread:void 0}}function kt(o){return{id:o.id}}function wt(o){return{id:o.id}}function Vt(o){return!!at(o._meta)}export{Xt as u};
@@ -0,0 +1 @@
1
+ import{c as I,b as k,a5 as N,b4 as S,j as o,a4 as $,K as A,V as L}from"./index-CwntHk8S.js";import{B as g}from"./badge-BG-k6t3T.js";import{c as v,T,a as b,b as _}from"./tooltip-BTd3W-2Z.js";import{g as H}from"./types-C8b3acwX.js";import{s as P}from"./Eye-BeTcpGN-.js";import{a5 as U,az as w}from"./agent-icon-DE4TWlDl.js";import{i as O}from"./mcp-oauth-DFWIYz5V.js";const R=[{key:"readOnlyHint",labelKey:"tools.toolsList.readOnly",Icon:P,variant:"secondary"},{key:"destructiveHint",labelKey:"tools.toolsList.destructive",Icon:N,variant:"destructive"},{key:"idempotentHint",labelKey:"tools.toolsList.idempotent",Icon:S,variant:"secondary"},{key:"openWorldHint",labelKey:"tools.toolsList.openWorld",Icon:U,variant:"outline"}];function Q(y){const e=I.c(22),{annotations:c,_meta:r}=y,t=k();let l;e[0]!==r?(l=H(r),e[0]=r,e[1]=l):l=e[1];const i=!!l;let s,n,a,u,d;if(e[2]!==c||e[3]!==i||e[4]!==t){d=Symbol.for("react.early_return_sentinel");e:{const x=c?R.filter(h=>c[h.key]===!0):[];if(x.length===0&&!i){d=null;break e}s=_,n="flex gap-1 flex-nowrap",e[10]!==i||e[11]!==t?(a=i&&o.jsxs(v,{children:[o.jsx(T,{asChild:!0,children:o.jsx(g,{asChild:!0,variant:"secondary",className:"size-6 p-1",children:o.jsx(w,{})})}),o.jsx(b,{children:t("tools.toolsList.interactive")})]}),e[10]=i,e[11]=t,e[12]=a):a=e[12];let f;e[13]!==t?(f=h=>{const{labelKey:j,Icon:C,variant:K}=h;return o.jsxs(v,{children:[o.jsx(T,{asChild:!0,children:o.jsx(g,{asChild:!0,variant:K,className:"size-6 p-1",children:o.jsx(C,{})})}),o.jsx(b,{children:t(j)})]},j)},e[13]=t,e[14]=f):f=e[14],u=x.map(f)}e[2]=c,e[3]=i,e[4]=t,e[5]=s,e[6]=n,e[7]=a,e[8]=u,e[9]=d}else s=e[5],n=e[6],a=e[7],u=e[8],d=e[9];if(d!==Symbol.for("react.early_return_sentinel"))return d;let m;e[15]!==n||e[16]!==a||e[17]!==u?(m=o.jsxs("div",{className:n,children:[a,u]}),e[15]=n,e[16]=a,e[17]=u,e[18]=m):m=e[18];let p;return e[19]!==s||e[20]!==m?(p=o.jsx(s,{children:m}),e[19]=s,e[20]=m,e[21]=p):p=e[21],p}function V(y){const e=I.c(11),{connectionId:c}=y,{org:r}=$();let t,l,i;e[0]!==c||e[1]!==r.slug?(t=new URL(`/api/${r.slug}/mcp/${c}`,window.location.origin),i=L,l=A.isMCPAuthenticated(t.href,null),e[0]=c,e[1]=r.slug,e[2]=t,e[3]=l,e[4]=i):(t=e[2],l=e[3],i=e[4]);let s;e[5]!==t||e[6]!==r.id?(s=()=>O({url:t.href,token:null,orgId:r.id}),e[5]=t,e[6]=r.id,e[7]=s):s=e[7];let n;e[8]!==l||e[9]!==s?(n={queryKey:l,queryFn:s},e[8]=l,e[9]=s,e[10]=n):n=e[10];const{data:a}=i(n);return a}export{Q as T,V as u};
@@ -1,4 +1,4 @@
1
- import{cM as ce,cN as le,cO as ue,cP as de,cQ as he,cR as m,cS as g,cT as fe,cU as pe,cV as me,cW as M,cX as _e,cY as F,cZ as we,c_ as q,c$ as ge,d0 as D,d1 as Te,d2 as ye,d3 as ke,d4 as z,d5 as ve,d6 as Se,d7 as Ce,d8 as ee,d9 as be,da as Re,db as Ie,bN as Ee,dc as qe,dd as Pe,de as A,df as $e,dg as Me,dh as Ae,di as He,dj as Oe,dk as xe,dl as Ne,dm as Ue,dn as je,dp as Fe,dq as De,dr as Le,ds as Ve,bE as V,dt as Qe,du as N,K as te,T as ze,c as se,V as Je,i as We}from"./index-BP527m3V.js";import{U as P,b as H,c as J}from"./auth-Br21RAsk.js";function x(a){return!!a._zod}function b(a,e){return x(a)?ce(a,e):a.safeParse(e)}function re(a){if(!a)return;let e;if(x(a)?e=a._zod?.def?.shape:e=a.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Ke(a){if(x(a)){const o=a._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}const t=a._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}const s=a.value;if(s!==void 0)return s}function R(a){return a==="completed"||a==="failed"||a==="cancelled"}function W(a){const t=re(a)?.method;if(!t)throw new Error("Schema is missing a method literal");const s=Ke(t);if(typeof s!="string")throw new Error("Schema method literal must be a string");return s}function K(a,e){const t=b(a,e);if(!t.success)throw t.error;return t.data}const Ge=6e4;class Be{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(le,t=>{this._oncancel(t)}),this.setNotificationHandler(ue,t=>{this._onprogress(t)}),this.setRequestHandler(de,t=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(he,async(t,s)=>{const r=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!r)throw new m(g.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(fe,async(t,s)=>{const r=async()=>{const o=t.params.taskId;if(this._taskMessageQueue){let i;for(;i=await this._taskMessageQueue.dequeue(o,s.sessionId);){if(i.type==="response"||i.type==="error"){const u=i.message,p=u.id,l=this._requestResolvers.get(p);if(l)if(this._requestResolvers.delete(p),i.type==="response")l(u);else{const h=u,f=new m(h.error.code,h.error.message,h.error.data);l(f)}else{const h=i.type==="response"?"Response":"Error";this._onerror(new Error(`${h} handler missing for request ${p}`))}continue}await this._transport?.send(i.message,{relatedRequestId:s.requestId})}}const n=await this._taskStore.getTask(o,s.sessionId);if(!n)throw new m(g.InvalidParams,`Task not found: ${o}`);if(!R(n.status))return await this._waitForTaskUpdate(o,s.signal),await r();if(R(n.status)){const i=await this._taskStore.getTaskResult(o,s.sessionId);return this._clearTaskQueue(o),{...i,_meta:{...i._meta,[q]:{taskId:o}}}}return await r()};return await r()}),this.setRequestHandler(pe,async(t,s)=>{try{const{tasks:r,nextCursor:o}=await this._taskStore.listTasks(t.params?.cursor,s.sessionId);return{tasks:r,nextCursor:o,_meta:{}}}catch(r){throw new m(g.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(me,async(t,s)=>{try{const r=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!r)throw new m(g.InvalidParams,`Task not found: ${t.params.taskId}`);if(R(r.status))throw new m(g.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",s.sessionId),this._clearTaskQueue(t.params.taskId);const o=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!o)throw new m(g.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...o}}catch(r){throw r instanceof m?r:new m(g.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,s,r,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:o,onTimeout:r})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),m.fromError(g.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;const t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};const s=this.transport?.onerror;this._transport.onerror=o=>{s?.(o),this._onerror(o)};const r=this._transport?.onmessage;this._transport.onmessage=(o,n)=>{r?.(o,n),M(o)||_e(o)?this._onresponse(o):F(o)?this._onrequest(o,n):we(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){const e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const s of this._timeoutInfo.values())clearTimeout(s.timeoutId);this._timeoutInfo.clear();for(const s of this._requestHandlerAbortControllers.values())s.abort();this._requestHandlerAbortControllers.clear();const t=m.fromError(g.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const s of e.values())s(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){const t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(s=>this._onerror(new Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,t){const s=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,o=e.params?._meta?.[q]?.taskId;if(s===void 0){const l={jsonrpc:"2.0",id:e.id,error:{code:g.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:l,timestamp:Date.now()},r?.sessionId).catch(h=>this._onerror(new Error(`Failed to enqueue error response: ${h}`))):r?.send(l).catch(h=>this._onerror(new Error(`Failed to send an error response: ${h}`)));return}const n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n);const i=ge(e.params)?e.params.task:void 0,u=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,p={signal:n.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(n.signal.aborted)return;const h={relatedRequestId:e.id};o&&(h.relatedTask={taskId:o}),await this.notification(l,h)},sendRequest:async(l,h,f)=>{if(n.signal.aborted)throw new m(g.ConnectionClosed,"Request was cancelled");const w={...f,relatedRequestId:e.id};o&&!w.relatedTask&&(w.relatedTask={taskId:o});const y=w.relatedTask?.taskId??o;return y&&u&&await u.updateTaskStatus(y,"input_required"),await this.request(l,h,w)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:o,taskStore:u,taskRequestedTtl:i?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{i&&this.assertTaskHandlerCapability(e.method)}).then(()=>s(e,p)).then(async l=>{if(n.signal.aborted)return;const h={result:l,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:h,timestamp:Date.now()},r?.sessionId):await r?.send(h)},async l=>{if(n.signal.aborted)return;const h={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:g.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:h,timestamp:Date.now()},r?.sessionId):await r?.send(h)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===n&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:t,...s}=e.params,r=Number(t),o=this._progressHandlers.get(r);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const n=this._responseHandlers.get(r),i=this._timeoutInfo.get(r);if(i&&n&&i.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(u){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),n(u);return}o(s)}_onresponse(e){const t=Number(e.id),s=this._requestResolvers.get(t);if(s){if(this._requestResolvers.delete(t),M(e))s(e);else{const n=new m(e.error.code,e.error.message,e.error.data);s(n)}return}const r=this._responseHandlers.get(t);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let o=!1;if(M(e)&&e.result&&typeof e.result=="object"){const n=e.result;if(n.task&&typeof n.task=="object"){const i=n.task;typeof i.taskId=="string"&&(o=!0,this._taskProgressTokens.set(i.taskId,t))}}if(o||this._progressHandlers.delete(t),M(e))r(e);else{const n=m.fromError(e.error.code,e.error.message,e.error.data);r(n)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,s){const{task:r}=s??{};if(!r){try{yield{type:"result",result:await this.request(e,t,s)}}catch(n){yield{type:"error",error:n instanceof m?n:new m(g.InternalError,String(n))}}return}let o;try{const n=await this.request(e,D,s);if(n.task)o=n.task.taskId,yield{type:"taskCreated",task:n.task};else throw new m(g.InternalError,"Task creation did not return a task");for(;;){const i=await this.getTask({taskId:o},s);if(yield{type:"taskStatus",task:i},R(i.status)){i.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},t,s)}:i.status==="failed"?yield{type:"error",error:new m(g.InternalError,`Task ${o} failed`)}:i.status==="cancelled"&&(yield{type:"error",error:new m(g.InternalError,`Task ${o} was cancelled`)});return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},t,s)};return}const u=i.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(p=>setTimeout(p,u)),s?.signal?.throwIfAborted()}}catch(n){yield{type:"error",error:n instanceof m?n:new m(g.InternalError,String(n))}}}request(e,t,s){const{relatedRequestId:r,resumptionToken:o,onresumptiontoken:n,task:i,relatedTask:u}=s??{};return new Promise((p,l)=>{const h=c=>{l(c)};if(!this._transport){h(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),i&&this.assertTaskCapability(e.method)}catch(c){h(c);return}s?.signal?.throwIfAborted();const f=this._requestMessageId++,w={...e,jsonrpc:"2.0",id:f};s?.onprogress&&(this._progressHandlers.set(f,s.onprogress),w.params={...e.params,_meta:{...e.params?._meta||{},progressToken:f}}),i&&(w.params={...w.params,task:i}),u&&(w.params={...w.params,_meta:{...w.params?._meta||{},[q]:u}});const y=c=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(c)}},{relatedRequestId:r,resumptionToken:o,onresumptiontoken:n}).catch(v=>this._onerror(new Error(`Failed to send cancellation: ${v}`)));const _=c instanceof m?c:new m(g.RequestTimeout,String(c));l(_)};this._responseHandlers.set(f,c=>{if(!s?.signal?.aborted){if(c instanceof Error)return l(c);try{const _=b(t,c.result);_.success?p(_.data):l(_.error)}catch(_){l(_)}}}),s?.signal?.addEventListener("abort",()=>{y(s?.signal?.reason)});const T=s?.timeout??Ge,k=()=>y(m.fromError(g.RequestTimeout,"Request timed out",{timeout:T}));this._setupTimeout(f,T,s?.maxTotalTimeout,k,s?.resetTimeoutOnProgress??!1);const d=u?.taskId;if(d){const c=_=>{const v=this._responseHandlers.get(f);v?v(_):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,c),this._enqueueTaskMessage(d,{type:"request",message:w,timestamp:Date.now()}).catch(_=>{this._cleanupTimeout(f),l(_)})}else this._transport.send(w,{relatedRequestId:r,resumptionToken:o,onresumptiontoken:n}).catch(c=>{this._cleanupTimeout(f),l(c)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},Te,t)}async getTaskResult(e,t,s){return this.request({method:"tasks/result",params:e},t,s)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},ye,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},ke,t)}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const s=t?.relatedTask?.taskId;if(s){const i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[q]:t.relatedTask}}};await this._enqueueTaskMessage(s,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let i={...e,jsonrpc:"2.0"};t?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[q]:t.relatedTask}}}),this._transport?.send(i,t).catch(u=>this._onerror(u))});return}let n={...e,jsonrpc:"2.0"};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[q]:t.relatedTask}}}),await this._transport.send(n,t)}setRequestHandler(e,t){const s=W(e);this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,o)=>{const n=K(e,r);return Promise.resolve(t(n,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){const s=W(e);this._notificationHandlers.set(s,r=>{const o=K(e,r);return Promise.resolve(t(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){const t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,s){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,s,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){const s=await this._taskMessageQueue.dequeueAll(e,t);for(const r of s)if(r.type==="request"&&F(r.message)){const o=r.message.id,n=this._requestResolvers.get(o);n?(n(new m(g.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let s=this._options?.defaultTaskPollInterval??1e3;try{const r=await this._taskStore?.getTask(e);r?.pollInterval&&(s=r.pollInterval)}catch{}return new Promise((r,o)=>{if(t.aborted){o(new m(g.InvalidRequest,"Request cancelled"));return}const n=setTimeout(r,s);t.addEventListener("abort",()=>{clearTimeout(n),o(new m(g.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){const s=this._taskStore;if(!s)throw new Error("No task store configured");return{createTask:async r=>{if(!e)throw new Error("No request provided");return await s.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async r=>{const o=await s.getTask(r,t);if(!o)throw new m(g.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(r,o,n)=>{await s.storeTaskResult(r,o,n,t);const i=await s.getTask(r,t);if(i){const u=z.parse({method:"notifications/tasks/status",params:i});await this.notification(u),R(i.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>s.getTaskResult(r,t),updateTaskStatus:async(r,o,n)=>{const i=await s.getTask(r,t);if(!i)throw new m(g.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(R(i.status))throw new m(g.InvalidParams,`Cannot update task "${r}" from terminal status "${i.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await s.updateTaskStatus(r,o,n,t);const u=await s.getTask(r,t);if(u){const p=z.parse({method:"notifications/tasks/status",params:u});await this.notification(p),R(u.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>s.listTasks(r,t)}}}function G(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)}function Ze(a,e){const t={...a};for(const s in e){const r=s,o=e[r];if(o===void 0)continue;const n=t[r];G(n)&&G(o)?t[r]={...n,...o}:t[r]=o}return t}var Ye=Se();const Xe=ve(Ye);function et(){const a=new Xe({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Ce(a),a}class tt{constructor(e){this._ajv=e??et()}getValidator(e){const t="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return s=>t(s)?{valid:!0,data:s,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}class st{constructor(e){this._client=e}async*callToolStream(e,t=ee,s){const r=this._client,o={...s,task:s?.task??(r.isToolTask(e.name)?{}:void 0)},n=r.requestStream({method:"tools/call",params:e},t,o),i=r.getToolOutputValidator(e.name);for await(const u of n){if(u.type==="result"&&i){const p=u.result;if(!p.structuredContent&&!p.isError){yield{type:"error",error:new m(g.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(p.structuredContent)try{const l=i(p.structuredContent);if(!l.valid){yield{type:"error",error:new m(g.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof m){yield{type:"error",error:l};return}yield{type:"error",error:new m(g.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)};return}}yield u}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,s){return this._client.getTaskResult({taskId:e},t,s)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,s){return this._client.requestStream(e,t,s)}}function rt(a,e,t){if(!a)throw new Error(`${t} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!a.tools?.call)throw new Error(`${t} does not support task creation for tools/call (required for ${e})`);break}}function ot(a,e,t){if(!a)throw new Error(`${t} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!a.sampling?.createMessage)throw new Error(`${t} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!a.elicitation?.create)throw new Error(`${t} does not support task creation for elicitation/create (required for ${e})`);break}}function O(a,e){if(!(!a||e===null||typeof e!="object")){if(a.type==="object"&&a.properties&&typeof a.properties=="object"){const t=e,s=a.properties;for(const r of Object.keys(s)){const o=s[r];t[r]===void 0&&Object.prototype.hasOwnProperty.call(o,"default")&&(t[r]=o.default),t[r]!==void 0&&O(o,t[r])}}if(Array.isArray(a.anyOf))for(const t of a.anyOf)typeof t!="boolean"&&O(t,e);if(Array.isArray(a.oneOf))for(const t of a.oneOf)typeof t!="boolean"&&O(t,e)}}function at(a){if(!a)return{supportsFormMode:!1,supportsUrlMode:!1};const e=a.form!==void 0,t=a.url!==void 0;return{supportsFormMode:e||!e&&!t,supportsUrlMode:t}}let nt=class extends Be{constructor(e,t){super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new tt,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",be,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",Re,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Ie,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new st(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ze(this._capabilities,e)}setRequestHandler(e,t){const r=re(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let o;if(x(r)){const i=r;o=i._zod?.def?.value??i.value}else{const i=r;o=i._def?.value??i.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");const n=o;if(n==="elicitation/create"){const i=async(u,p)=>{const l=b(je,u);if(!l.success){const c=l.error instanceof Error?l.error.message:String(l.error);throw new m(g.InvalidParams,`Invalid elicitation request: ${c}`)}const{params:h}=l.data;h.mode=h.mode??"form";const{supportsFormMode:f,supportsUrlMode:w}=at(this._capabilities.elicitation);if(h.mode==="form"&&!f)throw new m(g.InvalidParams,"Client does not support form-mode elicitation requests");if(h.mode==="url"&&!w)throw new m(g.InvalidParams,"Client does not support URL-mode elicitation requests");const y=await Promise.resolve(t(u,p));if(h.task){const c=b(D,y);if(!c.success){const _=c.error instanceof Error?c.error.message:String(c.error);throw new m(g.InvalidParams,`Invalid task creation result: ${_}`)}return c.data}const T=b(Fe,y);if(!T.success){const c=T.error instanceof Error?T.error.message:String(T.error);throw new m(g.InvalidParams,`Invalid elicitation result: ${c}`)}const k=T.data,d=h.mode==="form"?h.requestedSchema:void 0;if(h.mode==="form"&&k.action==="accept"&&k.content&&d&&this._capabilities.elicitation?.form?.applyDefaults)try{O(d,k.content)}catch{}return k};return super.setRequestHandler(e,i)}if(n==="sampling/createMessage"){const i=async(u,p)=>{const l=b(De,u);if(!l.success){const k=l.error instanceof Error?l.error.message:String(l.error);throw new m(g.InvalidParams,`Invalid sampling request: ${k}`)}const{params:h}=l.data,f=await Promise.resolve(t(u,p));if(h.task){const k=b(D,f);if(!k.success){const d=k.error instanceof Error?k.error.message:String(k.error);throw new m(g.InvalidParams,`Invalid task creation result: ${d}`)}return k.data}const y=h.tools||h.toolChoice?Le:Ve,T=b(y,f);if(!T.success){const k=T.error instanceof Error?T.error.message:String(T.error);throw new m(g.InvalidParams,`Invalid sampling result: ${k}`)}return T.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{const s=await this.request({method:"initialize",params:{protocolVersion:Ee,capabilities:this._capabilities,clientInfo:this._clientInfo}},qe,t);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Pe.includes(s.protocolVersion))throw new Error(`Server's protocol version is not supported: ${s.protocolVersion}`);this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(s.protocolVersion),this._instructions=s.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(s){throw this.close(),s}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break}}assertTaskCapability(e){rt(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&ot(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},A,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},$e,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},A,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},Me,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},Ae,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},He,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},Oe,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},xe,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},A,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},A,t)}async callTool(e,t=ee,s){if(this.isToolTaskRequired(e.name))throw new m(g.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const r=await this.request({method:"tools/call",params:e},t,s),o=this.getToolOutputValidator(e.name);if(o){if(!r.structuredContent&&!r.isError)throw new m(g.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{const n=o(r.structuredContent);if(!n.valid)throw new m(g.InvalidParams,`Structured content does not match the tool's output schema: ${n.errorMessage}`)}catch(n){throw n instanceof m?n:new m(g.InvalidParams,`Failed to validate structured content: ${n instanceof Error?n.message:String(n)}`)}}return r}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const t of e){if(t.outputSchema){const r=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,r)}const s=t.execution?.taskSupport;(s==="required"||s==="optional")&&this._cachedKnownTaskTools.add(t.name),s==="required"&&this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){const s=await this.request({method:"tools/list",params:e},Ne,t);return this.cacheToolMetadata(s.tools),s}_setupListChangedHandler(e,t,s,r){const o=Ue.safeParse(s);if(!o.success)throw new Error(`Invalid ${e} listChanged options: ${o.error.message}`);if(typeof s.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);const{autoRefresh:n,debounceMs:i}=o.data,{onChanged:u}=s,p=async()=>{if(!n){u(null,null);return}try{const h=await r();u(null,h)}catch(h){const f=h instanceof Error?h:new Error(String(h));u(f,null)}},l=()=>{if(i){const h=this._listChangedDebounceTimers.get(e);h&&clearTimeout(h);const f=setTimeout(p,i);this._listChangedDebounceTimers.set(e,f)}else p()};this.setNotificationHandler(t,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};const U=a=>[{type:"text",text:a}];function it(a){const e=V(a,typeof window<"u"?window.location.origin:void 0);if(!e)throw new Error("RestSelfClient requires either studioUrl or a browser environment.");const t={"Content-Type":"application/json",Accept:"application/json",...a.token?{Authorization:`Bearer ${a.token}`}:{}},s=u=>new URL(`/api/${encodeURIComponent(a.orgSlug)}${u}`,e).href,r=async u=>{let p;try{p=await fetch(s(`/tools/${encodeURIComponent(u.name)}`),{method:"POST",headers:t,credentials:"include",body:JSON.stringify(u.arguments??{})})}catch(h){const f=h instanceof Error?h.message:"Network error";return{content:U(f),isError:!0}}if(!p.ok){let h=`${u.name} failed (${p.status})`;try{const f=await p.json();f?.error&&(h=f.error)}catch{}return{content:U(h),isError:!0}}const l=await p.json().catch(()=>({}));return{content:U(typeof l=="string"?l:JSON.stringify(l)),structuredContent:l}},o=async()=>{const u=await fetch(s("/tools"),{method:"GET",headers:t,credentials:"include"});return u.ok?await u.json():{tools:[]}},n=u=>()=>Promise.reject(new Error(`RestSelfClient: ${u} is not supported over REST for the self connection`));return{callTool:r,listTools:o,listPrompts:n("listPrompts"),getPrompt:n("getPrompt"),listResources:n("listResources"),readResource:n("readResource"),listResourceTemplates:n("listResourceTemplates"),close:()=>Promise.resolve(),toJSON:()=>a.toJSONString}}function L(a){return a?a instanceof Headers?Object.fromEntries(a.entries()):Array.isArray(a)?Object.fromEntries(a):{...a}:{}}function ct(a=fetch,e){return e?async(t,s)=>{const r={...e,...s,headers:s?.headers?{...L(e.headers),...L(s.headers)}:e.headers};return a(t,r)}:a}class B extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}const Z=10,lt=13,I=32;function j(a){}function ut(a){if(typeof a=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=j,onError:t=j,onRetry:s=j,onComment:r}=a,o=[];let n=!0,i,u="",p=0,l;function h(d){if(n&&(n=!1,d.charCodeAt(0)===239&&d.charCodeAt(1)===187&&d.charCodeAt(2)===191&&(d=d.slice(3))),o.length===0){const v=f(d);v!==""&&o.push(v);return}if(d.indexOf(`
1
+ import{cK as ce,cL as le,cM as ue,cN as de,cO as he,cP as m,cQ as g,cR as fe,cS as pe,cT as me,cU as M,cV as _e,cW as F,cX as we,cY as q,cZ as ge,c_ as L,c$ as Te,d0 as ye,d1 as ke,d2 as z,d3 as ve,d4 as Se,d5 as Ce,d6 as ee,d7 as be,d8 as Re,d9 as Ie,bN as Ee,da as qe,db as Pe,dc as A,dd as $e,de as Me,df as Ae,dg as He,dh as Oe,di as xe,dj as Ne,dk as Ue,dl as je,dm as Fe,dn as Le,dp as De,dq as Ve,bE as V,dr as Qe,ds as N,K as te,T as ze,c as se,V as Je,i as We}from"./index-CwntHk8S.js";import{U as P,b as H,c as J}from"./auth-gL3R1YGn.js";function x(a){return!!a._zod}function b(a,e){return x(a)?ce(a,e):a.safeParse(e)}function re(a){if(!a)return;let e;if(x(a)?e=a._zod?.def?.shape:e=a.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Ke(a){if(x(a)){const o=a._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}const t=a._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}const s=a.value;if(s!==void 0)return s}function R(a){return a==="completed"||a==="failed"||a==="cancelled"}function W(a){const t=re(a)?.method;if(!t)throw new Error("Schema is missing a method literal");const s=Ke(t);if(typeof s!="string")throw new Error("Schema method literal must be a string");return s}function K(a,e){const t=b(a,e);if(!t.success)throw t.error;return t.data}const Ge=6e4;class Be{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(le,t=>{this._oncancel(t)}),this.setNotificationHandler(ue,t=>{this._onprogress(t)}),this.setRequestHandler(de,t=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(he,async(t,s)=>{const r=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!r)throw new m(g.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(fe,async(t,s)=>{const r=async()=>{const o=t.params.taskId;if(this._taskMessageQueue){let i;for(;i=await this._taskMessageQueue.dequeue(o,s.sessionId);){if(i.type==="response"||i.type==="error"){const u=i.message,p=u.id,l=this._requestResolvers.get(p);if(l)if(this._requestResolvers.delete(p),i.type==="response")l(u);else{const h=u,f=new m(h.error.code,h.error.message,h.error.data);l(f)}else{const h=i.type==="response"?"Response":"Error";this._onerror(new Error(`${h} handler missing for request ${p}`))}continue}await this._transport?.send(i.message,{relatedRequestId:s.requestId})}}const n=await this._taskStore.getTask(o,s.sessionId);if(!n)throw new m(g.InvalidParams,`Task not found: ${o}`);if(!R(n.status))return await this._waitForTaskUpdate(o,s.signal),await r();if(R(n.status)){const i=await this._taskStore.getTaskResult(o,s.sessionId);return this._clearTaskQueue(o),{...i,_meta:{...i._meta,[q]:{taskId:o}}}}return await r()};return await r()}),this.setRequestHandler(pe,async(t,s)=>{try{const{tasks:r,nextCursor:o}=await this._taskStore.listTasks(t.params?.cursor,s.sessionId);return{tasks:r,nextCursor:o,_meta:{}}}catch(r){throw new m(g.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(me,async(t,s)=>{try{const r=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!r)throw new m(g.InvalidParams,`Task not found: ${t.params.taskId}`);if(R(r.status))throw new m(g.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",s.sessionId),this._clearTaskQueue(t.params.taskId);const o=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!o)throw new m(g.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...o}}catch(r){throw r instanceof m?r:new m(g.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,s,r,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:o,onTimeout:r})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),m.fromError(g.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;const t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};const s=this.transport?.onerror;this._transport.onerror=o=>{s?.(o),this._onerror(o)};const r=this._transport?.onmessage;this._transport.onmessage=(o,n)=>{r?.(o,n),M(o)||_e(o)?this._onresponse(o):F(o)?this._onrequest(o,n):we(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){const e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const s of this._timeoutInfo.values())clearTimeout(s.timeoutId);this._timeoutInfo.clear();for(const s of this._requestHandlerAbortControllers.values())s.abort();this._requestHandlerAbortControllers.clear();const t=m.fromError(g.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const s of e.values())s(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){const t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(s=>this._onerror(new Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,t){const s=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,o=e.params?._meta?.[q]?.taskId;if(s===void 0){const l={jsonrpc:"2.0",id:e.id,error:{code:g.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:l,timestamp:Date.now()},r?.sessionId).catch(h=>this._onerror(new Error(`Failed to enqueue error response: ${h}`))):r?.send(l).catch(h=>this._onerror(new Error(`Failed to send an error response: ${h}`)));return}const n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n);const i=ge(e.params)?e.params.task:void 0,u=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,p={signal:n.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(n.signal.aborted)return;const h={relatedRequestId:e.id};o&&(h.relatedTask={taskId:o}),await this.notification(l,h)},sendRequest:async(l,h,f)=>{if(n.signal.aborted)throw new m(g.ConnectionClosed,"Request was cancelled");const w={...f,relatedRequestId:e.id};o&&!w.relatedTask&&(w.relatedTask={taskId:o});const y=w.relatedTask?.taskId??o;return y&&u&&await u.updateTaskStatus(y,"input_required"),await this.request(l,h,w)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:o,taskStore:u,taskRequestedTtl:i?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{i&&this.assertTaskHandlerCapability(e.method)}).then(()=>s(e,p)).then(async l=>{if(n.signal.aborted)return;const h={result:l,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:h,timestamp:Date.now()},r?.sessionId):await r?.send(h)},async l=>{if(n.signal.aborted)return;const h={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:g.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:h,timestamp:Date.now()},r?.sessionId):await r?.send(h)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===n&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:t,...s}=e.params,r=Number(t),o=this._progressHandlers.get(r);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const n=this._responseHandlers.get(r),i=this._timeoutInfo.get(r);if(i&&n&&i.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(u){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),n(u);return}o(s)}_onresponse(e){const t=Number(e.id),s=this._requestResolvers.get(t);if(s){if(this._requestResolvers.delete(t),M(e))s(e);else{const n=new m(e.error.code,e.error.message,e.error.data);s(n)}return}const r=this._responseHandlers.get(t);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let o=!1;if(M(e)&&e.result&&typeof e.result=="object"){const n=e.result;if(n.task&&typeof n.task=="object"){const i=n.task;typeof i.taskId=="string"&&(o=!0,this._taskProgressTokens.set(i.taskId,t))}}if(o||this._progressHandlers.delete(t),M(e))r(e);else{const n=m.fromError(e.error.code,e.error.message,e.error.data);r(n)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,s){const{task:r}=s??{};if(!r){try{yield{type:"result",result:await this.request(e,t,s)}}catch(n){yield{type:"error",error:n instanceof m?n:new m(g.InternalError,String(n))}}return}let o;try{const n=await this.request(e,L,s);if(n.task)o=n.task.taskId,yield{type:"taskCreated",task:n.task};else throw new m(g.InternalError,"Task creation did not return a task");for(;;){const i=await this.getTask({taskId:o},s);if(yield{type:"taskStatus",task:i},R(i.status)){i.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},t,s)}:i.status==="failed"?yield{type:"error",error:new m(g.InternalError,`Task ${o} failed`)}:i.status==="cancelled"&&(yield{type:"error",error:new m(g.InternalError,`Task ${o} was cancelled`)});return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},t,s)};return}const u=i.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(p=>setTimeout(p,u)),s?.signal?.throwIfAborted()}}catch(n){yield{type:"error",error:n instanceof m?n:new m(g.InternalError,String(n))}}}request(e,t,s){const{relatedRequestId:r,resumptionToken:o,onresumptiontoken:n,task:i,relatedTask:u}=s??{};return new Promise((p,l)=>{const h=c=>{l(c)};if(!this._transport){h(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),i&&this.assertTaskCapability(e.method)}catch(c){h(c);return}s?.signal?.throwIfAborted();const f=this._requestMessageId++,w={...e,jsonrpc:"2.0",id:f};s?.onprogress&&(this._progressHandlers.set(f,s.onprogress),w.params={...e.params,_meta:{...e.params?._meta||{},progressToken:f}}),i&&(w.params={...w.params,task:i}),u&&(w.params={...w.params,_meta:{...w.params?._meta||{},[q]:u}});const y=c=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(c)}},{relatedRequestId:r,resumptionToken:o,onresumptiontoken:n}).catch(v=>this._onerror(new Error(`Failed to send cancellation: ${v}`)));const _=c instanceof m?c:new m(g.RequestTimeout,String(c));l(_)};this._responseHandlers.set(f,c=>{if(!s?.signal?.aborted){if(c instanceof Error)return l(c);try{const _=b(t,c.result);_.success?p(_.data):l(_.error)}catch(_){l(_)}}}),s?.signal?.addEventListener("abort",()=>{y(s?.signal?.reason)});const T=s?.timeout??Ge,k=()=>y(m.fromError(g.RequestTimeout,"Request timed out",{timeout:T}));this._setupTimeout(f,T,s?.maxTotalTimeout,k,s?.resetTimeoutOnProgress??!1);const d=u?.taskId;if(d){const c=_=>{const v=this._responseHandlers.get(f);v?v(_):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,c),this._enqueueTaskMessage(d,{type:"request",message:w,timestamp:Date.now()}).catch(_=>{this._cleanupTimeout(f),l(_)})}else this._transport.send(w,{relatedRequestId:r,resumptionToken:o,onresumptiontoken:n}).catch(c=>{this._cleanupTimeout(f),l(c)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},Te,t)}async getTaskResult(e,t,s){return this.request({method:"tasks/result",params:e},t,s)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},ye,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},ke,t)}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const s=t?.relatedTask?.taskId;if(s){const i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[q]:t.relatedTask}}};await this._enqueueTaskMessage(s,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let i={...e,jsonrpc:"2.0"};t?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[q]:t.relatedTask}}}),this._transport?.send(i,t).catch(u=>this._onerror(u))});return}let n={...e,jsonrpc:"2.0"};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[q]:t.relatedTask}}}),await this._transport.send(n,t)}setRequestHandler(e,t){const s=W(e);this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,o)=>{const n=K(e,r);return Promise.resolve(t(n,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){const s=W(e);this._notificationHandlers.set(s,r=>{const o=K(e,r);return Promise.resolve(t(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){const t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,s){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,s,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){const s=await this._taskMessageQueue.dequeueAll(e,t);for(const r of s)if(r.type==="request"&&F(r.message)){const o=r.message.id,n=this._requestResolvers.get(o);n?(n(new m(g.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let s=this._options?.defaultTaskPollInterval??1e3;try{const r=await this._taskStore?.getTask(e);r?.pollInterval&&(s=r.pollInterval)}catch{}return new Promise((r,o)=>{if(t.aborted){o(new m(g.InvalidRequest,"Request cancelled"));return}const n=setTimeout(r,s);t.addEventListener("abort",()=>{clearTimeout(n),o(new m(g.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){const s=this._taskStore;if(!s)throw new Error("No task store configured");return{createTask:async r=>{if(!e)throw new Error("No request provided");return await s.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async r=>{const o=await s.getTask(r,t);if(!o)throw new m(g.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(r,o,n)=>{await s.storeTaskResult(r,o,n,t);const i=await s.getTask(r,t);if(i){const u=z.parse({method:"notifications/tasks/status",params:i});await this.notification(u),R(i.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>s.getTaskResult(r,t),updateTaskStatus:async(r,o,n)=>{const i=await s.getTask(r,t);if(!i)throw new m(g.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(R(i.status))throw new m(g.InvalidParams,`Cannot update task "${r}" from terminal status "${i.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await s.updateTaskStatus(r,o,n,t);const u=await s.getTask(r,t);if(u){const p=z.parse({method:"notifications/tasks/status",params:u});await this.notification(p),R(u.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>s.listTasks(r,t)}}}function G(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)}function Ze(a,e){const t={...a};for(const s in e){const r=s,o=e[r];if(o===void 0)continue;const n=t[r];G(n)&&G(o)?t[r]={...n,...o}:t[r]=o}return t}var Ye=Se();const Xe=ve(Ye);function et(){const a=new Xe({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Ce(a),a}class tt{constructor(e){this._ajv=e??et()}getValidator(e){const t="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return s=>t(s)?{valid:!0,data:s,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}class st{constructor(e){this._client=e}async*callToolStream(e,t=ee,s){const r=this._client,o={...s,task:s?.task??(r.isToolTask(e.name)?{}:void 0)},n=r.requestStream({method:"tools/call",params:e},t,o),i=r.getToolOutputValidator(e.name);for await(const u of n){if(u.type==="result"&&i){const p=u.result;if(!p.structuredContent&&!p.isError){yield{type:"error",error:new m(g.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(p.structuredContent)try{const l=i(p.structuredContent);if(!l.valid){yield{type:"error",error:new m(g.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof m){yield{type:"error",error:l};return}yield{type:"error",error:new m(g.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)};return}}yield u}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,s){return this._client.getTaskResult({taskId:e},t,s)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,s){return this._client.requestStream(e,t,s)}}function rt(a,e,t){if(!a)throw new Error(`${t} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!a.tools?.call)throw new Error(`${t} does not support task creation for tools/call (required for ${e})`);break}}function ot(a,e,t){if(!a)throw new Error(`${t} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!a.sampling?.createMessage)throw new Error(`${t} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!a.elicitation?.create)throw new Error(`${t} does not support task creation for elicitation/create (required for ${e})`);break}}function O(a,e){if(!(!a||e===null||typeof e!="object")){if(a.type==="object"&&a.properties&&typeof a.properties=="object"){const t=e,s=a.properties;for(const r of Object.keys(s)){const o=s[r];t[r]===void 0&&Object.prototype.hasOwnProperty.call(o,"default")&&(t[r]=o.default),t[r]!==void 0&&O(o,t[r])}}if(Array.isArray(a.anyOf))for(const t of a.anyOf)typeof t!="boolean"&&O(t,e);if(Array.isArray(a.oneOf))for(const t of a.oneOf)typeof t!="boolean"&&O(t,e)}}function at(a){if(!a)return{supportsFormMode:!1,supportsUrlMode:!1};const e=a.form!==void 0,t=a.url!==void 0;return{supportsFormMode:e||!e&&!t,supportsUrlMode:t}}let nt=class extends Be{constructor(e,t){super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new tt,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",be,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",Re,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Ie,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new st(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ze(this._capabilities,e)}setRequestHandler(e,t){const r=re(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let o;if(x(r)){const i=r;o=i._zod?.def?.value??i.value}else{const i=r;o=i._def?.value??i.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");const n=o;if(n==="elicitation/create"){const i=async(u,p)=>{const l=b(je,u);if(!l.success){const c=l.error instanceof Error?l.error.message:String(l.error);throw new m(g.InvalidParams,`Invalid elicitation request: ${c}`)}const{params:h}=l.data;h.mode=h.mode??"form";const{supportsFormMode:f,supportsUrlMode:w}=at(this._capabilities.elicitation);if(h.mode==="form"&&!f)throw new m(g.InvalidParams,"Client does not support form-mode elicitation requests");if(h.mode==="url"&&!w)throw new m(g.InvalidParams,"Client does not support URL-mode elicitation requests");const y=await Promise.resolve(t(u,p));if(h.task){const c=b(L,y);if(!c.success){const _=c.error instanceof Error?c.error.message:String(c.error);throw new m(g.InvalidParams,`Invalid task creation result: ${_}`)}return c.data}const T=b(Fe,y);if(!T.success){const c=T.error instanceof Error?T.error.message:String(T.error);throw new m(g.InvalidParams,`Invalid elicitation result: ${c}`)}const k=T.data,d=h.mode==="form"?h.requestedSchema:void 0;if(h.mode==="form"&&k.action==="accept"&&k.content&&d&&this._capabilities.elicitation?.form?.applyDefaults)try{O(d,k.content)}catch{}return k};return super.setRequestHandler(e,i)}if(n==="sampling/createMessage"){const i=async(u,p)=>{const l=b(Le,u);if(!l.success){const k=l.error instanceof Error?l.error.message:String(l.error);throw new m(g.InvalidParams,`Invalid sampling request: ${k}`)}const{params:h}=l.data,f=await Promise.resolve(t(u,p));if(h.task){const k=b(L,f);if(!k.success){const d=k.error instanceof Error?k.error.message:String(k.error);throw new m(g.InvalidParams,`Invalid task creation result: ${d}`)}return k.data}const y=h.tools||h.toolChoice?De:Ve,T=b(y,f);if(!T.success){const k=T.error instanceof Error?T.error.message:String(T.error);throw new m(g.InvalidParams,`Invalid sampling result: ${k}`)}return T.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{const s=await this.request({method:"initialize",params:{protocolVersion:Ee,capabilities:this._capabilities,clientInfo:this._clientInfo}},qe,t);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Pe.includes(s.protocolVersion))throw new Error(`Server's protocol version is not supported: ${s.protocolVersion}`);this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(s.protocolVersion),this._instructions=s.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(s){throw this.close(),s}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break}}assertTaskCapability(e){rt(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&ot(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},A,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},$e,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},A,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},Me,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},Ae,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},He,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},Oe,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},xe,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},A,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},A,t)}async callTool(e,t=ee,s){if(this.isToolTaskRequired(e.name))throw new m(g.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const r=await this.request({method:"tools/call",params:e},t,s),o=this.getToolOutputValidator(e.name);if(o){if(!r.structuredContent&&!r.isError)throw new m(g.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{const n=o(r.structuredContent);if(!n.valid)throw new m(g.InvalidParams,`Structured content does not match the tool's output schema: ${n.errorMessage}`)}catch(n){throw n instanceof m?n:new m(g.InvalidParams,`Failed to validate structured content: ${n instanceof Error?n.message:String(n)}`)}}return r}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const t of e){if(t.outputSchema){const r=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,r)}const s=t.execution?.taskSupport;(s==="required"||s==="optional")&&this._cachedKnownTaskTools.add(t.name),s==="required"&&this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){const s=await this.request({method:"tools/list",params:e},Ne,t);return this.cacheToolMetadata(s.tools),s}_setupListChangedHandler(e,t,s,r){const o=Ue.safeParse(s);if(!o.success)throw new Error(`Invalid ${e} listChanged options: ${o.error.message}`);if(typeof s.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);const{autoRefresh:n,debounceMs:i}=o.data,{onChanged:u}=s,p=async()=>{if(!n){u(null,null);return}try{const h=await r();u(null,h)}catch(h){const f=h instanceof Error?h:new Error(String(h));u(f,null)}},l=()=>{if(i){const h=this._listChangedDebounceTimers.get(e);h&&clearTimeout(h);const f=setTimeout(p,i);this._listChangedDebounceTimers.set(e,f)}else p()};this.setNotificationHandler(t,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};const U=a=>[{type:"text",text:a}];function it(a){const e=V(a,typeof window<"u"?window.location.origin:void 0);if(!e)throw new Error("RestSelfClient requires either studioUrl or a browser environment.");const t={"Content-Type":"application/json",Accept:"application/json",...a.token?{Authorization:`Bearer ${a.token}`}:{}},s=u=>new URL(`/api/${encodeURIComponent(a.orgSlug)}${u}`,e).href,r=async u=>{let p;try{p=await fetch(s(`/tools/${encodeURIComponent(u.name)}`),{method:"POST",headers:t,credentials:"include",body:JSON.stringify(u.arguments??{})})}catch(h){const f=h instanceof Error?h.message:"Network error";return{content:U(f),isError:!0}}if(!p.ok){let h=`${u.name} failed (${p.status})`;try{const f=await p.json();f?.error&&(h=f.error)}catch{}return{content:U(h),isError:!0}}const l=await p.json().catch(()=>({}));return{content:U(typeof l=="string"?l:JSON.stringify(l)),structuredContent:l}},o=async()=>{const u=await fetch(s("/tools"),{method:"GET",headers:t,credentials:"include"});return u.ok?await u.json():{tools:[]}},n=u=>()=>Promise.reject(new Error(`RestSelfClient: ${u} is not supported over REST for the self connection`));return{callTool:r,listTools:o,listPrompts:n("listPrompts"),getPrompt:n("getPrompt"),listResources:n("listResources"),readResource:n("readResource"),listResourceTemplates:n("listResourceTemplates"),close:()=>Promise.resolve(),toJSON:()=>a.toJSONString}}function D(a){return a?a instanceof Headers?Object.fromEntries(a.entries()):Array.isArray(a)?Object.fromEntries(a):{...a}:{}}function ct(a=fetch,e){return e?async(t,s)=>{const r={...e,...s,headers:s?.headers?{...D(e.headers),...D(s.headers)}:e.headers};return a(t,r)}:a}class B extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}const Z=10,lt=13,I=32;function j(a){}function ut(a){if(typeof a=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=j,onError:t=j,onRetry:s=j,onComment:r}=a,o=[];let n=!0,i,u="",p=0,l;function h(d){if(n&&(n=!1,d.charCodeAt(0)===239&&d.charCodeAt(1)===187&&d.charCodeAt(2)===191&&(d=d.slice(3))),o.length===0){const v=f(d);v!==""&&o.push(v);return}if(d.indexOf(`
2
2
  `)===-1&&d.indexOf("\r")===-1){o.push(d);return}o.push(d);const c=o.join("");o.length=0;const _=f(c);_!==""&&o.push(_)}function f(d){let c=0;if(d.indexOf("\r")===-1){let _=d.indexOf(`
3
3
  `,c);for(;_!==-1;){if(c===_){p>0&&e({id:i,event:l,data:u}),i=void 0,u="",p=0,l=void 0,c=_+1,_=d.indexOf(`
4
4
  `,c);continue}const v=d.charCodeAt(c);if(Y(d,c,v)){const S=d.charCodeAt(c+5)===I?c+6:c+5,C=d.slice(S,_);if(p===0&&d.charCodeAt(_+1)===Z){e({id:i,event:l,data:C}),i=void 0,u="",l=void 0,c=_+2,_=d.indexOf(`
@@ -7,4 +7,4 @@ ${C}`,p++}else X(d,c,v)?l=d.slice(d.charCodeAt(c+6)===I?c+7:c+6,_)||void 0:w(d,c
7
7
  `,c)}return d.slice(c)}for(;c<d.length;){const _=d.indexOf("\r",c),v=d.indexOf(`
8
8
  `,c);let S=-1;if(_!==-1&&v!==-1?S=_<v?_:v:_!==-1?_===d.length-1?S=-1:S=_:v!==-1&&(S=v),S===-1)break;w(d,c,S),c=S+1,d.charCodeAt(c-1)===lt&&d.charCodeAt(c)===Z&&c++}return d.slice(c)}function w(d,c,_){if(c===_){T();return}const v=d.charCodeAt(c);if(Y(d,c,v)){const E=d.charCodeAt(c+5)===I?c+6:c+5,Q=d.slice(E,_);u=p===0?Q:`${u}
9
9
  ${Q}`,p++;return}if(X(d,c,v)){l=d.slice(d.charCodeAt(c+6)===I?c+7:c+6,_)||void 0;return}if(v===105&&d.charCodeAt(c+1)===100&&d.charCodeAt(c+2)===58){const E=d.slice(d.charCodeAt(c+3)===I?c+4:c+3,_);i=E.includes("\0")?void 0:E;return}if(v===58){if(r){const E=d.slice(c,_);r(E.slice(d.charCodeAt(c+1)===I?2:1))}return}const S=d.slice(c,_),C=S.indexOf(":");if(C===-1){y(S,"",S);return}const ae=S.slice(0,C),ne=S.charCodeAt(C+1)===I?2:1,ie=S.slice(C+ne);y(ae,ie,S)}function y(d,c,_){switch(d){case"event":l=c||void 0;break;case"data":u=p===0?c:`${u}
10
- ${c}`,p++;break;case"id":i=c.includes("\0")?void 0:c;break;case"retry":/^\d+$/.test(c)?s(parseInt(c,10)):t(new B(`Invalid \`retry\` value: "${c}"`,{type:"invalid-retry",value:c,line:_}));break;default:t(new B(`Unknown field "${d.length>20?`${d.slice(0,20)}…`:d}"`,{type:"unknown-field",field:d,value:c,line:_}));break}}function T(){p>0&&e({id:i,event:l,data:u}),i=void 0,u="",p=0,l=void 0}function k(d={}){if(d.consume&&o.length>0){const c=o.join("");w(c,0,c.length)}n=!0,i=void 0,u="",p=0,l=void 0,o.length=0}return{feed:h,reset:k}}function Y(a,e,t){return t===100&&a.charCodeAt(e+1)===97&&a.charCodeAt(e+2)===116&&a.charCodeAt(e+3)===97&&a.charCodeAt(e+4)===58}function X(a,e,t){return t===101&&a.charCodeAt(e+1)===118&&a.charCodeAt(e+2)===101&&a.charCodeAt(e+3)===110&&a.charCodeAt(e+4)===116&&a.charCodeAt(e+5)===58}class dt extends TransformStream{constructor({onError:e,onRetry:t,onComment:s}={}){let r;super({start(o){r=ut({onEvent:n=>{o.enqueue(n)},onError(n){e==="terminate"?o.error(n):typeof e=="function"&&e(n)},onRetry:t,onComment:s})},transform(o){r.feed(o)}})}}const ht={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class $ extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}}let ft=class{constructor(e,t){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=ct(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??ht}async _authThenStart(){if(!this._authProvider)throw new P("No auth provider");let e;try{e=await H(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(t){throw this.onerror?.(t),t}if(e!=="AUTHORIZED")throw new P;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){const e={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(e.Authorization=`Bearer ${s.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);const t=L(this._requestInit?.headers);return new Headers({...e,...t})}async _startOrAuthSse(e){const{resumptionToken:t}=e;try{const s=await this._commonHeaders();s.set("Accept","text/event-stream"),t&&s.set("last-event-id",t);const r=await(this._fetch??fetch)(this._url,{method:"GET",headers:s,signal:this._abortController?.signal});if(!r.ok){if(await r.body?.cancel(),r.status===401&&this._authProvider)return await this._authThenStart();if(r.status===405)return;throw new $(r.status,`Failed to open SSE stream: ${r.statusText}`)}this._handleSseStream(r.body,e,!0)}catch(s){throw this.onerror?.(s),s}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;const t=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(s,e),r)}_scheduleReconnection(e,t=0){const s=this._reconnectionOptions.maxRetries;if(t>=s){this.onerror?.(new Error(`Maximum reconnection attempts (${s}) exceeded.`));return}const r=this._getNextReconnectionDelay(t);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,t+1)})},r)}_handleSseStream(e,t,s){if(!e)return;const{onresumptiontoken:r,replayMessageId:o}=t;let n,i=!1,u=!1;(async()=>{try{const l=e.pipeThrough(new TextDecoderStream).pipeThrough(new dt({onRetry:w=>{this._serverRetryMs=w}})).getReader();for(;;){const{value:w,done:y}=await l.read();if(y)break;if(w.id&&(n=w.id,i=!0,r?.(w.id)),!!w.data&&(!w.event||w.event==="message"))try{const T=N.parse(JSON.parse(w.data));M(T)&&(u=!0,o!==void 0&&(T.id=o)),this.onmessage?.(T)}catch(T){this.onerror?.(T)}}(s||i)&&!u&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:n,onresumptiontoken:r,replayMessageId:o},0)}catch(l){if(this.onerror?.(new Error(`SSE stream disconnected: ${l}`)),(s||i)&&!u&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:n,onresumptiontoken:r,replayMessageId:o},0)}catch(w){this.onerror?.(new Error(`Failed to reconnect: ${w instanceof Error?w.message:String(w)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new P("No auth provider");if(await H(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new P("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,t){try{const{resumptionToken:s,onresumptiontoken:r}=t||{};if(s){this._startOrAuthSse({resumptionToken:s,replayMessageId:F(e)?e.id:void 0}).catch(f=>this.onerror?.(f));return}const o=await this._commonHeaders();o.set("content-type","application/json"),o.set("accept","application/json, text/event-stream");const n={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:this._abortController?.signal},i=await(this._fetch??fetch)(this._url,n),u=i.headers.get("mcp-session-id");if(u&&(this._sessionId=u),!i.ok){const f=await i.text().catch(()=>null);if(i.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new $(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:w,scope:y}=J(i);if(this._resourceMetadataUrl=w,this._scope=y,await H(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new P;return this._hasCompletedAuthFlow=!0,this.send(e)}if(i.status===403&&this._authProvider){const{resourceMetadataUrl:w,scope:y,error:T}=J(i);if(T==="insufficient_scope"){const k=i.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===k)throw new $(403,"Server returned 403 after trying upscoping");if(y&&(this._scope=y),w&&(this._resourceMetadataUrl=w),this._lastUpscopingHeader=k??void 0,await H(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new P;return this.send(e)}}throw new $(i.status,`Error POSTing to endpoint: ${f}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,i.status===202){await i.body?.cancel(),Qe(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>this.onerror?.(f));return}const l=(Array.isArray(e)?e:[e]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,h=i.headers.get("content-type");if(l)if(h?.includes("text/event-stream"))this._handleSseStream(i.body,{onresumptiontoken:r},!1);else if(h?.includes("application/json")){const f=await i.json(),w=Array.isArray(f)?f.map(y=>N.parse(y)):[N.parse(f)];for(const y of w)this.onmessage?.(y)}else throw await i.body?.cancel(),new $(-1,`Unexpected content type: ${h}`);else await i.body?.cancel()}catch(s){throw this.onerror?.(s),s}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{const e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},s=await(this._fetch??fetch)(this._url,t);if(await s.body?.cancel(),!s.ok&&s.status!==405)throw new $(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}};class pt extends ft{constructor(e,t){super(e,t)}send(e,t){const s=mt(e);return s?.type==="emit"?(this.onmessage?.(s.message),Promise.resolve()):s?.type==="suppress"?Promise.resolve():super.send(e,t)}}function mt(a){const e=a;if(!e||typeof e!="object"||!("method"in e))return null;switch(e.method){case"initialize":{const t=e?.params?.protocolVersion;return t?{type:"emit",message:{result:{protocolVersion:t,capabilities:{tools:{},resources:{},prompts:{},tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}},serverInfo:{name:"studio-virtual-mcp",version:"1.0.0"}},jsonrpc:e.jsonrpc??"2.0",id:e.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}const _t={name:"studio-sdk",version:"1.0.0"};function wt(a,e,t){const s=t??(typeof window<"u"?window.location.origin:void 0);if(!s)throw new Error("MCP client requires either studioUrl or a browser environment.");const r=`/api/${encodeURIComponent(e)}`,o=a?`${r}/mcp/${a}`:`${r}/mcp`;return new URL(o,s).href}async function gt({connectionId:a,orgId:e,orgSlug:t,token:s,studioUrl:r,meshUrl:o}){const n=V({studioUrl:r,meshUrl:o}),i=te.mcpClient(e,a??"self",s??"",n??"");if(!a||a===ze)return it({orgSlug:t,token:s,studioUrl:n,toJSONString:`mcp-client:${i.join(":")}`});const u=wt(a,t,n),p=new nt(_t,{capabilities:{tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}}}),l=new pt(new URL(u),{requestInit:{headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream",...s?{Authorization:`Bearer ${s}`}:{}}}});return await p.connect(l),p.toJSON=()=>`mcp-client:${i.join(":")}`,p}function oe(a){const{connectionId:e,token:t,studioUrl:s,meshUrl:r,orgId:o}=a,n=V({studioUrl:s,meshUrl:r});return{queryKey:te.mcpClient(o,e??"self",t??"",n??""),queryFn:()=>gt(a),staleTime:1/0,gcTime:6e4}}function St(a){const e=se.c(2);let t;e[0]!==a?(t=oe(a),e[0]=a,e[1]=t):t=e[1];const{data:s}=Je(t);return s}function Ct(a,e){const t=se.c(7);let s;t[0]!==e?(s=e===void 0?{}:e,t[0]=e,t[1]=s):s=t[1];const{enabled:r}=s,o=r===void 0?!0:r;let n;t[2]!==a?(n=oe(a),t[2]=a,t[3]=n):n=t[3];let i;t[4]!==o||t[5]!==n?(i={...n,enabled:o},t[4]=o,t[5]=n,t[6]=i):i=t[6];const{data:u}=We(i);return u??null}export{Xe as A,nt as C,Be as P,ft as S,Ct as a,ut as b,gt as c,ct as d,oe as m,L as n,St as u};
10
+ ${c}`,p++;break;case"id":i=c.includes("\0")?void 0:c;break;case"retry":/^\d+$/.test(c)?s(parseInt(c,10)):t(new B(`Invalid \`retry\` value: "${c}"`,{type:"invalid-retry",value:c,line:_}));break;default:t(new B(`Unknown field "${d.length>20?`${d.slice(0,20)}…`:d}"`,{type:"unknown-field",field:d,value:c,line:_}));break}}function T(){p>0&&e({id:i,event:l,data:u}),i=void 0,u="",p=0,l=void 0}function k(d={}){if(d.consume&&o.length>0){const c=o.join("");w(c,0,c.length)}n=!0,i=void 0,u="",p=0,l=void 0,o.length=0}return{feed:h,reset:k}}function Y(a,e,t){return t===100&&a.charCodeAt(e+1)===97&&a.charCodeAt(e+2)===116&&a.charCodeAt(e+3)===97&&a.charCodeAt(e+4)===58}function X(a,e,t){return t===101&&a.charCodeAt(e+1)===118&&a.charCodeAt(e+2)===101&&a.charCodeAt(e+3)===110&&a.charCodeAt(e+4)===116&&a.charCodeAt(e+5)===58}class dt extends TransformStream{constructor({onError:e,onRetry:t,onComment:s}={}){let r;super({start(o){r=ut({onEvent:n=>{o.enqueue(n)},onError(n){e==="terminate"?o.error(n):typeof e=="function"&&e(n)},onRetry:t,onComment:s})},transform(o){r.feed(o)}})}}const ht={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class $ extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}}let ft=class{constructor(e,t){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=ct(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??ht}async _authThenStart(){if(!this._authProvider)throw new P("No auth provider");let e;try{e=await H(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(t){throw this.onerror?.(t),t}if(e!=="AUTHORIZED")throw new P;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){const e={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(e.Authorization=`Bearer ${s.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);const t=D(this._requestInit?.headers);return new Headers({...e,...t})}async _startOrAuthSse(e){const{resumptionToken:t}=e;try{const s=await this._commonHeaders();s.set("Accept","text/event-stream"),t&&s.set("last-event-id",t);const r=await(this._fetch??fetch)(this._url,{method:"GET",headers:s,signal:this._abortController?.signal});if(!r.ok){if(await r.body?.cancel(),r.status===401&&this._authProvider)return await this._authThenStart();if(r.status===405)return;throw new $(r.status,`Failed to open SSE stream: ${r.statusText}`)}this._handleSseStream(r.body,e,!0)}catch(s){throw this.onerror?.(s),s}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;const t=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(s,e),r)}_scheduleReconnection(e,t=0){const s=this._reconnectionOptions.maxRetries;if(t>=s){this.onerror?.(new Error(`Maximum reconnection attempts (${s}) exceeded.`));return}const r=this._getNextReconnectionDelay(t);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,t+1)})},r)}_handleSseStream(e,t,s){if(!e)return;const{onresumptiontoken:r,replayMessageId:o}=t;let n,i=!1,u=!1;(async()=>{try{const l=e.pipeThrough(new TextDecoderStream).pipeThrough(new dt({onRetry:w=>{this._serverRetryMs=w}})).getReader();for(;;){const{value:w,done:y}=await l.read();if(y)break;if(w.id&&(n=w.id,i=!0,r?.(w.id)),!!w.data&&(!w.event||w.event==="message"))try{const T=N.parse(JSON.parse(w.data));M(T)&&(u=!0,o!==void 0&&(T.id=o)),this.onmessage?.(T)}catch(T){this.onerror?.(T)}}(s||i)&&!u&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:n,onresumptiontoken:r,replayMessageId:o},0)}catch(l){if(this.onerror?.(new Error(`SSE stream disconnected: ${l}`)),(s||i)&&!u&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:n,onresumptiontoken:r,replayMessageId:o},0)}catch(w){this.onerror?.(new Error(`Failed to reconnect: ${w instanceof Error?w.message:String(w)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new P("No auth provider");if(await H(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new P("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,t){try{const{resumptionToken:s,onresumptiontoken:r}=t||{};if(s){this._startOrAuthSse({resumptionToken:s,replayMessageId:F(e)?e.id:void 0}).catch(f=>this.onerror?.(f));return}const o=await this._commonHeaders();o.set("content-type","application/json"),o.set("accept","application/json, text/event-stream");const n={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:this._abortController?.signal},i=await(this._fetch??fetch)(this._url,n),u=i.headers.get("mcp-session-id");if(u&&(this._sessionId=u),!i.ok){const f=await i.text().catch(()=>null);if(i.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new $(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:w,scope:y}=J(i);if(this._resourceMetadataUrl=w,this._scope=y,await H(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new P;return this._hasCompletedAuthFlow=!0,this.send(e)}if(i.status===403&&this._authProvider){const{resourceMetadataUrl:w,scope:y,error:T}=J(i);if(T==="insufficient_scope"){const k=i.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===k)throw new $(403,"Server returned 403 after trying upscoping");if(y&&(this._scope=y),w&&(this._resourceMetadataUrl=w),this._lastUpscopingHeader=k??void 0,await H(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new P;return this.send(e)}}throw new $(i.status,`Error POSTing to endpoint: ${f}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,i.status===202){await i.body?.cancel(),Qe(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>this.onerror?.(f));return}const l=(Array.isArray(e)?e:[e]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,h=i.headers.get("content-type");if(l)if(h?.includes("text/event-stream"))this._handleSseStream(i.body,{onresumptiontoken:r},!1);else if(h?.includes("application/json")){const f=await i.json(),w=Array.isArray(f)?f.map(y=>N.parse(y)):[N.parse(f)];for(const y of w)this.onmessage?.(y)}else throw await i.body?.cancel(),new $(-1,`Unexpected content type: ${h}`);else await i.body?.cancel()}catch(s){throw this.onerror?.(s),s}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{const e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},s=await(this._fetch??fetch)(this._url,t);if(await s.body?.cancel(),!s.ok&&s.status!==405)throw new $(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}};class pt extends ft{constructor(e,t){super(e,t)}send(e,t){const s=mt(e);return s?.type==="emit"?(this.onmessage?.(s.message),Promise.resolve()):s?.type==="suppress"?Promise.resolve():super.send(e,t)}}function mt(a){const e=a;if(!e||typeof e!="object"||!("method"in e))return null;switch(e.method){case"initialize":{const t=e?.params?.protocolVersion;return t?{type:"emit",message:{result:{protocolVersion:t,capabilities:{tools:{},resources:{},prompts:{},tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}},serverInfo:{name:"studio-virtual-mcp",version:"1.0.0"}},jsonrpc:e.jsonrpc??"2.0",id:e.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}const _t={name:"studio-sdk",version:"1.0.0"};function wt(a,e,t){const s=t??(typeof window<"u"?window.location.origin:void 0);if(!s)throw new Error("MCP client requires either studioUrl or a browser environment.");const r=`/api/${encodeURIComponent(e)}`,o=a?`${r}/mcp/${a}`:`${r}/mcp`;return new URL(o,s).href}async function gt({connectionId:a,orgId:e,orgSlug:t,token:s,studioUrl:r,meshUrl:o}){const n=V({studioUrl:r,meshUrl:o}),i=te.mcpClient(e,a??"self",s??"",n??"");if(!a||a===ze)return it({orgSlug:t,token:s,studioUrl:n,toJSONString:`mcp-client:${i.join(":")}`});const u=wt(a,t,n),p=new nt(_t,{capabilities:{tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}}}),l=new pt(new URL(u),{requestInit:{headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream",...s?{Authorization:`Bearer ${s}`}:{}}}});return await p.connect(l),p.toJSON=()=>`mcp-client:${i.join(":")}`,p}function oe(a){const{connectionId:e,token:t,studioUrl:s,meshUrl:r,orgId:o}=a,n=V({studioUrl:s,meshUrl:r});return{queryKey:te.mcpClient(o,e??"self",t??"",n??""),queryFn:()=>gt(a),staleTime:1/0,gcTime:6e4}}function St(a){const e=se.c(2);let t;e[0]!==a?(t=oe(a),e[0]=a,e[1]=t):t=e[1];const{data:s}=Je(t);return s}function Ct(a,e){const t=se.c(7);let s;t[0]!==e?(s=e===void 0?{}:e,t[0]=e,t[1]=s):s=t[1];const{enabled:r}=s,o=r===void 0?!0:r;let n;t[2]!==a?(n=oe(a),t[2]=a,t[3]=n):n=t[3];let i;t[4]!==o||t[5]!==n?(i={...n,enabled:o},t[4]=o,t[5]=n,t[6]=i):i=t[6];const{data:u}=We(i);return u??null}export{Xe as A,nt as C,Be as P,ft as S,Ct as a,ut as b,gt as c,ct as d,oe as m,D as n,St as u};
@@ -1 +1 @@
1
- import{c as l,i as u,cR as m,cS as f,V as y,K as n}from"./index-BP527m3V.js";async function c(r){if(!r.getServerCapabilities()?.prompts)return{prompts:[]};try{return await r.listPrompts()}catch(t){if(t instanceof m&&t.code===f.MethodNotFound)return{prompts:[]};throw t}}async function b(r,e,t){if(!r.getServerCapabilities()?.prompts)throw new Error("Prompts capability not supported");return await r.getPrompt({name:e,arguments:t??{}})}function g(r){const e=l.c(12);let t,s;e[0]!==r?({client:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let i;e[3]!==t?(i=n.mcpPromptsList(t),e[3]=t,e[4]=i):i=e[4];let o;e[5]!==t?(o=()=>c(t),e[5]=t,e[6]=o):o=e[6];const p=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==i||e[9]!==o||e[10]!==p?(a={...s,queryKey:i,queryFn:o,staleTime:p,retry:!1},e[7]=s,e[8]=i,e[9]=o,e[10]=p,e[11]=a):a=e[11],y(a)}function q(r){const e=l.c(12);let t,s;e[0]!==r?({client:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let i;e[3]!==t?(i=n.mcpPromptsList(t),e[3]=t,e[4]=i):i=e[4];let o;e[5]!==t?(o=()=>c(t),e[5]=t,e[6]=o):o=e[6];const p=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==i||e[9]!==o||e[10]!==p?(a={...s,queryKey:i,queryFn:o,staleTime:p,retry:!1},e[7]=s,e[8]=i,e[9]=o,e[10]=p,e[11]=a):a=e[11],u(a)}export{q as a,b as g,c as l,g as u};
1
+ import{c as l,i as u,cP as m,cQ as f,V as y,K as n}from"./index-CwntHk8S.js";async function c(r){if(!r.getServerCapabilities()?.prompts)return{prompts:[]};try{return await r.listPrompts()}catch(t){if(t instanceof m&&t.code===f.MethodNotFound)return{prompts:[]};throw t}}async function b(r,e,t){if(!r.getServerCapabilities()?.prompts)throw new Error("Prompts capability not supported");return await r.getPrompt({name:e,arguments:t??{}})}function g(r){const e=l.c(12);let t,s;e[0]!==r?({client:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let i;e[3]!==t?(i=n.mcpPromptsList(t),e[3]=t,e[4]=i):i=e[4];let o;e[5]!==t?(o=()=>c(t),e[5]=t,e[6]=o):o=e[6];const p=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==i||e[9]!==o||e[10]!==p?(a={...s,queryKey:i,queryFn:o,staleTime:p,retry:!1},e[7]=s,e[8]=i,e[9]=o,e[10]=p,e[11]=a):a=e[11],y(a)}function q(r){const e=l.c(12);let t,s;e[0]!==r?({client:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let i;e[3]!==t?(i=n.mcpPromptsList(t),e[3]=t,e[4]=i):i=e[4];let o;e[5]!==t?(o=()=>c(t),e[5]=t,e[6]=o):o=e[6];const p=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==i||e[9]!==o||e[10]!==p?(a={...s,queryKey:i,queryFn:o,staleTime:p,retry:!1},e[7]=s,e[8]=i,e[9]=o,e[10]=p,e[11]=a):a=e[11],u(a)}export{q as a,b as g,c as l,g as u};
@@ -1 +1 @@
1
- import{c as f,V as p,i as q,K as m}from"./index-BP527m3V.js";function C(n){const e=f.c(12);let t,s;e[0]!==n?({client:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let l;e[3]!==t?(l=m.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let i;e[5]!==t?(i=async()=>await t.listTools(),e[5]=t,e[6]=i):i=e[6];const r=s.staleTime??3e4;let o;return e[7]!==s||e[8]!==l||e[9]!==i||e[10]!==r?(o={...s,queryKey:l,queryFn:i,staleTime:r,retry:!1},e[7]=s,e[8]=l,e[9]=i,e[10]=r,e[11]=o):o=e[11],p(o)}function g(n){const e=f.c(12);let t,s;e[0]!==n?({client:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let l;e[3]!==t?(l=m.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let i;e[5]!==t?(i=async()=>await t.listTools(),e[5]=t,e[6]=i):i=e[6];const r=s.staleTime??3e4;let o;return e[7]!==s||e[8]!==l||e[9]!==i||e[10]!==r?(o={...s,queryKey:l,queryFn:i,staleTime:r,retry:!1},e[7]=s,e[8]=l,e[9]=i,e[10]=r,e[11]=o):o=e[11],q(o)}function L(n){const e=f.c(21);let t,s,l,i;e[0]!==n?({client:t,toolName:i,toolArguments:l,...s}=n,e[0]=n,e[1]=t,e[2]=s,e[3]=l,e[4]=i):(t=e[1],s=e[2],l=e[3],i=e[4]);let r,o,u;if(e[5]!==t||e[6]!==s||e[7]!==l||e[8]!==i){const T=JSON.stringify(l??{});u=p,r=s,o=m.mcpToolCall(t,i,T),e[5]=t,e[6]=s,e[7]=l,e[8]=i,e[9]=r,e[10]=o,e[11]=u}else r=e[9],o=e[10],u=e[11];let a;e[12]!==t||e[13]!==l||e[14]!==i?(a=async()=>await t.callTool({name:i,arguments:l}),e[12]=t,e[13]=l,e[14]=i,e[15]=a):a=e[15];const y=s.staleTime??3e4;let c;return e[16]!==r||e[17]!==o||e[18]!==a||e[19]!==y?(c={...r,queryKey:o,queryFn:a,staleTime:y,retry:!1},e[16]=r,e[17]=o,e[18]=a,e[19]=y,e[20]=c):c=e[20],u(c)}export{C as a,L as b,g as u};
1
+ import{c as f,V as p,i as q,K as m}from"./index-CwntHk8S.js";function C(n){const e=f.c(12);let t,s;e[0]!==n?({client:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let l;e[3]!==t?(l=m.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let i;e[5]!==t?(i=async()=>await t.listTools(),e[5]=t,e[6]=i):i=e[6];const r=s.staleTime??3e4;let o;return e[7]!==s||e[8]!==l||e[9]!==i||e[10]!==r?(o={...s,queryKey:l,queryFn:i,staleTime:r,retry:!1},e[7]=s,e[8]=l,e[9]=i,e[10]=r,e[11]=o):o=e[11],p(o)}function g(n){const e=f.c(12);let t,s;e[0]!==n?({client:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let l;e[3]!==t?(l=m.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let i;e[5]!==t?(i=async()=>await t.listTools(),e[5]=t,e[6]=i):i=e[6];const r=s.staleTime??3e4;let o;return e[7]!==s||e[8]!==l||e[9]!==i||e[10]!==r?(o={...s,queryKey:l,queryFn:i,staleTime:r,retry:!1},e[7]=s,e[8]=l,e[9]=i,e[10]=r,e[11]=o):o=e[11],q(o)}function L(n){const e=f.c(21);let t,s,l,i;e[0]!==n?({client:t,toolName:i,toolArguments:l,...s}=n,e[0]=n,e[1]=t,e[2]=s,e[3]=l,e[4]=i):(t=e[1],s=e[2],l=e[3],i=e[4]);let r,o,u;if(e[5]!==t||e[6]!==s||e[7]!==l||e[8]!==i){const T=JSON.stringify(l??{});u=p,r=s,o=m.mcpToolCall(t,i,T),e[5]=t,e[6]=s,e[7]=l,e[8]=i,e[9]=r,e[10]=o,e[11]=u}else r=e[9],o=e[10],u=e[11];let a;e[12]!==t||e[13]!==l||e[14]!==i?(a=async()=>await t.callTool({name:i,arguments:l}),e[12]=t,e[13]=l,e[14]=i,e[15]=a):a=e[15];const y=s.staleTime??3e4;let c;return e[16]!==r||e[17]!==o||e[18]!==a||e[19]!==y?(c={...r,queryKey:o,queryFn:a,staleTime:y,retry:!1},e[16]=r,e[17]=o,e[18]=a,e[19]=y,e[20]=c):c=e[20],u(c)}export{C as a,L as b,g as u};
@@ -1 +1 @@
1
- import{r as s}from"./index-BP527m3V.js";const n=768,r=`(max-width: ${n-1}px)`;function o(e){const t=globalThis.matchMedia(r);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}const a=()=>globalThis.innerWidth<n,c=()=>!1;function h(){return s.useSyncExternalStore(o,a,c)}export{h as u};
1
+ import{r as s}from"./index-CwntHk8S.js";const n=768,r=`(max-width: ${n-1}px)`;function o(e){const t=globalThis.matchMedia(r);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}const a=()=>globalThis.innerWidth<n,c=()=>!1;function h(){return s.useSyncExternalStore(o,a,c)}export{h as u};
@@ -1 +1 @@
1
- import{q as T,b as q,e as B,K as C,fK as j}from"./index-BP527m3V.js";import{u as H}from"./use-voice-input-Li611DFd.js";import{x as J,c as S,u as U,v as F,an as N,aE as R,Z as W,X as z,Y as A,ax as L,ay as Y,az as g,aB as G,aM as X,aJ as Z,aI as _,y as b,$ as D}from"./site-editor-toast-BXRGIPuY.js";import{s as $}from"./sandbox-git-api-3zULVhcU.js";import{u as V}from"./chat-context-Na_9rQo_.js";import{i as M,H as I}from"./hosted-reconcile-C5UVxzTP.js";import{b as E}from"./sandbox-url-D3mC8qhT.js";import{d as O}from"./utils-DONok1LX.js";function ue({orgSlug:i,virtualMcpId:t,branch:o}){const s=T(),y=V()?.taskId??null,P=J(t),Q=H(t).runtime==="cms",{url:v}=S(t),d=U(t,o),f=d.kind==="protocol"?d:null,l=F({orgSlug:i,virtualMcpId:t,branch:o}),h=C.decofile(l),K=q(),x=async(r,c)=>{if(v)return{ok:!0};if(Q){const a=await Z({orgSlug:i,virtualMcpId:t,branch:o},{set:r,delete:c});return _(s,{orgSlug:i,virtualMcpId:t,branch:o},a),await s.invalidateQueries({queryKey:$({orgSlug:i,virtualMcpId:t,branch:o,threadId:y})}),a}const u={orgSlug:i,virtualMcpId:t,branch:o,threadId:y};for(const[a,n]of Object.entries(r)){const e=await fetch(E(u,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:b(P,O(a)),content:JSON.stringify(n,null,2)})});if(!e.ok)return D(e,"Write")}for(const a of c){const n=await fetch(E(u,"unlink"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:b(P,O(a))})});if(!n.ok)return D(n,"Delete")}return{ok:!0}},p=B({mutationKey:A(i,t,o),scope:z(i,t,o),mutationFn:async({writes:r,deletes:c,copies:u,shown:a})=>{if(d.kind==="pending"||d.kind==="unavailable")throw N("CMS storage");const n=f?.source==="github"?r:j(r);return f?.source==="github"?M({queryClient:s,backend:f,params:{orgSlug:i,virtualMcpId:t,branch:o},cacheKey:l},{writes:n,deletes:c.filter(e=>!(e in n))},u,a?.()):f?R(s,f,{orgSlug:i,virtualMcpId:t,branch:o},l,{set:n,delete:c.filter(e=>!(e in n))}):W({queryClient:s,orgSlug:i,virtualMcpId:t,branch:o,backend:d,cacheKey:l},{kind:"edit",write:()=>x(n,c)})},onSuccess:()=>{f?.source!=="github"&&s.invalidateQueries({queryKey:C.liveMeta(i,t,o)})}});return{move:async(r,c)=>{const u=[...Object.keys(r.writes),...r.deletes],a=s.getQueryData(h),n=new Map;for(const e of u)a&&e in a&&n.set(e,a[e]);s.setQueryData(h,e=>ee(e,r)),s.cancelQueries({queryKey:h});try{return await p.mutateAsync({...r,copies:a,shown:c?.shown})}catch(e){throw e instanceof I?(L(K,e.deleted,e.deleted&&r.deletes.length>0&&r.deletes.every(m=>Y(s,l,m))),e):(g(K,e),f?.source==="github"&&(G(e)||e instanceof X)||s.setQueryData(h,m=>{if(!m)return m;const w={...m};for(const k of u)n.has(k)?w[k]=n.get(k):delete w[k];return w}),e)}},isPending:p.isPending,isError:p.isError}}function ee(i,{writes:t,deletes:o}){const s={...i??{},...t};for(const y of o)y in t||delete s[y];return s}export{ee as a,ue as u};
1
+ import{q as T,b as q,e as j,K as C,fK as B}from"./index-CwntHk8S.js";import{u as F}from"./use-voice-input-CwLNuWlo.js";import{x as H,c as S,u as U,v as J,aj as N,ax as R,Z as W,X as A,Y as L,aq as Y,ar as g,as as z,au as G,aF as X,aC as Z,aB as _,y as b,$ as D}from"./site-editor-toast-GAJZE2A0.js";import{s as $}from"./sandbox-git-api-CX3IYPAX.js";import{u as V}from"./chat-context-CiT7AzBS.js";import{i as M,H as I}from"./hosted-reconcile-BbIfIwl1.js";import{b as O}from"./sandbox-url-D3mC8qhT.js";import{d as Q}from"./utils-DPEBLDgi.js";function ue({orgSlug:i,virtualMcpId:t,branch:o}){const s=T(),y=V()?.taskId??null,P=H(t),v=F(t).runtime==="cms",{url:x}=S(t),d=U(t,o),f=d.kind==="protocol"?d:null,l=J({orgSlug:i,virtualMcpId:t,branch:o}),h=C.decofile(l),K=q(),E=async(r,c)=>{if(x)return{ok:!0};if(v){const a=await Z({orgSlug:i,virtualMcpId:t,branch:o},{set:r,delete:c});return _(s,{orgSlug:i,virtualMcpId:t,branch:o},a),await s.invalidateQueries({queryKey:$({orgSlug:i,virtualMcpId:t,branch:o,threadId:y})}),a}const u={orgSlug:i,virtualMcpId:t,branch:o,threadId:y};for(const[a,n]of Object.entries(r)){const e=await fetch(O(u,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:b(P,Q(a)),content:JSON.stringify(n,null,2)})});if(!e.ok)return D(e,"Write")}for(const a of c){const n=await fetch(O(u,"unlink"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:b(P,Q(a))})});if(!n.ok)return D(n,"Delete")}return{ok:!0}},p=j({mutationKey:L(i,t,o),scope:A(i,t,o),mutationFn:async({writes:r,deletes:c,copies:u,shown:a})=>{if(d.kind==="pending"||d.kind==="unavailable")throw N("CMS storage");const n=f?.source==="github"?r:B(r);return f?.source==="github"?M({queryClient:s,backend:f,params:{orgSlug:i,virtualMcpId:t,branch:o},cacheKey:l},{writes:n,deletes:c.filter(e=>!(e in n))},u,a?.()):f?R(s,f,{orgSlug:i,virtualMcpId:t,branch:o},l,{set:n,delete:c.filter(e=>!(e in n))}):W({queryClient:s,orgSlug:i,virtualMcpId:t,branch:o,backend:d,cacheKey:l},{kind:"edit",write:()=>E(n,c)})},onSuccess:()=>{f?.source!=="github"&&s.invalidateQueries({queryKey:C.liveMeta(i,t,o)})}});return{move:async(r,c)=>{const u=[...Object.keys(r.writes),...r.deletes],a=s.getQueryData(h),n=new Map;for(const e of u)a&&e in a&&n.set(e,a[e]);s.setQueryData(h,e=>ee(e,r)),s.cancelQueries({queryKey:h});try{return await p.mutateAsync({...r,copies:a,shown:c?.shown})}catch(e){throw e instanceof I?(Y(K,e.deleted,e.deleted&&r.deletes.length>0&&r.deletes.every(m=>g(s,l,m))),e):(z(K,e),f?.source==="github"&&(G(e)||e instanceof X)||s.setQueryData(h,m=>{if(!m)return m;const w={...m};for(const k of u)n.has(k)?w[k]=n.get(k):delete w[k];return w}),e)}},isPending:p.isPending,isError:p.isError}}function ee(i,{writes:t,deletes:o}){const s={...i??{},...t};for(const y of o)y in t||delete s[y];return s}export{ee as a,ue as u};
@@ -1 +1 @@
1
- import{c as m,ar as F,at as $,i as E,al as _,K as y,dN as K,a4 as N,d as M,a as G,cI as H,cJ as v}from"./index-BP527m3V.js";import{h as R,r as A,g as D,e as Q,d as x}from"./repository-binding-DGc5VhVW.js";import{t as B,i as W,u as Y,w as J}from"./thread-intent-DrRX6nG0.js";const p=[],z=4;function V(t,e){return[e,...t.filter(n=>n!==e)].slice(0,z)}function X(t){const e=m.c(9);let n;e[0]!==t?(n=$.recentProjects(t),e[0]=t,e[1]=n):n=e[1];const[a,o]=F(n,p),r=Array.isArray(a)?a:p;let s,c;e[2]!==o?(s=l=>o(u=>V(Array.isArray(u)?u:p,l)),c=l=>o(u=>(Array.isArray(u)?u:p).filter(h=>h!==l)),e[2]=o,e[3]=s,e[4]=c):(s=e[3],c=e[4]);let i;return e[5]!==r||e[6]!==s||e[7]!==c?(i={recent:r,remember:s,forget:c},e[5]=r,e[6]=s,e[7]=c,e[8]=i):i=e[8],i}function C(t,e,n,a,o){let r=null;for(const s of t)s.virtual_mcp_id===e&&s.created_by===n&&(s.hidden||B(s,a)&&(o&&s.branch===o||(!r||s.updated_at>r.updated_at)&&(r=s)));return r}function be(t,e,n,a,o){const r=o?.blogDrafts??!1;return t.find(s=>!s.hidden&&s.virtual_mcp_id===e&&s.created_by===n&&s.title==="New chat"&&!s.harness_id&&W(s.branch)===r&&B(s,a))}function Z(t,e,n,a,o,r){if(!o)return C(t,e,n,a)??void 0;const s=a==="cms"?new Set((r?.releases??[]).filter(i=>i.runtime==="sandbox").map(i=>i.branch)):null,c=s?.size?t.filter(i=>!i.branch||!s.has(i.branch)):t;return C(c,e,n,a,r?.baseBranch)??void 0}const S=6e4,ee=5*6e4,I=3e4;function T(t,e){const n=K(t.error);return n===null?0:Math.max(0,t.errorUpdatedAt+n-e)}const P={refetchOnWindowFocus:t=>T(t.state,Date.now())===0,refetchOnMount:t=>T(t.state,Date.now())===0};function L(t){return{number:t.number,title:t.title,body:t.body,state:t.state==="open"?"open":"closed",merged:t.state==="merged",mergedAt:t.mergedAt,base:t.base,head:t.head,headSha:t.headSha,headRepoFullName:t.headRepoPath,htmlUrl:t.url,author:t.author,changedFiles:t.changedFiles}}function te(t){return{id:t.id,name:t.name,status:t.state==="running"?"in_progress":t.state,conclusion:t.conclusion,htmlUrl:t.url??"",durationMs:t.durationMs}}function ne(t,e){const n=T(t,e);return n>0?Math.max(n,S):t.data===void 0||t.data.changeRequest?.state==="open"?S:ee}function k(t){const{orgSlug:e,target:n,owner:a,repo:o,branch:r}=t;return{queryKey:y.githubPrState(e,A(n),a,o,r),queryFn:()=>_(e,"CHANGE_REQUEST_STATE",{...n,branch:r}),enabled:!!r&&R(n)&&!!a&&!!o,...P,refetchInterval:s=>ne(s.state,Date.now()),refetchIntervalInBackground:!1,staleTime:I}}function ae(t){const e=m.c(4);let n;e[0]!==t?(n=k(t),e[0]=t,e[1]=n):n=e[1];let a;return e[2]!==n?(a={...n,select:se},e[2]=n,e[3]=a):a=e[3],E(a)}function se(t){return t.changeRequest?L(t.changeRequest):null}function pe(t){const e=m.c(4);let n;e[0]!==t?(n=k(t),e[0]=t,e[1]=n):n=e[1];let a;return e[2]!==n?(a={...n,select:re},e[2]=n,e[3]=a):a=e[3],E(a)}function re(t){return t.changeRequest?.state==="open"?t.changeRequest.checkRuns.map(te):[]}const oe=5*6e4;function Ee(t){const e=m.c(20),{orgSlug:n,target:a,owner:o,repo:r,base:s}=t;let c;e[0]!==s||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==a?(c=y.githubLastPublishedPr(n,A(a),o,r,s),e[0]=s,e[1]=n,e[2]=o,e[3]=r,e[4]=a,e[5]=c):c=e[5];let i;e[6]!==s||e[7]!==n||e[8]!==a?(i=()=>_(n,"CHANGE_REQUEST_LAST_MERGED",{...a,base:s}),e[6]=s,e[7]=n,e[8]=a,e[9]=i):i=e[9];let l;e[10]!==t.enabled||e[11]!==s||e[12]!==o||e[13]!==r||e[14]!==a?(l=(t.enabled??!0)&&!!s&&R(a)&&!!o&&!!r,e[10]=t.enabled,e[11]=s,e[12]=o,e[13]=r,e[14]=a,e[15]=l):l=e[15];let u;return e[16]!==c||e[17]!==i||e[18]!==l?(u={queryKey:c,queryFn:i,enabled:l,...P,staleTime:oe,select:ie},e[16]=c,e[17]=i,e[18]=l,e[19]=u):u=e[19],E(u)}function ie(t){return t.changeRequest?L(t.changeRequest):null}const ce=50;function Se(t){const e=m.c(17),{orgSlug:n,target:a,owner:o,repo:r}=t;let s;e[0]!==n||e[1]!==o||e[2]!==r||e[3]!==a?(s=y.githubOpenPrs(n,A(a),o,r),e[0]=n,e[1]=o,e[2]=r,e[3]=a,e[4]=s):s=e[4];let c;e[5]!==n||e[6]!==a?(c=()=>_(n,"CHANGE_REQUEST_LIST_OPEN",{...a,limit:ce}),e[5]=n,e[6]=a,e[7]=c):c=e[7];let i;e[8]!==t.enabled||e[9]!==o||e[10]!==r||e[11]!==a?(i=(t.enabled??!0)&&R(a)&&!!o&&!!r,e[8]=t.enabled,e[9]=o,e[10]=r,e[11]=a,e[12]=i):i=e[12];let l;return e[13]!==s||e[14]!==c||e[15]!==i?(l={queryKey:s,queryFn:c,enabled:i,...P,staleTime:I,select:le},e[13]=s,e[14]=c,e[15]=i,e[16]=l):l=e[16],E(l)}function le(t){return t.changeRequests.map(L)}function ue(t,e){const{org:n}=N(),a=D(t);return ae({orgId:n.id,orgSlug:n.slug,target:Q(a),owner:a?.owner??"",repo:a?.name??"",branch:e??null}).data?.base??"main"}const de=[];function Te(){const t=m.c(13),e=M(),{org:n,locator:a}=N(),o=x(),{data:r}=G.useSession(),s=Y(),c=ue(void 0,null),{remember:i}=X(n.slug);let l;t[0]!==c||t[1]!==o||t[2]!==a||t[3]!==s?.threads||t[4]!==e||t[5]!==n.slug||t[6]!==r?.user?.id?(l=(d,g,f)=>{if(H(g).kind==="org-destination"){v(e,{tabId:g,org:n.slug,agentId:d,replace:!1});return}const w=(o??[]).find(j=>j.id===d),U=!!(w&&D(w)),O=!f,q=O?void 0:Z(s?.threads.get()??de,d,r?.user?.id,f,U,{baseBranch:c}),b=O?void 0:q?.id??crypto.randomUUID();b&&!q&&f&&J(sessionStorage,a,b,{runtime:f}),v(e,{tabId:g,org:n.slug,agentId:d,search:()=>b?{thread:b}:{},replace:!1})},t[0]=c,t[1]=o,t[2]=a,t[3]=s?.threads,t[4]=e,t[5]=n.slug,t[6]=r?.user?.id,t[7]=l):l=t[7];const u=l;let h;return t[8]!==u||t[9]!==e||t[10]!==n.slug||t[11]!==i?(h=(d,g)=>{const f=g?.panel;if(!f){i(d),e(fe(n.slug,d));return}u(d,f,g?.runtime)},t[8]=u,t[9]=e,t[10]=n.slug,t[11]=i,t[12]=h):h=t[12],h}function fe(t,e){return{to:"/$org/projects/$agentId",params:{org:t,agentId:e},search:n=>({...n,project:void 0,virtualmcpid:void 0,thread:void 0,mainpanel:void 0})}}export{X as a,ue as b,Z as c,Se as d,ae as e,be as f,Ee as g,pe as h,k as p,Te as u};
1
+ import{c as m,ar as F,at as $,i as E,al as _,K as y,dN as K,a4 as N,d as M,a as G,cI as H,dI as v}from"./index-CwntHk8S.js";import{h as R,r as A,g as D,e as Q,d as x}from"./repository-binding-Cqb4hBI0.js";import{t as B,i as W,c as Y,w as z}from"./thread-intent-DpzwhK2y.js";const p=[],J=4;function V(t,e){return[e,...t.filter(n=>n!==e)].slice(0,J)}function X(t){const e=m.c(9);let n;e[0]!==t?(n=$.recentProjects(t),e[0]=t,e[1]=n):n=e[1];const[a,o]=F(n,p),r=Array.isArray(a)?a:p;let s,c;e[2]!==o?(s=l=>o(u=>V(Array.isArray(u)?u:p,l)),c=l=>o(u=>(Array.isArray(u)?u:p).filter(h=>h!==l)),e[2]=o,e[3]=s,e[4]=c):(s=e[3],c=e[4]);let i;return e[5]!==r||e[6]!==s||e[7]!==c?(i={recent:r,remember:s,forget:c},e[5]=r,e[6]=s,e[7]=c,e[8]=i):i=e[8],i}function C(t,e,n,a,o){let r=null;for(const s of t)s.virtual_mcp_id===e&&s.created_by===n&&(s.hidden||B(s,a)&&(o&&s.branch===o||(!r||s.updated_at>r.updated_at)&&(r=s)));return r}function be(t,e,n,a,o){const r=o?.blogDrafts??!1;return t.find(s=>!s.hidden&&s.virtual_mcp_id===e&&s.created_by===n&&s.title==="New chat"&&!s.harness_id&&W(s.branch)===r&&B(s,a))}function Z(t,e,n,a,o,r){if(!o)return C(t,e,n,a)??void 0;const s=a==="cms"?new Set((r?.releases??[]).filter(i=>i.runtime==="sandbox").map(i=>i.branch)):null,c=s?.size?t.filter(i=>!i.branch||!s.has(i.branch)):t;return C(c,e,n,a,r?.baseBranch)??void 0}const S=6e4,ee=5*6e4,I=3e4;function T(t,e){const n=K(t.error);return n===null?0:Math.max(0,t.errorUpdatedAt+n-e)}const P={refetchOnWindowFocus:t=>T(t.state,Date.now())===0,refetchOnMount:t=>T(t.state,Date.now())===0};function L(t){return{number:t.number,title:t.title,body:t.body,state:t.state==="open"?"open":"closed",merged:t.state==="merged",mergedAt:t.mergedAt,base:t.base,head:t.head,headSha:t.headSha,headRepoFullName:t.headRepoPath,htmlUrl:t.url,author:t.author,changedFiles:t.changedFiles}}function te(t){return{id:t.id,name:t.name,status:t.state==="running"?"in_progress":t.state,conclusion:t.conclusion,htmlUrl:t.url??"",durationMs:t.durationMs}}function ne(t,e){const n=T(t,e);return n>0?Math.max(n,S):t.data===void 0||t.data.changeRequest?.state==="open"?S:ee}function k(t){const{orgSlug:e,target:n,owner:a,repo:o,branch:r}=t;return{queryKey:y.githubPrState(e,A(n),a,o,r),queryFn:()=>_(e,"CHANGE_REQUEST_STATE",{...n,branch:r}),enabled:!!r&&R(n)&&!!a&&!!o,...P,refetchInterval:s=>ne(s.state,Date.now()),refetchIntervalInBackground:!1,staleTime:I}}function ae(t){const e=m.c(4);let n;e[0]!==t?(n=k(t),e[0]=t,e[1]=n):n=e[1];let a;return e[2]!==n?(a={...n,select:se},e[2]=n,e[3]=a):a=e[3],E(a)}function se(t){return t.changeRequest?L(t.changeRequest):null}function pe(t){const e=m.c(4);let n;e[0]!==t?(n=k(t),e[0]=t,e[1]=n):n=e[1];let a;return e[2]!==n?(a={...n,select:re},e[2]=n,e[3]=a):a=e[3],E(a)}function re(t){return t.changeRequest?.state==="open"?t.changeRequest.checkRuns.map(te):[]}const oe=5*6e4;function Ee(t){const e=m.c(20),{orgSlug:n,target:a,owner:o,repo:r,base:s}=t;let c;e[0]!==s||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==a?(c=y.githubLastPublishedPr(n,A(a),o,r,s),e[0]=s,e[1]=n,e[2]=o,e[3]=r,e[4]=a,e[5]=c):c=e[5];let i;e[6]!==s||e[7]!==n||e[8]!==a?(i=()=>_(n,"CHANGE_REQUEST_LAST_MERGED",{...a,base:s}),e[6]=s,e[7]=n,e[8]=a,e[9]=i):i=e[9];let l;e[10]!==t.enabled||e[11]!==s||e[12]!==o||e[13]!==r||e[14]!==a?(l=(t.enabled??!0)&&!!s&&R(a)&&!!o&&!!r,e[10]=t.enabled,e[11]=s,e[12]=o,e[13]=r,e[14]=a,e[15]=l):l=e[15];let u;return e[16]!==c||e[17]!==i||e[18]!==l?(u={queryKey:c,queryFn:i,enabled:l,...P,staleTime:oe,select:ie},e[16]=c,e[17]=i,e[18]=l,e[19]=u):u=e[19],E(u)}function ie(t){return t.changeRequest?L(t.changeRequest):null}const ce=50;function Se(t){const e=m.c(17),{orgSlug:n,target:a,owner:o,repo:r}=t;let s;e[0]!==n||e[1]!==o||e[2]!==r||e[3]!==a?(s=y.githubOpenPrs(n,A(a),o,r),e[0]=n,e[1]=o,e[2]=r,e[3]=a,e[4]=s):s=e[4];let c;e[5]!==n||e[6]!==a?(c=()=>_(n,"CHANGE_REQUEST_LIST_OPEN",{...a,limit:ce}),e[5]=n,e[6]=a,e[7]=c):c=e[7];let i;e[8]!==t.enabled||e[9]!==o||e[10]!==r||e[11]!==a?(i=(t.enabled??!0)&&R(a)&&!!o&&!!r,e[8]=t.enabled,e[9]=o,e[10]=r,e[11]=a,e[12]=i):i=e[12];let l;return e[13]!==s||e[14]!==c||e[15]!==i?(l={queryKey:s,queryFn:c,enabled:i,...P,staleTime:I,select:le},e[13]=s,e[14]=c,e[15]=i,e[16]=l):l=e[16],E(l)}function le(t){return t.changeRequests.map(L)}function ue(t,e){const{org:n}=N(),a=D(t);return ae({orgId:n.id,orgSlug:n.slug,target:Q(a),owner:a?.owner??"",repo:a?.name??"",branch:e??null}).data?.base??"main"}const de=[];function Te(){const t=m.c(13),e=M(),{org:n,locator:a}=N(),o=x(),{data:r}=G.useSession(),s=Y(),c=ue(void 0,null),{remember:i}=X(n.slug);let l;t[0]!==c||t[1]!==o||t[2]!==a||t[3]!==s?.threads||t[4]!==e||t[5]!==n.slug||t[6]!==r?.user?.id?(l=(d,g,f)=>{if(H(g).kind==="org-destination"){v(e,{tabId:g,org:n.slug,agentId:d,replace:!1});return}const w=(o??[]).find(j=>j.id===d),U=!!(w&&D(w)),O=!f,q=O?void 0:Z(s?.threads.get()??de,d,r?.user?.id,f,U,{baseBranch:c}),b=O?void 0:q?.id??crypto.randomUUID();b&&!q&&f&&z(sessionStorage,a,b,{runtime:f}),v(e,{tabId:g,org:n.slug,agentId:d,search:()=>b?{thread:b}:{},replace:!1})},t[0]=c,t[1]=o,t[2]=a,t[3]=s?.threads,t[4]=e,t[5]=n.slug,t[6]=r?.user?.id,t[7]=l):l=t[7];const u=l;let h;return t[8]!==u||t[9]!==e||t[10]!==n.slug||t[11]!==i?(h=(d,g)=>{const f=g?.panel;if(!f){i(d),e(fe(n.slug,d));return}u(d,f,g?.runtime)},t[8]=u,t[9]=e,t[10]=n.slug,t[11]=i,t[12]=h):h=t[12],h}function fe(t,e){return{to:"/$org/projects/$agentId",params:{org:t,agentId:e},search:n=>({...n,project:void 0,virtualmcpid:void 0,thread:void 0,mainpanel:void 0})}}export{X as a,ue as b,Z as c,Se as d,ae as e,be as f,Ee as g,pe as h,k as p,Te as u};
@@ -0,0 +1 @@
1
+ import{fJ as U,q as xe,b as Q,r as L,e as Ae,K as V,fK as oe,ec as Ee,fL as Me,fM as le,fN as ae,fO as Oe,fP as Fe,fQ as ze,fR as Le,fS as He,fT as Re,c as H,j as o,x as Ue,aS as $e,w as Be,d_ as Ie,R as Qe,v as Ve,D as qe,m as Ge,B as ve,h as _e,t as ke,X as Ye,aW as ce,Y as ee,a7 as We,Z as Je,_ as Ze}from"./index-CwntHk8S.js";import{u as Xe}from"./use-voice-input-CwLNuWlo.js";import{x as Ke,c as et,u as Se,v as tt,aq as it,ar as je,as as rt,at as _,au as X,aj as nt,av as st,aw as fe,ax as te,ay as ue,Z as ot,X as lt,Y as at,az as ct,aA as de,ac as ft,aB as ut,y as dt,$ as mt,aC as ht,aD as pt,aE as gt,a1 as yt}from"./site-editor-toast-GAJZE2A0.js";import{b as xt,h as vt,a as kt,d as me,e as he,f as St,c as jt,g as wt}from"./hosted-reconcile-BbIfIwl1.js";import{z as bt,y as Pt}from"./blocks-tab-states-GP0NCNYs.js";import{s as Ct}from"./sandbox-git-api-CX3IYPAX.js";import{u as Nt}from"./chat-context-CiT7AzBS.js";import{b as Dt}from"./sandbox-url-D3mC8qhT.js";import{d as Tt}from"./utils-DPEBLDgi.js";import{d as At}from"./delay-CnY5UFtP.js";import{i as Et}from"./AlertCircle-BfuEGc37.js";import{e as Mt}from"./agent-icon-DE4TWlDl.js";import{a as Ot}from"./SwitchHorizontal01-BbD-SqO6.js";import{i as Ft}from"./File02-D8jC2XAm.js";import{a as K}from"./Image01-0Jwady1a.js";import{i as we}from"./Upload01-Dd-OapHB.js";import{S as zt}from"./search-input-Yj0UUhbr.js";import{T as Lt,a as Ht,c as Rt,b as Ut}from"./tabs-BiFBpWbA.js";import{u as $t}from"./use-debounced-value-RJW46-1q.js";import{a as Bt}from"./use-file-configs-CzyibAGV.js";import{a as It,u as Qt,i as be,e as Vt,b as pe,f as qt}from"./asset-utils-DWvcPbEZ.js";import{f as q,M as Gt,c as _t,g as Z}from"./usage-stats-Bk_1jh1-.js";function Yt(t,e,i,n={}){return Pe("",t,e,i,n)}function Pe(t,e,i,n,r){if(Y(i,n)||Y(e,n))return i;if(Y(e,i))return n;if(ie(i)&&ie(n)){const s=ie(e)?e:{},c={},f=[...Object.keys(i),...Object.keys(n).filter(p=>!(p in i))];for(const p of f){const h=Pe(`${t}/${Wt(p)}`,s[p],i[p],n[p],r);h!==void 0&&(c[p]=h)}return c}if(Array.isArray(e)&&Array.isArray(i)&&Array.isArray(n)&&i.length===e.length&&n.length===e.length){const s=[];for(const[c,f]of e.entries()){const p=!Y(f,i[c]),h=!Y(f,n[c]);if(p&&h&&!Y(i[c],n[c]))return ge(t,i,n,r);s.push(p?i[c]:n[c])}return s}return ge(t,i,n,r)}function ge(t,e,i,n){return n.conflicts?.push(t),n.prefer==="theirs"?i:e}function Wt(t){return t.replaceAll("~","~0").replaceAll("/","~1")}function Y(t,e){return U(t)===U(e)}function ie(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Jt(t){return t?1e3:700}function re(t){return!!t&&typeof t=="object"&&t.keptTheirs===!0}const W=new Map,Zt=20,Xt=200,Kt=1500;function Ce(t){const e=W.get(t);W.delete(t);const i=e??[];if(W.set(t,i),W.size>Xt){const n=W.keys().next().value;n!==void 0&&W.delete(n)}return i}function ei(t,e){const i=Ce(t);i.push(U(e)),i.length>Zt&&i.shift()}function ti(t,e){return Ce(t).includes(U(e))}async function ii(t,e){if(e){if(e.value===void 0)return{[t]:null};try{return{[t]:await Re(e.value)}}catch{return}}}function ri({orgSlug:t,virtualMcpId:e,branch:i},n){const r=xe(),s=Nt()?.taskId??null,c=Ke(e),f=Xe(e).runtime==="cms",{url:p}=et(e),h=Se(e,i),v=h.kind==="protocol"?h:null,u=tt({orgSlug:t,virtualMcpId:e,branch:i}),k=Q(),j=v?.source==="github",[w]=L.useState(()=>n?.holdsCopy?new wt(()=>gt(r,u)):null);w?.settle();const m=j?w:null,g=async(l,a,d,S)=>{if(p)return{blockKey:l,data:a};if(f){const x=async($,O)=>{const B=await ii(l,O);return ht({orgSlug:t,virtualMcpId:e,branch:i},{set:{[l]:$},...B?{expect:B}:{}})},C=`${u}:${l}`,D=($,O=[])=>new _($,O.length>0?k("sectionsEditor.sectionsEditor.blockFieldsChangedElsewhere",{fields:He(O)}):k("sectionsEditor.sectionsEditor.blockChangedElsewhere"),O),A=async $=>{await r.invalidateQueries({queryKey:V.decofile(u)});const O=r.getQueryData(V.decofile(u))?.[l];if(d&&ti(C,O)&&U(O)!==U(d.value))return await At(Kt),{draft:await x(a,d),written:a};const B=[],G=S&&d?.fromCache?Yt(d.value,a,O,{prefer:"theirs",conflicts:B}):void 0;if(G===void 0||B.length>0)throw D($.blocks,B);const I=oe(G);return{draft:await x(I,{value:O}),written:I}};let R=a,z;try{z=await x(a,d)}catch($){if(!($ instanceof _))throw $;try{({draft:z,written:R}=await A($))}catch(O){throw!(O instanceof _)||O.fields.length>0?O:(await r.invalidateQueries({queryKey:V.decofile(u)}),D(O.blocks))}}return ei(C,R),ut(r,{orgSlug:t,virtualMcpId:e,branch:i},z),await r.invalidateQueries({queryKey:Ct({orgSlug:t,virtualMcpId:e,branch:i,threadId:s})}),{...z,written:R}}const y=dt(c,Tt(l)),T=JSON.stringify(a,null,2),E=await fetch(Dt({orgSlug:t,virtualMcpId:e,branch:i,threadId:s},"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:y,content:T})});return E.ok?E.json():mt(E,"Write")},b=async(l,a,d,S,y,T)=>{const E=v,x={queryClient:r,backend:E,params:l,cacheKey:u};let C=d,D=y?void 0:T?T.value:S?.value,A=y?{[a]:null}:T?{[a]:await vt(T,Me(r,u,a))}:await kt(x,[a],S?{[a]:S.value}:void 0);for(let R=0;;R++)try{return{...await te(r,E,l,u,{set:{[a]:C}},A),written:C}}catch(z){if(!X(z))throw z;const $=await ue(r,E,l,u,a,z),O=r.getQueryData(V.decofile(u))?.[a],B=de(r,u,a,E),G=C;if(R+1>=me||!le()||B===void 0||!J(G)||O!==void 0&&!J(O))throw new _([a],R+1>=me?k("siteEditor.save.keptChanging"):k("siteEditor.save.conflict"),[],$);if(A={[a]:B},!J(O)){if(!J(D))continue;if(await ae({kind:"theyDeleted",label:he(a,D,G)})==="theirs")return{keptTheirs:!0,deleted:!0};D=void 0;continue}const I=Oe({ancestor:J(D)?D:{},mine:G,theirs:O}),se=I.pointers.length===0?{}:await Fe(I,ze(I,P(l,O),!0),{block:bt(a,O),author:{draft:l,blockKey:a}});if(C=I.pointers.length===0?I.merged:Le(I,se),St(se)&&U(C)===U(O))return{keptTheirs:!0,deleted:!1};D=O}},P=(l,a)=>{const d=a.__resolveType,S=r.getQueryData(ft(l,v));if(typeof d!="string"||!S?.manifest)return null;try{return Pt(d,S)}catch{return null}},N=async(l,a,d,S,y)=>{const T=v,E=r.getQueryData(V.decofile(u));if(E&&Object.hasOwn(E,a)||!le()||!J(d))return;if(await ae({kind:"theyDeleted",label:he(a,y?.value,d)})==="theirs")return{keptTheirs:!0,deleted:!0};const C=de(r,u,a,T);if(C===void 0)return;const D=await te(r,T,l,u,{set:{[a]:d}},{[a]:C});return S.onApplied?.(D.versions),{...D,written:d}},M=Ae({mutationKey:at(t,e,i),scope:lt(t,e,i),mutationFn:async({blockKey:l,data:a,base:d,rebaseOnConflict:S=!0,guard:y,create:T=!1,edit:E})=>{if(h.kind==="pending"||h.kind==="unavailable")throw nt("CMS storage");if(v?.source!=="github"&&(a=oe(a)),v){const x={orgSlug:t,virtualMcpId:e,branch:i},C=A=>{!m||re(A)||U(A.written)===U(a)&&A.versions[l]&&m.saved(l,a)};if(j&&!y){const A=await b(x,l,a,d,T,T?void 0:m?.guardOf(l,E));return C(A),A}if(j&&y&&!y.reloadOnConflict){const A=await y.ifMatch(l),R=T||!!A&&A[l]===null;try{const z=await b(x,l,a,d,R,R?void 0:m?.guardOf(l,E));return C(z),y.onApplied?.(re(z)?{}:z.versions),z}catch(z){throw y.onRejected?.(z),z}}let D=await y?.ifMatch(l);if(y&&!D&&j&&(await st(r,v,x,u).catch(()=>{throw new fe}),D=await y.ifMatch(l),!D))throw new fe;try{const A=await te(r,v,x,u,{set:{[l]:a}},D);return D&&y?.onApplied?.(A.versions),A}catch(A){if(D&&y?.onRejected?.(A),D&&y?.reloadOnConflict&&X(A)){const R=await ue(r,v,x,u,l,A);if(j)try{const z=await N(x,l,a,y,d);if(z)return z}catch(z){if(!X(z))throw z}throw new _([l],k("sectionsEditor.sectionsEditor.blockChangedElsewhere"),[],R)}throw A}}return ot({queryClient:r,orgSlug:t,virtualMcpId:e,branch:i,backend:h,cacheKey:u},{kind:"edit",write:()=>g(l,a,d,S)})},onMutate:async({blockKey:l,data:a})=>{const d=V.decofile(u);await r.cancelQueries({queryKey:d});const S=r.getQueryData(d),y=!!S&&l in S,T=S?.[l];return r.setQueryData(d,E=>({...E??{},[l]:a})),{queryKey:d,blockKey:l,hadKey:y,previousValue:T}},onError:(l,a,d)=>{rt(k,l),!(!d||l instanceof _)&&(X(l)&&r.invalidateQueries({queryKey:d.queryKey}),r.setQueryData(d.queryKey,S=>{if(!S)return S;if(!d.hadKey){const{[d.blockKey]:y,...T}=S;return T}return{...S,[d.blockKey]:d.previousValue}}))},onSuccess:(l,{blockKey:a,data:d})=>{const S=()=>{if(!m)return;const T=jt({orgSlug:t,virtualMcpId:e,branch:i});Ee.schedule(()=>xt(T,a))};if(re(l)){it(k,l.deleted,l.deleted&&je(r,u,a)),S();return}const y=l&&typeof l=="object"&&"written"in l?l.written:d;r.setQueryData(V.decofile(u),T=>({...T??{},[a]:y})),U(y)!==U(d)&&S()}}),F=l=>{if(l.base)return l;const a=r.getQueryData(V.decofile(u));return a?{...l,base:{value:a[l.blockKey],fromCache:!0}}:l};return{...M,v8:h.kind!=="legacy",mutate:(l,a)=>M.mutate(F(l),a),mutateAsync:(l,a)=>M.mutateAsync(F(l),a),reportError:l=>ct(k,l,v?.source??null),hold:l=>w?.hold(l),holdsCopy:m!==null,autosaveDelay:Jt(v!==null),edited:l=>m?.edited(l),shown:l=>m?.get(l)}}function ir(t,e){const i=H.c(29),n=e?.holdsCopy;let r;i[0]!==n?(r={holdsCopy:n},i[0]=n,i[1]=r):r=i[1];const s=ri(t,r);let c;i[2]===Symbol.for("react.memo_cache_sentinel")?(c=new Map,i[2]=c):c=i[2];const f=L.useRef(c);let p;i[3]===Symbol.for("react.memo_cache_sentinel")?(p=new Map,i[3]=p):p=i[3];const h=L.useRef(p);let v;i[4]===Symbol.for("react.memo_cache_sentinel")?(v=new Map,i[4]=v):v=i[4];const u=L.useRef(v);let k;i[5]===Symbol.for("react.memo_cache_sentinel")?(k=new Set,i[5]=k):k=i[5];const j=L.useRef(k);let w;i[6]===Symbol.for("react.memo_cache_sentinel")?(w=new Set,i[6]=w):w=i[6];const m=L.useRef(w);let g,b;i[7]!==e||i[8]!==s?(g=x=>{if(j.current.has(x)){m.current.add(x);return}const C=f.current.get(x);if(!C)return;const D=typeof C=="function"?C():C;f.current.delete(x);const A=h.current.get(x);h.current.delete(x),D&&(j.current.add(x),s.mutateAsync({blockKey:x,data:D,guard:e?.guard,edit:A}).then(()=>e?.onSaved?.(),s.reportError).finally(()=>{j.current.delete(x),m.current.delete(x)&&g(x)}))},b=()=>{for(const x of u.current.values())clearTimeout(x);u.current.clear();for(const x of[...f.current.keys()])g(x)},i[7]=e,i[8]=s,i[9]=g,i[10]=b):(g=i[9],b=i[10]);const P=b;let N;i[11]===Symbol.for("react.memo_cache_sentinel")?(N=x=>{for(const C of x){const D=u.current.get(C);D&&clearTimeout(D),u.current.delete(C),f.current.delete(C),h.current.delete(C),m.current.delete(C)}},i[11]=N):N=i[11],pt(t.orgSlug,t.virtualMcpId,N);let M,F;i[12]===Symbol.for("react.memo_cache_sentinel")?(F=()=>{const x=C=>{(f.current.size>0||j.current.size>0)&&C.preventDefault()};return window.addEventListener("beforeunload",x),()=>window.removeEventListener("beforeunload",x)},M=[],i[12]=M,i[13]=F):(M=i[12],F=i[13]),L.useEffect(F,M);let l;i[14]!==P||i[15]!==s.holdsCopy?(l=()=>(s.holdsCopy&&P(),s.holdsCopy),i[14]=P,i[15]=s.holdsCopy,i[16]=l):l=i[16];const a=L.useEffectEvent(l);let d;i[17]!==a?(d=()=>{const x=u.current;return()=>{if(!a())for(const C of x.values())clearTimeout(C)}},i[17]=a,i[18]=d):d=i[18];let S;i[19]===Symbol.for("react.memo_cache_sentinel")?(S=[],i[19]=S):S=i[19],L.useEffect(d,S);let y;i[20]!==g||i[21]!==s?(y=(x,C)=>{if(!h.current.has(x)){const A=s.edited(x);A&&h.current.set(x,A)}f.current.set(x,C);const D=u.current.get(x);D&&clearTimeout(D),u.current.set(x,setTimeout(()=>{u.current.delete(x),g(x)},s.autosaveDelay))},i[20]=g,i[21]=s,i[22]=y):y=i[22];const T=y;let E;return i[23]!==P||i[24]!==T||i[25]!==s.hold||i[26]!==s.isPending||i[27]!==s.v8?(E={save:T,flush:P,isPending:s.isPending,hold:s.hold,v8:s.v8},i[23]=P,i[24]=T,i[25]=s.hold,i[26]=s.isPending,i[27]=s.v8,i[28]=E):E=i[28],E}function J(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}const Ne="file-picker:last-config-id";function rr(t){const e=H.c(31),i=Q(),n=t.open,r=t.onOpenChange;let s;e[0]!==t.mode||e[1]!==i?(s=t.mode==="image"?i("filePicker.filePickerDialog.pickAnImage"):i("filePicker.filePickerDialog.pickAFile"),e[0]=t.mode,e[1]=i,e[2]=s):s=e[2];let c;e[3]!==s?(c=o.jsx(Ue,{children:s}),e[3]=s,e[4]=c):c=e[4];let f;e[5]!==i?(f=i("filePicker.filePickerDialog.description"),e[5]=i,e[6]=f):f=e[6];let p;e[7]!==f?(p=o.jsx($e,{children:f}),e[7]=f,e[8]=p):p=e[8];let h;e[9]!==c||e[10]!==p?(h=o.jsxs(Be,{children:[c,p]}),e[9]=c,e[10]=p,e[11]=h):h=e[11];let v;e[12]!==i?(v=b=>{const{error:P}=b;return o.jsx(ni,{error:P??new Error(i("filePicker.filePickerDialog.failedToLoadBuckets"))})},e[12]=i,e[13]=v):v=e[13];let u;e[14]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Ie,{className:"h-64 w-full"}),e[14]=u):u=e[14];let k;e[15]!==t?(k=b=>{t.onSelect(b),t.onOpenChange(!1)},e[15]=t,e[16]=k):k=e[16];let j;e[17]!==t.lockedConfigId||e[18]!==t.mode||e[19]!==k?(j=o.jsx(L.Suspense,{fallback:u,children:o.jsx(si,{mode:t.mode,lockedConfigId:t.lockedConfigId,onSelect:k})}),e[17]=t.lockedConfigId,e[18]=t.mode,e[19]=k,e[20]=j):j=e[20];let w;e[21]!==j||e[22]!==v?(w=o.jsx(Qe,{fallback:v,children:j}),e[21]=j,e[22]=v,e[23]=w):w=e[23];let m;e[24]!==w||e[25]!==h?(m=o.jsxs(Ve,{className:"sm:max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[h,w]}),e[24]=w,e[25]=h,e[26]=m):m=e[26];let g;return e[27]!==t.onOpenChange||e[28]!==t.open||e[29]!==m?(g=o.jsx(qe,{open:n,onOpenChange:r,children:m}),e[27]=t.onOpenChange,e[28]=t.open,e[29]=m,e[30]=g):g=e[30],g}function ni(t){const e=H.c(3),{error:i}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Et,{size:16}),e[0]=n):n=e[0];let r;return e[1]!==i.message?(r=o.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,o.jsx("span",{className:"text-sm font-medium",children:i.message})]}),e[1]=i.message,e[2]=r):r=e[2],r}function si(t){const e=H.c(36),{mode:i,lockedConfigId:n,onSelect:r}=t,s=Bt(),c=Q();if(s.length===0){let m;return e[0]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(ai,{}),e[0]=m):m=e[0],m}if(n){let m;if(e[1]!==s||e[2]!==n){let N;e[4]!==n?(N=M=>M.id===n,e[4]=n,e[5]=N):N=e[5],m=s.find(N),e[1]=s,e[2]=n,e[3]=m}else m=e[3];const g=m;if(g){let N;return e[6]!==g||e[7]!==i||e[8]!==r?(N=o.jsx(ne,{config:g,mode:i,onSelect:r}),e[6]=g,e[7]=i,e[8]=r,e[9]=N):N=e[9],N}let b;e[10]!==c?(b=c("virtualMcp.settings.assetStorage.missing"),e[10]=c,e[11]=b):b=e[11];let P;return e[12]!==b?(P=o.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:b}),e[12]=b,e[13]=P):P=e[13],P}if(s.length===1){const m=s[0];let g;return e[14]!==m||e[15]!==i||e[16]!==r?(g=o.jsx(ne,{config:m,mode:i,onSelect:r}),e[14]=m,e[15]=i,e[16]=r,e[17]=g):g=e[17],g}let f;e[18]===Symbol.for("react.memo_cache_sentinel")?(f=typeof window<"u"?window.localStorage.getItem(Ne):null,e[18]=f):f=e[18];const p=f;let h;e[19]!==s?(h=s.find(m=>m.id===p)?.id??s[0].id,e[19]=s,e[20]=h):h=e[20];const v=h;let u;e[21]!==s?(u=s.map(oi),e[21]=s,e[22]=u):u=e[22];let k;e[23]!==u?(k=o.jsx(Ht,{className:"self-start",children:u}),e[23]=u,e[24]=k):k=e[24];let j;if(e[25]!==s||e[26]!==i||e[27]!==r){let m;e[29]!==i||e[30]!==r?(m=g=>o.jsx(Rt,{value:g.id,className:"min-h-0 flex-1 overflow-hidden flex flex-col",children:o.jsx(ne,{config:g,mode:i,onSelect:r})},g.id),e[29]=i,e[30]=r,e[31]=m):m=e[31],j=s.map(m),e[25]=s,e[26]=i,e[27]=r,e[28]=j}else j=e[28];let w;return e[32]!==v||e[33]!==k||e[34]!==j?(w=o.jsxs(Ut,{defaultValue:v,onValueChange:li,className:"min-h-0 flex-1 flex flex-col",children:[k,j]}),e[32]=v,e[33]=k,e[34]=j,e[35]=w):w=e[35],w}function oi(t){return o.jsx(Lt,{value:t.id,children:t.name},t.id)}function li(t){typeof window<"u"&&window.localStorage.setItem(Ne,t)}function ai(){const t=H.c(12),e=Q();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:o.jsx(we,{size:20,className:"text-muted-foreground"})}),t[0]=i):i=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noBucketConfigured"),t[1]=e,t[2]=n):n=t[2];let r;t[3]!==n?(r=o.jsx("p",{className:"font-medium text-sm",children:n}),t[3]=n,t[4]=r):r=t[4];let s;t[5]!==e?(s=e("filePicker.filePickerDialog.noBucketDescription"),t[5]=e,t[6]=s):s=t[6];let c;t[7]!==s?(c=o.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:s}),t[7]=s,t[8]=c):c=t[8];let f;return t[9]!==r||t[10]!==c?(f=o.jsxs("div",{className:"rounded-xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[i,o.jsxs("div",{children:[r,c]})]}),t[9]=r,t[10]=c,t[11]=f):f=t[11],f}function ne({config:t,mode:e,onSelect:i}){const n=Q(),[r,s]=L.useState(""),c=$t(r,300),f=It({configId:t.id,search:c,imageOnly:e==="image"}),p=Qt(),[h,v]=L.useState(!1),u=L.useRef(null),k=e==="image"?"image/*":void 0;async function j(a){if(!a)return;const d=Array.from(a);if(d.length===0)return;let S=null;const y=[];for(const T of d)try{const E=await p.mutateAsync({configId:t.id,file:T});S??=E.publicUrl}catch(E){y.push(`${T.name} (${E instanceof Error?E.message:"upload failed"})`)}await f.refetch(),y.length>0&&ke.error(y.length===d.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:y.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:y.join("; ")})),S&&i(S)}function w(a){a.preventDefault(),v(!0)}function m(){v(!1)}function g(a){a.preventDefault(),a.stopPropagation(),v(!1),j(a.dataTransfer.files)}const P=(f.data?.pages??[]).flatMap(a=>a.items),N=P.filter(a=>e==="image"?be(a.key):!0),M=c.trim(),F=P.length>0||r.trim().length>0,l=r!==c||f.isFetching&&!f.isFetchingNextPage;return o.jsxs("div",{className:"flex flex-col gap-3 min-h-0 flex-1",children:[o.jsxs("button",{type:"button",onClick:()=>u.current?.click(),onDragOver:w,onDragLeave:m,onDrop:g,className:Ge("rounded-xl border border-dashed border-border/60 p-6 flex flex-col items-center justify-center gap-2 text-center transition-colors",h&&"border-primary bg-primary/5",p.isPending&&"opacity-60 pointer-events-none"),children:[o.jsx(we,{size:18,className:"text-muted-foreground"}),o.jsx("p",{className:"text-sm font-medium",children:p.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick")}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("filePicker.filePickerDialog.uploadSizeLimit")," ",n(e==="image"?"filePicker.filePickerDialog.imagesOnlyTypes":"filePicker.filePickerDialog.commonMediaTypes")]}),o.jsx("input",{ref:u,type:"file",accept:k,multiple:!0,className:"hidden",onChange:a=>{const d=Array.from(a.target.files??[]);a.target.value="",j(d)}})]}),F?o.jsx(zt,{value:r,onChange:s,isSearching:l,placeholder:n(e==="image"?"filePicker.filePickerDialog.searchImagesPlaceholder":"filePicker.filePickerDialog.searchFilesPlaceholder"),className:"shrink-0"}):null,o.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:[N.length===0?M?o.jsx(ui,{query:M}):e==="image"&&P.length>0?o.jsx(fi,{}):o.jsx(ci,{}):e==="image"?o.jsx(di,{items:N,onSelect:i}):o.jsx(mi,{items:N,onSelect:i}),f.hasNextPage&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(ve,{type:"button",variant:"outline",size:"sm",disabled:f.isFetchingNextPage,onClick:()=>f.fetchNextPage(),children:f.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(_e,{className:"size-3.5"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})})]})]})}function ci(){const t=H.c(12),e=Q();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(K,{size:18,className:"text-muted-foreground"})}),t[0]=i):i=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noFilesYet"),t[1]=e,t[2]=n):n=t[2];let r;t[3]!==n?(r=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=r):r=t[4];let s;t[5]!==e?(s=e("filePicker.filePickerDialog.dropFileToGetStarted"),t[5]=e,t[6]=s):s=t[6];let c;t[7]!==s?(c=o.jsx("p",{className:"text-xs text-muted-foreground",children:s}),t[7]=s,t[8]=c):c=t[8];let f;return t[9]!==r||t[10]!==c?(f=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[i,r,c]}),t[9]=r,t[10]=c,t[11]=f):f=t[11],f}function fi(){const t=H.c(12),e=Q();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(K,{size:18,className:"text-muted-foreground"})}),t[0]=i):i=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noImagesYet"),t[1]=e,t[2]=n):n=t[2];let r;t[3]!==n?(r=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=r):r=t[4];let s;t[5]!==e?(s=e("filePicker.filePickerDialog.noImagesFormatDesc"),t[5]=e,t[6]=s):s=t[6];let c;t[7]!==s?(c=o.jsx("p",{className:"text-xs text-muted-foreground",children:s}),t[7]=s,t[8]=c):c=t[8];let f;return t[9]!==r||t[10]!==c?(f=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[i,r,c]}),t[9]=r,t[10]=c,t[11]=f):f=t[11],f}function ui(t){const e=H.c(13),{query:i}=t,n=Q();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(K,{size:18,className:"text-muted-foreground"})}),e[0]=r):r=e[0];let s;e[1]!==i||e[2]!==n?(s=n("filePicker.filePickerDialog.noMatches",{query:i}),e[1]=i,e[2]=n,e[3]=s):s=e[3];let c;e[4]!==s?(c=o.jsx("p",{className:"text-sm font-medium",children:s}),e[4]=s,e[5]=c):c=e[5];let f;e[6]!==n?(f=n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore"),e[6]=n,e[7]=f):f=e[7];let p;e[8]!==f?(p=o.jsx("p",{className:"text-xs text-muted-foreground",children:f}),e[8]=f,e[9]=p):p=e[9];let h;return e[10]!==c||e[11]!==p?(h=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[r,c,p]}),e[10]=c,e[11]=p,e[12]=h):h=e[12],h}function di(t){const e=H.c(7),{items:i,onSelect:n}=t;let r;if(e[0]!==i||e[1]!==n){let c;e[3]!==n?(c=f=>o.jsx(De,{item:f,variant:"image",onSelect:n},f.key),e[3]=n,e[4]=c):c=e[4],r=i.map(c),e[0]=i,e[1]=n,e[2]=r}else r=e[2];let s;return e[5]!==r?(s=o.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:r}),e[5]=r,e[6]=s):s=e[6],s}function mi(t){const e=H.c(7),{items:i,onSelect:n}=t;let r;if(e[0]!==i||e[1]!==n){let c;e[3]!==n?(c=f=>o.jsx("li",{children:o.jsx(De,{item:f,variant:"row",onSelect:n})},f.key),e[3]=n,e[4]=c):c=e[4],r=i.map(c),e[0]=i,e[1]=n,e[2]=r}else r=e[2];let s;return e[5]!==r?(s=o.jsx("ul",{className:"divide-y divide-border/60 rounded-lg border border-border/60",children:r}),e[5]=r,e[6]=s):s=e[6],s}function De(t){const e=H.c(58),{item:i,variant:n,onSelect:r}=t;let s;e[0]!==i.key?(s=Vt(i.key),e[0]=i.key,e[1]=s):s=e[1];const c=s;if(n==="image"){let N;e[2]!==i.publicUrl||e[3]!==r?(N=()=>r(i.publicUrl),e[2]=i.publicUrl,e[3]=r,e[4]=N):N=e[4];let M;e[5]!==i.key||e[6]!==i.publicUrl?(M=o.jsx("img",{src:i.publicUrl,alt:i.key,loading:"lazy",className:"h-full w-full object-cover",onError:hi}),e[5]=i.key,e[6]=i.publicUrl,e[7]=M):M=e[7];let F;e[8]!==i.key||e[9]!==N||e[10]!==M?(F=o.jsx("button",{type:"button",onClick:N,className:"block h-full w-full transition hover:ring-2 hover:ring-primary",title:i.key,children:M}),e[8]=i.key,e[9]=N,e[10]=M,e[11]=F):F=e[11];let l;e[12]!==c?(l=o.jsx("span",{className:"pointer-events-none absolute left-1.5 top-1.5 rounded bg-background/80 px-1.5 py-0.5 text-2xs font-medium uppercase text-foreground opacity-0 backdrop-blur-sm transition-opacity group-hover:opacity-100",children:c}),e[12]=c,e[13]=l):l=e[13];let a;e[14]!==i||e[15]!==r?(a=o.jsx("div",{className:"absolute right-1.5 top-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:o.jsx(ye,{item:i,onSelect:r})}),e[14]=i,e[15]=r,e[16]=a):a=e[16];let d;e[17]!==i.key?(d=pe(i.key),e[17]=i.key,e[18]=d):d=e[18];let S;e[19]!==d?(S=o.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent p-2 opacity-0 transition-opacity group-hover:opacity-100",children:o.jsx("p",{className:"truncate text-xs text-white",children:d})}),e[19]=d,e[20]=S):S=e[20];let y;return e[21]!==F||e[22]!==l||e[23]!==a||e[24]!==S?(y=o.jsxs("div",{className:"group relative aspect-square overflow-hidden rounded-lg border border-border/60 bg-muted",children:[F,l,a,S]}),e[21]=F,e[22]=l,e[23]=a,e[24]=S,e[25]=y):y=e[25],y}let f;e[26]!==i.publicUrl||e[27]!==r?(f=()=>r(i.publicUrl),e[26]=i.publicUrl,e[27]=r,e[28]=f):f=e[28];let p;e[29]!==i.key?(p=o.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted",children:be(i.key)?o.jsx(K,{size:16,className:"text-muted-foreground"}):o.jsx(Ft,{size:16,className:"text-muted-foreground"})}),e[29]=i.key,e[30]=p):p=e[30];let h;e[31]!==i.key?(h=pe(i.key),e[31]=i.key,e[32]=h):h=e[32];let v;e[33]!==h?(v=o.jsx("p",{className:"truncate text-sm font-medium",children:h}),e[33]=h,e[34]=v):v=e[34];let u;e[35]!==i.key?(u=o.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:i.key}),e[35]=i.key,e[36]=u):u=e[36];let k;e[37]!==v||e[38]!==u?(k=o.jsxs("div",{className:"min-w-0 flex-1",children:[v,u]}),e[37]=v,e[38]=u,e[39]=k):k=e[39];let j;e[40]!==c?(j=o.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-2xs font-medium uppercase text-muted-foreground",children:c}),e[40]=c,e[41]=j):j=e[41];let w;e[42]!==i.size?(w=qt(i.size),e[42]=i.size,e[43]=w):w=e[43];let m;e[44]!==w?(m=o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:w}),e[44]=w,e[45]=m):m=e[45];let g;e[46]!==m||e[47]!==f||e[48]!==p||e[49]!==k||e[50]!==j?(g=o.jsxs("button",{type:"button",onClick:f,className:"flex min-w-0 flex-1 items-center gap-3 text-left",children:[p,k,j,m]}),e[46]=m,e[47]=f,e[48]=p,e[49]=k,e[50]=j,e[51]=g):g=e[51];let b;e[52]!==i||e[53]!==r?(b=o.jsx(ye,{item:i,onSelect:r}),e[52]=i,e[53]=r,e[54]=b):b=e[54];let P;return e[55]!==g||e[56]!==b?(P=o.jsxs("div",{className:"group flex items-center gap-3 px-3 py-2 transition hover:bg-accent",children:[g,b]}),e[55]=g,e[56]=b,e[57]=P):P=e[57],P}function hi(t){t.target.style.display="none"}function ye(t){const e=H.c(39),{item:i,onSelect:n}=t,r=Q(),[s,c]=L.useState(!1);let f;e[0]!==i.publicUrl||e[1]!==r?(f=async function(y){y.preventDefault(),y.stopPropagation();try{await navigator.clipboard.writeText(i.publicUrl),c(!0),window.setTimeout(()=>c(!1),1500)}catch{ke.error(r("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=i.publicUrl,e[1]=r,e[2]=f):f=e[2];const p=f;let h;e[3]!==r?(h=r("filePicker.filePickerDialog.assetActions"),e[3]=r,e[4]=h):h=e[4];let v;e[5]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(Ot,{size:14}),e[5]=v):v=e[5];let u;e[6]!==h?(u=o.jsx(Ye,{asChild:!0,children:o.jsx(ve,{type:"button",variant:"ghost",size:"icon-sm",className:"bg-background/80 backdrop-blur-sm",onClick:yi,"aria-label":h,children:v})}),e[6]=h,e[7]=u):u=e[7];let k;e[8]!==i.publicUrl||e[9]!==n?(k=()=>n(i.publicUrl),e[8]=i.publicUrl,e[9]=n,e[10]=k):k=e[10];let j;e[11]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(ce,{size:14}),e[11]=j):j=e[11];let w;e[12]!==r?(w=r("filePicker.filePickerDialog.useThis"),e[12]=r,e[13]=w):w=e[13];let m;e[14]!==k||e[15]!==w?(m=o.jsxs(ee,{onClick:k,children:[j,w]}),e[14]=k,e[15]=w,e[16]=m):m=e[16];let g;e[17]!==s?(g=s?o.jsx(ce,{size:14}):o.jsx(Mt,{size:14}),e[17]=s,e[18]=g):g=e[18];let b;e[19]!==s||e[20]!==r?(b=r(s?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[19]=s,e[20]=r,e[21]=b):b=e[21];let P;e[22]!==p||e[23]!==b||e[24]!==g?(P=o.jsxs(ee,{onClick:p,children:[g,b]}),e[22]=p,e[23]=b,e[24]=g,e[25]=P):P=e[25];const N=i.publicUrl;let M;e[26]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(We,{size:14}),e[26]=M):M=e[26];let F;e[27]!==r?(F=r("filePicker.filePickerDialog.openInNewTab"),e[27]=r,e[28]=F):F=e[28];let l;e[29]!==i.publicUrl||e[30]!==F?(l=o.jsx(ee,{asChild:!0,children:o.jsxs("a",{href:N,target:"_blank",rel:"noreferrer",onClick:pi,children:[M,F]})}),e[29]=i.publicUrl,e[30]=F,e[31]=l):l=e[31];let a;e[32]!==P||e[33]!==l||e[34]!==m?(a=o.jsxs(Je,{align:"end",onClick:gi,children:[m,P,l]}),e[32]=P,e[33]=l,e[34]=m,e[35]=a):a=e[35];let d;return e[36]!==a||e[37]!==u?(d=o.jsxs(Ze,{children:[u,a]}),e[36]=a,e[37]=u,e[38]=d):d=e[38],d}function pi(t){return t.stopPropagation()}function gi(t){return t.stopPropagation()}function yi(t){return t.stopPropagation()}function nr(t,e,i){return e||(t.length===1?t[0].id:t.length===0?null:t.some(n=>n.id===i)?i:null)}const xi=new Set(["http:","https:"]),vi=/[\u0000-\u001F\u007F]/g;function ki(t){return t.replace(vi,"").trim()}const Si=/^[a-zA-Z][a-zA-Z0-9+.-]*:/;function sr(t){return ji(t)!==""}function ji(t){const e=ki(t);if(!e)return"";if(!Si.test(e))try{return encodeURI(e)}catch{return""}try{const i=new URL(e);return xi.has(i.protocol)||i.protocol==="data:"&&/^data:image\//i.test(i.href)?i.href:""}catch{return""}}const wi=q.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(i=>e.updateAttributes(i,{textAlign:t})).some(i=>i):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:i})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?i.unsetTextAlign():i.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});var or=wi;const bi=20,Te=(t,e=0)=>{const i=[];return!t.children.length||e>bi||Array.from(t.children).forEach(n=>{n.tagName==="SPAN"?i.push(n):n.children.length&&i.push(...Te(n,e+1))}),i},Pi=t=>{if(!t.children.length)return;const e=Te(t);e&&e.forEach(i=>{var n;const r=i.getAttribute("style"),s=(n=i.parentElement)===null||n===void 0||(n=n.closest("span"))===null||n===void 0?void 0:n.getAttribute("style");i.setAttribute("style",`${s};${r}`)})},Ci=Gt.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Pi(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",_t(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(i,n)=>{if(!i.isInline)return!0;i.marks.filter(r=>r.type===this.type).some(r=>Object.values(r.attrs).some(s=>!!s))||t.removeMark(n,n+i.nodeSize,this.type)}),!0}}}}),Ni=q.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const i=(e=Z(t,"background-color"))!==null&&e!==void 0?e:t.style.backgroundColor;return i?.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),Di=q.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const i=(e=Z(t,"color"))!==null&&e!==void 0?e:t.style.color;return i?.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),Ti=q.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>{var e;return(e=Z(t,"font-family"))!==null&&e!==void 0?e:t.style.fontFamily},renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),Ai=q.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>{var e;return(e=Z(t,"font-size"))!==null&&e!==void 0?e:t.style.fontSize},renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),Ei=q.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>{var e;return(e=Z(t,"line-height"))!==null&&e!==void 0?e:t.style.lineHeight},renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});q.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(Ni.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(Di.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(Ti.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(Ai.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(Ei.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(Ci.configure(this.options.textStyle)),t}});function lr(t){const e=H.c(6),i=xe(),n=Se(t.virtualMcpId,t.branch);if(n.kind!=="protocol"||n.source!=="github")return Mi;let r;e[0]!==n||e[1]!==t?(r=yt(t,n),e[0]=n,e[1]=t,e[2]=r):r=e[2];const s=r;let c;return e[3]!==s||e[4]!==i?(c=f=>je(i,s,f),e[3]=s,e[4]=i,e[5]=c):c=e[5],c}function Mi(){return!1}export{Di as C,rr as F,Ne as L,Ci as T,lr as a,ir as b,Ai as c,or as d,Jt as e,sr as i,re as k,nr as r,ji as s,ri as u};
@@ -1 +1 @@
1
- import{c as F,a4 as w,K as y,i as $,q as k,e as P}from"./index-BP527m3V.js";import{u as x}from"./useInfiniteQuery-CN2uIy97.js";function G(n){return n.contentHash??`${n.size}-${n.updatedAt}`}function p(n,e,t,s){const i=new URLSearchParams(s).toString();return`/api/${encodeURIComponent(n)}/fs/${encodeURIComponent(e)}/${t}${i?`?${i}`:""}`}async function h(n,e,t){const s=await fetch(n,e);if(s.ok||t?.allow404&&s.status===404)return s;let i="";try{i=(await s.json()).error??""}catch{}throw new Error(i||`HTTP ${s.status}`)}async function E(n,e,t){return(await(await h(p(n,e,"list",{path:t}))).json()).entries.toSorted((r,a)=>r.kind!==a.kind?r.kind==="dir"?-1:1:r.path.localeCompare(a.path))}function Z(n,e,t){const s=F.c(16),{org:i}=w(),r=t?.enabled??!0;let a;s[0]!==i.id||s[1]!==e||s[2]!==n?(a=y.orgFsList(i.id,n,e),s[0]=i.id,s[1]=e,s[2]=n,s[3]=a):a=s[3];let o;s[4]!==i.id||s[5]!==n?(o=(f,u)=>u?.queryKey[1]===i.id&&u.queryKey[2]===n?f:void 0,s[4]=i.id,s[5]=n,s[6]=o):o=s[6];let c;s[7]!==i.slug||s[8]!==e||s[9]!==n?(c=()=>E(i.slug,n,e),s[7]=i.slug,s[8]=e,s[9]=n,s[10]=c):c=s[10];let l;return s[11]!==r||s[12]!==a||s[13]!==o||s[14]!==c?(l={enabled:r,queryKey:a,placeholderData:o,queryFn:c},s[11]=r,s[12]=a,s[13]=o,s[14]=c,s[15]=l):l=s[15],$(l)}async function _(n,e,t){const s=await h(p(n,e,"stat",{path:t}),void 0,{allow404:!0});return s.status===404?null:(await s.json()).entry}function v(n,e,t){const s=F.c(16),{org:i}=w();let r;s[0]!==i.id||s[1]!==e||s[2]!==n?(r=y.orgFsStat(i.id,n??"",e),s[0]=i.id,s[1]=e,s[2]=n,s[3]=r):r=s[3];const a=n!==null,o=t?.staleTime;let c;s[4]!==t?(c=t?.refetchIntervalWhenAbsent?u=>u.state.data?!1:t.refetchIntervalWhenAbsent??!1:void 0,s[4]=t,s[5]=c):c=s[5];let l;s[6]!==i.slug||s[7]!==e||s[8]!==n?(l=()=>_(i.slug,n??"",e),s[6]=i.slug,s[7]=e,s[8]=n,s[9]=l):l=s[9];let f;return s[10]!==r||s[11]!==a||s[12]!==o||s[13]!==c||s[14]!==l?(f={queryKey:r,enabled:a,staleTime:o,refetchInterval:c,queryFn:l},s[10]=r,s[11]=a,s[12]=o,s[13]=c,s[14]=l,s[15]=f):f=s[15],$(f)}function ee(n,e){const t=F.c(9),s=n===void 0?60:n,{org:i}=w();let r;t[0]!==i.id?(r=y.orgFsRecent(i.id),t[0]=i.id,t[1]=r):r=t[1];const a=e?.enabled;let o;t[2]!==s||t[3]!==i.slug?(o=async()=>(await(await h(`/api/${encodeURIComponent(i.slug)}/fs/recent?limit=${s}`)).json()).entries,t[2]=s,t[3]=i.slug,t[4]=o):o=t[4];let c;return t[5]!==r||t[6]!==a||t[7]!==o?(c={queryKey:r,enabled:a,queryFn:o},t[5]=r,t[6]=a,t[7]=o,t[8]=c):c=t[8],$(c)}const R=200;function te(n){const e=F.c(9),{org:t}=w();let s;e[0]!==t.id||e[1]!==n?(s=y.orgFsVolumeFiles(t.id,n),e[0]=t.id,e[1]=n,e[2]=s):s=e[2];let i;e[3]!==t.slug||e[4]!==n?(i=async a=>{const{pageParam:o}=a,c=new URLSearchParams({limit:String(R)});return o&&c.set("before",o),await(await h(`/api/${encodeURIComponent(t.slug)}/fs/${encodeURIComponent(n)}/files?${c}`)).json()},e[3]=t.slug,e[4]=n,e[5]=i):i=e[5];let r;return e[6]!==s||e[7]!==i?(r={queryKey:s,initialPageParam:null,queryFn:i,getNextPageParam:C},e[6]=s,e[7]=i,e[8]=r):r=e[8],x(r)}function C(n){return n.next??void 0}const U=50;function se(n,e){const t=F.c(16),{org:s}=w();let i;t[0]!==s.id||t[1]!==n||t[2]!==e?.prefix||t[3]!==e?.volume?(i=y.orgFsSearch(s.id,n,e?.volume??"",e?.prefix??""),t[0]=s.id,t[1]=n,t[2]=e?.prefix,t[3]=e?.volume,t[4]=i):i=t[4];const r=n.length>0;let a;t[5]!==s.id?(a=(l,f)=>f?.queryKey[1]===s.id?l:void 0,t[5]=s.id,t[6]=a):a=t[6];let o;t[7]!==s.slug||t[8]!==n||t[9]!==e?(o=async()=>{const l=new URLSearchParams({q:n,limit:String(U)});return e&&(l.set("volume",e.volume),e.prefix&&l.set("prefix",e.prefix)),(await(await h(`/api/${encodeURIComponent(s.slug)}/fs/search?${l}`)).json()).entries},t[7]=s.slug,t[8]=n,t[9]=e,t[10]=o):o=t[10];let c;return t[11]!==i||t[12]!==r||t[13]!==a||t[14]!==o?(c={queryKey:i,enabled:r,placeholderData:a,queryFn:o},t[11]=i,t[12]=r,t[13]=a,t[14]=o,t[15]=c):c=t[15],$(c)}function ne(n){const e=F.c(8),{org:t}=w();let s;e[0]!==t.id?(s=y.orgFsSkills(t.id),e[0]=t.id,e[1]=s):s=e[1];const i=n?.enabled;let r;e[2]!==t.slug?(r=async()=>{const o=await h(`/api/${encodeURIComponent(t.slug)}/fs/skills`),{skills:c}=await o.json();return c.map(j)},e[2]=t.slug,e[3]=r):r=e[3];let a;return e[4]!==s||e[5]!==i||e[6]!==r?(a={queryKey:s,enabled:i,queryFn:r},e[4]=s,e[5]=i,e[6]=r,e[7]=a):a=e[7],$(a)}function j(n){return{volume:n.volume,path:n.path}}async function Q(n){const e=await h(`/api/${encodeURIComponent(n)}/fs/skills`),{skills:t}=await e.json();return t}function ie(){const n=F.c(7),{org:e}=w();let t;n[0]!==e.id?(t=y.slashSkills(e.id),n[0]=e.id,n[1]=t):t=n[1];let s;n[2]!==e.slug?(s=()=>Q(e.slug),n[2]=e.slug,n[3]=s):s=n[3];let i;return n[4]!==t||n[5]!==s?(i={queryKey:t,queryFn:s,staleTime:6e4},n[4]=t,n[5]=s,n[6]=i):i=n[6],$(i)}async function M(n,e,t){return(await h(p(n,e,"read",{path:t}))).text()}function re(n,e){const t=F.c(8);let s;t[0]!==n?(s=y.fileText(n),t[0]=n,t[1]=s):s=t[1];const i=e?.enabled!==!1&&n!=="";let r;t[2]!==n?(r=async()=>{const o=await fetch(n,{credentials:"include"});return o.ok?await o.text():null},t[2]=n,t[3]=r):r=t[3];let a;return t[4]!==s||t[5]!==i||t[6]!==r?(a={queryKey:s,enabled:i,staleTime:6e4,retry:!1,queryFn:r},t[4]=s,t[5]=i,t[6]=r,t[7]=a):a=t[7],$(a)}const A=new Set(["md","mdx","markdown","txt","text"]),D=25,N=64*1024,H=256*1024,V=4;function W(n){const e=n.lastIndexOf(".");return e===-1?!1:A.has(n.slice(e+1).toLowerCase())}async function ae(n,e,t){const s=t?`${t}/`:"",i=u=>u.startsWith(s)?u.slice(s.length):u,r=[],a=[],o=[{path:t,depth:0}];for(;o.length>0;){const u=o.shift();if(!u)break;let g;try{g=(await(await h(p(n,e,"list",{path:u.path}))).json()).entries}catch{continue}for(const d of[...g].sort((b,m)=>b.path.localeCompare(m.path))){if(d.kind==="dir"){u.depth<V&&o.push({path:d.path,depth:u.depth+1});continue}W(d.path)&&d.size<=N&&r.length<D?r.push(d.path):a.push(i(d.path))}}const c=await Promise.all(r.map(u=>M(n,e,u).catch(()=>null))),l=[];let f=0;return r.forEach((u,g)=>{const d=c[g];if(d==null||f+d.length>H){a.push(i(u));return}f+=d.length,l.push({relPath:i(u),content:d})}),l.sort((u,g)=>u.relPath==="SKILL.md"?-1:g.relPath==="SKILL.md"?1:u.relPath.localeCompare(g.relPath)),a.sort(),{files:l,omittedPaths:a}}function oe(){const n=F.c(7),{org:e}=w();let t;n[0]!==e.id?(t=y.orgFsPublicSets(e.id),n[0]=e.id,n[1]=t):t=n[1];let s;n[2]!==e.slug?(s=async()=>(await(await h(`/api/${encodeURIComponent(e.slug)}/fs/public-sets`)).json()).sets,n[2]=e.slug,n[3]=s):s=n[3];let i;return n[4]!==t||n[5]!==s?(i={queryKey:t,staleTime:3e5,queryFn:s},n[4]=t,n[5]=s,n[6]=i):i=n[6],$(i)}function le(n){const e=F.c(3),{org:t}=w();let s;return e[0]!==t.slug||e[1]!==n?(s=i=>p(t.slug,n,"read",{path:i}),e[0]=t.slug,e[1]=n,e[2]=s):s=e[2],s}function ce(){const n=F.c(2),{org:e}=w();let t;return n[0]!==e.slug?(t=(s,i)=>p(e.slug,s,"read",{path:i}),n[0]=e.slug,n[1]=t):t=n[1],t}function ue(n){const e=F.c(3),{org:t}=w();let s;return e[0]!==t||e[1]!==n?(s={mutationFn:async i=>(await(await h(p(t.slug,n,"file",{path:i.path}),{method:"PUT",headers:{"content-type":i.contentType??"text/html; charset=utf-8"},body:i.body})).json()).entry},e[0]=t,e[1]=n,e[2]=s):s=e[2],P(s)}async function fe(n,e,t,s,i,r="text/markdown; charset=utf-8"){const a={"content-type":r};i&&"absent"in i?a["if-none-match"]="*":i&&(a["if-match"]=`"${i.contentHash}"`);const o=await fetch(p(n,e,"file",{path:t}),{method:"PUT",headers:a,body:s});if(o.status===412)return{ok:!1,reason:"conflict"};if(o.status===403)return{ok:!1,reason:"forbidden"};if(!o.ok)throw new Error(`HTTP ${o.status}`);return{ok:!0,entry:(await o.json()).entry}}function de(n){const e=F.c(18),{org:t}=w(),s=k();let i;e[0]!==t||e[1]!==n?(i=async l=>(await(await h(p(t.slug,n,"public",{path:l.path}),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({mode:l.mode,password:l.password})})).json()).entry,e[0]=t,e[1]=n,e[2]=i):i=e[2];let r;e[3]!==t||e[4]!==s||e[5]!==n?(r=async l=>{const f=y.orgFsStat(t.id,n,l.path);await s.cancelQueries({queryKey:f});const u=s.getQueryData(f),g=l.mode!=="private";return s.setQueryData(f,d=>d&&{...d,readPublic:g,effectivePublic:g,shareMode:l.mode}),{key:f,previous:u}},e[3]=t,e[4]=s,e[5]=n,e[6]=r):r=e[6];let a;e[7]!==s?(a=(l,f,u)=>{u&&s.setQueryData(u.key,u.previous)},e[7]=s,e[8]=a):a=e[8];let o;e[9]!==t||e[10]!==s||e[11]!==n?(o=(l,f,u)=>{s.invalidateQueries({queryKey:y.orgFsStat(t.id,n,u.path)}),s.invalidateQueries({queryKey:y.orgFsVolume(t.id,n)}),s.invalidateQueries({queryKey:y.orgFsRecent(t.id)}),s.invalidateQueries({queryKey:y.orgFsSearchRoot(t.id)})},e[9]=t,e[10]=s,e[11]=n,e[12]=o):o=e[12];let c;return e[13]!==i||e[14]!==r||e[15]!==a||e[16]!==o?(c={mutationFn:i,onMutate:r,onError:a,onSettled:o},e[13]=i,e[14]=r,e[15]=a,e[16]=o,e[17]=c):c=e[17],P(c)}function X(n,e,t){n.invalidateQueries({queryKey:y.orgFsVolume(e,t)}),n.invalidateQueries({queryKey:y.orgFsRecent(e)}),n.invalidateQueries({queryKey:y.orgFsSearchRoot(e)})}function ge(n){const e=F.c(33),{org:t}=w(),s=k();let i;e[0]!==t||e[1]!==s||e[2]!==n?(i=()=>X(s,t.id,n),e[0]=t,e[1]=s,e[2]=n,e[3]=i):i=e[3];const r=i;let a;e[4]!==t||e[5]!==n?(a=async S=>{const T=(await Promise.allSettled(S.files.map(L=>{const q=S.dir?`${S.dir}/${L.name}`:L.name;return h(p(t.slug,n,"file",{path:q}),{method:"PUT",headers:{"content-type":L.type||"application/octet-stream"},body:L})}))).find(Y);if(T)throw T.reason},e[4]=t,e[5]=n,e[6]=a):a=e[6];let o;e[7]!==r||e[8]!==a?(o={mutationFn:a,onSettled:r},e[7]=r,e[8]=a,e[9]=o):o=e[9];const c=P(o);let l;e[10]!==t||e[11]!==n?(l=async S=>{await h(p(t.slug,n,"dir",{path:S}),{method:"POST"})},e[10]=t,e[11]=n,e[12]=l):l=e[12];let f;e[13]!==r||e[14]!==l?(f={mutationFn:l,onSuccess:r},e[13]=r,e[14]=l,e[15]=f):f=e[15];const u=P(f);let g;e[16]!==t||e[17]!==n?(g=async S=>{await h(p(t.slug,n,"file",{path:S}),{method:"DELETE"})},e[16]=t,e[17]=n,e[18]=g):g=e[18];let d;e[19]!==r||e[20]!==g?(d={mutationFn:g,onSuccess:r},e[19]=r,e[20]=g,e[21]=d):d=e[21];const b=P(d);let m;e[22]!==t||e[23]!==n?(m=async S=>{await h(p(t.slug,n,"move"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(S)})},e[22]=t,e[23]=n,e[24]=m):m=e[24];let I;e[25]!==r||e[26]!==m?(I={mutationFn:m,onSuccess:r},e[25]=r,e[26]=m,e[27]=I):I=e[27];const O=P(I);let K;return e[28]!==u||e[29]!==O||e[30]!==b||e[31]!==c?(K={upload:c,mkdir:u,remove:b,move:O},e[28]=u,e[29]=O,e[30]=b,e[31]=c,e[32]=K):K=e[32],K}function Y(n){return n.status==="rejected"}export{le as a,Q as b,v as c,ue as d,G as e,ae as f,de as g,re as h,E as i,ie as j,ge as k,ce as l,X as m,_ as n,M as o,ee as p,ne as q,oe as r,se as s,te as t,Z as u,fe as w};
1
+ import{c as F,a4 as w,K as y,i as $,q as k,e as P}from"./index-CwntHk8S.js";import{u as x}from"./useInfiniteQuery-BagPKS5m.js";function G(n){return n.contentHash??`${n.size}-${n.updatedAt}`}function p(n,e,t,s){const i=new URLSearchParams(s).toString();return`/api/${encodeURIComponent(n)}/fs/${encodeURIComponent(e)}/${t}${i?`?${i}`:""}`}async function h(n,e,t){const s=await fetch(n,e);if(s.ok||t?.allow404&&s.status===404)return s;let i="";try{i=(await s.json()).error??""}catch{}throw new Error(i||`HTTP ${s.status}`)}async function E(n,e,t){return(await(await h(p(n,e,"list",{path:t}))).json()).entries.toSorted((r,a)=>r.kind!==a.kind?r.kind==="dir"?-1:1:r.path.localeCompare(a.path))}function Z(n,e,t){const s=F.c(16),{org:i}=w(),r=t?.enabled??!0;let a;s[0]!==i.id||s[1]!==e||s[2]!==n?(a=y.orgFsList(i.id,n,e),s[0]=i.id,s[1]=e,s[2]=n,s[3]=a):a=s[3];let o;s[4]!==i.id||s[5]!==n?(o=(f,u)=>u?.queryKey[1]===i.id&&u.queryKey[2]===n?f:void 0,s[4]=i.id,s[5]=n,s[6]=o):o=s[6];let c;s[7]!==i.slug||s[8]!==e||s[9]!==n?(c=()=>E(i.slug,n,e),s[7]=i.slug,s[8]=e,s[9]=n,s[10]=c):c=s[10];let l;return s[11]!==r||s[12]!==a||s[13]!==o||s[14]!==c?(l={enabled:r,queryKey:a,placeholderData:o,queryFn:c},s[11]=r,s[12]=a,s[13]=o,s[14]=c,s[15]=l):l=s[15],$(l)}async function _(n,e,t){const s=await h(p(n,e,"stat",{path:t}),void 0,{allow404:!0});return s.status===404?null:(await s.json()).entry}function v(n,e,t){const s=F.c(16),{org:i}=w();let r;s[0]!==i.id||s[1]!==e||s[2]!==n?(r=y.orgFsStat(i.id,n??"",e),s[0]=i.id,s[1]=e,s[2]=n,s[3]=r):r=s[3];const a=n!==null,o=t?.staleTime;let c;s[4]!==t?(c=t?.refetchIntervalWhenAbsent?u=>u.state.data?!1:t.refetchIntervalWhenAbsent??!1:void 0,s[4]=t,s[5]=c):c=s[5];let l;s[6]!==i.slug||s[7]!==e||s[8]!==n?(l=()=>_(i.slug,n??"",e),s[6]=i.slug,s[7]=e,s[8]=n,s[9]=l):l=s[9];let f;return s[10]!==r||s[11]!==a||s[12]!==o||s[13]!==c||s[14]!==l?(f={queryKey:r,enabled:a,staleTime:o,refetchInterval:c,queryFn:l},s[10]=r,s[11]=a,s[12]=o,s[13]=c,s[14]=l,s[15]=f):f=s[15],$(f)}function ee(n,e){const t=F.c(9),s=n===void 0?60:n,{org:i}=w();let r;t[0]!==i.id?(r=y.orgFsRecent(i.id),t[0]=i.id,t[1]=r):r=t[1];const a=e?.enabled;let o;t[2]!==s||t[3]!==i.slug?(o=async()=>(await(await h(`/api/${encodeURIComponent(i.slug)}/fs/recent?limit=${s}`)).json()).entries,t[2]=s,t[3]=i.slug,t[4]=o):o=t[4];let c;return t[5]!==r||t[6]!==a||t[7]!==o?(c={queryKey:r,enabled:a,queryFn:o},t[5]=r,t[6]=a,t[7]=o,t[8]=c):c=t[8],$(c)}const R=200;function te(n){const e=F.c(9),{org:t}=w();let s;e[0]!==t.id||e[1]!==n?(s=y.orgFsVolumeFiles(t.id,n),e[0]=t.id,e[1]=n,e[2]=s):s=e[2];let i;e[3]!==t.slug||e[4]!==n?(i=async a=>{const{pageParam:o}=a,c=new URLSearchParams({limit:String(R)});return o&&c.set("before",o),await(await h(`/api/${encodeURIComponent(t.slug)}/fs/${encodeURIComponent(n)}/files?${c}`)).json()},e[3]=t.slug,e[4]=n,e[5]=i):i=e[5];let r;return e[6]!==s||e[7]!==i?(r={queryKey:s,initialPageParam:null,queryFn:i,getNextPageParam:C},e[6]=s,e[7]=i,e[8]=r):r=e[8],x(r)}function C(n){return n.next??void 0}const U=50;function se(n,e){const t=F.c(16),{org:s}=w();let i;t[0]!==s.id||t[1]!==n||t[2]!==e?.prefix||t[3]!==e?.volume?(i=y.orgFsSearch(s.id,n,e?.volume??"",e?.prefix??""),t[0]=s.id,t[1]=n,t[2]=e?.prefix,t[3]=e?.volume,t[4]=i):i=t[4];const r=n.length>0;let a;t[5]!==s.id?(a=(l,f)=>f?.queryKey[1]===s.id?l:void 0,t[5]=s.id,t[6]=a):a=t[6];let o;t[7]!==s.slug||t[8]!==n||t[9]!==e?(o=async()=>{const l=new URLSearchParams({q:n,limit:String(U)});return e&&(l.set("volume",e.volume),e.prefix&&l.set("prefix",e.prefix)),(await(await h(`/api/${encodeURIComponent(s.slug)}/fs/search?${l}`)).json()).entries},t[7]=s.slug,t[8]=n,t[9]=e,t[10]=o):o=t[10];let c;return t[11]!==i||t[12]!==r||t[13]!==a||t[14]!==o?(c={queryKey:i,enabled:r,placeholderData:a,queryFn:o},t[11]=i,t[12]=r,t[13]=a,t[14]=o,t[15]=c):c=t[15],$(c)}function ne(n){const e=F.c(8),{org:t}=w();let s;e[0]!==t.id?(s=y.orgFsSkills(t.id),e[0]=t.id,e[1]=s):s=e[1];const i=n?.enabled;let r;e[2]!==t.slug?(r=async()=>{const o=await h(`/api/${encodeURIComponent(t.slug)}/fs/skills`),{skills:c}=await o.json();return c.map(j)},e[2]=t.slug,e[3]=r):r=e[3];let a;return e[4]!==s||e[5]!==i||e[6]!==r?(a={queryKey:s,enabled:i,queryFn:r},e[4]=s,e[5]=i,e[6]=r,e[7]=a):a=e[7],$(a)}function j(n){return{volume:n.volume,path:n.path}}async function Q(n){const e=await h(`/api/${encodeURIComponent(n)}/fs/skills`),{skills:t}=await e.json();return t}function ie(){const n=F.c(7),{org:e}=w();let t;n[0]!==e.id?(t=y.slashSkills(e.id),n[0]=e.id,n[1]=t):t=n[1];let s;n[2]!==e.slug?(s=()=>Q(e.slug),n[2]=e.slug,n[3]=s):s=n[3];let i;return n[4]!==t||n[5]!==s?(i={queryKey:t,queryFn:s,staleTime:6e4},n[4]=t,n[5]=s,n[6]=i):i=n[6],$(i)}async function M(n,e,t){return(await h(p(n,e,"read",{path:t}))).text()}function re(n,e){const t=F.c(8);let s;t[0]!==n?(s=y.fileText(n),t[0]=n,t[1]=s):s=t[1];const i=e?.enabled!==!1&&n!=="";let r;t[2]!==n?(r=async()=>{const o=await fetch(n,{credentials:"include"});return o.ok?await o.text():null},t[2]=n,t[3]=r):r=t[3];let a;return t[4]!==s||t[5]!==i||t[6]!==r?(a={queryKey:s,enabled:i,staleTime:6e4,retry:!1,queryFn:r},t[4]=s,t[5]=i,t[6]=r,t[7]=a):a=t[7],$(a)}const A=new Set(["md","mdx","markdown","txt","text"]),D=25,N=64*1024,H=256*1024,V=4;function W(n){const e=n.lastIndexOf(".");return e===-1?!1:A.has(n.slice(e+1).toLowerCase())}async function ae(n,e,t){const s=t?`${t}/`:"",i=u=>u.startsWith(s)?u.slice(s.length):u,r=[],a=[],o=[{path:t,depth:0}];for(;o.length>0;){const u=o.shift();if(!u)break;let g;try{g=(await(await h(p(n,e,"list",{path:u.path}))).json()).entries}catch{continue}for(const d of[...g].sort((b,m)=>b.path.localeCompare(m.path))){if(d.kind==="dir"){u.depth<V&&o.push({path:d.path,depth:u.depth+1});continue}W(d.path)&&d.size<=N&&r.length<D?r.push(d.path):a.push(i(d.path))}}const c=await Promise.all(r.map(u=>M(n,e,u).catch(()=>null))),l=[];let f=0;return r.forEach((u,g)=>{const d=c[g];if(d==null||f+d.length>H){a.push(i(u));return}f+=d.length,l.push({relPath:i(u),content:d})}),l.sort((u,g)=>u.relPath==="SKILL.md"?-1:g.relPath==="SKILL.md"?1:u.relPath.localeCompare(g.relPath)),a.sort(),{files:l,omittedPaths:a}}function oe(){const n=F.c(7),{org:e}=w();let t;n[0]!==e.id?(t=y.orgFsPublicSets(e.id),n[0]=e.id,n[1]=t):t=n[1];let s;n[2]!==e.slug?(s=async()=>(await(await h(`/api/${encodeURIComponent(e.slug)}/fs/public-sets`)).json()).sets,n[2]=e.slug,n[3]=s):s=n[3];let i;return n[4]!==t||n[5]!==s?(i={queryKey:t,staleTime:3e5,queryFn:s},n[4]=t,n[5]=s,n[6]=i):i=n[6],$(i)}function le(n){const e=F.c(3),{org:t}=w();let s;return e[0]!==t.slug||e[1]!==n?(s=i=>p(t.slug,n,"read",{path:i}),e[0]=t.slug,e[1]=n,e[2]=s):s=e[2],s}function ce(){const n=F.c(2),{org:e}=w();let t;return n[0]!==e.slug?(t=(s,i)=>p(e.slug,s,"read",{path:i}),n[0]=e.slug,n[1]=t):t=n[1],t}function ue(n){const e=F.c(3),{org:t}=w();let s;return e[0]!==t||e[1]!==n?(s={mutationFn:async i=>(await(await h(p(t.slug,n,"file",{path:i.path}),{method:"PUT",headers:{"content-type":i.contentType??"text/html; charset=utf-8"},body:i.body})).json()).entry},e[0]=t,e[1]=n,e[2]=s):s=e[2],P(s)}async function fe(n,e,t,s,i,r="text/markdown; charset=utf-8"){const a={"content-type":r};i&&"absent"in i?a["if-none-match"]="*":i&&(a["if-match"]=`"${i.contentHash}"`);const o=await fetch(p(n,e,"file",{path:t}),{method:"PUT",headers:a,body:s});if(o.status===412)return{ok:!1,reason:"conflict"};if(o.status===403)return{ok:!1,reason:"forbidden"};if(!o.ok)throw new Error(`HTTP ${o.status}`);return{ok:!0,entry:(await o.json()).entry}}function de(n){const e=F.c(18),{org:t}=w(),s=k();let i;e[0]!==t||e[1]!==n?(i=async l=>(await(await h(p(t.slug,n,"public",{path:l.path}),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({mode:l.mode,password:l.password})})).json()).entry,e[0]=t,e[1]=n,e[2]=i):i=e[2];let r;e[3]!==t||e[4]!==s||e[5]!==n?(r=async l=>{const f=y.orgFsStat(t.id,n,l.path);await s.cancelQueries({queryKey:f});const u=s.getQueryData(f),g=l.mode!=="private";return s.setQueryData(f,d=>d&&{...d,readPublic:g,effectivePublic:g,shareMode:l.mode}),{key:f,previous:u}},e[3]=t,e[4]=s,e[5]=n,e[6]=r):r=e[6];let a;e[7]!==s?(a=(l,f,u)=>{u&&s.setQueryData(u.key,u.previous)},e[7]=s,e[8]=a):a=e[8];let o;e[9]!==t||e[10]!==s||e[11]!==n?(o=(l,f,u)=>{s.invalidateQueries({queryKey:y.orgFsStat(t.id,n,u.path)}),s.invalidateQueries({queryKey:y.orgFsVolume(t.id,n)}),s.invalidateQueries({queryKey:y.orgFsRecent(t.id)}),s.invalidateQueries({queryKey:y.orgFsSearchRoot(t.id)})},e[9]=t,e[10]=s,e[11]=n,e[12]=o):o=e[12];let c;return e[13]!==i||e[14]!==r||e[15]!==a||e[16]!==o?(c={mutationFn:i,onMutate:r,onError:a,onSettled:o},e[13]=i,e[14]=r,e[15]=a,e[16]=o,e[17]=c):c=e[17],P(c)}function X(n,e,t){n.invalidateQueries({queryKey:y.orgFsVolume(e,t)}),n.invalidateQueries({queryKey:y.orgFsRecent(e)}),n.invalidateQueries({queryKey:y.orgFsSearchRoot(e)})}function ge(n){const e=F.c(33),{org:t}=w(),s=k();let i;e[0]!==t||e[1]!==s||e[2]!==n?(i=()=>X(s,t.id,n),e[0]=t,e[1]=s,e[2]=n,e[3]=i):i=e[3];const r=i;let a;e[4]!==t||e[5]!==n?(a=async S=>{const T=(await Promise.allSettled(S.files.map(L=>{const q=S.dir?`${S.dir}/${L.name}`:L.name;return h(p(t.slug,n,"file",{path:q}),{method:"PUT",headers:{"content-type":L.type||"application/octet-stream"},body:L})}))).find(Y);if(T)throw T.reason},e[4]=t,e[5]=n,e[6]=a):a=e[6];let o;e[7]!==r||e[8]!==a?(o={mutationFn:a,onSettled:r},e[7]=r,e[8]=a,e[9]=o):o=e[9];const c=P(o);let l;e[10]!==t||e[11]!==n?(l=async S=>{await h(p(t.slug,n,"dir",{path:S}),{method:"POST"})},e[10]=t,e[11]=n,e[12]=l):l=e[12];let f;e[13]!==r||e[14]!==l?(f={mutationFn:l,onSuccess:r},e[13]=r,e[14]=l,e[15]=f):f=e[15];const u=P(f);let g;e[16]!==t||e[17]!==n?(g=async S=>{await h(p(t.slug,n,"file",{path:S}),{method:"DELETE"})},e[16]=t,e[17]=n,e[18]=g):g=e[18];let d;e[19]!==r||e[20]!==g?(d={mutationFn:g,onSuccess:r},e[19]=r,e[20]=g,e[21]=d):d=e[21];const b=P(d);let m;e[22]!==t||e[23]!==n?(m=async S=>{await h(p(t.slug,n,"move"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(S)})},e[22]=t,e[23]=n,e[24]=m):m=e[24];let I;e[25]!==r||e[26]!==m?(I={mutationFn:m,onSuccess:r},e[25]=r,e[26]=m,e[27]=I):I=e[27];const O=P(I);let K;return e[28]!==u||e[29]!==O||e[30]!==b||e[31]!==c?(K={upload:c,mkdir:u,remove:b,move:O},e[28]=u,e[29]=O,e[30]=b,e[31]=c,e[32]=K):K=e[32],K}function Y(n){return n.status==="rejected"}export{le as a,Q as b,v as c,ue as d,G as e,ae as f,de as g,re as h,E as i,ie as j,ge as k,ce as l,X as m,_ as n,M as o,ee as p,ne as q,oe as r,se as s,te as t,Z as u,fe as w};
@@ -0,0 +1 @@
1
+ import{c as h,j as u,o as C,b as $,r as A,B as S,a as p,t as f,M,i as _,K as z,cH as D,ar as E,at as I,d as G}from"./index-CwntHk8S.js";import{s as q}from"./XClose-CWGS9q3D.js";import{S as F}from"./thread-intent-DpzwhK2y.js";const K={switcher:"tour-layout-switcher",nav:"tour-layout-nav",tasks:"tour-layout-tasks",projects:"tour-layout-projects",account:"tour-layout-account",recentActivity:"tour-layout-recent-activity",siteEditor:"tour-layout-site-editor",surfaceTabs:"tour-layout-surface-tabs",branchPicker:"tour-layout-branch-picker",automations:"tour-layout-automations",settings:"tour-layout-settings"};function oe(e){return`[data-tour="${K[e]}"]`}function Y(e){return e!=="off"}function ie(e){if(!e.hasSource)return[];const t=["site-editor"];return Y(e.cmsMode)&&t.push("content"),e.runtime==="sandbox"&&t.push("code"),t}function X(e){return e==="site-editor"||e==="content"||e==="code"||e.startsWith("code:")}function ae(e){return e.reportsOnly&&!e.onReportAgent&&X(e.tabId)}const B={xs:"xs",sm:"xs",lg:"md"};function U(e){const t=h.c(4),{org:n,size:o}=e,s=o===void 0?"sm":o,r=n.logo??void 0,i=B[s];let a;return t[0]!==n.name||t[1]!==r||t[2]!==i?(a=u.jsx(C,{url:r,fallback:n.name,size:i,tone:"solid"}),t[0]=n.name,t[1]=r,t[2]=i,t[3]=a):a=t[3],a}function ce({invitation:e,onChanged:t}){const n=$(),[o,s]=A.useState(!1),r=e.organizationName??n("header.orgSwitcher.unknownOrganization"),i=async()=>{s(!0);try{const d=await p.organization.acceptInvitation({invitationId:e.id});if(d.error){f.error(d.error.message),s(!1);return}}catch{f.error(n("header.orgSwitcher.failedToAcceptInvitation")),s(!1);return}f.success(n("header.orgSwitcher.joined",{name:r})),M();let c;try{c=(await p.organization.getFullOrganization({query:{organizationId:e.organizationId}}))?.data?.slug}catch{}window.location.href=c?`/${c}`:"/"},a=async()=>{s(!0);try{const c=await p.organization.rejectInvitation({invitationId:e.id});if(c.error){f.error(c.error.message),s(!1);return}f.success(n("header.orgSwitcher.invitationDeclined")),s(!1),t()}catch{f.error(n("header.orgSwitcher.failedToDeclineInvitation")),s(!1)}};return u.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-dashed border-border px-3 py-2.5",children:[u.jsx(U,{org:{name:r},size:"sm"}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("p",{className:"truncate text-sm font-medium",children:r}),u.jsx("p",{className:"truncate text-xs text-muted-foreground",children:n("header.orgSwitcher.invitedToJoin")})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.jsx(S,{size:"sm",variant:"default",onClick:i,disabled:o,children:n("header.orgSwitcher.accept")}),u.jsx(S,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground",onClick:a,disabled:o,"aria-label":n("header.orgSwitcher.declineInvitationTo",{name:r}),children:u.jsx(q,{size:14})})]})]})}function H(e){return typeof e=="object"&&e!==null&&Array.isArray(e.items)}function de(e){const t=h.c(13),n=e.trim(),{data:o}=p.useSession(),s=o?.user?.id??"",r=n.length>0&&!!s,i=z.organizationSearch(s,n);let a;t[0]!==n?(a=async P=>{const{signal:L}=P,w=await fetch(`/api/_me/organizations/search?q=${encodeURIComponent(n)}`,{signal:L});if(!w.ok)throw new Error(`Organization search failed: ${w.status}`);const R=await w.json();if(!H(R))throw new Error("Invalid organization search response");return R},t[0]=n,t[1]=a):a=t[1];let c;t[2]!==r||t[3]!==i||t[4]!==a?(c={queryKey:i,queryFn:a,enabled:r,placeholderData:D,staleTime:3e4,retry:!1},t[2]=r,t[3]=i,t[4]=a,t[5]=c):c=t[5];const{data:d,isFetching:k,isPlaceholderData:N,isError:O}=_(c);let l;t[6]!==d?.items?(l=d?.items??[],t[6]=d?.items,t[7]=l):l=t[7];const b=r&&k,x=r&&N;let y;return t[8]!==O||t[9]!==l||t[10]!==b||t[11]!==x?(y={hits:l,isSearching:b,isStale:x,isError:O},t[8]=O,t[9]=l,t[10]=b,t[11]=x,t[12]=y):y=t[12],y}const J=3,T=10,Q=440,V=55;function ue(e){const t=Math.floor((e-Q)/V);return Math.min(T,Math.max(J,t))}function W(e,t,n=T*3,o=[]){return[...new Set([t,...o,...e])].slice(0,n)}function le(e,t){return!t.id||e.some(n=>n.slug===t.slug)?[...e]:[...e,t]}function fe(e,t,n,o,s=[]){if(e.length<=o)return{shown:[...e],hidden:[]};const r=new Map(e.map(a=>[a.slug,a])),i=new Set;n&&r.has(n)&&i.add(n);for(const a of s)r.has(a)&&i.add(a);for(const a of t){if(i.size>=o)break;r.has(a)&&i.add(a)}for(const a of e){if(i.size>=o)break;i.add(a.slug)}return{shown:e.filter(a=>i.has(a.slug)),hidden:e.filter(a=>!i.has(a.slug))}}const v=[];function Z(){const e=h.c(6);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=I.recentOrgs(),e[0]=t):t=e[0];const[n,o]=E(t,v),s=Array.isArray(n)?n:v;let r;e[1]!==o?(r=(a,c)=>o(d=>W(Array.isArray(d)?d:[],a,void 0,c)),e[1]=o,e[2]=r):r=e[2];let i;return e[3]!==s||e[4]!==r?(i={recent:s,remember:r},e[3]=s,e[4]=r,e[5]=i):i=e[5],i}const j={hidden:[],pinned:[],order:[]},g=(e,t)=>e.filter(n=>n!==t);function ee(e){if(typeof e!="object"||e===null)return j;const t=o=>Array.isArray(o)?o.filter(s=>typeof s=="string"):[],n=e;return{hidden:t(n.hidden),pinned:t(n.pinned),order:t(n.order)}}function he(e,t){return{...e,hidden:[...g(e.hidden,t),t],pinned:g(e.pinned,t)}}function te(e,t){return{...e,hidden:g(e.hidden,t)}}function me(e,t){return e.pinned.includes(t)?{...e,pinned:g(e.pinned,t)}:{...e,hidden:g(e.hidden,t),pinned:[...e.pinned,t]}}function ge(e,t,n){const o=s=>{const r=t.order.indexOf(s);return r===-1?Number.MAX_SAFE_INTEGER:r};return e.filter(s=>s.slug===n||!t.hidden.includes(s.slug)).map((s,r)=>({org:s,index:r})).sort((s,r)=>Number(t.pinned.includes(r.org.slug))-Number(t.pinned.includes(s.org.slug))||o(s.org.slug)-o(r.org.slug)||s.index-r.index).map(({org:s})=>s)}function ye(e,t,n,o){const s=t.indexOf(n),r=t.indexOf(o);if(s===-1||r===-1||s===r||e.pinned.includes(n)!==e.pinned.includes(o))return e;const i=[...t];return i.splice(s,1),i.splice(r,0,n),{...e,order:[...i,...e.order.filter(a=>!i.includes(a))]}}function pe(){const e=h.c(5),t=G(),{remember:n}=Z();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=I.railOrgPrefs(),e[0]=o):o=e[0];const[,s]=E(o,j);let r;return e[1]!==t||e[2]!==n||e[3]!==s?(r=(i,a)=>{const c=a?.includes(i)??!1;s(d=>te(ee(d),i)),n(i,c?a:void 0),t({to:"/$org/home",params:{org:i},viewTransition:!0})},e[1]=t,e[2]=n,e[3]=s,e[4]=r):r=e[4],r}const m=new F(!1);function Oe(){m.set(!0)}function be(){m.set(!1)}function xe(){const e=h.c(2),t=A.useSyncExternalStore(m.subscribe,m.get);let n;return e[0]!==t?(n=[t,m.set],e[0]=t,e[1]=n):n=e[1],n}function we(e){const t=h.c(8);let n;t[0]!==e?(n=z.orgNotice(e??""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==e?(o=async()=>{const i=await fetch(`/api/${e}/notice`,{credentials:"include"});return i.ok?(await i.json()).notice??null:null},t[2]=e,t[3]=o):o=t[3];const s=!!e;let r;return t[4]!==n||t[5]!==o||t[6]!==s?(r={queryKey:n,queryFn:o,enabled:s,staleTime:6e4},t[4]=n,t[5]=o,t[6]=s,t[7]=r):r=t[7],_(r)}export{j as E,ce as I,K as L,U as O,de as a,Z as b,pe as c,fe as d,ge as e,ue as f,Y as g,he as h,X as i,xe as j,be as k,oe as l,ye as m,ie as n,Oe as o,ee as r,ae as s,me as t,we as u,le as w};
@@ -1 +1 @@
1
- import{c as r,a4 as f,ak as y,K as S,i as _,q as d,e as R}from"./index-BP527m3V.js";const p=5e3;function m(e){return(e??[]).some(n=>!n.lastSyncedAt&&!n.lastSyncError)}function g(){const e=r.c(7),{org:n}=f(),t=y();let i;e[0]!==n.id?(i=S.orgRepoSyncs(n.id),e[0]=n.id,e[1]=i):i=e[1];let s;e[2]!==t?(s=async()=>(await t.call("ORG_REPO_SYNC_LIST",{})).configs,e[2]=t,e[3]=s):s=e[3];let o;return e[4]!==i||e[5]!==s?(o={queryKey:i,staleTime:6e4,refetchInterval:E,queryFn:s},e[4]=i,e[5]=s,e[6]=o):o=e[6],_(o)}function E(e){return m(e.state.data)?p:!1}function P(){const e=r.c(2),n=g();let t;return e[0]!==n.data?(t=new Set((n.data??[]).map(O)),e[0]=n.data,e[1]=t):t=e[1],t}function O(e){return e.volume}function q(){const e=r.c(12),{org:n}=f(),t=y(),i=d();let s;e[0]!==n||e[1]!==i?(s=()=>i.invalidateQueries({queryKey:S.orgRepoSyncs(n.id)}),e[0]=n,e[1]=i,e[2]=s):s=e[2];const o=s;let c;e[3]!==t?(c=async u=>(await t.call("ORG_REPO_SYNC_CREATE",u)).config,e[3]=t,e[4]=c):c=e[4];let a;e[5]!==o||e[6]!==t?(a=u=>{t.call("ORG_REPO_SYNC_RUN",{id:u.id}).catch(C).then(o)},e[5]=o,e[6]=t,e[7]=a):a=e[7];let l;return e[8]!==o||e[9]!==c||e[10]!==a?(l={mutationFn:c,onSuccess:a,onSettled:o},e[8]=o,e[9]=c,e[10]=a,e[11]=l):l=e[11],R(l)}function C(){return null}function T(){const e=r.c(8),{org:n}=f(),t=y(),i=d();let s;e[0]!==t?(s=a=>t.call("ORG_REPO_SYNC_DELETE",{id:a}),e[0]=t,e[1]=s):s=e[1];let o;e[2]!==n||e[3]!==i?(o=()=>i.invalidateQueries({queryKey:S.orgRepoSyncs(n.id)}),e[2]=n,e[3]=i,e[4]=o):o=e[4];let c;return e[5]!==s||e[6]!==o?(c={mutationFn:s,onSettled:o},e[5]=s,e[6]=o,e[7]=c):c=e[7],R(c)}export{P as a,q as b,T as c,g as u};
1
+ import{c as r,a4 as f,ak as y,K as S,i as _,q as d,e as R}from"./index-CwntHk8S.js";const p=5e3;function m(e){return(e??[]).some(n=>!n.lastSyncedAt&&!n.lastSyncError)}function g(){const e=r.c(7),{org:n}=f(),t=y();let i;e[0]!==n.id?(i=S.orgRepoSyncs(n.id),e[0]=n.id,e[1]=i):i=e[1];let s;e[2]!==t?(s=async()=>(await t.call("ORG_REPO_SYNC_LIST",{})).configs,e[2]=t,e[3]=s):s=e[3];let o;return e[4]!==i||e[5]!==s?(o={queryKey:i,staleTime:6e4,refetchInterval:E,queryFn:s},e[4]=i,e[5]=s,e[6]=o):o=e[6],_(o)}function E(e){return m(e.state.data)?p:!1}function P(){const e=r.c(2),n=g();let t;return e[0]!==n.data?(t=new Set((n.data??[]).map(O)),e[0]=n.data,e[1]=t):t=e[1],t}function O(e){return e.volume}function q(){const e=r.c(12),{org:n}=f(),t=y(),i=d();let s;e[0]!==n||e[1]!==i?(s=()=>i.invalidateQueries({queryKey:S.orgRepoSyncs(n.id)}),e[0]=n,e[1]=i,e[2]=s):s=e[2];const o=s;let c;e[3]!==t?(c=async u=>(await t.call("ORG_REPO_SYNC_CREATE",u)).config,e[3]=t,e[4]=c):c=e[4];let a;e[5]!==o||e[6]!==t?(a=u=>{t.call("ORG_REPO_SYNC_RUN",{id:u.id}).catch(C).then(o)},e[5]=o,e[6]=t,e[7]=a):a=e[7];let l;return e[8]!==o||e[9]!==c||e[10]!==a?(l={mutationFn:c,onSuccess:a,onSettled:o},e[8]=o,e[9]=c,e[10]=a,e[11]=l):l=e[11],R(l)}function C(){return null}function T(){const e=r.c(8),{org:n}=f(),t=y(),i=d();let s;e[0]!==t?(s=a=>t.call("ORG_REPO_SYNC_DELETE",{id:a}),e[0]=t,e[1]=s):s=e[1];let o;e[2]!==n||e[3]!==i?(o=()=>i.invalidateQueries({queryKey:S.orgRepoSyncs(n.id)}),e[2]=n,e[3]=i,e[4]=o):o=e[4];let c;return e[5]!==s||e[6]!==o?(c={mutationFn:s,onSettled:o},e[5]=s,e[6]=o,e[7]=c):c=e[7],R(c)}export{P as a,q as b,T as c,g as u};