@onequery/cli 0.1.33-win32-x64 → 0.1.34-darwin-arm64

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 (140) hide show
  1. package/package.json +3 -3
  2. package/vendor/{x86_64-pc-windows-msvc/onequery/onequery.exe → aarch64-apple-darwin/onequery/onequery} +0 -0
  3. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/DialogTitle-C3t5rzfv.js → aarch64-apple-darwin/runtime/web/assets/DialogTitle-C7S-GNch.js} +1 -1
  4. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/_authenticated-B_5gYcSE.js → aarch64-apple-darwin/runtime/web/assets/_authenticated-DZPwfG3P.js} +1 -1
  5. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/_org_slug-ZRAZX4yf.js → aarch64-apple-darwin/runtime/web/assets/_org_slug-ZU7MFtro.js} +1 -1
  6. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/audit-0ySkceEm.js → aarch64-apple-darwin/runtime/web/assets/audit-WhwKqWGH.js} +1 -1
  7. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/budget-M88BhFjM.js → aarch64-apple-darwin/runtime/web/assets/budget-C3tdfVeU.js} +1 -1
  8. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/callback-oibt7Zzh.js → aarch64-apple-darwin/runtime/web/assets/callback-B2lVZz5B.js} +1 -1
  9. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/connect-database-C2ki17Gk.js → aarch64-apple-darwin/runtime/web/assets/connect-database-BqVJwGWx.js} +1 -1
  10. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/create-org-gZvjpMQY.js → aarch64-apple-darwin/runtime/web/assets/create-org-Dk-TmEGt.js} +1 -1
  11. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/data-source-connection-form-DwwJ0tPU.js → aarch64-apple-darwin/runtime/web/assets/data-source-connection-form-BKMHkF5S.js} +4 -4
  12. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/device-CmX_h31L.js → aarch64-apple-darwin/runtime/web/assets/device-Q4ZN6Fdq.js} +1 -1
  13. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/dropdown-menu-BIqdY_8v.js → aarch64-apple-darwin/runtime/web/assets/dropdown-menu-BhdkLmzJ.js} +1 -1
  14. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/home-c0b9mo1B.js → aarch64-apple-darwin/runtime/web/assets/home-CcG2qLve.js} +1 -1
  15. package/vendor/aarch64-apple-darwin/runtime/web/assets/index-DGnxvx_K.css +2 -0
  16. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/index-CbFJKkNs.js → aarch64-apple-darwin/runtime/web/assets/index-DthpwdlN.js} +2 -2
  17. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/integrations-Dt8NPrZT.js → aarch64-apple-darwin/runtime/web/assets/integrations-CqOQH6vO.js} +1 -1
  18. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/invite._invitationId-DQAVR32l.js → aarch64-apple-darwin/runtime/web/assets/invite._invitationId-CJlS2Hoi.js} +1 -1
  19. package/vendor/aarch64-apple-darwin/runtime/web/assets/routes-BBWQP8ei.js +1 -0
  20. package/vendor/aarch64-apple-darwin/runtime/web/assets/signin-D87M0GJg.js +1 -0
  21. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/team-C8CHyB14.js → aarch64-apple-darwin/runtime/web/assets/team-DOt1TVvS.js} +1 -1
  22. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/theme-toggle-XEe6wWso.js → aarch64-apple-darwin/runtime/web/assets/theme-toggle-D-rc6UzS.js} +1 -1
  23. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/use-optimistic-mutation-Uf_9TxpA.js → aarch64-apple-darwin/runtime/web/assets/use-optimistic-mutation-B6q6iB7T.js} +1 -1
  24. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/useBaseQuery-C6Svq4OV.js → aarch64-apple-darwin/runtime/web/assets/useBaseQuery-Bwqdm4hJ.js} +1 -1
  25. package/vendor/aarch64-apple-darwin/runtime/web/assets/useQuery-BCl2C7k4.js +1 -0
  26. package/vendor/aarch64-apple-darwin/runtime/web/assets/useSuspenseQuery-BoUwwhvS.js +1 -0
  27. package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/index.html +2 -2
  28. package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/server/onequery-server.mjs +6622 -6446
  29. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/index-CqvU4VXr.css +0 -2
  30. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/routes-C1hIhGRp.js +0 -1
  31. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/signin-GSh_tL5l.js +0 -1
  32. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/useQuery-DcPzWABw.js +0 -1
  33. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/useSuspenseQuery-BanVmJgY.js +0 -1
  34. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260327065242_curious_nightmare.sql +0 -0
  35. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260403103652_slippery_hellfire_club.sql +0 -0
  36. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260403112219_gigantic_namora.sql +0 -0
  37. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260327065242_snapshot.json +0 -0
  38. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260403103652_snapshot.json +0 -0
  39. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260403112219_snapshot.json +0 -0
  40. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/_journal.json +0 -0
  41. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/initdb.wasm +0 -0
  42. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/pglite.data +0 -0
  43. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/pglite.wasm +0 -0
  44. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/sql-parser/sql_parser_wasm_bg.wasm +0 -0
  45. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/CompositeItem-D3nXGtvr.js +0 -0
  46. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/CompositeList-CX7HHxYw.js +0 -0
  47. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconArrowRight-DsOD7mDl.js +0 -0
  48. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconCheck-Gc24xPT2.js +0 -0
  49. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconChevronDown-B-39MA7-.js +0 -0
  50. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconCoins-C7Nn0L6R.js +0 -0
  51. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconHistory-BqAd-xl2.js +0 -0
  52. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconLoader2-B3B6M8nQ.js +0 -0
  53. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconPlus-C3-kRhGX.js +0 -0
  54. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconX-BQkA009b.js +0 -0
  55. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/Separator-vw4jPN_6.js +0 -0
  56. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/api-base-url-DIb6qukm.js +0 -0
  57. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/api-client-w1GRwBWy.js +0 -0
  58. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/api-paths-ClEWWGwS.js +0 -0
  59. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/app-routes-CnJncMlZ.js +0 -0
  60. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/auth-bootstrap-query-CrWpT3WV.js +0 -0
  61. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/auth-client-BlMeXgb4.js +0 -0
  62. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/avatar-B8g7WJsq.js +0 -0
  63. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/badge-C1_ZMBRy.js +0 -0
  64. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/card-Bsy6azfK.js +0 -0
  65. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/checkbox-CJcCVDm9.js +0 -0
  66. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/compiler-runtime-DCc3R3Xn.js +0 -0
  67. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/createReactComponent-_L2mp4Ui.js +0 -0
  68. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/empty-COnWCwda.js +0 -0
  69. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/format-date-Ctrh7my1.js +0 -0
  70. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/getDisabledMountTransitionStyles-BYKRz4ha.js +0 -0
  71. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/getPseudoElementBounds-InhM-dWf.js +0 -0
  72. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/input-CG_cIxvO.js +0 -0
  73. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  74. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  75. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  76. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  77. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  78. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  79. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  80. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/jsx-runtime-DG_AJzB_.js +0 -0
  81. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/label-CWOhoN_L.js +0 -0
  82. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/link-Cgvqhh5w.js +0 -0
  83. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/matchContext-CDajBC0L.js +0 -0
  84. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/organization-permissions-BQQ5PJbI.js +0 -0
  85. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/organization-query-keys-DwLucsD_.js +0 -0
  86. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/query-timing-LGzitMXx.js +0 -0
  87. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/queryOptions-BHw87wTZ.js +0 -0
  88. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/removable-BfDesq3B.js +0 -0
  89. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/schemas-MsKXD_XQ.js +0 -0
  90. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/select-D6km4Obp.js +0 -0
  91. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/separator-CWltZvB_.js +0 -0
  92. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/settings-5_Ep5M2N.js +0 -0
  93. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/src-DCIPwIx0.js +0 -0
  94. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/table-DCvfJyLS.js +0 -0
  95. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/textarea-DiU04l_U.js +0 -0
  96. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useBaseUiId-BLFGpnYJ.js +0 -0
  97. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useCompositeItem-BsMHgRi0.js +0 -0
  98. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useControlled-B8q0aJoo.js +0 -0
  99. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useRender-B2c9_UYd.js +0 -0
  100. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useRouterState-DpT8luFk.js +0 -0
  101. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useValueChanged-CqxkrqWn.js +0 -0
  102. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/utils-C8DGLIgm.js +0 -0
  103. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/xstate-react.esm-BlF76DuP.js +0 -0
  104. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/zod-C2fx2RN8.js +0 -0
  105. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/favicon.ico +0 -0
  106. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step1_settings_sidebar.png +0 -0
  107. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step2_projects.png +0 -0
  108. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step3_project_keys.png +0 -0
  109. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step4_api_keys.png +0 -0
  110. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step1_service_accounts.png +0 -0
  111. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step2_bigquery_roles.png +0 -0
  112. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step3_add_key_menu.png +0 -0
  113. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step4_create_json_key.png +0 -0
  114. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step1_service_accounts.png +0 -0
  115. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step2_create_json_key.png +0 -0
  116. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step3_add_user_viewer.png +0 -0
  117. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step4_property_details.png +0 -0
  118. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step1_signin.png +0 -0
  119. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step2_new_fine_grained_token_sanitized.png +0 -0
  120. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step3_permissions_configured_sanitized.png +0 -0
  121. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step4_token_created_sanitized.png +0 -0
  122. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step1_service_accounts.png +0 -0
  123. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step2_create_service_account.png +0 -0
  124. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step3_credentials.png +0 -0
  125. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step4_project_settings.png +0 -0
  126. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/postgresql/step1_create_user.png +0 -0
  127. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/postgresql/step2_connection.png +0 -0
  128. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/posthog/step1_project_settings.png +0 -0
  129. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/posthog/step2_personal_api_keys.png +0 -0
  130. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/posthog/step3_create_key_modal.png +0 -0
  131. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step1_connect.png +0 -0
  132. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step2_create_user.png +0 -0
  133. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step3_grant.png +0 -0
  134. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step4_info.png +0 -0
  135. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step1_personal_tokens.png +0 -0
  136. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step2_create_token_permissions.png +0 -0
  137. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step3_organization_slug.png +0 -0
  138. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step4_project_slug.png +0 -0
  139. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/linear.svg +0 -0
  140. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/onequery.svg +0 -0
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i}from"./api-base-url-DIb6qukm.js";import{S as a,a as o,i as s,n as c,t as l,x as u,y as d}from"./createReactComponent-_L2mp4Ui.js";import{t as f}from"./utils-C8DGLIgm.js";import{d as p,n as m,r as h,t as g}from"./dropdown-menu-BIqdY_8v.js";import{c as _,o as v,s as y}from"./select-D6km4Obp.js";import{n as b,r as x,t as S}from"./checkbox-CJcCVDm9.js";import{t as C}from"./IconLoader2-B3B6M8nQ.js";import{t as w}from"./IconPlus-C3-kRhGX.js";import{a as T,c as E,i as ee,l as D,n as te,o as O,r as k,s as A,u as j}from"./use-optimistic-mutation-Uf_9TxpA.js";import{t as M}from"./useQuery-DcPzWABw.js";import{t as N}from"./useSuspenseQuery-BanVmJgY.js";import{t as P}from"./queryOptions-BHw87wTZ.js";import{_t as F,bt as I,i as L,nt as ne}from"./getDisabledMountTransitionStyles-BYKRz4ha.js";import{t as re}from"./useBaseUiId-BLFGpnYJ.js";import{t as R}from"./api-client-w1GRwBWy.js";import{$ as z,S as B,U as ie,V as ae,X as V,g as oe,h as se,m as ce}from"./index-CbFJKkNs.js";import{t as le}from"./input-CG_cIxvO.js";import{t as ue}from"./format-date-Ctrh7my1.js";import{t as de}from"./badge-C1_ZMBRy.js";import{a as fe,n as pe,o as me,r as he,t as H}from"./card-Bsy6azfK.js";import{a as ge,i as _e,n as U,o as ve,r as ye,t as W}from"./data-source-connection-form-DwwJ0tPU.js";var be=l(`outline`,`search`,`Search`,[[`path`,{d:`M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`,key:`svg-0`}],[`path`,{d:`M21 21l-6 -6`,key:`svg-1`}]]);function G(e){return e}var K=r(),q=e(t(),1),J=n(),Y=s(`grid gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4 w-full relative group/alert`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`text-destructive bg-card *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function X(e){let t=(0,K.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==i?(a=f(Y({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,J.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}function Z(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:hover:text-foreground [&_a]:underline [&_a]:underline-offset-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,J.jsx)(`div`,{"data-slot":`alert-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Q(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`text-muted-foreground text-sm text-balance md:text-pretty [&_p:not(:last-child)]:mb-4 [&_a]:hover:text-foreground [&_a]:underline [&_a]:underline-offset-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,J.jsx)(`div`,{"data-slot":`alert-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $(e){let t=(0,K.c)(13),[n,r]=(0,q.useState)(!1),i;t[0]===e?i=t[1]:(i=t=>{e.onSuccess?.(t),r(!1)},t[0]=e,t[1]=i);let a=i,o;t[2]===e.children?o=t[3]:(o=(0,J.jsx)(D,{render:e.children}),t[2]=e.children,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,J.jsxs)(A,{children:[(0,J.jsx)(E,{children:`Add Data Source`}),(0,J.jsx)(T,{children:`Connect a data source so OneQuery can query your workspace data.`})]}),t[4]=s):s=t[4];let c;t[5]!==a||t[6]!==e.initialProvider||t[7]!==e.organizationId?(c=(0,J.jsxs)(ee,{className:`sm:max-w-[720px] max-h-[85vh] overflow-y-auto overflow-x-hidden`,children:[s,(0,J.jsx)(W,{organizationId:e.organizationId,onSuccess:a,className:`py-4`,initialProvider:e.initialProvider})]}),t[5]=a,t[6]=e.initialProvider,t[7]=e.organizationId,t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==o||t[11]!==c?(l=(0,J.jsxs)(k,{open:n,onOpenChange:r,children:[o,c]}),t[9]=n,t[10]=o,t[11]=c,t[12]=l):l=t[12],l}var xe=180,Se=/\b(api[-_ ]?key|authorization|bearer|cookie|password|secret|token)\b|-----BEGIN/i;function Ce(e,t){let n=t?.replaceAll(/\s+/g,` `).trim();if(n&&n!==e)return n.length>xe||Se.test(n)?`Review the data source settings and try again.`:n}function we(e){let t=Ce(e.title,e.description);return ae.error(e.title,{action:e.action,className:`max-w-[34rem]`,closeButton:!0,description:t,descriptionClassName:`whitespace-pre-wrap break-words`,duration:t?12e3:8e3,position:`top-center`,richColors:!0})}var Te=R();async function Ee(e,t){let n=await Te.api[`data-sources`][`:id`][`github-repositories`].$get({param:{id:t},query:{organizationId:e}});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(B(e,`Failed to fetch GitHub repositories`))}return n.json()}function De(e,t){return P({queryFn:async()=>Ee(e,t),queryKey:[`github-repositories`,t]})}async function Oe(e,t,n){let r=await Te.api[`data-sources`][`:id`][`github-repositories`].$post({json:{repositories:n},param:{id:t},query:{organizationId:e}});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(B(e,`Failed to update GitHub repositories`))}return r.json()}function ke({queryClient:e,organizationId:t,dataSourceId:n,onSuccess:r,onError:i}){let a=De(t,n);return G({mutationFn:async e=>Oe(t,n,e.repositories),mutationKey:[`github-repositories`,n,`update`],onError:i,onSuccess:(t,n)=>{e.setQueryData(a.queryKey,e=>e&&{...e,selected:t.repositories}),r?.(t,n)}})}var Ae=q.createContext(void 0);function je(){let e=q.useContext(Ae);if(e===void 0)throw Error(d(53));return e}var Me=function(e){return e.scrollAreaCornerHeight=`--scroll-area-corner-height`,e.scrollAreaCornerWidth=`--scroll-area-corner-width`,e}({});function Ne(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=n===`x`?`Inline`:`Block`;return n===`x`&&t===`margin`?parseFloat(r[`${t}InlineStart`])*2:parseFloat(r[`${t}${i}Start`])+parseFloat(r[`${t}${i}End`])}var Pe=function(e){return e.orientation=`data-orientation`,e.hovering=`data-hovering`,e.scrolling=`data-scrolling`,e.hasOverflowX=`data-has-overflow-x`,e.hasOverflowY=`data-has-overflow-y`,e.overflowXStart=`data-overflow-x-start`,e.overflowXEnd=`data-overflow-x-end`,e.overflowYStart=`data-overflow-y-start`,e.overflowYEnd=`data-overflow-y-end`,e}({}),Fe=function(e){return e.hasOverflowX=`data-has-overflow-x`,e.hasOverflowY=`data-has-overflow-y`,e.overflowXStart=`data-overflow-x-start`,e.overflowXEnd=`data-overflow-x-end`,e.overflowYStart=`data-overflow-y-start`,e.overflowYEnd=`data-overflow-y-end`,e}({}),Ie={hasOverflowX:e=>e?{[Fe.hasOverflowX]:``}:null,hasOverflowY:e=>e?{[Fe.hasOverflowY]:``}:null,overflowXStart:e=>e?{[Fe.overflowXStart]:``}:null,overflowXEnd:e=>e?{[Fe.overflowXEnd]:``}:null,overflowYStart:e=>e?{[Fe.overflowYStart]:``}:null,overflowYEnd:e=>e?{[Fe.overflowYEnd]:``}:null,cornerHidden:()=>null},Le={x:0,y:0},Re={width:0,height:0},ze={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Be={x:!1,y:!1,corner:!1},Ve=q.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,...s}=e,c=He(i),l=re(),u=I(),d=I(),{nonce:f,disableStyleElements:p}=v(),[m,h]=q.useState(!1),[g,y]=q.useState(!1),[b,x]=q.useState(!1),[S,C]=q.useState(!1),[w,T]=q.useState(Re),[E,ee]=q.useState(Re),[D,te]=q.useState(ze),[O,k]=q.useState(Be),A=q.useRef(null),j=q.useRef(null),M=q.useRef(null),N=q.useRef(null),P=q.useRef(null),F=q.useRef(null),L=q.useRef(null),R=q.useRef(!1),z=q.useRef(0),B=q.useRef(0),ie=q.useRef(0),ae=q.useRef(0),V=q.useRef(`vertical`),oe=q.useRef(Le),se=a(e=>{let t=e.x-oe.current.x,n=e.y-oe.current.y;oe.current=e,n!==0&&(x(!0),u.start(500,()=>{x(!1)})),t!==0&&(y(!0),d.start(500,()=>{y(!1)}))}),ce=a(e=>{e.button===0&&(R.current=!0,z.current=e.clientY,B.current=e.clientX,V.current=e.currentTarget.getAttribute(Pe.orientation),j.current&&(ie.current=j.current.scrollTop,ae.current=j.current.scrollLeft),P.current&&V.current===`vertical`&&P.current.setPointerCapture(e.pointerId),F.current&&V.current===`horizontal`&&F.current.setPointerCapture(e.pointerId))}),le=a(e=>{if(!R.current)return;let t=e.clientY-z.current,n=e.clientX-B.current;if(j.current){let r=j.current.scrollHeight,i=j.current.clientHeight,a=j.current.scrollWidth,o=j.current.clientWidth;if(P.current&&M.current&&V.current===`vertical`){let n=Ne(M.current,`padding`,`y`),a=Ne(P.current,`margin`,`y`),o=P.current.offsetHeight,s=t/(M.current.offsetHeight-o-n-a);j.current.scrollTop=ie.current+s*(r-i),e.preventDefault(),x(!0),u.start(500,()=>{x(!1)})}if(F.current&&N.current&&V.current===`horizontal`){let t=Ne(N.current,`padding`,`x`),r=Ne(F.current,`margin`,`x`),i=F.current.offsetWidth,s=n/(N.current.offsetWidth-i-t-r);j.current.scrollLeft=ae.current+s*(a-o),e.preventDefault(),y(!0),d.start(500,()=>{y(!1)})}}}),ue=a(e=>{R.current=!1,P.current&&V.current===`vertical`&&P.current.releasePointerCapture(e.pointerId),F.current&&V.current===`horizontal`&&F.current.releasePointerCapture(e.pointerId)});function de(e){C(e.pointerType===`touch`)}function fe(e){de(e),e.pointerType!==`touch`&&h(ne(A.current,e.target))}let pe=q.useMemo(()=>({hasOverflowX:!O.x,hasOverflowY:!O.y,overflowXStart:D.xStart,overflowXEnd:D.xEnd,overflowYStart:D.yStart,overflowYEnd:D.yEnd,cornerHidden:O.corner}),[O.x,O.y,O.corner,D]),me={role:`presentation`,onPointerEnter:fe,onPointerMove:fe,onPointerDown:de,onPointerLeave(){h(!1)},style:{position:`relative`,[Me.scrollAreaCornerHeight]:`${w.height}px`,[Me.scrollAreaCornerWidth]:`${w.width}px`}},he=o(`div`,e,{state:pe,ref:[t,A],props:[me,s],stateAttributesMapping:Ie}),H=q.useMemo(()=>({handlePointerDown:ce,handlePointerMove:le,handlePointerUp:ue,handleScroll:se,cornerSize:w,setCornerSize:T,thumbSize:E,setThumbSize:ee,touchModality:S,cornerRef:L,scrollingX:g,setScrollingX:y,scrollingY:b,setScrollingY:x,hovering:m,setHovering:h,viewportRef:j,rootRef:A,scrollbarYRef:M,scrollbarXRef:N,thumbYRef:P,thumbXRef:F,rootId:l,hiddenState:O,setHiddenState:k,overflowEdges:D,setOverflowEdges:te,viewportState:pe,overflowEdgeThreshold:c}),[ce,le,ue,se,w,E,S,g,y,b,x,m,h,l,O,D,pe,c]);return(0,J.jsxs)(Ae.Provider,{value:H,children:[!p&&_.getElement(f),he]})});function He(e){if(typeof e==`number`){let t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}var Ue=q.createContext(void 0);function We(e,t){if(typeof IntersectionObserver>`u`)return()=>{};let n=new IntersectionObserver(e=>{e.forEach(e=>{e.intersectionRatio>0&&(t(),n.disconnect())})});return n.observe(e),()=>{n.disconnect()}}var Ge=function(e){return e.scrollAreaOverflowXStart=`--scroll-area-overflow-x-start`,e.scrollAreaOverflowXEnd=`--scroll-area-overflow-x-end`,e.scrollAreaOverflowYStart=`--scroll-area-overflow-y-start`,e.scrollAreaOverflowYEnd=`--scroll-area-overflow-y-end`,e}({}),Ke=!1;function qe(){Ke||F||(typeof CSS<`u`&&`registerProperty`in CSS&&[Ge.scrollAreaOverflowXStart,Ge.scrollAreaOverflowXEnd,Ge.scrollAreaOverflowYStart,Ge.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),Ke=!0)}var Je=q.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{viewportRef:s,scrollbarYRef:c,scrollbarXRef:l,thumbYRef:d,thumbXRef:f,cornerRef:p,cornerSize:m,setCornerSize:h,setThumbSize:g,rootId:v,setHiddenState:b,hiddenState:x,handleScroll:S,setHovering:C,setOverflowEdges:w,overflowEdges:T,overflowEdgeThreshold:E}=je(),ee=L(),D=q.useRef(!0),te=I(),O=I(),k=a(()=>{let e=s.current,t=c.current,n=l.current,r=d.current,i=f.current,a=p.current;if(!e)return;let o=e.scrollHeight,u=e.scrollWidth,_=e.clientHeight,v=e.clientWidth,x=e.scrollTop,S=e.scrollLeft;if(o===0||u===0)return;let C=_>=o,T=v>=u,D=v/u,te=_/o,O=Math.max(0,u-v),k=Math.max(0,o-_),A=0,j=0;T||(A=y(ee===`rtl`?-S:S,0,O),j=O-A);let M=C?0:y(x,0,k),N=C?0:k-M,P=T?0:v,F=C?0:_,I=0,L=0;!T&&!C&&(I=t?.offsetWidth||0,L=n?.offsetHeight||0);let ne=m.width===0&&m.height===0,re=ne?I:0,R=ne?L:0,z=Ne(n,`padding`,`x`),B=Ne(t,`padding`,`y`),ie=Ne(i,`margin`,`x`),ae=Ne(r,`margin`,`y`),V=P-z-ie,oe=F-B-ae,se=n?Math.min(n.offsetWidth-re,V):V,ce=t?Math.min(t.offsetHeight-R,oe):oe,le=Math.max(16,se*D),ue=Math.max(16,ce*te);if(g(e=>e.height===ue&&e.width===le?e:{width:le,height:ue}),t&&r){let e=t.offsetHeight-ue-B-ae,n=o-_,i=n===0?0:x/n,a=Math.min(e,Math.max(0,i*e));r.style.transform=`translate3d(0,${a}px,0)`}if(n&&i){let e=n.offsetWidth-le-z-ie,t=u-v,r=t===0?0:S/t,a=ee===`rtl`?y(r*e,-e,0):y(r*e,0,e);i.style.transform=`translate3d(${a}px,0,0)`}let de=y(A,0,O),fe=y(j,0,O),pe=y(M,0,k),me=y(N,0,k),he=[[Ge.scrollAreaOverflowXStart,de],[Ge.scrollAreaOverflowXEnd,fe],[Ge.scrollAreaOverflowYStart,pe],[Ge.scrollAreaOverflowYEnd,me]];for(let[t,n]of he)e.style.setProperty(t,`${n}px`);a&&(T||C?h({width:0,height:0}):!T&&!C&&h({width:I,height:L})),b(e=>{let t=C||T;return e.y===C&&e.x===T&&e.corner===t?e:{y:C,x:T,corner:t}});let H={xStart:!T&&de>E.xStart,xEnd:!T&&fe>E.xEnd,yStart:!C&&pe>E.yStart,yEnd:!C&&me>E.yEnd};w(e=>e.xStart===H.xStart&&e.xEnd===H.xEnd&&e.yStart===H.yStart&&e.yEnd===H.yEnd?e:H)});u(()=>{if(!s.current)return;qe();let e=!1;return We(s.current,()=>{if(!e){e=!0;return}k()})},[k,s]),u(()=>{queueMicrotask(k)},[k,x,ee]),u(()=>{s.current?.matches(`:hover`)&&C(!0)},[s,C]),q.useEffect(()=>{let e=s.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;return}k()});return n.observe(e),O.start(0,()=>{let t=e.getAnimations({subtree:!0});t.length!==0&&Promise.all(t.map(e=>e.finished)).then(k).catch(()=>{})}),()=>{n.disconnect(),O.clear()}},[k,s,O]);function A(){D.current=!1}let j={role:`presentation`,...v&&{"data-id":`${v}-viewport`},...(!x.x||!x.y)&&{tabIndex:0},className:_.className,style:{overflow:`scroll`},onScroll(){s.current&&(k(),D.current||S({x:s.current.scrollLeft,y:s.current.scrollTop}),te.start(100,()=>{D.current=!0}))},onWheel:A,onTouchMove:A,onPointerMove:A,onPointerEnter:A,onKeyDown:A},M=q.useMemo(()=>({hasOverflowX:!x.x,hasOverflowY:!x.y,overflowXStart:T.xStart,overflowXEnd:T.xEnd,overflowYStart:T.yStart,overflowYEnd:T.yEnd,cornerHidden:x.corner}),[x.x,x.y,x.corner,T]),N=o(`div`,e,{ref:[t,s],state:M,props:[j,i],stateAttributesMapping:Ie}),P=q.useMemo(()=>({computeThumbPosition:k}),[k]);return(0,J.jsx)(Ue.Provider,{value:P,children:N})}),Ye=q.createContext(void 0);function Xe(){let e=q.useContext(Ye);if(e===void 0)throw Error(d(54));return e}var Ze=function(e){return e.scrollAreaThumbHeight=`--scroll-area-thumb-height`,e.scrollAreaThumbWidth=`--scroll-area-thumb-width`,e}({}),Qe=q.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,overflowEdges:f,scrollbarYRef:p,scrollbarXRef:m,viewportRef:h,thumbYRef:g,thumbXRef:_,handlePointerDown:v,handlePointerUp:y,rootId:b,thumbSize:x}=je(),S=q.useMemo(()=>({hovering:c,scrolling:{horizontal:l,vertical:u}[i],orientation:i,hasOverflowX:!d.x,hasOverflowY:!d.y,overflowXStart:f.xStart,overflowXEnd:f.xEnd,overflowYStart:f.yStart,overflowYEnd:f.yEnd,cornerHidden:d.corner}),[c,l,u,i,d,f]),C=L();q.useEffect(()=>{let e=h.current,t=i===`vertical`?p.current:m.current;if(!t)return;function n(n){if(!(!e||!t||n.ctrlKey)){if(n.preventDefault(),i===`vertical`){if(e.scrollTop===0&&n.deltaY<0)return}else if(e.scrollLeft===0&&n.deltaX<0)return;if(i===`vertical`){if(e.scrollTop===e.scrollHeight-e.clientHeight&&n.deltaY>0)return}else if(e.scrollLeft===e.scrollWidth-e.clientWidth&&n.deltaX>0)return;i===`vertical`?e.scrollTop+=n.deltaY:e.scrollLeft+=n.deltaX}}return t.addEventListener(`wheel`,n,{passive:!1}),()=>{t.removeEventListener(`wheel`,n)}},[i,m,p,h]);let w={...b&&{"data-id":`${b}-scrollbar`},onPointerDown(e){if(e.button===0&&e.currentTarget===e.target&&h.current){if(g.current&&p.current&&i===`vertical`){let t=Ne(g.current,`margin`,`y`),n=Ne(p.current,`padding`,`y`),r=g.current.offsetHeight,i=p.current.getBoundingClientRect(),a=e.clientY-i.top-r/2-n+t/2,o=h.current.scrollHeight,s=h.current.clientHeight,c=a/(p.current.offsetHeight-r-n-t)*(o-s);h.current.scrollTop=c}if(_.current&&m.current&&i===`horizontal`){let t=Ne(_.current,`margin`,`x`),n=Ne(m.current,`padding`,`x`),r=_.current.offsetWidth,i=m.current.getBoundingClientRect(),a=e.clientX-i.left-r/2-n+t/2,o=h.current.scrollWidth,s=h.current.clientWidth,c=a/(m.current.offsetWidth-r-n-t),l;C===`rtl`?(l=(1-c)*(o-s),h.current.scrollLeft<=0&&(l=-l)):l=c*(o-s),h.current.scrollLeft=l}v(e)}},onPointerUp:y,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,...i===`vertical`&&{top:0,bottom:`var(${Me.scrollAreaCornerHeight})`,insetInlineEnd:0,[Ze.scrollAreaThumbHeight]:`${x.height}px`},...i===`horizontal`&&{insetInlineStart:0,insetInlineEnd:`var(${Me.scrollAreaCornerWidth})`,bottom:0,[Ze.scrollAreaThumbWidth]:`${x.width}px`}}},T=o(`div`,e,{ref:[t,i===`vertical`?p:m],state:S,props:[w,s],stateAttributesMapping:Ie}),E=q.useMemo(()=>({orientation:i}),[i]),ee=i===`vertical`?d.y:d.x;return a||!ee?(0,J.jsx)(Ye.Provider,{value:E,children:T}):null}),$e=q.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{thumbYRef:a,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,setScrollingX:d,setScrollingY:f}=je(),{orientation:p}=Xe(),m=q.useMemo(()=>({orientation:p}),[p]);return o(`div`,e,{ref:[t,p===`vertical`?a:s],state:m,props:[{onPointerDown:c,onPointerMove:l,onPointerUp(e){p===`vertical`&&f(!1),p===`horizontal`&&d(!1),u(e)},style:{...p===`vertical`&&{height:`var(${Ze.scrollAreaThumbHeight})`},...p===`horizontal`&&{width:`var(${Ze.scrollAreaThumbWidth})`}}},i]})}),et=q.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{cornerRef:a,cornerSize:s,hiddenState:c}=je(),l=o(`div`,e,{ref:[t,a],props:[{style:{position:`absolute`,bottom:0,insetInlineEnd:0,width:s.width,height:s.height}},i]});return c.corner?null:l});function tt(e){let t=(0,K.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=f(`relative`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=(0,J.jsx)(Je,{"data-slot":`scroll-area-viewport`,className:`focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1`,children:n}),t[6]=n,t[7]=o);let s,c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,J.jsx)(nt,{}),c=(0,J.jsx)(et,{}),t[8]=s,t[9]=c):(s=t[8],c=t[9]);let l;return t[10]!==i||t[11]!==a||t[12]!==o?(l=(0,J.jsxs)(Ve,{"data-slot":`scroll-area`,className:a,...i,children:[o,s,c]}),t[10]=i,t[11]=a,t[12]=o,t[13]=l):l=t[13],l}function nt(e){let t=(0,K.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]===n?o=t[5]:(o=f(`data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent flex touch-none p-px transition-colors select-none`,n),t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,J.jsx)($e,{"data-slot":`scroll-area-thumb`,className:`rounded-full bg-border relative flex-1`}),t[6]=s):s=t[6];let c;return t[7]!==a||t[8]!==r||t[9]!==o?(c=(0,J.jsx)(Qe,{"data-slot":`scroll-area-scrollbar`,"data-orientation":a,orientation:a,className:o,...r,children:s}),t[7]=a,t[8]=r,t[9]=o,t[10]=c):c=t[10],c}function rt(e,t){if(e.length!==t.length)return!0;let n=new Set(e);return t.some(e=>!n.has(e))}function it(e){let t=(0,K.c)(94),[n,r]=(0,q.useState)(``),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,q.useState)(i),s=(0,q.useRef)(!1),l=ie(),u;t[1]!==e.dataSourceId||t[2]!==e.organizationId?(u=De(e.organizationId,e.dataSourceId),t[1]=e.dataSourceId,t[2]=e.organizationId,t[3]=u):u=t[3];let d;t[4]!==e.open||t[5]!==u?(d={...u,enabled:e.open},t[4]=e.open,t[5]=u,t[6]=d):d=t[6];let f=M(d),p;t[7]===f.data?.repositories?p=t[8]:(p=f.data?.repositories??[],t[7]=f.data?.repositories,t[8]=p);let m=p,h;t[9]===f.data?.selected?h=t[10]:(h=f.data?.selected??[],t[9]=f.data?.selected,t[10]=h);let g=h,_,v;t[11]!==g||t[12]!==e.open||t[13]!==f.data?(_=()=>{if(!e.open){s.current=!1,r(``);return}f.data&&(s.current||=(o(g),!0))},v=[g,e.open,f.data],t[11]=g,t[12]=e.open,t[13]=f.data,t[14]=_,t[15]=v):(_=t[14],v=t[15]),(0,q.useEffect)(_,v);let y;if(t[16]!==m||t[17]!==n){bb0:{let e=n.trim().toLowerCase();if(!e){y=m;break bb0}y=m.filter(t=>{let n=t.owner.toLowerCase(),r=t.name.toLowerCase(),i=t.fullName.toLowerCase();return n.includes(e)||r.includes(e)||i.includes(e)})}t[16]=m,t[17]=n,t[18]=y}else y=t[18];let b=y,x;t[19]!==g||t[20]!==a?(x=rt(a,g),t[19]=g,t[20]=a,t[21]=x):x=t[21];let w=x,D;t[22]===e?D=t[23]:(D=()=>{ae.success(`GitHub repositories updated`),e.onOpenChange(!1)},t[22]=e,t[23]=D);let te;t[24]!==e.dataSourceId||t[25]!==e.organizationId||t[26]!==l||t[27]!==D?(te=ke({dataSourceId:e.dataSourceId,onError:ot,onSuccess:D,organizationId:e.organizationId,queryClient:l}),t[24]=e.dataSourceId,t[25]=e.organizationId,t[26]=l,t[27]=D,t[28]=te):te=t[28];let N=j(te),P;t[29]===a?P=t[30]:(P=new Set(a),t[29]=a,t[30]=P);let F=P,I;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){o(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},t[31]=I):I=t[31];let L=I,ne;t[32]===b?ne=t[33]:(ne=function(){let e=b.map(at);o(t=>[...new Set([...t,...e])])},t[32]=b,t[33]=ne);let re=ne,R;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(){o([])},t[34]=R):R=t[34];let z=R,B=f.isLoading,V=f.isError,oe=w&&!N.isPending,se;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,J.jsxs)(A,{children:[(0,J.jsx)(E,{children:`Select GitHub Repositories`}),(0,J.jsx)(T,{children:`Choose repositories to use for this data source. We only read from the repositories your saved token can access and that you select here.`})]}),t[35]=se):se=t[35];let ce;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,J.jsx)(be,{size:16,className:`absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`}),t[36]=ce):ce=t[36];let ue;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ue=e=>r(e.target.value),t[37]=ue):ue=t[37];let fe;t[38]===n?fe=t[39]:(fe=(0,J.jsxs)(`div`,{className:`relative flex-1`,children:[ce,(0,J.jsx)(le,{value:n,onChange:ue,placeholder:`Search repositories...`,className:`pl-9`})]}),t[38]=n,t[39]=fe);let pe=b.length===0,me;t[40]!==re||t[41]!==pe?(me=(0,J.jsx)(c,{variant:`outline`,size:`sm`,onClick:re,disabled:pe,children:`Select visible`}),t[40]=re,t[41]=pe,t[42]=me):me=t[42];let he=a.length===0,H;t[43]===he?H=t[44]:(H=(0,J.jsx)(c,{variant:`ghost`,size:`sm`,onClick:z,disabled:he,children:`Clear`}),t[43]=he,t[44]=H);let ge;t[45]!==fe||t[46]!==me||t[47]!==H?(ge=(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[fe,me,H]}),t[45]=fe,t[46]=me,t[47]=H,t[48]=ge):ge=t[48];let _e=m.length>0?` • ${m.length} available`:``,U;t[49]!==a.length||t[50]!==_e?(U=(0,J.jsxs)(`span`,{children:[a.length,` selected`,_e]}),t[49]=a.length,t[50]=_e,t[51]=U):U=t[51];let ve;t[52]===w?ve=t[53]:(ve=w?(0,J.jsx)(de,{variant:`outline`,children:`Unsaved`}):null,t[52]=w,t[53]=ve);let ye;t[54]!==U||t[55]!==ve?(ye=(0,J.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[U,ve]}),t[54]=U,t[55]=ve,t[56]=ye):ye=t[56];let W;t[57]===B?W=t[58]:(W=B?(0,J.jsx)(`div`,{className:`flex items-center justify-center py-12 text-muted-foreground`,children:(0,J.jsx)(C,{size:24,className:`animate-spin`})}):null,t[57]=B,t[58]=W);let G;t[59]===V?G=t[60]:(G=V?(0,J.jsx)(`p`,{className:`text-sm text-destructive`,children:`Unable to load repositories. Please try again.`}):null,t[59]=V,t[60]=G);let Y;t[61]!==b||t[62]!==V||t[63]!==B||t[64]!==F?(Y=!B&&!V?(0,J.jsx)(tt,{className:`h-[320px] rounded-md border`,children:(0,J.jsxs)(`div`,{className:`p-2 space-y-1`,children:[b.length===0?(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground px-3 py-6 text-center`,children:`No repositories found.`}):null,b.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:`w-full flex items-center gap-3 rounded-md px-3 py-2 hover:bg-accent transition-colors text-left`,onClick:t=>{let n=t.target;n instanceof HTMLElement&&(n.closest(`[data-slot="checkbox"]`)||L(e.fullName))},children:[(0,J.jsx)(S,{checked:F.has(e.fullName),onCheckedChange:()=>L(e.fullName)}),(0,J.jsxs)(`div`,{className:`flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:e.fullName}),e.private?(0,J.jsx)(de,{variant:`secondary`,children:`Private`}):null]}),(0,J.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Owner: `,e.owner]})]})]},e.id))]})}):null,t[61]=b,t[62]=V,t[63]=B,t[64]=F,t[65]=Y):Y=t[65];let X;t[66]!==ge||t[67]!==ye||t[68]!==W||t[69]!==G||t[70]!==Y?(X=(0,J.jsxs)(`div`,{className:`space-y-3`,children:[ge,ye,W,G,Y]}),t[66]=ge,t[67]=ye,t[68]=W,t[69]=G,t[70]=Y,t[71]=X):X=t[71];let Z;t[72]===e?Z=t[73]:(Z=()=>e.onOpenChange(!1),t[72]=e,t[73]=Z);let Q;t[74]!==Z||t[75]!==N.isPending?(Q=(0,J.jsx)(c,{variant:`outline`,onClick:Z,disabled:N.isPending,children:`Cancel`}),t[74]=Z,t[75]=N.isPending,t[76]=Q):Q=t[76];let $;t[77]!==a||t[78]!==N?($=()=>N.mutate({repositories:a}),t[77]=a,t[78]=N,t[79]=$):$=t[79];let xe=!oe,Se=N.isPending?`Saving...`:`Save`,Ce;t[80]!==$||t[81]!==xe||t[82]!==Se?(Ce=(0,J.jsx)(c,{onClick:$,disabled:xe,children:Se}),t[80]=$,t[81]=xe,t[82]=Se,t[83]=Ce):Ce=t[83];let we;t[84]!==Q||t[85]!==Ce?(we=(0,J.jsxs)(O,{children:[Q,Ce]}),t[84]=Q,t[85]=Ce,t[86]=we):we=t[86];let Te;t[87]!==X||t[88]!==we?(Te=(0,J.jsxs)(ee,{className:`sm:max-w-[680px]`,children:[se,X,we]}),t[87]=X,t[88]=we,t[89]=Te):Te=t[89];let Ee;return t[90]!==e.onOpenChange||t[91]!==e.open||t[92]!==Te?(Ee=(0,J.jsx)(k,{open:e.open,onOpenChange:e.onOpenChange,children:Te}),t[90]=e.onOpenChange,t[91]=e.open,t[92]=Te,t[93]=Ee):Ee=t[93],Ee}function at(e){return e.fullName}function ot(e){we({title:`Failed to update GitHub repositories`,description:e.message})}function st(e){switch(e){case`active`:return`default`;case`error`:return`destructive`;case`disconnected`:return`secondary`;default:return`outline`}}function ct(e){let t=(0,K.c)(4);if(!e.errorMessage)return null;let n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,J.jsx)(z,{className:`size-4`}),r=(0,J.jsx)(Z,{children:`Connection needs attention`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e.errorMessage?i=t[3]:(i=(0,J.jsxs)(X,{variant:`destructive`,className:`mt-3 border-destructive/30 bg-destructive/5`,children:[n,r,(0,J.jsx)(Q,{className:`max-h-32 overflow-y-auto whitespace-pre-wrap break-words pr-1`,children:e.errorMessage})]}),t[2]=e.errorMessage,t[3]=i),i}function lt(e){let t=(0,K.c)(81),{dataSource:n,organizationId:r,openGitHubRepositories:i}=e,a;t[0]===r?a=t[1]:(a=ce(r),t[0]=r,t[1]=a);let o=a.queryKey,[s,l]=(0,q.useState)(!1),u=(0,q.useRef)(!1),d,f;t[2]!==n.provider||t[3]!==i?(d=()=>{u.current||i&&n.provider===`github`&&(l(!0),u.current=!0)},f=[n.provider,i],t[2]=n.provider,t[3]=i,t[4]=d,t[5]=f):(d=t[4],f=t[5]),(0,q.useEffect)(d,f);let _;t[6]!==n.id||t[7]!==r?(_=async()=>oe(n.id,r),t[6]=n.id,t[7]=r,t[8]=_):_=t[8];let v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=[`data-sources`],t[9]=v):v=t[9];let y;t[10]===_?y=t[11]:(y={mutationFn:_,mutationKey:v,onError:dt,onSuccess:ut},t[10]=_,t[11]=y);let S=j(y),C;t[12]!==n.id||t[13]!==r?(C=async()=>se(n.id,r),t[12]=n.id,t[13]=r,t[14]=C):C=t[14];let w;t[15]!==n.id||t[16]!==o||t[17]!==C?(w={errorMessage:`Failed to delete data source`,itemId:n.id,mutationFn:C,queryKey:o,successMessage:`Data source deleted`},t[15]=n.id,t[16]=o,t[17]=C,t[18]=w):w=t[18];let T=te(w),E;t[19]===n.provider?E=t[20]:(E=ve(n.provider),t[19]=n.provider,t[20]=E);let ee=E,D;t[21]===n.provider?D=t[22]:(D=_e(n.provider),t[21]=n.provider,t[22]=D);let O=D,k=O?`Test Connection`:`Test Connection (Unsupported)`,A;t[23]===n.name?A=t[24]:(A=(0,J.jsx)(me,{className:`text-lg`,children:n.name}),t[23]=n.name,t[24]=A);let M;t[25]===ee?M=t[26]:(M=(0,J.jsx)(ee,{className:`h-4.5 w-4.5`}),t[25]=ee,t[26]=M);let N;t[27]===n.provider?N=t[28]:(N=ye(n.provider),t[27]=n.provider,t[28]=N);let P;t[29]!==M||t[30]!==N?(P=(0,J.jsxs)(he,{className:`flex items-center gap-1.5 mt-0.5`,children:[M,N]}),t[29]=M,t[30]=N,t[31]=P):P=t[31];let F;t[32]!==A||t[33]!==P?(F=(0,J.jsxs)(`div`,{children:[A,P]}),t[32]=A,t[33]=P,t[34]=F):F=t[34];let I;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,J.jsx)(p,{children:(0,J.jsx)(c,{variant:`ghost`,size:`icon-sm`,children:(0,J.jsx)(x,{size:16,stroke:2})})}),t[35]=I):I=t[35];let L;t[36]===S?L=t[37]:(L=()=>S.mutate(),t[36]=S,t[37]=L);let ne=S.isPending||!O,re;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,J.jsx)(V,{size:16,stroke:2}),t[38]=re):re=t[38];let R=S.isPending?`Testing...`:k,z;t[39]!==L||t[40]!==ne||t[41]!==R?(z=(0,J.jsxs)(h,{onClick:L,disabled:ne,children:[re,R]}),t[39]=L,t[40]=ne,t[41]=R,t[42]=z):z=t[42];let B;t[43]===n.provider?B=t[44]:(B=n.provider===`github`?(0,J.jsxs)(h,{onClick:()=>l(!0),children:[(0,J.jsx)(ge,{size:16,stroke:`2`}),`Select Repositories`]}):null,t[43]=n.provider,t[44]=B);let ie;t[45]===T?ie=t[46]:(ie=()=>T.mutate(),t[45]=T,t[46]=ie);let ae;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,J.jsx)(b,{size:16,stroke:2}),t[47]=ae):ae=t[47];let le=T.isPending?`Deleting...`:`Delete`,U;t[48]!==T.isPending||t[49]!==ie||t[50]!==le?(U=(0,J.jsxs)(h,{onClick:ie,disabled:T.isPending,className:`text-destructive focus:text-destructive`,children:[ae,le]}),t[48]=T.isPending,t[49]=ie,t[50]=le,t[51]=U):U=t[51];let W;t[52]!==z||t[53]!==B||t[54]!==U?(W=(0,J.jsxs)(g,{children:[I,(0,J.jsxs)(m,{align:`end`,className:`min-w-40`,children:[z,B,U]})]}),t[52]=z,t[53]=B,t[54]=U,t[55]=W):W=t[55];let be;t[56]!==F||t[57]!==W?(be=(0,J.jsxs)(fe,{className:`flex flex-row items-start justify-between space-y-0 pb-2`,children:[F,W]}),t[56]=F,t[57]=W,t[58]=be):be=t[58];let G;t[59]===n.status?G=t[60]:(G=st(n.status),t[59]=n.status,t[60]=G);let Y;t[61]!==n.status||t[62]!==G?(Y=(0,J.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,J.jsx)(de,{variant:G,children:n.status})}),t[61]=n.status,t[62]=G,t[63]=Y):Y=t[63];let X;t[64]===n.lastUsedAt?X=t[65]:(X=n.lastUsedAt&&(0,J.jsxs)(`p`,{className:`text-sm text-muted-foreground mt-2`,children:[`Last used: `,ue(n.lastUsedAt)]}),t[64]=n.lastUsedAt,t[65]=X);let Z;t[66]===n.errorMessage?Z=t[67]:(Z=(0,J.jsx)(ct,{errorMessage:n.errorMessage}),t[66]=n.errorMessage,t[67]=Z);let Q;t[68]!==Y||t[69]!==X||t[70]!==Z?(Q=(0,J.jsxs)(pe,{children:[Y,X,Z]}),t[68]=Y,t[69]=X,t[70]=Z,t[71]=Q):Q=t[71];let $;t[72]!==n.id||t[73]!==n.provider||t[74]!==r||t[75]!==s?($=n.provider===`github`?(0,J.jsx)(it,{organizationId:r,dataSourceId:n.id,open:s,onOpenChange:l}):null,t[72]=n.id,t[73]=n.provider,t[74]=r,t[75]=s,t[76]=$):$=t[76];let xe;return t[77]!==be||t[78]!==Q||t[79]!==$?(xe=(0,J.jsxs)(H,{children:[be,Q,$]}),t[77]=be,t[78]=Q,t[79]=$,t[80]=xe):xe=t[80],xe}function ut(e){if(e.kind===`unsupported`){ae.info(e.message);return}if(e.result.success){ae.success(`Data source test successful`);return}we({title:`Data source test failed`,description:e.result.error??e.result.message??`Unknown error`})}function dt(e){return we({title:`Failed to test data source`,description:e.message})}function ft(e){return e}function pt(e){let t=(0,K.c)(18),n;t[0]===e.provider?n=t[1]:(n=ve(e.provider),t[0]=e.provider,t[1]=n);let r=n,i;t[2]===r?i=t[3]:(i=(0,J.jsx)(r,{className:`h-5 w-5 text-muted-foreground shrink-0`}),t[2]=r,t[3]=i);let a;t[4]===e.provider?a=t[5]:(a=ye(e.provider),t[4]=e.provider,t[5]=a);let o;t[6]===a?o=t[7]:(o=(0,J.jsx)(`p`,{className:`font-medium truncate`,children:a}),t[6]=a,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,J.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[i,o]}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let l;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,J.jsx)(c,{variant:`secondary`,size:`sm`,children:`Connect`}),t[11]=l):l=t[11];let u;t[12]!==e.organizationId||t[13]!==e.provider?(u=(0,J.jsx)($,{organizationId:e.organizationId,initialProvider:e.provider,children:l}),t[12]=e.organizationId,t[13]=e.provider,t[14]=u):u=t[14];let d;return t[15]!==s||t[16]!==u?(d=(0,J.jsx)(H,{className:`border-dashed`,children:(0,J.jsx)(pe,{className:`p-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[s,u]})})}),t[15]=s,t[16]=u,t[17]=d):d=t[17],d}function mt(e){let t=(0,K.c)(35),{organizationId:n,openGitHubDataSourceId:r}=e,i;t[0]===n?i=t[1]:(i=ce(n),t[0]=n,t[1]=i);let{data:a}=N(i),o,s,l,u,d,f,p,m;if(t[2]!==a||t[3]!==r||t[4]!==n){let e=ft(a),i=new Set(e.map(ht)),h=U.filter(e=>!i.has(e)),g=e.length>0;d=`space-y-8`;let _;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Connected`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Data sources already connected to your workspace.`})]}),t[13]=_):_=t[13];let v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,J.jsxs)(c,{children:[(0,J.jsx)(w,{size:16,stroke:2}),`Add Data Source`]}),t[14]=v):v=t[14],t[15]===n?f=t[16]:(f=(0,J.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[_,(0,J.jsx)($,{organizationId:n,children:v})]}),t[15]=n,t[16]=f),t[17]===g?p=t[18]:(p=g?null:(0,J.jsxs)(`div`,{className:`text-center py-12`,children:[(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`No connected data sources yet.`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Connect one below or add a new data source to get started.`})]}),t[17]=g,t[18]=p),m=g?(0,J.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>(0,J.jsx)(lt,{dataSource:e,organizationId:n,openGitHubRepositories:r===e.id},e.id))}):null,l=`space-y-4`,t[19]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Not connected`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Available data sources you can connect next.`})]}),t[19]=u):u=t[19],o=`grid gap-4 md:grid-cols-2 lg:grid-cols-3`;let y;t[20]===n?y=t[21]:(y=e=>(0,J.jsx)(pt,{provider:e,organizationId:n},e),t[20]=n,t[21]=y),s=h.map(y),t[2]=a,t[3]=r,t[4]=n,t[5]=o,t[6]=s,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m}else o=t[5],s=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12];let h;t[22]!==o||t[23]!==s?(h=(0,J.jsx)(`div`,{className:o,children:s}),t[22]=o,t[23]=s,t[24]=h):h=t[24];let g;t[25]!==h||t[26]!==l||t[27]!==u?(g=(0,J.jsxs)(`div`,{className:l,children:[u,h]}),t[25]=h,t[26]=l,t[27]=u,t[28]=g):g=t[28];let _;return t[29]!==g||t[30]!==d||t[31]!==f||t[32]!==p||t[33]!==m?(_=(0,J.jsxs)(`div`,{className:d,children:[f,p,m,g]}),t[29]=g,t[30]=d,t[31]=f,t[32]=p,t[33]=m,t[34]=_):_=t[34],_}function ht(e){return e.provider}var gt=i(`/_authenticated/$org_slug/integrations`);function _t(){let e=(0,K.c)(4),{organizationId:t}=gt.useRouteContext(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,J.jsx)(`section`,{children:(0,J.jsxs)(`div`,{className:`mb-6`,children:[(0,J.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Integrations`}),(0,J.jsx)(`p`,{className:`text-muted-foreground mt-2`,children:`Manage the data sources connected to your workspace.`})]})}),e[0]=n):n=e[0];let r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsxs)(`div`,{className:`mb-4`,children:[(0,J.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Data Sources`}),(0,J.jsx)(`p`,{className:`text-muted-foreground text-sm mt-1`,children:`Connect databases, analytics platforms, and other services to provide data for your agents.`})]}),e[1]=r):r=e[1];let i;return e[2]===t?i=e[3]:(i=(0,J.jsxs)(`div`,{className:`p-8 space-y-12`,children:[n,(0,J.jsxs)(`section`,{children:[r,(0,J.jsx)(mt,{organizationId:t})]})]}),e[2]=t,e[3]=i),i}var vt=_t;export{vt as component};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i}from"./api-base-url-DIb6qukm.js";import{S as a,a as o,i as s,n as c,t as l,x as u,y as d}from"./createReactComponent-_L2mp4Ui.js";import{t as f}from"./utils-C8DGLIgm.js";import{d as p,n as m,r as h,t as g}from"./dropdown-menu-BhdkLmzJ.js";import{c as _,o as v,s as y}from"./select-D6km4Obp.js";import{n as b,r as x,t as S}from"./checkbox-CJcCVDm9.js";import{t as C}from"./IconLoader2-B3B6M8nQ.js";import{t as w}from"./IconPlus-C3-kRhGX.js";import{a as T,c as E,i as ee,l as D,n as te,o as O,r as k,s as A,u as j}from"./use-optimistic-mutation-B6q6iB7T.js";import{t as M}from"./useQuery-BCl2C7k4.js";import{t as N}from"./useSuspenseQuery-BoUwwhvS.js";import{t as P}from"./queryOptions-BHw87wTZ.js";import{_t as F,bt as I,i as L,nt as ne}from"./getDisabledMountTransitionStyles-BYKRz4ha.js";import{t as re}from"./useBaseUiId-BLFGpnYJ.js";import{t as R}from"./api-client-w1GRwBWy.js";import{$ as z,S as B,U as ie,V as ae,X as V,g as oe,h as se,m as ce}from"./index-DthpwdlN.js";import{t as le}from"./input-CG_cIxvO.js";import{t as ue}from"./format-date-Ctrh7my1.js";import{t as de}from"./badge-C1_ZMBRy.js";import{a as fe,n as pe,o as me,r as he,t as H}from"./card-Bsy6azfK.js";import{a as ge,i as _e,n as U,o as ve,r as ye,t as W}from"./data-source-connection-form-BKMHkF5S.js";var be=l(`outline`,`search`,`Search`,[[`path`,{d:`M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`,key:`svg-0`}],[`path`,{d:`M21 21l-6 -6`,key:`svg-1`}]]);function G(e){return e}var K=r(),q=e(t(),1),J=n(),Y=s(`grid gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4 w-full relative group/alert`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`text-destructive bg-card *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function X(e){let t=(0,K.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==i?(a=f(Y({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,J.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}function Z(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:hover:text-foreground [&_a]:underline [&_a]:underline-offset-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,J.jsx)(`div`,{"data-slot":`alert-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Q(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`text-muted-foreground text-sm text-balance md:text-pretty [&_p:not(:last-child)]:mb-4 [&_a]:hover:text-foreground [&_a]:underline [&_a]:underline-offset-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,J.jsx)(`div`,{"data-slot":`alert-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $(e){let t=(0,K.c)(13),[n,r]=(0,q.useState)(!1),i;t[0]===e?i=t[1]:(i=t=>{e.onSuccess?.(t),r(!1)},t[0]=e,t[1]=i);let a=i,o;t[2]===e.children?o=t[3]:(o=(0,J.jsx)(D,{render:e.children}),t[2]=e.children,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,J.jsxs)(A,{children:[(0,J.jsx)(E,{children:`Add Data Source`}),(0,J.jsx)(T,{children:`Connect a data source so OneQuery can query your workspace data.`})]}),t[4]=s):s=t[4];let c;t[5]!==a||t[6]!==e.initialProvider||t[7]!==e.organizationId?(c=(0,J.jsxs)(ee,{className:`sm:max-w-[720px] max-h-[85vh] overflow-y-auto overflow-x-hidden`,children:[s,(0,J.jsx)(W,{organizationId:e.organizationId,onSuccess:a,className:`py-4`,initialProvider:e.initialProvider})]}),t[5]=a,t[6]=e.initialProvider,t[7]=e.organizationId,t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==o||t[11]!==c?(l=(0,J.jsxs)(k,{open:n,onOpenChange:r,children:[o,c]}),t[9]=n,t[10]=o,t[11]=c,t[12]=l):l=t[12],l}var xe=180,Se=/\b(api[-_ ]?key|authorization|bearer|cookie|password|secret|token)\b|-----BEGIN/i;function Ce(e,t){let n=t?.replaceAll(/\s+/g,` `).trim();if(n&&n!==e)return n.length>xe||Se.test(n)?`Review the data source settings and try again.`:n}function we(e){let t=Ce(e.title,e.description);return ae.error(e.title,{action:e.action,className:`max-w-[34rem]`,closeButton:!0,description:t,descriptionClassName:`whitespace-pre-wrap break-words`,duration:t?12e3:8e3,position:`top-center`,richColors:!0})}var Te=R();async function Ee(e,t){let n=await Te.api[`data-sources`][`:id`][`github-repositories`].$get({param:{id:t},query:{organizationId:e}});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(B(e,`Failed to fetch GitHub repositories`))}return n.json()}function De(e,t){return P({queryFn:async()=>Ee(e,t),queryKey:[`github-repositories`,t]})}async function Oe(e,t,n){let r=await Te.api[`data-sources`][`:id`][`github-repositories`].$post({json:{repositories:n},param:{id:t},query:{organizationId:e}});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(B(e,`Failed to update GitHub repositories`))}return r.json()}function ke({queryClient:e,organizationId:t,dataSourceId:n,onSuccess:r,onError:i}){let a=De(t,n);return G({mutationFn:async e=>Oe(t,n,e.repositories),mutationKey:[`github-repositories`,n,`update`],onError:i,onSuccess:(t,n)=>{e.setQueryData(a.queryKey,e=>e&&{...e,selected:t.repositories}),r?.(t,n)}})}var Ae=q.createContext(void 0);function je(){let e=q.useContext(Ae);if(e===void 0)throw Error(d(53));return e}var Me=function(e){return e.scrollAreaCornerHeight=`--scroll-area-corner-height`,e.scrollAreaCornerWidth=`--scroll-area-corner-width`,e}({});function Ne(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=n===`x`?`Inline`:`Block`;return n===`x`&&t===`margin`?parseFloat(r[`${t}InlineStart`])*2:parseFloat(r[`${t}${i}Start`])+parseFloat(r[`${t}${i}End`])}var Pe=function(e){return e.orientation=`data-orientation`,e.hovering=`data-hovering`,e.scrolling=`data-scrolling`,e.hasOverflowX=`data-has-overflow-x`,e.hasOverflowY=`data-has-overflow-y`,e.overflowXStart=`data-overflow-x-start`,e.overflowXEnd=`data-overflow-x-end`,e.overflowYStart=`data-overflow-y-start`,e.overflowYEnd=`data-overflow-y-end`,e}({}),Fe=function(e){return e.hasOverflowX=`data-has-overflow-x`,e.hasOverflowY=`data-has-overflow-y`,e.overflowXStart=`data-overflow-x-start`,e.overflowXEnd=`data-overflow-x-end`,e.overflowYStart=`data-overflow-y-start`,e.overflowYEnd=`data-overflow-y-end`,e}({}),Ie={hasOverflowX:e=>e?{[Fe.hasOverflowX]:``}:null,hasOverflowY:e=>e?{[Fe.hasOverflowY]:``}:null,overflowXStart:e=>e?{[Fe.overflowXStart]:``}:null,overflowXEnd:e=>e?{[Fe.overflowXEnd]:``}:null,overflowYStart:e=>e?{[Fe.overflowYStart]:``}:null,overflowYEnd:e=>e?{[Fe.overflowYEnd]:``}:null,cornerHidden:()=>null},Le={x:0,y:0},Re={width:0,height:0},ze={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Be={x:!1,y:!1,corner:!1},Ve=q.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,...s}=e,c=He(i),l=re(),u=I(),d=I(),{nonce:f,disableStyleElements:p}=v(),[m,h]=q.useState(!1),[g,y]=q.useState(!1),[b,x]=q.useState(!1),[S,C]=q.useState(!1),[w,T]=q.useState(Re),[E,ee]=q.useState(Re),[D,te]=q.useState(ze),[O,k]=q.useState(Be),A=q.useRef(null),j=q.useRef(null),M=q.useRef(null),N=q.useRef(null),P=q.useRef(null),F=q.useRef(null),L=q.useRef(null),R=q.useRef(!1),z=q.useRef(0),B=q.useRef(0),ie=q.useRef(0),ae=q.useRef(0),V=q.useRef(`vertical`),oe=q.useRef(Le),se=a(e=>{let t=e.x-oe.current.x,n=e.y-oe.current.y;oe.current=e,n!==0&&(x(!0),u.start(500,()=>{x(!1)})),t!==0&&(y(!0),d.start(500,()=>{y(!1)}))}),ce=a(e=>{e.button===0&&(R.current=!0,z.current=e.clientY,B.current=e.clientX,V.current=e.currentTarget.getAttribute(Pe.orientation),j.current&&(ie.current=j.current.scrollTop,ae.current=j.current.scrollLeft),P.current&&V.current===`vertical`&&P.current.setPointerCapture(e.pointerId),F.current&&V.current===`horizontal`&&F.current.setPointerCapture(e.pointerId))}),le=a(e=>{if(!R.current)return;let t=e.clientY-z.current,n=e.clientX-B.current;if(j.current){let r=j.current.scrollHeight,i=j.current.clientHeight,a=j.current.scrollWidth,o=j.current.clientWidth;if(P.current&&M.current&&V.current===`vertical`){let n=Ne(M.current,`padding`,`y`),a=Ne(P.current,`margin`,`y`),o=P.current.offsetHeight,s=t/(M.current.offsetHeight-o-n-a);j.current.scrollTop=ie.current+s*(r-i),e.preventDefault(),x(!0),u.start(500,()=>{x(!1)})}if(F.current&&N.current&&V.current===`horizontal`){let t=Ne(N.current,`padding`,`x`),r=Ne(F.current,`margin`,`x`),i=F.current.offsetWidth,s=n/(N.current.offsetWidth-i-t-r);j.current.scrollLeft=ae.current+s*(a-o),e.preventDefault(),y(!0),d.start(500,()=>{y(!1)})}}}),ue=a(e=>{R.current=!1,P.current&&V.current===`vertical`&&P.current.releasePointerCapture(e.pointerId),F.current&&V.current===`horizontal`&&F.current.releasePointerCapture(e.pointerId)});function de(e){C(e.pointerType===`touch`)}function fe(e){de(e),e.pointerType!==`touch`&&h(ne(A.current,e.target))}let pe=q.useMemo(()=>({hasOverflowX:!O.x,hasOverflowY:!O.y,overflowXStart:D.xStart,overflowXEnd:D.xEnd,overflowYStart:D.yStart,overflowYEnd:D.yEnd,cornerHidden:O.corner}),[O.x,O.y,O.corner,D]),me={role:`presentation`,onPointerEnter:fe,onPointerMove:fe,onPointerDown:de,onPointerLeave(){h(!1)},style:{position:`relative`,[Me.scrollAreaCornerHeight]:`${w.height}px`,[Me.scrollAreaCornerWidth]:`${w.width}px`}},he=o(`div`,e,{state:pe,ref:[t,A],props:[me,s],stateAttributesMapping:Ie}),H=q.useMemo(()=>({handlePointerDown:ce,handlePointerMove:le,handlePointerUp:ue,handleScroll:se,cornerSize:w,setCornerSize:T,thumbSize:E,setThumbSize:ee,touchModality:S,cornerRef:L,scrollingX:g,setScrollingX:y,scrollingY:b,setScrollingY:x,hovering:m,setHovering:h,viewportRef:j,rootRef:A,scrollbarYRef:M,scrollbarXRef:N,thumbYRef:P,thumbXRef:F,rootId:l,hiddenState:O,setHiddenState:k,overflowEdges:D,setOverflowEdges:te,viewportState:pe,overflowEdgeThreshold:c}),[ce,le,ue,se,w,E,S,g,y,b,x,m,h,l,O,D,pe,c]);return(0,J.jsxs)(Ae.Provider,{value:H,children:[!p&&_.getElement(f),he]})});function He(e){if(typeof e==`number`){let t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}var Ue=q.createContext(void 0);function We(e,t){if(typeof IntersectionObserver>`u`)return()=>{};let n=new IntersectionObserver(e=>{e.forEach(e=>{e.intersectionRatio>0&&(t(),n.disconnect())})});return n.observe(e),()=>{n.disconnect()}}var Ge=function(e){return e.scrollAreaOverflowXStart=`--scroll-area-overflow-x-start`,e.scrollAreaOverflowXEnd=`--scroll-area-overflow-x-end`,e.scrollAreaOverflowYStart=`--scroll-area-overflow-y-start`,e.scrollAreaOverflowYEnd=`--scroll-area-overflow-y-end`,e}({}),Ke=!1;function qe(){Ke||F||(typeof CSS<`u`&&`registerProperty`in CSS&&[Ge.scrollAreaOverflowXStart,Ge.scrollAreaOverflowXEnd,Ge.scrollAreaOverflowYStart,Ge.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),Ke=!0)}var Je=q.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{viewportRef:s,scrollbarYRef:c,scrollbarXRef:l,thumbYRef:d,thumbXRef:f,cornerRef:p,cornerSize:m,setCornerSize:h,setThumbSize:g,rootId:v,setHiddenState:b,hiddenState:x,handleScroll:S,setHovering:C,setOverflowEdges:w,overflowEdges:T,overflowEdgeThreshold:E}=je(),ee=L(),D=q.useRef(!0),te=I(),O=I(),k=a(()=>{let e=s.current,t=c.current,n=l.current,r=d.current,i=f.current,a=p.current;if(!e)return;let o=e.scrollHeight,u=e.scrollWidth,_=e.clientHeight,v=e.clientWidth,x=e.scrollTop,S=e.scrollLeft;if(o===0||u===0)return;let C=_>=o,T=v>=u,D=v/u,te=_/o,O=Math.max(0,u-v),k=Math.max(0,o-_),A=0,j=0;T||(A=y(ee===`rtl`?-S:S,0,O),j=O-A);let M=C?0:y(x,0,k),N=C?0:k-M,P=T?0:v,F=C?0:_,I=0,L=0;!T&&!C&&(I=t?.offsetWidth||0,L=n?.offsetHeight||0);let ne=m.width===0&&m.height===0,re=ne?I:0,R=ne?L:0,z=Ne(n,`padding`,`x`),B=Ne(t,`padding`,`y`),ie=Ne(i,`margin`,`x`),ae=Ne(r,`margin`,`y`),V=P-z-ie,oe=F-B-ae,se=n?Math.min(n.offsetWidth-re,V):V,ce=t?Math.min(t.offsetHeight-R,oe):oe,le=Math.max(16,se*D),ue=Math.max(16,ce*te);if(g(e=>e.height===ue&&e.width===le?e:{width:le,height:ue}),t&&r){let e=t.offsetHeight-ue-B-ae,n=o-_,i=n===0?0:x/n,a=Math.min(e,Math.max(0,i*e));r.style.transform=`translate3d(0,${a}px,0)`}if(n&&i){let e=n.offsetWidth-le-z-ie,t=u-v,r=t===0?0:S/t,a=ee===`rtl`?y(r*e,-e,0):y(r*e,0,e);i.style.transform=`translate3d(${a}px,0,0)`}let de=y(A,0,O),fe=y(j,0,O),pe=y(M,0,k),me=y(N,0,k),he=[[Ge.scrollAreaOverflowXStart,de],[Ge.scrollAreaOverflowXEnd,fe],[Ge.scrollAreaOverflowYStart,pe],[Ge.scrollAreaOverflowYEnd,me]];for(let[t,n]of he)e.style.setProperty(t,`${n}px`);a&&(T||C?h({width:0,height:0}):!T&&!C&&h({width:I,height:L})),b(e=>{let t=C||T;return e.y===C&&e.x===T&&e.corner===t?e:{y:C,x:T,corner:t}});let H={xStart:!T&&de>E.xStart,xEnd:!T&&fe>E.xEnd,yStart:!C&&pe>E.yStart,yEnd:!C&&me>E.yEnd};w(e=>e.xStart===H.xStart&&e.xEnd===H.xEnd&&e.yStart===H.yStart&&e.yEnd===H.yEnd?e:H)});u(()=>{if(!s.current)return;qe();let e=!1;return We(s.current,()=>{if(!e){e=!0;return}k()})},[k,s]),u(()=>{queueMicrotask(k)},[k,x,ee]),u(()=>{s.current?.matches(`:hover`)&&C(!0)},[s,C]),q.useEffect(()=>{let e=s.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;return}k()});return n.observe(e),O.start(0,()=>{let t=e.getAnimations({subtree:!0});t.length!==0&&Promise.all(t.map(e=>e.finished)).then(k).catch(()=>{})}),()=>{n.disconnect(),O.clear()}},[k,s,O]);function A(){D.current=!1}let j={role:`presentation`,...v&&{"data-id":`${v}-viewport`},...(!x.x||!x.y)&&{tabIndex:0},className:_.className,style:{overflow:`scroll`},onScroll(){s.current&&(k(),D.current||S({x:s.current.scrollLeft,y:s.current.scrollTop}),te.start(100,()=>{D.current=!0}))},onWheel:A,onTouchMove:A,onPointerMove:A,onPointerEnter:A,onKeyDown:A},M=q.useMemo(()=>({hasOverflowX:!x.x,hasOverflowY:!x.y,overflowXStart:T.xStart,overflowXEnd:T.xEnd,overflowYStart:T.yStart,overflowYEnd:T.yEnd,cornerHidden:x.corner}),[x.x,x.y,x.corner,T]),N=o(`div`,e,{ref:[t,s],state:M,props:[j,i],stateAttributesMapping:Ie}),P=q.useMemo(()=>({computeThumbPosition:k}),[k]);return(0,J.jsx)(Ue.Provider,{value:P,children:N})}),Ye=q.createContext(void 0);function Xe(){let e=q.useContext(Ye);if(e===void 0)throw Error(d(54));return e}var Ze=function(e){return e.scrollAreaThumbHeight=`--scroll-area-thumb-height`,e.scrollAreaThumbWidth=`--scroll-area-thumb-width`,e}({}),Qe=q.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,overflowEdges:f,scrollbarYRef:p,scrollbarXRef:m,viewportRef:h,thumbYRef:g,thumbXRef:_,handlePointerDown:v,handlePointerUp:y,rootId:b,thumbSize:x}=je(),S=q.useMemo(()=>({hovering:c,scrolling:{horizontal:l,vertical:u}[i],orientation:i,hasOverflowX:!d.x,hasOverflowY:!d.y,overflowXStart:f.xStart,overflowXEnd:f.xEnd,overflowYStart:f.yStart,overflowYEnd:f.yEnd,cornerHidden:d.corner}),[c,l,u,i,d,f]),C=L();q.useEffect(()=>{let e=h.current,t=i===`vertical`?p.current:m.current;if(!t)return;function n(n){if(!(!e||!t||n.ctrlKey)){if(n.preventDefault(),i===`vertical`){if(e.scrollTop===0&&n.deltaY<0)return}else if(e.scrollLeft===0&&n.deltaX<0)return;if(i===`vertical`){if(e.scrollTop===e.scrollHeight-e.clientHeight&&n.deltaY>0)return}else if(e.scrollLeft===e.scrollWidth-e.clientWidth&&n.deltaX>0)return;i===`vertical`?e.scrollTop+=n.deltaY:e.scrollLeft+=n.deltaX}}return t.addEventListener(`wheel`,n,{passive:!1}),()=>{t.removeEventListener(`wheel`,n)}},[i,m,p,h]);let w={...b&&{"data-id":`${b}-scrollbar`},onPointerDown(e){if(e.button===0&&e.currentTarget===e.target&&h.current){if(g.current&&p.current&&i===`vertical`){let t=Ne(g.current,`margin`,`y`),n=Ne(p.current,`padding`,`y`),r=g.current.offsetHeight,i=p.current.getBoundingClientRect(),a=e.clientY-i.top-r/2-n+t/2,o=h.current.scrollHeight,s=h.current.clientHeight,c=a/(p.current.offsetHeight-r-n-t)*(o-s);h.current.scrollTop=c}if(_.current&&m.current&&i===`horizontal`){let t=Ne(_.current,`margin`,`x`),n=Ne(m.current,`padding`,`x`),r=_.current.offsetWidth,i=m.current.getBoundingClientRect(),a=e.clientX-i.left-r/2-n+t/2,o=h.current.scrollWidth,s=h.current.clientWidth,c=a/(m.current.offsetWidth-r-n-t),l;C===`rtl`?(l=(1-c)*(o-s),h.current.scrollLeft<=0&&(l=-l)):l=c*(o-s),h.current.scrollLeft=l}v(e)}},onPointerUp:y,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,...i===`vertical`&&{top:0,bottom:`var(${Me.scrollAreaCornerHeight})`,insetInlineEnd:0,[Ze.scrollAreaThumbHeight]:`${x.height}px`},...i===`horizontal`&&{insetInlineStart:0,insetInlineEnd:`var(${Me.scrollAreaCornerWidth})`,bottom:0,[Ze.scrollAreaThumbWidth]:`${x.width}px`}}},T=o(`div`,e,{ref:[t,i===`vertical`?p:m],state:S,props:[w,s],stateAttributesMapping:Ie}),E=q.useMemo(()=>({orientation:i}),[i]),ee=i===`vertical`?d.y:d.x;return a||!ee?(0,J.jsx)(Ye.Provider,{value:E,children:T}):null}),$e=q.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{thumbYRef:a,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,setScrollingX:d,setScrollingY:f}=je(),{orientation:p}=Xe(),m=q.useMemo(()=>({orientation:p}),[p]);return o(`div`,e,{ref:[t,p===`vertical`?a:s],state:m,props:[{onPointerDown:c,onPointerMove:l,onPointerUp(e){p===`vertical`&&f(!1),p===`horizontal`&&d(!1),u(e)},style:{...p===`vertical`&&{height:`var(${Ze.scrollAreaThumbHeight})`},...p===`horizontal`&&{width:`var(${Ze.scrollAreaThumbWidth})`}}},i]})}),et=q.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{cornerRef:a,cornerSize:s,hiddenState:c}=je(),l=o(`div`,e,{ref:[t,a],props:[{style:{position:`absolute`,bottom:0,insetInlineEnd:0,width:s.width,height:s.height}},i]});return c.corner?null:l});function tt(e){let t=(0,K.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=f(`relative`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=(0,J.jsx)(Je,{"data-slot":`scroll-area-viewport`,className:`focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1`,children:n}),t[6]=n,t[7]=o);let s,c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,J.jsx)(nt,{}),c=(0,J.jsx)(et,{}),t[8]=s,t[9]=c):(s=t[8],c=t[9]);let l;return t[10]!==i||t[11]!==a||t[12]!==o?(l=(0,J.jsxs)(Ve,{"data-slot":`scroll-area`,className:a,...i,children:[o,s,c]}),t[10]=i,t[11]=a,t[12]=o,t[13]=l):l=t[13],l}function nt(e){let t=(0,K.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]===n?o=t[5]:(o=f(`data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent flex touch-none p-px transition-colors select-none`,n),t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,J.jsx)($e,{"data-slot":`scroll-area-thumb`,className:`rounded-full bg-border relative flex-1`}),t[6]=s):s=t[6];let c;return t[7]!==a||t[8]!==r||t[9]!==o?(c=(0,J.jsx)(Qe,{"data-slot":`scroll-area-scrollbar`,"data-orientation":a,orientation:a,className:o,...r,children:s}),t[7]=a,t[8]=r,t[9]=o,t[10]=c):c=t[10],c}function rt(e,t){if(e.length!==t.length)return!0;let n=new Set(e);return t.some(e=>!n.has(e))}function it(e){let t=(0,K.c)(94),[n,r]=(0,q.useState)(``),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,q.useState)(i),s=(0,q.useRef)(!1),l=ie(),u;t[1]!==e.dataSourceId||t[2]!==e.organizationId?(u=De(e.organizationId,e.dataSourceId),t[1]=e.dataSourceId,t[2]=e.organizationId,t[3]=u):u=t[3];let d;t[4]!==e.open||t[5]!==u?(d={...u,enabled:e.open},t[4]=e.open,t[5]=u,t[6]=d):d=t[6];let f=M(d),p;t[7]===f.data?.repositories?p=t[8]:(p=f.data?.repositories??[],t[7]=f.data?.repositories,t[8]=p);let m=p,h;t[9]===f.data?.selected?h=t[10]:(h=f.data?.selected??[],t[9]=f.data?.selected,t[10]=h);let g=h,_,v;t[11]!==g||t[12]!==e.open||t[13]!==f.data?(_=()=>{if(!e.open){s.current=!1,r(``);return}f.data&&(s.current||=(o(g),!0))},v=[g,e.open,f.data],t[11]=g,t[12]=e.open,t[13]=f.data,t[14]=_,t[15]=v):(_=t[14],v=t[15]),(0,q.useEffect)(_,v);let y;if(t[16]!==m||t[17]!==n){bb0:{let e=n.trim().toLowerCase();if(!e){y=m;break bb0}y=m.filter(t=>{let n=t.owner.toLowerCase(),r=t.name.toLowerCase(),i=t.fullName.toLowerCase();return n.includes(e)||r.includes(e)||i.includes(e)})}t[16]=m,t[17]=n,t[18]=y}else y=t[18];let b=y,x;t[19]!==g||t[20]!==a?(x=rt(a,g),t[19]=g,t[20]=a,t[21]=x):x=t[21];let w=x,D;t[22]===e?D=t[23]:(D=()=>{ae.success(`GitHub repositories updated`),e.onOpenChange(!1)},t[22]=e,t[23]=D);let te;t[24]!==e.dataSourceId||t[25]!==e.organizationId||t[26]!==l||t[27]!==D?(te=ke({dataSourceId:e.dataSourceId,onError:ot,onSuccess:D,organizationId:e.organizationId,queryClient:l}),t[24]=e.dataSourceId,t[25]=e.organizationId,t[26]=l,t[27]=D,t[28]=te):te=t[28];let N=j(te),P;t[29]===a?P=t[30]:(P=new Set(a),t[29]=a,t[30]=P);let F=P,I;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){o(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},t[31]=I):I=t[31];let L=I,ne;t[32]===b?ne=t[33]:(ne=function(){let e=b.map(at);o(t=>[...new Set([...t,...e])])},t[32]=b,t[33]=ne);let re=ne,R;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(){o([])},t[34]=R):R=t[34];let z=R,B=f.isLoading,V=f.isError,oe=w&&!N.isPending,se;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,J.jsxs)(A,{children:[(0,J.jsx)(E,{children:`Select GitHub Repositories`}),(0,J.jsx)(T,{children:`Choose repositories to use for this data source. We only read from the repositories your saved token can access and that you select here.`})]}),t[35]=se):se=t[35];let ce;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,J.jsx)(be,{size:16,className:`absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`}),t[36]=ce):ce=t[36];let ue;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ue=e=>r(e.target.value),t[37]=ue):ue=t[37];let fe;t[38]===n?fe=t[39]:(fe=(0,J.jsxs)(`div`,{className:`relative flex-1`,children:[ce,(0,J.jsx)(le,{value:n,onChange:ue,placeholder:`Search repositories...`,className:`pl-9`})]}),t[38]=n,t[39]=fe);let pe=b.length===0,me;t[40]!==re||t[41]!==pe?(me=(0,J.jsx)(c,{variant:`outline`,size:`sm`,onClick:re,disabled:pe,children:`Select visible`}),t[40]=re,t[41]=pe,t[42]=me):me=t[42];let he=a.length===0,H;t[43]===he?H=t[44]:(H=(0,J.jsx)(c,{variant:`ghost`,size:`sm`,onClick:z,disabled:he,children:`Clear`}),t[43]=he,t[44]=H);let ge;t[45]!==fe||t[46]!==me||t[47]!==H?(ge=(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[fe,me,H]}),t[45]=fe,t[46]=me,t[47]=H,t[48]=ge):ge=t[48];let _e=m.length>0?` • ${m.length} available`:``,U;t[49]!==a.length||t[50]!==_e?(U=(0,J.jsxs)(`span`,{children:[a.length,` selected`,_e]}),t[49]=a.length,t[50]=_e,t[51]=U):U=t[51];let ve;t[52]===w?ve=t[53]:(ve=w?(0,J.jsx)(de,{variant:`outline`,children:`Unsaved`}):null,t[52]=w,t[53]=ve);let ye;t[54]!==U||t[55]!==ve?(ye=(0,J.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[U,ve]}),t[54]=U,t[55]=ve,t[56]=ye):ye=t[56];let W;t[57]===B?W=t[58]:(W=B?(0,J.jsx)(`div`,{className:`flex items-center justify-center py-12 text-muted-foreground`,children:(0,J.jsx)(C,{size:24,className:`animate-spin`})}):null,t[57]=B,t[58]=W);let G;t[59]===V?G=t[60]:(G=V?(0,J.jsx)(`p`,{className:`text-sm text-destructive`,children:`Unable to load repositories. Please try again.`}):null,t[59]=V,t[60]=G);let Y;t[61]!==b||t[62]!==V||t[63]!==B||t[64]!==F?(Y=!B&&!V?(0,J.jsx)(tt,{className:`h-[320px] rounded-md border`,children:(0,J.jsxs)(`div`,{className:`p-2 space-y-1`,children:[b.length===0?(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground px-3 py-6 text-center`,children:`No repositories found.`}):null,b.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:`w-full flex items-center gap-3 rounded-md px-3 py-2 hover:bg-accent transition-colors text-left`,onClick:t=>{let n=t.target;n instanceof HTMLElement&&(n.closest(`[data-slot="checkbox"]`)||L(e.fullName))},children:[(0,J.jsx)(S,{checked:F.has(e.fullName),onCheckedChange:()=>L(e.fullName)}),(0,J.jsxs)(`div`,{className:`flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:e.fullName}),e.private?(0,J.jsx)(de,{variant:`secondary`,children:`Private`}):null]}),(0,J.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Owner: `,e.owner]})]})]},e.id))]})}):null,t[61]=b,t[62]=V,t[63]=B,t[64]=F,t[65]=Y):Y=t[65];let X;t[66]!==ge||t[67]!==ye||t[68]!==W||t[69]!==G||t[70]!==Y?(X=(0,J.jsxs)(`div`,{className:`space-y-3`,children:[ge,ye,W,G,Y]}),t[66]=ge,t[67]=ye,t[68]=W,t[69]=G,t[70]=Y,t[71]=X):X=t[71];let Z;t[72]===e?Z=t[73]:(Z=()=>e.onOpenChange(!1),t[72]=e,t[73]=Z);let Q;t[74]!==Z||t[75]!==N.isPending?(Q=(0,J.jsx)(c,{variant:`outline`,onClick:Z,disabled:N.isPending,children:`Cancel`}),t[74]=Z,t[75]=N.isPending,t[76]=Q):Q=t[76];let $;t[77]!==a||t[78]!==N?($=()=>N.mutate({repositories:a}),t[77]=a,t[78]=N,t[79]=$):$=t[79];let xe=!oe,Se=N.isPending?`Saving...`:`Save`,Ce;t[80]!==$||t[81]!==xe||t[82]!==Se?(Ce=(0,J.jsx)(c,{onClick:$,disabled:xe,children:Se}),t[80]=$,t[81]=xe,t[82]=Se,t[83]=Ce):Ce=t[83];let we;t[84]!==Q||t[85]!==Ce?(we=(0,J.jsxs)(O,{children:[Q,Ce]}),t[84]=Q,t[85]=Ce,t[86]=we):we=t[86];let Te;t[87]!==X||t[88]!==we?(Te=(0,J.jsxs)(ee,{className:`sm:max-w-[680px]`,children:[se,X,we]}),t[87]=X,t[88]=we,t[89]=Te):Te=t[89];let Ee;return t[90]!==e.onOpenChange||t[91]!==e.open||t[92]!==Te?(Ee=(0,J.jsx)(k,{open:e.open,onOpenChange:e.onOpenChange,children:Te}),t[90]=e.onOpenChange,t[91]=e.open,t[92]=Te,t[93]=Ee):Ee=t[93],Ee}function at(e){return e.fullName}function ot(e){we({title:`Failed to update GitHub repositories`,description:e.message})}function st(e){switch(e){case`active`:return`default`;case`error`:return`destructive`;case`disconnected`:return`secondary`;default:return`outline`}}function ct(e){let t=(0,K.c)(4);if(!e.errorMessage)return null;let n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,J.jsx)(z,{className:`size-4`}),r=(0,J.jsx)(Z,{children:`Connection needs attention`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e.errorMessage?i=t[3]:(i=(0,J.jsxs)(X,{variant:`destructive`,className:`mt-3 border-destructive/30 bg-destructive/5`,children:[n,r,(0,J.jsx)(Q,{className:`max-h-32 overflow-y-auto whitespace-pre-wrap break-words pr-1`,children:e.errorMessage})]}),t[2]=e.errorMessage,t[3]=i),i}function lt(e){let t=(0,K.c)(81),{dataSource:n,organizationId:r,openGitHubRepositories:i}=e,a;t[0]===r?a=t[1]:(a=ce(r),t[0]=r,t[1]=a);let o=a.queryKey,[s,l]=(0,q.useState)(!1),u=(0,q.useRef)(!1),d,f;t[2]!==n.provider||t[3]!==i?(d=()=>{u.current||i&&n.provider===`github`&&(l(!0),u.current=!0)},f=[n.provider,i],t[2]=n.provider,t[3]=i,t[4]=d,t[5]=f):(d=t[4],f=t[5]),(0,q.useEffect)(d,f);let _;t[6]!==n.id||t[7]!==r?(_=async()=>oe(n.id,r),t[6]=n.id,t[7]=r,t[8]=_):_=t[8];let v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=[`data-sources`],t[9]=v):v=t[9];let y;t[10]===_?y=t[11]:(y={mutationFn:_,mutationKey:v,onError:dt,onSuccess:ut},t[10]=_,t[11]=y);let S=j(y),C;t[12]!==n.id||t[13]!==r?(C=async()=>se(n.id,r),t[12]=n.id,t[13]=r,t[14]=C):C=t[14];let w;t[15]!==n.id||t[16]!==o||t[17]!==C?(w={errorMessage:`Failed to delete data source`,itemId:n.id,mutationFn:C,queryKey:o,successMessage:`Data source deleted`},t[15]=n.id,t[16]=o,t[17]=C,t[18]=w):w=t[18];let T=te(w),E;t[19]===n.provider?E=t[20]:(E=ve(n.provider),t[19]=n.provider,t[20]=E);let ee=E,D;t[21]===n.provider?D=t[22]:(D=_e(n.provider),t[21]=n.provider,t[22]=D);let O=D,k=O?`Test Connection`:`Test Connection (Unsupported)`,A;t[23]===n.name?A=t[24]:(A=(0,J.jsx)(me,{className:`text-lg`,children:n.name}),t[23]=n.name,t[24]=A);let M;t[25]===ee?M=t[26]:(M=(0,J.jsx)(ee,{className:`h-4.5 w-4.5`}),t[25]=ee,t[26]=M);let N;t[27]===n.provider?N=t[28]:(N=ye(n.provider),t[27]=n.provider,t[28]=N);let P;t[29]!==M||t[30]!==N?(P=(0,J.jsxs)(he,{className:`flex items-center gap-1.5 mt-0.5`,children:[M,N]}),t[29]=M,t[30]=N,t[31]=P):P=t[31];let F;t[32]!==A||t[33]!==P?(F=(0,J.jsxs)(`div`,{children:[A,P]}),t[32]=A,t[33]=P,t[34]=F):F=t[34];let I;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,J.jsx)(p,{children:(0,J.jsx)(c,{variant:`ghost`,size:`icon-sm`,children:(0,J.jsx)(x,{size:16,stroke:2})})}),t[35]=I):I=t[35];let L;t[36]===S?L=t[37]:(L=()=>S.mutate(),t[36]=S,t[37]=L);let ne=S.isPending||!O,re;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,J.jsx)(V,{size:16,stroke:2}),t[38]=re):re=t[38];let R=S.isPending?`Testing...`:k,z;t[39]!==L||t[40]!==ne||t[41]!==R?(z=(0,J.jsxs)(h,{onClick:L,disabled:ne,children:[re,R]}),t[39]=L,t[40]=ne,t[41]=R,t[42]=z):z=t[42];let B;t[43]===n.provider?B=t[44]:(B=n.provider===`github`?(0,J.jsxs)(h,{onClick:()=>l(!0),children:[(0,J.jsx)(ge,{size:16,stroke:`2`}),`Select Repositories`]}):null,t[43]=n.provider,t[44]=B);let ie;t[45]===T?ie=t[46]:(ie=()=>T.mutate(),t[45]=T,t[46]=ie);let ae;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,J.jsx)(b,{size:16,stroke:2}),t[47]=ae):ae=t[47];let le=T.isPending?`Deleting...`:`Delete`,U;t[48]!==T.isPending||t[49]!==ie||t[50]!==le?(U=(0,J.jsxs)(h,{onClick:ie,disabled:T.isPending,className:`text-destructive focus:text-destructive`,children:[ae,le]}),t[48]=T.isPending,t[49]=ie,t[50]=le,t[51]=U):U=t[51];let W;t[52]!==z||t[53]!==B||t[54]!==U?(W=(0,J.jsxs)(g,{children:[I,(0,J.jsxs)(m,{align:`end`,className:`min-w-40`,children:[z,B,U]})]}),t[52]=z,t[53]=B,t[54]=U,t[55]=W):W=t[55];let be;t[56]!==F||t[57]!==W?(be=(0,J.jsxs)(fe,{className:`flex flex-row items-start justify-between space-y-0 pb-2`,children:[F,W]}),t[56]=F,t[57]=W,t[58]=be):be=t[58];let G;t[59]===n.status?G=t[60]:(G=st(n.status),t[59]=n.status,t[60]=G);let Y;t[61]!==n.status||t[62]!==G?(Y=(0,J.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,J.jsx)(de,{variant:G,children:n.status})}),t[61]=n.status,t[62]=G,t[63]=Y):Y=t[63];let X;t[64]===n.lastUsedAt?X=t[65]:(X=n.lastUsedAt&&(0,J.jsxs)(`p`,{className:`text-sm text-muted-foreground mt-2`,children:[`Last used: `,ue(n.lastUsedAt)]}),t[64]=n.lastUsedAt,t[65]=X);let Z;t[66]===n.errorMessage?Z=t[67]:(Z=(0,J.jsx)(ct,{errorMessage:n.errorMessage}),t[66]=n.errorMessage,t[67]=Z);let Q;t[68]!==Y||t[69]!==X||t[70]!==Z?(Q=(0,J.jsxs)(pe,{children:[Y,X,Z]}),t[68]=Y,t[69]=X,t[70]=Z,t[71]=Q):Q=t[71];let $;t[72]!==n.id||t[73]!==n.provider||t[74]!==r||t[75]!==s?($=n.provider===`github`?(0,J.jsx)(it,{organizationId:r,dataSourceId:n.id,open:s,onOpenChange:l}):null,t[72]=n.id,t[73]=n.provider,t[74]=r,t[75]=s,t[76]=$):$=t[76];let xe;return t[77]!==be||t[78]!==Q||t[79]!==$?(xe=(0,J.jsxs)(H,{children:[be,Q,$]}),t[77]=be,t[78]=Q,t[79]=$,t[80]=xe):xe=t[80],xe}function ut(e){if(e.kind===`unsupported`){ae.info(e.message);return}if(e.result.success){ae.success(`Data source test successful`);return}we({title:`Data source test failed`,description:e.result.error??e.result.message??`Unknown error`})}function dt(e){return we({title:`Failed to test data source`,description:e.message})}function ft(e){return e}function pt(e){let t=(0,K.c)(18),n;t[0]===e.provider?n=t[1]:(n=ve(e.provider),t[0]=e.provider,t[1]=n);let r=n,i;t[2]===r?i=t[3]:(i=(0,J.jsx)(r,{className:`h-5 w-5 text-muted-foreground shrink-0`}),t[2]=r,t[3]=i);let a;t[4]===e.provider?a=t[5]:(a=ye(e.provider),t[4]=e.provider,t[5]=a);let o;t[6]===a?o=t[7]:(o=(0,J.jsx)(`p`,{className:`font-medium truncate`,children:a}),t[6]=a,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,J.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[i,o]}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let l;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,J.jsx)(c,{variant:`secondary`,size:`sm`,children:`Connect`}),t[11]=l):l=t[11];let u;t[12]!==e.organizationId||t[13]!==e.provider?(u=(0,J.jsx)($,{organizationId:e.organizationId,initialProvider:e.provider,children:l}),t[12]=e.organizationId,t[13]=e.provider,t[14]=u):u=t[14];let d;return t[15]!==s||t[16]!==u?(d=(0,J.jsx)(H,{className:`border-dashed`,children:(0,J.jsx)(pe,{className:`p-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[s,u]})})}),t[15]=s,t[16]=u,t[17]=d):d=t[17],d}function mt(e){let t=(0,K.c)(35),{organizationId:n,openGitHubDataSourceId:r}=e,i;t[0]===n?i=t[1]:(i=ce(n),t[0]=n,t[1]=i);let{data:a}=N(i),o,s,l,u,d,f,p,m;if(t[2]!==a||t[3]!==r||t[4]!==n){let e=ft(a),i=new Set(e.map(ht)),h=U.filter(e=>!i.has(e)),g=e.length>0;d=`space-y-8`;let _;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Connected`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Data sources already connected to your workspace.`})]}),t[13]=_):_=t[13];let v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,J.jsxs)(c,{children:[(0,J.jsx)(w,{size:16,stroke:2}),`Add Data Source`]}),t[14]=v):v=t[14],t[15]===n?f=t[16]:(f=(0,J.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[_,(0,J.jsx)($,{organizationId:n,children:v})]}),t[15]=n,t[16]=f),t[17]===g?p=t[18]:(p=g?null:(0,J.jsxs)(`div`,{className:`text-center py-12`,children:[(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`No connected data sources yet.`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Connect one below or add a new data source to get started.`})]}),t[17]=g,t[18]=p),m=g?(0,J.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>(0,J.jsx)(lt,{dataSource:e,organizationId:n,openGitHubRepositories:r===e.id},e.id))}):null,l=`space-y-4`,t[19]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Not connected`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Available data sources you can connect next.`})]}),t[19]=u):u=t[19],o=`grid gap-4 md:grid-cols-2 lg:grid-cols-3`;let y;t[20]===n?y=t[21]:(y=e=>(0,J.jsx)(pt,{provider:e,organizationId:n},e),t[20]=n,t[21]=y),s=h.map(y),t[2]=a,t[3]=r,t[4]=n,t[5]=o,t[6]=s,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m}else o=t[5],s=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12];let h;t[22]!==o||t[23]!==s?(h=(0,J.jsx)(`div`,{className:o,children:s}),t[22]=o,t[23]=s,t[24]=h):h=t[24];let g;t[25]!==h||t[26]!==l||t[27]!==u?(g=(0,J.jsxs)(`div`,{className:l,children:[u,h]}),t[25]=h,t[26]=l,t[27]=u,t[28]=g):g=t[28];let _;return t[29]!==g||t[30]!==d||t[31]!==f||t[32]!==p||t[33]!==m?(_=(0,J.jsxs)(`div`,{className:d,children:[f,p,m,g]}),t[29]=g,t[30]=d,t[31]=f,t[32]=p,t[33]=m,t[34]=_):_=t[34],_}function ht(e){return e.provider}var gt=i(`/_authenticated/$org_slug/integrations`);function _t(){let e=(0,K.c)(4),{organizationId:t}=gt.useRouteContext(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,J.jsx)(`section`,{children:(0,J.jsxs)(`div`,{className:`mb-6`,children:[(0,J.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Integrations`}),(0,J.jsx)(`p`,{className:`text-muted-foreground mt-2`,children:`Manage the data sources connected to your workspace.`})]})}),e[0]=n):n=e[0];let r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsxs)(`div`,{className:`mb-4`,children:[(0,J.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Data Sources`}),(0,J.jsx)(`p`,{className:`text-muted-foreground text-sm mt-1`,children:`Connect databases, analytics platforms, and other services to provide data for your agents.`})]}),e[1]=r):r=e[1];let i;return e[2]===t?i=e[3]:(i=(0,J.jsxs)(`div`,{className:`p-8 space-y-12`,children:[n,(0,J.jsxs)(`section`,{children:[r,(0,J.jsx)(mt,{organizationId:t})]})]}),e[2]=t,e[3]=i),i}var vt=_t;export{vt as component};
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,o as a}from"./api-base-url-DIb6qukm.js";import{n as o}from"./createReactComponent-_L2mp4Ui.js";import{t as s}from"./IconCheck-Gc24xPT2.js";import{t as c}from"./IconLoader2-B3B6M8nQ.js";import{t as l}from"./IconX-BQkA009b.js";import{t as u}from"./auth-client-BlMeXgb4.js";import{a as d,i as f}from"./app-routes-CnJncMlZ.js";import{E as p,T as m,U as h}from"./index-CbFJKkNs.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./card-Bsy6azfK.js";import{a as S,i as C,n as w,o as T,s as E}from"./xstate-react.esm-BlF76DuP.js";var D=r(),O=e(t(),1),k=i(f),A=`Failed to accept invitation`,j=`Failed to navigate. Try again from home.`,M=1500,N=`Invite accept actor is not configured`,P={kind:`home`},F={ACCEPT:`inviteAccept/accept`,DECLINE:`inviteAccept/decline`,GO_HOME:`inviteAccept/goHome`,NAVIGATION_COMPLETED:`inviteAccept/navigationCompleted`,NAVIGATION_FAILED:`inviteAccept/navigationFailed`,NAVIGATION_STARTED:`inviteAccept/navigationStarted`},I={ACCEPTING:`accepting`,ERROR:`error`,NAVIGATING:`navigating`,READY:`ready`,REFRESHING_ORGANIZATIONS:`refreshingOrganizations`,SUCCESS_PENDING_REDIRECT:`successPendingRedirect`};function L(){return{acceptedOrganizationId:null,errorMessage:null,navigation:null,nextNavigationId:1,redirectTarget:null}}function R(e){return{...L(),nextNavigationId:e.nextNavigationId}}function z(e,t){return{...R(e),errorMessage:t}}function B(e,t){return{navigation:{id:e.nextNavigationId,phase:`pending`,target:t},nextNavigationId:e.nextNavigationId+1}}function V(e){if(e.acceptedOrganizationId===null)throw Error(`Accepted organization ID is required`);return e.acceptedOrganizationId}function H(e){return e.redirectTarget??P}function U(e,t){if(!(e instanceof Error))return t;let n=e.message.trim();return n.length===0?t:n}function W(e){let t=e.successRedirectDelayMs??M;return S({actions:{markNavigationRunning:T(({context:e,event:t})=>(C(t,F.NAVIGATION_STARTED),e.navigation?.id===t.id?{navigation:{...e.navigation,phase:`running`}}:{})),queueHomeNavigation:T(({context:e})=>B(e,P)),queueResolvedNavigation:T(({context:e})=>B(e,H(e))),resetFlow:T(({context:e,event:t})=>(C(t,F.NAVIGATION_COMPLETED),e.navigation?.id===t.id?R(e):{})),storeAcceptError:T({acceptedOrganizationId:()=>null,errorMessage:(e,t)=>t.message,navigation:()=>null,redirectTarget:()=>null}),storeAcceptedOrganizationId:T({acceptedOrganizationId:(e,t)=>t.acceptedOrganizationId,errorMessage:()=>null,redirectTarget:()=>null}),storeHomeRedirectTarget:T({redirectTarget:()=>P}),storeNavigationError:T(({context:e,event:t})=>(C(t,F.NAVIGATION_FAILED),e.navigation?.id===t.id?z(e,t.message):{})),storeResolvedRedirectTarget:T({redirectTarget:(e,t)=>t.redirectTarget})},actors:{acceptInvitation:E(async()=>{throw Error(N)}),resolveRedirect:E(async()=>{throw Error(N)})},types:{}}).createMachine({context:L(),id:`inviteAccept`,initial:I.READY,states:{[I.READY]:{on:{[F.ACCEPT]:I.ACCEPTING,[F.DECLINE]:{actions:`queueHomeNavigation`,target:I.NAVIGATING}}},[I.ACCEPTING]:{invoke:{src:`acceptInvitation`,onDone:{actions:{type:`storeAcceptedOrganizationId`,params:({event:e})=>({acceptedOrganizationId:e.output.acceptedOrganizationId})},target:I.REFRESHING_ORGANIZATIONS},onError:{actions:{type:`storeAcceptError`,params:({event:e})=>({message:U(e.error,A)})},target:I.ERROR}}},[I.REFRESHING_ORGANIZATIONS]:{invoke:{src:`resolveRedirect`,input:({context:e})=>({acceptedOrganizationId:V(e)}),onDone:{actions:{type:`storeResolvedRedirectTarget`,params:({event:e})=>({redirectTarget:e.output})},target:I.SUCCESS_PENDING_REDIRECT},onError:{actions:`storeHomeRedirectTarget`,target:I.SUCCESS_PENDING_REDIRECT}}},[I.SUCCESS_PENDING_REDIRECT]:{after:{[t]:{actions:`queueResolvedNavigation`,target:I.NAVIGATING}}},[I.NAVIGATING]:{on:{[F.NAVIGATION_COMPLETED]:{actions:`resetFlow`,target:I.READY},[F.NAVIGATION_FAILED]:{actions:`storeNavigationError`,target:I.ERROR},[F.NAVIGATION_STARTED]:{actions:`markNavigationRunning`}}},[I.ERROR]:{on:{[F.GO_HOME]:{actions:`queueHomeNavigation`,target:I.NAVIGATING}}}}}).provide({actors:{acceptInvitation:E(async()=>e.acceptInvitation()),resolveRedirect:E(async({input:t})=>e.resolveRedirect(t.acceptedOrganizationId))}})}function G(e){return e.matches(I.ACCEPTING)?`accepting`:e.matches(I.ERROR)||e.matches(I.NAVIGATING)&&e.context.acceptedOrganizationId===null&&e.context.errorMessage!==null?`error`:e.matches(I.REFRESHING_ORGANIZATIONS)||e.matches(I.SUCCESS_PENDING_REDIRECT)||e.matches(I.NAVIGATING)&&e.context.acceptedOrganizationId!==null?`success`:`ready`}function K(e){return U(e,j)}function q(){let e=a(),t=h(),{invitationId:n}=k.useParams(),{auth:r,refetchSession:i}=k.useRouteContext(),o=r.session?.user.id,s=(0,O.useCallback)(async()=>{let e=await u.acceptInvitation({invitationId:n});if(e.error)throw Error(e.error.message);return{acceptedOrganizationId:e.data.member.organizationId}},[n]),c=(0,O.useCallback)(async e=>{try{await i();let n=(await t.fetchQuery({...m(o),staleTime:0})).find(t=>t.id===e);if(n)return{kind:`organization`,organizationSlug:p(n)};let r=await u.getFullOrganization({query:{organizationId:e}});if(r.data?.slug)return{kind:`organization`,organizationSlug:r.data.slug};console.error(`[invite] accepted invitation but organization was not found`,{acceptedOrganizationId:e,userId:o})}catch(t){console.error(`[invite] accepted invitation but failed to refresh orgs`,{acceptedOrganizationId:e,error:t,userId:o})}return P},[t,i,o]),[l,f]=w((0,O.useMemo)(()=>W({acceptInvitation:s,resolveRedirect:c}),[s,c])),g=l.context.navigation;return(0,O.useEffect)(()=>{g===null||g.phase!==`pending`||(f({id:g.id,type:F.NAVIGATION_STARTED}),(g.target.kind===`home`?e({to:`/`}):e({params:{org_slug:g.target.organizationSlug},to:d})).then(()=>{f({id:g.id,type:F.NAVIGATION_COMPLETED})}).catch(e=>{console.error(`[invite] failed to navigate after accepting invitation`,{error:e,navigation:g}),f({id:g.id,message:K(e),type:F.NAVIGATION_FAILED})}))},[e,g,f]),{accept:()=>{f({type:F.ACCEPT})},decline:()=>{f({type:F.DECLINE})},errorMessage:l.context.errorMessage,goHome:()=>{f({type:F.GO_HOME})},status:G(l)}}var J=n();function Y(){let e=(0,D.c)(28),{accept:t,decline:n,errorMessage:r,goHome:i,status:a}=q(),u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,J.jsxs)(g,{className:`text-center`,children:[(0,J.jsx)(y,{className:`text-2xl`,children:`Organization Invitation`}),(0,J.jsx)(b,{children:`You've been invited to join an organization`})]}),e[0]=u):u=e[0];let d;e[1]===a?d=e[2]:(d=a===`ready`&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,J.jsx)(`div`,{className:`rounded-full bg-primary/10 p-4`,children:(0,J.jsx)(s,{size:48,className:`text-primary`})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`font-medium`,children:`Ready to join`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Click the button below to accept the invitation and join the organization.`})]})]}),e[1]=a,e[2]=d);let f;e[3]===a?f=e[4]:(f=a===`accepting`&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,J.jsx)(c,{size:48,className:`animate-spin text-primary`}),(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`Accepting invitation...`})]}),e[3]=a,e[4]=f);let p;e[5]===a?p=e[6]:(p=a===`success`&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,J.jsx)(`div`,{className:`rounded-full bg-green-500/10 p-4`,children:(0,J.jsx)(s,{size:48,className:`text-green-500`})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`font-medium text-green-600`,children:`Successfully joined!`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Redirecting to your dashboard...`})]})]}),e[5]=a,e[6]=p);let m;e[7]!==r||e[8]!==a?(m=a===`error`&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,J.jsx)(`div`,{className:`rounded-full bg-destructive/10 p-4`,children:(0,J.jsx)(l,{size:48,className:`text-destructive`})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`font-medium text-destructive`,children:`Failed to accept invitation`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:r||`The invitation may have expired or already been used.`})]})]}),e[7]=r,e[8]=a,e[9]=m):m=e[9];let h;e[10]!==d||e[11]!==f||e[12]!==p||e[13]!==m?(h=(0,J.jsxs)(v,{className:`flex justify-center py-8`,children:[d,f,p,m]}),e[10]=d,e[11]=f,e[12]=p,e[13]=m,e[14]=h):h=e[14];let S;e[15]!==t||e[16]!==n||e[17]!==a?(S=a===`ready`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(o,{variant:`outline`,onClick:n,children:`Decline`}),(0,J.jsx)(o,{onClick:t,children:`Accept Invitation`})]}),e[15]=t,e[16]=n,e[17]=a,e[18]=S):S=e[18];let C;e[19]!==i||e[20]!==a?(C=a===`error`&&(0,J.jsx)(o,{variant:`outline`,onClick:i,children:`Go to Home`}),e[19]=i,e[20]=a,e[21]=C):C=e[21];let w;e[22]!==S||e[23]!==C?(w=(0,J.jsxs)(_,{className:`flex justify-center gap-4`,children:[S,C]}),e[22]=S,e[23]=C,e[24]=w):w=e[24];let T;return e[25]!==h||e[26]!==w?(T=(0,J.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:(0,J.jsxs)(x,{className:`w-full max-w-md`,children:[u,h,w]})}),e[25]=h,e[26]=w,e[27]=T):T=e[27],T}var X=Y;export{X as component};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,o as a}from"./api-base-url-DIb6qukm.js";import{n as o}from"./createReactComponent-_L2mp4Ui.js";import{t as s}from"./IconCheck-Gc24xPT2.js";import{t as c}from"./IconLoader2-B3B6M8nQ.js";import{t as l}from"./IconX-BQkA009b.js";import{t as u}from"./auth-client-BlMeXgb4.js";import{a as d,i as f}from"./app-routes-CnJncMlZ.js";import{E as p,T as m,U as h}from"./index-DthpwdlN.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./card-Bsy6azfK.js";import{a as S,i as C,n as w,o as T,s as E}from"./xstate-react.esm-BlF76DuP.js";var D=r(),O=e(t(),1),k=i(f),A=`Failed to accept invitation`,j=`Failed to navigate. Try again from home.`,M=1500,N=`Invite accept actor is not configured`,P={kind:`home`},F={ACCEPT:`inviteAccept/accept`,DECLINE:`inviteAccept/decline`,GO_HOME:`inviteAccept/goHome`,NAVIGATION_COMPLETED:`inviteAccept/navigationCompleted`,NAVIGATION_FAILED:`inviteAccept/navigationFailed`,NAVIGATION_STARTED:`inviteAccept/navigationStarted`},I={ACCEPTING:`accepting`,ERROR:`error`,NAVIGATING:`navigating`,READY:`ready`,REFRESHING_ORGANIZATIONS:`refreshingOrganizations`,SUCCESS_PENDING_REDIRECT:`successPendingRedirect`};function L(){return{acceptedOrganizationId:null,errorMessage:null,navigation:null,nextNavigationId:1,redirectTarget:null}}function R(e){return{...L(),nextNavigationId:e.nextNavigationId}}function z(e,t){return{...R(e),errorMessage:t}}function B(e,t){return{navigation:{id:e.nextNavigationId,phase:`pending`,target:t},nextNavigationId:e.nextNavigationId+1}}function V(e){if(e.acceptedOrganizationId===null)throw Error(`Accepted organization ID is required`);return e.acceptedOrganizationId}function H(e){return e.redirectTarget??P}function U(e,t){if(!(e instanceof Error))return t;let n=e.message.trim();return n.length===0?t:n}function W(e){let t=e.successRedirectDelayMs??M;return S({actions:{markNavigationRunning:T(({context:e,event:t})=>(C(t,F.NAVIGATION_STARTED),e.navigation?.id===t.id?{navigation:{...e.navigation,phase:`running`}}:{})),queueHomeNavigation:T(({context:e})=>B(e,P)),queueResolvedNavigation:T(({context:e})=>B(e,H(e))),resetFlow:T(({context:e,event:t})=>(C(t,F.NAVIGATION_COMPLETED),e.navigation?.id===t.id?R(e):{})),storeAcceptError:T({acceptedOrganizationId:()=>null,errorMessage:(e,t)=>t.message,navigation:()=>null,redirectTarget:()=>null}),storeAcceptedOrganizationId:T({acceptedOrganizationId:(e,t)=>t.acceptedOrganizationId,errorMessage:()=>null,redirectTarget:()=>null}),storeHomeRedirectTarget:T({redirectTarget:()=>P}),storeNavigationError:T(({context:e,event:t})=>(C(t,F.NAVIGATION_FAILED),e.navigation?.id===t.id?z(e,t.message):{})),storeResolvedRedirectTarget:T({redirectTarget:(e,t)=>t.redirectTarget})},actors:{acceptInvitation:E(async()=>{throw Error(N)}),resolveRedirect:E(async()=>{throw Error(N)})},types:{}}).createMachine({context:L(),id:`inviteAccept`,initial:I.READY,states:{[I.READY]:{on:{[F.ACCEPT]:I.ACCEPTING,[F.DECLINE]:{actions:`queueHomeNavigation`,target:I.NAVIGATING}}},[I.ACCEPTING]:{invoke:{src:`acceptInvitation`,onDone:{actions:{type:`storeAcceptedOrganizationId`,params:({event:e})=>({acceptedOrganizationId:e.output.acceptedOrganizationId})},target:I.REFRESHING_ORGANIZATIONS},onError:{actions:{type:`storeAcceptError`,params:({event:e})=>({message:U(e.error,A)})},target:I.ERROR}}},[I.REFRESHING_ORGANIZATIONS]:{invoke:{src:`resolveRedirect`,input:({context:e})=>({acceptedOrganizationId:V(e)}),onDone:{actions:{type:`storeResolvedRedirectTarget`,params:({event:e})=>({redirectTarget:e.output})},target:I.SUCCESS_PENDING_REDIRECT},onError:{actions:`storeHomeRedirectTarget`,target:I.SUCCESS_PENDING_REDIRECT}}},[I.SUCCESS_PENDING_REDIRECT]:{after:{[t]:{actions:`queueResolvedNavigation`,target:I.NAVIGATING}}},[I.NAVIGATING]:{on:{[F.NAVIGATION_COMPLETED]:{actions:`resetFlow`,target:I.READY},[F.NAVIGATION_FAILED]:{actions:`storeNavigationError`,target:I.ERROR},[F.NAVIGATION_STARTED]:{actions:`markNavigationRunning`}}},[I.ERROR]:{on:{[F.GO_HOME]:{actions:`queueHomeNavigation`,target:I.NAVIGATING}}}}}).provide({actors:{acceptInvitation:E(async()=>e.acceptInvitation()),resolveRedirect:E(async({input:t})=>e.resolveRedirect(t.acceptedOrganizationId))}})}function G(e){return e.matches(I.ACCEPTING)?`accepting`:e.matches(I.ERROR)||e.matches(I.NAVIGATING)&&e.context.acceptedOrganizationId===null&&e.context.errorMessage!==null?`error`:e.matches(I.REFRESHING_ORGANIZATIONS)||e.matches(I.SUCCESS_PENDING_REDIRECT)||e.matches(I.NAVIGATING)&&e.context.acceptedOrganizationId!==null?`success`:`ready`}function K(e){return U(e,j)}function q(){let e=a(),t=h(),{invitationId:n}=k.useParams(),{auth:r,refetchSession:i}=k.useRouteContext(),o=r.session?.user.id,s=(0,O.useCallback)(async()=>{let e=await u.acceptInvitation({invitationId:n});if(e.error)throw Error(e.error.message);return{acceptedOrganizationId:e.data.member.organizationId}},[n]),c=(0,O.useCallback)(async e=>{try{await i();let n=(await t.fetchQuery({...m(o),staleTime:0})).find(t=>t.id===e);if(n)return{kind:`organization`,organizationSlug:p(n)};let r=await u.getFullOrganization({query:{organizationId:e}});if(r.data?.slug)return{kind:`organization`,organizationSlug:r.data.slug};console.error(`[invite] accepted invitation but organization was not found`,{acceptedOrganizationId:e,userId:o})}catch(t){console.error(`[invite] accepted invitation but failed to refresh orgs`,{acceptedOrganizationId:e,error:t,userId:o})}return P},[t,i,o]),[l,f]=w((0,O.useMemo)(()=>W({acceptInvitation:s,resolveRedirect:c}),[s,c])),g=l.context.navigation;return(0,O.useEffect)(()=>{g===null||g.phase!==`pending`||(f({id:g.id,type:F.NAVIGATION_STARTED}),(g.target.kind===`home`?e({to:`/`}):e({params:{org_slug:g.target.organizationSlug},to:d})).then(()=>{f({id:g.id,type:F.NAVIGATION_COMPLETED})}).catch(e=>{console.error(`[invite] failed to navigate after accepting invitation`,{error:e,navigation:g}),f({id:g.id,message:K(e),type:F.NAVIGATION_FAILED})}))},[e,g,f]),{accept:()=>{f({type:F.ACCEPT})},decline:()=>{f({type:F.DECLINE})},errorMessage:l.context.errorMessage,goHome:()=>{f({type:F.GO_HOME})},status:G(l)}}var J=n();function Y(){let e=(0,D.c)(28),{accept:t,decline:n,errorMessage:r,goHome:i,status:a}=q(),u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,J.jsxs)(g,{className:`text-center`,children:[(0,J.jsx)(y,{className:`text-2xl`,children:`Organization Invitation`}),(0,J.jsx)(b,{children:`You've been invited to join an organization`})]}),e[0]=u):u=e[0];let d;e[1]===a?d=e[2]:(d=a===`ready`&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,J.jsx)(`div`,{className:`rounded-full bg-primary/10 p-4`,children:(0,J.jsx)(s,{size:48,className:`text-primary`})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`font-medium`,children:`Ready to join`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Click the button below to accept the invitation and join the organization.`})]})]}),e[1]=a,e[2]=d);let f;e[3]===a?f=e[4]:(f=a===`accepting`&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,J.jsx)(c,{size:48,className:`animate-spin text-primary`}),(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`Accepting invitation...`})]}),e[3]=a,e[4]=f);let p;e[5]===a?p=e[6]:(p=a===`success`&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,J.jsx)(`div`,{className:`rounded-full bg-green-500/10 p-4`,children:(0,J.jsx)(s,{size:48,className:`text-green-500`})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`font-medium text-green-600`,children:`Successfully joined!`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Redirecting to your dashboard...`})]})]}),e[5]=a,e[6]=p);let m;e[7]!==r||e[8]!==a?(m=a===`error`&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,J.jsx)(`div`,{className:`rounded-full bg-destructive/10 p-4`,children:(0,J.jsx)(l,{size:48,className:`text-destructive`})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`font-medium text-destructive`,children:`Failed to accept invitation`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:r||`The invitation may have expired or already been used.`})]})]}),e[7]=r,e[8]=a,e[9]=m):m=e[9];let h;e[10]!==d||e[11]!==f||e[12]!==p||e[13]!==m?(h=(0,J.jsxs)(v,{className:`flex justify-center py-8`,children:[d,f,p,m]}),e[10]=d,e[11]=f,e[12]=p,e[13]=m,e[14]=h):h=e[14];let S;e[15]!==t||e[16]!==n||e[17]!==a?(S=a===`ready`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(o,{variant:`outline`,onClick:n,children:`Decline`}),(0,J.jsx)(o,{onClick:t,children:`Accept Invitation`})]}),e[15]=t,e[16]=n,e[17]=a,e[18]=S):S=e[18];let C;e[19]!==i||e[20]!==a?(C=a===`error`&&(0,J.jsx)(o,{variant:`outline`,onClick:i,children:`Go to Home`}),e[19]=i,e[20]=a,e[21]=C):C=e[21];let w;e[22]!==S||e[23]!==C?(w=(0,J.jsxs)(_,{className:`flex justify-center gap-4`,children:[S,C]}),e[22]=S,e[23]=C,e[24]=w):w=e[24];let T;return e[25]!==h||e[26]!==w?(T=(0,J.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:(0,J.jsxs)(x,{className:`w-full max-w-md`,children:[u,h,w]})}),e[25]=h,e[26]=w,e[27]=T):T=e[27],T}var X=Y;export{X as component};
@@ -0,0 +1 @@
1
+ import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./link-Cgvqhh5w.js";import{t as n}from"./compiler-runtime-DCc3R3Xn.js";import{r,t as i}from"./createReactComponent-_L2mp4Ui.js";import{t as a}from"./utils-C8DGLIgm.js";import{t as o}from"./theme-toggle-D-rc6UzS.js";import{o as s}from"./app-routes-CnJncMlZ.js";import{X as c}from"./index-DthpwdlN.js";var l=i(`outline`,`git-compare`,`GitCompare`,[[`path`,{d:`M4 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M16 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M11 6h5a2 2 0 0 1 2 2v8`,key:`svg-2`}],[`path`,{d:`M14 9l-3 -3l3 -3`,key:`svg-3`}],[`path`,{d:`M13 18h-5a2 2 0 0 1 -2 -2v-8`,key:`svg-4`}],[`path`,{d:`M10 15l3 3l-3 3`,key:`svg-5`}]]),u=i(`outline`,`robot`,`Robot`,[[`path`,{d:`M6 6a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -4`,key:`svg-0`}],[`path`,{d:`M12 2v2`,key:`svg-1`}],[`path`,{d:`M9 12v9`,key:`svg-2`}],[`path`,{d:`M15 12v9`,key:`svg-3`}],[`path`,{d:`M5 16l4 -2`,key:`svg-4`}],[`path`,{d:`M15 14l4 2`,key:`svg-5`}],[`path`,{d:`M9 18h6`,key:`svg-6`}],[`path`,{d:`M10 8v.01`,key:`svg-7`}],[`path`,{d:`M14 8v.01`,key:`svg-8`}]]),d=n(),f=e();function p(){let e=(0,d.c)(3),n,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight sm:text-3xl`,children:`Get started in minutes`}),i=(0,f.jsx)(`p`,{className:`mt-4 max-w-lg text-sm leading-6 text-muted-foreground sm:text-base`,children:`Self-host for free with a single command, or try the managed cloud version.`}),e[0]=n,e[1]=i):(n=e[0],i=e[1]);let o;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsx)(`div`,{className:`mx-auto max-w-6xl px-4 py-14 sm:px-6 sm:py-20`,children:(0,f.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[n,i,(0,f.jsx)(t,{to:s,className:a(r({size:`lg`}),`mt-7 px-8 sm:mt-8`),children:`Start Free`})]})})}),e[2]=o):o=e[2],o}var m=[{description:`Connect databases, analytics tools, and connectors without stitching together a custom control plane.`,icon:u,title:`Unified Access`},{description:`Run consistent workflows across databases, analytics, GitHub, and more from the same workspace.`,icon:l,title:`Cross-Source Coverage`},{description:`Manage data source connectivity, budgets, and team access from a single operational surface.`,icon:c,title:`Operational Control`}];function h(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight sm:text-3xl`,children:`One workspace for connected data`}),(0,f.jsx)(`p`,{className:`mx-auto mt-4 max-w-2xl text-sm leading-6 text-muted-foreground sm:text-base`,children:`Replace scattered setup steps with a single, consistent control plane.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsxs)(`div`,{className:`mx-auto max-w-6xl px-4 py-14 sm:px-6 sm:py-20`,children:[t,(0,f.jsx)(`div`,{className:`mt-10 grid gap-5 sm:mt-16 sm:gap-8 md:grid-cols-3`,children:m.map(g)})]})}),e[1]=n):n=e[1],n}function g(e){return(0,f.jsxs)(`div`,{className:`flex flex-col rounded-lg border border-border p-5 sm:p-6`,children:[(0,f.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-md bg-muted`,children:(0,f.jsx)(e.icon,{size:20,stroke:1.5,className:`size-5`})}),(0,f.jsx)(`h3`,{className:`mt-4 text-base font-semibold`,children:e.title}),(0,f.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-muted-foreground`,children:e.description})]},e.title)}function _(){let e=(0,d.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(`footer`,{className:`border-t border-border`,children:(0,f.jsx)(`div`,{className:`mx-auto flex max-w-6xl items-center justify-center px-6 py-8`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`div`,{className:`flex h-6 w-6 items-center justify-center rounded bg-foreground text-background text-xs font-bold`,children:`V`}),(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`OneQuery - Autonomous Data Workspace`})]})})}),e[0]=t):t=e[0],t}function v(){let e=(0,d.c)(3),n,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`h1`,{className:`max-w-4xl text-3xl font-bold leading-tight tracking-tight sm:text-5xl md:text-6xl`,children:`Your autonomous data workspace`}),i=(0,f.jsx)(`p`,{className:`mt-5 max-w-2xl text-base leading-7 text-muted-foreground sm:mt-6 sm:text-lg md:text-xl`,children:`Connect your data sources, query them from one place, and keep your team aligned on the systems that matter. OneQuery gives you a clean control plane for operating your data access.`}),e[0]=n,e[1]=i):(n=e[0],i=e[1]);let o;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,f.jsx)(`section`,{className:`mx-auto max-w-6xl px-4 py-14 sm:px-6 sm:py-20 md:py-28`,children:(0,f.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[n,i,(0,f.jsx)(t,{to:s,className:a(r({size:`lg`}),`mt-8 px-8 sm:mt-10`),children:`Get Started`})]})}),e[2]=o):o=e[2],o}var y=[`PostgreSQL`,`MySQL`,`BigQuery`,`Google Analytics`,`Amplitude`,`Mixpanel`,`PostHog`,`GitHub`,`Linear`];function b(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight sm:text-3xl`,children:`Connect your stack`}),(0,f.jsx)(`p`,{className:`mx-auto mt-4 max-w-xl text-sm leading-6 text-muted-foreground sm:text-base`,children:`OneQuery integrates with the tools you already use.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsxs)(`div`,{className:`mx-auto max-w-6xl px-4 py-14 sm:px-6 sm:py-20`,children:[t,(0,f.jsx)(`div`,{className:`mt-10 flex flex-wrap items-center justify-center gap-x-6 gap-y-4 sm:mt-12 sm:gap-x-8`,children:y.map(x)})]})}),e[1]=n):n=e[1],n}function x(e){return(0,f.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:e},e)}function S(){let e=(0,d.c)(4),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsxs)(t,{to:`/`,className:`flex items-center gap-2`,children:[(0,f.jsx)(`img`,{src:`/onequery.svg`,alt:`OneQuery`,className:`h-8 w-8`}),(0,f.jsx)(`span`,{className:`font-semibold text-base sm:text-lg`,children:`OneQuery`})]}),e[0]=n):n=e[0];let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,f.jsx)(o,{}),e[1]=i):i=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,f.jsx)(t,{to:s,className:a(r({size:`sm`,variant:`ghost`}),`hidden sm:inline-flex`),children:`Sign in`}),e[2]=c):c=e[2];let l;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,f.jsx)(`header`,{className:`sticky top-0 z-50 w-full border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:(0,f.jsxs)(`div`,{className:`mx-auto flex h-14 max-w-6xl items-center justify-between px-4 sm:px-6`,children:[n,(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i,c,(0,f.jsx)(t,{to:s,className:r({size:`sm`,variant:`default`}),children:`Get Started`})]})]})}),e[3]=l):l=e[3],l}function C(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(S,{}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsxs)(`div`,{className:`flex h-screen flex-col overflow-y-auto`,children:[t,(0,f.jsxs)(`main`,{className:`flex-1`,children:[(0,f.jsx)(v,{}),(0,f.jsx)(h,{}),(0,f.jsx)(b,{}),(0,f.jsx)(p,{})]}),(0,f.jsx)(_,{})]}),e[1]=n):n=e[1],n}var w=C;export{w as component};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./link-Cgvqhh5w.js";import{n as i}from"./useRouterState-DpT8luFk.js";import{a,o,t as s}from"./api-base-url-DIb6qukm.js";import{n as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./theme-toggle-D-rc6UzS.js";import{i as u,n as d}from"./auth-client-BlMeXgb4.js";import{t as f}from"./useQuery-BCl2C7k4.js";import{d as p,l as m,o as h}from"./schemas-MsKXD_XQ.js";import{J as g,K as _,U as v,Y as y}from"./index-DthpwdlN.js";import{t as b}from"./input-CG_cIxvO.js";import{t as x}from"./label-CWOhoN_L.js";import{a as S,n as C,o as w,r as T,t as E}from"./card-Bsy6azfK.js";import{n as D,t as O}from"./zod-C2fx2RN8.js";import{t as k}from"./auth-bootstrap-query-CrWpT3WV.js";var A=e(t(),1),j=n(),M=m({email:h(`Please enter a valid email`),password:p().min(8,`Password must be at least 8 characters`)}),N=m({email:h(`Please enter a valid email`),name:p().min(2,`Name must be at least 2 characters`),password:p().min(8,`Password must be at least 8 characters`)}),P=N.extend({organizationName:p().min(2,`Organization name must be at least 2 characters`),organizationSlug:p().min(2,`Organization slug must be at least 2 characters`).regex(/^[a-z0-9-]+$/,`Organization slug can only contain lowercase letters, numbers, and hyphens`)}),F=a(`/signin`);function I(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,`-`).replaceAll(/^-|-$/g,``)}function L(e,t){if(!(e instanceof Error))return t;let n=e.message.trim();return n.length>0?n:t}async function R(e){let t=await e.json().catch(()=>null),n=m({error:p().optional(),message:p().optional()}).safeParse(t);return n.data?.error??n.data?.message??`Failed to complete bootstrap`}function z(){let e=o(),t=v(),n=i(),[a,h]=(0,A.useState)(`signin`),[z,B]=(0,A.useState)(!1),{redirect:V}=F.useSearch(),H=y(V),U=f(k()).data,W=U?.signupMode===`first-user`,G=W?`signup`:a,K=D({defaultValues:{email:``,password:``},resolver:O(M)}),q=D({defaultValues:{name:``,email:``,password:``},resolver:O(N)}),J=D({defaultValues:{email:``,name:``,organizationName:``,organizationSlug:``,password:``},resolver:O(P)}),Y=typeof window>`u`?`your-host`:window.location.host;async function X(t){B(!0);try{let r=await d.email({email:t.email,password:t.password});if(r.error){console.error(`[auth] sign-in failed`,{error:r.error}),K.setError(`root`,{message:r.error.message??`Invalid email or password`}),B(!1);return}await n.invalidate(),await e({to:H.path})}catch(e){console.error(`[auth] sign-in failed`,{error:e}),K.setError(`root`,{message:L(e,`Couldn't sign in right now. Try again.`)}),B(!1)}}async function Z(t){B(!0);try{let n=await u.email({email:t.email,name:t.name,password:t.password});if(n.error){console.error(`[auth] sign-up failed`,{error:n.error}),q.setError(`root`,{message:n.error.message??`Failed to create account`}),B(!1);return}await e({to:_(V)})}catch(e){console.error(`[auth] sign-up failed`,{error:e}),q.setError(`root`,{message:L(e,`Couldn't create your account right now. Try again.`)}),B(!1)}}async function Q(r){B(!0);try{let i=await fetch(`${s()}/api/bootstrap/complete`,{body:JSON.stringify(r),credentials:`include`,headers:{"content-type":`application/json`},method:`POST`});if(!i.ok){J.setError(`root`,{message:await R(i)}),B(!1);return}let a=m({bootstrap:m({organizationId:p().min(1)})}).safeParse(await i.json().catch(()=>null));if(!a.success){J.setError(`root`,{message:`Bootstrap completed, but the response was invalid`}),B(!1);return}let o=g({organizationId:a.data.bootstrap.organizationId,redirectPath:V});await t.invalidateQueries({queryKey:k().queryKey}),await n.invalidate({sync:!0}),await e({to:_(o)})}catch(e){console.error(`[auth] bootstrap failed`,{error:e}),J.setError(`root`,{message:L(e,`Couldn't finish setup right now. Try again.`)}),B(!1)}}function $(){W||(h(a===`signin`?`signup`:`signin`),K.reset(),q.reset())}let ee=J.watch(`organizationName`);return(0,j.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,j.jsxs)(`header`,{className:`flex h-14 items-center justify-between px-4 sm:px-6`,children:[(0,j.jsxs)(r,{to:`/`,className:`flex items-center gap-2`,children:[(0,j.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-md bg-foreground text-background font-bold`,children:`V`}),(0,j.jsx)(`span`,{className:`font-semibold text-base sm:text-lg`,children:`OneQuery`})]}),(0,j.jsx)(l,{})]}),(0,j.jsx)(`main`,{className:`flex flex-1 items-start justify-center px-4 pb-10 pt-12 sm:items-center sm:px-6 sm:py-6`,children:(0,j.jsxs)(E,{className:`w-full max-w-sm`,children:[(0,j.jsxs)(S,{className:`text-center`,children:[(0,j.jsx)(w,{className:`text-xl`,children:G===`signin`?`Sign in to OneQuery`:W?`Create the initial owner account`:`Create an account`}),(0,j.jsx)(T,{children:G===`signin`?`Enter your email and password to continue`:W?`Finish the first-run bootstrap by creating the owner account for this self-hosted server.`:U?.signupMode===`invite-only`?`Use the email address that received an invitation from your OneQuery admin.`:`Enter your details to get started`})]}),(0,j.jsx)(C,{children:G===`signin`?(0,j.jsxs)(`form`,{onSubmit:K.handleSubmit(X),className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`email`,children:`Email`}),(0,j.jsx)(b,{id:`email`,type:`email`,placeholder:`user@example.com`,autoComplete:`email`,...K.register(`email`)}),K.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`password`,children:`Password`}),(0,j.jsx)(b,{id:`password`,type:`password`,placeholder:`Enter your password`,autoComplete:`current-password`,...K.register(`password`)}),K.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.password.message})]}),K.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.root.message}),(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z,children:z?`Signing in...`:`Sign in`}),(0,j.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[U?.signupMode===`invite-only`?`Need an account? Ask an admin for an invitation, then use the invited email to sign up.`:`Don't have an account? `,U?.signupMode===`invite-only`?(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`I have an invitation`}):(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`Sign up`})]})]}):W?(0,j.jsxs)(`form`,{onSubmit:J.handleSubmit(Q),className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-name`,children:`Your name`}),(0,j.jsx)(b,{id:`bootstrap-name`,type:`text`,placeholder:`Jane Doe`,autoComplete:`name`,...J.register(`name`)}),J.formState.errors.name&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.name.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-email`,children:`Email`}),(0,j.jsx)(b,{id:`bootstrap-email`,type:`email`,placeholder:`owner@example.com`,autoComplete:`email`,...J.register(`email`)}),J.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-organization-name`,children:`Organization name`}),(0,j.jsx)(b,{id:`bootstrap-organization-name`,type:`text`,placeholder:`Acme Inc.`,...J.register(`organizationName`,{onChange:e=>{J.setValue(`organizationSlug`,I(e.target.value))}})}),J.formState.errors.organizationName&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.organizationName.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-organization-slug`,children:`URL slug`}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[Y,`/`]}),(0,j.jsx)(b,{id:`bootstrap-organization-slug`,placeholder:`acme`,...J.register(`organizationSlug`),className:`flex-1`})]}),J.formState.errors.organizationSlug&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.organizationSlug.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-password`,children:`Password`}),(0,j.jsx)(b,{id:`bootstrap-password`,type:`password`,placeholder:`Create a password`,autoComplete:`new-password`,...J.register(`password`)}),J.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.password.message})]}),J.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.root.message}),(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This setup screen is only available until the first owner account is created.`}),(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z||ee.trim().length===0,children:z?`Creating owner...`:`Create owner account`})]}):(0,j.jsxs)(`form`,{onSubmit:q.handleSubmit(Z),className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`name`,children:`Name`}),(0,j.jsx)(b,{id:`name`,type:`text`,placeholder:`John Doe`,autoComplete:`name`,...q.register(`name`)}),q.formState.errors.name&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.name.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`signup-email`,children:`Email`}),(0,j.jsx)(b,{id:`signup-email`,type:`email`,placeholder:`user@example.com`,autoComplete:`email`,...q.register(`email`)}),q.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`signup-password`,children:`Password`}),(0,j.jsx)(b,{id:`signup-password`,type:`password`,placeholder:`Create a password`,autoComplete:`new-password`,...q.register(`password`)}),q.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.password.message})]}),q.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.root.message}),U?.signupMode===`invite-only`?(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Account creation is limited to email addresses with a pending organization invitation.`}):null,(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z,children:z?`Creating account...`:W?`Create owner account`:`Create account`}),W?null:(0,j.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[`Already have an account?`,` `,(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`Sign in`})]})]})})]})})]})}var B=z;export{B as component};
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,n as a,t as o}from"./api-base-url-DIb6qukm.js";import{n as s,t as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./IconCheck-Gc24xPT2.js";import{d as u,n as d,r as f,t as p}from"./dropdown-menu-BIqdY_8v.js";import{n as m,r as h,t as g}from"./checkbox-CJcCVDm9.js";import{t as _}from"./IconLoader2-B3B6M8nQ.js";import{t as v}from"./IconX-BQkA009b.js";import{l as y}from"./app-routes-CnJncMlZ.js";import{a as b,c as x,i as S,l as C,n as w,o as T,r as E,s as D,t as O,u as k}from"./use-optimistic-mutation-Uf_9TxpA.js";import{t as A}from"./useQuery-DcPzWABw.js";import{t as j}from"./useSuspenseQuery-BanVmJgY.js";import{d as M,l as N,m as P,o as F}from"./schemas-MsKXD_XQ.js";import{n as I}from"./src-DCIPwIx0.js";import{a as L,r as R}from"./organization-permissions-BQQ5PJbI.js";import{U as z,V as B,_ as ee,v as V,y as H}from"./index-CbFJKkNs.js";import{t as te}from"./input-CG_cIxvO.js";import{n as U,r as ne,t as re}from"./avatar-B8g7WJsq.js";import{t as ie}from"./format-date-Ctrh7my1.js";import{t as ae}from"./badge-C1_ZMBRy.js";import{t as oe}from"./label-CWOhoN_L.js";import{a as se,i as W,n as ce,o as G,r as K,t as le}from"./table-DCvfJyLS.js";import{a as ue,n as de,o as fe}from"./xstate-react.esm-BlF76DuP.js";import{r as q}from"./api-paths-ClEWWGwS.js";import{n as pe,t as me}from"./zod-C2fx2RN8.js";var he=c(`outline`,`copy`,`Copy`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}]]),ge=c(`outline`,`user-edit`,`UserEdit`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h3.5`,key:`svg-1`}],[`path`,{d:`M18.42 15.61a2.1 2.1 0 0 1 2.97 2.97l-3.39 3.42h-3v-3l3.42 -3.39`,key:`svg-2`}]]),_e=c(`outline`,`user-plus`,`UserPlus`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M16 19h6`,key:`svg-1`}],[`path`,{d:`M19 16v6`,key:`svg-2`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h4`,key:`svg-3`}]]),J=r(),Y=n();function ve(e){switch(e){case`owner`:return`default`;case`admin`:return`secondary`;case`member`:return`outline`}}function ye(e){switch(e){case`owner`:return`Owner`;case`admin`:return`Admin`;case`member`:return`Member`}}function be(e){let t=(0,J.c)(7),{role:n}=e,r;t[0]===n?r=t[1]:(r=ve(n),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=ye(n),t[2]=n,t[3]=i);let a;return t[4]!==r||t[5]!==i?(a=(0,Y.jsx)(ae,{variant:r,children:i}),t[4]=r,t[5]=i,t[6]=a):a=t[6],a}function xe(e){let t=(0,J.c)(9),{roleNames:n,rawRole:r,emptyLabel:i}=e;if(n.length===0){let e;t[0]!==i||t[1]!==r?(e=r?.trim()||i,t[0]=i,t[1]=r,t[2]=e):e=t[2];let n=e,a;return t[3]===n?a=t[4]:(a=n?(0,Y.jsx)(ae,{variant:`outline`,children:n}):null,t[3]=n,t[4]=a),a}let a;t[5]===n?a=t[6]:(a=n.map(Se),t[5]=n,t[6]=a);let o;return t[7]===a?o=t[8]:(o=(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:a}),t[7]=a,t[8]=o),o}function Se(e){return(0,Y.jsx)(be,{role:e},e)}var Ce=N({expiresAt:P().optional(),id:M(),role:M().optional()}),we=N({id:M(),role:M()}),Te=N({member:we});async function Ee(e,t){if((e.headers.get(`content-type`)??``).includes(`application/json`)){let n=await e.json().catch(()=>null),r=N({code:M().optional(),error:M().optional(),message:M().optional()}).safeParse(n);if(r.success)return r.data.error??r.data.message??t}return await e.text().catch(()=>``)||t}async function X(e){let t=await fetch(`${o()}${e.path}`,{body:e.body?JSON.stringify(e.body):void 0,credentials:`include`,headers:{"Content-Type":`application/json`},method:e.method});if(!t.ok)throw Error(await Ee(t,e.errorMessage));let n=await t.json().catch(()=>null),r=e.successSchema.safeParse(n);if(!r.success)throw Error(e.errorMessage);return r.data}async function De(e){return X({body:{email:e.email,role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to create invitation link`,method:`POST`,path:q(e.organizationId,`invitations`),successSchema:Ce})}async function Oe(e){return X({errorMessage:`Failed to cancel invitation`,method:`DELETE`,path:q(e.organizationId,`invitations`,e.invitationId),successSchema:Ce})}async function ke(e){return X({body:{role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to update role`,method:`PATCH`,path:q(e.organizationId,`members`,e.memberId,`role`),successSchema:we})}async function Ae(e){return X({errorMessage:`Failed to remove member`,method:`DELETE`,path:q(e.organizationId,`members`,e.memberId),successSchema:Te})}function je(e){let t=Date.parse(e)-Date.now();if(t<0)return`Expired`;let n=Math.floor(t/(1e3*60*60*24)),r=Math.floor(t%(1e3*60*60*24)/(1e3*60*60));return n>0?`Expires in ${n}d`:r>0?`Expires in ${r}h`:`Expires soon`}function Me(e){let t=(0,J.c)(31),{invitation:n,currentUserId:r,organizationId:i,canManageInvitationMutations:a}=e,o=n.id,c;t[0]!==n.id||t[1]!==i?(c=async()=>{await Oe({invitationId:n.id,organizationId:i})},t[0]=n.id,t[1]=i,t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==n.organizationId?(l=ee(r,n.organizationId),t[3]=r,t[4]=n.organizationId,t[5]=l):l=t[5];let u;t[6]!==n.id||t[7]!==c||t[8]!==l.queryKey?(u={errorMessage:`Failed to cancel invitation`,itemId:o,mutationFn:c,queryKey:l.queryKey,successMessage:`Invitation cancelled`},t[6]=n.id,t[7]=c,t[8]=l.queryKey,t[9]=u):u=t[9];let d=w(u),f=n.expiresAt?Date.parse(n.expiresAt)<Date.now():!1,p;t[10]===n.email?p=t[11]:(p=(0,Y.jsx)(K,{children:(0,Y.jsx)(`span`,{className:`font-medium`,children:n.email})}),t[10]=n.email,t[11]=p);let m;t[12]!==n.rawRole||t[13]!==n.roleNames?(m=(0,Y.jsx)(K,{children:(0,Y.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole,emptyLabel:`Member`})}),t[12]=n.rawRole,t[13]=n.roleNames,t[14]=m):m=t[14];let h=f?`text-destructive`:`text-muted-foreground`,g;t[15]===n.expiresAt?g=t[16]:(g=n.expiresAt?je(n.expiresAt):`Pending`,t[15]=n.expiresAt,t[16]=g);let y;t[17]!==h||t[18]!==g?(y=(0,Y.jsx)(K,{children:(0,Y.jsx)(`span`,{className:h,children:g})}),t[17]=h,t[18]=g,t[19]=y):y=t[19];let b;t[20]!==a||t[21]!==d||t[22]!==f?(b=a&&!f&&(0,Y.jsx)(s,{variant:`ghost`,size:`icon-sm`,onClick:()=>d.mutate(),disabled:d.isPending,title:`Cancel invitation`,children:d.isPending?(0,Y.jsx)(_,{size:16,className:`animate-spin`}):(0,Y.jsx)(v,{size:16,stroke:2})}),t[20]=a,t[21]=d,t[22]=f,t[23]=b):b=t[23];let x;t[24]===b?x=t[25]:(x=(0,Y.jsx)(K,{className:`text-right`,children:b}),t[24]=b,t[25]=x);let S;return t[26]!==x||t[27]!==p||t[28]!==m||t[29]!==y?(S=(0,Y.jsxs)(G,{children:[p,m,y,x]}),t[26]=x,t[27]=p,t[28]=m,t[29]=y,t[30]=S):S=t[30],S}function Ne(e){let t=(0,J.c)(31),{currentUserId:n,organizationId:r,canManageInvitationMutations:i}=e,a;t[0]!==n||t[1]!==r?(a=ee(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=A(a);if(o.isPending){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`Loading invitations...`}),t[3]=e):e=t[3],e}if(o.isLoadingError){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-destructive`,children:`Failed to load invitations.`}),t[4]=e):e=t[4],e}let s=o.data,c,l,u,d,f,p;if(t[5]!==i||t[6]!==n||t[7]!==s||t[8]!==r){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=s.filter(Pe);if(e.length===0){let e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No pending invitations.`}),t[15]=e):e=t[15],p=e;break bb0}f=`rounded-md border`,l=le,t[16]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(se,{children:(0,Y.jsxs)(G,{children:[(0,Y.jsx)(W,{children:`Email`}),(0,Y.jsx)(W,{children:`Role`}),(0,Y.jsx)(W,{children:`Status`}),(0,Y.jsx)(W,{className:`text-right w-[50px]`})]})}),t[16]=d):d=t[16],c=ce;let a;t[17]!==i||t[18]!==n||t[19]!==r?(a=e=>(0,Y.jsx)(Me,{invitation:e,currentUserId:n,organizationId:r,canManageInvitationMutations:i},e.id),t[17]=i,t[18]=n,t[19]=r,t[20]=a):a=t[20],u=e.map(a)}t[5]=i,t[6]=n,t[7]=s,t[8]=r,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f,t[14]=p}else c=t[9],l=t[10],u=t[11],d=t[12],f=t[13],p=t[14];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[21]!==c||t[22]!==u?(m=(0,Y.jsx)(c,{children:u}),t[21]=c,t[22]=u,t[23]=m):m=t[23];let h;t[24]!==l||t[25]!==d||t[26]!==m?(h=(0,Y.jsxs)(l,{children:[d,m]}),t[24]=l,t[25]=d,t[26]=m,t[27]=h):h=t[27];let g;return t[28]!==f||t[29]!==h?(g=(0,Y.jsx)(`div`,{className:f,children:h}),t[28]=f,t[29]=h,t[30]=g):g=t[30],g}function Pe(e){return e.status===`pending`}var Z=e(t(),1);function Fe(e){let t=(0,J.c)(11),{value:n,className:r}=e,[i,a]=(0,Z.useState)(!1),o,c;t[0]===i?(o=t[1],c=t[2]):(o=()=>{if(!i)return;let e=setTimeout(()=>{a(!1)},2e3);return()=>clearTimeout(e)},c=[i],t[0]=i,t[1]=o,t[2]=c),(0,Z.useEffect)(o,c);let u;t[3]===n?u=t[4]:(u=()=>{navigator.clipboard.writeText(n),a(!0)},t[3]=n,t[4]=u);let d=u,f;t[5]===i?f=t[6]:(f=i?(0,Y.jsx)(l,{size:16,stroke:2}):(0,Y.jsx)(he,{size:16,stroke:2}),t[5]=i,t[6]=f);let p;return t[7]!==r||t[8]!==d||t[9]!==f?(p=(0,Y.jsx)(s,{type:`button`,variant:`outline`,size:`icon`,onClick:d,title:`Copy`,className:r,children:f}),t[7]=r,t[8]=d,t[9]=f,t[10]=p):p=t[10],p}var Ie=[`admin`,`member`],Le=[{label:`Admin`,value:`admin`},{label:`Member`,value:`member`}],Re=[`member`],Q={RESET:`teamRoleSelection/reset`,SOURCE_ROLE_NAMES_SYNCED:`teamRoleSelection/sourceRoleNamesSynced`,TOGGLE_ROLE:`teamRoleSelection/toggleRole`};function $(e){let t=new Set;for(let n of e)(n===`admin`||n===`member`)&&t.add(n);return Ie.filter(e=>t.has(e))}var ze=ue({actions:{resetSelectedRoleNames:fe({selectedRoleNames:({context:e})=>e.sourceRoleNames}),syncSourceRoleNames:fe({selectedRoleNames:(e,t)=>[...t.roleNames],sourceRoleNames:(e,t)=>[...t.roleNames]}),toggleRoleName:fe({selectedRoleNames:({context:e},t)=>{let n=new Set(e.selectedRoleNames);return n.has(t.roleName)?n.delete(t.roleName):n.add(t.roleName),Ie.filter(e=>n.has(e))}})},types:{}}).createMachine({context:({input:e})=>{let t=$(e.initialRoleNames);return{selectedRoleNames:t,sourceRoleNames:t}},id:`teamRoleSelection`,initial:`ready`,on:{[Q.RESET]:{actions:`resetSelectedRoleNames`},[Q.SOURCE_ROLE_NAMES_SYNCED]:{actions:{type:`syncSourceRoleNames`,params:({event:e})=>({roleNames:$(e.roleNames)})}},[Q.TOGGLE_ROLE]:{actions:{type:`toggleRoleName`,params:({event:e})=>({roleName:e.roleName})}}},states:{ready:{}}});function Be(e){let t=(0,J.c)(21),n;t[0]===e.initialRoleNames?n=t[1]:(n=$(e.initialRoleNames),t[0]=e.initialRoleNames,t[1]=n);let r;t[2]===n?r=t[3]:(r={input:{initialRoleNames:n}},t[2]=n,t[3]=r);let[i,a]=de(ze,r),o;t[4]===i.context.selectedRoleNames?o=t[5]:(o=L(i.context.selectedRoleNames),t[4]=i.context.selectedRoleNames,t[5]=o);let s=o,c;t[6]===i.context.sourceRoleNames?c=t[7]:(c=L(i.context.sourceRoleNames),t[6]=i.context.sourceRoleNames,t[7]=c);let l=s!==c,u=i.context.selectedRoleNames.length===0,d;t[8]===a?d=t[9]:(d=()=>{a({type:Q.RESET})},t[8]=a,t[9]=d);let f=d,p;t[10]===a?p=t[11]:(p=e=>{a({type:Q.SOURCE_ROLE_NAMES_SYNCED,roleNames:e})},t[10]=a,t[11]=p);let m=p,h;t[12]===a?h=t[13]:(h=e=>{a({type:Q.TOGGLE_ROLE,roleName:e})},t[12]=a,t[13]=h);let g=h,_;return t[14]!==i.context.selectedRoleNames||t[15]!==g||t[16]!==l||t[17]!==u||t[18]!==f||t[19]!==m?(_={hasChanges:l,isSelectionEmpty:u,reset:f,resetToRoleNames:m,selectedRoleNames:i.context.selectedRoleNames,toggleRole:g},t[14]=i.context.selectedRoleNames,t[15]=g,t[16]=l,t[17]=u,t[18]=f,t[19]=m,t[20]=_):_=t[20],_}function Ve(e){return e instanceof HTMLElement&&e.closest(`[data-slot="checkbox"]`)!==null}function He(e){let t=(0,J.c)(12),{errorMessage:n,helperText:r,onToggleRole:i,selectedRoleNames:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsx)(oe,{children:`Roles`}),t[0]=o):o=t[0];let s;t[1]!==i||t[2]!==a?(s=Le.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 rounded-md border px-3 py-2 text-left hover:bg-accent/40`,onClick:t=>{Ve(t.target)||i(e.value)},children:[(0,Y.jsx)(g,{checked:a.includes(e.value),onCheckedChange:()=>i(e.value)}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`p`,{className:`font-medium`,children:e.label})})]},e.value)),t[1]=i,t[2]=a,t[3]=s):s=t[3];let c;t[4]===s?c=t[5]:(c=(0,Y.jsx)(`div`,{className:`space-y-2`,children:s}),t[4]=s,t[5]=c);let l;t[6]!==n||t[7]!==r?(l=n?(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:n}):(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r}),t[6]=n,t[7]=r,t[8]=l):l=t[8];let u;return t[9]!==c||t[10]!==l?(u=(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[o,c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11],u}var Ue=N({email:F(`Please enter a valid email address`)});function We(e){let t=(0,J.c)(44),{children:n,currentUserId:r,organizationId:i}=e,[o,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={initialRoleNames:Re},t[0]=p):p=t[0];let m=Be(p),h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h={defaultValues:{email:``},resolver:me(Ue)},t[1]=h):h=t[1];let g=pe(h),_;t[2]===i?_=t[3]:(_=e=>({id:`temp-${crypto.randomUUID()}`,email:e.email,rawRole:L(e.roleNames),roleNames:[...e.roleNames],status:`pending`,expiresAt:I().toISOString(),organizationId:i,inviterId:`current-user`}),t[2]=i,t[3]=_);let v;t[4]===i?v=t[5]:(v=async e=>De({email:e.email,organizationId:i,roleNames:e.roleNames}),t[4]=i,t[5]=v);let w;t[6]!==g||t[7]!==m?(w=e=>{e?.id&&u({expiresAt:e.expiresAt??I().toISOString(),url:`${a()}${y(e.id)}`}),g.reset(),m.reset(),f(null)},t[6]=g,t[7]=m,t[8]=w):w=t[8];let k;t[9]!==r||t[10]!==i?(k=ee(r,i),t[9]=r,t[10]=i,t[11]=k):k=t[11];let A;t[12]!==_||t[13]!==v||t[14]!==w||t[15]!==k.queryKey?(A={createOptimisticItem:_,errorMessage:`Failed to create invitation link`,mutationFn:v,onSuccess:w,queryKey:k.queryKey,successMessage:`Invitation link created`},t[12]=_,t[13]=v,t[14]=w,t[15]=k.queryKey,t[16]=A):A=t[16];let j=O(A),M;t[17]!==j||t[18]!==m.isSelectionEmpty||t[19]!==m.selectedRoleNames?(M=e=>{if(m.isSelectionEmpty){f(`Select at least one role`);return}j.mutate({...e,roleNames:m.selectedRoleNames})},t[17]=j,t[18]=m.isSelectionEmpty,t[19]=m.selectedRoleNames,t[20]=M):M=t[20];let N=M,P;t[21]!==g||t[22]!==m?(P=e=>{c(e),e||(u(null),f(null),m.reset(),g.reset())},t[21]=g,t[22]=m,t[23]=P):P=t[23];let F=P,R;t[24]!==d||t[25]!==m?(R=e=>{d&&f(null),m.toggleRole(e)},t[24]=d,t[25]=m,t[26]=R):R=t[26];let z=R,B;t[27]===n?B=t[28]:(B=(0,Y.jsx)(C,{render:n}),t[27]=n,t[28]=B);let V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Y.jsxs)(D,{children:[(0,Y.jsx)(x,{children:`Create Invitation Link`}),(0,Y.jsx)(b,{children:`Create a shareable invitation link for this organization. The recipient will sign in with an existing account or create their own before accepting.`})]}),t[29]=V):V=t[29];let H;t[30]!==g||t[31]!==z||t[32]!==l||t[33]!==j||t[34]!==N||t[35]!==d||t[36]!==m.isSelectionEmpty||t[37]!==m.selectedRoleNames?(H=(0,Y.jsxs)(S,{className:`sm:max-w-[400px]`,children:[V,l?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`space-y-2 pt-4`,children:[(0,Y.jsx)(oe,{children:`Invitation Link`}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(te,{value:l.url,readOnly:!0,className:`flex-1 text-sm`}),(0,Y.jsx)(Fe,{value:l.url})]}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Share this link with the invitee. They'll accept it after signing in or creating an account. The link expires on`,` `,ie(l.expiresAt),`.`]})]}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>u(null),children:`Create Another Link`}),(0,Y.jsx)(s,{type:`button`,onClick:()=>c(!1),children:`Done`})]})]}):(0,Y.jsxs)(`form`,{onSubmit:g.handleSubmit(N),className:`space-y-4 pt-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(oe,{htmlFor:`email`,children:`Email Address`}),(0,Y.jsx)(te,{id:`email`,type:`email`,placeholder:`colleague@example.com`,...g.register(`email`)}),g.formState.errors.email&&(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:g.formState.errors.email.message})]}),(0,Y.jsx)(He,{errorMessage:d,helperText:`Select one or more roles for this invitation.`,onToggleRole:z,selectedRoleNames:m.selectedRoleNames}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>c(!1),children:`Cancel`}),(0,Y.jsx)(s,{type:`submit`,disabled:j.isPending||m.isSelectionEmpty,children:j.isPending?`Creating Link...`:`Create Invitation Link`})]})]})]}),t[30]=g,t[31]=z,t[32]=l,t[33]=j,t[34]=N,t[35]=d,t[36]=m.isSelectionEmpty,t[37]=m.selectedRoleNames,t[38]=H):H=t[38];let U;return t[39]!==F||t[40]!==o||t[41]!==B||t[42]!==H?(U=(0,Y.jsxs)(E,{open:o,onOpenChange:F,children:[B,H]}),t[39]=F,t[40]=o,t[41]=B,t[42]=H,t[43]=U):U=t[43],U}function Ge({currentUserId:e,open:t,onOpenChange:n,member:r}){let i=z(),a=(0,Z.useMemo)(()=>$(r.roleNames),[L(r.roleNames)]),o=Be({initialRoleNames:a});(0,Z.useEffect)(()=>{t&&o.resetToRoleNames(a)},[a,r.id,t,o.resetToRoleNames]);let c=k({mutationFn:async()=>{await ke({memberId:r.id,organizationId:r.organizationId,roleNames:o.selectedRoleNames})},onError:e=>{B.error(e.message||`Failed to update role`)},onSuccess:()=>{B.success(`Role updated`),i.invalidateQueries({queryKey:V(e,r.organizationId).queryKey}),n(!1)}});return(0,Y.jsx)(E,{open:t,onOpenChange:n,children:(0,Y.jsxs)(S,{className:`sm:max-w-[400px]`,children:[(0,Y.jsxs)(D,{children:[(0,Y.jsx)(x,{children:`Change Role`}),(0,Y.jsxs)(b,{children:[`Update the role for `,r.user.name]})]}),(0,Y.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),!o.hasChanges){n(!1);return}c.mutate()},className:`space-y-4 pt-4`,children:[(0,Y.jsx)(He,{helperText:`Select one or more roles for this member.`,onToggleRole:o.toggleRole,selectedRoleNames:o.selectedRoleNames}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Y.jsx)(s,{type:`submit`,disabled:c.isPending||o.isSelectionEmpty,children:c.isPending?`Updating...`:`Update Role`})]})]})]})})}function Ke(e){return e.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2)}function qe(e){let t=(0,J.c)(51),{member:n,currentUserId:r,canManageMemberMutations:i}=e,[a,o]=(0,Z.useState)(!1),c=n.userId===r,l;t[0]===n.rawRole?l=t[1]:(l=R({roleName:`owner`,rawRole:n.rawRole}),t[0]=n.rawRole,t[1]=l);let g=l,_=n.id,v;t[2]!==n.id||t[3]!==n.organizationId?(v=async()=>{await Ae({memberId:n.id,organizationId:n.organizationId})},t[2]=n.id,t[3]=n.organizationId,t[4]=v):v=t[4];let y;t[5]!==r||t[6]!==n.organizationId?(y=V(r,n.organizationId),t[5]=r,t[6]=n.organizationId,t[7]=y):y=t[7];let b;t[8]!==n.id||t[9]!==v||t[10]!==y.queryKey?(b={errorMessage:`Failed to remove member`,itemId:_,mutationFn:v,queryKey:y.queryKey,successMessage:`Member removed`},t[8]=n.id,t[9]=v,t[10]=y.queryKey,t[11]=b):b=t[11];let x=w(b),S=i&&!g&&!c,C=i&&!g&&!c,T;t[12]===n.user.image?T=t[13]:(T=n.user.image&&(0,Y.jsx)(ne,{src:n.user.image}),t[12]=n.user.image,t[13]=T);let E;t[14]===n.user.name?E=t[15]:(E=Ke(n.user.name),t[14]=n.user.name,t[15]=E);let D;t[16]===E?D=t[17]:(D=(0,Y.jsx)(U,{children:E}),t[16]=E,t[17]=D);let O;t[18]!==T||t[19]!==D?(O=(0,Y.jsxs)(re,{size:`sm`,children:[T,D]}),t[18]=T,t[19]=D,t[20]=O):O=t[20];let k;t[21]===n.user.name?k=t[22]:(k=(0,Y.jsx)(`div`,{className:`font-medium`,children:n.user.name}),t[21]=n.user.name,t[22]=k);let A;t[23]===n.user.email?A=t[24]:(A=(0,Y.jsx)(`div`,{className:`text-muted-foreground text-sm`,children:n.user.email}),t[23]=n.user.email,t[24]=A);let j;t[25]!==k||t[26]!==A?(j=(0,Y.jsxs)(`div`,{children:[k,A]}),t[25]=k,t[26]=A,t[27]=j):j=t[27];let M;t[28]!==j||t[29]!==O?(M=(0,Y.jsx)(K,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[O,j]})}),t[28]=j,t[29]=O,t[30]=M):M=t[30];let N;t[31]!==n.rawRole||t[32]!==n.roleNames?(N=(0,Y.jsx)(K,{children:(0,Y.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole})}),t[31]=n.rawRole,t[32]=n.roleNames,t[33]=N):N=t[33];let P;t[34]!==S||t[35]!==C||t[36]!==x?(P=(S||C)&&(0,Y.jsxs)(p,{children:[(0,Y.jsx)(u,{children:(0,Y.jsx)(s,{variant:`ghost`,size:`icon-sm`,children:(0,Y.jsx)(h,{size:16,stroke:2})})}),(0,Y.jsxs)(d,{align:`end`,children:[S&&(0,Y.jsxs)(f,{onClick:()=>o(!0),children:[(0,Y.jsx)(ge,{size:16,stroke:2}),`Change Role`]}),C&&(0,Y.jsxs)(f,{onClick:()=>x.mutate(),disabled:x.isPending,className:`text-destructive focus:text-destructive`,children:[(0,Y.jsx)(m,{size:16,stroke:2}),x.isPending?`Removing...`:`Remove`]})]})]}),t[34]=S,t[35]=C,t[36]=x,t[37]=P):P=t[37];let F;t[38]===P?F=t[39]:(F=(0,Y.jsx)(K,{className:`text-right`,children:P}),t[38]=P,t[39]=F);let I;t[40]!==M||t[41]!==N||t[42]!==F?(I=(0,Y.jsxs)(G,{children:[M,N,F]}),t[40]=M,t[41]=N,t[42]=F,t[43]=I):I=t[43];let L;t[44]!==r||t[45]!==n||t[46]!==a?(L=(0,Y.jsx)(Ge,{open:a,onOpenChange:o,currentUserId:r,member:n}),t[44]=r,t[45]=n,t[46]=a,t[47]=L):L=t[47];let z;return t[48]!==I||t[49]!==L?(z=(0,Y.jsxs)(Y.Fragment,{children:[I,L]}),t[48]=I,t[49]=L,t[50]=z):z=t[50],z}function Je(e){let t=(0,J.c)(11),{members:n,currentUserId:r,canManageMemberMutations:i}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No members found.`}),t[0]=e):e=t[0],e}let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(se,{children:(0,Y.jsxs)(G,{children:[(0,Y.jsx)(W,{children:`Member`}),(0,Y.jsx)(W,{children:`Role`}),(0,Y.jsx)(W,{className:`text-right w-[50px]`})]})}),t[1]=a):a=t[1];let o;if(t[2]!==i||t[3]!==r||t[4]!==n){let e;t[6]!==i||t[7]!==r?(e=e=>(0,Y.jsx)(qe,{member:e,currentUserId:r,canManageMemberMutations:i},e.id),t[6]=i,t[7]=r,t[8]=e):e=t[8],o=n.map(e),t[2]=i,t[3]=r,t[4]=n,t[5]=o}else o=t[5];let s;return t[9]===o?s=t[10]:(s=(0,Y.jsx)(`div`,{className:`rounded-md border`,children:(0,Y.jsxs)(le,{children:[a,(0,Y.jsx)(ce,{children:o})]})}),t[9]=o,t[10]=s),s}var Ye=i(`/_authenticated/$org_slug/team`);function Xe(e){let t=(0,J.c)(27),n;t[0]!==e.currentUserId||t[1]!==e.organizationId?(n=V(e.currentUserId,e.organizationId),t[0]=e.currentUserId,t[1]=e.organizationId,t[2]=n):n=t[2];let{data:r}=j(n),i;t[3]!==r||t[4]!==e.currentUserId?(i=H({currentUserId:e.currentUserId,members:r}),t[3]=r,t[4]=e.currentUserId,t[5]=i):i=t[5];let{canInviteMembers:a,canManageMembershipMutations:o,canReadInvitations:c}=i,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Members`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`People who have access to this organization. Invite teammates to let them join with their own account.`})]}),t[6]=l):l=t[6];let u;t[7]!==a||t[8]!==o||t[9]!==e.currentUserId||t[10]!==e.organizationId?(u=a?(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:o?(0,Y.jsx)(We,{currentUserId:e.currentUserId,organizationId:e.organizationId,children:(0,Y.jsxs)(s,{children:[(0,Y.jsx)(_e,{size:16,stroke:2}),`Create Invitation Link`]})}):null}):null,t[7]=a,t[8]=o,t[9]=e.currentUserId,t[10]=e.organizationId,t[11]=u):u=t[11];let d;t[12]===u?d=t[13]:(d=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[l,u]}),t[12]=u,t[13]=d);let f;t[14]!==o||t[15]!==r||t[16]!==e.currentUserId?(f=(0,Y.jsx)(Je,{members:r,currentUserId:e.currentUserId,canManageMemberMutations:o}),t[14]=o,t[15]=r,t[16]=e.currentUserId,t[17]=f):f=t[17];let p;t[18]!==o||t[19]!==c||t[20]!==e.currentUserId||t[21]!==e.organizationId?(p=c?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold mb-2`,children:`Pending Invitations`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:`Invitations that haven't been accepted yet.`}),(0,Y.jsx)(Ne,{currentUserId:e.currentUserId,organizationId:e.organizationId,canManageInvitationMutations:o})]}):null,t[18]=o,t[19]=c,t[20]=e.currentUserId,t[21]=e.organizationId,t[22]=p):p=t[22];let m;return t[23]!==d||t[24]!==f||t[25]!==p?(m=(0,Y.jsxs)(`div`,{className:`space-y-8`,children:[d,f,p]}),t[23]=d,t[24]=f,t[25]=p,t[26]=m):m=t[26],m}function Ze(){let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsxs)(`div`,{className:`mb-8`,children:[(0,Y.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Team`}),(0,Y.jsx)(`p`,{className:`text-muted-foreground mt-2`,children:`Manage your members and create invitation links for new teammates.`})]}),e[0]=t):t=e[0],t}function Qe(){let e=(0,J.c)(4),{organizationId:t,session:n}=Ye.useRouteContext(),r=n.user.id,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(Ze,{}),e[0]=i):i=e[0];let a;return e[1]!==r||e[2]!==t?(a=(0,Y.jsxs)(`div`,{className:`p-8`,children:[i,(0,Y.jsx)(Xe,{organizationId:t,currentUserId:r})]}),e[1]=r,e[2]=t,e[3]=a):a=e[3],a}var $e=Qe;export{$e as component};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,n as a,t as o}from"./api-base-url-DIb6qukm.js";import{n as s,t as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./IconCheck-Gc24xPT2.js";import{d as u,n as d,r as f,t as p}from"./dropdown-menu-BhdkLmzJ.js";import{n as m,r as h,t as g}from"./checkbox-CJcCVDm9.js";import{t as _}from"./IconLoader2-B3B6M8nQ.js";import{t as v}from"./IconX-BQkA009b.js";import{l as y}from"./app-routes-CnJncMlZ.js";import{a as b,c as x,i as S,l as C,n as w,o as T,r as E,s as D,t as O,u as k}from"./use-optimistic-mutation-B6q6iB7T.js";import{t as A}from"./useQuery-BCl2C7k4.js";import{t as j}from"./useSuspenseQuery-BoUwwhvS.js";import{d as M,l as N,m as P,o as F}from"./schemas-MsKXD_XQ.js";import{n as I}from"./src-DCIPwIx0.js";import{a as L,r as R}from"./organization-permissions-BQQ5PJbI.js";import{U as z,V as B,_ as ee,v as V,y as H}from"./index-DthpwdlN.js";import{t as te}from"./input-CG_cIxvO.js";import{n as U,r as ne,t as re}from"./avatar-B8g7WJsq.js";import{t as ie}from"./format-date-Ctrh7my1.js";import{t as ae}from"./badge-C1_ZMBRy.js";import{t as oe}from"./label-CWOhoN_L.js";import{a as se,i as W,n as ce,o as G,r as K,t as le}from"./table-DCvfJyLS.js";import{a as ue,n as de,o as fe}from"./xstate-react.esm-BlF76DuP.js";import{r as q}from"./api-paths-ClEWWGwS.js";import{n as pe,t as me}from"./zod-C2fx2RN8.js";var he=c(`outline`,`copy`,`Copy`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}]]),ge=c(`outline`,`user-edit`,`UserEdit`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h3.5`,key:`svg-1`}],[`path`,{d:`M18.42 15.61a2.1 2.1 0 0 1 2.97 2.97l-3.39 3.42h-3v-3l3.42 -3.39`,key:`svg-2`}]]),_e=c(`outline`,`user-plus`,`UserPlus`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M16 19h6`,key:`svg-1`}],[`path`,{d:`M19 16v6`,key:`svg-2`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h4`,key:`svg-3`}]]),J=r(),Y=n();function ve(e){switch(e){case`owner`:return`default`;case`admin`:return`secondary`;case`member`:return`outline`}}function ye(e){switch(e){case`owner`:return`Owner`;case`admin`:return`Admin`;case`member`:return`Member`}}function be(e){let t=(0,J.c)(7),{role:n}=e,r;t[0]===n?r=t[1]:(r=ve(n),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=ye(n),t[2]=n,t[3]=i);let a;return t[4]!==r||t[5]!==i?(a=(0,Y.jsx)(ae,{variant:r,children:i}),t[4]=r,t[5]=i,t[6]=a):a=t[6],a}function xe(e){let t=(0,J.c)(9),{roleNames:n,rawRole:r,emptyLabel:i}=e;if(n.length===0){let e;t[0]!==i||t[1]!==r?(e=r?.trim()||i,t[0]=i,t[1]=r,t[2]=e):e=t[2];let n=e,a;return t[3]===n?a=t[4]:(a=n?(0,Y.jsx)(ae,{variant:`outline`,children:n}):null,t[3]=n,t[4]=a),a}let a;t[5]===n?a=t[6]:(a=n.map(Se),t[5]=n,t[6]=a);let o;return t[7]===a?o=t[8]:(o=(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:a}),t[7]=a,t[8]=o),o}function Se(e){return(0,Y.jsx)(be,{role:e},e)}var Ce=N({expiresAt:P().optional(),id:M(),role:M().optional()}),we=N({id:M(),role:M()}),Te=N({member:we});async function Ee(e,t){if((e.headers.get(`content-type`)??``).includes(`application/json`)){let n=await e.json().catch(()=>null),r=N({code:M().optional(),error:M().optional(),message:M().optional()}).safeParse(n);if(r.success)return r.data.error??r.data.message??t}return await e.text().catch(()=>``)||t}async function X(e){let t=await fetch(`${o()}${e.path}`,{body:e.body?JSON.stringify(e.body):void 0,credentials:`include`,headers:{"Content-Type":`application/json`},method:e.method});if(!t.ok)throw Error(await Ee(t,e.errorMessage));let n=await t.json().catch(()=>null),r=e.successSchema.safeParse(n);if(!r.success)throw Error(e.errorMessage);return r.data}async function De(e){return X({body:{email:e.email,role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to create invitation link`,method:`POST`,path:q(e.organizationId,`invitations`),successSchema:Ce})}async function Oe(e){return X({errorMessage:`Failed to cancel invitation`,method:`DELETE`,path:q(e.organizationId,`invitations`,e.invitationId),successSchema:Ce})}async function ke(e){return X({body:{role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to update role`,method:`PATCH`,path:q(e.organizationId,`members`,e.memberId,`role`),successSchema:we})}async function Ae(e){return X({errorMessage:`Failed to remove member`,method:`DELETE`,path:q(e.organizationId,`members`,e.memberId),successSchema:Te})}function je(e){let t=Date.parse(e)-Date.now();if(t<0)return`Expired`;let n=Math.floor(t/(1e3*60*60*24)),r=Math.floor(t%(1e3*60*60*24)/(1e3*60*60));return n>0?`Expires in ${n}d`:r>0?`Expires in ${r}h`:`Expires soon`}function Me(e){let t=(0,J.c)(31),{invitation:n,currentUserId:r,organizationId:i,canManageInvitationMutations:a}=e,o=n.id,c;t[0]!==n.id||t[1]!==i?(c=async()=>{await Oe({invitationId:n.id,organizationId:i})},t[0]=n.id,t[1]=i,t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==n.organizationId?(l=ee(r,n.organizationId),t[3]=r,t[4]=n.organizationId,t[5]=l):l=t[5];let u;t[6]!==n.id||t[7]!==c||t[8]!==l.queryKey?(u={errorMessage:`Failed to cancel invitation`,itemId:o,mutationFn:c,queryKey:l.queryKey,successMessage:`Invitation cancelled`},t[6]=n.id,t[7]=c,t[8]=l.queryKey,t[9]=u):u=t[9];let d=w(u),f=n.expiresAt?Date.parse(n.expiresAt)<Date.now():!1,p;t[10]===n.email?p=t[11]:(p=(0,Y.jsx)(K,{children:(0,Y.jsx)(`span`,{className:`font-medium`,children:n.email})}),t[10]=n.email,t[11]=p);let m;t[12]!==n.rawRole||t[13]!==n.roleNames?(m=(0,Y.jsx)(K,{children:(0,Y.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole,emptyLabel:`Member`})}),t[12]=n.rawRole,t[13]=n.roleNames,t[14]=m):m=t[14];let h=f?`text-destructive`:`text-muted-foreground`,g;t[15]===n.expiresAt?g=t[16]:(g=n.expiresAt?je(n.expiresAt):`Pending`,t[15]=n.expiresAt,t[16]=g);let y;t[17]!==h||t[18]!==g?(y=(0,Y.jsx)(K,{children:(0,Y.jsx)(`span`,{className:h,children:g})}),t[17]=h,t[18]=g,t[19]=y):y=t[19];let b;t[20]!==a||t[21]!==d||t[22]!==f?(b=a&&!f&&(0,Y.jsx)(s,{variant:`ghost`,size:`icon-sm`,onClick:()=>d.mutate(),disabled:d.isPending,title:`Cancel invitation`,children:d.isPending?(0,Y.jsx)(_,{size:16,className:`animate-spin`}):(0,Y.jsx)(v,{size:16,stroke:2})}),t[20]=a,t[21]=d,t[22]=f,t[23]=b):b=t[23];let x;t[24]===b?x=t[25]:(x=(0,Y.jsx)(K,{className:`text-right`,children:b}),t[24]=b,t[25]=x);let S;return t[26]!==x||t[27]!==p||t[28]!==m||t[29]!==y?(S=(0,Y.jsxs)(G,{children:[p,m,y,x]}),t[26]=x,t[27]=p,t[28]=m,t[29]=y,t[30]=S):S=t[30],S}function Ne(e){let t=(0,J.c)(31),{currentUserId:n,organizationId:r,canManageInvitationMutations:i}=e,a;t[0]!==n||t[1]!==r?(a=ee(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=A(a);if(o.isPending){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`Loading invitations...`}),t[3]=e):e=t[3],e}if(o.isLoadingError){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-destructive`,children:`Failed to load invitations.`}),t[4]=e):e=t[4],e}let s=o.data,c,l,u,d,f,p;if(t[5]!==i||t[6]!==n||t[7]!==s||t[8]!==r){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=s.filter(Pe);if(e.length===0){let e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No pending invitations.`}),t[15]=e):e=t[15],p=e;break bb0}f=`rounded-md border`,l=le,t[16]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(se,{children:(0,Y.jsxs)(G,{children:[(0,Y.jsx)(W,{children:`Email`}),(0,Y.jsx)(W,{children:`Role`}),(0,Y.jsx)(W,{children:`Status`}),(0,Y.jsx)(W,{className:`text-right w-[50px]`})]})}),t[16]=d):d=t[16],c=ce;let a;t[17]!==i||t[18]!==n||t[19]!==r?(a=e=>(0,Y.jsx)(Me,{invitation:e,currentUserId:n,organizationId:r,canManageInvitationMutations:i},e.id),t[17]=i,t[18]=n,t[19]=r,t[20]=a):a=t[20],u=e.map(a)}t[5]=i,t[6]=n,t[7]=s,t[8]=r,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f,t[14]=p}else c=t[9],l=t[10],u=t[11],d=t[12],f=t[13],p=t[14];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[21]!==c||t[22]!==u?(m=(0,Y.jsx)(c,{children:u}),t[21]=c,t[22]=u,t[23]=m):m=t[23];let h;t[24]!==l||t[25]!==d||t[26]!==m?(h=(0,Y.jsxs)(l,{children:[d,m]}),t[24]=l,t[25]=d,t[26]=m,t[27]=h):h=t[27];let g;return t[28]!==f||t[29]!==h?(g=(0,Y.jsx)(`div`,{className:f,children:h}),t[28]=f,t[29]=h,t[30]=g):g=t[30],g}function Pe(e){return e.status===`pending`}var Z=e(t(),1);function Fe(e){let t=(0,J.c)(11),{value:n,className:r}=e,[i,a]=(0,Z.useState)(!1),o,c;t[0]===i?(o=t[1],c=t[2]):(o=()=>{if(!i)return;let e=setTimeout(()=>{a(!1)},2e3);return()=>clearTimeout(e)},c=[i],t[0]=i,t[1]=o,t[2]=c),(0,Z.useEffect)(o,c);let u;t[3]===n?u=t[4]:(u=()=>{navigator.clipboard.writeText(n),a(!0)},t[3]=n,t[4]=u);let d=u,f;t[5]===i?f=t[6]:(f=i?(0,Y.jsx)(l,{size:16,stroke:2}):(0,Y.jsx)(he,{size:16,stroke:2}),t[5]=i,t[6]=f);let p;return t[7]!==r||t[8]!==d||t[9]!==f?(p=(0,Y.jsx)(s,{type:`button`,variant:`outline`,size:`icon`,onClick:d,title:`Copy`,className:r,children:f}),t[7]=r,t[8]=d,t[9]=f,t[10]=p):p=t[10],p}var Ie=[`admin`,`member`],Le=[{label:`Admin`,value:`admin`},{label:`Member`,value:`member`}],Re=[`member`],Q={RESET:`teamRoleSelection/reset`,SOURCE_ROLE_NAMES_SYNCED:`teamRoleSelection/sourceRoleNamesSynced`,TOGGLE_ROLE:`teamRoleSelection/toggleRole`};function $(e){let t=new Set;for(let n of e)(n===`admin`||n===`member`)&&t.add(n);return Ie.filter(e=>t.has(e))}var ze=ue({actions:{resetSelectedRoleNames:fe({selectedRoleNames:({context:e})=>e.sourceRoleNames}),syncSourceRoleNames:fe({selectedRoleNames:(e,t)=>[...t.roleNames],sourceRoleNames:(e,t)=>[...t.roleNames]}),toggleRoleName:fe({selectedRoleNames:({context:e},t)=>{let n=new Set(e.selectedRoleNames);return n.has(t.roleName)?n.delete(t.roleName):n.add(t.roleName),Ie.filter(e=>n.has(e))}})},types:{}}).createMachine({context:({input:e})=>{let t=$(e.initialRoleNames);return{selectedRoleNames:t,sourceRoleNames:t}},id:`teamRoleSelection`,initial:`ready`,on:{[Q.RESET]:{actions:`resetSelectedRoleNames`},[Q.SOURCE_ROLE_NAMES_SYNCED]:{actions:{type:`syncSourceRoleNames`,params:({event:e})=>({roleNames:$(e.roleNames)})}},[Q.TOGGLE_ROLE]:{actions:{type:`toggleRoleName`,params:({event:e})=>({roleName:e.roleName})}}},states:{ready:{}}});function Be(e){let t=(0,J.c)(21),n;t[0]===e.initialRoleNames?n=t[1]:(n=$(e.initialRoleNames),t[0]=e.initialRoleNames,t[1]=n);let r;t[2]===n?r=t[3]:(r={input:{initialRoleNames:n}},t[2]=n,t[3]=r);let[i,a]=de(ze,r),o;t[4]===i.context.selectedRoleNames?o=t[5]:(o=L(i.context.selectedRoleNames),t[4]=i.context.selectedRoleNames,t[5]=o);let s=o,c;t[6]===i.context.sourceRoleNames?c=t[7]:(c=L(i.context.sourceRoleNames),t[6]=i.context.sourceRoleNames,t[7]=c);let l=s!==c,u=i.context.selectedRoleNames.length===0,d;t[8]===a?d=t[9]:(d=()=>{a({type:Q.RESET})},t[8]=a,t[9]=d);let f=d,p;t[10]===a?p=t[11]:(p=e=>{a({type:Q.SOURCE_ROLE_NAMES_SYNCED,roleNames:e})},t[10]=a,t[11]=p);let m=p,h;t[12]===a?h=t[13]:(h=e=>{a({type:Q.TOGGLE_ROLE,roleName:e})},t[12]=a,t[13]=h);let g=h,_;return t[14]!==i.context.selectedRoleNames||t[15]!==g||t[16]!==l||t[17]!==u||t[18]!==f||t[19]!==m?(_={hasChanges:l,isSelectionEmpty:u,reset:f,resetToRoleNames:m,selectedRoleNames:i.context.selectedRoleNames,toggleRole:g},t[14]=i.context.selectedRoleNames,t[15]=g,t[16]=l,t[17]=u,t[18]=f,t[19]=m,t[20]=_):_=t[20],_}function Ve(e){return e instanceof HTMLElement&&e.closest(`[data-slot="checkbox"]`)!==null}function He(e){let t=(0,J.c)(12),{errorMessage:n,helperText:r,onToggleRole:i,selectedRoleNames:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsx)(oe,{children:`Roles`}),t[0]=o):o=t[0];let s;t[1]!==i||t[2]!==a?(s=Le.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 rounded-md border px-3 py-2 text-left hover:bg-accent/40`,onClick:t=>{Ve(t.target)||i(e.value)},children:[(0,Y.jsx)(g,{checked:a.includes(e.value),onCheckedChange:()=>i(e.value)}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`p`,{className:`font-medium`,children:e.label})})]},e.value)),t[1]=i,t[2]=a,t[3]=s):s=t[3];let c;t[4]===s?c=t[5]:(c=(0,Y.jsx)(`div`,{className:`space-y-2`,children:s}),t[4]=s,t[5]=c);let l;t[6]!==n||t[7]!==r?(l=n?(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:n}):(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r}),t[6]=n,t[7]=r,t[8]=l):l=t[8];let u;return t[9]!==c||t[10]!==l?(u=(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[o,c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11],u}var Ue=N({email:F(`Please enter a valid email address`)});function We(e){let t=(0,J.c)(44),{children:n,currentUserId:r,organizationId:i}=e,[o,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={initialRoleNames:Re},t[0]=p):p=t[0];let m=Be(p),h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h={defaultValues:{email:``},resolver:me(Ue)},t[1]=h):h=t[1];let g=pe(h),_;t[2]===i?_=t[3]:(_=e=>({id:`temp-${crypto.randomUUID()}`,email:e.email,rawRole:L(e.roleNames),roleNames:[...e.roleNames],status:`pending`,expiresAt:I().toISOString(),organizationId:i,inviterId:`current-user`}),t[2]=i,t[3]=_);let v;t[4]===i?v=t[5]:(v=async e=>De({email:e.email,organizationId:i,roleNames:e.roleNames}),t[4]=i,t[5]=v);let w;t[6]!==g||t[7]!==m?(w=e=>{e?.id&&u({expiresAt:e.expiresAt??I().toISOString(),url:`${a()}${y(e.id)}`}),g.reset(),m.reset(),f(null)},t[6]=g,t[7]=m,t[8]=w):w=t[8];let k;t[9]!==r||t[10]!==i?(k=ee(r,i),t[9]=r,t[10]=i,t[11]=k):k=t[11];let A;t[12]!==_||t[13]!==v||t[14]!==w||t[15]!==k.queryKey?(A={createOptimisticItem:_,errorMessage:`Failed to create invitation link`,mutationFn:v,onSuccess:w,queryKey:k.queryKey,successMessage:`Invitation link created`},t[12]=_,t[13]=v,t[14]=w,t[15]=k.queryKey,t[16]=A):A=t[16];let j=O(A),M;t[17]!==j||t[18]!==m.isSelectionEmpty||t[19]!==m.selectedRoleNames?(M=e=>{if(m.isSelectionEmpty){f(`Select at least one role`);return}j.mutate({...e,roleNames:m.selectedRoleNames})},t[17]=j,t[18]=m.isSelectionEmpty,t[19]=m.selectedRoleNames,t[20]=M):M=t[20];let N=M,P;t[21]!==g||t[22]!==m?(P=e=>{c(e),e||(u(null),f(null),m.reset(),g.reset())},t[21]=g,t[22]=m,t[23]=P):P=t[23];let F=P,R;t[24]!==d||t[25]!==m?(R=e=>{d&&f(null),m.toggleRole(e)},t[24]=d,t[25]=m,t[26]=R):R=t[26];let z=R,B;t[27]===n?B=t[28]:(B=(0,Y.jsx)(C,{render:n}),t[27]=n,t[28]=B);let V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Y.jsxs)(D,{children:[(0,Y.jsx)(x,{children:`Create Invitation Link`}),(0,Y.jsx)(b,{children:`Create a shareable invitation link for this organization. The recipient will sign in with an existing account or create their own before accepting.`})]}),t[29]=V):V=t[29];let H;t[30]!==g||t[31]!==z||t[32]!==l||t[33]!==j||t[34]!==N||t[35]!==d||t[36]!==m.isSelectionEmpty||t[37]!==m.selectedRoleNames?(H=(0,Y.jsxs)(S,{className:`sm:max-w-[400px]`,children:[V,l?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`space-y-2 pt-4`,children:[(0,Y.jsx)(oe,{children:`Invitation Link`}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(te,{value:l.url,readOnly:!0,className:`flex-1 text-sm`}),(0,Y.jsx)(Fe,{value:l.url})]}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Share this link with the invitee. They'll accept it after signing in or creating an account. The link expires on`,` `,ie(l.expiresAt),`.`]})]}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>u(null),children:`Create Another Link`}),(0,Y.jsx)(s,{type:`button`,onClick:()=>c(!1),children:`Done`})]})]}):(0,Y.jsxs)(`form`,{onSubmit:g.handleSubmit(N),className:`space-y-4 pt-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(oe,{htmlFor:`email`,children:`Email Address`}),(0,Y.jsx)(te,{id:`email`,type:`email`,placeholder:`colleague@example.com`,...g.register(`email`)}),g.formState.errors.email&&(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:g.formState.errors.email.message})]}),(0,Y.jsx)(He,{errorMessage:d,helperText:`Select one or more roles for this invitation.`,onToggleRole:z,selectedRoleNames:m.selectedRoleNames}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>c(!1),children:`Cancel`}),(0,Y.jsx)(s,{type:`submit`,disabled:j.isPending||m.isSelectionEmpty,children:j.isPending?`Creating Link...`:`Create Invitation Link`})]})]})]}),t[30]=g,t[31]=z,t[32]=l,t[33]=j,t[34]=N,t[35]=d,t[36]=m.isSelectionEmpty,t[37]=m.selectedRoleNames,t[38]=H):H=t[38];let U;return t[39]!==F||t[40]!==o||t[41]!==B||t[42]!==H?(U=(0,Y.jsxs)(E,{open:o,onOpenChange:F,children:[B,H]}),t[39]=F,t[40]=o,t[41]=B,t[42]=H,t[43]=U):U=t[43],U}function Ge({currentUserId:e,open:t,onOpenChange:n,member:r}){let i=z(),a=(0,Z.useMemo)(()=>$(r.roleNames),[L(r.roleNames)]),o=Be({initialRoleNames:a});(0,Z.useEffect)(()=>{t&&o.resetToRoleNames(a)},[a,r.id,t,o.resetToRoleNames]);let c=k({mutationFn:async()=>{await ke({memberId:r.id,organizationId:r.organizationId,roleNames:o.selectedRoleNames})},onError:e=>{B.error(e.message||`Failed to update role`)},onSuccess:()=>{B.success(`Role updated`),i.invalidateQueries({queryKey:V(e,r.organizationId).queryKey}),n(!1)}});return(0,Y.jsx)(E,{open:t,onOpenChange:n,children:(0,Y.jsxs)(S,{className:`sm:max-w-[400px]`,children:[(0,Y.jsxs)(D,{children:[(0,Y.jsx)(x,{children:`Change Role`}),(0,Y.jsxs)(b,{children:[`Update the role for `,r.user.name]})]}),(0,Y.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),!o.hasChanges){n(!1);return}c.mutate()},className:`space-y-4 pt-4`,children:[(0,Y.jsx)(He,{helperText:`Select one or more roles for this member.`,onToggleRole:o.toggleRole,selectedRoleNames:o.selectedRoleNames}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Y.jsx)(s,{type:`submit`,disabled:c.isPending||o.isSelectionEmpty,children:c.isPending?`Updating...`:`Update Role`})]})]})]})})}function Ke(e){return e.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2)}function qe(e){let t=(0,J.c)(51),{member:n,currentUserId:r,canManageMemberMutations:i}=e,[a,o]=(0,Z.useState)(!1),c=n.userId===r,l;t[0]===n.rawRole?l=t[1]:(l=R({roleName:`owner`,rawRole:n.rawRole}),t[0]=n.rawRole,t[1]=l);let g=l,_=n.id,v;t[2]!==n.id||t[3]!==n.organizationId?(v=async()=>{await Ae({memberId:n.id,organizationId:n.organizationId})},t[2]=n.id,t[3]=n.organizationId,t[4]=v):v=t[4];let y;t[5]!==r||t[6]!==n.organizationId?(y=V(r,n.organizationId),t[5]=r,t[6]=n.organizationId,t[7]=y):y=t[7];let b;t[8]!==n.id||t[9]!==v||t[10]!==y.queryKey?(b={errorMessage:`Failed to remove member`,itemId:_,mutationFn:v,queryKey:y.queryKey,successMessage:`Member removed`},t[8]=n.id,t[9]=v,t[10]=y.queryKey,t[11]=b):b=t[11];let x=w(b),S=i&&!g&&!c,C=i&&!g&&!c,T;t[12]===n.user.image?T=t[13]:(T=n.user.image&&(0,Y.jsx)(ne,{src:n.user.image}),t[12]=n.user.image,t[13]=T);let E;t[14]===n.user.name?E=t[15]:(E=Ke(n.user.name),t[14]=n.user.name,t[15]=E);let D;t[16]===E?D=t[17]:(D=(0,Y.jsx)(U,{children:E}),t[16]=E,t[17]=D);let O;t[18]!==T||t[19]!==D?(O=(0,Y.jsxs)(re,{size:`sm`,children:[T,D]}),t[18]=T,t[19]=D,t[20]=O):O=t[20];let k;t[21]===n.user.name?k=t[22]:(k=(0,Y.jsx)(`div`,{className:`font-medium`,children:n.user.name}),t[21]=n.user.name,t[22]=k);let A;t[23]===n.user.email?A=t[24]:(A=(0,Y.jsx)(`div`,{className:`text-muted-foreground text-sm`,children:n.user.email}),t[23]=n.user.email,t[24]=A);let j;t[25]!==k||t[26]!==A?(j=(0,Y.jsxs)(`div`,{children:[k,A]}),t[25]=k,t[26]=A,t[27]=j):j=t[27];let M;t[28]!==j||t[29]!==O?(M=(0,Y.jsx)(K,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[O,j]})}),t[28]=j,t[29]=O,t[30]=M):M=t[30];let N;t[31]!==n.rawRole||t[32]!==n.roleNames?(N=(0,Y.jsx)(K,{children:(0,Y.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole})}),t[31]=n.rawRole,t[32]=n.roleNames,t[33]=N):N=t[33];let P;t[34]!==S||t[35]!==C||t[36]!==x?(P=(S||C)&&(0,Y.jsxs)(p,{children:[(0,Y.jsx)(u,{children:(0,Y.jsx)(s,{variant:`ghost`,size:`icon-sm`,children:(0,Y.jsx)(h,{size:16,stroke:2})})}),(0,Y.jsxs)(d,{align:`end`,children:[S&&(0,Y.jsxs)(f,{onClick:()=>o(!0),children:[(0,Y.jsx)(ge,{size:16,stroke:2}),`Change Role`]}),C&&(0,Y.jsxs)(f,{onClick:()=>x.mutate(),disabled:x.isPending,className:`text-destructive focus:text-destructive`,children:[(0,Y.jsx)(m,{size:16,stroke:2}),x.isPending?`Removing...`:`Remove`]})]})]}),t[34]=S,t[35]=C,t[36]=x,t[37]=P):P=t[37];let F;t[38]===P?F=t[39]:(F=(0,Y.jsx)(K,{className:`text-right`,children:P}),t[38]=P,t[39]=F);let I;t[40]!==M||t[41]!==N||t[42]!==F?(I=(0,Y.jsxs)(G,{children:[M,N,F]}),t[40]=M,t[41]=N,t[42]=F,t[43]=I):I=t[43];let L;t[44]!==r||t[45]!==n||t[46]!==a?(L=(0,Y.jsx)(Ge,{open:a,onOpenChange:o,currentUserId:r,member:n}),t[44]=r,t[45]=n,t[46]=a,t[47]=L):L=t[47];let z;return t[48]!==I||t[49]!==L?(z=(0,Y.jsxs)(Y.Fragment,{children:[I,L]}),t[48]=I,t[49]=L,t[50]=z):z=t[50],z}function Je(e){let t=(0,J.c)(11),{members:n,currentUserId:r,canManageMemberMutations:i}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No members found.`}),t[0]=e):e=t[0],e}let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(se,{children:(0,Y.jsxs)(G,{children:[(0,Y.jsx)(W,{children:`Member`}),(0,Y.jsx)(W,{children:`Role`}),(0,Y.jsx)(W,{className:`text-right w-[50px]`})]})}),t[1]=a):a=t[1];let o;if(t[2]!==i||t[3]!==r||t[4]!==n){let e;t[6]!==i||t[7]!==r?(e=e=>(0,Y.jsx)(qe,{member:e,currentUserId:r,canManageMemberMutations:i},e.id),t[6]=i,t[7]=r,t[8]=e):e=t[8],o=n.map(e),t[2]=i,t[3]=r,t[4]=n,t[5]=o}else o=t[5];let s;return t[9]===o?s=t[10]:(s=(0,Y.jsx)(`div`,{className:`rounded-md border`,children:(0,Y.jsxs)(le,{children:[a,(0,Y.jsx)(ce,{children:o})]})}),t[9]=o,t[10]=s),s}var Ye=i(`/_authenticated/$org_slug/team`);function Xe(e){let t=(0,J.c)(27),n;t[0]!==e.currentUserId||t[1]!==e.organizationId?(n=V(e.currentUserId,e.organizationId),t[0]=e.currentUserId,t[1]=e.organizationId,t[2]=n):n=t[2];let{data:r}=j(n),i;t[3]!==r||t[4]!==e.currentUserId?(i=H({currentUserId:e.currentUserId,members:r}),t[3]=r,t[4]=e.currentUserId,t[5]=i):i=t[5];let{canInviteMembers:a,canManageMembershipMutations:o,canReadInvitations:c}=i,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Members`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`People who have access to this organization. Invite teammates to let them join with their own account.`})]}),t[6]=l):l=t[6];let u;t[7]!==a||t[8]!==o||t[9]!==e.currentUserId||t[10]!==e.organizationId?(u=a?(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:o?(0,Y.jsx)(We,{currentUserId:e.currentUserId,organizationId:e.organizationId,children:(0,Y.jsxs)(s,{children:[(0,Y.jsx)(_e,{size:16,stroke:2}),`Create Invitation Link`]})}):null}):null,t[7]=a,t[8]=o,t[9]=e.currentUserId,t[10]=e.organizationId,t[11]=u):u=t[11];let d;t[12]===u?d=t[13]:(d=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[l,u]}),t[12]=u,t[13]=d);let f;t[14]!==o||t[15]!==r||t[16]!==e.currentUserId?(f=(0,Y.jsx)(Je,{members:r,currentUserId:e.currentUserId,canManageMemberMutations:o}),t[14]=o,t[15]=r,t[16]=e.currentUserId,t[17]=f):f=t[17];let p;t[18]!==o||t[19]!==c||t[20]!==e.currentUserId||t[21]!==e.organizationId?(p=c?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold mb-2`,children:`Pending Invitations`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:`Invitations that haven't been accepted yet.`}),(0,Y.jsx)(Ne,{currentUserId:e.currentUserId,organizationId:e.organizationId,canManageInvitationMutations:o})]}):null,t[18]=o,t[19]=c,t[20]=e.currentUserId,t[21]=e.organizationId,t[22]=p):p=t[22];let m;return t[23]!==d||t[24]!==f||t[25]!==p?(m=(0,Y.jsxs)(`div`,{className:`space-y-8`,children:[d,f,p]}),t[23]=d,t[24]=f,t[25]=p,t[26]=m):m=t[26],m}function Ze(){let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsxs)(`div`,{className:`mb-8`,children:[(0,Y.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Team`}),(0,Y.jsx)(`p`,{className:`text-muted-foreground mt-2`,children:`Manage your members and create invitation links for new teammates.`})]}),e[0]=t):t=e[0],t}function Qe(){let e=(0,J.c)(4),{organizationId:t,session:n}=Ye.useRouteContext(),r=n.user.id,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(Ze,{}),e[0]=i):i=e[0];let a;return e[1]!==r||e[2]!==t?(a=(0,Y.jsxs)(`div`,{className:`p-8`,children:[i,(0,Y.jsx)(Xe,{organizationId:t,currentUserId:r})]}),e[1]=r,e[2]=t,e[3]=a):a=e[3],a}var $e=Qe;export{$e as component};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./compiler-runtime-DCc3R3Xn.js";import{n,t as r}from"./createReactComponent-_L2mp4Ui.js";import{a as i,d as a,i as o,n as s,t as c}from"./dropdown-menu-BIqdY_8v.js";import{H as l}from"./index-CbFJKkNs.js";var u=r(`outline`,`device-desktop`,`DeviceDesktop`,[[`path`,{d:`M3 5a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-10`,key:`svg-0`}],[`path`,{d:`M7 20h10`,key:`svg-1`}],[`path`,{d:`M9 16v4`,key:`svg-2`}],[`path`,{d:`M15 16v4`,key:`svg-3`}]]),d=r(`outline`,`moon`,`Moon`,[[`path`,{d:`M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454l0 .008`,key:`svg-0`}]]),f=r(`outline`,`sun`,`Sun`,[[`path`,{d:`M8 12a4 4 0 1 0 8 0a4 4 0 1 0 -8 0`,key:`svg-0`}],[`path`,{d:`M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7`,key:`svg-1`}]]),p=t(),m=e();function h(){let e=(0,p.c)(8),{theme:t,setTheme:r}=l(),h;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,m.jsx)(n,{variant:`ghost`,size:`icon`}),e[0]=h):h=e[0];let g;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,m.jsxs)(a,{render:h,"aria-label":`Toggle theme`,children:[(0,m.jsx)(f,{size:16,stroke:2,className:`rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,m.jsx)(d,{size:16,stroke:2,className:`absolute rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`})]}),e[1]=g):g=e[1];let _;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,m.jsxs)(i,{value:`light`,children:[(0,m.jsx)(f,{size:16,stroke:2,className:`mr-2`}),`Light`]}),e[2]=_):_=e[2];let v;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,m.jsxs)(i,{value:`dark`,children:[(0,m.jsx)(d,{size:16,stroke:2,className:`mr-2`}),`Dark`]}),e[3]=v):v=e[3];let y;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,m.jsxs)(i,{value:`system`,children:[(0,m.jsx)(u,{size:16,stroke:2,className:`mr-2`}),`System`]}),e[4]=y):y=e[4];let b;return e[5]!==r||e[6]!==t?(b=(0,m.jsxs)(c,{children:[g,(0,m.jsx)(s,{align:`end`,children:(0,m.jsxs)(o,{value:t,onValueChange:r,children:[_,v,y]})})]}),e[5]=r,e[6]=t,e[7]=b):b=e[7],b}export{h as t};
1
+ import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./compiler-runtime-DCc3R3Xn.js";import{n,t as r}from"./createReactComponent-_L2mp4Ui.js";import{a as i,d as a,i as o,n as s,t as c}from"./dropdown-menu-BhdkLmzJ.js";import{H as l}from"./index-DthpwdlN.js";var u=r(`outline`,`device-desktop`,`DeviceDesktop`,[[`path`,{d:`M3 5a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-10`,key:`svg-0`}],[`path`,{d:`M7 20h10`,key:`svg-1`}],[`path`,{d:`M9 16v4`,key:`svg-2`}],[`path`,{d:`M15 16v4`,key:`svg-3`}]]),d=r(`outline`,`moon`,`Moon`,[[`path`,{d:`M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454l0 .008`,key:`svg-0`}]]),f=r(`outline`,`sun`,`Sun`,[[`path`,{d:`M8 12a4 4 0 1 0 8 0a4 4 0 1 0 -8 0`,key:`svg-0`}],[`path`,{d:`M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7`,key:`svg-1`}]]),p=t(),m=e();function h(){let e=(0,p.c)(8),{theme:t,setTheme:r}=l(),h;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,m.jsx)(n,{variant:`ghost`,size:`icon`}),e[0]=h):h=e[0];let g;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,m.jsxs)(a,{render:h,"aria-label":`Toggle theme`,children:[(0,m.jsx)(f,{size:16,stroke:2,className:`rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,m.jsx)(d,{size:16,stroke:2,className:`absolute rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`})]}),e[1]=g):g=e[1];let _;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,m.jsxs)(i,{value:`light`,children:[(0,m.jsx)(f,{size:16,stroke:2,className:`mr-2`}),`Light`]}),e[2]=_):_=e[2];let v;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,m.jsxs)(i,{value:`dark`,children:[(0,m.jsx)(d,{size:16,stroke:2,className:`mr-2`}),`Dark`]}),e[3]=v):v=e[3];let y;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,m.jsxs)(i,{value:`system`,children:[(0,m.jsx)(u,{size:16,stroke:2,className:`mr-2`}),`System`]}),e[4]=y):y=e[4];let b;return e[5]!==r||e[6]!==t?(b=(0,m.jsxs)(c,{children:[g,(0,m.jsx)(s,{align:`end`,children:(0,m.jsxs)(o,{value:t,onValueChange:r,children:[_,v,y]})})]}),e[5]=r,e[6]=t,e[7]=b):b=e[7],b}export{h as t};
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,g as a,n as o,o as s,y as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./utils-C8DGLIgm.js";import{t as u}from"./IconX-BQkA009b.js";import{A as d,E as f,T as p,b as m,m as h,o as g}from"./removable-BfDesq3B.js";import{c as _,l as v}from"./getDisabledMountTransitionStyles-BYKRz4ha.js";import{t as y}from"./useBaseUiId-BLFGpnYJ.js";import{c as b}from"./getPseudoElementBounds-InhM-dWf.js";import{U as x,V as S,W as C,z as w}from"./index-CbFJKkNs.js";import{a as T,c as E,i as D,n as O,o as k,r as A,s as j,t as M}from"./DialogTitle-C3t5rzfv.js";var N=class extends d{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),p(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&h(t.mutationKey)!==h(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??C();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){g.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},P=e(t(),1);function F(e,t){let n=x(t),[r]=P.useState(()=>new N(n,e));P.useEffect(()=>{r.setOptions(e)},[r,e]);let i=P.useSyncExternalStore(P.useCallback(e=>r.subscribe(g.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=P.useCallback((e,t)=>{r.mutate(e,t).catch(m)},[r]);if(i.error&&f(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var I=P.forwardRef(function(e,t){let{render:n,className:r,disabled:o=!1,nativeButton:l=!0,id:u,payload:d,handle:f,...p}=e,m=E(!0),h=f?.store??m?.store;if(!h)throw Error(c(79));let g=y(u),x=h.useState(`floatingRootContext`),S=h.useState(`isOpenedByTrigger`,g),C=P.useRef(null),{registerTrigger:T,isMountedByThisTrigger:D}=w(g,C,h,{payload:d}),{getButtonProps:O,buttonRef:k}=a({disabled:o,native:l}),A=v([b(x,{enabled:x!=null})]),j=P.useMemo(()=>({disabled:o,open:S}),[o,S]),M=h.useState(`triggerProps`,D);return i(`button`,e,{state:j,ref:[k,t,T,C],props:[A.getReferenceProps(),M,{[s]:``,id:g},p,O],stateAttributesMapping:_})}),L=r(),R=n();function z(e){let t=(0,L.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,R.jsx)(O,{"data-slot":`dialog`,...n}),t[2]=n,t[3]=r),r}function B(e){let t=(0,L.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,R.jsx)(I,{"data-slot":`dialog-trigger`,...n}),t[2]=n,t[3]=r),r}function V(e){let t=(0,L.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,R.jsx)(A,{"data-slot":`dialog-portal`,...n}),t[2]=n,t[3]=r),r}function H(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(j,{"data-slot":`dialog-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function U(e){let t=(0,L.c)(20),n,r,i,a,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5]):({className:r,children:n,showCloseButton:s,overlayClassName:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s);let c=s===void 0?!0:s,d;t[6]===i?d=t[7]:(d=(0,R.jsx)(H,{className:i}),t[6]=i,t[7]=d);let f;t[8]===r?f=t[9]:(f=l(`bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-xl p-4 text-sm ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none`,r),t[8]=r,t[9]=f);let p;t[10]===c?p=t[11]:(p=c&&(0,R.jsxs)(k,{"data-slot":`dialog-close`,render:(0,R.jsx)(o,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,R.jsx)(u,{}),(0,R.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[10]=c,t[11]=p);let m;t[12]!==n||t[13]!==a||t[14]!==f||t[15]!==p?(m=(0,R.jsxs)(D,{"data-slot":`dialog-content`,className:f,...a,children:[n,p]}),t[12]=n,t[13]=a,t[14]=f,t[15]=p,t[16]=m):m=t[16];let h;return t[17]!==d||t[18]!==m?(h=(0,R.jsxs)(V,{children:[d,m]}),t[17]=d,t[18]=m,t[19]=h):h=t[19],h}function W(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`gap-2 flex flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(`div`,{"data-slot":`dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function G(e){let t=(0,L.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,showCloseButton:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let s=a===void 0?!1:a,c;t[5]===r?c=t[6]:(c=l(`bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,r),t[5]=r,t[6]=c);let u;t[7]===s?u=t[8]:(u=s&&(0,R.jsx)(k,{render:(0,R.jsx)(o,{variant:`outline`}),children:`Close`}),t[7]=s,t[8]=u);let d;return t[9]!==n||t[10]!==i||t[11]!==c||t[12]!==u?(d=(0,R.jsxs)(`div`,{"data-slot":`dialog-footer`,className:c,...i,children:[n,u]}),t[9]=n,t[10]=i,t[11]=c,t[12]=u,t[13]=d):d=t[13],d}function K(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`text-sm leading-none font-medium`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(M,{"data-slot":`dialog-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function q(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(T,{"data-slot":`dialog-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function J(e){let t=(0,L.c)(27),{mutationFn:n,queryKey:r,optimisticUpdate:i,onSuccess:a,onError:o,successMessage:s,errorMessage:c}=e,l=x(),u;t[0]!==c||t[1]!==o||t[2]!==l||t[3]!==r?(u=(e,t,n)=>{n?.previousData!==void 0&&l.setQueryData(r,n.previousData);let i=c??(e.message?e.message:`Operation failed`);S.error(i),o?.(e,t)},t[0]=c,t[1]=o,t[2]=l,t[3]=r,t[4]=u):u=t[4];let d;t[5]!==i||t[6]!==l||t[7]!==r?(d=async e=>{await l.cancelQueries({queryKey:r});let t=l.getQueryData(r);return t!==void 0&&l.setQueryData(r,t=>t===void 0?t:i(t,e)),{previousData:t}},t[5]=i,t[6]=l,t[7]=r,t[8]=d):d=t[8];let f;t[9]!==l||t[10]!==r?(f=()=>{l.invalidateQueries({queryKey:r})},t[9]=l,t[10]=r,t[11]=f):f=t[11];let p;t[12]!==a||t[13]!==s?(p=(e,t)=>{s&&S.success(s),a?.(e,t)},t[12]=a,t[13]=s,t[14]=p):p=t[14];let m;t[15]!==n||t[16]!==u||t[17]!==d||t[18]!==f||t[19]!==p?(m={mutationFn:n,onError:u,onMutate:d,onSettled:f,onSuccess:p},t[15]=n,t[16]=u,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h=F(m),g=h.mutate,_=h.mutateAsync,v;return t[21]!==h.isError||t[22]!==h.isPending||t[23]!==h.isSuccess||t[24]!==g||t[25]!==_?(v={isError:h.isError,isPending:h.isPending,isSuccess:h.isSuccess,mutate:g,mutateAsync:_},t[21]=h.isError,t[22]=h.isPending,t[23]=h.isSuccess,t[24]=g,t[25]=_,t[26]=v):v=t[26],v}function Y({mutationFn:e,queryKey:t,itemId:n,getId:r=e=>e.id,onSuccess:i,onError:a,successMessage:o,errorMessage:s=`Failed to delete`}){return J({errorMessage:s,mutationFn:async()=>e(),onError:a?e=>a(e):void 0,onSuccess:i?e=>i(e):void 0,optimisticUpdate:e=>e.filter(e=>r(e)!==n),queryKey:t,successMessage:o})}function X(e){let t=(0,L.c)(10),{mutationFn:n,queryKey:r,createOptimisticItem:i,onSuccess:a,onError:o,successMessage:s,errorMessage:c}=e,l;t[0]===i?l=t[1]:(l=(e,t)=>[...e,i(t)],t[0]=i,t[1]=l);let u;return t[2]!==c||t[3]!==n||t[4]!==o||t[5]!==a||t[6]!==r||t[7]!==s||t[8]!==l?(u={errorMessage:c,mutationFn:n,onError:o,onSuccess:a,optimisticUpdate:l,queryKey:r,successMessage:s},t[2]=c,t[3]=n,t[4]=o,t[5]=a,t[6]=r,t[7]=s,t[8]=l,t[9]=u):u=t[9],J(u)}export{q as a,K as c,U as i,B as l,Y as n,G as o,z as r,W as s,X as t,F as u};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,g as a,n as o,o as s,y as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./utils-C8DGLIgm.js";import{t as u}from"./IconX-BQkA009b.js";import{A as d,E as f,T as p,b as m,m as h,o as g}from"./removable-BfDesq3B.js";import{c as _,l as v}from"./getDisabledMountTransitionStyles-BYKRz4ha.js";import{t as y}from"./useBaseUiId-BLFGpnYJ.js";import{c as b}from"./getPseudoElementBounds-InhM-dWf.js";import{U as x,V as S,W as C,z as w}from"./index-DthpwdlN.js";import{a as T,c as E,i as D,n as O,o as k,r as A,s as j,t as M}from"./DialogTitle-C7S-GNch.js";var N=class extends d{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),p(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&h(t.mutationKey)!==h(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??C();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){g.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},P=e(t(),1);function F(e,t){let n=x(t),[r]=P.useState(()=>new N(n,e));P.useEffect(()=>{r.setOptions(e)},[r,e]);let i=P.useSyncExternalStore(P.useCallback(e=>r.subscribe(g.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=P.useCallback((e,t)=>{r.mutate(e,t).catch(m)},[r]);if(i.error&&f(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var I=P.forwardRef(function(e,t){let{render:n,className:r,disabled:o=!1,nativeButton:l=!0,id:u,payload:d,handle:f,...p}=e,m=E(!0),h=f?.store??m?.store;if(!h)throw Error(c(79));let g=y(u),x=h.useState(`floatingRootContext`),S=h.useState(`isOpenedByTrigger`,g),C=P.useRef(null),{registerTrigger:T,isMountedByThisTrigger:D}=w(g,C,h,{payload:d}),{getButtonProps:O,buttonRef:k}=a({disabled:o,native:l}),A=v([b(x,{enabled:x!=null})]),j=P.useMemo(()=>({disabled:o,open:S}),[o,S]),M=h.useState(`triggerProps`,D);return i(`button`,e,{state:j,ref:[k,t,T,C],props:[A.getReferenceProps(),M,{[s]:``,id:g},p,O],stateAttributesMapping:_})}),L=r(),R=n();function z(e){let t=(0,L.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,R.jsx)(O,{"data-slot":`dialog`,...n}),t[2]=n,t[3]=r),r}function B(e){let t=(0,L.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,R.jsx)(I,{"data-slot":`dialog-trigger`,...n}),t[2]=n,t[3]=r),r}function V(e){let t=(0,L.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,R.jsx)(A,{"data-slot":`dialog-portal`,...n}),t[2]=n,t[3]=r),r}function H(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(j,{"data-slot":`dialog-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function U(e){let t=(0,L.c)(20),n,r,i,a,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5]):({className:r,children:n,showCloseButton:s,overlayClassName:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s);let c=s===void 0?!0:s,d;t[6]===i?d=t[7]:(d=(0,R.jsx)(H,{className:i}),t[6]=i,t[7]=d);let f;t[8]===r?f=t[9]:(f=l(`bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-xl p-4 text-sm ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none`,r),t[8]=r,t[9]=f);let p;t[10]===c?p=t[11]:(p=c&&(0,R.jsxs)(k,{"data-slot":`dialog-close`,render:(0,R.jsx)(o,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,R.jsx)(u,{}),(0,R.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[10]=c,t[11]=p);let m;t[12]!==n||t[13]!==a||t[14]!==f||t[15]!==p?(m=(0,R.jsxs)(D,{"data-slot":`dialog-content`,className:f,...a,children:[n,p]}),t[12]=n,t[13]=a,t[14]=f,t[15]=p,t[16]=m):m=t[16];let h;return t[17]!==d||t[18]!==m?(h=(0,R.jsxs)(V,{children:[d,m]}),t[17]=d,t[18]=m,t[19]=h):h=t[19],h}function W(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`gap-2 flex flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(`div`,{"data-slot":`dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function G(e){let t=(0,L.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,showCloseButton:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let s=a===void 0?!1:a,c;t[5]===r?c=t[6]:(c=l(`bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,r),t[5]=r,t[6]=c);let u;t[7]===s?u=t[8]:(u=s&&(0,R.jsx)(k,{render:(0,R.jsx)(o,{variant:`outline`}),children:`Close`}),t[7]=s,t[8]=u);let d;return t[9]!==n||t[10]!==i||t[11]!==c||t[12]!==u?(d=(0,R.jsxs)(`div`,{"data-slot":`dialog-footer`,className:c,...i,children:[n,u]}),t[9]=n,t[10]=i,t[11]=c,t[12]=u,t[13]=d):d=t[13],d}function K(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`text-sm leading-none font-medium`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(M,{"data-slot":`dialog-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function q(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(T,{"data-slot":`dialog-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function J(e){let t=(0,L.c)(27),{mutationFn:n,queryKey:r,optimisticUpdate:i,onSuccess:a,onError:o,successMessage:s,errorMessage:c}=e,l=x(),u;t[0]!==c||t[1]!==o||t[2]!==l||t[3]!==r?(u=(e,t,n)=>{n?.previousData!==void 0&&l.setQueryData(r,n.previousData);let i=c??(e.message?e.message:`Operation failed`);S.error(i),o?.(e,t)},t[0]=c,t[1]=o,t[2]=l,t[3]=r,t[4]=u):u=t[4];let d;t[5]!==i||t[6]!==l||t[7]!==r?(d=async e=>{await l.cancelQueries({queryKey:r});let t=l.getQueryData(r);return t!==void 0&&l.setQueryData(r,t=>t===void 0?t:i(t,e)),{previousData:t}},t[5]=i,t[6]=l,t[7]=r,t[8]=d):d=t[8];let f;t[9]!==l||t[10]!==r?(f=()=>{l.invalidateQueries({queryKey:r})},t[9]=l,t[10]=r,t[11]=f):f=t[11];let p;t[12]!==a||t[13]!==s?(p=(e,t)=>{s&&S.success(s),a?.(e,t)},t[12]=a,t[13]=s,t[14]=p):p=t[14];let m;t[15]!==n||t[16]!==u||t[17]!==d||t[18]!==f||t[19]!==p?(m={mutationFn:n,onError:u,onMutate:d,onSettled:f,onSuccess:p},t[15]=n,t[16]=u,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h=F(m),g=h.mutate,_=h.mutateAsync,v;return t[21]!==h.isError||t[22]!==h.isPending||t[23]!==h.isSuccess||t[24]!==g||t[25]!==_?(v={isError:h.isError,isPending:h.isPending,isSuccess:h.isSuccess,mutate:g,mutateAsync:_},t[21]=h.isError,t[22]=h.isPending,t[23]=h.isSuccess,t[24]=g,t[25]=_,t[26]=v):v=t[26],v}function Y({mutationFn:e,queryKey:t,itemId:n,getId:r=e=>e.id,onSuccess:i,onError:a,successMessage:o,errorMessage:s=`Failed to delete`}){return J({errorMessage:s,mutationFn:async()=>e(),onError:a?e=>a(e):void 0,onSuccess:i?e=>i(e):void 0,optimisticUpdate:e=>e.filter(e=>r(e)!==n),queryKey:t,successMessage:o})}function X(e){let t=(0,L.c)(10),{mutationFn:n,queryKey:r,createOptimisticItem:i,onSuccess:a,onError:o,successMessage:s,errorMessage:c}=e,l;t[0]===i?l=t[1]:(l=(e,t)=>[...e,i(t)],t[0]=i,t[1]=l);let u;return t[2]!==c||t[3]!==n||t[4]!==o||t[5]!==a||t[6]!==r||t[7]!==s||t[8]!==l?(u={errorMessage:c,mutationFn:n,onError:o,onSuccess:a,optimisticUpdate:l,queryKey:r,successMessage:s},t[2]=c,t[3]=n,t[4]=o,t[5]=a,t[6]=r,t[7]=s,t[8]=l,t[9]=u):u=t[9],J(u)}export{q as a,K as c,U as i,B as l,Y as n,G as o,z as r,W as s,X as t,F as u};
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{A as r,C as i,E as a,O as o,S as s,T as c,_ as l,b as u,c as d,g as f,k as p,o as m,s as h,w as g}from"./removable-BfDesq3B.js";import{G as _,U as v}from"./index-CbFJKkNs.js";var y=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=h(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),x(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return S(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return S(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!c(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&C(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let a=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||a!==this.#p)&&this.#v(a)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return T(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u)),t}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(f||this.#r.isStale||!l(e))return;let t=o(this.#r.dataUpdatedAt,e)+1;this.#d=p.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(f||i(this.options.enabled,this.#t)===!1||!l(this.#p)||this.#p===0)&&(this.#f=p.setInterval(()=>{(this.options.refetchIntervalInBackground||d.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(p.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(p.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,a=this.#r,o=this.#i,c=this.#a,l=e===n?this.#n:e.state,{state:u}=e,d={...u},f=!1,p;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&x(e,t),o=i&&C(e,n,t,r);(a||o)&&(d={...d,..._(u.data,e.options)}),t._optimisticResults===`isRestoring`&&(d.fetchStatus=`idle`)}let{error:m,errorUpdatedAt:g,status:v}=d;p=d.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&v===`pending`){let e;a?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=a.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(v=`success`,p=s(a?.data,e,t),f=!0)}if(t.select&&p!==void 0&&!y)if(a&&p===o?.data&&t.select===this.#c)p=this.#l;else try{this.#c=t.select,p=t.select(p),p=s(a?.data,p,t),this.#l=p,this.#s=null}catch(e){this.#s=e}this.#s&&(m=this.#s,p=this.#l,g=Date.now(),v=`error`);let b=d.fetchStatus===`fetching`,S=v===`pending`,T=v===`error`,E=S&&b,D=p!==void 0,O={status:v,fetchStatus:d.fetchStatus,isPending:S,isSuccess:v===`success`,isError:T,isInitialLoading:E,isLoading:E,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:b,isRefetching:b&&!S,isLoadingError:T&&!D,isPaused:d.fetchStatus===`paused`,isPlaceholderData:f,isRefetchError:T&&D,isStale:w(e,t),refetch:this.refetch,promise:this.#o,isEnabled:i(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},a=()=>{i(this.#o=O.promise=h())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||O.data!==o.value)&&a();break;case`rejected`:(!r||O.error!==o.reason)&&a();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!c(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){m.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function b(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function x(e,t){return b(e,t)||e.state.data!==void 0&&S(e,t,t.refetchOnMount)}function S(e,t,n){if(i(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&w(e,t)}return!1}function C(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&w(e,n)}function w(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}function T(e,t){return!c(e.getCurrentResult(),t)}var E=e(t(),1),D=E.createContext(!1),O=()=>E.useContext(D);D.Provider,n();function k(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var A=E.createContext(k()),j=()=>E.useContext(A),M=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?a(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},N=e=>{E.useEffect(()=>{e.clearReset()},[e])},P=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||a(n,[e.error,r])),F=(e,t)=>t.state.data===void 0,I=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},L=(e,t)=>e.isLoading&&e.isFetching&&!t,R=(e,t)=>e?.suspense&&t.isPending,z=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function B(e,t,n){let r=O(),i=j(),a=v(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,I(o),M(o,i,s),N(i);let c=!a.getQueryCache().get(o.queryHash),[l]=E.useState(()=>new t(a,o)),d=l.getOptimisticResult(o),p=!r&&e.subscribed!==!1;if(E.useSyncExternalStore(E.useCallback(e=>{let t=p?l.subscribe(m.batchCalls(e)):u;return l.updateResult(),t},[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),E.useEffect(()=>{l.setOptions(o)},[o,l]),R(o,d))throw z(o,l,i);if(P({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!f&&L(d,r)&&(c?z(o,l,i):s?.promise)?.catch(u).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?d:l.trackResult(d)}export{F as n,y as r,B as t};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{A as r,C as i,E as a,O as o,S as s,T as c,_ as l,b as u,c as d,g as f,k as p,o as m,s as h,w as g}from"./removable-BfDesq3B.js";import{G as _,U as v}from"./index-DthpwdlN.js";var y=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=h(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),x(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return S(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return S(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!c(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&C(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let a=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||a!==this.#p)&&this.#v(a)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return T(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u)),t}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(f||this.#r.isStale||!l(e))return;let t=o(this.#r.dataUpdatedAt,e)+1;this.#d=p.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(f||i(this.options.enabled,this.#t)===!1||!l(this.#p)||this.#p===0)&&(this.#f=p.setInterval(()=>{(this.options.refetchIntervalInBackground||d.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(p.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(p.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,a=this.#r,o=this.#i,c=this.#a,l=e===n?this.#n:e.state,{state:u}=e,d={...u},f=!1,p;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&x(e,t),o=i&&C(e,n,t,r);(a||o)&&(d={...d,..._(u.data,e.options)}),t._optimisticResults===`isRestoring`&&(d.fetchStatus=`idle`)}let{error:m,errorUpdatedAt:g,status:v}=d;p=d.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&v===`pending`){let e;a?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=a.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(v=`success`,p=s(a?.data,e,t),f=!0)}if(t.select&&p!==void 0&&!y)if(a&&p===o?.data&&t.select===this.#c)p=this.#l;else try{this.#c=t.select,p=t.select(p),p=s(a?.data,p,t),this.#l=p,this.#s=null}catch(e){this.#s=e}this.#s&&(m=this.#s,p=this.#l,g=Date.now(),v=`error`);let b=d.fetchStatus===`fetching`,S=v===`pending`,T=v===`error`,E=S&&b,D=p!==void 0,O={status:v,fetchStatus:d.fetchStatus,isPending:S,isSuccess:v===`success`,isError:T,isInitialLoading:E,isLoading:E,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:b,isRefetching:b&&!S,isLoadingError:T&&!D,isPaused:d.fetchStatus===`paused`,isPlaceholderData:f,isRefetchError:T&&D,isStale:w(e,t),refetch:this.refetch,promise:this.#o,isEnabled:i(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},a=()=>{i(this.#o=O.promise=h())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||O.data!==o.value)&&a();break;case`rejected`:(!r||O.error!==o.reason)&&a();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!c(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){m.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function b(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function x(e,t){return b(e,t)||e.state.data!==void 0&&S(e,t,t.refetchOnMount)}function S(e,t,n){if(i(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&w(e,t)}return!1}function C(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&w(e,n)}function w(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}function T(e,t){return!c(e.getCurrentResult(),t)}var E=e(t(),1),D=E.createContext(!1),O=()=>E.useContext(D);D.Provider,n();function k(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var A=E.createContext(k()),j=()=>E.useContext(A),M=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?a(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},N=e=>{E.useEffect(()=>{e.clearReset()},[e])},P=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||a(n,[e.error,r])),F=(e,t)=>t.state.data===void 0,I=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},L=(e,t)=>e.isLoading&&e.isFetching&&!t,R=(e,t)=>e?.suspense&&t.isPending,z=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function B(e,t,n){let r=O(),i=j(),a=v(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,I(o),M(o,i,s),N(i);let c=!a.getQueryCache().get(o.queryHash),[l]=E.useState(()=>new t(a,o)),d=l.getOptimisticResult(o),p=!r&&e.subscribed!==!1;if(E.useSyncExternalStore(E.useCallback(e=>{let t=p?l.subscribe(m.batchCalls(e)):u;return l.updateResult(),t},[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),E.useEffect(()=>{l.setOptions(o)},[o,l]),R(o,d))throw z(o,l,i);if(P({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!f&&L(d,r)&&(c?z(o,l,i):s?.promise)?.catch(u).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?d:l.trackResult(d)}export{F as n,y as r,B as t};
@@ -0,0 +1 @@
1
+ import{r as e,t}from"./useBaseQuery-Bwqdm4hJ.js";function n(n,r){return t(n,e,r)}export{n as t};
@@ -0,0 +1 @@
1
+ import{n as e,r as t,t as n}from"./useBaseQuery-Bwqdm4hJ.js";function r(r,i){return n({...r,enabled:!0,suspense:!0,throwOnError:e,placeholderData:void 0},t,i)}export{r as t};
@@ -18,7 +18,7 @@
18
18
  }
19
19
  })();
20
20
  </script>
21
- <script type="module" crossorigin src="/assets/index-CbFJKkNs.js"></script>
21
+ <script type="module" crossorigin src="/assets/index-DthpwdlN.js"></script>
22
22
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-DG_AJzB_.js">
23
23
  <link rel="modulepreload" crossorigin href="/assets/useRouterState-DpT8luFk.js">
24
24
  <link rel="modulepreload" crossorigin href="/assets/link-Cgvqhh5w.js">
@@ -39,7 +39,7 @@
39
39
  <link rel="modulepreload" crossorigin href="/assets/schemas-MsKXD_XQ.js">
40
40
  <link rel="modulepreload" crossorigin href="/assets/src-DCIPwIx0.js">
41
41
  <link rel="modulepreload" crossorigin href="/assets/organization-permissions-BQQ5PJbI.js">
42
- <link rel="stylesheet" crossorigin href="/assets/index-CqvU4VXr.css">
42
+ <link rel="stylesheet" crossorigin href="/assets/index-DGnxvx_K.css">
43
43
  </head>
44
44
  <body>
45
45
  <div id="root"></div>