@onequery/cli 0.1.62-win32-x64 → 0.1.63-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 (173) 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/aarch64-apple-darwin/runtime/dashboard/assets/IconTerminal2-PxNqcz3d.js +1 -0
  4. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/_authenticated-CeN4Gcz4.js → aarch64-apple-darwin/runtime/dashboard/assets/_authenticated-CcSc_Pt7.js} +1 -1
  5. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/_org_slug-Bx7RRX8m.js → aarch64-apple-darwin/runtime/dashboard/assets/_org_slug-BvJDit6U.js} +1 -1
  6. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/audit-DYFxwKYW.js → aarch64-apple-darwin/runtime/dashboard/assets/audit-CdPU9Jf2.js} +1 -1
  7. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/budget-efuiCQwt.js → aarch64-apple-darwin/runtime/dashboard/assets/budget-CX5MplAP.js} +1 -1
  8. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/callback-0MQtger7.js → aarch64-apple-darwin/runtime/dashboard/assets/callback-BWQ3ETBy.js} +1 -1
  9. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/connect-database-v_spfhVx.js → aarch64-apple-darwin/runtime/dashboard/assets/connect-database-C1Jb2l53.js} +1 -1
  10. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/create-org-BYswkAvi.js → aarch64-apple-darwin/runtime/dashboard/assets/create-org-BSzKv5ue.js} +1 -1
  11. package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/data-source-connection-form-CbDL0cgG.js +273 -0
  12. package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/device-Bbz7apAX.js +1 -0
  13. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/dropdown-menu-B7XsQ055.js → aarch64-apple-darwin/runtime/dashboard/assets/dropdown-menu-Cw2MW0pD.js} +1 -1
  14. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/home-DXFqJtr0.js → aarch64-apple-darwin/runtime/dashboard/assets/home-BNjpNKdt.js} +1 -1
  15. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/index-CzO2VlPF.js → aarch64-apple-darwin/runtime/dashboard/assets/index-CXR0dKJj.js} +2 -2
  16. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/integrations-BmNrymMN.js → aarch64-apple-darwin/runtime/dashboard/assets/integrations-BWC7iPQ5.js} +1 -1
  17. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/invite._invitationId-CbHBukr7.js → aarch64-apple-darwin/runtime/dashboard/assets/invite._invitationId-DmJnR4R5.js} +1 -1
  18. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/routes-BU9HpXEH.js → aarch64-apple-darwin/runtime/dashboard/assets/routes-CxJ2aoMf.js} +1 -1
  19. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/signin-Bh2rs3iR.js → aarch64-apple-darwin/runtime/dashboard/assets/signin-BgfqB9QB.js} +1 -1
  20. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/team-CJiJQnH5.js → aarch64-apple-darwin/runtime/dashboard/assets/team-CYPsHFTt.js} +1 -1
  21. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/theme-toggle-DuLiHT8m.js → aarch64-apple-darwin/runtime/dashboard/assets/theme-toggle-CRaDbyxE.js} +1 -1
  22. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/use-optimistic-mutation-ltpcuxqj.js → aarch64-apple-darwin/runtime/dashboard/assets/use-optimistic-mutation-3PPnMc-O.js} +1 -1
  23. package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/useBaseQuery-Da78x9do.js → aarch64-apple-darwin/runtime/dashboard/assets/useBaseQuery-CO5Q8xm4.js} +1 -1
  24. package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/useQuery-DyOxsY45.js +1 -0
  25. package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/useSuspenseQuery-CBFRU4At.js +1 -0
  26. package/vendor/aarch64-apple-darwin/runtime/dashboard/images/google-search-console/step1_confirm_property.png +0 -0
  27. package/vendor/aarch64-apple-darwin/runtime/dashboard/images/google-search-console/step2_scope_selected.png +0 -0
  28. package/vendor/aarch64-apple-darwin/runtime/dashboard/images/google-search-console/step3_copy_access_token.png +0 -0
  29. package/vendor/aarch64-apple-darwin/runtime/dashboard/images/vercel/step1_tokens_page.png +0 -0
  30. package/vendor/aarch64-apple-darwin/runtime/dashboard/images/vercel/step2_configure_token.png +0 -0
  31. package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/index.html +1 -1
  32. package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/server/onequery-server.mjs +3632 -621
  33. package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/IconTerminal2-B6A2_8s9.js +0 -1
  34. package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/data-source-connection-form-CJxEArZ_.js +0 -231
  35. package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/device-DVPbm2ZJ.js +0 -1
  36. package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/useQuery-Cu-8Z6op.js +0 -1
  37. package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/useSuspenseQuery-7OqrCVKL.js +0 -1
  38. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/CompositeItem-BB408Cyb.js +0 -0
  39. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/CompositeList-DbbDW_rT.js +0 -0
  40. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/DialogTitle-ChNkcIa6.js +0 -0
  41. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconArrowRight-DsOD7mDl.js +0 -0
  42. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconCheck-Gc24xPT2.js +0 -0
  43. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconChevronDown-B-39MA7-.js +0 -0
  44. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconChevronRight-DD16tNHZ.js +0 -0
  45. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconCoins-C7Nn0L6R.js +0 -0
  46. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconHistory-DuLS8PKF.js +0 -0
  47. /package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/IconLoader2-0wRUrt7h.js → aarch64-apple-darwin/runtime/dashboard/assets/IconLoader2-BpZcTuHV.js} +0 -0
  48. /package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/IconPlus-C2A-IVFH.js → aarch64-apple-darwin/runtime/dashboard/assets/IconPlus-CZiRiEUF.js} +0 -0
  49. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconX-rRpRFwc5.js +0 -0
  50. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/Separator-M05FshHx.js +0 -0
  51. /package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/alert-8GsJA6Gl.js → aarch64-apple-darwin/runtime/dashboard/assets/alert-BIGxI3XN.js} +0 -0
  52. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/api-base-url-DIb6qukm.js +0 -0
  53. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/api-client-tp8XTpAa.js +0 -0
  54. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/api-paths-DcYkf-C_.js +0 -0
  55. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/app-routes-CMyon6Em.js +0 -0
  56. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/auth-bootstrap-query-B1MHd_NV.js +0 -0
  57. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/auth-client-D-YHMy0G.js +0 -0
  58. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/avatar-SaFoLofF.js +0 -0
  59. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/badge-BFPkSrVD.js +0 -0
  60. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/card-Dllm2lhp.js +0 -0
  61. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/checkbox-Bii9Pcrx.js +0 -0
  62. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/compiler-runtime-DCc3R3Xn.js +0 -0
  63. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/copy-button-BO1KBdf9.js +0 -0
  64. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/createReactComponent-_L2mp4Ui.js +0 -0
  65. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/dist-BNi06Dzx.js +0 -0
  66. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/empty-DjRo5ytz.js +0 -0
  67. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/format-date-Rg05aHXh.js +0 -0
  68. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/getDisabledMountTransitionStyles-C0uz3iMh.js +0 -0
  69. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/getPseudoElementBounds-CRlxTrfr.js +0 -0
  70. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/index-B4OsjuJp.css +0 -0
  71. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/input-BRu0b1Tq.js +0 -0
  72. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  73. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  74. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  75. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  76. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  77. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  78. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  79. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/jsx-runtime-DG_AJzB_.js +0 -0
  80. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/label-f2wVZcni.js +0 -0
  81. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/link-Cgvqhh5w.js +0 -0
  82. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/matchContext-CDajBC0L.js +0 -0
  83. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/organization-permissions-BXV_ess0.js +0 -0
  84. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/organization-query-keys-ieaSNxMR.js +0 -0
  85. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/query-CY--GYXb.js +0 -0
  86. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/query-timing-YBkSOxxF.js +0 -0
  87. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/queryOptions-bXtOUR_h.js +0 -0
  88. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/schemas-EcBBwCo1.js +0 -0
  89. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/select-yNaL0SXM.js +0 -0
  90. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/separator-BH7Gsum-.js +0 -0
  91. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/settings-C8us2bWX.js +0 -0
  92. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/src-C5F1uEDb.js +0 -0
  93. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/textarea-CnA77PLS.js +0 -0
  94. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useBaseUiId-CtNp109T.js +0 -0
  95. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useCompositeItem-D243hyne.js +0 -0
  96. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useControlled-C-85HRFr.js +0 -0
  97. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useRender-CzpKCg11.js +0 -0
  98. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useRouterState-DpT8luFk.js +0 -0
  99. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useValueChanged-BNrgSVVM.js +0 -0
  100. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/utils-C8DGLIgm.js +0 -0
  101. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/xstate-react.esm-Bo3CCIRt.js +0 -0
  102. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/zod-D0PWrP9q.js +0 -0
  103. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/favicon.ico +0 -0
  104. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/amplitude/step1_settings_sidebar.png +0 -0
  105. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/amplitude/step2_projects.png +0 -0
  106. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/amplitude/step3_project_keys.png +0 -0
  107. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/amplitude/step4_api_keys.png +0 -0
  108. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/bigquery/step1_service_accounts.png +0 -0
  109. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/bigquery/step2_bigquery_roles.png +0 -0
  110. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/bigquery/step3_add_key_menu.png +0 -0
  111. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/bigquery/step4_create_json_key.png +0 -0
  112. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/cloudflare-workers-observability/step2_enable_workers_logs.png +0 -0
  113. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/cloudflare-workers-observability/step3_user_api_tokens.png +0 -0
  114. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/cloudflare-workers-observability/step4_create_api_token.png +0 -0
  115. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/cloudflare-workers-observability/step5_workers_pages_account_id.png +0 -0
  116. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/cloudflare-workers-observability/step6_workers_observability_permission.png +0 -0
  117. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/ga4/step1_service_accounts.png +0 -0
  118. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/ga4/step2_create_json_key.png +0 -0
  119. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/ga4/step3_add_user_viewer.png +0 -0
  120. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/ga4/step4_property_details.png +0 -0
  121. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/github-token-guide/step1_signin.png +0 -0
  122. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/github-token-guide/step2_new_fine_grained_token_sanitized.png +0 -0
  123. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/github-token-guide/step3_permissions_configured_sanitized.png +0 -0
  124. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/github-token-guide/step4_token_created_sanitized.png +0 -0
  125. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/mixpanel/step1_service_accounts.png +0 -0
  126. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/mixpanel/step2_create_service_account.png +0 -0
  127. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/mixpanel/step3_credentials.png +0 -0
  128. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/mixpanel/step4_project_settings.png +0 -0
  129. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/postgresql/step1_create_user.png +0 -0
  130. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/postgresql/step2_connection.png +0 -0
  131. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/posthog/step1_project_settings.png +0 -0
  132. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/posthog/step2_personal_api_keys.png +0 -0
  133. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/posthog/step3_create_key_modal.png +0 -0
  134. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/rds/step1_connect.png +0 -0
  135. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/rds/step2_create_user.png +0 -0
  136. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/rds/step3_grant.png +0 -0
  137. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/rds/step4_info.png +0 -0
  138. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/sentry/step1_personal_tokens.png +0 -0
  139. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/sentry/step2_create_token_permissions.png +0 -0
  140. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/sentry/step3_organization_slug.png +0 -0
  141. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/sentry/step4_project_slug.png +0 -0
  142. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/onequery.svg +0 -0
  143. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260327065242_curious_nightmare.sql +0 -0
  144. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260403103652_slippery_hellfire_club.sql +0 -0
  145. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260403112219_gigantic_namora.sql +0 -0
  146. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260420071232_previous_justin_hammer.sql +0 -0
  147. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260420093157_spooky_cassandra_nova.sql +0 -0
  148. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260420101631_even_ogun.sql +0 -0
  149. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260425110519_smart_amazoness.sql +0 -0
  150. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260428033542_rename_source_query_interface_missing.sql +0 -0
  151. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260430114113_jittery_scorpion.sql +0 -0
  152. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260430135906_flippant_timeslip.sql +0 -0
  153. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260502000100_drop_old_workflow_audit_tables.sql +0 -0
  154. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260503011110_moaning_jack_flag.sql +0 -0
  155. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260514143216_reset_workflow_audit_history.sql +0 -0
  156. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260524081943_colorful_firelord.sql +0 -0
  157. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260327065242_snapshot.json +0 -0
  158. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260403103652_snapshot.json +0 -0
  159. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260403112219_snapshot.json +0 -0
  160. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260420071232_snapshot.json +0 -0
  161. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260420093157_snapshot.json +0 -0
  162. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260420101631_snapshot.json +0 -0
  163. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260425110519_snapshot.json +0 -0
  164. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260428033542_snapshot.json +0 -0
  165. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260430114113_snapshot.json +0 -0
  166. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260430135906_snapshot.json +0 -0
  167. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260503011110_snapshot.json +0 -0
  168. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260524081943_snapshot.json +0 -0
  169. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/_journal.json +0 -0
  170. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/initdb.wasm +0 -0
  171. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/pglite.data +0 -0
  172. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/pglite.wasm +0 -0
  173. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/server/polyglot_sql_wasm_bg.wasm +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,n as s,x as c,y as l}from"./createReactComponent-_L2mp4Ui.js";import{t as u}from"./utils-C8DGLIgm.js";import{c as d,o as f,s as p}from"./select-yNaL0SXM.js";import{n as m,r as h,t as g}from"./checkbox-Bii9Pcrx.js";import{a as _,i as v,n as y,o as b,r as x,t as S}from"./data-source-connection-form-CJxEArZ_.js";import{t as C}from"./IconLoader2-0wRUrt7h.js";import{t as w}from"./IconPlus-C2A-IVFH.js";import{i as T,n as E,r as D,t as O}from"./alert-8GsJA6Gl.js";import{a as ee,c as k,i as A,l as j,n as M,o as N,r as P,s as F,u as te}from"./use-optimistic-mutation-ltpcuxqj.js";import{t as ne}from"./useQuery-Cu-8Z6op.js";import{t as I}from"./useSuspenseQuery-7OqrCVKL.js";import{t as L}from"./queryOptions-bXtOUR_h.js";import{Ct as re,Et as R,ct as ie,i as z}from"./getDisabledMountTransitionStyles-C0uz3iMh.js";import{t as B}from"./useBaseUiId-CtNp109T.js";import{t as V}from"./api-client-tp8XTpAa.js";import{D as H,V as ae,X as U,b as W,q as oe,v as G,x as se,y as ce,z as K}from"./index-CzO2VlPF.js";import{t as le}from"./input-BRu0b1Tq.js";import{d as ue,n as q,r as de,t as fe}from"./dropdown-menu-B7XsQ055.js";import{t as pe}from"./format-date-Rg05aHXh.js";import{a as me,n as he,o as ge,r as _e,t as ve}from"./card-Dllm2lhp.js";import{t as ye}from"./badge-BFPkSrVD.js";function J(e){return e}var be=r(),Y=e(t(),1),X=n();function Z(e){let t=(0,be.c)(13),[n,r]=(0,Y.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,X.jsx)(j,{render:e.children}),t[2]=e.children,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsxs)(F,{children:[(0,X.jsx)(k,{children:`Add Data Source`}),(0,X.jsx)(ee,{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,X.jsxs)(A,{className:`sm:max-w-[720px] max-h-[85vh] overflow-y-auto overflow-x-hidden`,children:[s,(0,X.jsx)(S,{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,X.jsxs)(P,{open:n,onOpenChange:r,children:[o,c]}),t[9]=n,t[10]=o,t[11]=c,t[12]=l):l=t[12],l}var Q=180,$=/\b(api[-_ ]?key|authorization|bearer|cookie|password|secret|token)\b|-----BEGIN/i;function xe(e,t){let n=t?.replaceAll(/\s+/g,` `).trim();if(n&&n!==e)return n.length>Q||$.test(n)?`Review the data source settings and try again.`:n}function Se(e){let t=xe(e.title,e.description);return K.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 Ce=V();async function we(e,t){let n=await Ce.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(H(e,`Failed to fetch GitHub repositories`))}return n.json()}function Te(e,t){return L({queryFn:async()=>we(e,t),queryKey:[`github-repositories`,t]})}async function Ee(e,t,n){let r=await Ce.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(H(e,`Failed to update GitHub repositories`))}return r.json()}function De({queryClient:e,organizationId:t,dataSourceId:n,onSuccess:r,onError:i}){let a=Te(t,n);return J({mutationFn:async e=>Ee(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 Oe=Y.createContext(void 0);function ke(){let e=Y.useContext(Oe);if(e===void 0)throw Error(l(53));return e}var Ae=function(e){return e.scrollAreaCornerHeight=`--scroll-area-corner-height`,e.scrollAreaCornerWidth=`--scroll-area-corner-width`,e}({});function je(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 Me=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}({}),Ne=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}({}),Pe={hasOverflowX:e=>e?{[Ne.hasOverflowX]:``}:null,hasOverflowY:e=>e?{[Ne.hasOverflowY]:``}:null,overflowXStart:e=>e?{[Ne.overflowXStart]:``}:null,overflowXEnd:e=>e?{[Ne.overflowXEnd]:``}:null,overflowYStart:e=>e?{[Ne.overflowYStart]:``}:null,overflowYEnd:e=>e?{[Ne.overflowYEnd]:``}:null,cornerHidden:()=>null},Fe={x:0,y:0},Ie={width:0,height:0},Le={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Re={x:!1,y:!1,corner:!1},ze=Y.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,...s}=e,c=Be(i),l=B(),u=R(),p=R(),{nonce:m,disableStyleElements:h}=f(),[g,_]=Y.useState(!1),[v,y]=Y.useState(!1),[b,x]=Y.useState(!1),[S,C]=Y.useState(!1),[w,T]=Y.useState(Ie),[E,D]=Y.useState(Ie),[O,ee]=Y.useState(Le),[k,A]=Y.useState(Re),j=Y.useRef(null),M=Y.useRef(null),N=Y.useRef(null),P=Y.useRef(null),F=Y.useRef(null),te=Y.useRef(null),ne=Y.useRef(null),I=Y.useRef(!1),L=Y.useRef(0),re=Y.useRef(0),z=Y.useRef(0),V=Y.useRef(0),H=Y.useRef(`vertical`),ae=Y.useRef(Fe),U=a(e=>{let t=e.x-ae.current.x,n=e.y-ae.current.y;ae.current=e,n!==0&&(x(!0),u.start(500,()=>{x(!1)})),t!==0&&(y(!0),p.start(500,()=>{y(!1)}))}),W=a(e=>{e.button===0&&(I.current=!0,L.current=e.clientY,re.current=e.clientX,H.current=e.currentTarget.getAttribute(Me.orientation),M.current&&(z.current=M.current.scrollTop,V.current=M.current.scrollLeft),F.current&&H.current===`vertical`&&F.current.setPointerCapture(e.pointerId),te.current&&H.current===`horizontal`&&te.current.setPointerCapture(e.pointerId))}),oe=a(e=>{if(!I.current)return;let t=e.clientY-L.current,n=e.clientX-re.current;if(M.current){let r=M.current.scrollHeight,i=M.current.clientHeight,a=M.current.scrollWidth,o=M.current.clientWidth;if(F.current&&N.current&&H.current===`vertical`){let n=je(N.current,`padding`,`y`),a=je(F.current,`margin`,`y`),o=F.current.offsetHeight,s=t/(N.current.offsetHeight-o-n-a);M.current.scrollTop=z.current+s*(r-i),e.preventDefault(),x(!0),u.start(500,()=>{x(!1)})}if(te.current&&P.current&&H.current===`horizontal`){let t=je(P.current,`padding`,`x`),r=je(te.current,`margin`,`x`),i=te.current.offsetWidth,s=n/(P.current.offsetWidth-i-t-r);M.current.scrollLeft=V.current+s*(a-o),e.preventDefault(),y(!0),p.start(500,()=>{y(!1)})}}}),G=a(e=>{I.current=!1,F.current&&H.current===`vertical`&&F.current.releasePointerCapture(e.pointerId),te.current&&H.current===`horizontal`&&te.current.releasePointerCapture(e.pointerId)});function se(e){C(e.pointerType===`touch`)}function ce(e){se(e),e.pointerType!==`touch`&&_(ie(j.current,e.target))}let K=Y.useMemo(()=>({hasOverflowX:!k.x,hasOverflowY:!k.y,overflowXStart:O.xStart,overflowXEnd:O.xEnd,overflowYStart:O.yStart,overflowYEnd:O.yEnd,cornerHidden:k.corner}),[k.x,k.y,k.corner,O]),le={role:`presentation`,onPointerEnter:ce,onPointerMove:ce,onPointerDown:se,onPointerLeave(){_(!1)},style:{position:`relative`,[Ae.scrollAreaCornerHeight]:`${w.height}px`,[Ae.scrollAreaCornerWidth]:`${w.width}px`}},ue=o(`div`,e,{state:K,ref:[t,j],props:[le,s],stateAttributesMapping:Pe}),q=Y.useMemo(()=>({handlePointerDown:W,handlePointerMove:oe,handlePointerUp:G,handleScroll:U,cornerSize:w,setCornerSize:T,thumbSize:E,setThumbSize:D,touchModality:S,cornerRef:ne,scrollingX:v,setScrollingX:y,scrollingY:b,setScrollingY:x,hovering:g,setHovering:_,viewportRef:M,rootRef:j,scrollbarYRef:N,scrollbarXRef:P,thumbYRef:F,thumbXRef:te,rootId:l,hiddenState:k,setHiddenState:A,overflowEdges:O,setOverflowEdges:ee,viewportState:K,overflowEdgeThreshold:c}),[W,oe,G,U,w,E,S,v,y,b,x,g,_,l,k,O,K,c]);return(0,X.jsxs)(Oe.Provider,{value:q,children:[!h&&d.getElement(m),ue]})});function Be(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 Ve=Y.createContext(void 0);function He(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 Ue=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}({}),We=!1;function Ge(){We||re||(typeof CSS<`u`&&`registerProperty`in CSS&&[Ue.scrollAreaOverflowXStart,Ue.scrollAreaOverflowXEnd,Ue.scrollAreaOverflowYStart,Ue.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),We=!0)}var Ke=Y.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{viewportRef:s,scrollbarYRef:l,scrollbarXRef:u,thumbYRef:f,thumbXRef:m,cornerRef:h,cornerSize:g,setCornerSize:_,setThumbSize:v,rootId:y,setHiddenState:b,hiddenState:x,handleScroll:S,setHovering:C,setOverflowEdges:w,overflowEdges:T,overflowEdgeThreshold:E}=ke(),D=z(),O=Y.useRef(!0),ee=R(),k=R(),A=a(()=>{let e=s.current,t=l.current,n=u.current,r=f.current,i=m.current,a=h.current;if(!e)return;let o=e.scrollHeight,c=e.scrollWidth,d=e.clientHeight,y=e.clientWidth,x=e.scrollTop,S=e.scrollLeft;if(o===0||c===0)return;let C=d>=o,T=y>=c,O=y/c,ee=d/o,k=Math.max(0,c-y),A=Math.max(0,o-d),j=0,M=0;T||(j=p(D===`rtl`?-S:S,0,k),M=k-j);let N=C?0:p(x,0,A),P=C?0:A-N,F=T?0:y,te=C?0:d,ne=0,I=0;!T&&!C&&(ne=t?.offsetWidth||0,I=n?.offsetHeight||0);let L=g.width===0&&g.height===0,re=L?ne:0,R=L?I:0,ie=je(n,`padding`,`x`),z=je(t,`padding`,`y`),B=je(i,`margin`,`x`),V=je(r,`margin`,`y`),H=F-ie-B,ae=te-z-V,U=n?Math.min(n.offsetWidth-re,H):H,W=t?Math.min(t.offsetHeight-R,ae):ae,oe=Math.max(16,U*O),G=Math.max(16,W*ee);if(v(e=>e.height===G&&e.width===oe?e:{width:oe,height:G}),t&&r){let e=t.offsetHeight-G-z-V,n=o-d,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-oe-ie-B,t=c-y,r=t===0?0:S/t,a=D===`rtl`?p(r*e,-e,0):p(r*e,0,e);i.style.transform=`translate3d(${a}px,0,0)`}let se=p(j,0,k),ce=p(M,0,k),K=p(N,0,A),le=p(P,0,A),ue=[[Ue.scrollAreaOverflowXStart,se],[Ue.scrollAreaOverflowXEnd,ce],[Ue.scrollAreaOverflowYStart,K],[Ue.scrollAreaOverflowYEnd,le]];for(let[t,n]of ue)e.style.setProperty(t,`${n}px`);a&&(T||C?_({width:0,height:0}):!T&&!C&&_({width:ne,height:I})),b(e=>{let t=C||T;return e.y===C&&e.x===T&&e.corner===t?e:{y:C,x:T,corner:t}});let q={xStart:!T&&se>E.xStart,xEnd:!T&&ce>E.xEnd,yStart:!C&&K>E.yStart,yEnd:!C&&le>E.yEnd};w(e=>e.xStart===q.xStart&&e.xEnd===q.xEnd&&e.yStart===q.yStart&&e.yEnd===q.yEnd?e:q)});c(()=>{if(!s.current)return;Ge();let e=!1;return He(s.current,()=>{if(!e){e=!0;return}A()})},[A,s]),c(()=>{queueMicrotask(A)},[A,x,D]),c(()=>{s.current?.matches(`:hover`)&&C(!0)},[s,C]),Y.useEffect(()=>{let e=s.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;return}A()});return n.observe(e),k.start(0,()=>{let t=e.getAnimations({subtree:!0});t.length!==0&&Promise.all(t.map(e=>e.finished)).then(A).catch(()=>{})}),()=>{n.disconnect(),k.clear()}},[A,s,k]);function j(){O.current=!1}let M={role:`presentation`,...y&&{"data-id":`${y}-viewport`},...(!x.x||!x.y)&&{tabIndex:0},className:d.className,style:{overflow:`scroll`},onScroll(){s.current&&(A(),O.current||S({x:s.current.scrollLeft,y:s.current.scrollTop}),ee.start(100,()=>{O.current=!0}))},onWheel:j,onTouchMove:j,onPointerMove:j,onPointerEnter:j,onKeyDown:j},N=Y.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]),P=o(`div`,e,{ref:[t,s],state:N,props:[M,i],stateAttributesMapping:Pe}),F=Y.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,X.jsx)(Ve.Provider,{value:F,children:P})}),qe=Y.createContext(void 0);function Je(){let e=Y.useContext(qe);if(e===void 0)throw Error(l(54));return e}var Ye=function(e){return e.scrollAreaThumbHeight=`--scroll-area-thumb-height`,e.scrollAreaThumbWidth=`--scroll-area-thumb-width`,e}({}),Xe=Y.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}=ke(),S=Y.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=z();Y.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=je(g.current,`margin`,`y`),n=je(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=je(_.current,`margin`,`x`),n=je(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(${Ae.scrollAreaCornerHeight})`,insetInlineEnd:0,[Ye.scrollAreaThumbHeight]:`${x.height}px`},...i===`horizontal`&&{insetInlineStart:0,insetInlineEnd:`var(${Ae.scrollAreaCornerWidth})`,bottom:0,[Ye.scrollAreaThumbWidth]:`${x.width}px`}}},T=o(`div`,e,{ref:[t,i===`vertical`?p:m],state:S,props:[w,s],stateAttributesMapping:Pe}),E=Y.useMemo(()=>({orientation:i}),[i]),D=i===`vertical`?d.y:d.x;return a||!D?(0,X.jsx)(qe.Provider,{value:E,children:T}):null}),Ze=Y.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}=ke(),{orientation:p}=Je(),m=Y.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(${Ye.scrollAreaThumbHeight})`},...p===`horizontal`&&{width:`var(${Ye.scrollAreaThumbWidth})`}}},i]})}),Qe=Y.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{cornerRef:a,cornerSize:s,hiddenState:c}=ke(),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 $e(e){let t=(0,be.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=u(`relative`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=(0,X.jsx)(Ke,{"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,X.jsx)(et,{}),c=(0,X.jsx)(Qe,{}),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,X.jsxs)(ze,{"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 et(e){let t=(0,be.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=u(`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,X.jsx)(Ze,{"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,X.jsx)(Xe,{"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 tt(e,t){if(e.length!==t.length)return!0;let n=new Set(e);return t.some(e=>!n.has(e))}function nt(e){let t=(0,be.c)(94),[n,r]=(0,Y.useState)(``),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,Y.useState)(i),c=(0,Y.useRef)(!1),l=ae(),u;t[1]!==e.dataSourceId||t[2]!==e.organizationId?(u=Te(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=ne(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 _=h,v,y;t[11]!==_||t[12]!==e.open||t[13]!==f.data?(v=()=>{if(!e.open){c.current=!1,r(``);return}f.data&&(c.current||=(o(_),!0))},y=[_,e.open,f.data],t[11]=_,t[12]=e.open,t[13]=f.data,t[14]=v,t[15]=y):(v=t[14],y=t[15]),(0,Y.useEffect)(v,y);let b;if(t[16]!==m||t[17]!==n){bb0:{let e=n.trim().toLowerCase();if(!e){b=m;break bb0}b=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]=b}else b=t[18];let x=b,S;t[19]!==_||t[20]!==a?(S=tt(a,_),t[19]=_,t[20]=a,t[21]=S):S=t[21];let w=S,E;t[22]===e?E=t[23]:(E=()=>{K.success(`GitHub repositories updated`),e.onOpenChange(!1)},t[22]=e,t[23]=E);let D;t[24]!==e.dataSourceId||t[25]!==e.organizationId||t[26]!==l||t[27]!==E?(D=De({dataSourceId:e.dataSourceId,onError:it,onSuccess:E,organizationId:e.organizationId,queryClient:l}),t[24]=e.dataSourceId,t[25]=e.organizationId,t[26]=l,t[27]=E,t[28]=D):D=t[28];let O=te(D),j;t[29]===a?j=t[30]:(j=new Set(a),t[29]=a,t[30]=j);let M=j,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,re;t[32]===x?re=t[33]:(re=function(){let e=x.map(rt);o(t=>[...new Set([...t,...e])])},t[32]=x,t[33]=re);let R=re,ie;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){o([])},t[34]=ie):ie=t[34];let z=ie,B=f.isLoading,V=f.isError,H=w&&!O.isPending,U;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,X.jsxs)(F,{children:[(0,X.jsx)(k,{children:`Select GitHub Repositories`}),(0,X.jsx)(ee,{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]=U):U=t[35];let W;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,X.jsx)(T,{size:16,className:`absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`}),t[36]=W):W=t[36];let oe;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(oe=e=>r(e.target.value),t[37]=oe):oe=t[37];let G;t[38]===n?G=t[39]:(G=(0,X.jsxs)(`div`,{className:`relative flex-1`,children:[W,(0,X.jsx)(le,{value:n,onChange:oe,placeholder:`Search repositories...`,className:`pl-9`})]}),t[38]=n,t[39]=G);let se=x.length===0,ce;t[40]!==R||t[41]!==se?(ce=(0,X.jsx)(s,{variant:`outline`,size:`sm`,onClick:R,disabled:se,children:`Select visible`}),t[40]=R,t[41]=se,t[42]=ce):ce=t[42];let ue=a.length===0,q;t[43]===ue?q=t[44]:(q=(0,X.jsx)(s,{variant:`ghost`,size:`sm`,onClick:z,disabled:ue,children:`Clear`}),t[43]=ue,t[44]=q);let de;t[45]!==G||t[46]!==ce||t[47]!==q?(de=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[G,ce,q]}),t[45]=G,t[46]=ce,t[47]=q,t[48]=de):de=t[48];let fe=m.length>0?` • ${m.length} available`:``,pe;t[49]!==a.length||t[50]!==fe?(pe=(0,X.jsxs)(`span`,{children:[a.length,` selected`,fe]}),t[49]=a.length,t[50]=fe,t[51]=pe):pe=t[51];let me;t[52]===w?me=t[53]:(me=w?(0,X.jsx)(ye,{variant:`outline`,children:`Unsaved`}):null,t[52]=w,t[53]=me);let he;t[54]!==pe||t[55]!==me?(he=(0,X.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[pe,me]}),t[54]=pe,t[55]=me,t[56]=he):he=t[56];let ge;t[57]===B?ge=t[58]:(ge=B?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-12 text-muted-foreground`,children:(0,X.jsx)(C,{size:24,className:`animate-spin`})}):null,t[57]=B,t[58]=ge);let _e;t[59]===V?_e=t[60]:(_e=V?(0,X.jsx)(`p`,{className:`text-sm text-destructive`,children:`Unable to load repositories. Please try again.`}):null,t[59]=V,t[60]=_e);let ve;t[61]!==x||t[62]!==V||t[63]!==B||t[64]!==M?(ve=!B&&!V?(0,X.jsx)($e,{className:`h-[320px] rounded-md border`,children:(0,X.jsxs)(`div`,{className:`p-2 space-y-1`,children:[x.length===0?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground px-3 py-6 text-center`,children:`No repositories found.`}):null,x.map(e=>(0,X.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,X.jsx)(g,{checked:M.has(e.fullName),onCheckedChange:()=>L(e.fullName)}),(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.fullName}),e.private?(0,X.jsx)(ye,{variant:`secondary`,children:`Private`}):null]}),(0,X.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Owner: `,e.owner]})]})]},e.id))]})}):null,t[61]=x,t[62]=V,t[63]=B,t[64]=M,t[65]=ve):ve=t[65];let J;t[66]!==de||t[67]!==he||t[68]!==ge||t[69]!==_e||t[70]!==ve?(J=(0,X.jsxs)(`div`,{className:`space-y-3`,children:[de,he,ge,_e,ve]}),t[66]=de,t[67]=he,t[68]=ge,t[69]=_e,t[70]=ve,t[71]=J):J=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]!==O.isPending?(Q=(0,X.jsx)(s,{variant:`outline`,onClick:Z,disabled:O.isPending,children:`Cancel`}),t[74]=Z,t[75]=O.isPending,t[76]=Q):Q=t[76];let $;t[77]!==a||t[78]!==O?($=()=>O.mutate({repositories:a}),t[77]=a,t[78]=O,t[79]=$):$=t[79];let xe=!H,Se=O.isPending?`Saving...`:`Save`,Ce;t[80]!==$||t[81]!==xe||t[82]!==Se?(Ce=(0,X.jsx)(s,{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,X.jsxs)(N,{children:[Q,Ce]}),t[84]=Q,t[85]=Ce,t[86]=we):we=t[86];let Ee;t[87]!==J||t[88]!==we?(Ee=(0,X.jsxs)(A,{className:`sm:max-w-[680px]`,children:[U,J,we]}),t[87]=J,t[88]=we,t[89]=Ee):Ee=t[89];let Oe;return t[90]!==e.onOpenChange||t[91]!==e.open||t[92]!==Ee?(Oe=(0,X.jsx)(P,{open:e.open,onOpenChange:e.onOpenChange,children:Ee}),t[90]=e.onOpenChange,t[91]=e.open,t[92]=Ee,t[93]=Oe):Oe=t[93],Oe}function rt(e){return e.fullName}function it(e){Se({title:`Failed to update GitHub repositories`,description:e.message})}function at(e){switch(e){case`active`:return`default`;case`error`:return`destructive`;case`disconnected`:return`secondary`;default:return`outline`}}function ot(e){let t=(0,be.c)(4);if(!e.errorMessage)return null;let n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(U,{className:`size-4`}),r=(0,X.jsx)(D,{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,X.jsxs)(O,{variant:`destructive`,className:`mt-3 border-destructive/30 bg-destructive/5`,children:[n,r,(0,X.jsx)(E,{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 st(e){let t=(0,be.c)(83),{dataSource:n,organizationId:r,openGitHubRepositories:i,providers:a}=e,o;t[0]===r?o=t[1]:(o=G(r),t[0]=r,t[1]=o);let c=o.queryKey,[l,u]=(0,Y.useState)(!1),d=(0,Y.useRef)(!1),f,p;t[2]!==n.provider||t[3]!==i?(f=()=>{d.current||i&&n.provider===`github`&&(u(!0),d.current=!0)},p=[n.provider,i],t[2]=n.provider,t[3]=i,t[4]=f,t[5]=p):(f=t[4],p=t[5]),(0,Y.useEffect)(f,p);let g;t[6]!==n.id||t[7]!==r?(g=async()=>se(n.id,r),t[6]=n.id,t[7]=r,t[8]=g):g=t[8];let y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=[`data-sources`],t[9]=y):y=t[9];let S;t[10]===g?S=t[11]:(S={mutationFn:g,mutationKey:y,onError:lt,onSuccess:ct},t[10]=g,t[11]=S);let C=te(S),w;t[12]!==n.id||t[13]!==r?(w=async()=>ce(n.id,r),t[12]=n.id,t[13]=r,t[14]=w):w=t[14];let T;t[15]!==n.id||t[16]!==c||t[17]!==w?(T={errorMessage:`Failed to delete data source`,itemId:n.id,mutationFn:w,queryKey:c,successMessage:`Data source deleted`},t[15]=n.id,t[16]=c,t[17]=w,t[18]=T):T=t[18];let E=M(T),D;t[19]===n.provider?D=t[20]:(D=b(n.provider),t[19]=n.provider,t[20]=D);let O=D,ee;t[21]!==n.provider||t[22]!==a?(ee=v(n.provider,a),t[21]=n.provider,t[22]=a,t[23]=ee):ee=t[23];let k=ee,A=k?`Test Connection`:`Test Connection (Unsupported)`,j;t[24]===n.name?j=t[25]:(j=(0,X.jsx)(ge,{className:`text-lg`,children:n.name}),t[24]=n.name,t[25]=j);let N;t[26]===O?N=t[27]:(N=(0,X.jsx)(O,{className:`h-4.5 w-4.5`}),t[26]=O,t[27]=N);let P;t[28]!==n.provider||t[29]!==a?(P=x(n.provider,a),t[28]=n.provider,t[29]=a,t[30]=P):P=t[30];let F;t[31]!==N||t[32]!==P?(F=(0,X.jsxs)(_e,{className:`flex items-center gap-1.5 mt-0.5`,children:[N,P]}),t[31]=N,t[32]=P,t[33]=F):F=t[33];let ne;t[34]!==j||t[35]!==F?(ne=(0,X.jsxs)(`div`,{children:[j,F]}),t[34]=j,t[35]=F,t[36]=ne):ne=t[36];let I;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,X.jsx)(ue,{children:(0,X.jsx)(s,{variant:`ghost`,size:`icon-sm`,children:(0,X.jsx)(h,{size:16,stroke:2})})}),t[37]=I):I=t[37];let L;t[38]===C?L=t[39]:(L=()=>C.mutate(),t[38]=C,t[39]=L);let re=C.isPending||!k,R;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,X.jsx)(oe,{size:16,stroke:2}),t[40]=R):R=t[40];let ie=C.isPending?`Testing...`:A,z;t[41]!==L||t[42]!==re||t[43]!==ie?(z=(0,X.jsxs)(de,{onClick:L,disabled:re,children:[R,ie]}),t[41]=L,t[42]=re,t[43]=ie,t[44]=z):z=t[44];let B;t[45]===n.provider?B=t[46]:(B=n.provider===`github`?(0,X.jsxs)(de,{onClick:()=>u(!0),children:[(0,X.jsx)(_,{size:16,stroke:`2`}),`Select Repositories`]}):null,t[45]=n.provider,t[46]=B);let V;t[47]===E?V=t[48]:(V=()=>E.mutate(),t[47]=E,t[48]=V);let H;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,X.jsx)(m,{size:16,stroke:2}),t[49]=H):H=t[49];let ae=E.isPending?`Deleting...`:`Delete`,U;t[50]!==E.isPending||t[51]!==V||t[52]!==ae?(U=(0,X.jsxs)(de,{onClick:V,disabled:E.isPending,className:`text-destructive focus:text-destructive`,children:[H,ae]}),t[50]=E.isPending,t[51]=V,t[52]=ae,t[53]=U):U=t[53];let W;t[54]!==z||t[55]!==B||t[56]!==U?(W=(0,X.jsxs)(fe,{children:[I,(0,X.jsxs)(q,{align:`end`,className:`min-w-40`,children:[z,B,U]})]}),t[54]=z,t[55]=B,t[56]=U,t[57]=W):W=t[57];let K;t[58]!==ne||t[59]!==W?(K=(0,X.jsxs)(me,{className:`flex flex-row items-start justify-between space-y-0 pb-2`,children:[ne,W]}),t[58]=ne,t[59]=W,t[60]=K):K=t[60];let le;t[61]===n.status?le=t[62]:(le=at(n.status),t[61]=n.status,t[62]=le);let J;t[63]!==n.status||t[64]!==le?(J=(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsx)(ye,{variant:le,children:n.status})}),t[63]=n.status,t[64]=le,t[65]=J):J=t[65];let Z;t[66]===n.lastUsedAt?Z=t[67]:(Z=n.lastUsedAt&&(0,X.jsxs)(`p`,{className:`text-sm text-muted-foreground mt-2`,children:[`Last used: `,pe(n.lastUsedAt)]}),t[66]=n.lastUsedAt,t[67]=Z);let Q;t[68]===n.errorMessage?Q=t[69]:(Q=(0,X.jsx)(ot,{errorMessage:n.errorMessage}),t[68]=n.errorMessage,t[69]=Q);let $;t[70]!==J||t[71]!==Z||t[72]!==Q?($=(0,X.jsxs)(he,{children:[J,Z,Q]}),t[70]=J,t[71]=Z,t[72]=Q,t[73]=$):$=t[73];let xe;t[74]!==n.id||t[75]!==n.provider||t[76]!==r||t[77]!==l?(xe=n.provider===`github`?(0,X.jsx)(nt,{organizationId:r,dataSourceId:n.id,open:l,onOpenChange:u}):null,t[74]=n.id,t[75]=n.provider,t[76]=r,t[77]=l,t[78]=xe):xe=t[78];let Se;return t[79]!==K||t[80]!==$||t[81]!==xe?(Se=(0,X.jsxs)(ve,{children:[K,$,xe]}),t[79]=K,t[80]=$,t[81]=xe,t[82]=Se):Se=t[82],Se}function ct(e){if(e.kind===`unsupported`){K.info(e.message);return}if(e.result.success){K.success(`Data source test successful`);return}Se({title:`Data source test failed`,description:e.result.error??e.result.message??`Unknown error`})}function lt(e){return Se({title:`Failed to test data source`,description:e.message})}function ut(e){return e}function dt(e){let t=(0,be.c)(16),n;t[0]===e.provider.id?n=t[1]:(n=b(e.provider.id),t[0]=e.provider.id,t[1]=n);let r=n,i;t[2]===r?i=t[3]:(i=(0,X.jsx)(r,{className:`h-5 w-5 text-muted-foreground shrink-0`}),t[2]=r,t[3]=i);let a;t[4]===e.provider.label?a=t[5]:(a=(0,X.jsx)(`p`,{className:`font-medium truncate`,children:e.provider.label}),t[4]=e.provider.label,t[5]=a);let o;t[6]!==i||t[7]!==a?(o=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[i,a]}),t[6]=i,t[7]=a,t[8]=o):o=t[8];let c;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(s,{variant:`secondary`,size:`sm`,children:`Connect`}),t[9]=c):c=t[9];let l;t[10]!==e.organizationId||t[11]!==e.provider.id?(l=(0,X.jsx)(Z,{organizationId:e.organizationId,initialProvider:e.provider.id,children:c}),t[10]=e.organizationId,t[11]=e.provider.id,t[12]=l):l=t[12];let u;return t[13]!==o||t[14]!==l?(u=(0,X.jsx)(ve,{className:`border-dashed`,children:(0,X.jsx)(he,{className:`p-4`,children:(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[o,l]})})}),t[13]=o,t[14]=l,t[15]=u):u=t[15],u}function ft(e){let t=(0,be.c)(37),{organizationId:n,openGitHubDataSourceId:r}=e,i;t[0]===n?i=t[1]:(i=G(n),t[0]=n,t[1]=i);let{data:a}=I(i),o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=W(),t[2]=o):o=t[2];let{data:c}=I(o),l=c.providers,u,d,f,p,m,h,g,_;if(t[3]!==a||t[4]!==r||t[5]!==n||t[6]!==l){let e=ut(a),i=new Set(e.map(pt)),o=y(l).filter(e=>!i.has(e.id)),c=e.length>0;h=`space-y-8`;let v;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Connected`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Data sources already connected to your workspace.`})]}),t[15]=v):v=t[15];let b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsxs)(s,{children:[(0,X.jsx)(w,{size:16,stroke:2}),`Add Data Source`]}),t[16]=b):b=t[16],t[17]===n?g=t[18]:(g=(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[v,(0,X.jsx)(Z,{organizationId:n,children:b})]}),t[17]=n,t[18]=g),t[19]===c?_=t[20]:(_=c?null:(0,X.jsxs)(`div`,{className:`text-center py-12`,children:[(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`No connected data sources yet.`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Connect one below or add a new data source to get started.`})]}),t[19]=c,t[20]=_),u=c?(0,X.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>(0,X.jsx)(st,{dataSource:e,organizationId:n,openGitHubRepositories:r===e.id,providers:l},e.id))}):null,p=`space-y-4`,t[21]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Not connected`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Available data sources you can connect next.`})]}),t[21]=m):m=t[21],d=`grid gap-4 md:grid-cols-2 lg:grid-cols-3`;let x;t[22]===n?x=t[23]:(x=e=>(0,X.jsx)(dt,{provider:e,organizationId:n},e.id),t[22]=n,t[23]=x),f=o.map(x),t[3]=a,t[4]=r,t[5]=n,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_}else u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14];let v;t[24]!==d||t[25]!==f?(v=(0,X.jsx)(`div`,{className:d,children:f}),t[24]=d,t[25]=f,t[26]=v):v=t[26];let b;t[27]!==v||t[28]!==p||t[29]!==m?(b=(0,X.jsxs)(`div`,{className:p,children:[m,v]}),t[27]=v,t[28]=p,t[29]=m,t[30]=b):b=t[30];let x;return t[31]!==u||t[32]!==b||t[33]!==h||t[34]!==g||t[35]!==_?(x=(0,X.jsxs)(`div`,{className:h,children:[g,_,u,b]}),t[31]=u,t[32]=b,t[33]=h,t[34]=g,t[35]=_,t[36]=x):x=t[36],x}function pt(e){return e.provider}var mt=i(`/_authenticated/$org_slug/integrations`);function ht(){let e=(0,be.c)(4),{organizationId:t}=mt.useRouteContext(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`section`,{children:(0,X.jsxs)(`div`,{className:`mb-6`,children:[(0,X.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Integrations`}),(0,X.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,X.jsxs)(`div`,{className:`mb-4`,children:[(0,X.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Data Sources`}),(0,X.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,X.jsxs)(`div`,{className:`p-8 space-y-12`,children:[n,(0,X.jsxs)(`section`,{children:[r,(0,X.jsx)(ft,{organizationId:t})]})]}),e[2]=t,e[3]=i),i}var gt=ht;export{gt 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,n as s,x as c,y as l}from"./createReactComponent-_L2mp4Ui.js";import{t as u}from"./utils-C8DGLIgm.js";import{c as d,o as f,s as p}from"./select-yNaL0SXM.js";import{n as m,r as h,t as g}from"./checkbox-Bii9Pcrx.js";import{a as _,i as v,n as y,o as b,r as x,t as S}from"./data-source-connection-form-CbDL0cgG.js";import{t as C}from"./IconLoader2-BpZcTuHV.js";import{t as w}from"./IconPlus-CZiRiEUF.js";import{i as T,n as E,r as D,t as O}from"./alert-BIGxI3XN.js";import{a as ee,c as k,i as A,l as j,n as M,o as N,r as P,s as F,u as te}from"./use-optimistic-mutation-3PPnMc-O.js";import{t as ne}from"./useQuery-DyOxsY45.js";import{t as I}from"./useSuspenseQuery-CBFRU4At.js";import{t as L}from"./queryOptions-bXtOUR_h.js";import{Ct as re,Et as R,ct as ie,i as z}from"./getDisabledMountTransitionStyles-C0uz3iMh.js";import{t as B}from"./useBaseUiId-CtNp109T.js";import{t as V}from"./api-client-tp8XTpAa.js";import{D as H,V as ae,X as U,b as W,q as oe,v as G,x as se,y as ce,z as K}from"./index-CXR0dKJj.js";import{t as le}from"./input-BRu0b1Tq.js";import{d as ue,n as q,r as de,t as fe}from"./dropdown-menu-Cw2MW0pD.js";import{t as pe}from"./format-date-Rg05aHXh.js";import{a as me,n as he,o as ge,r as _e,t as ve}from"./card-Dllm2lhp.js";import{t as ye}from"./badge-BFPkSrVD.js";function J(e){return e}var be=r(),Y=e(t(),1),X=n();function Z(e){let t=(0,be.c)(13),[n,r]=(0,Y.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,X.jsx)(j,{render:e.children}),t[2]=e.children,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsxs)(F,{children:[(0,X.jsx)(k,{children:`Add Data Source`}),(0,X.jsx)(ee,{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,X.jsxs)(A,{className:`sm:max-w-[720px] max-h-[85vh] overflow-y-auto overflow-x-hidden`,children:[s,(0,X.jsx)(S,{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,X.jsxs)(P,{open:n,onOpenChange:r,children:[o,c]}),t[9]=n,t[10]=o,t[11]=c,t[12]=l):l=t[12],l}var Q=180,$=/\b(api[-_ ]?key|authorization|bearer|cookie|password|secret|token)\b|-----BEGIN/i;function xe(e,t){let n=t?.replaceAll(/\s+/g,` `).trim();if(n&&n!==e)return n.length>Q||$.test(n)?`Review the data source settings and try again.`:n}function Se(e){let t=xe(e.title,e.description);return K.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 Ce=V();async function we(e,t){let n=await Ce.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(H(e,`Failed to fetch GitHub repositories`))}return n.json()}function Te(e,t){return L({queryFn:async()=>we(e,t),queryKey:[`github-repositories`,t]})}async function Ee(e,t,n){let r=await Ce.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(H(e,`Failed to update GitHub repositories`))}return r.json()}function De({queryClient:e,organizationId:t,dataSourceId:n,onSuccess:r,onError:i}){let a=Te(t,n);return J({mutationFn:async e=>Ee(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 Oe=Y.createContext(void 0);function ke(){let e=Y.useContext(Oe);if(e===void 0)throw Error(l(53));return e}var Ae=function(e){return e.scrollAreaCornerHeight=`--scroll-area-corner-height`,e.scrollAreaCornerWidth=`--scroll-area-corner-width`,e}({});function je(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 Me=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}({}),Ne=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}({}),Pe={hasOverflowX:e=>e?{[Ne.hasOverflowX]:``}:null,hasOverflowY:e=>e?{[Ne.hasOverflowY]:``}:null,overflowXStart:e=>e?{[Ne.overflowXStart]:``}:null,overflowXEnd:e=>e?{[Ne.overflowXEnd]:``}:null,overflowYStart:e=>e?{[Ne.overflowYStart]:``}:null,overflowYEnd:e=>e?{[Ne.overflowYEnd]:``}:null,cornerHidden:()=>null},Fe={x:0,y:0},Ie={width:0,height:0},Le={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Re={x:!1,y:!1,corner:!1},ze=Y.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,...s}=e,c=Be(i),l=B(),u=R(),p=R(),{nonce:m,disableStyleElements:h}=f(),[g,_]=Y.useState(!1),[v,y]=Y.useState(!1),[b,x]=Y.useState(!1),[S,C]=Y.useState(!1),[w,T]=Y.useState(Ie),[E,D]=Y.useState(Ie),[O,ee]=Y.useState(Le),[k,A]=Y.useState(Re),j=Y.useRef(null),M=Y.useRef(null),N=Y.useRef(null),P=Y.useRef(null),F=Y.useRef(null),te=Y.useRef(null),ne=Y.useRef(null),I=Y.useRef(!1),L=Y.useRef(0),re=Y.useRef(0),z=Y.useRef(0),V=Y.useRef(0),H=Y.useRef(`vertical`),ae=Y.useRef(Fe),U=a(e=>{let t=e.x-ae.current.x,n=e.y-ae.current.y;ae.current=e,n!==0&&(x(!0),u.start(500,()=>{x(!1)})),t!==0&&(y(!0),p.start(500,()=>{y(!1)}))}),W=a(e=>{e.button===0&&(I.current=!0,L.current=e.clientY,re.current=e.clientX,H.current=e.currentTarget.getAttribute(Me.orientation),M.current&&(z.current=M.current.scrollTop,V.current=M.current.scrollLeft),F.current&&H.current===`vertical`&&F.current.setPointerCapture(e.pointerId),te.current&&H.current===`horizontal`&&te.current.setPointerCapture(e.pointerId))}),oe=a(e=>{if(!I.current)return;let t=e.clientY-L.current,n=e.clientX-re.current;if(M.current){let r=M.current.scrollHeight,i=M.current.clientHeight,a=M.current.scrollWidth,o=M.current.clientWidth;if(F.current&&N.current&&H.current===`vertical`){let n=je(N.current,`padding`,`y`),a=je(F.current,`margin`,`y`),o=F.current.offsetHeight,s=t/(N.current.offsetHeight-o-n-a);M.current.scrollTop=z.current+s*(r-i),e.preventDefault(),x(!0),u.start(500,()=>{x(!1)})}if(te.current&&P.current&&H.current===`horizontal`){let t=je(P.current,`padding`,`x`),r=je(te.current,`margin`,`x`),i=te.current.offsetWidth,s=n/(P.current.offsetWidth-i-t-r);M.current.scrollLeft=V.current+s*(a-o),e.preventDefault(),y(!0),p.start(500,()=>{y(!1)})}}}),G=a(e=>{I.current=!1,F.current&&H.current===`vertical`&&F.current.releasePointerCapture(e.pointerId),te.current&&H.current===`horizontal`&&te.current.releasePointerCapture(e.pointerId)});function se(e){C(e.pointerType===`touch`)}function ce(e){se(e),e.pointerType!==`touch`&&_(ie(j.current,e.target))}let K=Y.useMemo(()=>({hasOverflowX:!k.x,hasOverflowY:!k.y,overflowXStart:O.xStart,overflowXEnd:O.xEnd,overflowYStart:O.yStart,overflowYEnd:O.yEnd,cornerHidden:k.corner}),[k.x,k.y,k.corner,O]),le={role:`presentation`,onPointerEnter:ce,onPointerMove:ce,onPointerDown:se,onPointerLeave(){_(!1)},style:{position:`relative`,[Ae.scrollAreaCornerHeight]:`${w.height}px`,[Ae.scrollAreaCornerWidth]:`${w.width}px`}},ue=o(`div`,e,{state:K,ref:[t,j],props:[le,s],stateAttributesMapping:Pe}),q=Y.useMemo(()=>({handlePointerDown:W,handlePointerMove:oe,handlePointerUp:G,handleScroll:U,cornerSize:w,setCornerSize:T,thumbSize:E,setThumbSize:D,touchModality:S,cornerRef:ne,scrollingX:v,setScrollingX:y,scrollingY:b,setScrollingY:x,hovering:g,setHovering:_,viewportRef:M,rootRef:j,scrollbarYRef:N,scrollbarXRef:P,thumbYRef:F,thumbXRef:te,rootId:l,hiddenState:k,setHiddenState:A,overflowEdges:O,setOverflowEdges:ee,viewportState:K,overflowEdgeThreshold:c}),[W,oe,G,U,w,E,S,v,y,b,x,g,_,l,k,O,K,c]);return(0,X.jsxs)(Oe.Provider,{value:q,children:[!h&&d.getElement(m),ue]})});function Be(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 Ve=Y.createContext(void 0);function He(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 Ue=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}({}),We=!1;function Ge(){We||re||(typeof CSS<`u`&&`registerProperty`in CSS&&[Ue.scrollAreaOverflowXStart,Ue.scrollAreaOverflowXEnd,Ue.scrollAreaOverflowYStart,Ue.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),We=!0)}var Ke=Y.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{viewportRef:s,scrollbarYRef:l,scrollbarXRef:u,thumbYRef:f,thumbXRef:m,cornerRef:h,cornerSize:g,setCornerSize:_,setThumbSize:v,rootId:y,setHiddenState:b,hiddenState:x,handleScroll:S,setHovering:C,setOverflowEdges:w,overflowEdges:T,overflowEdgeThreshold:E}=ke(),D=z(),O=Y.useRef(!0),ee=R(),k=R(),A=a(()=>{let e=s.current,t=l.current,n=u.current,r=f.current,i=m.current,a=h.current;if(!e)return;let o=e.scrollHeight,c=e.scrollWidth,d=e.clientHeight,y=e.clientWidth,x=e.scrollTop,S=e.scrollLeft;if(o===0||c===0)return;let C=d>=o,T=y>=c,O=y/c,ee=d/o,k=Math.max(0,c-y),A=Math.max(0,o-d),j=0,M=0;T||(j=p(D===`rtl`?-S:S,0,k),M=k-j);let N=C?0:p(x,0,A),P=C?0:A-N,F=T?0:y,te=C?0:d,ne=0,I=0;!T&&!C&&(ne=t?.offsetWidth||0,I=n?.offsetHeight||0);let L=g.width===0&&g.height===0,re=L?ne:0,R=L?I:0,ie=je(n,`padding`,`x`),z=je(t,`padding`,`y`),B=je(i,`margin`,`x`),V=je(r,`margin`,`y`),H=F-ie-B,ae=te-z-V,U=n?Math.min(n.offsetWidth-re,H):H,W=t?Math.min(t.offsetHeight-R,ae):ae,oe=Math.max(16,U*O),G=Math.max(16,W*ee);if(v(e=>e.height===G&&e.width===oe?e:{width:oe,height:G}),t&&r){let e=t.offsetHeight-G-z-V,n=o-d,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-oe-ie-B,t=c-y,r=t===0?0:S/t,a=D===`rtl`?p(r*e,-e,0):p(r*e,0,e);i.style.transform=`translate3d(${a}px,0,0)`}let se=p(j,0,k),ce=p(M,0,k),K=p(N,0,A),le=p(P,0,A),ue=[[Ue.scrollAreaOverflowXStart,se],[Ue.scrollAreaOverflowXEnd,ce],[Ue.scrollAreaOverflowYStart,K],[Ue.scrollAreaOverflowYEnd,le]];for(let[t,n]of ue)e.style.setProperty(t,`${n}px`);a&&(T||C?_({width:0,height:0}):!T&&!C&&_({width:ne,height:I})),b(e=>{let t=C||T;return e.y===C&&e.x===T&&e.corner===t?e:{y:C,x:T,corner:t}});let q={xStart:!T&&se>E.xStart,xEnd:!T&&ce>E.xEnd,yStart:!C&&K>E.yStart,yEnd:!C&&le>E.yEnd};w(e=>e.xStart===q.xStart&&e.xEnd===q.xEnd&&e.yStart===q.yStart&&e.yEnd===q.yEnd?e:q)});c(()=>{if(!s.current)return;Ge();let e=!1;return He(s.current,()=>{if(!e){e=!0;return}A()})},[A,s]),c(()=>{queueMicrotask(A)},[A,x,D]),c(()=>{s.current?.matches(`:hover`)&&C(!0)},[s,C]),Y.useEffect(()=>{let e=s.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;return}A()});return n.observe(e),k.start(0,()=>{let t=e.getAnimations({subtree:!0});t.length!==0&&Promise.all(t.map(e=>e.finished)).then(A).catch(()=>{})}),()=>{n.disconnect(),k.clear()}},[A,s,k]);function j(){O.current=!1}let M={role:`presentation`,...y&&{"data-id":`${y}-viewport`},...(!x.x||!x.y)&&{tabIndex:0},className:d.className,style:{overflow:`scroll`},onScroll(){s.current&&(A(),O.current||S({x:s.current.scrollLeft,y:s.current.scrollTop}),ee.start(100,()=>{O.current=!0}))},onWheel:j,onTouchMove:j,onPointerMove:j,onPointerEnter:j,onKeyDown:j},N=Y.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]),P=o(`div`,e,{ref:[t,s],state:N,props:[M,i],stateAttributesMapping:Pe}),F=Y.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,X.jsx)(Ve.Provider,{value:F,children:P})}),qe=Y.createContext(void 0);function Je(){let e=Y.useContext(qe);if(e===void 0)throw Error(l(54));return e}var Ye=function(e){return e.scrollAreaThumbHeight=`--scroll-area-thumb-height`,e.scrollAreaThumbWidth=`--scroll-area-thumb-width`,e}({}),Xe=Y.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}=ke(),S=Y.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=z();Y.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=je(g.current,`margin`,`y`),n=je(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=je(_.current,`margin`,`x`),n=je(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(${Ae.scrollAreaCornerHeight})`,insetInlineEnd:0,[Ye.scrollAreaThumbHeight]:`${x.height}px`},...i===`horizontal`&&{insetInlineStart:0,insetInlineEnd:`var(${Ae.scrollAreaCornerWidth})`,bottom:0,[Ye.scrollAreaThumbWidth]:`${x.width}px`}}},T=o(`div`,e,{ref:[t,i===`vertical`?p:m],state:S,props:[w,s],stateAttributesMapping:Pe}),E=Y.useMemo(()=>({orientation:i}),[i]),D=i===`vertical`?d.y:d.x;return a||!D?(0,X.jsx)(qe.Provider,{value:E,children:T}):null}),Ze=Y.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}=ke(),{orientation:p}=Je(),m=Y.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(${Ye.scrollAreaThumbHeight})`},...p===`horizontal`&&{width:`var(${Ye.scrollAreaThumbWidth})`}}},i]})}),Qe=Y.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{cornerRef:a,cornerSize:s,hiddenState:c}=ke(),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 $e(e){let t=(0,be.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=u(`relative`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=(0,X.jsx)(Ke,{"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,X.jsx)(et,{}),c=(0,X.jsx)(Qe,{}),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,X.jsxs)(ze,{"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 et(e){let t=(0,be.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=u(`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,X.jsx)(Ze,{"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,X.jsx)(Xe,{"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 tt(e,t){if(e.length!==t.length)return!0;let n=new Set(e);return t.some(e=>!n.has(e))}function nt(e){let t=(0,be.c)(94),[n,r]=(0,Y.useState)(``),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,Y.useState)(i),c=(0,Y.useRef)(!1),l=ae(),u;t[1]!==e.dataSourceId||t[2]!==e.organizationId?(u=Te(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=ne(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 _=h,v,y;t[11]!==_||t[12]!==e.open||t[13]!==f.data?(v=()=>{if(!e.open){c.current=!1,r(``);return}f.data&&(c.current||=(o(_),!0))},y=[_,e.open,f.data],t[11]=_,t[12]=e.open,t[13]=f.data,t[14]=v,t[15]=y):(v=t[14],y=t[15]),(0,Y.useEffect)(v,y);let b;if(t[16]!==m||t[17]!==n){bb0:{let e=n.trim().toLowerCase();if(!e){b=m;break bb0}b=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]=b}else b=t[18];let x=b,S;t[19]!==_||t[20]!==a?(S=tt(a,_),t[19]=_,t[20]=a,t[21]=S):S=t[21];let w=S,E;t[22]===e?E=t[23]:(E=()=>{K.success(`GitHub repositories updated`),e.onOpenChange(!1)},t[22]=e,t[23]=E);let D;t[24]!==e.dataSourceId||t[25]!==e.organizationId||t[26]!==l||t[27]!==E?(D=De({dataSourceId:e.dataSourceId,onError:it,onSuccess:E,organizationId:e.organizationId,queryClient:l}),t[24]=e.dataSourceId,t[25]=e.organizationId,t[26]=l,t[27]=E,t[28]=D):D=t[28];let O=te(D),j;t[29]===a?j=t[30]:(j=new Set(a),t[29]=a,t[30]=j);let M=j,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,re;t[32]===x?re=t[33]:(re=function(){let e=x.map(rt);o(t=>[...new Set([...t,...e])])},t[32]=x,t[33]=re);let R=re,ie;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){o([])},t[34]=ie):ie=t[34];let z=ie,B=f.isLoading,V=f.isError,H=w&&!O.isPending,U;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,X.jsxs)(F,{children:[(0,X.jsx)(k,{children:`Select GitHub Repositories`}),(0,X.jsx)(ee,{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]=U):U=t[35];let W;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,X.jsx)(T,{size:16,className:`absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`}),t[36]=W):W=t[36];let oe;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(oe=e=>r(e.target.value),t[37]=oe):oe=t[37];let G;t[38]===n?G=t[39]:(G=(0,X.jsxs)(`div`,{className:`relative flex-1`,children:[W,(0,X.jsx)(le,{value:n,onChange:oe,placeholder:`Search repositories...`,className:`pl-9`})]}),t[38]=n,t[39]=G);let se=x.length===0,ce;t[40]!==R||t[41]!==se?(ce=(0,X.jsx)(s,{variant:`outline`,size:`sm`,onClick:R,disabled:se,children:`Select visible`}),t[40]=R,t[41]=se,t[42]=ce):ce=t[42];let ue=a.length===0,q;t[43]===ue?q=t[44]:(q=(0,X.jsx)(s,{variant:`ghost`,size:`sm`,onClick:z,disabled:ue,children:`Clear`}),t[43]=ue,t[44]=q);let de;t[45]!==G||t[46]!==ce||t[47]!==q?(de=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[G,ce,q]}),t[45]=G,t[46]=ce,t[47]=q,t[48]=de):de=t[48];let fe=m.length>0?` • ${m.length} available`:``,pe;t[49]!==a.length||t[50]!==fe?(pe=(0,X.jsxs)(`span`,{children:[a.length,` selected`,fe]}),t[49]=a.length,t[50]=fe,t[51]=pe):pe=t[51];let me;t[52]===w?me=t[53]:(me=w?(0,X.jsx)(ye,{variant:`outline`,children:`Unsaved`}):null,t[52]=w,t[53]=me);let he;t[54]!==pe||t[55]!==me?(he=(0,X.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[pe,me]}),t[54]=pe,t[55]=me,t[56]=he):he=t[56];let ge;t[57]===B?ge=t[58]:(ge=B?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-12 text-muted-foreground`,children:(0,X.jsx)(C,{size:24,className:`animate-spin`})}):null,t[57]=B,t[58]=ge);let _e;t[59]===V?_e=t[60]:(_e=V?(0,X.jsx)(`p`,{className:`text-sm text-destructive`,children:`Unable to load repositories. Please try again.`}):null,t[59]=V,t[60]=_e);let ve;t[61]!==x||t[62]!==V||t[63]!==B||t[64]!==M?(ve=!B&&!V?(0,X.jsx)($e,{className:`h-[320px] rounded-md border`,children:(0,X.jsxs)(`div`,{className:`p-2 space-y-1`,children:[x.length===0?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground px-3 py-6 text-center`,children:`No repositories found.`}):null,x.map(e=>(0,X.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,X.jsx)(g,{checked:M.has(e.fullName),onCheckedChange:()=>L(e.fullName)}),(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.fullName}),e.private?(0,X.jsx)(ye,{variant:`secondary`,children:`Private`}):null]}),(0,X.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Owner: `,e.owner]})]})]},e.id))]})}):null,t[61]=x,t[62]=V,t[63]=B,t[64]=M,t[65]=ve):ve=t[65];let J;t[66]!==de||t[67]!==he||t[68]!==ge||t[69]!==_e||t[70]!==ve?(J=(0,X.jsxs)(`div`,{className:`space-y-3`,children:[de,he,ge,_e,ve]}),t[66]=de,t[67]=he,t[68]=ge,t[69]=_e,t[70]=ve,t[71]=J):J=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]!==O.isPending?(Q=(0,X.jsx)(s,{variant:`outline`,onClick:Z,disabled:O.isPending,children:`Cancel`}),t[74]=Z,t[75]=O.isPending,t[76]=Q):Q=t[76];let $;t[77]!==a||t[78]!==O?($=()=>O.mutate({repositories:a}),t[77]=a,t[78]=O,t[79]=$):$=t[79];let xe=!H,Se=O.isPending?`Saving...`:`Save`,Ce;t[80]!==$||t[81]!==xe||t[82]!==Se?(Ce=(0,X.jsx)(s,{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,X.jsxs)(N,{children:[Q,Ce]}),t[84]=Q,t[85]=Ce,t[86]=we):we=t[86];let Ee;t[87]!==J||t[88]!==we?(Ee=(0,X.jsxs)(A,{className:`sm:max-w-[680px]`,children:[U,J,we]}),t[87]=J,t[88]=we,t[89]=Ee):Ee=t[89];let Oe;return t[90]!==e.onOpenChange||t[91]!==e.open||t[92]!==Ee?(Oe=(0,X.jsx)(P,{open:e.open,onOpenChange:e.onOpenChange,children:Ee}),t[90]=e.onOpenChange,t[91]=e.open,t[92]=Ee,t[93]=Oe):Oe=t[93],Oe}function rt(e){return e.fullName}function it(e){Se({title:`Failed to update GitHub repositories`,description:e.message})}function at(e){switch(e){case`active`:return`default`;case`error`:return`destructive`;case`disconnected`:return`secondary`;default:return`outline`}}function ot(e){let t=(0,be.c)(4);if(!e.errorMessage)return null;let n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(U,{className:`size-4`}),r=(0,X.jsx)(D,{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,X.jsxs)(O,{variant:`destructive`,className:`mt-3 border-destructive/30 bg-destructive/5`,children:[n,r,(0,X.jsx)(E,{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 st(e){let t=(0,be.c)(83),{dataSource:n,organizationId:r,openGitHubRepositories:i,providers:a}=e,o;t[0]===r?o=t[1]:(o=G(r),t[0]=r,t[1]=o);let c=o.queryKey,[l,u]=(0,Y.useState)(!1),d=(0,Y.useRef)(!1),f,p;t[2]!==n.provider||t[3]!==i?(f=()=>{d.current||i&&n.provider===`github`&&(u(!0),d.current=!0)},p=[n.provider,i],t[2]=n.provider,t[3]=i,t[4]=f,t[5]=p):(f=t[4],p=t[5]),(0,Y.useEffect)(f,p);let g;t[6]!==n.id||t[7]!==r?(g=async()=>se(n.id,r),t[6]=n.id,t[7]=r,t[8]=g):g=t[8];let y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=[`data-sources`],t[9]=y):y=t[9];let S;t[10]===g?S=t[11]:(S={mutationFn:g,mutationKey:y,onError:lt,onSuccess:ct},t[10]=g,t[11]=S);let C=te(S),w;t[12]!==n.id||t[13]!==r?(w=async()=>ce(n.id,r),t[12]=n.id,t[13]=r,t[14]=w):w=t[14];let T;t[15]!==n.id||t[16]!==c||t[17]!==w?(T={errorMessage:`Failed to delete data source`,itemId:n.id,mutationFn:w,queryKey:c,successMessage:`Data source deleted`},t[15]=n.id,t[16]=c,t[17]=w,t[18]=T):T=t[18];let E=M(T),D;t[19]===n.provider?D=t[20]:(D=b(n.provider),t[19]=n.provider,t[20]=D);let O=D,ee;t[21]!==n.provider||t[22]!==a?(ee=v(n.provider,a),t[21]=n.provider,t[22]=a,t[23]=ee):ee=t[23];let k=ee,A=k?`Test Connection`:`Test Connection (Unsupported)`,j;t[24]===n.name?j=t[25]:(j=(0,X.jsx)(ge,{className:`text-lg`,children:n.name}),t[24]=n.name,t[25]=j);let N;t[26]===O?N=t[27]:(N=(0,X.jsx)(O,{className:`h-4.5 w-4.5`}),t[26]=O,t[27]=N);let P;t[28]!==n.provider||t[29]!==a?(P=x(n.provider,a),t[28]=n.provider,t[29]=a,t[30]=P):P=t[30];let F;t[31]!==N||t[32]!==P?(F=(0,X.jsxs)(_e,{className:`flex items-center gap-1.5 mt-0.5`,children:[N,P]}),t[31]=N,t[32]=P,t[33]=F):F=t[33];let ne;t[34]!==j||t[35]!==F?(ne=(0,X.jsxs)(`div`,{children:[j,F]}),t[34]=j,t[35]=F,t[36]=ne):ne=t[36];let I;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,X.jsx)(ue,{children:(0,X.jsx)(s,{variant:`ghost`,size:`icon-sm`,children:(0,X.jsx)(h,{size:16,stroke:2})})}),t[37]=I):I=t[37];let L;t[38]===C?L=t[39]:(L=()=>C.mutate(),t[38]=C,t[39]=L);let re=C.isPending||!k,R;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,X.jsx)(oe,{size:16,stroke:2}),t[40]=R):R=t[40];let ie=C.isPending?`Testing...`:A,z;t[41]!==L||t[42]!==re||t[43]!==ie?(z=(0,X.jsxs)(de,{onClick:L,disabled:re,children:[R,ie]}),t[41]=L,t[42]=re,t[43]=ie,t[44]=z):z=t[44];let B;t[45]===n.provider?B=t[46]:(B=n.provider===`github`?(0,X.jsxs)(de,{onClick:()=>u(!0),children:[(0,X.jsx)(_,{size:16,stroke:`2`}),`Select Repositories`]}):null,t[45]=n.provider,t[46]=B);let V;t[47]===E?V=t[48]:(V=()=>E.mutate(),t[47]=E,t[48]=V);let H;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,X.jsx)(m,{size:16,stroke:2}),t[49]=H):H=t[49];let ae=E.isPending?`Deleting...`:`Delete`,U;t[50]!==E.isPending||t[51]!==V||t[52]!==ae?(U=(0,X.jsxs)(de,{onClick:V,disabled:E.isPending,className:`text-destructive focus:text-destructive`,children:[H,ae]}),t[50]=E.isPending,t[51]=V,t[52]=ae,t[53]=U):U=t[53];let W;t[54]!==z||t[55]!==B||t[56]!==U?(W=(0,X.jsxs)(fe,{children:[I,(0,X.jsxs)(q,{align:`end`,className:`min-w-40`,children:[z,B,U]})]}),t[54]=z,t[55]=B,t[56]=U,t[57]=W):W=t[57];let K;t[58]!==ne||t[59]!==W?(K=(0,X.jsxs)(me,{className:`flex flex-row items-start justify-between space-y-0 pb-2`,children:[ne,W]}),t[58]=ne,t[59]=W,t[60]=K):K=t[60];let le;t[61]===n.status?le=t[62]:(le=at(n.status),t[61]=n.status,t[62]=le);let J;t[63]!==n.status||t[64]!==le?(J=(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsx)(ye,{variant:le,children:n.status})}),t[63]=n.status,t[64]=le,t[65]=J):J=t[65];let Z;t[66]===n.lastUsedAt?Z=t[67]:(Z=n.lastUsedAt&&(0,X.jsxs)(`p`,{className:`text-sm text-muted-foreground mt-2`,children:[`Last used: `,pe(n.lastUsedAt)]}),t[66]=n.lastUsedAt,t[67]=Z);let Q;t[68]===n.errorMessage?Q=t[69]:(Q=(0,X.jsx)(ot,{errorMessage:n.errorMessage}),t[68]=n.errorMessage,t[69]=Q);let $;t[70]!==J||t[71]!==Z||t[72]!==Q?($=(0,X.jsxs)(he,{children:[J,Z,Q]}),t[70]=J,t[71]=Z,t[72]=Q,t[73]=$):$=t[73];let xe;t[74]!==n.id||t[75]!==n.provider||t[76]!==r||t[77]!==l?(xe=n.provider===`github`?(0,X.jsx)(nt,{organizationId:r,dataSourceId:n.id,open:l,onOpenChange:u}):null,t[74]=n.id,t[75]=n.provider,t[76]=r,t[77]=l,t[78]=xe):xe=t[78];let Se;return t[79]!==K||t[80]!==$||t[81]!==xe?(Se=(0,X.jsxs)(ve,{children:[K,$,xe]}),t[79]=K,t[80]=$,t[81]=xe,t[82]=Se):Se=t[82],Se}function ct(e){if(e.kind===`unsupported`){K.info(e.message);return}if(e.result.success){K.success(`Data source test successful`);return}Se({title:`Data source test failed`,description:e.result.error??e.result.message??`Unknown error`})}function lt(e){return Se({title:`Failed to test data source`,description:e.message})}function ut(e){return e}function dt(e){let t=(0,be.c)(16),n;t[0]===e.provider.id?n=t[1]:(n=b(e.provider.id),t[0]=e.provider.id,t[1]=n);let r=n,i;t[2]===r?i=t[3]:(i=(0,X.jsx)(r,{className:`h-5 w-5 text-muted-foreground shrink-0`}),t[2]=r,t[3]=i);let a;t[4]===e.provider.label?a=t[5]:(a=(0,X.jsx)(`p`,{className:`font-medium truncate`,children:e.provider.label}),t[4]=e.provider.label,t[5]=a);let o;t[6]!==i||t[7]!==a?(o=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[i,a]}),t[6]=i,t[7]=a,t[8]=o):o=t[8];let c;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(s,{variant:`secondary`,size:`sm`,children:`Connect`}),t[9]=c):c=t[9];let l;t[10]!==e.organizationId||t[11]!==e.provider.id?(l=(0,X.jsx)(Z,{organizationId:e.organizationId,initialProvider:e.provider.id,children:c}),t[10]=e.organizationId,t[11]=e.provider.id,t[12]=l):l=t[12];let u;return t[13]!==o||t[14]!==l?(u=(0,X.jsx)(ve,{className:`border-dashed`,children:(0,X.jsx)(he,{className:`p-4`,children:(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[o,l]})})}),t[13]=o,t[14]=l,t[15]=u):u=t[15],u}function ft(e){let t=(0,be.c)(37),{organizationId:n,openGitHubDataSourceId:r}=e,i;t[0]===n?i=t[1]:(i=G(n),t[0]=n,t[1]=i);let{data:a}=I(i),o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=W(),t[2]=o):o=t[2];let{data:c}=I(o),l=c.providers,u,d,f,p,m,h,g,_;if(t[3]!==a||t[4]!==r||t[5]!==n||t[6]!==l){let e=ut(a),i=new Set(e.map(pt)),o=y(l).filter(e=>!i.has(e.id)),c=e.length>0;h=`space-y-8`;let v;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Connected`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Data sources already connected to your workspace.`})]}),t[15]=v):v=t[15];let b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsxs)(s,{children:[(0,X.jsx)(w,{size:16,stroke:2}),`Add Data Source`]}),t[16]=b):b=t[16],t[17]===n?g=t[18]:(g=(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[v,(0,X.jsx)(Z,{organizationId:n,children:b})]}),t[17]=n,t[18]=g),t[19]===c?_=t[20]:(_=c?null:(0,X.jsxs)(`div`,{className:`text-center py-12`,children:[(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`No connected data sources yet.`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Connect one below or add a new data source to get started.`})]}),t[19]=c,t[20]=_),u=c?(0,X.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>(0,X.jsx)(st,{dataSource:e,organizationId:n,openGitHubRepositories:r===e.id,providers:l},e.id))}):null,p=`space-y-4`,t[21]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Not connected`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Available data sources you can connect next.`})]}),t[21]=m):m=t[21],d=`grid gap-4 md:grid-cols-2 lg:grid-cols-3`;let x;t[22]===n?x=t[23]:(x=e=>(0,X.jsx)(dt,{provider:e,organizationId:n},e.id),t[22]=n,t[23]=x),f=o.map(x),t[3]=a,t[4]=r,t[5]=n,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_}else u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14];let v;t[24]!==d||t[25]!==f?(v=(0,X.jsx)(`div`,{className:d,children:f}),t[24]=d,t[25]=f,t[26]=v):v=t[26];let b;t[27]!==v||t[28]!==p||t[29]!==m?(b=(0,X.jsxs)(`div`,{className:p,children:[m,v]}),t[27]=v,t[28]=p,t[29]=m,t[30]=b):b=t[30];let x;return t[31]!==u||t[32]!==b||t[33]!==h||t[34]!==g||t[35]!==_?(x=(0,X.jsxs)(`div`,{className:h,children:[g,_,u,b]}),t[31]=u,t[32]=b,t[33]=h,t[34]=g,t[35]=_,t[36]=x):x=t[36],x}function pt(e){return e.provider}var mt=i(`/_authenticated/$org_slug/integrations`);function ht(){let e=(0,be.c)(4),{organizationId:t}=mt.useRouteContext(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`section`,{children:(0,X.jsxs)(`div`,{className:`mb-6`,children:[(0,X.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Integrations`}),(0,X.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,X.jsxs)(`div`,{className:`mb-4`,children:[(0,X.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Data Sources`}),(0,X.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,X.jsxs)(`div`,{className:`p-8 space-y-12`,children:[n,(0,X.jsxs)(`section`,{children:[r,(0,X.jsx)(ft,{organizationId:t})]})]}),e[2]=t,e[3]=i),i}var gt=ht;export{gt as component};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./compiler-runtime-DCc3R3Xn.js";import{a as n,o as r}from"./api-base-url-DIb6qukm.js";import{n as i}from"./createReactComponent-_L2mp4Ui.js";import{t as a}from"./IconCheck-Gc24xPT2.js";import{t as o}from"./IconLoader2-0wRUrt7h.js";import{t as s}from"./IconX-rRpRFwc5.js";import{t as c}from"./auth-client-D-YHMy0G.js";import{a as l,i as u}from"./app-routes-CMyon6Em.js";import{A as d,V as f,j as p}from"./index-CzO2VlPF.js";import{a as m,i as h,r as g,t as _}from"./xstate-react.esm-Bo3CCIRt.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./card-Dllm2lhp.js";import{n as w,t as T}from"./dist-BNi06Dzx.js";var E=t(),D=n(u),O=`Failed to accept invitation`,k=`Failed to navigate. Try again from home.`,A=1500,j={kind:`home`},M={ACCEPT:`inviteAccept/accept`,DECLINE:`inviteAccept/decline`,GO_HOME:`inviteAccept/goHome`},N={ACCEPTING:`accepting`,ERROR:`error`,NAVIGATING:`navigating`,NAVIGATING_FROM_ERROR:`fromError`,NAVIGATING_FROM_READY:`fromReady`,NAVIGATING_FROM_SUCCESS:`fromSuccess`,READY:`ready`,REFRESHING_ORGANIZATIONS:`refreshingOrganizations`,SUCCESS_PENDING_REDIRECT:`successPendingRedirect`},P={ACCEPTING:`accepting`,ERROR:`error`,READY:`ready`,SUCCESS:`success`},F=class extends w(`InviteAcceptRequestError`)(){},I=class extends w(`InviteRedirectResolutionError`)(){};function L(){return{kind:`idle`}}function R(e){return{kind:`accepted`,organizationId:e}}function z(e){return{kind:`error`,message:e}}function B(e){return{invitationId:e,outcome:L(),redirectTarget:null}}function V(e){return B(e.invitationId)}function H(e,t){return{...V(e),outcome:z(t)}}function U(e){return e.redirectTarget??j}function W(e){if(e.outcome.kind!==`accepted`)throw Error(`Accepted organization id is required to resolve redirect`);return e.outcome.organizationId}async function G(e){let t=await T.tryPromise({try:()=>c.acceptInvitation({invitationId:e}),catch:e=>new F({cause:e,message:O,reason:`request_failed`})});if(t.isErr())return T.err(t.error);let n=t.value;return n.error?T.err(new F({message:J(n.error.message,O),reason:`response_failed`})):T.ok({acceptedOrganizationId:n.data.member.organizationId})}async function K(e){let t=await T.tryPromise({try:()=>e.refetchSession(),catch:t=>new I({acceptedOrganizationId:e.acceptedOrganizationId,cause:t,message:`Failed to refresh organizations after accepting invitation`,reason:`session_refresh_failed`,...e.userId?{userId:e.userId}:{}})});if(t.isErr())return Y(t.error),T.err(t.error);let n=await T.tryPromise({try:()=>e.queryClient.fetchQuery({...d(e.userId),staleTime:0}),catch:t=>new I({acceptedOrganizationId:e.acceptedOrganizationId,cause:t,message:`Failed to refresh organizations after accepting invitation`,reason:`organization_list_failed`,...e.userId?{userId:e.userId}:{}})});if(n.isErr())return Y(n.error),T.err(n.error);let r=n.value.find(t=>t.id===e.acceptedOrganizationId);if(r)return T.ok({kind:`organization`,organizationSlug:p(r)});let i=await T.tryPromise({try:()=>c.getFullOrganization({query:{organizationId:e.acceptedOrganizationId}}),catch:t=>new I({acceptedOrganizationId:e.acceptedOrganizationId,cause:t,message:`Failed to load accepted organization details`,reason:`organization_lookup_failed`,...e.userId?{userId:e.userId}:{}})});if(i.isErr())return Y(i.error),T.err(i.error);if(i.value.data?.slug)return T.ok({kind:`organization`,organizationSlug:i.value.data.slug});let a=new I({acceptedOrganizationId:e.acceptedOrganizationId,message:`Accepted invitation but organization was not found`,reason:`organization_missing`,...e.userId?{userId:e.userId}:{}});return Y(a),T.err(a)}function q(e,t){if(!(e instanceof Error))return t;let n=e.message.trim();return n.length===0?t:n}function J(e,t){let n=e?.trim()??``;return n.length>0?n:t}function Y(e){if(e.reason===`organization_missing`){console.error(`[invite] accepted invitation but organization was not found`,{acceptedOrganizationId:e.acceptedOrganizationId,userId:e.userId});return}console.error(`[invite] accepted invitation but failed to refresh orgs`,{acceptedOrganizationId:e.acceptedOrganizationId,error:e.cause??e.message,reason:e.reason,userId:e.userId})}function X(e={}){return Z.provide({delays:{successRedirect:e.successRedirectDelayMs??A}})}var Z=g({actions:{prepareAcceptRequest:h(()=>({outcome:L(),redirectTarget:null})),resetFlow:h(({context:e})=>V(e)),setHomeRedirectTarget:h({redirectTarget:()=>j}),storeAcceptError:h(({context:e},t)=>H(e,q(t.error,O))),storeAcceptedOrganizationId:h({outcome:(e,t)=>R(t.acceptedOrganizationId),redirectTarget:()=>null}),storeNavigationError:h(({context:e},t)=>H(e,Q(t.error))),storeResolvedRedirectTarget:h({redirectTarget:(e,t)=>t.redirectTarget})},actors:{acceptInvitation:m(async({input:e})=>{let t=await G(e.invitationId);if(t.isErr())throw t.error;return t.value}),navigateToInviteTarget:m(async e=>void 0),resolveRedirect:m(async e=>j)},delays:{successRedirect:A},types:{}}).createMachine({context:({input:e})=>B(e.invitationId),id:`inviteAccept`,initial:N.READY,states:{[N.READY]:{tags:P.READY,on:{[M.ACCEPT]:{actions:`prepareAcceptRequest`,target:N.ACCEPTING},[M.DECLINE]:{actions:`setHomeRedirectTarget`,target:`${N.NAVIGATING}.${N.NAVIGATING_FROM_READY}`}}},[N.ACCEPTING]:{tags:P.ACCEPTING,invoke:{src:`acceptInvitation`,input:({context:e})=>({invitationId:e.invitationId}),onDone:{actions:{type:`storeAcceptedOrganizationId`,params:({event:e})=>({acceptedOrganizationId:e.output.acceptedOrganizationId})},target:N.REFRESHING_ORGANIZATIONS},onError:{actions:{type:`storeAcceptError`,params:({event:e})=>({error:e.error})},target:N.ERROR}}},[N.REFRESHING_ORGANIZATIONS]:{tags:P.SUCCESS,invoke:{src:`resolveRedirect`,input:({context:e})=>({acceptedOrganizationId:W(e)}),onDone:{actions:{type:`storeResolvedRedirectTarget`,params:({event:e})=>({redirectTarget:e.output})},target:N.SUCCESS_PENDING_REDIRECT},onError:{actions:`setHomeRedirectTarget`,target:N.SUCCESS_PENDING_REDIRECT}}},[N.SUCCESS_PENDING_REDIRECT]:{tags:P.SUCCESS,after:{successRedirect:`${N.NAVIGATING}.${N.NAVIGATING_FROM_SUCCESS}`}},[N.NAVIGATING]:{initial:N.NAVIGATING_FROM_READY,invoke:{src:`navigateToInviteTarget`,input:({context:e})=>({target:U(e)}),onDone:{actions:`resetFlow`,target:N.READY},onError:{actions:{type:`storeNavigationError`,params:({event:e})=>({error:e.error})},target:N.ERROR}},states:{[N.NAVIGATING_FROM_ERROR]:{tags:P.ERROR},[N.NAVIGATING_FROM_READY]:{tags:P.READY},[N.NAVIGATING_FROM_SUCCESS]:{tags:P.SUCCESS}}},[N.ERROR]:{tags:P.ERROR,on:{[M.GO_HOME]:{actions:`setHomeRedirectTarget`,target:`${N.NAVIGATING}.${N.NAVIGATING_FROM_ERROR}`}}}}}),ee=X();function te(e){return e.hasTag(P.ACCEPTING)?`accepting`:e.hasTag(P.ERROR)?`error`:e.hasTag(P.SUCCESS)?`success`:`ready`}function ne(e){return e.context.outcome.kind===`error`?e.context.outcome.message:null}function Q(e){return q(e,k)}function re(){let e=(0,E.c)(28),t=r(),n=f(),{invitationId:i}=D.useParams(),{auth:a,refetchSession:o}=D.useRouteContext(),s=a.session?.user.id,c;if(e[0]!==t||e[1]!==n||e[2]!==o||e[3]!==s){let r;e[5]===t?r=e[6]:(r=async e=>{let{input:n}=e;try{if(n.target.kind===`home`){await t({to:`/`});return}await t({params:{org_slug:n.target.organizationSlug},to:l})}catch(e){let t=e;throw console.error(`[invite] failed to navigate after accepting invitation`,{error:t,navigationTarget:n.target}),Error(Q(t),{cause:t})}},e[5]=t,e[6]=r);let i;e[7]!==n||e[8]!==o||e[9]!==s?(i=async e=>{let{input:t}=e,r=await K({acceptedOrganizationId:t.acceptedOrganizationId,queryClient:n,refetchSession:o,userId:s});if(r.isErr())throw r.error;return r.value},e[7]=n,e[8]=o,e[9]=s,e[10]=i):i=e[10],c=ee.provide({actors:{navigateToInviteTarget:m(r),resolveRedirect:m(i)}}),e[0]=t,e[1]=n,e[2]=o,e[3]=s,e[4]=c}else c=e[4];let u;e[11]===i?u=e[12]:(u={input:{invitationId:i}},e[11]=i,e[12]=u);let[d,p]=_(c,u),h,g;e[13]===p?(h=e[14],g=e[15]):(h=()=>{p({type:M.ACCEPT})},g=()=>{p({type:M.DECLINE})},e[13]=p,e[14]=h,e[15]=g);let v;e[16]===d?v=e[17]:(v=ne(d),e[16]=d,e[17]=v);let y;e[18]===p?y=e[19]:(y=()=>{p({type:M.GO_HOME})},e[18]=p,e[19]=y);let b;e[20]===d?b=e[21]:(b=te(d),e[20]=d,e[21]=b);let x;return e[22]!==h||e[23]!==g||e[24]!==v||e[25]!==y||e[26]!==b?(x={accept:h,decline:g,errorMessage:v,goHome:y,status:b},e[22]=h,e[23]=g,e[24]=v,e[25]=y,e[26]=b,e[27]=x):x=e[27],x}var $=e();function ie(){let e=(0,E.c)(2),{invitationId:t}=D.useParams(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(ae,{},t),e[0]=t,e[1]=n),n}function ae(){let e=(0,E.c)(28),{accept:t,decline:n,errorMessage:r,goHome:c,status:l}=re(),u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsxs)(v,{className:`text-center`,children:[(0,$.jsx)(x,{className:`text-2xl`,children:`Organization Invitation`}),(0,$.jsx)(S,{children:`You've been invited to join an organization`})]}),e[0]=u):u=e[0];let d;e[1]===l?d=e[2]:(d=l===`ready`&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,$.jsx)(`div`,{className:`rounded-full bg-primary/10 p-4`,children:(0,$.jsx)(a,{size:48,className:`text-primary`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium`,children:`Ready to join`}),(0,$.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]=l,e[2]=d);let f;e[3]===l?f=e[4]:(f=l===`accepting`&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,$.jsx)(o,{size:48,className:`animate-spin text-primary`}),(0,$.jsx)(`p`,{className:`text-muted-foreground`,children:`Accepting invitation...`})]}),e[3]=l,e[4]=f);let p;e[5]===l?p=e[6]:(p=l===`success`&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,$.jsx)(`div`,{className:`rounded-full bg-green-500/10 p-4`,children:(0,$.jsx)(a,{size:48,className:`text-green-500`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium text-green-600`,children:`Successfully joined!`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Redirecting to your dashboard...`})]})]}),e[5]=l,e[6]=p);let m;e[7]!==r||e[8]!==l?(m=l===`error`&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,$.jsx)(`div`,{className:`rounded-full bg-destructive/10 p-4`,children:(0,$.jsx)(s,{size:48,className:`text-destructive`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium text-destructive`,children:`Failed to accept invitation`}),(0,$.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]=l,e[9]=m):m=e[9];let h;e[10]!==d||e[11]!==f||e[12]!==p||e[13]!==m?(h=(0,$.jsxs)(b,{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 g;e[15]!==t||e[16]!==n||e[17]!==l?(g=l===`ready`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(i,{variant:`outline`,onClick:n,children:`Decline`}),(0,$.jsx)(i,{onClick:t,children:`Accept Invitation`})]}),e[15]=t,e[16]=n,e[17]=l,e[18]=g):g=e[18];let _;e[19]!==c||e[20]!==l?(_=l===`error`&&(0,$.jsx)(i,{variant:`outline`,onClick:c,children:`Go to Home`}),e[19]=c,e[20]=l,e[21]=_):_=e[21];let w;e[22]!==g||e[23]!==_?(w=(0,$.jsxs)(y,{className:`flex justify-center gap-4`,children:[g,_]}),e[22]=g,e[23]=_,e[24]=w):w=e[24];let T;return e[25]!==h||e[26]!==w?(T=(0,$.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:(0,$.jsxs)(C,{className:`w-full max-w-md`,children:[u,h,w]})}),e[25]=h,e[26]=w,e[27]=T):T=e[27],T}var oe=ie;export{oe as component};
1
+ import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./compiler-runtime-DCc3R3Xn.js";import{a as n,o as r}from"./api-base-url-DIb6qukm.js";import{n as i}from"./createReactComponent-_L2mp4Ui.js";import{t as a}from"./IconCheck-Gc24xPT2.js";import{t as o}from"./IconLoader2-BpZcTuHV.js";import{t as s}from"./IconX-rRpRFwc5.js";import{t as c}from"./auth-client-D-YHMy0G.js";import{a as l,i as u}from"./app-routes-CMyon6Em.js";import{A as d,V as f,j as p}from"./index-CXR0dKJj.js";import{a as m,i as h,r as g,t as _}from"./xstate-react.esm-Bo3CCIRt.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./card-Dllm2lhp.js";import{n as w,t as T}from"./dist-BNi06Dzx.js";var E=t(),D=n(u),O=`Failed to accept invitation`,k=`Failed to navigate. Try again from home.`,A=1500,j={kind:`home`},M={ACCEPT:`inviteAccept/accept`,DECLINE:`inviteAccept/decline`,GO_HOME:`inviteAccept/goHome`},N={ACCEPTING:`accepting`,ERROR:`error`,NAVIGATING:`navigating`,NAVIGATING_FROM_ERROR:`fromError`,NAVIGATING_FROM_READY:`fromReady`,NAVIGATING_FROM_SUCCESS:`fromSuccess`,READY:`ready`,REFRESHING_ORGANIZATIONS:`refreshingOrganizations`,SUCCESS_PENDING_REDIRECT:`successPendingRedirect`},P={ACCEPTING:`accepting`,ERROR:`error`,READY:`ready`,SUCCESS:`success`},F=class extends w(`InviteAcceptRequestError`)(){},I=class extends w(`InviteRedirectResolutionError`)(){};function L(){return{kind:`idle`}}function R(e){return{kind:`accepted`,organizationId:e}}function z(e){return{kind:`error`,message:e}}function B(e){return{invitationId:e,outcome:L(),redirectTarget:null}}function V(e){return B(e.invitationId)}function H(e,t){return{...V(e),outcome:z(t)}}function U(e){return e.redirectTarget??j}function W(e){if(e.outcome.kind!==`accepted`)throw Error(`Accepted organization id is required to resolve redirect`);return e.outcome.organizationId}async function G(e){let t=await T.tryPromise({try:()=>c.acceptInvitation({invitationId:e}),catch:e=>new F({cause:e,message:O,reason:`request_failed`})});if(t.isErr())return T.err(t.error);let n=t.value;return n.error?T.err(new F({message:J(n.error.message,O),reason:`response_failed`})):T.ok({acceptedOrganizationId:n.data.member.organizationId})}async function K(e){let t=await T.tryPromise({try:()=>e.refetchSession(),catch:t=>new I({acceptedOrganizationId:e.acceptedOrganizationId,cause:t,message:`Failed to refresh organizations after accepting invitation`,reason:`session_refresh_failed`,...e.userId?{userId:e.userId}:{}})});if(t.isErr())return Y(t.error),T.err(t.error);let n=await T.tryPromise({try:()=>e.queryClient.fetchQuery({...d(e.userId),staleTime:0}),catch:t=>new I({acceptedOrganizationId:e.acceptedOrganizationId,cause:t,message:`Failed to refresh organizations after accepting invitation`,reason:`organization_list_failed`,...e.userId?{userId:e.userId}:{}})});if(n.isErr())return Y(n.error),T.err(n.error);let r=n.value.find(t=>t.id===e.acceptedOrganizationId);if(r)return T.ok({kind:`organization`,organizationSlug:p(r)});let i=await T.tryPromise({try:()=>c.getFullOrganization({query:{organizationId:e.acceptedOrganizationId}}),catch:t=>new I({acceptedOrganizationId:e.acceptedOrganizationId,cause:t,message:`Failed to load accepted organization details`,reason:`organization_lookup_failed`,...e.userId?{userId:e.userId}:{}})});if(i.isErr())return Y(i.error),T.err(i.error);if(i.value.data?.slug)return T.ok({kind:`organization`,organizationSlug:i.value.data.slug});let a=new I({acceptedOrganizationId:e.acceptedOrganizationId,message:`Accepted invitation but organization was not found`,reason:`organization_missing`,...e.userId?{userId:e.userId}:{}});return Y(a),T.err(a)}function q(e,t){if(!(e instanceof Error))return t;let n=e.message.trim();return n.length===0?t:n}function J(e,t){let n=e?.trim()??``;return n.length>0?n:t}function Y(e){if(e.reason===`organization_missing`){console.error(`[invite] accepted invitation but organization was not found`,{acceptedOrganizationId:e.acceptedOrganizationId,userId:e.userId});return}console.error(`[invite] accepted invitation but failed to refresh orgs`,{acceptedOrganizationId:e.acceptedOrganizationId,error:e.cause??e.message,reason:e.reason,userId:e.userId})}function X(e={}){return Z.provide({delays:{successRedirect:e.successRedirectDelayMs??A}})}var Z=g({actions:{prepareAcceptRequest:h(()=>({outcome:L(),redirectTarget:null})),resetFlow:h(({context:e})=>V(e)),setHomeRedirectTarget:h({redirectTarget:()=>j}),storeAcceptError:h(({context:e},t)=>H(e,q(t.error,O))),storeAcceptedOrganizationId:h({outcome:(e,t)=>R(t.acceptedOrganizationId),redirectTarget:()=>null}),storeNavigationError:h(({context:e},t)=>H(e,Q(t.error))),storeResolvedRedirectTarget:h({redirectTarget:(e,t)=>t.redirectTarget})},actors:{acceptInvitation:m(async({input:e})=>{let t=await G(e.invitationId);if(t.isErr())throw t.error;return t.value}),navigateToInviteTarget:m(async e=>void 0),resolveRedirect:m(async e=>j)},delays:{successRedirect:A},types:{}}).createMachine({context:({input:e})=>B(e.invitationId),id:`inviteAccept`,initial:N.READY,states:{[N.READY]:{tags:P.READY,on:{[M.ACCEPT]:{actions:`prepareAcceptRequest`,target:N.ACCEPTING},[M.DECLINE]:{actions:`setHomeRedirectTarget`,target:`${N.NAVIGATING}.${N.NAVIGATING_FROM_READY}`}}},[N.ACCEPTING]:{tags:P.ACCEPTING,invoke:{src:`acceptInvitation`,input:({context:e})=>({invitationId:e.invitationId}),onDone:{actions:{type:`storeAcceptedOrganizationId`,params:({event:e})=>({acceptedOrganizationId:e.output.acceptedOrganizationId})},target:N.REFRESHING_ORGANIZATIONS},onError:{actions:{type:`storeAcceptError`,params:({event:e})=>({error:e.error})},target:N.ERROR}}},[N.REFRESHING_ORGANIZATIONS]:{tags:P.SUCCESS,invoke:{src:`resolveRedirect`,input:({context:e})=>({acceptedOrganizationId:W(e)}),onDone:{actions:{type:`storeResolvedRedirectTarget`,params:({event:e})=>({redirectTarget:e.output})},target:N.SUCCESS_PENDING_REDIRECT},onError:{actions:`setHomeRedirectTarget`,target:N.SUCCESS_PENDING_REDIRECT}}},[N.SUCCESS_PENDING_REDIRECT]:{tags:P.SUCCESS,after:{successRedirect:`${N.NAVIGATING}.${N.NAVIGATING_FROM_SUCCESS}`}},[N.NAVIGATING]:{initial:N.NAVIGATING_FROM_READY,invoke:{src:`navigateToInviteTarget`,input:({context:e})=>({target:U(e)}),onDone:{actions:`resetFlow`,target:N.READY},onError:{actions:{type:`storeNavigationError`,params:({event:e})=>({error:e.error})},target:N.ERROR}},states:{[N.NAVIGATING_FROM_ERROR]:{tags:P.ERROR},[N.NAVIGATING_FROM_READY]:{tags:P.READY},[N.NAVIGATING_FROM_SUCCESS]:{tags:P.SUCCESS}}},[N.ERROR]:{tags:P.ERROR,on:{[M.GO_HOME]:{actions:`setHomeRedirectTarget`,target:`${N.NAVIGATING}.${N.NAVIGATING_FROM_ERROR}`}}}}}),ee=X();function te(e){return e.hasTag(P.ACCEPTING)?`accepting`:e.hasTag(P.ERROR)?`error`:e.hasTag(P.SUCCESS)?`success`:`ready`}function ne(e){return e.context.outcome.kind===`error`?e.context.outcome.message:null}function Q(e){return q(e,k)}function re(){let e=(0,E.c)(28),t=r(),n=f(),{invitationId:i}=D.useParams(),{auth:a,refetchSession:o}=D.useRouteContext(),s=a.session?.user.id,c;if(e[0]!==t||e[1]!==n||e[2]!==o||e[3]!==s){let r;e[5]===t?r=e[6]:(r=async e=>{let{input:n}=e;try{if(n.target.kind===`home`){await t({to:`/`});return}await t({params:{org_slug:n.target.organizationSlug},to:l})}catch(e){let t=e;throw console.error(`[invite] failed to navigate after accepting invitation`,{error:t,navigationTarget:n.target}),Error(Q(t),{cause:t})}},e[5]=t,e[6]=r);let i;e[7]!==n||e[8]!==o||e[9]!==s?(i=async e=>{let{input:t}=e,r=await K({acceptedOrganizationId:t.acceptedOrganizationId,queryClient:n,refetchSession:o,userId:s});if(r.isErr())throw r.error;return r.value},e[7]=n,e[8]=o,e[9]=s,e[10]=i):i=e[10],c=ee.provide({actors:{navigateToInviteTarget:m(r),resolveRedirect:m(i)}}),e[0]=t,e[1]=n,e[2]=o,e[3]=s,e[4]=c}else c=e[4];let u;e[11]===i?u=e[12]:(u={input:{invitationId:i}},e[11]=i,e[12]=u);let[d,p]=_(c,u),h,g;e[13]===p?(h=e[14],g=e[15]):(h=()=>{p({type:M.ACCEPT})},g=()=>{p({type:M.DECLINE})},e[13]=p,e[14]=h,e[15]=g);let v;e[16]===d?v=e[17]:(v=ne(d),e[16]=d,e[17]=v);let y;e[18]===p?y=e[19]:(y=()=>{p({type:M.GO_HOME})},e[18]=p,e[19]=y);let b;e[20]===d?b=e[21]:(b=te(d),e[20]=d,e[21]=b);let x;return e[22]!==h||e[23]!==g||e[24]!==v||e[25]!==y||e[26]!==b?(x={accept:h,decline:g,errorMessage:v,goHome:y,status:b},e[22]=h,e[23]=g,e[24]=v,e[25]=y,e[26]=b,e[27]=x):x=e[27],x}var $=e();function ie(){let e=(0,E.c)(2),{invitationId:t}=D.useParams(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(ae,{},t),e[0]=t,e[1]=n),n}function ae(){let e=(0,E.c)(28),{accept:t,decline:n,errorMessage:r,goHome:c,status:l}=re(),u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsxs)(v,{className:`text-center`,children:[(0,$.jsx)(x,{className:`text-2xl`,children:`Organization Invitation`}),(0,$.jsx)(S,{children:`You've been invited to join an organization`})]}),e[0]=u):u=e[0];let d;e[1]===l?d=e[2]:(d=l===`ready`&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,$.jsx)(`div`,{className:`rounded-full bg-primary/10 p-4`,children:(0,$.jsx)(a,{size:48,className:`text-primary`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium`,children:`Ready to join`}),(0,$.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]=l,e[2]=d);let f;e[3]===l?f=e[4]:(f=l===`accepting`&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,$.jsx)(o,{size:48,className:`animate-spin text-primary`}),(0,$.jsx)(`p`,{className:`text-muted-foreground`,children:`Accepting invitation...`})]}),e[3]=l,e[4]=f);let p;e[5]===l?p=e[6]:(p=l===`success`&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,$.jsx)(`div`,{className:`rounded-full bg-green-500/10 p-4`,children:(0,$.jsx)(a,{size:48,className:`text-green-500`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium text-green-600`,children:`Successfully joined!`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Redirecting to your dashboard...`})]})]}),e[5]=l,e[6]=p);let m;e[7]!==r||e[8]!==l?(m=l===`error`&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,$.jsx)(`div`,{className:`rounded-full bg-destructive/10 p-4`,children:(0,$.jsx)(s,{size:48,className:`text-destructive`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium text-destructive`,children:`Failed to accept invitation`}),(0,$.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]=l,e[9]=m):m=e[9];let h;e[10]!==d||e[11]!==f||e[12]!==p||e[13]!==m?(h=(0,$.jsxs)(b,{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 g;e[15]!==t||e[16]!==n||e[17]!==l?(g=l===`ready`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(i,{variant:`outline`,onClick:n,children:`Decline`}),(0,$.jsx)(i,{onClick:t,children:`Accept Invitation`})]}),e[15]=t,e[16]=n,e[17]=l,e[18]=g):g=e[18];let _;e[19]!==c||e[20]!==l?(_=l===`error`&&(0,$.jsx)(i,{variant:`outline`,onClick:c,children:`Go to Home`}),e[19]=c,e[20]=l,e[21]=_):_=e[21];let w;e[22]!==g||e[23]!==_?(w=(0,$.jsxs)(y,{className:`flex justify-center gap-4`,children:[g,_]}),e[22]=g,e[23]=_,e[24]=w):w=e[24];let T;return e[25]!==h||e[26]!==w?(T=(0,$.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:(0,$.jsxs)(C,{className:`w-full max-w-md`,children:[u,h,w]})}),e[25]=h,e[26]=w,e[27]=T):T=e[27],T}var oe=ie;export{oe as component};
@@ -1 +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-DuLiHT8m.js";import{o as s}from"./app-routes-CMyon6Em.js";import{q as c}from"./index-CzO2VlPF.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`,`Microsoft Clarity`,`GitHub`,`Vercel`,`Cloudflare Web Analytics`,`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};
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-CRaDbyxE.js";import{o as s}from"./app-routes-CMyon6Em.js";import{q as c}from"./index-CXR0dKJj.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`,`Microsoft Clarity`,`GitHub`,`Vercel`,`Cloudflare Web Analytics`,`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};
@@ -1 +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-DuLiHT8m.js";import{i as u,n as d}from"./auth-client-D-YHMy0G.js";import{t as f}from"./useQuery-Cu-8Z6op.js";import{d as p,p as m,s as h}from"./schemas-EcBBwCo1.js";import{G as g,K as _,U as v,V as y}from"./index-CzO2VlPF.js";import{t as b}from"./input-BRu0b1Tq.js";import{t as x}from"./label-f2wVZcni.js";import{a as S,n as C,o as w,r as T,t as E}from"./card-Dllm2lhp.js";import{n as D,t as O}from"./zod-D0PWrP9q.js";import{t as k}from"./auth-bootstrap-query-B1MHd_NV.js";var A=e(t(),1),j=n(),M=p({email:h(`Please enter a valid email`),password:m().min(8,`Password must be at least 8 characters`)}),N=p({email:h(`Please enter a valid email`),name:m().min(2,`Name must be at least 2 characters`),password:m().min(8,`Password must be at least 8 characters`)}),P=N.extend({organizationName:m().min(2,`Organization name must be at least 2 characters`),organizationSlug:m().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=p({error:m().optional(),message:m().optional()}).safeParse(t);return n.data?.error??n.data?.message??`Failed to complete bootstrap`}function z(){let e=o(),t=y(),n=i(),[a,h]=(0,A.useState)(`signin`),[z,B]=(0,A.useState)(!1),{redirect:V}=F.useSearch(),H=_(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(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=p({bootstrap:p({organizationId:m().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:v(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:e=>{K.handleSubmit(X)(e)},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:e=>{J.handleSubmit(Q)(e)},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:e=>{q.handleSubmit(Z)(e)},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
+ 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-CRaDbyxE.js";import{i as u,n as d}from"./auth-client-D-YHMy0G.js";import{t as f}from"./useQuery-DyOxsY45.js";import{d as p,p as m,s as h}from"./schemas-EcBBwCo1.js";import{G as g,K as _,U as v,V as y}from"./index-CXR0dKJj.js";import{t as b}from"./input-BRu0b1Tq.js";import{t as x}from"./label-f2wVZcni.js";import{a as S,n as C,o as w,r as T,t as E}from"./card-Dllm2lhp.js";import{n as D,t as O}from"./zod-D0PWrP9q.js";import{t as k}from"./auth-bootstrap-query-B1MHd_NV.js";var A=e(t(),1),j=n(),M=p({email:h(`Please enter a valid email`),password:m().min(8,`Password must be at least 8 characters`)}),N=p({email:h(`Please enter a valid email`),name:m().min(2,`Name must be at least 2 characters`),password:m().min(8,`Password must be at least 8 characters`)}),P=N.extend({organizationName:m().min(2,`Organization name must be at least 2 characters`),organizationSlug:m().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=p({error:m().optional(),message:m().optional()}).safeParse(t);return n.data?.error??n.data?.message??`Failed to complete bootstrap`}function z(){let e=o(),t=y(),n=i(),[a,h]=(0,A.useState)(`signin`),[z,B]=(0,A.useState)(!1),{redirect:V}=F.useSearch(),H=_(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(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=p({bootstrap:p({organizationId:m().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:v(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:e=>{K.handleSubmit(X)(e)},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:e=>{J.handleSubmit(Q)(e)},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:e=>{q.handleSubmit(Z)(e)},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{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./copy-button-BO1KBdf9.js";import{n as g,r as _,t as v}from"./checkbox-Bii9Pcrx.js";import{t as y}from"./IconLoader2-0wRUrt7h.js";import{t as b}from"./IconX-rRpRFwc5.js";import{l as x}from"./app-routes-CMyon6Em.js";import{a as S,c as C,i as w,l as T,n as E,o as D,r as O,s as k,t as A,u as j}from"./use-optimistic-mutation-ltpcuxqj.js";import{t as M}from"./useQuery-Cu-8Z6op.js";import{t as N}from"./useSuspenseQuery-7OqrCVKL.js";import{_ as P,d as F,p as I,s as L}from"./schemas-EcBBwCo1.js";import{n as ee}from"./src-C5F1uEDb.js";import{a as R,r as z}from"./organization-permissions-BXV_ess0.js";import{C as B,S as V,V as H,w as U,z as W}from"./index-CzO2VlPF.js";import{t as te}from"./input-BRu0b1Tq.js";import{n as ne,r as re,t as ie}from"./avatar-SaFoLofF.js";import{d as ae,n as oe,r as se,t as ce}from"./dropdown-menu-B7XsQ055.js";import{i as G,r as le,t as ue}from"./xstate-react.esm-Bo3CCIRt.js";import{t as de}from"./format-date-Rg05aHXh.js";import{t as fe}from"./label-f2wVZcni.js";import{t as pe}from"./badge-BFPkSrVD.js";import{r as K}from"./api-paths-DcYkf-C_.js";import{n as me,t as he}from"./zod-D0PWrP9q.js";var 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`}]]),q=r(),J=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,q.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,J.jsx)(pe,{variant:r,children:i}),t[4]=r,t[5]=i,t[6]=a):a=t[6],a}function xe(e){let t=(0,q.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,J.jsx)(pe,{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,J.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:a}),t[7]=a,t[8]=o),o}function Se(e){return(0,J.jsx)(be,{role:e},e)}var Ce=F({expiresAt:P().optional(),id:I(),role:I().optional()}),we=F({id:I(),role:I()}),Te=F({member:we});async function Ee(e,t){if((e.headers.get(`content-type`)??``).includes(`application/json`)){let n=await e.json().catch(()=>null),r=F({code:I().optional(),error:I().optional(),message:I().optional()}).safeParse(n);if(r.success)return r.data.error??r.data.message??t}return await e.text().catch(()=>``)||t}async function Y(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 Y({body:{email:e.email,role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to create invitation link`,method:`POST`,path:K(e.organizationId,`invitations`),successSchema:Ce})}async function Oe(e){return Y({errorMessage:`Failed to cancel invitation`,method:`DELETE`,path:K(e.organizationId,`invitations`,e.invitationId),successSchema:Ce})}async function ke(e){return Y({body:{role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to update role`,method:`PATCH`,path:K(e.organizationId,`members`,e.memberId,`role`),successSchema:we})}async function Ae(e){return Y({errorMessage:`Failed to remove member`,method:`DELETE`,path:K(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,q.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=V(r,n.organizationId),t[3]=r,t[4]=n.organizationId,t[5]=l):l=t[5];let d;t[6]!==n.id||t[7]!==c||t[8]!==l.queryKey?(d={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]=d):d=t[9];let f=E(d),p=n.expiresAt?Date.parse(n.expiresAt)<Date.now():!1,h;t[10]===n.email?h=t[11]:(h=(0,J.jsx)(u,{children:(0,J.jsx)(`span`,{className:`font-medium`,children:n.email})}),t[10]=n.email,t[11]=h);let g;t[12]!==n.rawRole||t[13]!==n.roleNames?(g=(0,J.jsx)(u,{children:(0,J.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole,emptyLabel:`Member`})}),t[12]=n.rawRole,t[13]=n.roleNames,t[14]=g):g=t[14];let _=p?`text-destructive`:`text-muted-foreground`,v;t[15]===n.expiresAt?v=t[16]:(v=n.expiresAt?je(n.expiresAt):`Pending`,t[15]=n.expiresAt,t[16]=v);let x;t[17]!==_||t[18]!==v?(x=(0,J.jsx)(u,{children:(0,J.jsx)(`span`,{className:_,children:v})}),t[17]=_,t[18]=v,t[19]=x):x=t[19];let S;t[20]!==a||t[21]!==f||t[22]!==p?(S=a&&!p&&(0,J.jsx)(s,{variant:`ghost`,size:`icon-sm`,onClick:()=>f.mutate(),disabled:f.isPending,title:`Cancel invitation`,children:f.isPending?(0,J.jsx)(y,{size:16,className:`animate-spin`}):(0,J.jsx)(b,{size:16,stroke:2})}),t[20]=a,t[21]=f,t[22]=p,t[23]=S):S=t[23];let C;t[24]===S?C=t[25]:(C=(0,J.jsx)(u,{className:`text-right`,children:S}),t[24]=S,t[25]=C);let w;return t[26]!==C||t[27]!==h||t[28]!==g||t[29]!==x?(w=(0,J.jsxs)(m,{children:[h,g,x,C]}),t[26]=C,t[27]=h,t[28]=g,t[29]=x,t[30]=w):w=t[30],w}function Ne(e){let t=(0,q.c)(31),{currentUserId:n,organizationId:r,canManageInvitationMutations:i}=e,a;t[0]!==n||t[1]!==r?(a=V(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=M(a);if(o.isPending){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.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,J.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,u,h,g,_,v;if(t[5]!==i||t[6]!==n||t[7]!==s||t[8]!==r){v=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,J.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No pending invitations.`}),t[15]=e):e=t[15],v=e;break bb0}_=`rounded-md border`,u=d,t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,J.jsx)(f,{children:(0,J.jsxs)(m,{children:[(0,J.jsx)(l,{children:`Email`}),(0,J.jsx)(l,{children:`Role`}),(0,J.jsx)(l,{children:`Status`}),(0,J.jsx)(l,{className:`text-right w-[50px]`})]})}),t[16]=g):g=t[16],c=p;let a;t[17]!==i||t[18]!==n||t[19]!==r?(a=e=>(0,J.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],h=e.map(a)}t[5]=i,t[6]=n,t[7]=s,t[8]=r,t[9]=c,t[10]=u,t[11]=h,t[12]=g,t[13]=_,t[14]=v}else c=t[9],u=t[10],h=t[11],g=t[12],_=t[13],v=t[14];if(v!==Symbol.for(`react.early_return_sentinel`))return v;let y;t[21]!==c||t[22]!==h?(y=(0,J.jsx)(c,{children:h}),t[21]=c,t[22]=h,t[23]=y):y=t[23];let b;t[24]!==u||t[25]!==g||t[26]!==y?(b=(0,J.jsxs)(u,{children:[g,y]}),t[24]=u,t[25]=g,t[26]=y,t[27]=b):b=t[27];let x;return t[28]!==_||t[29]!==b?(x=(0,J.jsx)(`div`,{className:_,children:b}),t[28]=_,t[29]=b,t[30]=x):x=t[30],x}function Pe(e){return e.status===`pending`}var X=e(t(),1),Fe=[`admin`,`member`],Ie=[{label:`Admin`,value:`admin`},{label:`Member`,value:`member`}],Le=[`member`],Z={RESET:`teamRoleSelection/reset`,SOURCE_ROLE_NAMES_SYNCED:`teamRoleSelection/sourceRoleNamesSynced`,TOGGLE_ROLE:`teamRoleSelection/toggleRole`},Q={CLEAN:`clean`,DIRTY:`dirty`,EVALUATING:`evaluating`},Re={DIRTY:`dirty`};function $(e){let t=new Set;for(let n of e)(n===`admin`||n===`member`)&&t.add(n);return Fe.filter(e=>t.has(e))}function ze(e){let t=$(e);return{selectedRoleNames:[...t],sourceRoleNames:[...t]}}var Be=le({actions:{resetSelectedRoleNames:G({selectedRoleNames:({context:e})=>[...e.sourceRoleNames]}),syncSourceRoleNames:G({selectedRoleNames:(e,t)=>[...t.roleNames],sourceRoleNames:(e,t)=>[...t.roleNames]}),toggleRoleName:G({selectedRoleNames:({context:e},t)=>{let n=new Set(e.selectedRoleNames);return n.has(t.roleName)?n.delete(t.roleName):n.add(t.roleName),Fe.filter(e=>n.has(e))}})},guards:{hasRoleSelectionChanges:({context:e})=>R(e.selectedRoleNames)!==R(e.sourceRoleNames)},types:{}}).createMachine({context:({input:e})=>ze(e.initialRoleNames),id:`teamRoleSelection`,initial:Q.EVALUATING,on:{[Z.RESET]:{actions:`resetSelectedRoleNames`,target:`.${Q.EVALUATING}`},[Z.SOURCE_ROLE_NAMES_SYNCED]:{actions:{type:`syncSourceRoleNames`,params:({event:e})=>({roleNames:$(e.roleNames)})},target:`.${Q.EVALUATING}`},[Z.TOGGLE_ROLE]:{actions:{type:`toggleRoleName`,params:({event:e})=>({roleName:e.roleName})},target:`.${Q.EVALUATING}`}},states:{[Q.EVALUATING]:{always:[{guard:`hasRoleSelectionChanges`,target:Q.DIRTY},{target:Q.CLEAN}]},[Q.CLEAN]:{},[Q.DIRTY]:{tags:Re.DIRTY}}});function Ve(e){let t=(0,q.c)(19),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]=ue(Be,r),o;t[4]===i?o=t[5]:(o=i.hasTag(Re.DIRTY),t[4]=i,t[5]=o);let s=i.context.selectedRoleNames.length===0,c;t[6]===a?c=t[7]:(c=()=>{a({type:Z.RESET})},t[6]=a,t[7]=c);let l=c,u;t[8]===a?u=t[9]:(u=e=>{a({type:Z.SOURCE_ROLE_NAMES_SYNCED,roleNames:e})},t[8]=a,t[9]=u);let d=u,f;t[10]===a?f=t[11]:(f=e=>{a({type:Z.TOGGLE_ROLE,roleName:e})},t[10]=a,t[11]=f);let p=f,m;return t[12]!==i.context.selectedRoleNames||t[13]!==o||t[14]!==s||t[15]!==l||t[16]!==d||t[17]!==p?(m={hasChanges:o,isSelectionEmpty:s,reset:l,resetToRoleNames:d,selectedRoleNames:i.context.selectedRoleNames,toggleRole:p},t[12]=i.context.selectedRoleNames,t[13]=o,t[14]=s,t[15]=l,t[16]=d,t[17]=p,t[18]=m):m=t[18],m}function He(e){return e instanceof HTMLElement&&e.closest(`[data-slot="checkbox"]`)!==null}function Ue(e){let t=(0,q.c)(12),{errorMessage:n,helperText:r,onToggleRole:i,selectedRoleNames:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,J.jsx)(fe,{children:`Roles`}),t[0]=o):o=t[0];let s;t[1]!==i||t[2]!==a?(s=Ie.map(e=>(0,J.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=>{He(t.target)||i(e.value)},children:[(0,J.jsx)(v,{checked:a.includes(e.value),onCheckedChange:()=>i(e.value)}),(0,J.jsx)(`div`,{children:(0,J.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,J.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,J.jsx)(`p`,{className:`text-sm text-destructive`,children:n}):(0,J.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,J.jsxs)(`div`,{className:`space-y-2`,children:[o,c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11],u}var We=F({email:L(`Please enter a valid email address`)});function Ge(e){let t=(0,q.c)(44),{children:n,currentUserId:r,organizationId:i}=e,[o,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={initialRoleNames:Le},t[0]=p):p=t[0];let m=Ve(p),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g={defaultValues:{email:``},resolver:he(We)},t[1]=g):g=t[1];let _=me(g),v;t[2]===i?v=t[3]:(v=e=>({id:`temp-${crypto.randomUUID()}`,email:e.email,rawRole:R(e.roleNames),roleNames:[...e.roleNames],status:`pending`,expiresAt:ee().toISOString(),organizationId:i,inviterId:`current-user`}),t[2]=i,t[3]=v);let y;t[4]===i?y=t[5]:(y=async e=>De({email:e.email,organizationId:i,roleNames:e.roleNames}),t[4]=i,t[5]=y);let b;t[6]!==_||t[7]!==m?(b=e=>{e?.id&&u({expiresAt:e.expiresAt??ee().toISOString(),url:`${a()}${x(e.id)}`}),_.reset(),m.reset(),f(null)},t[6]=_,t[7]=m,t[8]=b):b=t[8];let E;t[9]!==r||t[10]!==i?(E=V(r,i),t[9]=r,t[10]=i,t[11]=E):E=t[11];let j;t[12]!==v||t[13]!==y||t[14]!==b||t[15]!==E.queryKey?(j={createOptimisticItem:v,errorMessage:`Failed to create invitation link`,mutationFn:y,onSuccess:b,queryKey:E.queryKey,successMessage:`Invitation link created`},t[12]=v,t[13]=y,t[14]=b,t[15]=E.queryKey,t[16]=j):j=t[16];let M=A(j),N;t[17]!==M||t[18]!==m.isSelectionEmpty||t[19]!==m.selectedRoleNames?(N=e=>{if(m.isSelectionEmpty){f(`Select at least one role`);return}M.mutate({...e,roleNames:m.selectedRoleNames})},t[17]=M,t[18]=m.isSelectionEmpty,t[19]=m.selectedRoleNames,t[20]=N):N=t[20];let P=N,F;t[21]!==_||t[22]!==m?(F=e=>{c(e),e||(u(null),f(null),m.reset(),_.reset())},t[21]=_,t[22]=m,t[23]=F):F=t[23];let I=F,L;t[24]!==d||t[25]!==m?(L=e=>{d&&f(null),m.toggleRole(e)},t[24]=d,t[25]=m,t[26]=L):L=t[26];let z=L,B;t[27]===n?B=t[28]:(B=(0,J.jsx)(T,{render:n}),t[27]=n,t[28]=B);let H;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,J.jsxs)(k,{children:[(0,J.jsx)(C,{children:`Create Invitation Link`}),(0,J.jsx)(S,{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]=H):H=t[29];let U;t[30]!==_||t[31]!==z||t[32]!==l||t[33]!==M||t[34]!==P||t[35]!==d||t[36]!==m.isSelectionEmpty||t[37]!==m.selectedRoleNames?(U=(0,J.jsxs)(w,{className:`sm:max-w-[400px]`,children:[H,l?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`space-y-2 pt-4`,children:[(0,J.jsx)(fe,{children:`Invitation Link`}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(te,{value:l.url,readOnly:!0,className:`flex-1 text-sm`}),(0,J.jsx)(h,{value:l.url})]}),(0,J.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`,` `,de(l.expiresAt),`.`]})]}),(0,J.jsxs)(D,{children:[(0,J.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>u(null),children:`Create Another Link`}),(0,J.jsx)(s,{type:`button`,onClick:()=>c(!1),children:`Done`})]})]}):(0,J.jsxs)(`form`,{onSubmit:e=>{_.handleSubmit(P)(e)},className:`space-y-4 pt-4`,children:[(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(fe,{htmlFor:`email`,children:`Email Address`}),(0,J.jsx)(te,{id:`email`,type:`email`,placeholder:`colleague@example.com`,..._.register(`email`)}),_.formState.errors.email&&(0,J.jsx)(`p`,{className:`text-sm text-destructive`,children:_.formState.errors.email.message})]}),(0,J.jsx)(Ue,{errorMessage:d,helperText:`Select one or more roles for this invitation.`,onToggleRole:z,selectedRoleNames:m.selectedRoleNames}),(0,J.jsxs)(D,{children:[(0,J.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>c(!1),children:`Cancel`}),(0,J.jsx)(s,{type:`submit`,disabled:M.isPending||m.isSelectionEmpty,children:M.isPending?`Creating Link...`:`Create Invitation Link`})]})]})]}),t[30]=_,t[31]=z,t[32]=l,t[33]=M,t[34]=P,t[35]=d,t[36]=m.isSelectionEmpty,t[37]=m.selectedRoleNames,t[38]=U):U=t[38];let W;return t[39]!==I||t[40]!==o||t[41]!==B||t[42]!==U?(W=(0,J.jsxs)(O,{open:o,onOpenChange:I,children:[B,U]}),t[39]=I,t[40]=o,t[41]=B,t[42]=U,t[43]=W):W=t[43],W}function Ke({currentUserId:e,open:t,onOpenChange:n,member:r}){let i=H(),a=(0,X.useMemo)(()=>$(r.roleNames),[R(r.roleNames)]),o=Ve({initialRoleNames:a});(0,X.useEffect)(()=>{t&&o.resetToRoleNames(a)},[a,r.id,t,o.resetToRoleNames]);let c=j({mutationFn:async()=>{await ke({memberId:r.id,organizationId:r.organizationId,roleNames:o.selectedRoleNames})},onError:e=>{W.error(e.message||`Failed to update role`)},onSuccess:()=>{W.success(`Role updated`),i.invalidateQueries({queryKey:B(e,r.organizationId).queryKey}),n(!1)}});return(0,J.jsx)(O,{open:t,onOpenChange:n,children:(0,J.jsxs)(w,{className:`sm:max-w-[400px]`,children:[(0,J.jsxs)(k,{children:[(0,J.jsx)(C,{children:`Change Role`}),(0,J.jsxs)(S,{children:[`Update the role for `,r.user.name]})]}),(0,J.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),!o.hasChanges){n(!1);return}c.mutate()},className:`space-y-4 pt-4`,children:[(0,J.jsx)(Ue,{helperText:`Select one or more roles for this member.`,onToggleRole:o.toggleRole,selectedRoleNames:o.selectedRoleNames}),(0,J.jsxs)(D,{children:[(0,J.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,J.jsx)(s,{type:`submit`,disabled:c.isPending||o.isSelectionEmpty,children:c.isPending?`Updating...`:`Update Role`})]})]})]})})}function qe(e){return e.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2)}function Je(e){let t=(0,q.c)(51),{member:n,currentUserId:r,canManageMemberMutations:i}=e,[a,o]=(0,X.useState)(!1),c=n.userId===r,l;t[0]===n.rawRole?l=t[1]:(l=z({roleName:`owner`,rawRole:n.rawRole}),t[0]=n.rawRole,t[1]=l);let d=l,f=n.id,p;t[2]!==n.id||t[3]!==n.organizationId?(p=async()=>{await Ae({memberId:n.id,organizationId:n.organizationId})},t[2]=n.id,t[3]=n.organizationId,t[4]=p):p=t[4];let h;t[5]!==r||t[6]!==n.organizationId?(h=B(r,n.organizationId),t[5]=r,t[6]=n.organizationId,t[7]=h):h=t[7];let v;t[8]!==n.id||t[9]!==p||t[10]!==h.queryKey?(v={errorMessage:`Failed to remove member`,itemId:f,mutationFn:p,queryKey:h.queryKey,successMessage:`Member removed`},t[8]=n.id,t[9]=p,t[10]=h.queryKey,t[11]=v):v=t[11];let y=E(v),b=i&&!d&&!c,x=i&&!d&&!c,S;t[12]===n.user.image?S=t[13]:(S=n.user.image&&(0,J.jsx)(re,{src:n.user.image}),t[12]=n.user.image,t[13]=S);let C;t[14]===n.user.name?C=t[15]:(C=qe(n.user.name),t[14]=n.user.name,t[15]=C);let w;t[16]===C?w=t[17]:(w=(0,J.jsx)(ne,{children:C}),t[16]=C,t[17]=w);let T;t[18]!==S||t[19]!==w?(T=(0,J.jsxs)(ie,{size:`sm`,children:[S,w]}),t[18]=S,t[19]=w,t[20]=T):T=t[20];let D;t[21]===n.user.name?D=t[22]:(D=(0,J.jsx)(`div`,{className:`font-medium`,children:n.user.name}),t[21]=n.user.name,t[22]=D);let O;t[23]===n.user.email?O=t[24]:(O=(0,J.jsx)(`div`,{className:`text-muted-foreground text-sm`,children:n.user.email}),t[23]=n.user.email,t[24]=O);let k;t[25]!==D||t[26]!==O?(k=(0,J.jsxs)(`div`,{children:[D,O]}),t[25]=D,t[26]=O,t[27]=k):k=t[27];let A;t[28]!==k||t[29]!==T?(A=(0,J.jsx)(u,{children:(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[T,k]})}),t[28]=k,t[29]=T,t[30]=A):A=t[30];let j;t[31]!==n.rawRole||t[32]!==n.roleNames?(j=(0,J.jsx)(u,{children:(0,J.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole})}),t[31]=n.rawRole,t[32]=n.roleNames,t[33]=j):j=t[33];let M;t[34]!==b||t[35]!==x||t[36]!==y?(M=(b||x)&&(0,J.jsxs)(ce,{children:[(0,J.jsx)(ae,{children:(0,J.jsx)(s,{variant:`ghost`,size:`icon-sm`,children:(0,J.jsx)(_,{size:16,stroke:2})})}),(0,J.jsxs)(oe,{align:`end`,children:[b&&(0,J.jsxs)(se,{onClick:()=>o(!0),children:[(0,J.jsx)(ge,{size:16,stroke:2}),`Change Role`]}),x&&(0,J.jsxs)(se,{onClick:()=>y.mutate(),disabled:y.isPending,className:`text-destructive focus:text-destructive`,children:[(0,J.jsx)(g,{size:16,stroke:2}),y.isPending?`Removing...`:`Remove`]})]})]}),t[34]=b,t[35]=x,t[36]=y,t[37]=M):M=t[37];let N;t[38]===M?N=t[39]:(N=(0,J.jsx)(u,{className:`text-right`,children:M}),t[38]=M,t[39]=N);let P;t[40]!==A||t[41]!==j||t[42]!==N?(P=(0,J.jsxs)(m,{children:[A,j,N]}),t[40]=A,t[41]=j,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==r||t[45]!==n||t[46]!==a?(F=(0,J.jsx)(Ke,{open:a,onOpenChange:o,currentUserId:r,member:n}),t[44]=r,t[45]=n,t[46]=a,t[47]=F):F=t[47];let I;return t[48]!==P||t[49]!==F?(I=(0,J.jsxs)(J.Fragment,{children:[P,F]}),t[48]=P,t[49]=F,t[50]=I):I=t[50],I}function Ye(e){let t=(0,q.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,J.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,J.jsx)(f,{children:(0,J.jsxs)(m,{children:[(0,J.jsx)(l,{children:`Member`}),(0,J.jsx)(l,{children:`Role`}),(0,J.jsx)(l,{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,J.jsx)(Je,{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,J.jsx)(`div`,{className:`rounded-md border`,children:(0,J.jsxs)(d,{children:[a,(0,J.jsx)(p,{children:o})]})}),t[9]=o,t[10]=s),s}var Xe=i(`/_authenticated/$org_slug/team`);function Ze(e){let t=(0,q.c)(27),n;t[0]!==e.currentUserId||t[1]!==e.organizationId?(n=B(e.currentUserId,e.organizationId),t[0]=e.currentUserId,t[1]=e.organizationId,t[2]=n):n=t[2];let{data:r}=N(n),i;t[3]!==r||t[4]!==e.currentUserId?(i=U({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,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Members`}),(0,J.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,J.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:o?(0,J.jsx)(Ge,{currentUserId:e.currentUserId,organizationId:e.organizationId,children:(0,J.jsxs)(s,{children:[(0,J.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,J.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,J.jsx)(Ye,{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,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-xl font-semibold mb-2`,children:`Pending Invitations`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:`Invitations that haven't been accepted yet.`}),(0,J.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,J.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 Qe(){let e=(0,q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`div`,{className:`mb-8`,children:[(0,J.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Team`}),(0,J.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 $e(){let e=(0,q.c)(4),{organizationId:t,session:n}=Xe.useRouteContext(),r=n.user.id,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,J.jsx)(Qe,{}),e[0]=i):i=e[0];let a;return e[1]!==r||e[2]!==t?(a=(0,J.jsxs)(`div`,{className:`p-8`,children:[i,(0,J.jsx)(Ze,{organizationId:t,currentUserId:r})]}),e[1]=r,e[2]=t,e[3]=a):a=e[3],a}var et=$e;export{et 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{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./copy-button-BO1KBdf9.js";import{n as g,r as _,t as v}from"./checkbox-Bii9Pcrx.js";import{t as y}from"./IconLoader2-BpZcTuHV.js";import{t as b}from"./IconX-rRpRFwc5.js";import{l as x}from"./app-routes-CMyon6Em.js";import{a as S,c as C,i as w,l as T,n as E,o as D,r as O,s as k,t as A,u as j}from"./use-optimistic-mutation-3PPnMc-O.js";import{t as M}from"./useQuery-DyOxsY45.js";import{t as N}from"./useSuspenseQuery-CBFRU4At.js";import{_ as P,d as F,p as I,s as L}from"./schemas-EcBBwCo1.js";import{n as ee}from"./src-C5F1uEDb.js";import{a as R,r as z}from"./organization-permissions-BXV_ess0.js";import{C as B,S as V,V as H,w as U,z as W}from"./index-CXR0dKJj.js";import{t as te}from"./input-BRu0b1Tq.js";import{n as ne,r as re,t as ie}from"./avatar-SaFoLofF.js";import{d as ae,n as oe,r as se,t as ce}from"./dropdown-menu-Cw2MW0pD.js";import{i as G,r as le,t as ue}from"./xstate-react.esm-Bo3CCIRt.js";import{t as de}from"./format-date-Rg05aHXh.js";import{t as fe}from"./label-f2wVZcni.js";import{t as pe}from"./badge-BFPkSrVD.js";import{r as K}from"./api-paths-DcYkf-C_.js";import{n as me,t as he}from"./zod-D0PWrP9q.js";var 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`}]]),q=r(),J=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,q.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,J.jsx)(pe,{variant:r,children:i}),t[4]=r,t[5]=i,t[6]=a):a=t[6],a}function xe(e){let t=(0,q.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,J.jsx)(pe,{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,J.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:a}),t[7]=a,t[8]=o),o}function Se(e){return(0,J.jsx)(be,{role:e},e)}var Ce=F({expiresAt:P().optional(),id:I(),role:I().optional()}),we=F({id:I(),role:I()}),Te=F({member:we});async function Ee(e,t){if((e.headers.get(`content-type`)??``).includes(`application/json`)){let n=await e.json().catch(()=>null),r=F({code:I().optional(),error:I().optional(),message:I().optional()}).safeParse(n);if(r.success)return r.data.error??r.data.message??t}return await e.text().catch(()=>``)||t}async function Y(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 Y({body:{email:e.email,role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to create invitation link`,method:`POST`,path:K(e.organizationId,`invitations`),successSchema:Ce})}async function Oe(e){return Y({errorMessage:`Failed to cancel invitation`,method:`DELETE`,path:K(e.organizationId,`invitations`,e.invitationId),successSchema:Ce})}async function ke(e){return Y({body:{role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to update role`,method:`PATCH`,path:K(e.organizationId,`members`,e.memberId,`role`),successSchema:we})}async function Ae(e){return Y({errorMessage:`Failed to remove member`,method:`DELETE`,path:K(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,q.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=V(r,n.organizationId),t[3]=r,t[4]=n.organizationId,t[5]=l):l=t[5];let d;t[6]!==n.id||t[7]!==c||t[8]!==l.queryKey?(d={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]=d):d=t[9];let f=E(d),p=n.expiresAt?Date.parse(n.expiresAt)<Date.now():!1,h;t[10]===n.email?h=t[11]:(h=(0,J.jsx)(u,{children:(0,J.jsx)(`span`,{className:`font-medium`,children:n.email})}),t[10]=n.email,t[11]=h);let g;t[12]!==n.rawRole||t[13]!==n.roleNames?(g=(0,J.jsx)(u,{children:(0,J.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole,emptyLabel:`Member`})}),t[12]=n.rawRole,t[13]=n.roleNames,t[14]=g):g=t[14];let _=p?`text-destructive`:`text-muted-foreground`,v;t[15]===n.expiresAt?v=t[16]:(v=n.expiresAt?je(n.expiresAt):`Pending`,t[15]=n.expiresAt,t[16]=v);let x;t[17]!==_||t[18]!==v?(x=(0,J.jsx)(u,{children:(0,J.jsx)(`span`,{className:_,children:v})}),t[17]=_,t[18]=v,t[19]=x):x=t[19];let S;t[20]!==a||t[21]!==f||t[22]!==p?(S=a&&!p&&(0,J.jsx)(s,{variant:`ghost`,size:`icon-sm`,onClick:()=>f.mutate(),disabled:f.isPending,title:`Cancel invitation`,children:f.isPending?(0,J.jsx)(y,{size:16,className:`animate-spin`}):(0,J.jsx)(b,{size:16,stroke:2})}),t[20]=a,t[21]=f,t[22]=p,t[23]=S):S=t[23];let C;t[24]===S?C=t[25]:(C=(0,J.jsx)(u,{className:`text-right`,children:S}),t[24]=S,t[25]=C);let w;return t[26]!==C||t[27]!==h||t[28]!==g||t[29]!==x?(w=(0,J.jsxs)(m,{children:[h,g,x,C]}),t[26]=C,t[27]=h,t[28]=g,t[29]=x,t[30]=w):w=t[30],w}function Ne(e){let t=(0,q.c)(31),{currentUserId:n,organizationId:r,canManageInvitationMutations:i}=e,a;t[0]!==n||t[1]!==r?(a=V(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=M(a);if(o.isPending){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.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,J.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,u,h,g,_,v;if(t[5]!==i||t[6]!==n||t[7]!==s||t[8]!==r){v=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,J.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No pending invitations.`}),t[15]=e):e=t[15],v=e;break bb0}_=`rounded-md border`,u=d,t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,J.jsx)(f,{children:(0,J.jsxs)(m,{children:[(0,J.jsx)(l,{children:`Email`}),(0,J.jsx)(l,{children:`Role`}),(0,J.jsx)(l,{children:`Status`}),(0,J.jsx)(l,{className:`text-right w-[50px]`})]})}),t[16]=g):g=t[16],c=p;let a;t[17]!==i||t[18]!==n||t[19]!==r?(a=e=>(0,J.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],h=e.map(a)}t[5]=i,t[6]=n,t[7]=s,t[8]=r,t[9]=c,t[10]=u,t[11]=h,t[12]=g,t[13]=_,t[14]=v}else c=t[9],u=t[10],h=t[11],g=t[12],_=t[13],v=t[14];if(v!==Symbol.for(`react.early_return_sentinel`))return v;let y;t[21]!==c||t[22]!==h?(y=(0,J.jsx)(c,{children:h}),t[21]=c,t[22]=h,t[23]=y):y=t[23];let b;t[24]!==u||t[25]!==g||t[26]!==y?(b=(0,J.jsxs)(u,{children:[g,y]}),t[24]=u,t[25]=g,t[26]=y,t[27]=b):b=t[27];let x;return t[28]!==_||t[29]!==b?(x=(0,J.jsx)(`div`,{className:_,children:b}),t[28]=_,t[29]=b,t[30]=x):x=t[30],x}function Pe(e){return e.status===`pending`}var X=e(t(),1),Fe=[`admin`,`member`],Ie=[{label:`Admin`,value:`admin`},{label:`Member`,value:`member`}],Le=[`member`],Z={RESET:`teamRoleSelection/reset`,SOURCE_ROLE_NAMES_SYNCED:`teamRoleSelection/sourceRoleNamesSynced`,TOGGLE_ROLE:`teamRoleSelection/toggleRole`},Q={CLEAN:`clean`,DIRTY:`dirty`,EVALUATING:`evaluating`},Re={DIRTY:`dirty`};function $(e){let t=new Set;for(let n of e)(n===`admin`||n===`member`)&&t.add(n);return Fe.filter(e=>t.has(e))}function ze(e){let t=$(e);return{selectedRoleNames:[...t],sourceRoleNames:[...t]}}var Be=le({actions:{resetSelectedRoleNames:G({selectedRoleNames:({context:e})=>[...e.sourceRoleNames]}),syncSourceRoleNames:G({selectedRoleNames:(e,t)=>[...t.roleNames],sourceRoleNames:(e,t)=>[...t.roleNames]}),toggleRoleName:G({selectedRoleNames:({context:e},t)=>{let n=new Set(e.selectedRoleNames);return n.has(t.roleName)?n.delete(t.roleName):n.add(t.roleName),Fe.filter(e=>n.has(e))}})},guards:{hasRoleSelectionChanges:({context:e})=>R(e.selectedRoleNames)!==R(e.sourceRoleNames)},types:{}}).createMachine({context:({input:e})=>ze(e.initialRoleNames),id:`teamRoleSelection`,initial:Q.EVALUATING,on:{[Z.RESET]:{actions:`resetSelectedRoleNames`,target:`.${Q.EVALUATING}`},[Z.SOURCE_ROLE_NAMES_SYNCED]:{actions:{type:`syncSourceRoleNames`,params:({event:e})=>({roleNames:$(e.roleNames)})},target:`.${Q.EVALUATING}`},[Z.TOGGLE_ROLE]:{actions:{type:`toggleRoleName`,params:({event:e})=>({roleName:e.roleName})},target:`.${Q.EVALUATING}`}},states:{[Q.EVALUATING]:{always:[{guard:`hasRoleSelectionChanges`,target:Q.DIRTY},{target:Q.CLEAN}]},[Q.CLEAN]:{},[Q.DIRTY]:{tags:Re.DIRTY}}});function Ve(e){let t=(0,q.c)(19),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]=ue(Be,r),o;t[4]===i?o=t[5]:(o=i.hasTag(Re.DIRTY),t[4]=i,t[5]=o);let s=i.context.selectedRoleNames.length===0,c;t[6]===a?c=t[7]:(c=()=>{a({type:Z.RESET})},t[6]=a,t[7]=c);let l=c,u;t[8]===a?u=t[9]:(u=e=>{a({type:Z.SOURCE_ROLE_NAMES_SYNCED,roleNames:e})},t[8]=a,t[9]=u);let d=u,f;t[10]===a?f=t[11]:(f=e=>{a({type:Z.TOGGLE_ROLE,roleName:e})},t[10]=a,t[11]=f);let p=f,m;return t[12]!==i.context.selectedRoleNames||t[13]!==o||t[14]!==s||t[15]!==l||t[16]!==d||t[17]!==p?(m={hasChanges:o,isSelectionEmpty:s,reset:l,resetToRoleNames:d,selectedRoleNames:i.context.selectedRoleNames,toggleRole:p},t[12]=i.context.selectedRoleNames,t[13]=o,t[14]=s,t[15]=l,t[16]=d,t[17]=p,t[18]=m):m=t[18],m}function He(e){return e instanceof HTMLElement&&e.closest(`[data-slot="checkbox"]`)!==null}function Ue(e){let t=(0,q.c)(12),{errorMessage:n,helperText:r,onToggleRole:i,selectedRoleNames:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,J.jsx)(fe,{children:`Roles`}),t[0]=o):o=t[0];let s;t[1]!==i||t[2]!==a?(s=Ie.map(e=>(0,J.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=>{He(t.target)||i(e.value)},children:[(0,J.jsx)(v,{checked:a.includes(e.value),onCheckedChange:()=>i(e.value)}),(0,J.jsx)(`div`,{children:(0,J.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,J.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,J.jsx)(`p`,{className:`text-sm text-destructive`,children:n}):(0,J.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,J.jsxs)(`div`,{className:`space-y-2`,children:[o,c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11],u}var We=F({email:L(`Please enter a valid email address`)});function Ge(e){let t=(0,q.c)(44),{children:n,currentUserId:r,organizationId:i}=e,[o,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={initialRoleNames:Le},t[0]=p):p=t[0];let m=Ve(p),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g={defaultValues:{email:``},resolver:he(We)},t[1]=g):g=t[1];let _=me(g),v;t[2]===i?v=t[3]:(v=e=>({id:`temp-${crypto.randomUUID()}`,email:e.email,rawRole:R(e.roleNames),roleNames:[...e.roleNames],status:`pending`,expiresAt:ee().toISOString(),organizationId:i,inviterId:`current-user`}),t[2]=i,t[3]=v);let y;t[4]===i?y=t[5]:(y=async e=>De({email:e.email,organizationId:i,roleNames:e.roleNames}),t[4]=i,t[5]=y);let b;t[6]!==_||t[7]!==m?(b=e=>{e?.id&&u({expiresAt:e.expiresAt??ee().toISOString(),url:`${a()}${x(e.id)}`}),_.reset(),m.reset(),f(null)},t[6]=_,t[7]=m,t[8]=b):b=t[8];let E;t[9]!==r||t[10]!==i?(E=V(r,i),t[9]=r,t[10]=i,t[11]=E):E=t[11];let j;t[12]!==v||t[13]!==y||t[14]!==b||t[15]!==E.queryKey?(j={createOptimisticItem:v,errorMessage:`Failed to create invitation link`,mutationFn:y,onSuccess:b,queryKey:E.queryKey,successMessage:`Invitation link created`},t[12]=v,t[13]=y,t[14]=b,t[15]=E.queryKey,t[16]=j):j=t[16];let M=A(j),N;t[17]!==M||t[18]!==m.isSelectionEmpty||t[19]!==m.selectedRoleNames?(N=e=>{if(m.isSelectionEmpty){f(`Select at least one role`);return}M.mutate({...e,roleNames:m.selectedRoleNames})},t[17]=M,t[18]=m.isSelectionEmpty,t[19]=m.selectedRoleNames,t[20]=N):N=t[20];let P=N,F;t[21]!==_||t[22]!==m?(F=e=>{c(e),e||(u(null),f(null),m.reset(),_.reset())},t[21]=_,t[22]=m,t[23]=F):F=t[23];let I=F,L;t[24]!==d||t[25]!==m?(L=e=>{d&&f(null),m.toggleRole(e)},t[24]=d,t[25]=m,t[26]=L):L=t[26];let z=L,B;t[27]===n?B=t[28]:(B=(0,J.jsx)(T,{render:n}),t[27]=n,t[28]=B);let H;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,J.jsxs)(k,{children:[(0,J.jsx)(C,{children:`Create Invitation Link`}),(0,J.jsx)(S,{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]=H):H=t[29];let U;t[30]!==_||t[31]!==z||t[32]!==l||t[33]!==M||t[34]!==P||t[35]!==d||t[36]!==m.isSelectionEmpty||t[37]!==m.selectedRoleNames?(U=(0,J.jsxs)(w,{className:`sm:max-w-[400px]`,children:[H,l?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`space-y-2 pt-4`,children:[(0,J.jsx)(fe,{children:`Invitation Link`}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(te,{value:l.url,readOnly:!0,className:`flex-1 text-sm`}),(0,J.jsx)(h,{value:l.url})]}),(0,J.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`,` `,de(l.expiresAt),`.`]})]}),(0,J.jsxs)(D,{children:[(0,J.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>u(null),children:`Create Another Link`}),(0,J.jsx)(s,{type:`button`,onClick:()=>c(!1),children:`Done`})]})]}):(0,J.jsxs)(`form`,{onSubmit:e=>{_.handleSubmit(P)(e)},className:`space-y-4 pt-4`,children:[(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(fe,{htmlFor:`email`,children:`Email Address`}),(0,J.jsx)(te,{id:`email`,type:`email`,placeholder:`colleague@example.com`,..._.register(`email`)}),_.formState.errors.email&&(0,J.jsx)(`p`,{className:`text-sm text-destructive`,children:_.formState.errors.email.message})]}),(0,J.jsx)(Ue,{errorMessage:d,helperText:`Select one or more roles for this invitation.`,onToggleRole:z,selectedRoleNames:m.selectedRoleNames}),(0,J.jsxs)(D,{children:[(0,J.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>c(!1),children:`Cancel`}),(0,J.jsx)(s,{type:`submit`,disabled:M.isPending||m.isSelectionEmpty,children:M.isPending?`Creating Link...`:`Create Invitation Link`})]})]})]}),t[30]=_,t[31]=z,t[32]=l,t[33]=M,t[34]=P,t[35]=d,t[36]=m.isSelectionEmpty,t[37]=m.selectedRoleNames,t[38]=U):U=t[38];let W;return t[39]!==I||t[40]!==o||t[41]!==B||t[42]!==U?(W=(0,J.jsxs)(O,{open:o,onOpenChange:I,children:[B,U]}),t[39]=I,t[40]=o,t[41]=B,t[42]=U,t[43]=W):W=t[43],W}function Ke({currentUserId:e,open:t,onOpenChange:n,member:r}){let i=H(),a=(0,X.useMemo)(()=>$(r.roleNames),[R(r.roleNames)]),o=Ve({initialRoleNames:a});(0,X.useEffect)(()=>{t&&o.resetToRoleNames(a)},[a,r.id,t,o.resetToRoleNames]);let c=j({mutationFn:async()=>{await ke({memberId:r.id,organizationId:r.organizationId,roleNames:o.selectedRoleNames})},onError:e=>{W.error(e.message||`Failed to update role`)},onSuccess:()=>{W.success(`Role updated`),i.invalidateQueries({queryKey:B(e,r.organizationId).queryKey}),n(!1)}});return(0,J.jsx)(O,{open:t,onOpenChange:n,children:(0,J.jsxs)(w,{className:`sm:max-w-[400px]`,children:[(0,J.jsxs)(k,{children:[(0,J.jsx)(C,{children:`Change Role`}),(0,J.jsxs)(S,{children:[`Update the role for `,r.user.name]})]}),(0,J.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),!o.hasChanges){n(!1);return}c.mutate()},className:`space-y-4 pt-4`,children:[(0,J.jsx)(Ue,{helperText:`Select one or more roles for this member.`,onToggleRole:o.toggleRole,selectedRoleNames:o.selectedRoleNames}),(0,J.jsxs)(D,{children:[(0,J.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,J.jsx)(s,{type:`submit`,disabled:c.isPending||o.isSelectionEmpty,children:c.isPending?`Updating...`:`Update Role`})]})]})]})})}function qe(e){return e.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2)}function Je(e){let t=(0,q.c)(51),{member:n,currentUserId:r,canManageMemberMutations:i}=e,[a,o]=(0,X.useState)(!1),c=n.userId===r,l;t[0]===n.rawRole?l=t[1]:(l=z({roleName:`owner`,rawRole:n.rawRole}),t[0]=n.rawRole,t[1]=l);let d=l,f=n.id,p;t[2]!==n.id||t[3]!==n.organizationId?(p=async()=>{await Ae({memberId:n.id,organizationId:n.organizationId})},t[2]=n.id,t[3]=n.organizationId,t[4]=p):p=t[4];let h;t[5]!==r||t[6]!==n.organizationId?(h=B(r,n.organizationId),t[5]=r,t[6]=n.organizationId,t[7]=h):h=t[7];let v;t[8]!==n.id||t[9]!==p||t[10]!==h.queryKey?(v={errorMessage:`Failed to remove member`,itemId:f,mutationFn:p,queryKey:h.queryKey,successMessage:`Member removed`},t[8]=n.id,t[9]=p,t[10]=h.queryKey,t[11]=v):v=t[11];let y=E(v),b=i&&!d&&!c,x=i&&!d&&!c,S;t[12]===n.user.image?S=t[13]:(S=n.user.image&&(0,J.jsx)(re,{src:n.user.image}),t[12]=n.user.image,t[13]=S);let C;t[14]===n.user.name?C=t[15]:(C=qe(n.user.name),t[14]=n.user.name,t[15]=C);let w;t[16]===C?w=t[17]:(w=(0,J.jsx)(ne,{children:C}),t[16]=C,t[17]=w);let T;t[18]!==S||t[19]!==w?(T=(0,J.jsxs)(ie,{size:`sm`,children:[S,w]}),t[18]=S,t[19]=w,t[20]=T):T=t[20];let D;t[21]===n.user.name?D=t[22]:(D=(0,J.jsx)(`div`,{className:`font-medium`,children:n.user.name}),t[21]=n.user.name,t[22]=D);let O;t[23]===n.user.email?O=t[24]:(O=(0,J.jsx)(`div`,{className:`text-muted-foreground text-sm`,children:n.user.email}),t[23]=n.user.email,t[24]=O);let k;t[25]!==D||t[26]!==O?(k=(0,J.jsxs)(`div`,{children:[D,O]}),t[25]=D,t[26]=O,t[27]=k):k=t[27];let A;t[28]!==k||t[29]!==T?(A=(0,J.jsx)(u,{children:(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[T,k]})}),t[28]=k,t[29]=T,t[30]=A):A=t[30];let j;t[31]!==n.rawRole||t[32]!==n.roleNames?(j=(0,J.jsx)(u,{children:(0,J.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole})}),t[31]=n.rawRole,t[32]=n.roleNames,t[33]=j):j=t[33];let M;t[34]!==b||t[35]!==x||t[36]!==y?(M=(b||x)&&(0,J.jsxs)(ce,{children:[(0,J.jsx)(ae,{children:(0,J.jsx)(s,{variant:`ghost`,size:`icon-sm`,children:(0,J.jsx)(_,{size:16,stroke:2})})}),(0,J.jsxs)(oe,{align:`end`,children:[b&&(0,J.jsxs)(se,{onClick:()=>o(!0),children:[(0,J.jsx)(ge,{size:16,stroke:2}),`Change Role`]}),x&&(0,J.jsxs)(se,{onClick:()=>y.mutate(),disabled:y.isPending,className:`text-destructive focus:text-destructive`,children:[(0,J.jsx)(g,{size:16,stroke:2}),y.isPending?`Removing...`:`Remove`]})]})]}),t[34]=b,t[35]=x,t[36]=y,t[37]=M):M=t[37];let N;t[38]===M?N=t[39]:(N=(0,J.jsx)(u,{className:`text-right`,children:M}),t[38]=M,t[39]=N);let P;t[40]!==A||t[41]!==j||t[42]!==N?(P=(0,J.jsxs)(m,{children:[A,j,N]}),t[40]=A,t[41]=j,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==r||t[45]!==n||t[46]!==a?(F=(0,J.jsx)(Ke,{open:a,onOpenChange:o,currentUserId:r,member:n}),t[44]=r,t[45]=n,t[46]=a,t[47]=F):F=t[47];let I;return t[48]!==P||t[49]!==F?(I=(0,J.jsxs)(J.Fragment,{children:[P,F]}),t[48]=P,t[49]=F,t[50]=I):I=t[50],I}function Ye(e){let t=(0,q.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,J.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,J.jsx)(f,{children:(0,J.jsxs)(m,{children:[(0,J.jsx)(l,{children:`Member`}),(0,J.jsx)(l,{children:`Role`}),(0,J.jsx)(l,{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,J.jsx)(Je,{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,J.jsx)(`div`,{className:`rounded-md border`,children:(0,J.jsxs)(d,{children:[a,(0,J.jsx)(p,{children:o})]})}),t[9]=o,t[10]=s),s}var Xe=i(`/_authenticated/$org_slug/team`);function Ze(e){let t=(0,q.c)(27),n;t[0]!==e.currentUserId||t[1]!==e.organizationId?(n=B(e.currentUserId,e.organizationId),t[0]=e.currentUserId,t[1]=e.organizationId,t[2]=n):n=t[2];let{data:r}=N(n),i;t[3]!==r||t[4]!==e.currentUserId?(i=U({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,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Members`}),(0,J.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,J.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:o?(0,J.jsx)(Ge,{currentUserId:e.currentUserId,organizationId:e.organizationId,children:(0,J.jsxs)(s,{children:[(0,J.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,J.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,J.jsx)(Ye,{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,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-xl font-semibold mb-2`,children:`Pending Invitations`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:`Invitations that haven't been accepted yet.`}),(0,J.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,J.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 Qe(){let e=(0,q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`div`,{className:`mb-8`,children:[(0,J.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Team`}),(0,J.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 $e(){let e=(0,q.c)(4),{organizationId:t,session:n}=Xe.useRouteContext(),r=n.user.id,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,J.jsx)(Qe,{}),e[0]=i):i=e[0];let a;return e[1]!==r||e[2]!==t?(a=(0,J.jsxs)(`div`,{className:`p-8`,children:[i,(0,J.jsx)(Ze,{organizationId:t,currentUserId:r})]}),e[1]=r,e[2]=t,e[3]=a):a=e[3],a}var et=$e;export{et 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{B as i}from"./index-CzO2VlPF.js";import{a,d as o,i as s,n as c,t as l}from"./dropdown-menu-B7XsQ055.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}=i(),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)(o,{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)(a,{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)(a,{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)(a,{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)(l,{children:[g,(0,m.jsx)(c,{align:`end`,children:(0,m.jsxs)(s,{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{B as i}from"./index-CXR0dKJj.js";import{a,d as o,i as s,n as c,t as l}from"./dropdown-menu-Cw2MW0pD.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}=i(),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)(o,{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)(a,{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)(a,{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)(a,{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)(l,{children:[g,(0,m.jsx)(c,{align:`end`,children:(0,m.jsxs)(s,{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-rRpRFwc5.js";import{A as d,E as f,T as p,b as m,m as h,o as g}from"./query-CY--GYXb.js";import{_,c as v,l as y}from"./getDisabledMountTransitionStyles-C0uz3iMh.js";import{t as b}from"./useBaseUiId-CtNp109T.js";import{c as x}from"./getPseudoElementBounds-CRlxTrfr.js";import{H as S,V as C,z as w}from"./index-CzO2VlPF.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-ChNkcIa6.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??S();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=C(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=b(u),S=h.useState(`floatingRootContext`),C=h.useState(`isOpenedByTrigger`,g),w=P.useRef(null),{registerTrigger:T,isMountedByThisTrigger:D}=_(g,w,h,{payload:d}),{getButtonProps:O,buttonRef:k}=a({disabled:o,native:l}),A=y([x(S,{enabled:S!=null})]),j=P.useMemo(()=>({disabled:o,open:C}),[o,C]),M=h.useState(`triggerProps`,D);return i(`button`,e,{state:j,ref:[k,t,T,w],props:[A.getReferenceProps(),M,{[s]:``,id:g},p,O],stateAttributesMapping:v})}),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=C(),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`);w.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&&w.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-rRpRFwc5.js";import{A as d,E as f,T as p,b as m,m as h,o as g}from"./query-CY--GYXb.js";import{_,c as v,l as y}from"./getDisabledMountTransitionStyles-C0uz3iMh.js";import{t as b}from"./useBaseUiId-CtNp109T.js";import{c as x}from"./getPseudoElementBounds-CRlxTrfr.js";import{H as S,V as C,z as w}from"./index-CXR0dKJj.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-ChNkcIa6.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??S();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=C(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=b(u),S=h.useState(`floatingRootContext`),C=h.useState(`isOpenedByTrigger`,g),w=P.useRef(null),{registerTrigger:T,isMountedByThisTrigger:D}=_(g,w,h,{payload:d}),{getButtonProps:O,buttonRef:k}=a({disabled:o,native:l}),A=y([x(S,{enabled:S!=null})]),j=P.useMemo(()=>({disabled:o,open:C}),[o,C]),M=h.useState(`triggerProps`,D);return i(`button`,e,{state:j,ref:[k,t,T,w],props:[A.getReferenceProps(),M,{[s]:``,id:g},p,O],stateAttributesMapping:v})}),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=C(),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`);w.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&&w.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,n as m,o as h,s as g,w as _}from"./query-CY--GYXb.js";import{V as v}from"./index-CzO2VlPF.js";var y=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=g(),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)||_(this.options.staleTime,this.#t)!==_(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=_(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,...m(u.data,e.options)}),t._optimisticResults===`isRestoring`&&(d.fetchStatus=`idle`)}let{error:h,errorUpdatedAt:_,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&&(h=this.#s,p=this.#l,_=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:h,errorUpdatedAt:_,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=g())},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){h.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&&_(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(_(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(h.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,n as m,o as h,s as g,w as _}from"./query-CY--GYXb.js";import{V as v}from"./index-CXR0dKJj.js";var y=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=g(),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)||_(this.options.staleTime,this.#t)!==_(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=_(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,...m(u.data,e.options)}),t._optimisticResults===`isRestoring`&&(d.fetchStatus=`idle`)}let{error:h,errorUpdatedAt:_,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&&(h=this.#s,p=this.#l,_=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:h,errorUpdatedAt:_,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=g())},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){h.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&&_(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(_(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(h.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-CO5Q8xm4.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-CO5Q8xm4.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-CzO2VlPF.js"></script>
21
+ <script type="module" crossorigin src="/assets/index-CXR0dKJj.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">