@lobu/runtime-server 24.9.0 → 24.10.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 (221) hide show
  1. package/dist/catalogs/automations.json +2 -2
  2. package/dist/catalogs/connectors.json +16 -4
  3. package/dist/catalogs/skills.json +1 -1
  4. package/dist/component.json +1 -1
  5. package/dist/connectors/postgres.ts +39 -24
  6. package/dist/connectors/whatsapp-web-adapter.js +41 -10
  7. package/dist/connectors/whatsapp-web-helpers.ts +12 -2
  8. package/dist/connectors/whatsapp_web.ts +18 -2
  9. package/dist/db/migrations/20261112210000_instance_identity.sql +18 -0
  10. package/dist/dependencies.bun.lock +62 -60
  11. package/dist/embeddings-server.mjs +38 -5
  12. package/dist/owletto/dist/assets/_-CYvj1y65.js +3 -0
  13. package/dist/owletto/dist/assets/_-CeLTSYYY.js +2 -0
  14. package/dist/owletto/dist/assets/_agentId-BB5E-L6T.js +2 -0
  15. package/dist/owletto/dist/assets/{_agentId-bna2tPsW.js → _agentId-DN0EwMAC.js} +2 -2
  16. package/dist/owletto/dist/assets/_automationId-DvUl9CSd.js +2 -0
  17. package/dist/owletto/dist/assets/_connectorKey._connectionId-CVKfL9AG.js +2 -0
  18. package/dist/owletto/dist/assets/_connectorKey.index-Cv6FzK1v.js +2 -0
  19. package/dist/owletto/dist/assets/{_conversationId-zcs-S3dY.js → _conversationId-CPpNySjO.js} +2 -2
  20. package/dist/owletto/dist/assets/_eventId-DZKicuq6.js +2 -0
  21. package/dist/owletto/dist/assets/_owner-Dauk3YuD.js +3 -0
  22. package/dist/owletto/dist/assets/_shape-cKrEID3T.js +2 -0
  23. package/dist/owletto/dist/assets/_slug-DJx_8fsV.js +2 -0
  24. package/dist/owletto/dist/assets/_viewKey-CPVzVKEf.js +2 -0
  25. package/dist/owletto/dist/assets/_viewKey-CW8gexOQ.js +2 -0
  26. package/dist/owletto/dist/assets/accept-invitation-Dwq1GAnG.js +2 -0
  27. package/dist/owletto/dist/assets/activity-route-location-C1jcXC7v.js +2 -0
  28. package/dist/owletto/dist/assets/activity-route-view-D78Wj0RH.js +2 -0
  29. package/dist/owletto/dist/assets/agent-connect-pages-DoI9UR0a.js +4 -0
  30. package/dist/owletto/dist/assets/{agent-editor-form-Bnc_q5WD.js → agent-editor-form-DlavYg2q.js} +2 -2
  31. package/dist/owletto/dist/assets/{agent-loading-shells-xteN-pyK.js → agent-loading-shells-DYqQphN7.js} +2 -2
  32. package/dist/owletto/dist/assets/agent-permissions-matrix-C1L8IcYR.js +2 -0
  33. package/dist/owletto/dist/assets/{agent-skill-context-r0O0BVOu.js → agent-skill-context-D1nMrVod.js} +2 -2
  34. package/dist/owletto/dist/assets/{agent-subpage-shell-C2KpYdu3.js → agent-subpage-shell-2w7vTeXw.js} +2 -2
  35. package/dist/owletto/dist/assets/{agent-thread-Bv_chdPy.js → agent-thread-BopD-2k1.js} +3 -3
  36. package/dist/owletto/dist/assets/{app._appId-BUcNaSMS.js → app._appId-BXeFXW1w.js} +2 -2
  37. package/dist/owletto/dist/assets/{assist-composer-B1LykXpD.js → assist-composer-CL5x8pNt.js} +2 -2
  38. package/dist/owletto/dist/assets/automation-run-now-MtxUTfzd.js +2 -0
  39. package/dist/owletto/dist/assets/{callback-kSLa4n5s.js → callback-BgfwP1Eo.js} +2 -2
  40. package/dist/owletto/dist/assets/{card-C01y1O-W.js → card-DtLIFq7D.js} +2 -2
  41. package/dist/owletto/dist/assets/{claim-Dnux9Lqf.js → claim-CT3hYVMF.js} +2 -2
  42. package/dist/owletto/dist/assets/{client-activity-scopes-BBIq16tG.js → client-activity-scopes-BPbRX-Pe.js} +2 -2
  43. package/dist/owletto/dist/assets/{client-rows-DGh1O-Fu.js → client-rows-vrNA6FLs.js} +2 -2
  44. package/dist/owletto/dist/assets/clients-xnzZeEdZ.js +2 -0
  45. package/dist/owletto/dist/assets/{code-editor-BdRMYojw.js → code-editor-mrKkAfcE.js} +2 -2
  46. package/dist/owletto/dist/assets/connect-NUCSay8X.js +2 -0
  47. package/dist/owletto/dist/assets/{connect-menu-D4w-JhJW.js → connect-menu-C6iVtuSo.js} +2 -2
  48. package/dist/owletto/dist/assets/connect._clientId-Cp-d9Q5b.js +2 -0
  49. package/dist/owletto/dist/assets/{connected._clientId-BsDzltNz.js → connected._clientId-ROfVgp9h.js} +2 -2
  50. package/dist/owletto/dist/assets/connection-BMz740Wi.js +2 -0
  51. package/dist/owletto/dist/assets/{connection-feed-detail-CJju0qiw.js → connection-feed-detail-0VAJiZTP.js} +2 -2
  52. package/dist/owletto/dist/assets/connector-page-shell-BFv21yuv.js +2 -0
  53. package/dist/owletto/dist/assets/{connector-provenance-B2C2cjBg.js → connector-provenance-b59RfBtk.js} +2 -2
  54. package/dist/owletto/dist/assets/connectors-nYS31lO2.js +2 -0
  55. package/dist/owletto/dist/assets/consent-cPRF9JQv.js +2 -0
  56. package/dist/owletto/dist/assets/{copy-button-BhXeXLIm.js → copy-button-C3wMMv63.js} +2 -2
  57. package/dist/owletto/dist/assets/{core.esm-CJUp2aNZ.js → core.esm-C9QlSrgK.js} +3 -3
  58. package/dist/owletto/dist/assets/{create-DUlRsFNn.js → create-ASRN3Obq.js} +2 -2
  59. package/dist/owletto/dist/assets/create-CBcodaSO.js +2 -0
  60. package/dist/owletto/dist/assets/create-CGOWfMk4.js +2 -0
  61. package/dist/owletto/dist/assets/{create-automation-form-D141prEG.js → create-automation-form-CLicoPH5.js} +3 -3
  62. package/dist/owletto/dist/assets/create._connectorKey-s4xkktTC.js +2 -0
  63. package/dist/owletto/dist/assets/{custom-guardrail-edits-DuQ28xv3.js → custom-guardrail-edits-BUL7nmuO.js} +2 -2
  64. package/dist/owletto/dist/assets/{definition-comparison-BUDNuAN_.js → definition-comparison-4UYMI6BK.js} +2 -2
  65. package/dist/owletto/dist/assets/{detail-page-skeleton-BRHaq5Sj.js → detail-page-skeleton-C8v3rJXK.js} +2 -2
  66. package/dist/owletto/dist/assets/device-BBwsOi7q.js +2 -0
  67. package/dist/owletto/dist/assets/{device-pin-tombstone-BIM-ziCH.js → device-pin-tombstone-Bcpe7nAA.js} +2 -2
  68. package/dist/owletto/dist/assets/{device._deviceId-BnPqTgK1.js → device._deviceId-DLT4jh0Z.js} +2 -2
  69. package/dist/owletto/dist/assets/{dynamic-schema-form-OkIZImgp.js → dynamic-schema-form-BDT8x0Vg.js} +2 -2
  70. package/dist/owletto/dist/assets/{entity-options-CpeX7iiX.js → entity-options-B9hm9V87.js} +2 -2
  71. package/dist/owletto/dist/assets/entity-page-DZjzQ2V4.js +2 -0
  72. package/dist/owletto/dist/assets/entity-pages-BWBpttz3.js +2 -0
  73. package/dist/owletto/dist/assets/entity-schema-graph-lMMx3HhR.js +2 -0
  74. package/dist/owletto/dist/assets/{entity-type-page-MgZ7_0oh.js → entity-type-page-CkQm0yEu.js} +2 -2
  75. package/dist/owletto/dist/assets/{event-detail-D6AH6a2C.js → event-detail-CkzfakTK.js} +2 -2
  76. package/dist/owletto/dist/assets/events-feed-DmRzikZW.js +2 -0
  77. package/dist/owletto/dist/assets/{filter-editors-DDTwyYt0.js → filter-editors-CQoSj-20.js} +3 -3
  78. package/dist/owletto/dist/assets/{full-page-spinner-DWo519BU.js → full-page-spinner-CYyCnKve.js} +2 -2
  79. package/dist/owletto/dist/assets/index-BE7eb2kE.js +2 -0
  80. package/dist/owletto/dist/assets/index-BFR0uiKY.js +2 -0
  81. package/dist/owletto/dist/assets/{index-Cd8jMsz8.js → index-BS5Ty3tf.js} +2 -2
  82. package/dist/owletto/dist/assets/index-C38OzBpB.js +2 -0
  83. package/dist/owletto/dist/assets/{index-D1UCJQl1.js → index-C3hz9tzx.js} +2 -2
  84. package/dist/owletto/dist/assets/index-CDyFQ32o.js +2 -0
  85. package/dist/owletto/dist/assets/{index-BW7IFKXC.js → index-CUndAH6o.js} +2 -2
  86. package/dist/owletto/dist/assets/index-CiKysEhV.js +2 -0
  87. package/dist/owletto/dist/assets/{index-CdDNNAx2.js → index-DByaMzsG.js} +274 -274
  88. package/dist/owletto/dist/assets/index-DfdinB7B.js +2 -0
  89. package/dist/owletto/dist/assets/index-DgMM4Zt5.css +1 -0
  90. package/dist/owletto/dist/assets/index-Xk711gVC.js +2 -0
  91. package/dist/owletto/dist/assets/{index-DmqnKGqW.js → index-ittfA0k8.js} +2 -2
  92. package/dist/owletto/dist/assets/{json-diff-C-WQqyIf.js → json-diff-mcDgyct_.js} +2 -2
  93. package/dist/owletto/dist/assets/{list-skeleton-0B1bTrAK.js → list-skeleton-DsYGUHxi.js} +2 -2
  94. package/dist/owletto/dist/assets/login-EoLq136v.js +2 -0
  95. package/dist/owletto/dist/assets/{logout-D474YsYQ.js → logout-gLgEQOiX.js} +2 -2
  96. package/dist/owletto/dist/assets/{member-scope-gate-CH_0jHiM.js → member-scope-gate-vvkgSAb2.js} +2 -2
  97. package/dist/owletto/dist/assets/memory-browse-page-DvDtwrEI.js +74 -0
  98. package/dist/owletto/dist/assets/{model-selector-XYmk7Iru.js → model-selector-D3vSMLO2.js} +2 -2
  99. package/dist/owletto/dist/assets/{needs-you-list-Bd4iiiqm.js → needs-you-list-B5Bgd05M.js} +2 -2
  100. package/dist/owletto/dist/assets/{new-CJ6TF3Vc.js → new-BPW3V0Y1.js} +2 -2
  101. package/dist/owletto/dist/assets/new-Bk_flKQO.js +2 -0
  102. package/dist/owletto/dist/assets/new-C5HtQdM_.js +2 -0
  103. package/dist/owletto/dist/assets/new-dLXsCHBd.js +2 -0
  104. package/dist/owletto/dist/assets/organization-DBfgBkzq.js +2 -0
  105. package/dist/owletto/dist/assets/{peek-pane-content-Cc8YX1oy.js → peek-pane-content-c2PG3TEX.js} +2 -2
  106. package/dist/owletto/dist/assets/{pending-seed-D7-ld7as.js → pending-seed-CBhx2Ql-.js} +2 -2
  107. package/dist/owletto/dist/assets/{proposal-review-shell-BWRJidwb.js → proposal-review-shell-B-jYcKfB.js} +2 -2
  108. package/dist/owletto/dist/assets/public-shell-ready-D8TijlRY.js +2 -0
  109. package/dist/owletto/dist/assets/record-activity-DnRVOrG2.js +2 -0
  110. package/dist/owletto/dist/assets/{record-session-ClKBr1_C.js → record-session-CAmGHMyM.js} +2 -2
  111. package/dist/owletto/dist/assets/{renderer-DZ0w2k2r.js → renderer-olRv_HMI.js} +3 -3
  112. package/dist/owletto/dist/assets/reset-password-B9_xi8Pq.js +2 -0
  113. package/dist/owletto/dist/assets/{run-initiator-B8IRlRd-.js → run-initiator-DhE5v4z0.js} +2 -2
  114. package/dist/owletto/dist/assets/runs-C8sZQr4o.js +2 -0
  115. package/dist/owletto/dist/assets/{runs-list-8gUPWjP4.js → runs-list-CwtH-wmk.js} +2 -2
  116. package/dist/owletto/dist/assets/{schema-value-k19Ata7u.js → schema-value-zTJGE4eh.js} +3 -3
  117. package/dist/owletto/dist/assets/{scoped-feed-bar-L7h-Ca4u.js → scoped-feed-bar-BKyJSa3_.js} +2 -2
  118. package/dist/owletto/dist/assets/{settings-BZqntV3E.js → settings-z02cvVS3.js} +2 -2
  119. package/dist/owletto/dist/assets/source-record-panels-CGmKIJdN.js +2 -0
  120. package/dist/owletto/dist/assets/{status-variants-BR_iGWN5.js → status-variants-DyRCXBzM.js} +2 -2
  121. package/dist/owletto/dist/assets/subDays-D8nHthaS.js +2 -0
  122. package/dist/owletto/dist/assets/{table-C3DMoL4K.js → table-C637cQxG.js} +2 -2
  123. package/dist/owletto/dist/assets/use-automations-CgWNoYio.js +2 -0
  124. package/dist/owletto/dist/assets/use-login-redirect-tDdhXTpt.js +2 -0
  125. package/dist/owletto/dist/assets/{use-mention-search-CtbixPEE.js → use-mention-search-D-kIKchD.js} +2 -2
  126. package/dist/owletto/dist/assets/view-param-filters-CUCj9Df-.js +2 -0
  127. package/dist/owletto/dist/assets/{views-access-required-CvIIxdS_.js → views-access-required-C35Dyt91.js} +2 -2
  128. package/dist/owletto/dist/index.html +2 -2
  129. package/dist/server-main.bundle.mjs +2733 -1795
  130. package/npm-shrinkwrap.json +238 -221
  131. package/package.json +1 -1
  132. package/vendor/connector-sdk/dist/connector-types.d.ts +6 -0
  133. package/vendor/connector-sdk/dist/index.d.ts +1 -0
  134. package/vendor/connector-sdk/dist/index.js +1 -0
  135. package/vendor/connector-sdk/dist/ip-reachability.d.ts +1 -1
  136. package/vendor/connector-sdk/dist/ip-reachability.js +1 -1
  137. package/vendor/connector-sdk/dist/logger.d.ts +1 -1
  138. package/vendor/connector-sdk/dist/logger.js +1 -1
  139. package/vendor/connector-sdk/dist/reaction-client-types.d.ts +3 -1
  140. package/vendor/connector-sdk/dist/retry.d.ts +1 -1
  141. package/vendor/connector-sdk/dist/retry.js +1 -1
  142. package/vendor/connector-sdk/dist/source-withheld-error.d.ts +16 -0
  143. package/vendor/connector-sdk/dist/source-withheld-error.js +19 -0
  144. package/vendor/connector-sdk/package.json +1 -1
  145. package/vendor/core/dist/classify-error.d.ts +1 -1
  146. package/vendor/core/dist/classify-error.js +2 -2
  147. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +28 -3
  148. package/vendor/core/dist/contracts/tools/manage-automations.js +27 -8
  149. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +8 -0
  150. package/vendor/core/dist/contracts/tools/manage-entity.js +11 -3
  151. package/vendor/core/dist/contracts/tools/save-memory.d.ts +11 -1
  152. package/vendor/core/dist/contracts/tools/save-memory.js +25 -3
  153. package/vendor/core/dist/contracts/tools/search-memory.js +1 -1
  154. package/vendor/core/dist/credentials.d.ts +12 -0
  155. package/vendor/core/dist/credentials.js +1 -0
  156. package/vendor/core/dist/errors.js +2 -2
  157. package/vendor/core/dist/worker/auth.d.ts +5 -0
  158. package/vendor/core/dist/worker/auth.js +15 -4
  159. package/vendor/core/package.json +1 -1
  160. package/vendor/postgres/cf/src/connection.js +7 -2
  161. package/vendor/postgres/cjs/src/connection.js +7 -2
  162. package/vendor/postgres/src/connection.js +7 -2
  163. package/vendor/views/dist/native.d.ts +33 -1
  164. package/vendor/views/dist/native.js +3 -0
  165. package/vendor/views/package.json +1 -1
  166. package/dist/owletto/dist/assets/_-B2C9B2RM.js +0 -2
  167. package/dist/owletto/dist/assets/_-CjyiGzwB.js +0 -3
  168. package/dist/owletto/dist/assets/_agentId-DKHXGvS2.js +0 -2
  169. package/dist/owletto/dist/assets/_automationId-CowRFD4E.js +0 -2
  170. package/dist/owletto/dist/assets/_connectorKey._connectionId-dE6im18z.js +0 -2
  171. package/dist/owletto/dist/assets/_connectorKey.index-DqwSv8Zs.js +0 -2
  172. package/dist/owletto/dist/assets/_eventId-BVOVizs4.js +0 -2
  173. package/dist/owletto/dist/assets/_owner-DsvIC94q.js +0 -3
  174. package/dist/owletto/dist/assets/_shape-CWjpzcvv.js +0 -2
  175. package/dist/owletto/dist/assets/_slug-DuCxYsJk.js +0 -2
  176. package/dist/owletto/dist/assets/_viewKey-BqVeHB6Z.js +0 -2
  177. package/dist/owletto/dist/assets/_viewKey-DzyOCG5U.js +0 -2
  178. package/dist/owletto/dist/assets/accept-invitation-k1u3zBcn.js +0 -2
  179. package/dist/owletto/dist/assets/activity-route-view-jTBMW7a9.js +0 -2
  180. package/dist/owletto/dist/assets/agent-connect-pages-D3mVM_q4.js +0 -4
  181. package/dist/owletto/dist/assets/agent-permissions-matrix-C_ayr0pd.js +0 -2
  182. package/dist/owletto/dist/assets/automation-run-now-CjkJIkaZ.js +0 -2
  183. package/dist/owletto/dist/assets/clients-BCvjAJDT.js +0 -2
  184. package/dist/owletto/dist/assets/connect-DZeFSGIH.js +0 -2
  185. package/dist/owletto/dist/assets/connect._clientId-IZEMQJ64.js +0 -2
  186. package/dist/owletto/dist/assets/connection-C7glVpPE.js +0 -2
  187. package/dist/owletto/dist/assets/connector-page-shell-BeuyjiB2.js +0 -2
  188. package/dist/owletto/dist/assets/connectors-DSQ5AWPf.js +0 -2
  189. package/dist/owletto/dist/assets/consent-B6Aw_89N.js +0 -2
  190. package/dist/owletto/dist/assets/create-CWcza8NT.js +0 -2
  191. package/dist/owletto/dist/assets/create-bGOYifof.js +0 -2
  192. package/dist/owletto/dist/assets/create._connectorKey-Ds4tpwHP.js +0 -2
  193. package/dist/owletto/dist/assets/device-D3fzoIrM.js +0 -2
  194. package/dist/owletto/dist/assets/entity-page-Cjc8oXA2.js +0 -2
  195. package/dist/owletto/dist/assets/entity-pages-18xSANrS.js +0 -2
  196. package/dist/owletto/dist/assets/entity-schema-graph-uwZ-P0t8.js +0 -2
  197. package/dist/owletto/dist/assets/events-feed-BI7wNRUY.js +0 -2
  198. package/dist/owletto/dist/assets/index-9tTjJo_J.css +0 -1
  199. package/dist/owletto/dist/assets/index-BYcFrinP.js +0 -2
  200. package/dist/owletto/dist/assets/index-BhJsTy-C.js +0 -2
  201. package/dist/owletto/dist/assets/index-CEcsgXDj.js +0 -2
  202. package/dist/owletto/dist/assets/index-CPscKk2u.js +0 -2
  203. package/dist/owletto/dist/assets/index-CfJ2-EpK.js +0 -2
  204. package/dist/owletto/dist/assets/index-D5DM4g2w.js +0 -2
  205. package/dist/owletto/dist/assets/index-DznAbTOF.js +0 -2
  206. package/dist/owletto/dist/assets/login-CH7P2AyR.js +0 -2
  207. package/dist/owletto/dist/assets/memory-browse-page-Ba4aYavw.js +0 -74
  208. package/dist/owletto/dist/assets/new-BOsrRqp8.js +0 -2
  209. package/dist/owletto/dist/assets/new-DGPOjak2.js +0 -2
  210. package/dist/owletto/dist/assets/new-Q0XqiZq2.js +0 -2
  211. package/dist/owletto/dist/assets/organization-hD_Z6TSd.js +0 -2
  212. package/dist/owletto/dist/assets/public-shell-ready-CRyAZATw.js +0 -2
  213. package/dist/owletto/dist/assets/record-activity-9ux6SfCd.js +0 -2
  214. package/dist/owletto/dist/assets/reset-password-D2RfrEVZ.js +0 -2
  215. package/dist/owletto/dist/assets/runs-CuC7WMtd.js +0 -2
  216. package/dist/owletto/dist/assets/source-record-panels-C4UItfdk.js +0 -2
  217. package/dist/owletto/dist/assets/subDays-hOwerOLo.js +0 -2
  218. package/dist/owletto/dist/assets/use-automations-CdtiVLCv.js +0 -2
  219. package/dist/owletto/dist/assets/use-login-redirect-CYlVkAhE.js +0 -2
  220. package/dist/owletto/dist/assets/view-param-filters-BdN8OU35.js +0 -2
  221. /package/vendor/postgres/{.bun-tag-c81dacd34e959a7a → .bun-tag-652f2580b8090d71} +0 -0
@@ -1,4 +1,4 @@
1
- import{r as $t,j as yu,i as bu}from"./index-CdDNNAx2.js";import{k as Su,b as Qu,s as ku}from"./index-Vcq4gwWv.js";let Or=[],lh=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?lh:Or).push(t=t+n[e])})();function wu(n){if(n<768)return!1;for(let e=0,t=Or.length;;){let i=e+t>>1;if(n<Or[i])t=i;else if(n>=lh[i])e=i+1;else return!0;if(e==t)return!1}}function sl(n){return n>=127462&&n<=127487}const rl=8205;function vu(n,e,t=!0,i=!0){return(t?ah:$u)(n,e,i)}function ah(n,e,t){if(e==n.length)return e;e&&hh(n.charCodeAt(e))&&ch(n.charCodeAt(e-1))&&e--;let i=Ls(n,e);for(e+=ol(i);e<n.length;){let s=Ls(n,e);if(i==rl||s==rl||t&&wu(s))e+=ol(s),i=s;else if(sl(s)){let r=0,o=e-2;for(;o>=0&&sl(Ls(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function $u(n,e,t){for(;e>0;){let i=ah(n,e-2,t);if(i<e)return i;e--}return 0}function Ls(n,e){let t=n.charCodeAt(e);if(!ch(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return hh(i)?(t-55296<<10)+(i-56320)+65536:t}function hh(n){return n>=56320&&n<57344}function ch(n){return n>=55296&&n<56320}function ol(n){return n<65536?1:2}class E{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=li(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Ue.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=li(this,e,t);let i=[];return this.decompose(e,t,i,0),Ue.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new Ci(this),r=new Ci(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new Ci(this,e)}iterRange(e,t=this.length){return new fh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new uh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?E.empty:e.length<=32?new H(e):Ue.from(H.split(e,[]))}}class H extends E{constructor(e,t=Pu(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Tu(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new H(ll(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Mn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new H(l,o.length+r.length));else{let a=l.length>>1;i.push(new H(l.slice(0,a)),new H(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof H))return super.replace(e,t,i);[e,t]=li(this,e,t);let s=Mn(this.text,Mn(i.text,ll(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new H(s,r):Ue.from(H.split(s,[]),r)}sliceString(e,t=this.length,i=`
1
+ import{r as $t,j as yu,i as bu}from"./index-DByaMzsG.js";import{k as Su,b as Qu,s as ku}from"./index-Vcq4gwWv.js";let Or=[],lh=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?lh:Or).push(t=t+n[e])})();function wu(n){if(n<768)return!1;for(let e=0,t=Or.length;;){let i=e+t>>1;if(n<Or[i])t=i;else if(n>=lh[i])e=i+1;else return!0;if(e==t)return!1}}function sl(n){return n>=127462&&n<=127487}const rl=8205;function vu(n,e,t=!0,i=!0){return(t?ah:$u)(n,e,i)}function ah(n,e,t){if(e==n.length)return e;e&&hh(n.charCodeAt(e))&&ch(n.charCodeAt(e-1))&&e--;let i=Ls(n,e);for(e+=ol(i);e<n.length;){let s=Ls(n,e);if(i==rl||s==rl||t&&wu(s))e+=ol(s),i=s;else if(sl(s)){let r=0,o=e-2;for(;o>=0&&sl(Ls(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function $u(n,e,t){for(;e>0;){let i=ah(n,e-2,t);if(i<e)return i;e--}return 0}function Ls(n,e){let t=n.charCodeAt(e);if(!ch(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return hh(i)?(t-55296<<10)+(i-56320)+65536:t}function hh(n){return n>=56320&&n<57344}function ch(n){return n>=55296&&n<56320}function ol(n){return n<65536?1:2}class E{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=li(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Ue.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=li(this,e,t);let i=[];return this.decompose(e,t,i,0),Ue.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new Ci(this),r=new Ci(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new Ci(this,e)}iterRange(e,t=this.length){return new fh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new uh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?E.empty:e.length<=32?new H(e):Ue.from(H.split(e,[]))}}class H extends E{constructor(e,t=Pu(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Tu(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new H(ll(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Mn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new H(l,o.length+r.length));else{let a=l.length>>1;i.push(new H(l.slice(0,a)),new H(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof H))return super.replace(e,t,i);[e,t]=li(this,e,t);let s=Mn(this.text,Mn(i.text,ll(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new H(s,r):Ue.from(H.split(s,[]),r)}sliceString(e,t=this.length,i=`
2
2
  `){[e,t]=li(this,e,t);let s="";for(let r=0,o=0;r<=t&&o<this.text.length;o++){let l=this.text[o],a=r+l.length;r>e&&o&&(s+=i),e<a&&t>r&&(s+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new H(i,s)),i=[],s=-1);return s>-1&&t.push(new H(i,s)),t}}class Ue extends E{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=a+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r<this.children.length;r++){let l=this.children[r],a=o+l.length;if(e<=a&&t>=o){let h=s&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=li(this,e,t),i.lines<this.lines)for(let s=0,r=0;s<this.children.length;s++){let o=this.children[s],l=r+o.length;if(e>=r&&t<=l){let a=o.replace(e-r,t-r,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let c=this.children.slice();return c[s]=a,new Ue(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
3
3
  `){[e,t]=li(this,e,t);let s="";for(let r=0,o=0;r<this.children.length&&o<=t;r++){let l=this.children[r],a=o+l.length;o>e&&r&&(s+=i),e<a&&t>o&&(s+=l.sliceString(e-o,t-o,i)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ue))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let a=this.children[s],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let O of e)O.flatten(d);return new H(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(d){let O;if(d.lines>r&&d instanceof Ue)for(let p of d.children)f(p);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof H&&a&&(O=c[c.length-1])instanceof H&&d.lines+O.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new H(O.text.concat(d.text),O.length+1+d.length)):(a+d.lines>s&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:Ue.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new Ue(l,t)}}E.empty=new H([""],0);function Pu(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Mn(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r<n.length&&s<=i;r++){let l=n[r],a=s+l.length;a>=t&&(a>i&&(l=l.slice(0,i-s)),s<t&&(l=l.slice(t-s)),o?(e[e.length-1]+=l,o=!1):e.push(l)),s=a+1}return e}function ll(n,e,t){return Mn(n,[""],e,t)}class Ci{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof H?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof H?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
4
4
  `,this;e--}else if(s instanceof H){let a=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=s.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof H?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class fh{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Ci(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class uh{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(E.prototype[Symbol.iterator]=function(){return this.iter()},Ci.prototype[Symbol.iterator]=fh.prototype[Symbol.iterator]=uh.prototype[Symbol.iterator]=function(){return this});class Tu{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}function li(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function se(n,e,t=!0,i=!0){return vu(n,e,t,i)}function Cu(n){return n>=56320&&n<57344}function Zu(n){return n>=55296&&n<56320}function me(n,e){let t=n.charCodeAt(e);if(!Zu(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Cu(i)?(t-55296<<10)+(i-56320)+65536:t}function fo(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Fe(n){return n<65536?1:2}const pr=/\r\n?|\n/;var le=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(le||(le={}));class it{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,s=0;t<this.sections.length;){let r=this.sections[t++],o=this.sections[t++];o<0?(e(i,s,r),s+=r):s+=o,i+=r}}iterChangedRanges(e,t=!1){mr(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];s<0?e.push(i,s):e.push(s,i)}return new it(e)}composeDesc(e){return this.empty?e:e.empty?this:dh(this,e)}mapDesc(e,t=!1){return e.empty?this:gr(this,e,t)}mapPos(e,t=-1,i=le.Simple){let s=0,r=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=s+l;if(a<0){if(h>e)return r+(e-s);r+=l}else{if(i!=le.Simple&&h>=e&&(i==le.TrackDel&&s<e&&h>e||i==le.TrackBefore&&s<e||i==le.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i<this.sections.length&&s<=t;){let r=this.sections[i++],o=this.sections[i++],l=s+r;if(o>=0&&s<=t&&l>=e)return s<e&&l>t?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];e+=(e?" ":"")+i+(s>=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new it(e)}static create(e){return new it(e)}}class ie extends it{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return mr(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return gr(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s<t.length;s+=2){let o=t[s],l=t[s+1];if(l>=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;i.length<a;)i.push(E.empty);i.push(o?e.slice(r,r+o):E.empty)}r+=o}return new ie(t,i)}compose(e){return this.empty?e:e.empty?this:dh(this,e,!0)}map(e,t=!1){return e.empty?this:gr(this,e,t,!0)}iterChanges(e,t=!1){mr(this,e,t)}get desc(){return it.create(this.sections)}filter(e){let t=[],i=[],s=[],r=new Wi(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&r.len==0;){if(r.done)break e;let c=Math.min(r.len,a-l);he(s,c,-1);let f=r.ins==-1?-1:r.off==0?r.ins:0;he(t,c,f),f>0&&Ot(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l<h;){if(r.done)break e;let c=Math.min(r.len,h-l);he(t,c,-1),he(s,c,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(c),l+=c}}return{changes:new ie(t,i),filtered:it.create(s)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],s=this.sections[t+1];s<0?e.push(i):s==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;o<t&&he(s,t-o,-1);let f=new ie(s,r);l=l?l.compose(f.map(l)):f,s=[],r=[],o=0}function h(c){if(Array.isArray(c))for(let f of c)h(f);else if(c instanceof ie){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:f,to:u=f,insert:d}=c;if(f>u||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let O=d?typeof d=="string"?E.of(d.split(i||pr)):d:E.empty,p=O.length;if(f==u&&p==0)return;f<o&&a(),f>o&&he(s,f-o,-1),he(s,u-f,p),Ot(r,s,O),o=u}}return h(e),a(!l),l}static empty(e){return new ie(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;s<e.length;s++){let r=e[s];if(typeof r=="number")t.push(r,-1);else{if(!Array.isArray(r)||typeof r[0]!="number"||r.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length<s;)i.push(E.empty);i[s]=E.of(r.slice(1)),t.push(r[0],i[s].length)}}}return new ie(t,i)}static createSet(e,t){return new ie(e,t)}}function he(n,e,t,i=!1){if(e==0&&t<=0)return;let s=n.length-2;s>=0&&t<=0&&t==n[s+1]?n[s]+=e:s>=0&&e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function Ot(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(E.empty);n.push(t)}}function mr(n,e,t){let i=n.inserted;for(let s=0,r=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)s+=l,r+=l;else{let h=s,c=r,f=E.empty;for(;h+=l,c+=a,a&&i&&(f=f.append(i[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(s,h,r,c,f),s=h,r=c}}}function gr(n,e,t,i=!1){let s=[],r=i?[]:null,o=new Wi(n),l=new Wi(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);he(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let h=l.len;for(he(s,l.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=c&&(he(s,0,o.ins),r&&Ot(r,s,o.text),a=o.i),o.forward(c),h-=c}l.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;he(s,h,a<o.i?o.ins:0),r&&a<o.i&&Ot(r,s,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return r?ie.createSet(s,r):it.create(s);throw new Error("Mismatched change set lengths")}}}function dh(n,e,t=!1){let i=[],s=t?[]:null,r=new Wi(n),o=new Wi(e);for(let l=!1;;){if(r.done&&o.done)return s?ie.createSet(i,s):it.create(i);if(r.ins==0)he(i,r.len,0,l),r.next();else if(o.len==0&&!o.done)he(i,0,o.ins,l),s&&Ot(s,i,o.text),o.next();else{if(r.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(r.len2,o.len),h=i.length;if(r.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;he(i,a,c,l),s&&c&&Ot(s,i,o.text)}else o.ins==-1?(he(i,r.off?0:r.len,a,l),s&&Ot(s,i,r.textBit(a))):(he(i,r.off?0:r.len,o.off?0:o.ins,l),s&&!o.off&&Ot(s,i,o.text));l=(r.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class Wi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?E.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?E.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Rt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new Rt(i,s,this.flags)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return y.range(e,t,void 0,void 0,i);let s=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return y.range(this.anchor,s,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return y.range(e.anchor,e.head)}static create(e,t,i){return new Rt(e,t,i)}}class y{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:y.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new y([this.main],0)}addRange(e,t=!0){return y.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,y.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new y(e.ranges.map(t=>Rt.fromJSON(t)),e.main)}static single(e,t=e){return new y([y.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;s<e.length;s++){let r=e[s];if(r.empty?r.from<=i:r.from<i)return y.normalized(e.slice(),t);i=r.to}return new y(e,t)}static cursor(e,t=0,i,s){return Rt.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(s??16777215)<<6)}static range(e,t,i,s,r){let o=(i??16777215)<<6|(s==null?7:Math.min(6,s));return!r&&e!=t&&(r=t<e?1:-1),t<e?Rt.create(t,e,48|o):Rt.create(e,t,(r?r<0?8:16:0)|o)}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;s<e.length;s++){let r=e[s],o=e[s-1];if(r.empty?r.from<=o.to:r.from<o.to){let l=o.from,a=Math.max(r.to,o.to);s<=t&&t--,e.splice(--s,2,r.anchor>r.head?y.range(a,l):y.range(l,a))}}return new y(e,t)}}function Oh(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let uo=0;class P{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=uo++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new P(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Oo),!!e.static,e.enables)}of(e){return new Rn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Rn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Rn(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Oo(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Rn{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=uo++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||xr(f,c)){let d=i(f);if(l?!al(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,O=u.config.address[r];if(O!=null){let p=Yn(u,O);if(this.dependencies.every(m=>m instanceof P?u.facet(m)===f.facet(m):m instanceof ce?u.field(m,!1)==f.field(m,!1):!0)||(l?al(d=i(f),p,s):s(d=i(f),p)))return f.values[o]=p,0}else d=i(f);return f.values[o]=d,1}}}}function al(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function xr(n,e){let t=!1;for(let i of e)Zi(n,i)&1&&(t=!0);return t}function Au(n,e,t){let i=t.map(a=>n[a.id]),s=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;c<i.length;c++){let f=Yn(a,i[c]);if(s[c]==2)for(let u of f)h.push(u);else h.push(f)}return e.combine(h)}return{create(a){for(let h of i)Zi(a,h);return a.values[o]=l(a),1},update(a,h){if(!xr(a,r))return 0;let c=l(a);return e.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,h){let c=xr(a,i),f=h.config.facets[e.id],u=h.facet(e);if(f&&!c&&Oo(t,f))return a.values[o]=u,0;let d=l(a);return e.compare(d,u)?(a.values[o]=u,0):(a.values[o]=d,1)}}}const hn=P.define({static:!0});class ce{constructor(e,t,i,s,r){this.id=e,this.createF=t,this.updateF=i,this.compareF=s,this.spec=r,this.provides=void 0}static define(e){let t=new ce(uo++,e.create,e.update,e.compare||((i,s)=>i===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(hn).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>{let r=i.facet(hn),o=s.facet(hn),l;return(l=r.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,hn.of({field:this,create:e})]}get extension(){return this}}const At={lowest:4,low:3,default:2,high:1,highest:0};function bi(n){return e=>new ph(e,n)}const kt={highest:bi(At.highest),high:bi(At.high),default:bi(At.default),low:bi(At.low),lowest:bi(At.lowest)};class ph{constructor(e,t){this.inner=e,this.prec=t}}class ps{of(e){return new yr(this,e)}reconfigure(e){return ps.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class yr{constructor(e,t){this.compartment=e,this.inner=t}}class Bn{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of Mu(e,t,o))u instanceof ce?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of s)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i?.config.facets;for(let u in r){let d=r[u],O=d[0].facet,p=c&&c[u]||[];if(d.every(m=>m.type==0))if(l[O.id]=a.length<<1|1,Oo(p,d))a.push(i.facet(O));else{let m=O.combine(d.map(x=>x.value));a.push(i&&O.compare(m,i.facet(O))?i.facet(O):m)}else{for(let m of d)m.type==0?(l[m.id]=a.length<<1|1,a.push(m.value)):(l[m.id]=h.length<<1,h.push(x=>m.dynamicSlot(x)));l[O.id]=h.length<<1,h.push(m=>Au(m,O,d))}}let f=h.map(u=>u(l));return new Bn(e,o,f,l,a,r)}}function Mu(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof yr&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof yr){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof ph)r(o.inner,o.prec);else if(o instanceof ce)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Rn)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,At.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(n,At.default),i.reduce((o,l)=>o.concat(l))}function Zi(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function Yn(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const mh=P.define(),br=P.define({combine:n=>n.some(e=>e),static:!0}),gh=P.define({combine:n=>n.length?n[0]:void 0,static:!0}),xh=P.define(),yh=P.define(),bh=P.define(),Sh=P.define({combine:n=>n.length?n[0]:!1});class ct{constructor(e,t){this.type=e,this.value=t}static define(){return new Ru}}class Ru{of(e){return new ct(this,e)}}class Xu{constructor(e){this.map=e}of(e){return new M(this,e)}}class M{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new M(this.type,t)}is(e){return this.type==e}static define(e={}){return new Xu(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}M.reconfigure=M.define();M.appendConfig=M.define();class J{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Oh(i,t.newLength),r.some(l=>l.type==J.time)||(this.annotations=r.concat(J.time.of(Date.now())))}static create(e,t,i,s,r,o){return new J(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(J.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}J.time=ct.define();J.userEvent=ct.define();J.addToHistory=ct.define();J.remote=ct.define();function Lu(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i<n.length&&(s==e.length||e[s]>=n[i]))r=n[i++],o=n[i++];else if(s<e.length)r=e[s++],o=e[s++];else return t;!t.length||t[t.length-1]<r?t.push(r,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function Qh(n,e,t){var i;let s,r,o;return t?(s=e.changes,r=ie.empty(e.changes.length),o=n.changes.compose(e.changes)):(s=e.changes.map(n.changes),r=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(s)),{changes:o,selection:e.selection?e.selection.map(r):(i=n.selection)===null||i===void 0?void 0:i.map(s),effects:M.mapEffects(n.effects,s).concat(M.mapEffects(e.effects,r)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function Sr(n,e,t){let i=e.selection,s=Jt(e.annotations);return e.userEvent&&(s=s.concat(J.userEvent.of(e.userEvent))),{changes:e.changes instanceof ie?e.changes:ie.of(e.changes||[],t,n.facet(gh)),selection:i&&(i instanceof y?i:y.single(i.anchor,i.head)),effects:Jt(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function kh(n,e,t){let i=Sr(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let r=1;r<e.length;r++){e[r].filter===!1&&(t=!1);let o=!!e[r].sequential;i=Qh(i,Sr(n,e[r],o?i.changes.newLength:n.doc.length),o)}let s=J.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Wu(t?Du(s):s)}function Du(n){let e=n.startState,t=!0;for(let s of e.facet(xh)){let r=s(n);if(r===!1){t=!1;break}Array.isArray(r)&&(t=t===!0?r:Lu(t,r))}if(t!==!0){let s,r;if(t===!1)r=n.changes.invertedDesc,s=ie.empty(e.doc.length);else{let o=n.changes.filter(t);s=o.changes,r=o.filtered.mapDesc(o.changes).invertedDesc}n=J.create(e,s,n.selection&&n.selection.map(r),M.mapEffects(n.effects,r),n.annotations,n.scrollIntoView)}let i=e.facet(yh);for(let s=i.length-1;s>=0;s--){let r=i[s](n);r instanceof J?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof J?n=r[0]:n=kh(e,Jt(r),!1)}return n}function Wu(n){let e=n.startState,t=e.facet(bh),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=Qh(i,Sr(e,r,n.changes.newLength),!0))}return i==n?n:J.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const Eu=[];function Jt(n){return n==null?Eu:Array.isArray(n)?n:[n]}var G=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(G||(G={}));const zu=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Qr;try{Qr=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Bu(n){if(Qr)return Qr.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||zu.test(t)))return!0}return!1}function Yu(n){return e=>{if(!/\S/.test(e))return G.Space;if(Bu(e))return G.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return G.Word;return G.Other}}class z{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)Zi(this,l<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Zi(this,i),Yn(this,i)}update(...e){return kh(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:s}=t;for(let l of e.effects)l.is(ps.reconfigure)?(t&&(s=new Map,t.compartments.forEach((a,h)=>s.set(h,a)),t=null),s.set(l.value.compartment,l.value.extension)):l.is(M.reconfigure)?(t=null,i=l.value):l.is(M.appendConfig)&&(t=null,i=Jt(i).concat(l.value));let r;t?r=e.startState.values.slice():(t=Bn.resolve(i,s,this),r=new z(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(br)?e.newSelection:e.newSelection.asSingle();new z(t,e.newDoc,o,r,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:y.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=Jt(i.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),h=this.changes(a.changes),c=h.map(s);for(let u=0;u<l;u++)r[u]=r[u].map(c);let f=s.mapDesc(h,!0);r.push(a.range.map(f)),s=s.compose(c),o=M.mapEffects(o,c).concat(M.mapEffects(Jt(a.effects),f))}return{changes:s,selection:y.create(r,t.mainIndex),effects:o}}changes(e=[]){return e instanceof ie?e:ie.of(e,this.doc.length,this.facet(z.lineSeparator))}toText(e){return E.of(e.split(this.facet(z.lineSeparator)||pr))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Zi(this,t),Yn(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let s=e[i];s instanceof ce&&this.config.address[s.id]!=null&&(t[i]=s.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(i){for(let r in i)if(Object.prototype.hasOwnProperty.call(e,r)){let o=i[r],l=e[r];s.push(o.init(a=>o.spec.fromJSON(l,a)))}}return z.create({doc:e.doc,selection:y.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Bn.resolve(e.extensions||[],new Map),i=e.doc instanceof E?e.doc:E.of((e.doc||"").split(t.staticFacet(z.lineSeparator)||pr)),s=e.selection?e.selection instanceof y?e.selection:y.single(e.selection.anchor,e.selection.head):y.single(0);return Oh(s,i.length),t.staticFacet(br)||(s=s.asSingle()),new z(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(z.tabSize)}get lineBreak(){return this.facet(z.lineSeparator)||`
@@ -23,4 +23,4 @@ import{r as $t,j as yu,i as bu}from"./index-CdDNNAx2.js";import{k as Su,b as Qu,
23
23
  }`,{label:"class",detail:"definition",type:"keyword"}),pe('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),pe('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],b1=jf.concat([pe("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),pe("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),pe("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Ya=new Pp,Nf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function vi(n){return(e,t)=>{let i=e.node.getChild("VariableDefinition");return i&&t(i,n),!0}}const S1=["FunctionDeclaration"],Q1={FunctionDeclaration:vi("function"),ClassDeclaration:vi("class"),ClassExpression:()=>!0,EnumDeclaration:vi("constant"),TypeAliasDeclaration:vi("type"),NamespaceDeclaration:vi("namespace"),VariableDefinition(n,e){n.matchContext(S1)||e(n,"variable")},TypeDefinition(n,e){e(n,"type")},__proto__:null};function Gf(n,e){let t=Ya.get(e);if(t)return t;let i=[],s=!0;function r(o,l){let a=n.sliceString(o.from,o.to);i.push({label:a,type:l})}return e.cursor(U.IncludeAnonymous).iterate(o=>{if(s)s=!1;else if(o.name){let l=Q1[o.name];if(l&&l(o,r)||Nf.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of Gf(n,o.node))i.push(l);return!1}}),Ya.set(e,i),i}const _a=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function k1(n){let e=te(n.state).resolveInner(n.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&_a.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let i=[];for(let s=e;s;s=s.parent)Nf.has(s.name)&&(i=i.concat(Gf(n.state.doc,s)));return{options:i,from:t?e.from:n.pos,validFor:_a}}const zt=ui.define({name:"javascript",parser:y1.configure({props:[$s.add({IfStatement:ni({except:/^\s*({|else\b)/}),TryStatement:ni({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Np,SwitchBody:n=>{let e=n.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return n.baseIndent+(t?0:i?1:2)*n.unit},Block:jp({closing:"}"}),ArrowFunction:n=>n.baseIndent+n.unit,"TemplateString BlockComment":()=>null,"Statement Property":ni({except:/^\s*{/}),JSXElement(n){let e=/^\s*<\//.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},JSXEscape(n){let e=/\s*\}/.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},"JSXOpenTag JSXSelfClosingTag"(n){return n.column(n.node.from)+n.unit}}),Ps.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":qc,BlockComment(n){return{from:n.from+2,to:n.to-2}},JSXElement(n){let e=n.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=n.lastChild;return{from:e.to,to:t.type.isError?n.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(n){var e;let t=(e=n.firstChild)===null||e===void 0?void 0:e.nextSibling,i=n.lastChild;return!t||t.type.isError?null:{from:t.to,to:i.type.isError?n.to:i.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Ff={test:n=>/^JSX/.test(n.name),facet:Ec({commentTokens:{block:{open:"{/*",close:"*/}"}}})},w1=zt.configure({dialect:"ts"},"typescript"),v1=zt.configure({dialect:"jsx",props:[Lo.add(n=>n.isTop?[Ff]:void 0)]}),$1=zt.configure({dialect:"jsx ts",props:[Lo.add(n=>n.isTop?[Ff]:void 0)]},"typescript");let Hf=n=>({label:n,type:"keyword"});const Kf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(Hf),P1=Kf.concat(["declare","implements","private","protected","public"].map(Hf));function qa(n={}){let e=n.jsx?n.typescript?$1:v1:n.typescript?w1:zt,t=n.typescript?b1.concat(P1):jf.concat(Kf);return new Do(e,[zt.data.of({autocomplete:nf(Uf,Eo(t))}),zt.data.of({autocomplete:k1}),n.jsx?Z1:[]])}function T1(n){for(;;){if(n.name=="JSXOpenTag"||n.name=="JSXSelfClosingTag"||n.name=="JSXFragmentTag")return n;if(n.name=="JSXEscape"||!n.parent)return null;n=n.parent}}function Va(n,e,t=n.length){for(let i=e?.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return n.sliceString(i.from,Math.min(i.to,t));return""}const C1=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Z1=$.inputHandler.of((n,e,t,i,s)=>{if((C1?n.composing:n.compositionStarted)||n.state.readOnly||e!=t||i!=">"&&i!="/"||!zt.isActiveAt(n.state,e,-1))return!1;let r=s(),{state:o}=r,l=o.changeByRange(a=>{var h;let{head:c}=a,f=te(o).resolveInner(c-1,-1),u;if(f.name=="JSXStartTag"&&(f=f.parent),!(o.doc.sliceString(c-1,c)!=i||f.name=="JSXAttributeValue"&&f.to>c)){if(i==">"&&f.name=="JSXFragmentTag")return{range:a,changes:{from:c,insert:"</>"}};if(i=="/"&&f.name=="JSXStartCloseTag"){let d=f.parent,O=d.parent;if(O&&d.from==c-2&&((u=Va(o.doc,O.firstChild,c))||((h=O.firstChild)===null||h===void 0?void 0:h.name)=="JSXFragmentTag")){let p=`${u}>`;return{range:y.cursor(c+p.length,-1),changes:{from:c,insert:p}}}}else if(i==">"){let d=T1(f);if(d&&d.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(c,c+2))&&(u=Va(o.doc,d,c)))return{range:a,changes:{from:c,insert:`</${u}>`}}}}return{range:a}});return l.changes.empty?!1:(n.dispatch([r,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),A1=ks({String:g.string,Number:g.number,"True False":g.bool,PropertyName:g.propertyName,Null:g.null,", :":g.separator,"[ ]":g.squareBracket,"{ }":g.brace}),M1=Oi.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[A1],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),R1=ui.define({name:"json",parser:M1.configure({props:[$s.add({Object:ni({except:/^\s*\}/}),Array:ni({except:/^\s*\]/})}),Ps.add({"Object Array":qc})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function X1(){return new Do(R1)}const L1=36,Ia=1,D1=2,It=3,cr=4,W1=5,E1=6,z1=7,B1=8,Y1=9,_1=10,q1=11,V1=12,I1=13,j1=14,N1=15,G1=16,U1=17,ja=18,F1=19,Jf=20,eu=21,Na=22,H1=23,K1=24;function oo(n){return n>=65&&n<=90||n>=97&&n<=122||n>=48&&n<=57}function J1(n){return n>=48&&n<=57||n>=97&&n<=102||n>=65&&n<=70}function Zt(n,e,t){for(let i=!1;;){if(n.next<0)return;if(n.next==e&&!i){n.advance();return}i=t&&!i&&n.next==92,n.advance()}}function ex(n,e){e:for(;;){if(n.next<0)return;if(n.next==36){n.advance();for(let t=0;t<e.length;t++){if(n.next!=e.charCodeAt(t))continue e;n.advance()}if(n.next==36){n.advance();return}}else n.advance()}}function tx(n,e){let t="[{<(".indexOf(String.fromCharCode(e)),i=t<0?e:"]}>)".charCodeAt(t);for(;;){if(n.next<0)return;if(n.next==i&&n.peek(1)==39){n.advance(2);return}n.advance()}}function lo(n,e){for(;!(n.next!=95&&!oo(n.next));)e!=null&&(e+=String.fromCharCode(n.next)),n.advance();return e}function ix(n){if(n.next==39||n.next==34||n.next==96){let e=n.next;n.advance(),Zt(n,e,!1)}else lo(n)}function Ga(n,e){for(;n.next==48||n.next==49;)n.advance();e&&n.next==e&&n.advance()}function Ua(n,e){for(;;){if(n.next==46){if(e)break;e=!0}else if(n.next<48||n.next>57)break;n.advance()}if(n.next==69||n.next==101)for(n.advance(),(n.next==43||n.next==45)&&n.advance();n.next>=48&&n.next<=57;)n.advance()}function Fa(n){for(;!(n.next<0||n.next==10);)n.advance()}function Tt(n,e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)==n)return!0;return!1}const fr=` \r
24
24
  `;function tu(n,e,t){let i=Object.create(null);i.true=i.false=W1,i.null=i.unknown=E1;for(let s of n.split(" "))s&&(i[s]=Jf);for(let s of e.split(" "))s&&(i[s]=eu);for(let s of(t||"").split(" "))s&&(i[s]=K1);return i}const nx="array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying ",sx="absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone ",ao={backslashEscapes:!1,hashComments:!1,spaceAfterDashes:!1,slashComments:!1,doubleQuotedStrings:!1,doubleDollarQuotedStrings:!1,unquotedBitLiterals:!1,treatBitsAsBytes:!1,charSetCasts:!1,plsqlQuotingMechanism:!1,operatorChars:"*+-%<>!=&|~^/",specialVar:"?",identifierQuotes:'"',caseInsensitiveIdentifiers:!1,words:tu(sx,nx)};function rx(n,e,t,i){let s={};for(let r in ao)s[r]=(n.hasOwnProperty(r)?n:ao)[r];return e&&(s.words=tu(e,t||"",i)),s}function iu(n){return new xi(e=>{var t;let{next:i}=e;if(e.advance(),Tt(i,fr)){for(;Tt(e.next,fr);)e.advance();e.acceptToken(L1)}else if(i==36&&n.doubleDollarQuotedStrings){let s=lo(e,"");e.next==36&&(e.advance(),ex(e,s),e.acceptToken(It))}else if(i==39||i==34&&n.doubleQuotedStrings)Zt(e,i,n.backslashEscapes),e.acceptToken(It);else if(i==35&&n.hashComments||i==47&&e.next==47&&n.slashComments)Fa(e),e.acceptToken(Ia);else if(i==45&&e.next==45&&(!n.spaceAfterDashes||e.peek(1)==32))Fa(e),e.acceptToken(Ia);else if(i==47&&e.next==42){e.advance();for(let s=1;;){let r=e.next;if(e.next<0)break;if(e.advance(),r==42&&e.next==47){if(s--,e.advance(),!s)break}else r==47&&e.next==42&&(s++,e.advance())}e.acceptToken(D1)}else if((i==101||i==69)&&e.next==39)e.advance(),Zt(e,39,!0),e.acceptToken(It);else if((i==110||i==78)&&e.next==39&&n.charSetCasts)e.advance(),Zt(e,39,n.backslashEscapes),e.acceptToken(It);else if(i==95&&n.charSetCasts)for(let s=0;;s++){if(e.next==39&&s>1){e.advance(),Zt(e,39,n.backslashEscapes),e.acceptToken(It);break}if(!oo(e.next))break;e.advance()}else if(n.plsqlQuotingMechanism&&(i==113||i==81)&&e.next==39&&e.peek(1)>0&&!Tt(e.peek(1),fr)){let s=e.peek(1);e.advance(2),tx(e,s),e.acceptToken(It)}else if(Tt(i,n.identifierQuotes)){const s=i==91?93:i;Zt(e,s,!1),e.acceptToken(F1)}else if(i==40)e.acceptToken(z1);else if(i==41)e.acceptToken(B1);else if(i==123)e.acceptToken(Y1);else if(i==125)e.acceptToken(_1);else if(i==91)e.acceptToken(q1);else if(i==93)e.acceptToken(V1);else if(i==59)e.acceptToken(I1);else if(n.unquotedBitLiterals&&i==48&&e.next==98)e.advance(),Ga(e),e.acceptToken(Na);else if((i==98||i==66)&&(e.next==39||e.next==34)){const s=e.next;e.advance(),n.treatBitsAsBytes?(Zt(e,s,n.backslashEscapes),e.acceptToken(H1)):(Ga(e,s),e.acceptToken(Na))}else if(i==48&&(e.next==120||e.next==88)||(i==120||i==88)&&e.next==39){let s=e.next==39;for(e.advance();J1(e.next);)e.advance();s&&e.next==39&&e.advance(),e.acceptToken(cr)}else if(i==46&&e.next>=48&&e.next<=57)Ua(e,!0),e.acceptToken(cr);else if(i==46)e.acceptToken(j1);else if(i>=48&&i<=57)Ua(e,!1),e.acceptToken(cr);else if(Tt(i,n.operatorChars)){for(;Tt(e.next,n.operatorChars);)e.advance();e.acceptToken(N1)}else if(Tt(i,n.specialVar))e.next==i&&e.advance(),ix(e),e.acceptToken(U1);else if(i==58||i==44)e.acceptToken(G1);else if(oo(i)){let s=lo(e,String.fromCharCode(i));e.acceptToken(e.next==46||e.peek(-s.length-1)==46?ja:(t=n.words[s.toLowerCase()])!==null&&t!==void 0?t:ja)}})}const nu=iu(ao),ox=Oi.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:"⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",maxTerm:38,nodeProps:[["isolate",-4,1,2,3,19,""]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:"RORO",tokenizers:[0,nu],topRules:{Script:[0,25]},tokenPrec:0});function ho(n){let e=n.cursor().moveTo(n.from,-1);for(;/Comment/.test(e.name);)e.moveTo(e.from,-1);return e.node}function Ui(n,e){let t=n.sliceString(e.from,e.to),i=/^([`'"\[])(.*)([`'"\]])$/.exec(t);return i?i[2]:t}function as(n){return n&&(n.name=="Identifier"||n.name=="QuotedIdentifier")}function lx(n,e){if(e.name=="CompositeIdentifier"){let t=[];for(let i=e.firstChild;i;i=i.nextSibling)as(i)&&t.push(Ui(n,i));return t}return[Ui(n,e)]}function Ha(n,e){for(let t=[];;){if(!e||e.name!=".")return t;let i=ho(e);if(!as(i))return t;t.unshift(Ui(n,i)),e=ho(i)}}function ax(n,e){let t=te(n).resolveInner(e,-1),i=cx(n.doc,t);return t.name=="Identifier"||t.name=="QuotedIdentifier"||t.name=="Keyword"?{from:t.from,quoted:t.name=="QuotedIdentifier"?n.doc.sliceString(t.from,t.from+1):null,parents:Ha(n.doc,ho(t)),aliases:i}:t.name=="."?{from:e,quoted:null,parents:Ha(n.doc,t),aliases:i}:{from:e,quoted:null,parents:[],empty:!0,aliases:i}}const hx=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" "));function cx(n,e){let t;for(let s=e;!t;s=s.parent){if(!s)return null;s.name=="Statement"&&(t=s)}let i=null;for(let s=t.firstChild,r=!1,o=null;s;s=s.nextSibling){let l=s.name=="Keyword"?n.sliceString(s.from,s.to).toLowerCase():null,a=null;if(!r)r=l=="from";else if(l=="as"&&o&&as(s.nextSibling))a=Ui(n,s.nextSibling);else{if(l&&hx.has(l))break;o&&as(s)&&(a=Ui(n,s))}a&&(i||(i=Object.create(null)),i[a]=lx(n,o)),o=/Identifier$/.test(s.name)?s:null}return i}function fx(n,e,t){return t.map(i=>({...i,label:i.label[0]==n?i.label:n+i.label+e,apply:void 0}))}const ux=/^\w*$/,dx=/^[`'"\[]?\w*[`'"\]]?$/;function Ka(n){return n.self&&typeof n.self.label=="string"}class Fo{constructor(e,t){this.idQuote=e,this.idCaseInsensitive=t,this.list=[],this.children=void 0}child(e){let t=this.children||(this.children=Object.create(null)),i=t[e];return i||(e&&!this.list.some(s=>s.label==e)&&this.list.push(Ja(e,"type",this.idQuote,this.idCaseInsensitive)),t[e]=new Fo(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let t=this.list.findIndex(i=>i.label==e.label);t>-1?this.list[t]=e:this.list.push(e)}addCompletions(e){for(let t of e)this.addCompletion(typeof t=="string"?Ja(t,"property",this.idQuote,this.idCaseInsensitive):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):Ka(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let t of Object.keys(e)){let i=e[t],s=null,r=t.replace(/\\?\./g,l=>l=="."?"\0":l).split("\0"),o=this;Ka(i)&&(s=i.self,i=i.children);for(let l=0;l<r.length;l++)s&&l==r.length-1&&o.addCompletion(s),o=o.child(r[l].replace(/\\\./g,"."));o.addNamespace(i)}}}function Ja(n,e,t,i){return new RegExp("^[a-z_][a-z_\\d]*$",i?"i":"").test(n)?{label:n,type:e}:{label:n,type:e,apply:t+n+su(t)}}function su(n){return n==="["?"]":n}function Ox(n,e,t,i,s,r){var o;let l=((o=r?.spec.identifierQuotes)===null||o===void 0?void 0:o[0])||'"',a=new Fo(l,!!r?.spec.caseInsensitiveIdentifiers),h=s?a.child(s):null;return a.addNamespace(n),e&&(h||a).addCompletions(e),t&&a.addCompletions(t),h&&a.addCompletions(h.list),i&&a.addCompletions((h||a).child(i).list),c=>{let{parents:f,from:u,quoted:d,empty:O,aliases:p}=ax(c.state,c.pos);if(O&&!c.explicit)return null;p&&f.length==1&&(f=p[f[0]]||f);let m=a;for(let b of f){for(;!m.children||!m.children[b];)if(m==a&&h)m=h;else if(m==h&&i)m=m.child(i);else return null;let S=m.maybeChild(b);if(!S)return null;m=S}let x=m.list;if(m==a&&p&&(x=x.concat(Object.keys(p).map(b=>({label:b,type:"constant"})))),d){let b=d[0],S=su(b),C=c.state.sliceDoc(c.pos,c.pos+1)==S;return{from:u,to:C?c.pos+1:void 0,options:fx(b,S,x),validFor:dx}}else return{from:u,options:x,validFor:ux}}}function px(n){return n==eu?"type":n==Jf?"keyword":"variable"}function mx(n,e,t){let i=Object.keys(n).map(s=>t(e?s.toUpperCase():s,px(n[s])));return nf(["QuotedIdentifier","String","LineComment","BlockComment","."],Eo(i))}let gx=ox.configure({props:[$s.add({Statement:ni()}),Ps.add({Statement(n,e){return{from:Math.min(n.from+100,e.doc.lineAt(n.from).to),to:n.to}},BlockComment(n){return{from:n.from+2,to:n.to-2}}}),ks({Keyword:g.keyword,Type:g.typeName,Builtin:g.standard(g.name),Bits:g.number,Bytes:g.string,Bool:g.bool,Null:g.null,Number:g.number,String:g.string,Identifier:g.name,QuotedIdentifier:g.special(g.string),SpecialVar:g.special(g.name),LineComment:g.lineComment,BlockComment:g.blockComment,Operator:g.operator,"Semi Punctuation":g.punctuation,"( )":g.paren,"{ }":g.brace,"[ ]":g.squareBracket})]});class hs{constructor(e,t,i){this.dialect=e,this.language=t,this.spec=i}get extension(){return this.language.extension}configureLanguage(e,t){return new hs(this.dialect,this.language.configure(e,t),this.spec)}static define(e){let t=rx(e,e.keywords,e.types,e.builtin),i=ui.define({name:"sql",parser:gx.configure({tokenizers:[{from:nu,to:iu(t)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new hs(t,i,e)}}function xx(n,e){return{label:n,type:e,boost:-1}}function yx(n,e=!1,t){return mx(n.dialect.words,e,t||xx)}function bx(n){return n.schema?Ox(n.schema,n.tables,n.schemas,n.defaultTable,n.defaultSchema,n.dialect||Ho):()=>null}function Sx(n){return n.schema?(n.dialect||Ho).language.data.of({autocomplete:bx(n)}):[]}function Qx(n={}){let e=n.dialect||Ho;return new Do(e.language,[Sx(n),e.language.data.of({autocomplete:yx(e,n.upperCaseKeywords,n.keywordCompletion)})])}const Ho=hs.define({});class eh{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Mt{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let s=i.facet(Fi).markerFilter;s&&(e=s(e,i));let r=e.slice().sort((d,O)=>d.from-O.from||d.to-O.to),o=new at,l=[],a=0,h=i.doc.iter(),c=0,f=i.doc.length;for(let d=0;;){let O=d==r.length?null:r[d];if(!O&&!l.length)break;let p,m;if(l.length)p=a,m=l.reduce((S,C)=>Math.min(S,C.to),O&&O.from>p?O.from:1e8);else{if(p=O.from,p>f)break;m=O.to,l.push(O),d++}for(;d<r.length;){let S=r[d];if(S.from==p&&(S.to>S.from||S.to==p))l.push(S),d++,m=Math.min(S.to,m);else{m=Math.min(S.from,m);break}}m=Math.min(m,f);let x=!1;if(l.some(S=>S.from==p&&(S.to==m||m==f))&&(x=p==m,!x&&m-p<10)){let S=p-(c+h.value.length);S>0&&(h.next(S),c=p);for(let C=p;;){if(C>=m){x=!0;break}if(!h.lineBreak&&c+h.value.length>C)break;C=c+h.value.length,c+=h.value.length,h.next()}}let b=Lx(l);if(x)o.add(p,p,Z.widget({widget:new Ax(b),diagnostics:l.slice()}));else{let S=l.reduce((C,Q)=>Q.markClass?C+" "+Q.markClass:C,"");o.add(p,m,Z.mark({class:"cm-lintRange cm-lintRange-"+b+S,diagnostics:l.slice(),inclusiveEnd:l.some(C=>C.to>m)}))}if(a=m,a==f)break;for(let S=0;S<l.length;S++)l[S].to<=a&&l.splice(S--,1)}let u=o.finish();return new Mt(u,t,Qt(u))}}function Qt(n,e=null,t=0){let i=null;return n.between(t,1e9,(s,r,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!i)i=new eh(s,r,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new eh(i.from,r,i.diagnostic)}}),i}function kx(n,e){let t=e.pos,i=e.end||t,s=n.state.facet(Fi).hideOn(n,t,i);if(s!=null)return s;let r=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(ru))||n.changes.touchesRange(r.from,Math.max(r.to,i)))}function wx(n,e){return n.field(Te,!1)?e:e.concat(M.appendConfig.of(Dx))}const ru=M.define(),Ko=M.define(),ou=M.define(),Te=ce.define({create(){return new Mt(Z.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,s=n.panel;if(n.selected){let r=e.changes.mapPos(n.selected.from,1);i=Qt(t,n.selected.diagnostic,r)||Qt(t,null,r)}!t.size&&s&&e.state.facet(Fi).autoPanel&&(s=null),n=new Mt(t,s,i)}for(let t of e.effects)if(t.is(ru)){let i=e.state.facet(Fi).autoPanel?t.value.length?Hi.open:null:n.panel;n=Mt.init(t.value,i,e.state)}else t.is(Ko)?n=new Mt(n.diagnostics,t.value?Hi.open:null,n.selected):t.is(ou)&&(n=new Mt(n.diagnostics,n.panel,t.value));return n},provide:n=>[qi.from(n,e=>e.panel),$.decorations.from(n,e=>e.diagnostics)]}),vx=Z.mark({class:"cm-lintRange cm-lintRange-active"});function $x(n,e,t){let{diagnostics:i}=n.state.field(Te),s,r=-1,o=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(a,h,{spec:c})=>{if(e>=a&&e<=h&&(a==h||(e>a||t>0)&&(e<h||t<0)))return s=c.diagnostics,r=a,o=h,!1});let l=n.state.facet(Fi).tooltipFilter;return s&&l&&(s=l(s,n.state)),s?{pos:r,end:o,above:n.state.doc.lineAt(r).to<o,create(){return{dom:Px(n,s)}}}:null}function Px(n,e){return _("ul",{class:"cm-tooltip-lint"},e.map(t=>au(n,t,!1)))}const Tx=n=>{let e=n.state.field(Te,!1);(!e||!e.panel)&&n.dispatch({effects:wx(n.state,[Ko.of(!0)])});let t=Zo(n,Hi.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},th=n=>{let e=n.state.field(Te,!1);return!e||!e.panel?!1:(n.dispatch({effects:Ko.of(!1)}),!0)},Cx=n=>{let e=n.state.field(Te,!1);if(!e)return!1;let t=n.state.selection.main,i=Qt(e.diagnostics,null,t.to+1);return!i&&(i=Qt(e.diagnostics,null,0),!i||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),lp(n,i.from,1,{tooltip:hu,until:s=>s.docChanged||s.newSelection.main.head<i.from||s.newSelection.main.head>i.to}),!0)},Zx=[{key:"Mod-Shift-m",run:Tx,preventDefault:!0},{key:"F8",run:Cx}],Fi=P.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...nt(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:ih,tooltipFilter:ih,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,s,r)=>e(i,s,r)||t(i,s,r):e:t,autoPanel:(e,t)=>e||t})}}});function ih(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function lu(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;i<t.length;i++){let s=t[i];if(/[a-zA-Z]/.test(s)&&!e.some(r=>r.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function au(n,e,t){var i;let s=t?lu(e.actions):[];return _("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},_("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((r,o)=>{let l=!1,a=d=>{if(d.preventDefault(),l)return;l=!0;let O=Qt(n.state.field(Te).diagnostics,e);O&&r.apply(n,O.from,O.to)},{name:h}=r,c=s[o]?h.indexOf(s[o]):-1,f=c<0?h:[h.slice(0,c),_("u",h.slice(c,c+1)),h.slice(c+1)],u=r.markClass?" "+r.markClass:"";return _("button",{type:"button",class:"cm-diagnosticAction"+u,onclick:a,onmousedown:a,"aria-label":` Action: ${h}${c<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&_("div",{class:"cm-diagnosticSource"},e.source))}class Ax extends Be{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return _("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class nh{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=au(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Hi{constructor(e){this.view=e,this.items=[];let t=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)th(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=lu(r.actions);for(let l=0;l<o.length;l++)if(o[l].toUpperCase().charCodeAt(0)==s.keyCode){let a=Qt(this.view.state.field(Te).diagnostics,r);a&&r.actions[l].apply(e,a.from,a.to)}}else return;s.preventDefault()}},i=s=>{for(let r=0;r<this.items.length;r++)this.items[r].dom.contains(s.target)&&this.moveSelection(r)};this.list=_("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:i}),this.dom=_("div",{class:"cm-panel-lint"},this.list,_("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>th(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Te).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(Te),i=0,s=!1,r=null,o=new Set;for(e.between(0,this.view.state.doc.length,(l,a,{spec:h})=>{for(let c of h.diagnostics){if(o.has(c))continue;o.add(c);let f=-1,u;for(let d=i;d<this.items.length;d++)if(this.items[d].diagnostic==c){f=d;break}f<0?(u=new nh(this.view,c),this.items.splice(i,0,u),s=!0):(u=this.items[f],f>i&&(this.items.splice(i,f-i),s=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),r=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),i++}});i<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new nh(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:()=>({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let h=a.height/this.list.offsetHeight;l.top<a.top?this.list.scrollTop-=(a.top-l.top)/h:l.bottom>a.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Te),i=Qt(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:ou.of(i)})}static open(e){return new Hi(e)}}function Mx(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(n)}</svg>')`}function Cn(n){return Mx(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${n}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const Rx=$.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Cn("#f11")},".cm-lintRange-warning":{backgroundImage:Cn("orange")},".cm-lintRange-info":{backgroundImage:Cn("#999")},".cm-lintRange-hint":{backgroundImage:Cn("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function Xx(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function Lx(n){let e="hint",t=1;for(let i of n){let s=Xx(i.severity);s>t&&(t=s,e=i.severity)}return e}const hu=op($x,{hideOn:kx}),Dx=[Te,$.decorations.compute([Te],n=>{let{selected:e,panel:t}=n.field(Te);return!e||!t||e.from==e.to?Z.none:Z.set([vx.range(e.from,e.to)])}),hu,Rx],sh=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class pi{constructor(e,t,i=0,s=e.length,r,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,s),this.bufferStart=i,this.normalize=r?l=>r(sh(l)):sh,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return me(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=fo(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Fe(e);let s=this.normalize(t);if(s.length)for(let r=0,o=i,l=!0;;r++){let a=s.charCodeAt(r),h=this.match(a,o,l,this.bufferPos+this.bufferStart,r==s.length-1);if(h)return this.value=h,this;if(r==s.length-1)break;l&&r<t.length&&t.charCodeAt(r)==a?o++:l=!1}}}match(e,t,i,s,r){let o=null;for(let l=0;l<this.matches.length;){let a=this.matches[l],h=!1;this.query.charCodeAt(a.index)==e&&(a.index==this.query.length-1?o={from:a.from,to:s,precise:r&&a.precise}:(a.index++,h=!0)),h?l++:this.matches.splice(l,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?o={from:t,to:s,precise:i&&r}:this.matches.push({from:t,index:1,precise:i})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(pi.prototype[Symbol.iterator]=function(){return this});const cu={from:-1,to:-1,match:/.*/.exec(""),precise:!0},Jo="gm"+(/x/.unicode==null?"":"u");class fu{constructor(e,t,i,s=0,r=e.length){if(this.text=e,this.to=r,this.curLine="",this.done=!1,this.value=cu,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new uu(e,t,i,s,r);this.re=new RegExp(t,Jo+(i?.ignoreCase?"i":"")),this.test=i?.test,this.iter=e.iter();let o=e.lineAt(s);this.curLineStart=o.from,this.matchPos=cs(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,s=i+t[0].length;if(this.matchPos=cs(this.text,s+(i==s?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(i<s||i>this.value.to)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const ur=new WeakMap;class oi{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,i){let s=ur.get(e);if(!s||s.from>=i||s.to<=t){let l=new oi(t,e.sliceString(t,i));return ur.set(e,l),l}if(s.from==t&&s.to==i)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to<i&&(r+=e.sliceString(s.to,i)),ur.set(e,new oi(o,r)),new oi(t,r.slice(t-o,i-o))}}class uu{constructor(e,t,i,s,r){this.text=e,this.to=r,this.done=!1,this.value=cu,this.matchPos=cs(e,s),this.re=new RegExp(t,Jo+(i?.ignoreCase?"i":"")),this.test=i?.test,this.flat=oi.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,s=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,precise:!0,match:t},this.matchPos=cs(this.text,s+(i==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=oi.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(fu.prototype[Symbol.iterator]=uu.prototype[Symbol.iterator]=function(){return this});function Wx(n){try{return new RegExp(n,Jo),!0}catch{return!1}}function cs(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e<t.to&&(i=t.text.charCodeAt(e-t.from))>=56320&&i<57344;)e++;return e}const Ex=n=>{let{state:e}=n,t=String(e.doc.lineAt(n.state.selection.main.head).number),{close:i,result:s}=hp(n,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return s.then(r=>{let o=r&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.elements.line.value);if(!o){n.dispatch({effects:i});return}let l=e.doc.lineAt(e.selection.main.head),[,a,h,c,f]=o,u=c?+c.slice(1):0,d=h?+h:l.number;if(h&&f){let m=d/100;a&&(m=m*(a=="-"?-1:1)+l.number/e.doc.lines),d=Math.round(e.doc.lines*m)}else h&&a&&(d=d*(a=="-"?-1:1)+l.number);let O=e.doc.line(Math.max(1,Math.min(e.doc.lines,d))),p=y.cursor(O.from+Math.max(0,Math.min(u,O.length)));n.dispatch({effects:[i,$.scrollIntoView(p.from,{y:"center"})],selection:p})}),!0},zx={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Bx=P.define({combine(n){return nt(n,zx,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Yx(n){return[jx,Ix]}const _x=Z.mark({class:"cm-selectionMatch"}),qx=Z.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function rh(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=G.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=G.Word)}function Vx(n,e,t,i){return n(e.sliceDoc(t,t+1))==G.Word&&n(e.sliceDoc(i-1,i))==G.Word}const Ix=ee.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(Bx),{state:t}=n,i=t.selection;if(i.ranges.length>1)return Z.none;let s=i.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return Z.none;let a=t.wordAt(s.head);if(!a)return Z.none;o=t.charCategorizer(s.head),r=t.sliceDoc(a.from,a.to)}else{let a=s.to-s.from;if(a<e.minSelectionLength||a>200)return Z.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(rh(o,t,s.from,s.to)&&Vx(o,t,s.from,s.to)))return Z.none}else if(r=t.sliceDoc(s.from,s.to),!r)return Z.none}let l=[];for(let a of n.visibleRanges){let h=new pi(t.doc,r,a.from,a.to);for(;!h.next().done;){let{from:c,to:f}=h.value;if((!o||rh(o,t,c,f))&&(s.empty&&c<=s.from&&f>=s.to?l.push(qx.range(c,f)):(c>=s.to||f<=s.from)&&l.push(_x.range(c,f)),l.length>e.maxMatches))return Z.none}}return Z.set(l)}},{decorations:n=>n.decorations}),jx=$.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Nx=({state:n,dispatch:e})=>{let{selection:t}=n,i=y.create(t.ranges.map(s=>n.wordAt(s.head)||y.cursor(s.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function Gx(n,e){let{main:t,ranges:i}=n.selection,s=n.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,l=new pi(n.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new pi(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(a=>a.from==l.value.from))continue;if(r){let a=n.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const Ux=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return Nx({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=i))return!1;let s=Gx(n,i);return s?(e(n.update({selection:n.selection.addRange(y.range(s.from,s.to),!1),effects:$.scrollIntoView(s.to)})),!0):!1},yi=P.define({combine(n){return nt(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new hy(e),scrollToMatch:e=>$.scrollIntoView(e)})}});class du{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Wx(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?`
25
25
  `:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new ty(this):new Kx(this)}getCursor(e,t=0,i){let s=e.doc?e:z.create({doc:e});return i==null&&(i=s.doc.length),this.regexp?Gt(this,s,t,i):Nt(this,s,t,i)}}class Ou{constructor(e){this.spec=e}}function Fx(n,e,t){return(i,s,r,o)=>{if(t&&!t(i,s,r,o))return!1;let l=i>=o&&s<=o+r.length?r.slice(i-o,s-o):e.doc.sliceString(i,s);return n(l,e,i,s)}}function Nt(n,e,t,i){let s;return n.wholeWord&&(s=Hx(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(s=Fx(n.test,e,s)),new pi(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:r=>r.toLowerCase(),s)}function Hx(n,e){return(t,i,s,r)=>((r>t||r+s.length<i)&&(r=Math.max(0,t-2),s=n.sliceString(r,Math.min(n.length,i+2))),(e(fs(s,t-r))!=G.Word||e(us(s,t-r))!=G.Word)&&(e(us(s,i-r))!=G.Word||e(fs(s,i-r))!=G.Word))}class Kx extends Ou{constructor(e){super(e)}nextMatch(e,t,i){let s=Nt(this.spec,e,i,e.doc.length).nextOverlapping();if(s.done){let r=Math.min(e.doc.length,t+this.spec.unquoted.length);s=Nt(this.spec,e,0,r).nextOverlapping()}return s.done||s.value.from==t&&s.value.to==i?null:s.value}prevMatchInRange(e,t,i){for(let s=i;;){let r=Math.max(t,s-1e4-this.spec.unquoted.length),o=Nt(this.spec,e,r,s),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(r==t)return null;s-=1e4}}prevMatch(e,t,i){let s=this.prevMatchInRange(e,0,t);return s||(s=this.prevMatchInRange(e,Math.max(0,i-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=t||s.to!=i)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let i=Nt(this.spec,e,0,e.doc.length),s=[];for(;!i.next().done;){if(s.length>=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Nt(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Jx(n,e,t){return(i,s,r)=>(!t||t(i,s,r))&&n(r[0],e,i,s)}function Gt(n,e,t,i){let s;return n.wholeWord&&(s=ey(e.charCategorizer(e.selection.main.head))),n.test&&(s=Jx(n.test,e,s)),new fu(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:s},t,i)}function fs(n,e){return n.slice(se(n,e,!1),e)}function us(n,e){return n.slice(e,se(n,e))}function ey(n){return(e,t,i)=>!i[0].length||(n(fs(i.input,i.index))!=G.Word||n(us(i.input,i.index))!=G.Word)&&(n(us(i.input,i.index+i[0].length))!=G.Word||n(fs(i.input,i.index+i[0].length))!=G.Word)}class ty extends Ou{nextMatch(e,t,i){let s=Gt(this.spec,e,i,e.doc.length).next();return s.done&&(s=Gt(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=Gt(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let s=i.length;s>0;s--){let r=+i.slice(0,s);if(r>0&&r<e.match.length)return e.match[r]+i.slice(s)}return t})}matchAll(e,t){let i=Gt(this.spec,e,0,e.doc.length),s=[];for(;!i.next().done;){if(s.length>=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Gt(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const Ki=M.define(),el=M.define(),pt=ce.define({create(n){return new dr(co(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Ki)?n=new dr(t.value.create(),n.panel):t.is(el)&&(n=new dr(n.query,t.value?tl:null));return n},provide:n=>qi.from(n,e=>e.panel)});class dr{constructor(e,t){this.query=e,this.panel=t}}const iy=Z.mark({class:"cm-searchMatch"}),ny=Z.mark({class:"cm-searchMatch cm-searchMatch-selected"}),sy=ee.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(pt))}update(n){let e=n.state.field(pt);(e!=n.startState.field(pt)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return Z.none;let{view:t}=this,i=new at;for(let s=0,r=t.visibleRanges,o=r.length;s<o;s++){let{from:l,to:a}=r[s];for(;s<o-1&&a>r[s+1].from-500;)a=r[++s].to;n.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?ny:iy)})}return i.finish()}},{decorations:n=>n.decorations});function ln(n){return e=>{let t=e.state.field(pt,!1);return t&&t.query.spec.valid?n(e,t):gu(e)}}const ds=ln((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let s=y.single(i.from,i.to),r=n.state.facet(yi);return n.dispatch({selection:s,effects:[il(n,i),r.scrollToMatch(s.main,n)],userEvent:"select.search"}),mu(n),!0}),Os=ln((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t,i,i);if(!s)return!1;let r=y.single(s.from,s.to),o=n.state.facet(yi);return n.dispatch({selection:r,effects:[il(n,s),o.scrollToMatch(r.main,n)],userEvent:"select.search"}),mu(n),!0}),ry=ln((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:y.create(t.map(i=>y.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),oy=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let l=new pi(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==i&&(o=r.length),r.push(y.range(l.value.from,l.value.to))}return e(n.update({selection:y.create(r,o),userEvent:"select.search.matches"})),!0},oh=ln((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,i,i);if(!r)return!1;let o=r,l=[],a,h,c=[];o.precise?o.from==i&&o.to==s&&(h=t.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:h}),c.push($.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))):o=e.nextMatch(t,o.from,o.to);let f=n.state.changes(l);return o&&(a=y.single(o.from,o.to).map(f),c.push(il(n,o)),c.push(t.facet(yi).scrollToMatch(a.main,n))),n.dispatch({changes:f,selection:a,effects:c,userEvent:"input.replace"}),!0}),ly=ln((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let s of e.matchAll(n.state,1e9)){let{from:r,to:o,precise:l}=s;l&&t.push({from:r,to:o,insert:e.getReplacement(s)})}if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:$.announce.of(i),userEvent:"input.replace.all"}),!0});function tl(n){return n.state.facet(yi).createPanel(n)}function co(n,e){var t,i,s,r,o;let l=n.selection.main,a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=n.facet(yi);return new du({search:((t=e?.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e?.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(r=e?.regexp)!==null&&r!==void 0?r:h.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function pu(n){let e=Zo(n,tl);return e&&e.dom.querySelector("[main-field]")}function mu(n){let e=pu(n);e&&e==n.root.activeElement&&e.select()}const gu=n=>{let e=n.state.field(pt,!1);if(e&&e.panel){let t=pu(n);if(t&&t!=n.root.activeElement){let i=co(n.state,e.query.spec);i.valid&&n.dispatch({effects:Ki.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[el.of(!0),e?Ki.of(co(n.state,e.query.spec)):M.appendConfig.of(fy)]});return!0},xu=n=>{let e=n.state.field(pt,!1);if(!e||!e.panel)return!1;let t=Zo(n,tl);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:el.of(!1)}),!0},ay=[{key:"Mod-f",run:gu,scope:"editor search-panel"},{key:"F3",run:ds,shift:Os,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ds,shift:Os,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:xu,scope:"editor search-panel"},{key:"Mod-Shift-l",run:oy},{key:"Mod-Alt-g",run:Ex},{key:"Mod-d",run:Ux,preventDefault:!0}];class hy{constructor(e){this.view=e;let t=this.query=e.state.field(pt).query.spec;this.commit=this.commit.bind(this),this.searchField=_("input",{value:t.search,placeholder:$e(e,"Find"),"aria-label":$e(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=_("input",{value:t.replace,placeholder:$e(e,"Replace"),"aria-label":$e(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=_("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=_("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=_("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(s,r,o){return _("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=_("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>ds(e),[$e(e,"next")]),i("prev",()=>Os(e),[$e(e,"previous")]),i("select",()=>ry(e),[$e(e,"all")]),_("label",null,[this.caseField,$e(e,"match case")]),_("label",null,[this.reField,$e(e,"regexp")]),_("label",null,[this.wordField,$e(e,"by word")]),...e.state.readOnly?[]:[_("br"),this.replaceField,i("replace",()=>oh(e),[$e(e,"replace")]),i("replaceAll",()=>ly(e),[$e(e,"replace all")])],_("button",{name:"close",onclick:()=>xu(e),"aria-label":$e(e,"close"),type:"button"},["×"])])}commit(){let e=new du({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Ki.of(e)}))}keydown(e){PO(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Os:ds)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),oh(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(Ki)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(yi).top}}function $e(n,e){return n.state.phrase(e)}const Zn=30,An=/[\s\.,:;?!]/;function il(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to,r=Math.max(i.from,e-Zn),o=Math.min(s,t+Zn),l=n.state.sliceDoc(r,o);if(r!=i.from){for(let a=0;a<Zn;a++)if(!An.test(l[a+1])&&An.test(l[a])){l=l.slice(a);break}}if(o!=s){for(let a=l.length-1;a>l.length-Zn;a--)if(!An.test(l[a-1])&&An.test(l[a])){l=l.slice(0,a);break}}return $.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}const cy=$.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),fy=[pt,kt.low(sy),cy],uy=$.theme({"&":{backgroundColor:"var(--background)",color:"var(--foreground)",fontSize:"13px",border:"1px solid var(--border)",borderRadius:"0.5rem",overflow:"hidden",width:"100%"},"& .cm-scroller":{overflow:"auto"},"&.cm-focused":{outline:"2px solid var(--ring)",outlineOffset:"-1px"},".cm-content":{caretColor:"var(--foreground)",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',padding:"8px 0"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--foreground)"},".cm-selectionBackground, ::selection":{backgroundColor:"var(--accent)"},".cm-activeLine":{backgroundColor:"var(--accent)",opacity:"0.3"},".cm-gutters":{backgroundColor:"var(--muted)",color:"var(--muted-foreground)",border:"none",borderRight:"1px solid var(--border)"},".cm-activeLineGutter":{backgroundColor:"var(--accent)"},".cm-foldPlaceholder":{backgroundColor:"var(--muted)",color:"var(--muted-foreground)",border:"1px solid var(--border)"},".cm-tooltip":{backgroundColor:"var(--popover)",color:"var(--popover-foreground)",border:"1px solid var(--border)"},".cm-placeholder":{color:"var(--muted-foreground)"}},{dark:!1});function dy(n){switch(n){case"javascript":return qa({jsx:!0});case"typescript":return qa({jsx:!0,typescript:!0});case"sql":return Qx();default:return X1()}}function yy({value:n,onChange:e,readonly:t=!1,placeholder:i,className:s,minHeight:r="120px",language:o="json"}){const l=$t.useRef(null),a=$t.useRef(null),h=$t.useRef(e),c=$t.useRef(n),f=$t.useRef(o);return h.current=e,$t.useEffect(()=>{if(!l.current)return;const u=[bp(),_O(),Cg(),om(),RO(),z.allowMultipleSelections.of(!0),am(fm,{fallback:!0}),xm(),lg(),xg(),GO(),Yx(),Ss.of([...fg,...R0,...ay,...Eg,...im,...uf,...Zx]),dy(f.current),uy,$.theme({".cm-scroller":{minHeight:r}}),$.updateListener.of(p=>{p.docChanged&&h.current?.(p.state.doc.toString())})];t&&u.push(z.readOnly.of(!0),$.editable.of(!1)),i&&u.push(KO(i));const d=z.create({doc:c.current,extensions:u}),O=new $({state:d,parent:l.current});return a.current=O,()=>{O.destroy(),a.current=null}},[t,i,r]),$t.useEffect(()=>{const u=a.current;if(!u)return;const d=u.state.doc.toString();d!==n&&u.dispatch({changes:{from:0,to:d.length,insert:n}})},[n]),yu.jsx("div",{ref:l,className:bu("w-full",s)})}export{yy as C,Z as D,$ as E,P as F,yt as G,kt as P,at as R,ce as S,E as T,ee as V,Be as W,M as a,xy as b,ie as c,D as d,z as e,fm as f,dp as g,Xp as h,X1 as j,St as l,am as s};
26
- //# sourceMappingURL=code-editor-BdRMYojw.js.map
26
+ //# sourceMappingURL=code-editor-mrKkAfcE.js.map
@@ -0,0 +1,2 @@
1
+ import{j as t,O as o}from"./index-DByaMzsG.js";const n=()=>t.jsx(o,{});export{n as component};
2
+ //# sourceMappingURL=connect-NUCSay8X.js.map
@@ -1,2 +1,2 @@
1
- import{z as fe,cN as ie,iH as ge,iI as oe,iJ as ke,aW as ce,iN as je,iO as be,iP as ve,iQ as ye,r as j,u as re,iR as Ae,j as s,dk as _e,iS as Ne,a2 as ue,dm as w,iT as Ce,cU as Y,di as Se,B as f,dj as Oe,i as I,dh as ne,hP as De,hQ as Le,hR as we,hS as Pe,hT as $e,iU as Me,iV as ae,iW as Fe,L as Re,iX as Ue,iY as ze,iZ as Be,c7 as B,i_ as Ee,i$ as Ie,c6 as Te,fb as Ke,T as X,f$ as qe,e8 as Ve,U as le,fc as We,cb as Qe,ai as Xe,fd as Ye}from"./index-CdDNNAx2.js";function es({connector:t,organizationId:l,ownerSlug:n,connections:r,openNewApp:g=!1,onNewAppHandled:c}){const{session:b}=fe(),{isAdmin:u,isLoading:_}=ie(l),P=ge(t.auth_schema),o=oe(t.auth_schema),N=ke(t.auth_schema),C=ce(l,{connectorKey:t.key,provider:o?.provider}),m=je(l,t.key),S=be(),$=ve(),p=ye(),[O,D]=j.useState(null),[v,y]=j.useState(null),[x,M]=j.useState([]),F=re(),k=j.useCallback(e=>F?.open({href:"",key:`oauth-apps:${t.key}`,title:"OAuth apps",connectorPanel:{section:"oauth-apps",connectorKey:t.key,organizationId:l,ownerSlug:n,newApp:e}}),[F,t.key,l,n]);j.useEffect(()=>{!g||!u||(k(!0),c?.())},[g,u,k,c]);const R=b?.user?.id;if(!R||_||C.isLoading||m.isPending)return null;const a=(C.data??[]).filter(e=>e.profile_kind==="oauth_app"),A=a.filter(e=>e.status==="active"),H=e=>E(e,t.key),U=A.find(H),de=new Set(r.map(e=>e.auth_profile_slug)),pe=(C.data??[]).filter(e=>e.profile_kind==="oauth_account"&&e.created_by===R&&!de.has(e.slug)),he=(m.data?.options??[]).filter(e=>e.kind!=="local"&&e.configured&&!!e.url),T=m.data?.options.find(e=>e.kind==="local"),K=m.isError||m.data?.cloud_status==="unavailable",d=[],J=e=>({key:`app:${e.slug}`,kind:"app",slug:e.slug,button:"Connect account",label:e.display_name,hint:"Your OAuth app",badge:H(e)?"Default":void 0,canLead:!!U||A.length===1}),q=u?A:U?[U]:[],V=U??(q.length===1?q[0]:void 0);V&&d.push(J(V));for(const e of he)d.push({key:`offer:${e.kind}:${e.managed_by_org??e.url}`,kind:"link",href:e.url,external:!0,note:e.instructions,button:e.label,label:e.label,hint:e.execution==="cloud"?"Runs in Lobu Cloud":"The cloud holds the grant; data syncs here",canLead:!0});N&&T?.configured&&T.url&&d.push({key:"install",kind:"link",href:Ae(T.url,{installShape:N.installShape}),external:!1,button:`Install ${t.name} app`,label:`Install ${t.name} app`,hint:"Installs on your provider account",canLead:!0});for(const e of q)e!==V&&d.push(J(e));for(const e of pe){const i=e.status==="active";d.push({key:`account:${e.slug}`,kind:"account",profile:e,button:i?"Use this account":"Reconnect",label:`${i?"Use":"Reconnect"} ${e.display_name}`,canLead:!1})}(!o||P.some(e=>e.type!=="oauth"))&&d.push({key:"create",kind:"create",button:"Add connection",label:N?"Use your own app":"Add connection",canLead:!0});const me=u&&o?{key:"new-app",kind:"new-app",button:"New OAuth app",label:"New OAuth app…",canLead:!0}:void 0,h=d.find(e=>e.canLead)??(d.length?void 0:me),Z=e=>p.begin(()=>S.mutateAsync({connector_key:t.key,app_auth_profile_slug:e,requested_scopes:o?Ue(o,x):[]})),W=e=>{if(D(null),e.kind==="app")o&&ae(o).length?y(e.slug):Z(e.slug);else if(e.kind==="account"){const{profile:i}=e;p.begin(()=>i.status==="active"?S.mutateAsync({connector_key:t.key,auth_profile_slug:i.slug}):$.mutateAsync({auth_profile_slug:i.slug}))}else e.kind==="new-app"?k(!0):e.kind==="link"&&D(e.note??null)},G=(e,i)=>e.kind==="link"?s.jsx("a",{href:e.href,...e.external?{target:"_blank",rel:"noopener noreferrer"}:{},onClick:()=>W(e),children:i}):e.kind==="create"?s.jsx(Re,{to:"/$owner/connectors/create/$connectorKey",params:{owner:n,connectorKey:t.key},children:i}):null,z=d.length===1&&d[0]===h?[]:d,ee=!!(u&&o),Q=z.length>0||K||ee&&(d.length>0||a.length>0),se=s.jsxs(_e,{align:"end",className:"w-72",children:[z.length?s.jsx(Ne,{children:"Connect with"}):null,z.map(e=>{const i=s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate",children:e.label}),e.hint?s.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:e.hint}):null]}),e.badge?s.jsx(ue,{variant:"secondary",className:"text-[10px]",children:e.badge}):null]}),L=G(e,i);return L?s.jsx(w,{asChild:!0,children:L},e.key):s.jsx(w,{onSelect:()=>W(e),children:i},e.key)}),K?s.jsx(w,{onSelect:e=>{e.preventDefault(),m.refetch()},children:s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block",children:"Retry cloud options"}),s.jsx("span",{className:"block text-xs text-muted-foreground",children:"Cloud connection options could not be checked"})]})}):null,ee?s.jsxs(s.Fragment,{children:[z.length||K?s.jsx(Ce,{}):null,s.jsxs(w,{onSelect:()=>k(!0),children:[s.jsx(Y,{}),"New OAuth app…"]}),a.length?s.jsx(w,{onSelect:()=>k(!1),children:"Manage OAuth apps…"}):null]}):null]}),te=s.jsx(Se,{asChild:!0,children:s.jsxs(f,{size:"sm",variant:h?"default":"outline",className:I(h&&"rounded-l-none border-l border-primary-foreground/25 px-2"),"aria-label":h?"More ways to connect":void 0,children:[h?null:"Connect",s.jsx(Oe,{className:"size-3.5"})]})});return s.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1.5",children:[h?s.jsxs(ne,{children:[s.jsxs("div",{className:"inline-flex",children:[(()=>{const e=s.jsxs(s.Fragment,{children:[h.kind==="new-app"||h.kind==="create"?s.jsx(Y,{className:"size-3.5"}):null,h.button]}),i=G(h,e);return s.jsx(f,{size:"sm",disabled:p.pending,className:I(Q&&"rounded-r-none"),asChild:!!i,onClick:i?void 0:()=>W(h),children:i??e})})(),Q?te:null]}),se]}):Q?s.jsxs(ne,{children:[te,se]}):s.jsxs(s.Fragment,{children:[s.jsx(f,{size:"sm",disabled:!0,children:"Connect account"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Ask an administrator to set the workspace-default OAuth app."})]}),O?s.jsx("p",{className:"max-w-sm text-xs text-muted-foreground",children:O}):null,p.error?s.jsx("p",{role:"alert",className:"max-w-sm text-xs text-destructive",children:p.error}):null,p.continueUrl?s.jsx("a",{href:p.continueUrl,target:"_blank",rel:"noreferrer",className:"text-xs underline",children:"Continue authorization in your browser"}):null,o?s.jsx(De,{open:v!==null,onOpenChange:e=>!e&&y(null),children:s.jsxs(Le,{className:"max-w-md",children:[s.jsxs(we,{children:[s.jsx(Pe,{children:"Permissions"}),s.jsxs($e,{children:["Choose what ",t.name," may access."]})]}),s.jsx(Me,{requiredScopes:Fe(o),optionalScopes:ae(o),selectedOptionalScopes:x,onToggleOptionalScope:(e,i)=>M(L=>i?[...new Set([...L,e])]:L.filter(xe=>xe!==e))}),s.jsx("div",{className:"flex justify-end",children:s.jsx(f,{size:"sm",disabled:p.pending,onClick:()=>{const e=v;y(null),e&&Z(e)},children:"Continue"})})]})}):null]})}function ss({connector:t,organizationId:l,newApp:n}){const r=re(),{isAdmin:g}=ie(l),c=oe(t.auth_schema),b=ce(l,{connectorKey:t.key,provider:c?.provider});return c?s.jsx(He,{connector:t,oauthMethod:c,appProfiles:(b.data??[]).filter(u=>u.profile_kind==="oauth_app"),isAdmin:g,initialOpen:n,onClose:n?()=>r?.close():void 0,refetchProfiles:()=>void b.refetch()}):null}function He({initialOpen:t=!1,onClose:l,connector:n,oauthMethod:r,appProfiles:g,isAdmin:c,refetchProfiles:b}){const u=ze(),_=Be(),[P,o]=B(n.key,t&&c),[N,C]=j.useState(!1);j.useEffect(()=>{t&&c&&o(!0)},[t,c,o]);const m=`${Ee()}/connect/oauth/callback`,[S,$]=B(n.key,`${n.name} OAuth App`),[p,O]=B(n.key,""),[D,v]=B(n.key,null),y=Ie(r),x=Te(`${n.key}:${P}`,Ke(y),y),{values:M,setValues:F}=x,k=g.find(a=>E(a,n.key)),R=()=>{x.canSubmit&&(v(null),u.mutate({connector_key:n.key,profile_kind:"oauth_app",display_name:S.trim()||`${n.name} OAuth App`,slug:p.trim()||void 0,credentials:Ze(Ye(M))},{onSuccess:a=>{const A=a.auth_profile?.slug;A&&!k&&_.mutate({connector_key:n.key,auth_profile_slug:A}),o(!1),l?.(),$(`${n.name} OAuth App`),O(""),b()},onError:a=>{v(a instanceof Error?a.message:"Failed to add OAuth app")}}))};return s.jsxs("div",{className:"min-w-0 space-y-4",children:[c&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(X,{children:"OAuth callback URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"min-w-0 flex-1 break-all text-xs",children:m}),s.jsxs(f,{variant:"outline",size:"sm",onClick:()=>{navigator.clipboard.writeText(m).then(()=>C(!0)).catch(()=>v("Could not copy the callback URL. Select and copy it above."))},children:[s.jsx(qe,{className:"mr-1.5 h-3.5 w-3.5"}),N?"Copied":"Copy callback URL"]})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Register this exact URL in your provider’s app settings before saving the client configuration."})]}),g.length>0?s.jsx("div",{className:"space-y-2",children:g.map(a=>s.jsxs("div",{className:I(Ve,"flex flex-wrap items-center gap-3 p-3"),children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:a.display_name}),E(a,n.key)?s.jsx(ue,{variant:"secondary",className:"text-[10px]",children:"Default"}):null,s.jsx(Je,{status:a.status})]}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.slug})]}),c&&!E(a,n.key)&&a.connector_key===n.key&&a.status==="active"?s.jsx(f,{variant:"outline",size:"sm",disabled:_.isPending,onClick:()=>_.mutate({connector_key:n.key,auth_profile_slug:a.slug}),children:"Set default"}):null]},a.slug))}):null,c?P?s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(X,{htmlFor:"oauth-app-name",children:"Display name"}),s.jsx(le,{id:"oauth-app-name",value:S,onChange:a=>$(a.target.value)})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(X,{htmlFor:"oauth-app-slug",children:"Slug"}),s.jsx(le,{id:"oauth-app-slug",placeholder:"optional",value:p,onChange:a=>O(a.target.value)})]}),s.jsx(We,{schema:x.revision??void 0,values:M,onValuesChange:F,fieldIdPrefix:"oauth-app-"}),s.jsx(Qe,{visible:x.hasConflict,onReload:x.reset}),D?s.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:D}):null,s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(f,{variant:"outline",size:"sm",disabled:u.isPending,onClick:()=>{o(!1),l?.()},children:"Cancel"}),s.jsxs(f,{size:"sm",disabled:u.isPending||!x.canSubmit,onClick:R,children:[u.isPending?s.jsx(Xe,{size:"md",className:"mr-1.5"}):null,"Save OAuth app"]})]})]}):s.jsxs(f,{variant:"outline",size:"sm",onClick:()=>o(!0),children:[s.jsx(Y,{className:"size-3.5"}),"Add OAuth app"]}):null]})}function E(t,l){return!!t.is_default_for_connector&&t.connector_key===l}function Je({status:t}){const l=t==="active"?"text-green-500":t==="error"||t==="revoked"?"text-destructive":"text-amber-500";return s.jsxs("span",{className:I("text-xs",l),children:["· ",t]})}function Ze(t){const l={};for(const[n,r]of Object.entries(t))typeof r=="string"&&r.trim()?l[n]=r.trim():(typeof r=="number"||typeof r=="boolean")&&(l[n]=String(r));return l}export{Je as A,es as C,ss as O};
2
- //# sourceMappingURL=connect-menu-D4w-JhJW.js.map
1
+ import{H as xe,cJ as ie,iD as ge,iE as oe,iF as ke,aV as ce,iJ as je,iK as ve,iL as be,iM as ye,r as j,u as re,iN as Ae,j as s,di as Ne,iO as _e,a7 as ue,dk as w,iP as Ce,dg as Z,df as Se,B as x,dh as Oe,i as I,de as ne,hL as De,hM as Le,hN as we,hO as Me,hP as Pe,iQ as Fe,iR as ae,iS as $e,L as Re,iT as Ue,iU as ze,iV as Be,c4 as B,iW as Ee,iX as Ie,c3 as Ke,f9 as Te,Z as X,fZ as Ve,e6 as qe,$ as le,fa as Je,c8 as We,al as Xe,fb as Ze}from"./index-DByaMzsG.js";function es({connector:t,organizationId:l,ownerSlug:n,connections:r,openNewApp:g=!1,onNewAppHandled:c}){const{session:v}=xe(),{isAdmin:u,isLoading:N}=ie(l),M=ge(t.auth_schema),o=oe(t.auth_schema),_=ke(t.auth_schema),C=ce(l,{connectorKey:t.key,provider:o?.provider}),m=je(l,t.key),S=ve(),P=be(),p=ye(),[O,D]=j.useState(null),[b,y]=j.useState(null),[f,F]=j.useState([]),$=re(),k=j.useCallback(e=>$?.open({href:"",key:`oauth-apps:${t.key}`,title:"OAuth apps",connectorPanel:{section:"oauth-apps",connectorKey:t.key,organizationId:l,ownerSlug:n,newApp:e}}),[$,t.key,l,n]);j.useEffect(()=>{!g||!u||(k(!0),c?.())},[g,u,k,c]);const R=v?.user?.id;if(!R||N||C.isLoading||m.isPending)return null;const a=(C.data??[]).filter(e=>e.profile_kind==="oauth_app"),A=a.filter(e=>e.status==="active"),H=e=>E(e,t.key),U=A.find(H),de=new Set(r.map(e=>e.auth_profile_slug)),pe=(C.data??[]).filter(e=>e.profile_kind==="oauth_account"&&e.created_by===R&&!de.has(e.slug)),he=(m.data?.options??[]).filter(e=>e.kind!=="local"&&e.configured&&!!e.url),K=m.data?.options.find(e=>e.kind==="local"),T=m.isError||m.data?.cloud_status==="unavailable",d=[],Q=e=>({key:`app:${e.slug}`,kind:"app",slug:e.slug,button:"Connect account",label:e.display_name,hint:"Your OAuth app",badge:H(e)?"Default":void 0,canLead:!!U||A.length===1}),V=u?A:U?[U]:[],q=U??(V.length===1?V[0]:void 0);q&&d.push(Q(q));for(const e of he)d.push({key:`offer:${e.kind}:${e.managed_by_org??e.url}`,kind:"link",href:e.url,external:!0,note:e.instructions,button:e.label,label:e.label,hint:e.execution==="cloud"?"Runs in Lobu Cloud":"The cloud holds the grant; data syncs here",canLead:!0});_&&K?.configured&&K.url&&d.push({key:"install",kind:"link",href:Ae(K.url,{installShape:_.installShape}),external:!1,button:`Install ${t.name} app`,label:`Install ${t.name} app`,hint:"Installs on your provider account",canLead:!0});for(const e of V)e!==q&&d.push(Q(e));for(const e of pe){const i=e.status==="active";d.push({key:`account:${e.slug}`,kind:"account",profile:e,button:i?"Use this account":"Reconnect",label:`${i?"Use":"Reconnect"} ${e.display_name}`,canLead:!1})}(!o||M.some(e=>e.type!=="oauth"))&&d.push({key:"create",kind:"create",button:"Add connection",label:_?"Use your own app":"Add connection",canLead:!0});const me=u&&o?{key:"new-app",kind:"new-app",button:"New OAuth app",label:"New OAuth app…",canLead:!0}:void 0,h=d.find(e=>e.canLead)??(d.length?void 0:me),Y=e=>p.begin(()=>S.mutateAsync({connector_key:t.key,app_auth_profile_slug:e,requested_scopes:o?Ue(o,f):[]})),J=e=>{if(D(null),e.kind==="app")o&&ae(o).length?y(e.slug):Y(e.slug);else if(e.kind==="account"){const{profile:i}=e;p.begin(()=>i.status==="active"?S.mutateAsync({connector_key:t.key,auth_profile_slug:i.slug}):P.mutateAsync({auth_profile_slug:i.slug}))}else e.kind==="new-app"?k(!0):e.kind==="link"&&D(e.note??null)},G=(e,i)=>e.kind==="link"?s.jsx("a",{href:e.href,...e.external?{target:"_blank",rel:"noopener noreferrer"}:{},onClick:()=>J(e),children:i}):e.kind==="create"?s.jsx(Re,{to:"/$owner/connectors/create/$connectorKey",params:{owner:n,connectorKey:t.key},children:i}):null,z=d.length===1&&d[0]===h?[]:d,ee=!!(u&&o),W=z.length>0||T||ee&&(d.length>0||a.length>0),se=s.jsxs(Ne,{align:"end",className:"w-72",children:[z.length?s.jsx(_e,{children:"Connect with"}):null,z.map(e=>{const i=s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate",children:e.label}),e.hint?s.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:e.hint}):null]}),e.badge?s.jsx(ue,{variant:"secondary",className:"text-[10px]",children:e.badge}):null]}),L=G(e,i);return L?s.jsx(w,{asChild:!0,children:L},e.key):s.jsx(w,{onSelect:()=>J(e),children:i},e.key)}),T?s.jsx(w,{onSelect:e=>{e.preventDefault(),m.refetch()},children:s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block",children:"Retry cloud options"}),s.jsx("span",{className:"block text-xs text-muted-foreground",children:"Cloud connection options could not be checked"})]})}):null,ee?s.jsxs(s.Fragment,{children:[z.length||T?s.jsx(Ce,{}):null,s.jsxs(w,{onSelect:()=>k(!0),children:[s.jsx(Z,{}),"New OAuth app…"]}),a.length?s.jsx(w,{onSelect:()=>k(!1),children:"Manage OAuth apps…"}):null]}):null]}),te=s.jsx(Se,{asChild:!0,children:s.jsxs(x,{size:"sm",variant:h?"default":"outline",className:I(h&&"rounded-l-none border-l border-primary-foreground/25 px-2"),"aria-label":h?"More ways to connect":void 0,children:[h?null:"Connect",s.jsx(Oe,{className:"size-3.5"})]})});return s.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1.5",children:[h?s.jsxs(ne,{children:[s.jsxs("div",{className:"inline-flex",children:[(()=>{const e=s.jsxs(s.Fragment,{children:[h.kind==="new-app"||h.kind==="create"?s.jsx(Z,{className:"size-3.5"}):null,h.button]}),i=G(h,e);return s.jsx(x,{size:"sm",disabled:p.pending,className:I(W&&"rounded-r-none"),asChild:!!i,onClick:i?void 0:()=>J(h),children:i??e})})(),W?te:null]}),se]}):W?s.jsxs(ne,{children:[te,se]}):s.jsxs(s.Fragment,{children:[s.jsx(x,{size:"sm",disabled:!0,children:"Connect account"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Ask an administrator to set the workspace-default OAuth app."})]}),O?s.jsx("p",{className:"max-w-sm text-xs text-muted-foreground",children:O}):null,p.error?s.jsx("p",{role:"alert",className:"max-w-sm text-xs text-destructive",children:p.error}):null,p.continueUrl?s.jsx("a",{href:p.continueUrl,target:"_blank",rel:"noreferrer",className:"text-xs underline",children:"Continue authorization in your browser"}):null,o?s.jsx(De,{open:b!==null,onOpenChange:e=>!e&&y(null),children:s.jsxs(Le,{className:"max-w-md",children:[s.jsxs(we,{children:[s.jsx(Me,{children:"Permissions"}),s.jsxs(Pe,{children:["Choose what ",t.name," may access."]})]}),s.jsx(Fe,{requiredScopes:$e(o),optionalScopes:ae(o),selectedOptionalScopes:f,onToggleOptionalScope:(e,i)=>F(L=>i?[...new Set([...L,e])]:L.filter(fe=>fe!==e))}),s.jsx("div",{className:"flex justify-end",children:s.jsx(x,{size:"sm",disabled:p.pending,onClick:()=>{const e=b;y(null),e&&Y(e)},children:"Continue"})})]})}):null]})}function ss({connector:t,organizationId:l,newApp:n}){const r=re(),{isAdmin:g}=ie(l),c=oe(t.auth_schema),v=ce(l,{connectorKey:t.key,provider:c?.provider});return c?s.jsx(He,{connector:t,oauthMethod:c,appProfiles:(v.data??[]).filter(u=>u.profile_kind==="oauth_app"),isAdmin:g,initialOpen:n,onClose:n?()=>r?.close():void 0,refetchProfiles:()=>void v.refetch()}):null}function He({initialOpen:t=!1,onClose:l,connector:n,oauthMethod:r,appProfiles:g,isAdmin:c,refetchProfiles:v}){const u=ze(),N=Be(),[M,o]=B(n.key,t&&c),[_,C]=j.useState(!1);j.useEffect(()=>{t&&c&&o(!0)},[t,c,o]);const m=`${Ee()}/connect/oauth/callback`,[S,P]=B(n.key,`${n.name} OAuth App`),[p,O]=B(n.key,""),[D,b]=B(n.key,null),y=Ie(r),f=Ke(`${n.key}:${M}`,Te(y),y),{values:F,setValues:$}=f,k=g.find(a=>E(a,n.key)),R=()=>{f.canSubmit&&(b(null),u.mutate({connector_key:n.key,profile_kind:"oauth_app",display_name:S.trim()||`${n.name} OAuth App`,slug:p.trim()||void 0,credentials:Ye(Ze(F))},{onSuccess:a=>{const A=a.auth_profile?.slug;A&&!k&&N.mutate({connector_key:n.key,auth_profile_slug:A}),o(!1),l?.(),P(`${n.name} OAuth App`),O(""),v()},onError:a=>{b(a instanceof Error?a.message:"Failed to add OAuth app")}}))};return s.jsxs("div",{className:"min-w-0 space-y-4",children:[c&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(X,{children:"OAuth callback URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"min-w-0 flex-1 break-all text-xs",children:m}),s.jsxs(x,{variant:"outline",size:"sm",onClick:()=>{navigator.clipboard.writeText(m).then(()=>C(!0)).catch(()=>b("Could not copy the callback URL. Select and copy it above."))},children:[s.jsx(Ve,{className:"mr-1.5 h-3.5 w-3.5"}),_?"Copied":"Copy callback URL"]})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Register this exact URL in your provider’s app settings before saving the client configuration."})]}),g.length>0?s.jsx("div",{className:"space-y-2",children:g.map(a=>s.jsxs("div",{className:I(qe,"flex flex-wrap items-center gap-3 p-3"),children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:a.display_name}),E(a,n.key)?s.jsx(ue,{variant:"secondary",className:"text-[10px]",children:"Default"}):null,s.jsx(Qe,{status:a.status})]}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.slug})]}),c&&!E(a,n.key)&&a.connector_key===n.key&&a.status==="active"?s.jsx(x,{variant:"outline",size:"sm",disabled:N.isPending,onClick:()=>N.mutate({connector_key:n.key,auth_profile_slug:a.slug}),children:"Set default"}):null]},a.slug))}):null,c?M?s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(X,{htmlFor:"oauth-app-name",children:"Display name"}),s.jsx(le,{id:"oauth-app-name",value:S,onChange:a=>P(a.target.value)})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(X,{htmlFor:"oauth-app-slug",children:"Slug"}),s.jsx(le,{id:"oauth-app-slug",placeholder:"optional",value:p,onChange:a=>O(a.target.value)})]}),s.jsx(Je,{schema:f.revision??void 0,values:F,onValuesChange:$,fieldIdPrefix:"oauth-app-"}),s.jsx(We,{visible:f.hasConflict,onReload:f.reset}),D?s.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:D}):null,s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(x,{variant:"outline",size:"sm",disabled:u.isPending,onClick:()=>{o(!1),l?.()},children:"Cancel"}),s.jsxs(x,{size:"sm",disabled:u.isPending||!f.canSubmit,onClick:R,children:[u.isPending?s.jsx(Xe,{size:"md",className:"mr-1.5"}):null,"Save OAuth app"]})]})]}):s.jsxs(x,{variant:"outline",size:"sm",onClick:()=>o(!0),children:[s.jsx(Z,{className:"size-3.5"}),"Add OAuth app"]}):null]})}function E(t,l){return!!t.is_default_for_connector&&t.connector_key===l}function Qe({status:t}){const l=t==="active"?"text-green-500":t==="error"||t==="revoked"?"text-destructive":"text-amber-500";return s.jsxs("span",{className:I("text-xs",l),children:["· ",t]})}function Ye(t){const l={};for(const[n,r]of Object.entries(t))typeof r=="string"&&r.trim()?l[n]=r.trim():(typeof r=="number"||typeof r=="boolean")&&(l[n]=String(r));return l}export{Qe as A,es as C,ss as O};
2
+ //# sourceMappingURL=connect-menu-C6iVtuSo.js.map
@@ -0,0 +1,2 @@
1
+ import{jD as r,j as t,aS as a}from"./index-DByaMzsG.js";import{a as s}from"./agent-connect-pages-DoI9UR0a.js";import"./connector-page-shell-BFv21yuv.js";import"./copy-button-C3wMMv63.js";import"./clients-xnzZeEdZ.js";import"./client-rows-vrNA6FLs.js";function x(){const{owner:e,clientId:o}=r.useParams();return t.jsx(a,{owner:e,children:({ownerSlug:n})=>t.jsx(s,{owner:n,clientId:o})})}export{x as component};
2
+ //# sourceMappingURL=connect._clientId-Cp-d9Q5b.js.map
@@ -1,2 +1,2 @@
1
- import{j as e,a2 as P,c as E,L as N,ex as M,A as $,G as D,cN as _,r as u,m as I,dP as K,ey as G,ic as f,B as y,ai as H,ar as O,dt as Q,eK as V,dv as W,dw as q,jG as F,aT as J}from"./index-CdDNNAx2.js";import{T as X,a as Y,b as S,c as d,d as Z,e as x}from"./table-C3DMoL4K.js";import{a as w,g as R}from"./client-rows-DGh1O-Fu.js";import{u as A}from"./client-activity-scopes-BBIq16tG.js";import{u as T,a as ee}from"./clients-BCvjAJDT.js";import{C as se}from"./connector-page-shell-BeuyjiB2.js";function te({isLive:n}){return e.jsx(P,{variant:n?"default":"secondary",className:`shrink-0 text-[10px] ${n?"":"text-muted-foreground"}`,title:n?"Live MCP transport":"No live MCP transport; activity history is retained",children:n?"Active":"Ended"})}function L({scopes:n,ownerSlug:i}){const l=E(),c=t=>({to:"/$owner/events",params:{owner:t.organizationId===null?"me":i},search:{client_ids:t.clientId,mcp_activity_id:t.activityId}}),r=t=>{l(c(t))};return e.jsx("div",{className:"rounded-lg border",children:e.jsxs(X,{children:[e.jsx(Y,{children:e.jsxs(S,{children:[e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Conversation"}),e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Calls"}),e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Last action"}),e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Last active"}),e.jsx(d,{className:"w-8 px-3 py-1.5"})]})}),e.jsx(Z,{children:n.map(t=>e.jsxs(S,{className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>r(t),children:[e.jsx(x,{className:"max-w-0 px-3 py-2 text-xs font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{...c(t),onClick:o=>o.stopPropagation(),className:"truncate hover:underline",children:w(t)}),t.activityKind==="session"?e.jsx(te,{isLive:t.isLive}):null,t.unreadNotificationCount>0?e.jsxs(P,{variant:"secondary",className:"shrink-0 text-[10px]",children:[t.unreadNotificationCount," unread"]}):null]})}),e.jsx(x,{className:"px-3 py-2 font-mono text-xs text-muted-foreground",children:t.callCount}),e.jsx(x,{className:"max-w-0 truncate px-3 py-2 text-xs text-muted-foreground",children:t.lastAction||"—"}),e.jsx(x,{className:"px-3 py-2 text-xs text-muted-foreground",children:M(t.lastCallAt)}),e.jsx(x,{className:"px-3 py-2 text-right",children:e.jsx("button",{type:"button","aria-label":`View ${w(t)} activity`,className:"text-muted-foreground hover:text-foreground",tabIndex:-1,children:e.jsx($,{className:"h-3.5 w-3.5"})})})]},`${t.clientId}:${t.activityId}`))})]})})}function ne({ownerSlug:n,clientId:i}){const{orgContext:l}=D(),{isAdmin:c}=_(l.organizationId),{data:r=[],isLoading:t}=T(null),o=ee(),[B,h]=u.useState(!1),s=u.useMemo(()=>R(r),[r]).find(a=>a.clientIds.includes(i)),b=s?.clientIds??[],g=A({enabled:!!s,limit:100,clientIds:b,activityKind:"conversation",organizationId:l?.organizationId??null}),p=A({enabled:!!s,limit:100,clientIds:b,activityKind:"session",organizationId:l?.organizationId??null,refetchInterval:a=>a?5e3:!1}),m=g.data??[],v=p.data??[],z=u.useMemo(()=>r.filter(a=>s?.clientIds.includes(a.id)),[r,s]);if(t)return e.jsxs("div",{className:"space-y-4",children:[e.jsx(I,{className:"h-16 w-full rounded-lg"}),e.jsx(I,{className:"h-24 w-full rounded-lg"})]});if(!s)return e.jsx("p",{className:"text-sm text-muted-foreground",children:"This app isn't connected to this workspace, so its details aren't available."});const j=z[0],C=j?.details?.redirectUris??[],k=s.linkedUserEntitySlug?K(n,[{entity_type:"$member",slug:s.linkedUserEntitySlug}]):null,U=[{label:"Registered",value:s.title},{label:s.clientIds.length===1?"Client ID":"Client IDs",value:e.jsx("div",{className:"space-y-1",children:s.clientIds.map(a=>e.jsx("code",{className:"block break-all",children:a},a))})},...s.drivenBy&&s.drivenBy!==s.title?[{label:"Driven by",value:s.drivenBy}]:[],...j?.platform?[{label:"Software",value:j.platform}]:[],...C.length>0?[{label:"Redirects",value:C.join(", ")}]:[],{label:"Granted by",value:k&&s.linkedUser?e.jsx(N,{to:k,className:"font-medium text-primary hover:underline",children:s.linkedUser}):s.linkedUser??"—"},{label:"Last active",value:s.connected?G(s.lastSeenAt):"disconnected"},{label:"Registrations",value:String(s.clientIds.length)}];return e.jsxs("div",{className:"space-y-7",children:[e.jsx(f,{title:"Settings",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"overflow-hidden rounded-lg border text-xs",children:e.jsx("dl",{className:"divide-y",children:U.map(a=>e.jsxs("div",{className:"flex gap-3 px-3 py-2",children:[e.jsx("dt",{className:"w-28 shrink-0 text-muted-foreground",children:a.label}),e.jsx("dd",{className:"min-w-0 flex-1 break-words",children:a.value})]},a.label))})}),c&&s.connected?e.jsxs("div",{className:"space-y-2 rounded-lg border p-3",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Revoking disconnects every registration this app holds",s.clientIds.length>1?` (${s.clientIds.length} of them)`:""," ","and kills its live sessions. It can reconnect by authorizing again."]}),B?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",disabled:o.isPending,onClick:()=>o.mutate({clientId:s.clientIds[0],scope:"all"},{onSettled:()=>h(!1)}),children:o.isPending?"Revoking…":"Confirm revoke"}),e.jsx(y,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",disabled:o.isPending,onClick:()=>h(!1),children:"Cancel"})]}):e.jsx(y,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs text-destructive hover:text-destructive",onClick:()=>h(!0),children:"Revoke"})]}):null]})}),e.jsx(f,{title:"Conversations",count:m.length>0?String(m.length):void 0,children:g.isLoading||p.isLoading?e.jsxs("div",{className:"flex items-center py-4 text-xs text-muted-foreground",children:[e.jsx(H,{className:"mr-2"})," Loading client activity…"]}):g.isError||p.isError?e.jsx("p",{className:"py-3 text-xs text-destructive",children:"Could not load this app's activity."}):m.length===0?e.jsx("p",{className:"py-3 text-xs text-muted-foreground",children:"No recent conversations."}):e.jsx(L,{scopes:m,ownerSlug:n})}),v.length>0?e.jsx(f,{title:"Sessions",count:String(v.length),children:e.jsx(L,{scopes:v,ownerSlug:n})}):null]})}function ae({owner:n,clientId:i}){const{data:l=[]}=T(null),r=u.useMemo(()=>R(l).find(t=>t.clientIds.includes(i)),[i,l])?.title??"Connected agent";return e.jsx(O,{className:"gap-3 pt-2.5 pb-8",children:e.jsx(se,{header:e.jsx(Q,{breadcrumb:e.jsx(W,{crumbs:[e.jsx(N,{to:"/$owner",params:{owner:n},search:{section:"agent"},className:q,children:"Agents"},"agents")]}),icon:e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:e.jsx(V,{name:r})}),title:r,caption:"An external agent connected to this workspace through Lobu. Review its Lobu conversations, activity, and access."}),children:e.jsx(ne,{ownerSlug:n,clientId:i},i)})})}function me(){const{owner:n,clientId:i}=F.useParams();return e.jsx(J,{owner:n,children:({ownerSlug:l})=>e.jsx(ae,{owner:l,clientId:i})})}export{me as component};
2
- //# sourceMappingURL=connected._clientId-BsDzltNz.js.map
1
+ import{j as e,a7 as R,c as E,L as N,ev as M,A as $,M as D,cJ as _,r as u,m as I,dL as K,ew as H,i8 as f,B as y,al as G,at as O,dr as Q,eI as J,ds as V,dt as W,jC as q,aS as F}from"./index-DByaMzsG.js";import{T as X,a as Y,b as S,c as d,d as Z,e as x}from"./table-C637cQxG.js";import{a as w,g as P}from"./client-rows-vrNA6FLs.js";import{u as A}from"./client-activity-scopes-BPbRX-Pe.js";import{u as B,a as ee}from"./clients-xnzZeEdZ.js";import{C as se}from"./connector-page-shell-BFv21yuv.js";function te({isLive:n}){return e.jsx(R,{variant:n?"default":"secondary",className:`shrink-0 text-[10px] ${n?"":"text-muted-foreground"}`,title:n?"Live MCP transport":"No live MCP transport; activity history is retained",children:n?"Active":"Ended"})}function L({scopes:n,ownerSlug:i}){const l=E(),c=t=>({to:"/$owner/events",params:{owner:t.organizationId===null?"me":i},search:{client_ids:t.clientId,mcp_activity_id:t.activityId}}),r=t=>{l(c(t))};return e.jsx("div",{className:"rounded-lg border",children:e.jsxs(X,{children:[e.jsx(Y,{children:e.jsxs(S,{children:[e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Conversation"}),e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Calls"}),e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Last action"}),e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Last active"}),e.jsx(d,{className:"w-8 px-3 py-1.5"})]})}),e.jsx(Z,{children:n.map(t=>e.jsxs(S,{className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>r(t),children:[e.jsx(x,{className:"max-w-0 px-3 py-2 text-xs font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{...c(t),onClick:o=>o.stopPropagation(),className:"truncate hover:underline",children:w(t)}),t.activityKind==="session"?e.jsx(te,{isLive:t.isLive}):null,t.unreadNotificationCount>0?e.jsxs(R,{variant:"secondary",className:"shrink-0 text-[10px]",children:[t.unreadNotificationCount," unread"]}):null]})}),e.jsx(x,{className:"px-3 py-2 font-mono text-xs text-muted-foreground",children:t.callCount}),e.jsx(x,{className:"max-w-0 truncate px-3 py-2 text-xs text-muted-foreground",children:t.lastAction||"—"}),e.jsx(x,{className:"px-3 py-2 text-xs text-muted-foreground",children:M(t.lastCallAt)}),e.jsx(x,{className:"px-3 py-2 text-right",children:e.jsx("button",{type:"button","aria-label":`View ${w(t)} activity`,className:"text-muted-foreground hover:text-foreground",tabIndex:-1,children:e.jsx($,{className:"h-3.5 w-3.5"})})})]},`${t.clientId}:${t.activityId}`))})]})})}function ne({ownerSlug:n,clientId:i}){const{orgContext:l}=D(),{isAdmin:c}=_(l.organizationId),{data:r=[],isLoading:t}=B(null),o=ee(),[T,h]=u.useState(!1),s=u.useMemo(()=>P(r),[r]).find(a=>a.clientIds.includes(i)),b=s?.clientIds??[],g=A({enabled:!!s,limit:100,clientIds:b,activityKind:"conversation",organizationId:l?.organizationId??null}),p=A({enabled:!!s,limit:100,clientIds:b,activityKind:"session",organizationId:l?.organizationId??null,refetchInterval:a=>a?5e3:!1}),m=g.data??[],v=p.data??[],z=u.useMemo(()=>r.filter(a=>s?.clientIds.includes(a.id)),[r,s]);if(t)return e.jsxs("div",{className:"space-y-4",children:[e.jsx(I,{className:"h-16 w-full rounded-lg"}),e.jsx(I,{className:"h-24 w-full rounded-lg"})]});if(!s)return e.jsx("p",{className:"text-sm text-muted-foreground",children:"This app isn't connected to this workspace, so its details aren't available."});const j=z[0],C=j?.details?.redirectUris??[],k=s.linkedUserEntitySlug?K(n,[{entity_type:"$member",slug:s.linkedUserEntitySlug}]):null,U=[{label:"Registered",value:s.title},{label:s.clientIds.length===1?"Client ID":"Client IDs",value:e.jsx("div",{className:"space-y-1",children:s.clientIds.map(a=>e.jsx("code",{className:"block break-all",children:a},a))})},...s.drivenBy&&s.drivenBy!==s.title?[{label:"Driven by",value:s.drivenBy}]:[],...j?.platform?[{label:"Software",value:j.platform}]:[],...C.length>0?[{label:"Redirects",value:C.join(", ")}]:[],{label:"Granted by",value:k&&s.linkedUser?e.jsx(N,{to:k,className:"font-medium text-primary hover:underline",children:s.linkedUser}):s.linkedUser??"—"},{label:"Last active",value:s.connected?H(s.lastSeenAt):"disconnected"},{label:"Registrations",value:String(s.clientIds.length)}];return e.jsxs("div",{className:"space-y-7",children:[e.jsx(f,{title:"Settings",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"overflow-hidden rounded-lg border text-xs",children:e.jsx("dl",{className:"divide-y",children:U.map(a=>e.jsxs("div",{className:"flex gap-3 px-3 py-2",children:[e.jsx("dt",{className:"w-28 shrink-0 text-muted-foreground",children:a.label}),e.jsx("dd",{className:"min-w-0 flex-1 break-words",children:a.value})]},a.label))})}),c&&s.connected?e.jsxs("div",{className:"space-y-2 rounded-lg border p-3",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Revoking disconnects every registration this app holds",s.clientIds.length>1?` (${s.clientIds.length} of them)`:""," ","and kills its live sessions. It can reconnect by authorizing again."]}),T?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",disabled:o.isPending,onClick:()=>o.mutate({clientId:s.clientIds[0],scope:"all"},{onSettled:()=>h(!1)}),children:o.isPending?"Revoking…":"Confirm revoke"}),e.jsx(y,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",disabled:o.isPending,onClick:()=>h(!1),children:"Cancel"})]}):e.jsx(y,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs text-destructive hover:text-destructive",onClick:()=>h(!0),children:"Revoke"})]}):null]})}),e.jsx(f,{title:"Conversations",count:m.length>0?String(m.length):void 0,children:g.isLoading||p.isLoading?e.jsxs("div",{className:"flex items-center py-4 text-xs text-muted-foreground",children:[e.jsx(G,{className:"mr-2"})," Loading client activity…"]}):g.isError||p.isError?e.jsx("p",{className:"py-3 text-xs text-destructive",children:"Could not load this app's activity."}):m.length===0?e.jsx("p",{className:"py-3 text-xs text-muted-foreground",children:"No recent conversations."}):e.jsx(L,{scopes:m,ownerSlug:n})}),v.length>0?e.jsx(f,{title:"Sessions",count:String(v.length),children:e.jsx(L,{scopes:v,ownerSlug:n})}):null]})}function ae({owner:n,clientId:i}){const{data:l=[]}=B(null),r=u.useMemo(()=>P(l).find(t=>t.clientIds.includes(i)),[i,l])?.title??"Connected agent";return e.jsx(O,{className:"gap-3 pt-2.5 pb-8",children:e.jsx(se,{header:e.jsx(Q,{breadcrumb:e.jsx(V,{crumbs:[e.jsx(N,{to:"/$owner",params:{owner:n},search:{section:"agent"},className:W,children:"Agents"},"agents")]}),icon:e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:e.jsx(J,{name:r})}),title:r,caption:"An external agent connected to this workspace through Lobu. Review its Lobu conversations, activity, and access."}),children:e.jsx(ne,{ownerSlug:n,clientId:i},i)})})}function me(){const{owner:n,clientId:i}=q.useParams();return e.jsx(F,{owner:n,children:({ownerSlug:l})=>e.jsx(ae,{owner:l,clientId:i})})}export{me as component};
2
+ //# sourceMappingURL=connected._clientId-ROfVgp9h.js.map
@@ -0,0 +1,2 @@
1
+ import{bp as W,V as F,r as l,af as z,a4 as R,j as e,al as N,B as f,bq as V,br as q,bs as M,bt as Y,bu as E,$ as B,Q as D,F as G,ah as K,an as H,a0 as J}from"./index-DByaMzsG.js";import{s as Q}from"./index-BS5Ty3tf.js";import{C as X,a as Z,b as ee,c as ne}from"./card-DtLIFq7D.js";const C="__new_org__";function te(r){return r.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function w(r){return Q.find(i=>i.provider===r)?.name??r}function re(r,i){return`${window.location.origin}/connector/${encodeURIComponent(r)}/connection?${new URLSearchParams({ref:i})}`}function ie(r,i){return r==="account_already_linked_to_different_user"?`This ${i} account belongs to a different Lobu account than the one you are signed in to. Sign out, then continue with ${i} to finish setup as that account.`:`We couldn’t verify your ${i} account for this setup. Sign out, then continue with ${i} to try again.`}function oe(r,i){const[s,n]=l.useState({}),o=i?`${i}:${r}`:null;return l.useEffect(()=>{if(!o||!i||o in s)return;let c=!1;return D(i).then(h=>h.find(g=>g.key===r)?.name??null).catch(()=>null).then(h=>{c||n(g=>({...g,[o]:h}))}),()=>{c=!0}},[o,r,s,i]),o?s[o]??null:null}function I(r,i,s){if(!r)return"/";const n=`/${encodeURIComponent(r)}/`;if(s?.startsWith(n)){const o=new URL(s,window.location.origin);if(o.origin===window.location.origin&&o.pathname.startsWith(n))return o.pathname+o.search}return`${n}connectors/${encodeURIComponent(i)}?connected=1`}function se(r,i){return r==="not_admin"?`You must be an admin or owner to connect ${i} to Lobu.`:`You don't have permission to connect ${i} to Lobu.`}function T(r,i,s){switch(r){case"not_authorized":return se(i,s);case"no_pending":return`No Lobu install was found for ${s}. Add Lobu from the marketplace to get started.`;case"no_org":return`Your account has no Lobu organization to connect ${s} to.`;default:return`Something went wrong while connecting ${s}. Please try again.`}}function de(){const{name:r}=W({from:"/connector/$name/connection"}),{ref:i,error:s}=F({from:"/connector/$name/connection"}),[n,o]=l.useState({kind:"loading"}),[c,h]=l.useState(""),[g,O]=l.useState(""),[x,$]=l.useState(!1),[_,p]=l.useState(null),[j,k]=l.useState(null),u=oe(r,n.kind==="confirm"?n.orgs[0]?.slug??null:n.kind==="already_connected"?n.orgSlug:null),m=n.kind==="confirm"&&n.subjectKind||"connection",S=n.kind==="confirm"&&n.subjectName?n.subjectName:u?`this ${u} ${m}`:`this ${m}`,P=l.useCallback(async()=>{if(!i){o({kind:"error",message:"This connection link is missing its reference."});return}o({kind:"loading"});try{const t=await(await z(`${R}/api/connector/${encodeURIComponent(r)}/connection/claim-context?ref=${encodeURIComponent(i)}`,{credentials:"include"})).json();if("error"in t){if(t.error==="unauthenticated"){o({kind:"signin",signinProvider:t.signinProvider??r,linkAccount:!1});return}if(t.error==="signin_required"){o(s?{kind:"link_failed",signinProvider:t.signinProvider??r,error:s}:{kind:"signin",signinProvider:t.signinProvider??r,linkAccount:!0});return}o({kind:"error",message:T(t.error,t.code,"this connection")});return}if("alreadyConnected"in t){o({kind:"already_connected",orgSlug:t.orgSlug,nextUrl:t.nextUrl});return}h(t.orgs[0]?.slug??""),o({kind:"confirm",subjectKind:t.subjectKind,subjectName:t.subjectName,orgs:t.orgs})}catch{o({kind:"error",message:"We couldn’t load this connection link. Please try again."})}},[r,i,s]);l.useEffect(()=>{P()},[P]);const L=async d=>{if(!i)return;const t=re(r,i);if(n.kind==="signin"&&n.linkAccount){const y=await G.linkSocial({provider:d,callbackURL:t,errorCallbackURL:t});y.error&&o({kind:"error",message:y.error.message??"Couldn’t verify this account."});return}n.kind==="link_failed"&&await K(),await H.social({provider:d,callbackURL:t,errorCallbackURL:t})},U=async(d=!1)=>{if(!(!i||!c)){$(!0),p(null),k(null);try{let t=c;if(c===C){const b=g.trim();if(!b){p("Enter a name for the new organization.");return}const v=await J.create({name:b,slug:te(b)});if(v.error||!v.data){p(v.error?.message??"Couldn’t create the organization.");return}t=v.data.slug}const a=await(await z(`${R}/api/connector/${encodeURIComponent(r)}/connection/claim`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({ref:i,org:t,confirmMove:d})})).json();if("error"in a){if(a.error==="signin_required"||a.error==="unauthenticated"){o({kind:"signin",signinProvider:a.signinProvider??r,linkAccount:a.error==="signin_required"});return}if((a.error==="already_connected_elsewhere"||a.error==="enterprise_scope_overlap")&&a.existing){k({kind:a.error,existing:a.existing});return}p(T(a.error,a.code,S));return}window.location.href=I(a.orgSlug,r,a.nextUrl)}catch{p(`Something went wrong while connecting this ${m}. Please try again.`)}finally{$(!1)}}},A=n.kind==="signin"?"Sign in to continue":n.kind==="link_failed"?"Use a different account":n.kind==="error"?`Can’t connect this ${m}`:n.kind==="already_connected"?"Already connected":u?`Connect ${u} to Lobu`:"Connect to Lobu";return e.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center",children:e.jsx("div",{className:"w-full max-w-md p-8",children:e.jsxs(X,{children:[e.jsx(Z,{children:e.jsx(ee,{asChild:!0,children:e.jsx("h1",{children:A})})}),e.jsxs(ne,{children:[n.kind==="loading"&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-sm text-muted-foreground",children:[e.jsx(N,{size:"lg"}),e.jsx("span",{children:"Checking this connection link…"})]}),n.kind==="error"&&e.jsx("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:n.message}),n.kind==="already_connected"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["This ",u?`${u} `:"",m," is already connected to Lobu."]}),e.jsx(f,{className:"w-full",asChild:!0,children:e.jsx("a",{href:I(n.orgSlug,r,n.nextUrl),children:n.nextUrl?"Choose an agent":"Open Lobu"})})]}),n.kind==="signin"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Sign in with ",w(n.signinProvider)," to verify you can connect this ",m,"."]}),e.jsxs(f,{className:"w-full",onClick:()=>L(n.signinProvider),children:["Sign in with ",w(n.signinProvider)]})]}),n.kind==="link_failed"&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{role:"alert",className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:ie(n.error,w(n.signinProvider))}),e.jsxs(f,{className:"w-full",onClick:()=>L(n.signinProvider),children:["Sign out and continue with"," ",w(n.signinProvider)]})]}),n.kind==="confirm"&&(()=>{const d=n.subjectName||S;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Connecting"," ",e.jsx("strong",{className:"font-medium text-foreground",children:d}),". Choose the organization to connect it to:"]}),e.jsxs(V,{value:c,onValueChange:t=>{k(null),h(t)},children:[e.jsx(q,{children:e.jsx(M,{placeholder:"Select an organization"})}),e.jsxs(Y,{children:[n.orgs.map(t=>e.jsxs(E,{value:t.slug,children:[t.name,t.isPersonal&&e.jsx("span",{className:"ml-1 text-muted-foreground",children:"(personal)"})]},t.id)),e.jsx(E,{value:C,children:"+ New organization"})]})]}),c===C&&e.jsx(B,{autoFocus:!0,value:g,onChange:t=>O(t.target.value),placeholder:"New organization name","aria-label":"New organization name"}),_&&e.jsx("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:_}),j&&(()=>{const t=j.existing.orgName??j.existing.orgSlug??"another organization";return j.kind==="already_connected_elsewhere"?e.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-muted/40 px-3 py-3",children:[e.jsxs("p",{className:"text-sm text-foreground",children:[d," is already connected in"," ",e.jsx("strong",{className:"font-medium",children:t}),". Move it here?"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{className:"flex-1",onClick:()=>U(!0),disabled:x,children:x?e.jsxs(e.Fragment,{children:[e.jsx(N,{size:"lg"}),e.jsx("span",{className:"ml-2",children:"Moving…"})]}):"Move it here"}),e.jsx(f,{className:"flex-1",variant:"outline",onClick:()=>k(null),disabled:x,children:"Cancel"})]})]}):e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:["This ",u?`${u} `:"","Enterprise Grid is already connected in"," ",e.jsx("strong",{className:"font-medium",children:t}),"; ","connecting this ",m," here may change how its messages route. Contact support to move it."]})})(),e.jsx(f,{className:"w-full",onClick:()=>U(),disabled:x||j!==null||!c||c===C&&!g.trim(),children:x?e.jsxs(e.Fragment,{children:[e.jsx(N,{size:"lg"}),e.jsx("span",{className:"ml-2",children:"Connecting…"})]}):`Connect ${d}`})]})})()]})]})})})}export{de as component};
2
+ //# sourceMappingURL=connection-BMz740Wi.js.map
@@ -1,2 +1,2 @@
1
- import{r as d,j as e,dZ as X,jy as R,m as T,B as v,jz as G,L as E,i as w,ai as F,fj as B,hJ as Q,gS as Y,aP as ee,a4 as se,gU as te,jA as ne,c6 as U,fb as V,hO as A,br as ae,bs as ce,bt as ie,bu as le,bv as re,fc as W,cb as H,bT as oe,d9 as de,dd as me,a7 as ue,jB as xe,e8 as he,jC as pe,jD as fe,jE as ge,hZ as je,e$ as ye,ic as L,u as ve,jF as Ne,eU as I,a2 as q,ex as z}from"./index-CdDNNAx2.js";import{S as be}from"./scoped-feed-bar-L7h-Ca4u.js";import{E as _e}from"./events-feed-BI7wNRUY.js";import{f as Se,C as ke}from"./entity-options-CpeX7iiX.js";import{V as Ce,a as we}from"./runs-list-8gUPWjP4.js";import{S as P,g as K}from"./status-variants-BR_iGWN5.js";import{f as Fe}from"./feed-event-kinds-BYuZCoU4.js";function Oe({connection:s,ownerSlug:t}){const[a,c]=d.useState([]),x=d.useMemo(()=>[s.connector_key],[s.connector_key]),m=d.useMemo(()=>({connectionIds:[s.id],...a.length>0?{semanticTypes:a}:{}}),[s.id,a]),r=s.facets?.chat??!1;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{"aria-label":r?"Channels":"Feeds",className:"space-y-2",children:[e.jsx("h2",{className:"text-sm font-semibold",children:r?"Channels":"Feeds"}),e.jsx(Ee,{connection:s,ownerSlug:t})]}),e.jsxs("section",{"aria-label":"What came in",className:"space-y-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("h2",{className:"shrink-0 text-sm font-semibold",children:"What came in"}),e.jsx(be,{owner:t,organizationId:s.organization_id,activitySearch:{connection_ids:String(s.id)},kinds:a,onKindsChange:c,platforms:x})]}),e.jsx(_e,{organizationId:s.organization_id,ownerSlug:t,filters:m,hideOriginator:!0,emptyState:e.jsx("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Nothing has come in from this connection yet."})})]})]})}function Ee({connection:s,ownerSlug:t}){const{data:a=[],isLoading:c,isError:x,refetch:m}=X(s.id),r=R();return c?e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"h-12 w-full rounded-lg"}),e.jsx(T,{className:"h-12 w-full rounded-lg"})]}):x?e.jsxs("div",{role:"alert",className:"space-y-2 text-sm",children:[e.jsx("p",{children:"Could not load feeds."}),e.jsx(v,{variant:"outline",size:"sm",onClick:()=>void m(),children:"Retry"})]}):a.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No feeds yet. Add one from Settings."}):e.jsx("ul",{className:"divide-y overflow-hidden rounded-lg border",children:a.map(i=>{const l=G(i),p=i.operations.includes("sync"),u=i.active_runs>0||r.isPending&&r.variables===i.id;return e.jsxs("li",{className:"flex items-center gap-3 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(E,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:t,connectorKey:s.connector_key,connectionId:String(s.id)},search:{feedId:i.id},className:"block truncate text-sm font-medium hover:underline",children:i.display_name?.trim()||i.feed_key}),e.jsx("p",{className:w("truncate text-xs",l.failed?"text-destructive":"text-muted-foreground"),title:l.text,children:p&&i.execution_mode==="no_schedule"?`${l.text} No schedule: it runs only when you sync it.`:p?l.text:"Live access, nothing to sync."})]}),p?e.jsxs(v,{type:"button",size:"sm",variant:l.failed?"default":"outline",className:"h-7 shrink-0 text-xs",disabled:u,onClick:()=>r.mutate(i.id),children:[u?e.jsx(F,{size:"sm",className:"mr-1"}):e.jsx(B,{className:"mr-1 h-3 w-3"}),u?"Syncing":l.failed?"Try again":"Sync now"]}):null]},i.id)})})}function $e({organizationId:s,value:t,onChange:a,entities:c,className:x}){const{data:m=[]}=Q(c?void 0:s),r=d.useMemo(()=>c??Se(m),[c,m]),i=new Set(t),l=r.filter(o=>i.has(o.id)),p=o=>{const n=new Set(i);n.has(o)?n.delete(o):n.add(o),a(Array.from(n).sort((f,N)=>f-N))},u=l.length===0?"All entities":l.length===1?l[0].name:`${l.length} entities selected`;return e.jsx(Y,{contentClassName:"w-[320px]",searchPlaceholder:"Filter entities...",emptyText:"No entities found.",trigger:o=>e.jsxs(v,{variant:"outline",role:"combobox","aria-expanded":o,className:w("justify-between",x),children:[u,e.jsx(te,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),children:()=>r.map(o=>{const n=i.has(o.id);return e.jsxs(ee,{value:`${o.name} ${o.entityType}`,onSelect:()=>p(o.id),className:"cursor-pointer",children:[e.jsx(se,{className:w("mr-2 h-4 w-4",n?"opacity-100":"opacity-0")}),e.jsxs("span",{children:[o.name," ",e.jsxs("span",{className:"text-muted-foreground text-xs",children:["(",o.entityType,")"]})]})]},o.id)})})}function De(s){return s?.feeds_schema?Object.entries(s.feeds_schema).map(([t,a])=>({key:t,name:a.name??t,description:a.description,configSchema:a.configSchema})):[]}const Re="Feeds are optional scheduled sync targets for an existing connection.";function Be({organizationId:s,connections:t,connectorDefinitions:a,entityId:c,onClose:x}){const m=t.length===1,[r,i]=d.useState(m?String(t[0].id):""),[l,p]=d.useState(""),[u,o]=d.useState(c?[c]:[]),[n,f]=d.useState(null),N=ne(),k=d.useMemo(()=>new Map(a.map(h=>[h.key,h])),[a]),y=d.useMemo(()=>t.find(h=>String(h.id)===r),[t,r]),b=d.useMemo(()=>y?De(k.get(y.connector_key)):[],[y,k]),C=d.useMemo(()=>b.find(h=>h.key===l)??null,[b,l]),j=U(`${r}:${l}`,V(C?.configSchema),C?.configSchema),{values:_,setValues:$}=j,S=d.useCallback(()=>{i(m?String(t[0].id):""),p(""),o(c?[c]:[]),f(null)},[c,m,t]),g=d.useCallback(()=>{S(),x()},[x,S]),D=d.useCallback(async()=>{if(!j.canSubmit||!y||!l)return;f(null);const h=A(_);try{await N.mutateAsync({connection_id:y.id,feed_key:l,config:Object.keys(h).length>0?h:void 0,entity_ids:c?[c]:u.length>0?u:void 0}),g()}catch(M){f(M instanceof Error?M.message:"Failed to create feed")}},[_,j.canSubmit,N,c,g,y,u,l]),Z=e.jsxs("div",{className:"flex-1 space-y-4 overflow-y-auto py-6 pr-1",children:[!m&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Connection"}),e.jsx(ke,{connections:t,value:r,onValueChange:h=>{i(h),p(""),f(null)},placeholder:"Select a connection"})]}),y&&b.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Feed Type"}),e.jsxs(ae,{value:l,onValueChange:p,children:[e.jsx(ce,{children:e.jsx(ie,{placeholder:"Select feed type"})}),e.jsx(le,{children:b.map(h=>e.jsx(re,{value:h.key,children:e.jsxs("div",{children:[e.jsx("span",{children:h.name}),h.description&&e.jsxs("span",{className:"text-muted-foreground ml-1 text-xs",children:["— ",h.description]})]})},h.key))})]})]}),c?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Target Entity"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This feed will be attached to the current entity."})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Target Entities"}),e.jsx($e,{organizationId:s,value:u,onChange:o,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. Leave empty to create an unscoped feed."})]}),j.revision&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Feed Configuration"}),e.jsx(W,{schema:j.revision,values:_,onValuesChange:$})]}),y&&b.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"This connector has no configurable feed types."}),e.jsx(H,{visible:j.hasConflict,onReload:j.reset}),n&&e.jsx("p",{className:"text-sm text-destructive",children:n})]}),J=e.jsx(oe,{onCancel:g,className:"mt-2",children:e.jsxs(v,{disabled:!j.canSubmit||!l||N.isPending,onClick:()=>void D(),children:[N.isPending&&e.jsx(F,{size:"lg",className:"mr-2"}),"Create Feed"]})});return e.jsxs("div",{className:"flex flex-col",children:[Z,J]})}function Ue({feed:s,onClose:t,hideHeader:a=!1}){const c=s.display_name?.trim()||s.feed_key,x=s.feed_key.includes(":")?s.feed_key.slice(s.feed_key.indexOf(":")+1):s.feed_key,m=s.external_tenant_id,r=s.connector_key==="slack"&&m?`https://app.slack.com/client/${m}/${x}`:void 0;return e.jsxs("div",{className:"flex max-w-xl flex-col gap-4",children:[a?null:e.jsxs(e.Fragment,{children:[t?e.jsxs("button",{type:"button",onClick:t,className:"inline-flex w-fit items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(de,{className:"h-3 w-3"}),"Back to connection"]}):null,e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(me,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("h2",{className:"text-lg font-semibold leading-tight",children:c}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"chat channel"})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Messages captured for this channel are available to Lobu Automations. Open Slack to read the channel history."}),r?e.jsx(v,{asChild:!0,variant:"outline",className:"w-full justify-center",children:e.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(ue,{className:"mr-2 h-4 w-4"}),"Open in Slack"]})}):null,e.jsxs("div",{className:w(he,"flex flex-col gap-3 p-4"),children:[e.jsx("div",{className:"text-xs font-medium uppercase text-muted-foreground",children:"Channel"}),e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx(xe,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"break-all",children:c})]}),m?e.jsxs("div",{className:"flex items-baseline justify-between gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Workspace"}),e.jsx("span",{className:"break-all font-mono text-xs",children:m})]}):null,e.jsx("p",{className:"text-xs text-muted-foreground",children:"Messages the bot sees here are captured as they arrive. Open the channel in Slack to read the full history."})]})]})}function We(s,t){return s.display_name?s.display_name:t?.feeds_schema?.[s.feed_key]?.name??s.feed_key}function Ie(s,t){const a=s?.feeds_schema;if(!a)return;if(a[t])return a[t];const c=Object.values(a);return c.find(x=>x?.key===t)??(c.length===1?c[0]:void 0)}const O=8;function Ve({kinds:s,feedId:t,ownerSlug:a}){const[c,x]=d.useState(!1),m=ve(),r=c?s:s.slice(0,O);return e.jsxs(L,{title:"Event types",count:`${s.length} ${s.length===1?"kind":"kinds"}`,children:[e.jsx("ul",{className:"divide-y",children:r.map(({kind:i,description:l,targets:p})=>{const u=Ne(a,t,[i]),o=`${I(i)} events`;return e.jsx("li",{children:e.jsxs(E,{to:u,className:"flex flex-col gap-1 py-2 text-left transition-colors hover:bg-accent/50 sm:flex-row sm:items-start sm:gap-4",onClick:n=>{!m||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||n.button!==0||(n.preventDefault(),m.open({href:u,title:o}))},children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:I(i)}),e.jsx("code",{className:"truncate font-mono text-[11px] text-muted-foreground",children:i})]}),l?e.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",title:l,children:l}):null]}),p.length>0?e.jsx("div",{className:"flex flex-wrap gap-1 sm:max-w-[40%] sm:justify-end",children:p.map(({entityType:n,creates:f})=>e.jsx(q,{variant:"secondary",className:"font-normal",title:f?`Creates ${n} records`:`Links to existing ${n} records`,children:I(n)},n))}):null]})},i)})}),s.length>O?e.jsx(v,{variant:"ghost",size:"sm",className:"mt-1 h-7 px-2 text-xs text-muted-foreground",onClick:()=>x(i=>!i),children:c?"Show fewer":`Show all ${s.length}`}):null]})}function He({feed:s,ownerSlug:t}){return e.jsxs(e.Fragment,{children:[e.jsx(P,{status:K(s.status),showDot:!0,children:s.status}),s.connection_status&&s.connection_status!==s.status&&e.jsxs(P,{status:K(s.connection_status),showDot:!0,children:["Connection: ",s.connection_status]}),s.device_worker_id?e.jsx(E,{to:"/$owner/connectors/device/$deviceId",params:{owner:t,deviceId:s.device_worker_id},children:e.jsx(q,{variant:s.device_status==="offline"?"secondary":"outline",className:"text-xs hover:bg-accent",children:s.device_status==="offline"?`Waiting for ${s.device_label||s.device_platform||"device"}`:`On ${s.device_label||s.device_platform||"device"}`})}):null]})}function qe({feed:s}){return s.operations.includes("sync")?e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:["Last sync: ",s.last_sync_at?z(s.last_sync_at):"—"]}),e.jsxs("span",{children:["Next: ",s.next_run_at?z(s.next_run_at):"—"]}),s.event_count!=null&&e.jsxs("span",{className:"font-mono",children:[s.event_count.toLocaleString()," events"]})]}):e.jsx("span",{children:"Read live when queried"})}function Ze({feed:s,connectorDef:t,ownerSlug:a}){const{data:c,refetch:x}=pe(s.id),m=d.useMemo(()=>(c?.recent_runs??[]).map(g=>({...g,run_type:"sync"})),[c?.recent_runs]),r=fe(),i=R(),l=c?.recent_runs?.some(g=>["running","pending","claimed"].includes(g.status));d.useEffect(()=>{if(!l)return;const g=setInterval(()=>x(),5e3);return()=>clearInterval(g)},[l,x]);const p=d.useMemo(()=>Ie(t,s.feed_key),[t,s.feed_key]),u=p?.configSchema,o=d.useMemo(()=>Fe(p).sort((g,D)=>g.kind.localeCompare(D.kind)),[p]),n=U(s.id,V(u,s.config??{}),u),{values:f,setValues:N,dirty:k}=n,y=d.useCallback(async()=>{n.canSubmit&&(await r.mutateAsync({feed_id:s.id,config:A(f)}),n.accept(f,V(u,A(f))))},[r,s.id,f,u,n.canSubmit,n.accept]),b=d.useCallback(async()=>{const g=s.status==="active"?"paused":"active";await r.mutateAsync({feed_id:s.id,status:g})},[r,s.id,s.status]),C=d.useCallback(async()=>{await i.mutateAsync(s.id)},[i,s.id]),j=s.status==="active",_=s.operations.includes("sync"),$=s.auth_profile_status&&s.auth_profile_status!=="active",S=r.isPending||i.isPending;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(v,{variant:"outline",size:"sm",disabled:S,onClick:()=>void b(),children:[j?e.jsx(ge,{className:"h-3.5 w-3.5 mr-1.5"}):e.jsx(je,{className:"h-3.5 w-3.5 mr-1.5"}),j?"Pause":"Resume"]}),_?e.jsxs(v,{variant:"outline",size:"sm",disabled:S||!j,onClick:()=>void C(),children:[i.isPending?e.jsx(F,{size:"md",className:"mr-1.5"}):e.jsx(B,{className:"h-3.5 w-3.5 mr-1.5"}),"Sync now"]}):null,e.jsx(Ce,{ownerSlug:a,scope:{kind:"feed",id:s.id},variant:"ghost",label:"View in memory"})]}),$&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-50 dark:bg-amber-950/20 px-3 py-2 text-sm",children:[e.jsx(ye,{className:"h-4 w-4 text-amber-500 shrink-0"}),e.jsxs("span",{className:"text-amber-700 dark:text-amber-400",children:["Authentication issue: ",s.auth_profile_status]}),e.jsx(v,{asChild:!0,variant:"outline",size:"sm",className:"ml-auto h-7 text-xs",children:e.jsx(E,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:a,connectorKey:s.connector_key,connectionId:String(s.connection_id)},search:{settings:!0},children:"Fix auth"})})]}),n.revision?e.jsx(L,{title:"Settings",children:e.jsxs("div",{className:"max-w-xl space-y-4",children:[e.jsx(W,{schema:n.revision,values:f,onValuesChange:N}),e.jsx(H,{visible:n.hasConflict,onReload:n.reset}),k&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(v,{size:"sm",disabled:S||!n.canSubmit,onClick:()=>void y(),children:[r.isPending?e.jsx(F,{size:"md",className:"mr-1.5"}):null,"Save"]})})]})}):null,o.length>0?e.jsx(Ve,{kinds:o,feedId:s.id,ownerSlug:a}):null,_?e.jsx(L,{title:"Recent syncs",children:e.jsx(we,{runs:m,ownerSlug:a,emptyState:e.jsx("p",{className:"rounded-lg border bg-muted/20 px-3 py-6 text-center text-xs text-muted-foreground",children:"No syncs yet."})})}):null]})}export{Be as A,Oe as C,He as F,Ue as a,qe as b,Ze as c,Re as d,We as f};
2
- //# sourceMappingURL=connection-feed-detail-CJju0qiw.js.map
1
+ import{r as d,j as e,dX as Z,ju as R,m as z,B as v,jv as G,L as E,i as w,al as F,fh as B,hF as J,gO as Y,aO as ee,a9 as se,gQ as te,jw as ne,c3 as W,f9 as I,hK as A,bq as ae,br as ce,bs as ie,bt as le,bu as re,fa as q,c8 as H,bR as oe,d6 as de,da as me,ac as ue,jx as xe,e6 as he,jy as pe,jz as fe,jA as ge,hV as je,eZ as ye,i8 as L,u as ve,jB as Ne,eS as V,a7 as U,ev as T}from"./index-DByaMzsG.js";import{S as _e}from"./scoped-feed-bar-BKyJSa3_.js";import{E as be}from"./events-feed-DmRzikZW.js";import{f as Se,C as ke}from"./entity-options-B9hm9V87.js";import{V as Ce,a as we}from"./runs-list-CwtH-wmk.js";import{S as K,g as P}from"./status-variants-DyRCXBzM.js";import{f as Fe}from"./feed-event-kinds-BYuZCoU4.js";function Oe({connection:s,ownerSlug:t}){const[a,c]=d.useState([]),x=d.useMemo(()=>[s.connector_key],[s.connector_key]),m=d.useMemo(()=>({connectionIds:[s.id],...a.length>0?{semanticTypes:a}:{}}),[s.id,a]),r=s.facets?.chat??!1;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{"aria-label":r?"Channels":"Feeds",className:"space-y-2",children:[e.jsx("h2",{className:"text-sm font-semibold",children:r?"Channels":"Feeds"}),e.jsx(Ee,{connection:s,ownerSlug:t})]}),e.jsxs("section",{"aria-label":"What came in",className:"space-y-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("h2",{className:"shrink-0 text-sm font-semibold",children:"What came in"}),e.jsx(_e,{owner:t,organizationId:s.organization_id,activitySearch:{connection_ids:String(s.id)},kinds:a,onKindsChange:c,platforms:x})]}),e.jsx(be,{organizationId:s.organization_id,ownerSlug:t,filters:m,hideOriginator:!0,emptyState:e.jsx("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Nothing has come in from this connection yet."})})]})]})}function Ee({connection:s,ownerSlug:t}){const{data:a=[],isLoading:c,isError:x,refetch:m}=Z(s.id),r=R();return c?e.jsxs("div",{className:"space-y-2",children:[e.jsx(z,{className:"h-12 w-full rounded-lg"}),e.jsx(z,{className:"h-12 w-full rounded-lg"})]}):x?e.jsxs("div",{role:"alert",className:"space-y-2 text-sm",children:[e.jsx("p",{children:"Could not load feeds."}),e.jsx(v,{variant:"outline",size:"sm",onClick:()=>void m(),children:"Retry"})]}):a.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No feeds yet. Add one from Settings."}):e.jsx("ul",{className:"divide-y overflow-hidden rounded-lg border",children:a.map(i=>{const l=G(i),p=i.operations.includes("sync"),u=i.active_runs>0||r.isPending&&r.variables===i.id;return e.jsxs("li",{className:"flex items-center gap-3 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(E,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:t,connectorKey:s.connector_key,connectionId:String(s.id)},search:{feedId:i.id},className:"block truncate text-sm font-medium hover:underline",children:i.display_name?.trim()||i.feed_key}),e.jsx("p",{className:w("truncate text-xs",l.failed?"text-destructive":"text-muted-foreground"),title:l.text,children:p&&i.execution_mode==="no_schedule"?`${l.text} No schedule: it runs only when you sync it.`:p?l.text:"Live access, nothing to sync."})]}),p?e.jsxs(v,{type:"button",size:"sm",variant:l.failed?"default":"outline",className:"h-7 shrink-0 text-xs",disabled:u,onClick:()=>r.mutate(i.id),children:[u?e.jsx(F,{size:"sm",className:"mr-1"}):e.jsx(B,{className:"mr-1 h-3 w-3"}),u?"Syncing":l.failed?"Try again":"Sync now"]}):null]},i.id)})})}function $e({organizationId:s,value:t,onChange:a,entities:c,className:x}){const{data:m=[]}=J(c?void 0:s),r=d.useMemo(()=>c??Se(m),[c,m]),i=new Set(t),l=r.filter(o=>i.has(o.id)),p=o=>{const n=new Set(i);n.has(o)?n.delete(o):n.add(o),a(Array.from(n).sort((f,N)=>f-N))},u=l.length===0?"All entities":l.length===1?l[0].name:`${l.length} entities selected`;return e.jsx(Y,{contentClassName:"w-[320px]",searchPlaceholder:"Filter entities...",emptyText:"No entities found.",trigger:o=>e.jsxs(v,{variant:"outline",role:"combobox","aria-expanded":o,className:w("justify-between",x),children:[u,e.jsx(te,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),children:()=>r.map(o=>{const n=i.has(o.id);return e.jsxs(ee,{value:`${o.name} ${o.entityType}`,onSelect:()=>p(o.id),className:"cursor-pointer",children:[e.jsx(se,{className:w("mr-2 h-4 w-4",n?"opacity-100":"opacity-0")}),e.jsxs("span",{children:[o.name," ",e.jsxs("span",{className:"text-muted-foreground text-xs",children:["(",o.entityType,")"]})]})]},o.id)})})}function De(s){return s?.feeds_schema?Object.entries(s.feeds_schema).map(([t,a])=>({key:t,name:a.name??t,description:a.description,configSchema:a.configSchema})):[]}const Re="Feeds are optional scheduled sync targets for an existing connection.";function Be({organizationId:s,connections:t,connectorDefinitions:a,entityId:c,onClose:x}){const m=t.length===1,[r,i]=d.useState(m?String(t[0].id):""),[l,p]=d.useState(""),[u,o]=d.useState(c?[c]:[]),[n,f]=d.useState(null),N=ne(),k=d.useMemo(()=>new Map(a.map(h=>[h.key,h])),[a]),y=d.useMemo(()=>t.find(h=>String(h.id)===r),[t,r]),_=d.useMemo(()=>y?De(k.get(y.connector_key)):[],[y,k]),C=d.useMemo(()=>_.find(h=>h.key===l)??null,[_,l]),j=W(`${r}:${l}`,I(C?.configSchema),C?.configSchema),{values:b,setValues:$}=j,S=d.useCallback(()=>{i(m?String(t[0].id):""),p(""),o(c?[c]:[]),f(null)},[c,m,t]),g=d.useCallback(()=>{S(),x()},[x,S]),D=d.useCallback(async()=>{if(!j.canSubmit||!y||!l)return;f(null);const h=A(b);try{await N.mutateAsync({connection_id:y.id,feed_key:l,config:Object.keys(h).length>0?h:void 0,entity_ids:c?[c]:u.length>0?u:void 0}),g()}catch(M){f(M instanceof Error?M.message:"Failed to create feed")}},[b,j.canSubmit,N,c,g,y,u,l]),X=e.jsxs("div",{className:"flex-1 space-y-4 overflow-y-auto py-6 pr-1",children:[!m&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Connection"}),e.jsx(ke,{connections:t,value:r,onValueChange:h=>{i(h),p(""),f(null)},placeholder:"Select a connection"})]}),y&&_.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Feed Type"}),e.jsxs(ae,{value:l,onValueChange:p,children:[e.jsx(ce,{children:e.jsx(ie,{placeholder:"Select feed type"})}),e.jsx(le,{children:_.map(h=>e.jsx(re,{value:h.key,children:e.jsxs("div",{children:[e.jsx("span",{children:h.name}),h.description&&e.jsxs("span",{className:"text-muted-foreground ml-1 text-xs",children:["— ",h.description]})]})},h.key))})]})]}),c?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Target Entity"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This feed will be attached to the current entity."})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Target Entities"}),e.jsx($e,{organizationId:s,value:u,onChange:o,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. Leave empty to create an unscoped feed."})]}),j.revision&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Feed Configuration"}),e.jsx(q,{schema:j.revision,values:b,onValuesChange:$})]}),y&&_.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"This connector has no configurable feed types."}),e.jsx(H,{visible:j.hasConflict,onReload:j.reset}),n&&e.jsx("p",{className:"text-sm text-destructive",children:n})]}),Q=e.jsx(oe,{onCancel:g,className:"mt-2",children:e.jsxs(v,{disabled:!j.canSubmit||!l||N.isPending,onClick:()=>void D(),children:[N.isPending&&e.jsx(F,{size:"lg",className:"mr-2"}),"Create Feed"]})});return e.jsxs("div",{className:"flex flex-col",children:[X,Q]})}function We({feed:s,onClose:t,hideHeader:a=!1}){const c=s.display_name?.trim()||s.feed_key,x=s.feed_key.includes(":")?s.feed_key.slice(s.feed_key.indexOf(":")+1):s.feed_key,m=s.external_tenant_id,r=s.connector_key==="slack"&&m?`https://app.slack.com/client/${m}/${x}`:void 0;return e.jsxs("div",{className:"flex max-w-xl flex-col gap-4",children:[a?null:e.jsxs(e.Fragment,{children:[t?e.jsxs("button",{type:"button",onClick:t,className:"inline-flex w-fit items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(de,{className:"h-3 w-3"}),"Back to connection"]}):null,e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(me,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("h2",{className:"text-lg font-semibold leading-tight",children:c}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"chat channel"})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Messages captured for this channel are available to Lobu Automations. Open Slack to read the channel history."}),r?e.jsx(v,{asChild:!0,variant:"outline",className:"w-full justify-center",children:e.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(ue,{className:"mr-2 h-4 w-4"}),"Open in Slack"]})}):null,e.jsxs("div",{className:w(he,"flex flex-col gap-3 p-4"),children:[e.jsx("div",{className:"text-xs font-medium uppercase text-muted-foreground",children:"Channel"}),e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx(xe,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"break-all",children:c})]}),m?e.jsxs("div",{className:"flex items-baseline justify-between gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Workspace"}),e.jsx("span",{className:"break-all font-mono text-xs",children:m})]}):null,e.jsx("p",{className:"text-xs text-muted-foreground",children:"Messages the bot sees here are captured as they arrive. Open the channel in Slack to read the full history."})]})]})}function qe(s,t){return s.display_name?s.display_name:t?.feeds_schema?.[s.feed_key]?.name??s.feed_key}function Ve(s,t){const a=s?.feeds_schema;if(!a)return;if(a[t])return a[t];const c=Object.values(a);return c.find(x=>x?.key===t)??(c.length===1?c[0]:void 0)}const O=8;function Ie({kinds:s,feedId:t,ownerSlug:a}){const[c,x]=d.useState(!1),m=ve(),r=c?s:s.slice(0,O);return e.jsxs(L,{title:"Event types",count:`${s.length} ${s.length===1?"kind":"kinds"}`,children:[e.jsx("ul",{className:"divide-y",children:r.map(({kind:i,description:l,targets:p})=>{const u=Ne(a,t,[i]),o=`${V(i)} events`;return e.jsx("li",{children:e.jsxs(E,{to:u,className:"flex flex-col gap-1 py-2 text-left transition-colors hover:bg-accent/50 sm:flex-row sm:items-start sm:gap-4",onClick:n=>{!m||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||n.button!==0||(n.preventDefault(),m.open({href:u,title:o}))},children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:V(i)}),e.jsx("code",{className:"truncate font-mono text-[11px] text-muted-foreground",children:i})]}),l?e.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",title:l,children:l}):null]}),p.length>0?e.jsx("div",{className:"flex flex-wrap gap-1 sm:max-w-[40%] sm:justify-end",children:p.map(({entityType:n,creates:f})=>e.jsx(U,{variant:"secondary",className:"font-normal",title:f?`Creates ${n} records`:`Links to existing ${n} records`,children:V(n)},n))}):null]})},i)})}),s.length>O?e.jsx(v,{variant:"ghost",size:"sm",className:"mt-1 h-7 px-2 text-xs text-muted-foreground",onClick:()=>x(i=>!i),children:c?"Show fewer":`Show all ${s.length}`}):null]})}function He({feed:s,ownerSlug:t}){return e.jsxs(e.Fragment,{children:[e.jsx(K,{status:P(s.status),showDot:!0,children:s.status}),s.connection_status&&s.connection_status!==s.status&&e.jsxs(K,{status:P(s.connection_status),showDot:!0,children:["Connection: ",s.connection_status]}),s.device_worker_id?e.jsx(E,{to:"/$owner/connectors/device/$deviceId",params:{owner:t,deviceId:s.device_worker_id},children:e.jsx(U,{variant:s.device_status==="offline"?"secondary":"outline",className:"text-xs hover:bg-accent",children:s.device_status==="offline"?`Waiting for ${s.device_label||s.device_platform||"device"}`:`On ${s.device_label||s.device_platform||"device"}`})}):null]})}function Ue({feed:s}){return s.operations.includes("sync")?e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:["Last sync: ",s.last_sync_at?T(s.last_sync_at):"—"]}),e.jsxs("span",{children:["Next: ",s.next_run_at?T(s.next_run_at):"—"]}),s.event_count!=null&&e.jsxs("span",{className:"font-mono",children:[s.event_count.toLocaleString()," events"]})]}):e.jsx("span",{children:"Read live when queried"})}function Xe({feed:s,connectorDef:t,ownerSlug:a}){const{data:c,refetch:x}=pe(s.id),m=d.useMemo(()=>(c?.recent_runs??[]).map(g=>({...g,run_type:"sync"})),[c?.recent_runs]),r=fe(),i=R(),l=c?.recent_runs?.some(g=>["running","pending","claimed"].includes(g.status));d.useEffect(()=>{if(!l)return;const g=setInterval(()=>x(),5e3);return()=>clearInterval(g)},[l,x]);const p=d.useMemo(()=>Ve(t,s.feed_key),[t,s.feed_key]),u=p?.configSchema,o=d.useMemo(()=>Fe(p).sort((g,D)=>g.kind.localeCompare(D.kind)),[p]),n=W(s.id,I(u,s.config??{}),u),{values:f,setValues:N,dirty:k}=n,y=d.useCallback(async()=>{n.canSubmit&&(await r.mutateAsync({feed_id:s.id,config:A(f)}),n.accept(f,I(u,A(f))))},[r,s.id,f,u,n.canSubmit,n.accept]),_=d.useCallback(async()=>{const g=s.status==="active"?"paused":"active";await r.mutateAsync({feed_id:s.id,status:g})},[r,s.id,s.status]),C=d.useCallback(async()=>{await i.mutateAsync(s.id)},[i,s.id]),j=s.status==="active",b=s.operations.includes("sync"),$=s.auth_profile_status&&s.auth_profile_status!=="active",S=r.isPending||i.isPending;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(v,{variant:"outline",size:"sm",disabled:S,onClick:()=>void _(),children:[j?e.jsx(ge,{className:"h-3.5 w-3.5 mr-1.5"}):e.jsx(je,{className:"h-3.5 w-3.5 mr-1.5"}),j?"Pause":"Resume"]}),b?e.jsxs(v,{variant:"outline",size:"sm",disabled:S||!j,onClick:()=>void C(),children:[i.isPending?e.jsx(F,{size:"md",className:"mr-1.5"}):e.jsx(B,{className:"h-3.5 w-3.5 mr-1.5"}),"Sync now"]}):null,e.jsx(Ce,{ownerSlug:a,scope:{kind:"feed",id:s.id},variant:"ghost",label:"View in memory"})]}),$&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-50 dark:bg-amber-950/20 px-3 py-2 text-sm",children:[e.jsx(ye,{className:"h-4 w-4 text-amber-500 shrink-0"}),e.jsxs("span",{className:"text-amber-700 dark:text-amber-400",children:["Authentication issue: ",s.auth_profile_status]}),e.jsx(v,{asChild:!0,variant:"outline",size:"sm",className:"ml-auto h-7 text-xs",children:e.jsx(E,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:a,connectorKey:s.connector_key,connectionId:String(s.connection_id)},search:{settings:!0},children:"Fix auth"})})]}),n.revision?e.jsx(L,{title:"Settings",children:e.jsxs("div",{className:"max-w-xl space-y-4",children:[e.jsx(q,{schema:n.revision,values:f,onValuesChange:N}),e.jsx(H,{visible:n.hasConflict,onReload:n.reset}),k&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(v,{size:"sm",disabled:S||!n.canSubmit,onClick:()=>void y(),children:[r.isPending?e.jsx(F,{size:"md",className:"mr-1.5"}):null,"Save"]})})]})}):null,o.length>0?e.jsx(Ie,{kinds:o,feedId:s.id,ownerSlug:a}):null,b?e.jsx(L,{title:"Recent syncs",children:e.jsx(we,{runs:m,ownerSlug:a,emptyState:e.jsx("p",{className:"rounded-lg border bg-muted/20 px-3 py-6 text-center text-xs text-muted-foreground",children:"No syncs yet."})})}):null]})}export{Be as A,Oe as C,He as F,We as a,Ue as b,Xe as c,Re as d,qe as f};
2
+ //# sourceMappingURL=connection-feed-detail-0VAJiZTP.js.map
@@ -0,0 +1,2 @@
1
+ import{j as e,au as l}from"./index-DByaMzsG.js";function c({header:s,children:a}){return e.jsxs(l,{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"sticky top-0 z-10 space-y-4 bg-background pb-1",children:s}),e.jsx("div",{className:"mt-4 min-w-0 flex-1 space-y-7",children:a})]})}export{c as C};
2
+ //# sourceMappingURL=connector-page-shell-BFv21yuv.js.map
@@ -1,2 +1,2 @@
1
- import{j as e,aF as m,aG as u,aI as h,a7 as v,a2 as x,L as c}from"./index-CdDNNAx2.js";function N({connectorDef:s,connectorKey:t,ownerSlug:n,deviceWorkerId:i,deviceLabel:o}){return s?e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1.5 text-[11.5px] text-muted-foreground",children:[e.jsx("span",{children:"Runs on"}),e.jsx(c,{to:"/$owner/connectors/$connectorKey",params:{owner:n,connectorKey:t},className:"underline underline-offset-2 hover:text-foreground",children:s.name}),e.jsx(f,{deviceWorkerId:i,deviceLabel:o,connectorDef:s,ownerSlug:n})]}):null}function f({connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i}){return e.jsxs(m,{children:[e.jsxs(u,{className:"rounded border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground transition-colors hover:border-muted-foreground hover:text-foreground",children:["v",s.version||"unknown"]}),e.jsx(h,{align:"start",className:"w-80 p-0",children:e.jsx(j,{connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i})})]})}function j({connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i}){const o=s.runtime?.platforms??[],d=s.runtime?.scopes??[],r=s.source_uri?.trim()||null,p=!!r&&(r.startsWith("http://")||r.startsWith("https://")),l=[{label:"Key",value:e.jsx("span",{className:"font-mono",children:s.key})},{label:"Version",value:e.jsx("span",{className:"font-mono",children:s.version?`v${s.version}`:"unknown"})}];return s.catalog_origin&&l.push({label:"Origin",value:s.catalog_origin==="org"?e.jsx("span",{className:"text-amber-600 dark:text-amber-500",children:"Built in this workspace"}):e.jsx("span",{children:"Lobu catalog"})}),r&&l.push({label:"Source",value:p?e.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",className:"inline-flex max-w-full items-start gap-1 break-all font-mono text-primary hover:underline",children:[r,e.jsx(v,{className:"mt-0.5 h-3 w-3 shrink-0"})]}):e.jsx("span",{className:"break-all font-mono",children:r})}),o.length>0&&l.push({label:"Platforms",value:e.jsx("span",{className:"flex flex-wrap gap-1",children:o.map(a=>e.jsx(x,{variant:"secondary",className:"h-4 px-1 py-0 font-mono text-[10px]",children:a},a))})}),s.required_capability&&l.push({label:"Capability",value:e.jsx("span",{className:"font-mono",children:s.required_capability})}),d.length>0&&l.push({label:"Scopes",value:e.jsx("span",{className:"flex flex-wrap gap-1",children:d.map(a=>e.jsx(x,{variant:"secondary",className:"h-4 px-1 py-0 font-mono text-[10px]",children:a},a))})}),e.jsxs("div",{className:"text-xs",children:[e.jsx("dl",{className:"divide-y",children:l.map(a=>e.jsxs("div",{className:"flex gap-3 px-3 py-2",children:[e.jsx("dt",{className:"w-20 shrink-0 text-muted-foreground",children:a.label}),e.jsx("dd",{className:"min-w-0 flex-1",children:a.value})]},a.label))}),o.length>0?e.jsx("div",{className:"border-t px-3 py-2 text-muted-foreground",children:n?e.jsxs(e.Fragment,{children:["Runs on"," ",e.jsx(c,{to:"/$owner/connectors/device/$deviceId",params:{owner:t,deviceId:n},className:"text-primary hover:underline",children:i||"this device"}),"."]}):"Runs on a linked device."}):null]})}export{f as C,N as a};
2
- //# sourceMappingURL=connector-provenance-B2C2cjBg.js.map
1
+ import{j as e,aE as m,aF as u,aH as h,ac as v,a7 as x,L as c}from"./index-DByaMzsG.js";function N({connectorDef:s,connectorKey:t,ownerSlug:n,deviceWorkerId:i,deviceLabel:o}){return s?e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1.5 text-[11.5px] text-muted-foreground",children:[e.jsx("span",{children:"Runs on"}),e.jsx(c,{to:"/$owner/connectors/$connectorKey",params:{owner:n,connectorKey:t},className:"underline underline-offset-2 hover:text-foreground",children:s.name}),e.jsx(f,{deviceWorkerId:i,deviceLabel:o,connectorDef:s,ownerSlug:n})]}):null}function f({connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i}){return e.jsxs(m,{children:[e.jsxs(u,{className:"rounded border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground transition-colors hover:border-muted-foreground hover:text-foreground",children:["v",s.version||"unknown"]}),e.jsx(h,{align:"start",className:"w-80 p-0",children:e.jsx(j,{connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i})})]})}function j({connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i}){const o=s.runtime?.platforms??[],d=s.runtime?.scopes??[],r=s.source_uri?.trim()||null,p=!!r&&(r.startsWith("http://")||r.startsWith("https://")),l=[{label:"Key",value:e.jsx("span",{className:"font-mono",children:s.key})},{label:"Version",value:e.jsx("span",{className:"font-mono",children:s.version?`v${s.version}`:"unknown"})}];return s.catalog_origin&&l.push({label:"Origin",value:s.catalog_origin==="org"?e.jsx("span",{className:"text-amber-600 dark:text-amber-500",children:"Built in this workspace"}):e.jsx("span",{children:"Lobu catalog"})}),r&&l.push({label:"Source",value:p?e.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",className:"inline-flex max-w-full items-start gap-1 break-all font-mono text-primary hover:underline",children:[r,e.jsx(v,{className:"mt-0.5 h-3 w-3 shrink-0"})]}):e.jsx("span",{className:"break-all font-mono",children:r})}),o.length>0&&l.push({label:"Platforms",value:e.jsx("span",{className:"flex flex-wrap gap-1",children:o.map(a=>e.jsx(x,{variant:"secondary",className:"h-4 px-1 py-0 font-mono text-[10px]",children:a},a))})}),s.required_capability&&l.push({label:"Capability",value:e.jsx("span",{className:"font-mono",children:s.required_capability})}),d.length>0&&l.push({label:"Scopes",value:e.jsx("span",{className:"flex flex-wrap gap-1",children:d.map(a=>e.jsx(x,{variant:"secondary",className:"h-4 px-1 py-0 font-mono text-[10px]",children:a},a))})}),e.jsxs("div",{className:"text-xs",children:[e.jsx("dl",{className:"divide-y",children:l.map(a=>e.jsxs("div",{className:"flex gap-3 px-3 py-2",children:[e.jsx("dt",{className:"w-20 shrink-0 text-muted-foreground",children:a.label}),e.jsx("dd",{className:"min-w-0 flex-1",children:a.value})]},a.label))}),o.length>0?e.jsx("div",{className:"border-t px-3 py-2 text-muted-foreground",children:n?e.jsxs(e.Fragment,{children:["Runs on"," ",e.jsx(c,{to:"/$owner/connectors/device/$deviceId",params:{owner:t,deviceId:n},className:"text-primary hover:underline",children:i||"this device"}),"."]}):"Runs on a linked device."}):null]})}export{f as C,N as a};
2
+ //# sourceMappingURL=connector-provenance-b59RfBtk.js.map
@@ -0,0 +1,2 @@
1
+ import{j as e,at as s,O as t}from"./index-DByaMzsG.js";function n(){return e.jsx(s,{className:"gap-3 pt-2.5 pb-8",children:e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:e.jsx(t,{})})})}export{n as component};
2
+ //# sourceMappingURL=connectors-nYS31lO2.js.map
@@ -0,0 +1,2 @@
1
+ import{a5 as $,H as z,r as i,j as t,a4 as D,a6 as F}from"./index-DByaMzsG.js";import{a as I,u as T,C as G,b as B,c as H,R as J,W as Q,A as K,r as V,o as X}from"./use-login-redirect-tDdhXTpt.js";import{F as Y}from"./full-page-spinner-CYyCnKve.js";import"./card-DtLIFq7D.js";const Z=["client_id","redirect_uri","scope","code_challenge","code_challenge_method"];function re(){const e=$.useSearch(),d=e.workspace_grants==="1",{session:g,isReady:k}=z(),m=!k,[r,_]=i.useState(null),[v,l]=i.useState(null);I(!!g,m);const p=i.useMemo(()=>Z.filter(s=>!e[s]||e[s]?.length===0),[e]),c=p.length===0,C=e.client_name?.trim()||null,f=i.useMemo(()=>Array.from(new Set((e.scope||"").split(" ").map(s=>s.trim()).filter(Boolean))),[e.scope]),{accessLevel:w,setAccessLevel:O,selectedScopes:A,resourceOrg:S,hasMcpScopes:E,requiresWorkspaceAccess:n,orgList:h,workspaceAccess:L,setWorkspaceAccess:M,selectedOrgIds:o,toggleSelectedOrgId:P,orgsLoading:q,orgsError:b,retryOrgs:N,workspaceSelectionReady:y}=T({requestedScopes:f,resource:e.resource,allowMultiple:d}),u=i.useMemo(()=>h.filter(s=>o.includes(s.id)).map(s=>s.name),[h,o]),U=n?u.length===0?"Nothing will be granted access.":`${u.length<=2?u.join(", "):`${u.length} workspaces`} will be granted access.`:null,W=n&&d&&o.length>0?`Approve ${o.length} ${o.length===1?"workspace":"workspaces"}`:"Approve",R=async s=>{if(!c){l(`Missing required query params: ${p.join(", ")}`);return}if(s&&n&&!y){l(b?"Workspaces could not be loaded. Retry before approving.":"Choose at least one workspace before approving.");return}_(s?"approve":"deny"),l(null);try{const a=await fetch(`${D}/oauth/authorize/consent`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({client_id:e.client_id,redirect_uri:e.redirect_uri,scope:s?A.join(" "):e.scope,state:e.state??"",code_challenge:e.code_challenge,code_challenge_method:e.code_challenge_method,client_name:e.client_name,resource:e.resource,authorization_intent:e.authorization_intent,approved:s,...s&&n?{workspace_access:L,organization_ids:o}:{}})}),x=await a.json().catch(()=>null);if(a.status===401){V();return}if(!a.ok)throw new Error(X(x,`Failed to ${s?"approve":"deny"} OAuth consent`));const j=F(x?.redirect_url);if(!j)throw new Error("Consent response did not include a valid redirect URL");window.location.href=j}catch(a){_(null),l(a instanceof Error?a.message:"Unexpected error while submitting consent")}};return m||!g?t.jsx(Y,{className:"min-h-[calc(100vh-3.5rem)]"}):t.jsx(G,{title:"Authorize application",busy:r!==null,error:v,review:t.jsx(K,{idPrefix:"oauth-consent",clientName:C,requestedScopes:f,accessLevel:w,onAccessLevelChange:O,disabled:r!==null,resource:e.resource,logoUri:e.logo_uri,clientUri:e.client_uri}),aside:n?t.jsx(Q,{idPrefix:"oauth-consent",allowMultiple:d,orgList:h,selectedOrgIds:o,onWorkspaceAccessChange:M,onSelectedOrgChange:P,orgsLoading:q,orgsError:b,onRetry:N,disabled:r!==null||!c}):void 0,below:E&&S?t.jsx(J,{resourceOrg:S,accessLevel:w}):null,notice:c?null:t.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:["Missing required query params: ",p.join(", ")]}),footer:t.jsx(B,{summary:U,children:t.jsx(H,{busy:r,approveLabel:W,approveDisabled:r!==null||!c||A.length===0||n&&!y,denyDisabled:r!==null||!c,onApprove:()=>R(!0),onDeny:()=>R(!1)})})})}export{re as component};
2
+ //# sourceMappingURL=consent-cPRF9JQv.js.map
@@ -1,2 +1,2 @@
1
- import{r as s,j as a,B as p,a4 as n,f$ as l,bz as i}from"./index-CdDNNAx2.js";function m({text:u,label:o,iconOnly:t=!1}){const[r,c]=s.useState(!1),e=s.useRef(void 0);return s.useEffect(()=>()=>clearTimeout(e.current),[]),a.jsxs(p,{type:"button",variant:t?"ghost":"outline",size:t?"icon":"sm",className:t?"h-6 w-6 shrink-0":"h-8 text-xs","aria-label":t?`Copy ${o}`:void 0,onClick:async()=>{try{await navigator.clipboard.writeText(u),c(!0),i.success("Copied to clipboard"),clearTimeout(e.current),e.current=setTimeout(()=>c(!1),1500)}catch{i.error("Could not copy. Please select and copy the text.")}},children:[r?a.jsx(n,{className:"h-3.5 w-3.5"}):a.jsx(l,{className:"h-3.5 w-3.5"}),!t&&(r?"Copied":o)]})}export{m as C};
2
- //# sourceMappingURL=copy-button-BhXeXLIm.js.map
1
+ import{r as s,j as a,B as p,a9 as n,fZ as l,by as i}from"./index-DByaMzsG.js";function m({text:u,label:o,iconOnly:t=!1}){const[r,c]=s.useState(!1),e=s.useRef(void 0);return s.useEffect(()=>()=>clearTimeout(e.current),[]),a.jsxs(p,{type:"button",variant:t?"ghost":"outline",size:t?"icon":"sm",className:t?"h-6 w-6 shrink-0":"h-8 text-xs","aria-label":t?`Copy ${o}`:void 0,onClick:async()=>{try{await navigator.clipboard.writeText(u),c(!0),i.success("Copied to clipboard"),clearTimeout(e.current),e.current=setTimeout(()=>c(!1),1500)}catch{i.error("Could not copy. Please select and copy the text.")}},children:[r?a.jsx(n,{className:"h-3.5 w-3.5"}):a.jsx(l,{className:"h-3.5 w-3.5"}),!t&&(r?"Copied":o)]})}export{m as C};
2
+ //# sourceMappingURL=copy-button-C3wMMv63.js.map