@onequery/cli 0.1.43-win32-x64 → 0.1.44-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 (159) hide show
  1. package/package.json +3 -3
  2. package/vendor/{x86_64-pc-windows-msvc/onequery/onequery.exe → aarch64-apple-darwin/onequery/onequery} +0 -0
  3. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/CompositeItem-D3nXGtvr.js → aarch64-apple-darwin/runtime/web/assets/CompositeItem-BczSyMtT.js} +1 -1
  4. package/vendor/aarch64-apple-darwin/runtime/web/assets/CompositeList-FRTEqUDK.js +1 -0
  5. package/vendor/aarch64-apple-darwin/runtime/web/assets/DialogTitle-XJoEl7im.js +1 -0
  6. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/Separator-vw4jPN_6.js → aarch64-apple-darwin/runtime/web/assets/Separator-CHfSrIVw.js} +1 -1
  7. package/vendor/aarch64-apple-darwin/runtime/web/assets/_authenticated-BM2yiz99.js +1 -0
  8. package/vendor/aarch64-apple-darwin/runtime/web/assets/_org_slug-BfXJF28s.js +1 -0
  9. package/vendor/aarch64-apple-darwin/runtime/web/assets/audit-ClpgHu9B.js +1 -0
  10. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/avatar-B8g7WJsq.js → aarch64-apple-darwin/runtime/web/assets/avatar-BJ8wGO2c.js} +1 -1
  11. package/vendor/aarch64-apple-darwin/runtime/web/assets/budget-D6Ev_SML.js +1 -0
  12. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/callback-CJcspPuI.js → aarch64-apple-darwin/runtime/web/assets/callback-B6XJzLSF.js} +1 -1
  13. package/vendor/aarch64-apple-darwin/runtime/web/assets/checkbox-BRqndHHY.js +1 -0
  14. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/connect-database-BRm1cHow.js → aarch64-apple-darwin/runtime/web/assets/connect-database-JaPJNCsD.js} +1 -1
  15. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/create-org-D1xCoAP-.js → aarch64-apple-darwin/runtime/web/assets/create-org-BbAFZCln.js} +1 -1
  16. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/data-source-connection-form-DPfvAEve.js → aarch64-apple-darwin/runtime/web/assets/data-source-connection-form-pf2b-ERK.js} +1 -1
  17. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/device-CUOuLzJr.js → aarch64-apple-darwin/runtime/web/assets/device-XQc0RI9Z.js} +1 -1
  18. package/vendor/aarch64-apple-darwin/runtime/web/assets/dropdown-menu-Bb-uhONR.js +1 -0
  19. package/vendor/aarch64-apple-darwin/runtime/web/assets/getDisabledMountTransitionStyles-Co-5TcgR.js +1 -0
  20. package/vendor/aarch64-apple-darwin/runtime/web/assets/getPseudoElementBounds-BefWKytd.js +12 -0
  21. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/home-BUn6Mfan.js → aarch64-apple-darwin/runtime/web/assets/home-CA1ev4te.js} +1 -1
  22. package/vendor/aarch64-apple-darwin/runtime/web/assets/index-B4tzcC1c.js +10 -0
  23. package/vendor/aarch64-apple-darwin/runtime/web/assets/integrations-KI8qBfl_.js +1 -0
  24. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/invite._invitationId-BtGsgWJR.js → aarch64-apple-darwin/runtime/web/assets/invite._invitationId-BPdIb9rb.js} +1 -1
  25. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/routes-Bfxhd-MC.js → aarch64-apple-darwin/runtime/web/assets/routes-BUGLO-p-.js} +1 -1
  26. package/vendor/aarch64-apple-darwin/runtime/web/assets/select--f8ikhXw.js +1 -0
  27. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/separator-CWltZvB_.js → aarch64-apple-darwin/runtime/web/assets/separator-C6uGWs7e.js} +1 -1
  28. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/signin-Bb-ElhcI.js → aarch64-apple-darwin/runtime/web/assets/signin-DZOz5SqL.js} +1 -1
  29. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/team-lu76z2PF.js → aarch64-apple-darwin/runtime/web/assets/team-BC8PBk76.js} +1 -1
  30. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/textarea-eJnGRrvE.js → aarch64-apple-darwin/runtime/web/assets/textarea-DeFlZYve.js} +1 -1
  31. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/theme-toggle-SKykt1po.js → aarch64-apple-darwin/runtime/web/assets/theme-toggle-7vhlmsbU.js} +1 -1
  32. package/vendor/aarch64-apple-darwin/runtime/web/assets/use-optimistic-mutation-F9aL7LPX.js +1 -0
  33. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/useBaseQuery-DXS4_Zkx.js → aarch64-apple-darwin/runtime/web/assets/useBaseQuery-O7HCqjpX.js} +1 -1
  34. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/useCompositeItem-BsMHgRi0.js → aarch64-apple-darwin/runtime/web/assets/useCompositeItem-C3Tz1oAb.js} +1 -1
  35. package/vendor/aarch64-apple-darwin/runtime/web/assets/useQuery-Cbo-5C23.js +1 -0
  36. package/vendor/aarch64-apple-darwin/runtime/web/assets/useSuspenseQuery-GImltoGU.js +1 -0
  37. package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/index.html +2 -2
  38. package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/server/onequery-server.mjs +2702 -2363
  39. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/CompositeList-CX7HHxYw.js +0 -1
  40. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/DialogTitle-CzRmdOOz.js +0 -1
  41. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/_authenticated-DE-fRDAy.js +0 -1
  42. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/_org_slug-8Eun-zo1.js +0 -1
  43. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/audit-ChUF-UD4.js +0 -1
  44. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/budget-DA47wojH.js +0 -1
  45. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/checkbox-DYtEYWlC.js +0 -1
  46. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/dropdown-menu-CrGReNWD.js +0 -1
  47. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/getDisabledMountTransitionStyles-BYKRz4ha.js +0 -1
  48. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/getPseudoElementBounds-InhM-dWf.js +0 -12
  49. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/index-ClzxEm7R.js +0 -10
  50. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/integrations-MfPuDele.js +0 -1
  51. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/select-BRK_cJtj.js +0 -1
  52. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/use-optimistic-mutation-Dd5ntQWa.js +0 -1
  53. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/useQuery-B9mB-acs.js +0 -1
  54. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/useSuspenseQuery-Bq3OtiRW.js +0 -1
  55. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260327065242_curious_nightmare.sql +0 -0
  56. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260403103652_slippery_hellfire_club.sql +0 -0
  57. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260403112219_gigantic_namora.sql +0 -0
  58. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260420071232_previous_justin_hammer.sql +0 -0
  59. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260420093157_spooky_cassandra_nova.sql +0 -0
  60. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260420101631_even_ogun.sql +0 -0
  61. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260327065242_snapshot.json +0 -0
  62. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260403103652_snapshot.json +0 -0
  63. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260403112219_snapshot.json +0 -0
  64. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260420071232_snapshot.json +0 -0
  65. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260420093157_snapshot.json +0 -0
  66. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260420101631_snapshot.json +0 -0
  67. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/_journal.json +0 -0
  68. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/initdb.wasm +0 -0
  69. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/pglite.data +0 -0
  70. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/pglite.wasm +0 -0
  71. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/sql-parser/sql_parser_wasm_bg.wasm +0 -0
  72. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconArrowRight-DsOD7mDl.js +0 -0
  73. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconCheck-Gc24xPT2.js +0 -0
  74. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconChevronDown-B-39MA7-.js +0 -0
  75. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconCoins-C7Nn0L6R.js +0 -0
  76. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconHistory-BqAd-xl2.js +0 -0
  77. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconLoader2-B3B6M8nQ.js +0 -0
  78. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconPlus-C3-kRhGX.js +0 -0
  79. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconX-BQkA009b.js +0 -0
  80. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/alert-CgZYtErJ.js +0 -0
  81. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/api-base-url-DIb6qukm.js +0 -0
  82. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/api-client-B2Cc7TWF.js +0 -0
  83. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/api-paths-DM-NAvAZ.js +0 -0
  84. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/app-routes-CnJncMlZ.js +0 -0
  85. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/auth-bootstrap-query-B7dkGOfQ.js +0 -0
  86. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/auth-client-DF1BsKzX.js +0 -0
  87. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/badge-CwG2ykXV.js +0 -0
  88. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/card-BWqhQk-T.js +0 -0
  89. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/compiler-runtime-DCc3R3Xn.js +0 -0
  90. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/createReactComponent-_L2mp4Ui.js +0 -0
  91. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/dist-D0YU0n1N.js +0 -0
  92. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/empty-nwzd6339.js +0 -0
  93. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/format-date-Ctrh7my1.js +0 -0
  94. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/index-BBPJeil4.css +0 -0
  95. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/input-CG_cIxvO.js +0 -0
  96. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  97. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  98. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  99. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  100. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  101. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  102. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  103. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/jsx-runtime-DG_AJzB_.js +0 -0
  104. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/label-DDLGZnWP.js +0 -0
  105. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/link-Cgvqhh5w.js +0 -0
  106. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/matchContext-CDajBC0L.js +0 -0
  107. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/organization-permissions-BQQ5PJbI.js +0 -0
  108. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/organization-query-keys-DwLucsD_.js +0 -0
  109. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/query-timing-LGzitMXx.js +0 -0
  110. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/queryOptions-BHw87wTZ.js +0 -0
  111. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/removable-BfDesq3B.js +0 -0
  112. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/schemas-n4sxh6jF.js +0 -0
  113. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/settings-DbZya6GZ.js +0 -0
  114. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/src-DCIPwIx0.js +0 -0
  115. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/table-Bzsu823v.js +0 -0
  116. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useBaseUiId-BLFGpnYJ.js +0 -0
  117. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useControlled-B8q0aJoo.js +0 -0
  118. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useRender-B2c9_UYd.js +0 -0
  119. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useRouterState-DpT8luFk.js +0 -0
  120. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useValueChanged-C3CBkPge.js +0 -0
  121. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/utils-C8DGLIgm.js +0 -0
  122. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/xstate-react.esm-U3P0kbzA.js +0 -0
  123. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/zod-Ch0Zejov.js +0 -0
  124. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/favicon.ico +0 -0
  125. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step1_settings_sidebar.png +0 -0
  126. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step2_projects.png +0 -0
  127. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step3_project_keys.png +0 -0
  128. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step4_api_keys.png +0 -0
  129. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step1_service_accounts.png +0 -0
  130. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step2_bigquery_roles.png +0 -0
  131. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step3_add_key_menu.png +0 -0
  132. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step4_create_json_key.png +0 -0
  133. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step1_service_accounts.png +0 -0
  134. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step2_create_json_key.png +0 -0
  135. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step3_add_user_viewer.png +0 -0
  136. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step4_property_details.png +0 -0
  137. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step1_signin.png +0 -0
  138. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step2_new_fine_grained_token_sanitized.png +0 -0
  139. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step3_permissions_configured_sanitized.png +0 -0
  140. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step4_token_created_sanitized.png +0 -0
  141. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step1_service_accounts.png +0 -0
  142. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step2_create_service_account.png +0 -0
  143. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step3_credentials.png +0 -0
  144. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step4_project_settings.png +0 -0
  145. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/postgresql/step1_create_user.png +0 -0
  146. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/postgresql/step2_connection.png +0 -0
  147. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/posthog/step1_project_settings.png +0 -0
  148. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/posthog/step2_personal_api_keys.png +0 -0
  149. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/posthog/step3_create_key_modal.png +0 -0
  150. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step1_connect.png +0 -0
  151. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step2_create_user.png +0 -0
  152. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step3_grant.png +0 -0
  153. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step4_info.png +0 -0
  154. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step1_personal_tokens.png +0 -0
  155. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step2_create_token_permissions.png +0 -0
  156. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step3_organization_slug.png +0 -0
  157. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step4_project_slug.png +0 -0
  158. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/linear.svg +0 -0
  159. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/onequery.svg +0 -0
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i}from"./api-base-url-DIb6qukm.js";import{S as a,a as o,n as s,t as c,x as l,y as u}from"./createReactComponent-_L2mp4Ui.js";import{t as d}from"./utils-C8DGLIgm.js";import{d as f,n as p,r as m,t as h}from"./dropdown-menu-Bb-uhONR.js";import{c as g,o as _,s as v}from"./select--f8ikhXw.js";import{n as y,r as b,t as x}from"./checkbox-BRqndHHY.js";import{t as S}from"./IconLoader2-B3B6M8nQ.js";import{t as C}from"./IconPlus-C3-kRhGX.js";import{a as w,c as T,i as E,l as D,n as O,o as ee,r as k,s as A,u as j}from"./use-optimistic-mutation-F9aL7LPX.js";import{t as M}from"./useQuery-Cbo-5C23.js";import{t as N}from"./useSuspenseQuery-GImltoGU.js";import{t as P}from"./queryOptions-BHw87wTZ.js";import{Ct as F,Et as I,ct as L,i as R}from"./getDisabledMountTransitionStyles-Co-5TcgR.js";import{t as te}from"./useBaseUiId-BLFGpnYJ.js";import{t as ne}from"./api-client-B2Cc7TWF.js";import{G as re,I as ie,J as z,R as ae,_ as oe,g as B,v as se,w as V}from"./index-B4tzcC1c.js";import{t as ce}from"./input-CG_cIxvO.js";import{t as le}from"./format-date-Ctrh7my1.js";import{n as H,r as U,t as W}from"./alert-CgZYtErJ.js";import{t as ue}from"./badge-CwG2ykXV.js";import{a as de,n as fe,o as G,r as pe,t as me}from"./card-BWqhQk-T.js";import{a as he,i as ge,n as K,o as _e,r as ve,t as q}from"./data-source-connection-form-pf2b-ERK.js";var ye=c(`outline`,`search`,`Search`,[[`path`,{d:`M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`,key:`svg-0`}],[`path`,{d:`M21 21l-6 -6`,key:`svg-1`}]]);function 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)(D,{render:e.children}),t[2]=e.children,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsxs)(A,{children:[(0,X.jsx)(T,{children:`Add Data Source`}),(0,X.jsx)(w,{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)(E,{className:`sm:max-w-[720px] max-h-[85vh] overflow-y-auto overflow-x-hidden`,children:[s,(0,X.jsx)(q,{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)(k,{open:n,onOpenChange:r,children:[o,c]}),t[9]=n,t[10]=o,t[11]=c,t[12]=l):l=t[12],l}var 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 ie.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=ne();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(V(e,`Failed to fetch GitHub repositories`))}return n.json()}function Te(e,t){return P({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(V(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(u(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=te(),u=I(),d=I(),{nonce:f,disableStyleElements:p}=_(),[m,h]=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),R=Y.useRef(null),ne=Y.useRef(null),re=Y.useRef(!1),ie=Y.useRef(0),z=Y.useRef(0),ae=Y.useRef(0),oe=Y.useRef(0),B=Y.useRef(`vertical`),se=Y.useRef(Fe),V=a(e=>{let t=e.x-se.current.x,n=e.y-se.current.y;se.current=e,n!==0&&(x(!0),u.start(500,()=>{x(!1)})),t!==0&&(y(!0),d.start(500,()=>{y(!1)}))}),ce=a(e=>{e.button===0&&(re.current=!0,ie.current=e.clientY,z.current=e.clientX,B.current=e.currentTarget.getAttribute(Me.orientation),M.current&&(ae.current=M.current.scrollTop,oe.current=M.current.scrollLeft),F.current&&B.current===`vertical`&&F.current.setPointerCapture(e.pointerId),R.current&&B.current===`horizontal`&&R.current.setPointerCapture(e.pointerId))}),le=a(e=>{if(!re.current)return;let t=e.clientY-ie.current,n=e.clientX-z.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&&B.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=ae.current+s*(r-i),e.preventDefault(),x(!0),u.start(500,()=>{x(!1)})}if(R.current&&P.current&&B.current===`horizontal`){let t=je(P.current,`padding`,`x`),r=je(R.current,`margin`,`x`),i=R.current.offsetWidth,s=n/(P.current.offsetWidth-i-t-r);M.current.scrollLeft=oe.current+s*(a-o),e.preventDefault(),y(!0),d.start(500,()=>{y(!1)})}}}),H=a(e=>{re.current=!1,F.current&&B.current===`vertical`&&F.current.releasePointerCapture(e.pointerId),R.current&&B.current===`horizontal`&&R.current.releasePointerCapture(e.pointerId)});function U(e){C(e.pointerType===`touch`)}function W(e){U(e),e.pointerType!==`touch`&&h(L(j.current,e.target))}let ue=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]),de={role:`presentation`,onPointerEnter:W,onPointerMove:W,onPointerDown:U,onPointerLeave(){h(!1)},style:{position:`relative`,[Ae.scrollAreaCornerHeight]:`${w.height}px`,[Ae.scrollAreaCornerWidth]:`${w.width}px`}},fe=o(`div`,e,{state:ue,ref:[t,j],props:[de,s],stateAttributesMapping:Pe}),G=Y.useMemo(()=>({handlePointerDown:ce,handlePointerMove:le,handlePointerUp:H,handleScroll:V,cornerSize:w,setCornerSize:T,thumbSize:E,setThumbSize:D,touchModality:S,cornerRef:ne,scrollingX:v,setScrollingX:y,scrollingY:b,setScrollingY:x,hovering:m,setHovering:h,viewportRef:M,rootRef:j,scrollbarYRef:N,scrollbarXRef:P,thumbYRef:F,thumbXRef:R,rootId:l,hiddenState:k,setHiddenState:A,overflowEdges:O,setOverflowEdges:ee,viewportState:ue,overflowEdgeThreshold:c}),[ce,le,H,V,w,E,S,v,y,b,x,m,h,l,k,O,ue,c]);return(0,X.jsxs)(Oe.Provider,{value:G,children:[!p&&g.getElement(f),fe]})});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||F||(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:c,scrollbarXRef:u,thumbYRef:d,thumbXRef:f,cornerRef:p,cornerSize:m,setCornerSize:h,setThumbSize:_,rootId:y,setHiddenState:b,hiddenState:x,handleScroll:S,setHovering:C,setOverflowEdges:w,overflowEdges:T,overflowEdgeThreshold:E}=ke(),D=R(),O=Y.useRef(!0),ee=I(),k=I(),A=a(()=>{let e=s.current,t=c.current,n=u.current,r=d.current,i=f.current,a=p.current;if(!e)return;let o=e.scrollHeight,l=e.scrollWidth,g=e.clientHeight,y=e.clientWidth,x=e.scrollTop,S=e.scrollLeft;if(o===0||l===0)return;let C=g>=o,T=y>=l,O=y/l,ee=g/o,k=Math.max(0,l-y),A=Math.max(0,o-g),j=0,M=0;T||(j=v(D===`rtl`?-S:S,0,k),M=k-j);let N=C?0:v(x,0,A),P=C?0:A-N,F=T?0:y,I=C?0:g,L=0,R=0;!T&&!C&&(L=t?.offsetWidth||0,R=n?.offsetHeight||0);let te=m.width===0&&m.height===0,ne=te?L:0,re=te?R:0,ie=je(n,`padding`,`x`),z=je(t,`padding`,`y`),ae=je(i,`margin`,`x`),oe=je(r,`margin`,`y`),B=F-ie-ae,se=I-z-oe,V=n?Math.min(n.offsetWidth-ne,B):B,ce=t?Math.min(t.offsetHeight-re,se):se,le=Math.max(16,V*O),H=Math.max(16,ce*ee);if(_(e=>e.height===H&&e.width===le?e:{width:le,height:H}),t&&r){let e=t.offsetHeight-H-z-oe,n=o-g,i=n===0?0:x/n,a=Math.min(e,Math.max(0,i*e));r.style.transform=`translate3d(0,${a}px,0)`}if(n&&i){let e=n.offsetWidth-le-ie-ae,t=l-y,r=t===0?0:S/t,a=D===`rtl`?v(r*e,-e,0):v(r*e,0,e);i.style.transform=`translate3d(${a}px,0,0)`}let U=v(j,0,k),W=v(M,0,k),ue=v(N,0,A),de=v(P,0,A),fe=[[Ue.scrollAreaOverflowXStart,U],[Ue.scrollAreaOverflowXEnd,W],[Ue.scrollAreaOverflowYStart,ue],[Ue.scrollAreaOverflowYEnd,de]];for(let[t,n]of fe)e.style.setProperty(t,`${n}px`);a&&(T||C?h({width:0,height:0}):!T&&!C&&h({width:L,height:R})),b(e=>{let t=C||T;return e.y===C&&e.x===T&&e.corner===t?e:{y:C,x:T,corner:t}});let G={xStart:!T&&U>E.xStart,xEnd:!T&&W>E.xEnd,yStart:!C&&ue>E.yStart,yEnd:!C&&de>E.yEnd};w(e=>e.xStart===G.xStart&&e.xEnd===G.xEnd&&e.yStart===G.yStart&&e.yEnd===G.yEnd?e:G)});l(()=>{if(!s.current)return;Ge();let e=!1;return He(s.current,()=>{if(!e){e=!0;return}A()})},[A,s]),l(()=>{queueMicrotask(A)},[A,x,D]),l(()=>{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:g.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(u(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=R();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=d(`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=d(`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=M(d),p;t[7]===f.data?.repositories?p=t[8]:(p=f.data?.repositories??[],t[7]=f.data?.repositories,t[8]=p);let m=p,h;t[9]===f.data?.selected?h=t[10]:(h=f.data?.selected??[],t[9]=f.data?.selected,t[10]=h);let g=h,_,v;t[11]!==g||t[12]!==e.open||t[13]!==f.data?(_=()=>{if(!e.open){c.current=!1,r(``);return}f.data&&(c.current||=(o(g),!0))},v=[g,e.open,f.data],t[11]=g,t[12]=e.open,t[13]=f.data,t[14]=_,t[15]=v):(_=t[14],v=t[15]),(0,Y.useEffect)(_,v);let y;if(t[16]!==m||t[17]!==n){bb0:{let e=n.trim().toLowerCase();if(!e){y=m;break bb0}y=m.filter(t=>{let n=t.owner.toLowerCase(),r=t.name.toLowerCase(),i=t.fullName.toLowerCase();return n.includes(e)||r.includes(e)||i.includes(e)})}t[16]=m,t[17]=n,t[18]=y}else y=t[18];let b=y,C;t[19]!==g||t[20]!==a?(C=tt(a,g),t[19]=g,t[20]=a,t[21]=C):C=t[21];let D=C,O;t[22]===e?O=t[23]:(O=()=>{ie.success(`GitHub repositories updated`),e.onOpenChange(!1)},t[22]=e,t[23]=O);let N;t[24]!==e.dataSourceId||t[25]!==e.organizationId||t[26]!==l||t[27]!==O?(N=De({dataSourceId:e.dataSourceId,onError:it,onSuccess:O,organizationId:e.organizationId,queryClient:l}),t[24]=e.dataSourceId,t[25]=e.organizationId,t[26]=l,t[27]=O,t[28]=N):N=t[28];let P=j(N),F;t[29]===a?F=t[30]:(F=new Set(a),t[29]=a,t[30]=F);let I=F,L;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(L=function(e){o(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},t[31]=L):L=t[31];let R=L,te;t[32]===b?te=t[33]:(te=function(){let e=b.map(rt);o(t=>[...new Set([...t,...e])])},t[32]=b,t[33]=te);let ne=te,re;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(){o([])},t[34]=re):re=t[34];let z=re,oe=f.isLoading,B=f.isError,se=D&&!P.isPending,V;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,X.jsxs)(A,{children:[(0,X.jsx)(T,{children:`Select GitHub Repositories`}),(0,X.jsx)(w,{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]=V):V=t[35];let le;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,X.jsx)(ye,{size:16,className:`absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`}),t[36]=le):le=t[36];let H;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>r(e.target.value),t[37]=H):H=t[37];let U;t[38]===n?U=t[39]:(U=(0,X.jsxs)(`div`,{className:`relative flex-1`,children:[le,(0,X.jsx)(ce,{value:n,onChange:H,placeholder:`Search repositories...`,className:`pl-9`})]}),t[38]=n,t[39]=U);let W=b.length===0,de;t[40]!==ne||t[41]!==W?(de=(0,X.jsx)(s,{variant:`outline`,size:`sm`,onClick:ne,disabled:W,children:`Select visible`}),t[40]=ne,t[41]=W,t[42]=de):de=t[42];let fe=a.length===0,G;t[43]===fe?G=t[44]:(G=(0,X.jsx)(s,{variant:`ghost`,size:`sm`,onClick:z,disabled:fe,children:`Clear`}),t[43]=fe,t[44]=G);let pe;t[45]!==U||t[46]!==de||t[47]!==G?(pe=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[U,de,G]}),t[45]=U,t[46]=de,t[47]=G,t[48]=pe):pe=t[48];let me=m.length>0?` • ${m.length} available`:``,he;t[49]!==a.length||t[50]!==me?(he=(0,X.jsxs)(`span`,{children:[a.length,` selected`,me]}),t[49]=a.length,t[50]=me,t[51]=he):he=t[51];let ge;t[52]===D?ge=t[53]:(ge=D?(0,X.jsx)(ue,{variant:`outline`,children:`Unsaved`}):null,t[52]=D,t[53]=ge);let K;t[54]!==he||t[55]!==ge?(K=(0,X.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[he,ge]}),t[54]=he,t[55]=ge,t[56]=K):K=t[56];let _e;t[57]===oe?_e=t[58]:(_e=oe?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-12 text-muted-foreground`,children:(0,X.jsx)(S,{size:24,className:`animate-spin`})}):null,t[57]=oe,t[58]=_e);let ve;t[59]===B?ve=t[60]:(ve=B?(0,X.jsx)(`p`,{className:`text-sm text-destructive`,children:`Unable to load repositories. Please try again.`}):null,t[59]=B,t[60]=ve);let q;t[61]!==b||t[62]!==B||t[63]!==oe||t[64]!==I?(q=!oe&&!B?(0,X.jsx)($e,{className:`h-[320px] rounded-md border`,children:(0,X.jsxs)(`div`,{className:`p-2 space-y-1`,children:[b.length===0?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground px-3 py-6 text-center`,children:`No repositories found.`}):null,b.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"]`)||R(e.fullName))},children:[(0,X.jsx)(x,{checked:I.has(e.fullName),onCheckedChange:()=>R(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)(ue,{variant:`secondary`,children:`Private`}):null]}),(0,X.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Owner: `,e.owner]})]})]},e.id))]})}):null,t[61]=b,t[62]=B,t[63]=oe,t[64]=I,t[65]=q):q=t[65];let J;t[66]!==pe||t[67]!==K||t[68]!==_e||t[69]!==ve||t[70]!==q?(J=(0,X.jsxs)(`div`,{className:`space-y-3`,children:[pe,K,_e,ve,q]}),t[66]=pe,t[67]=K,t[68]=_e,t[69]=ve,t[70]=q,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]!==P.isPending?(Q=(0,X.jsx)(s,{variant:`outline`,onClick:Z,disabled:P.isPending,children:`Cancel`}),t[74]=Z,t[75]=P.isPending,t[76]=Q):Q=t[76];let $;t[77]!==a||t[78]!==P?($=()=>P.mutate({repositories:a}),t[77]=a,t[78]=P,t[79]=$):$=t[79];let xe=!se,Se=P.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)(ee,{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)(E,{className:`sm:max-w-[680px]`,children:[V,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)(k,{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)(z,{className:`size-4`}),r=(0,X.jsx)(U,{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)(W,{variant:`destructive`,className:`mt-3 border-destructive/30 bg-destructive/5`,children:[n,r,(0,X.jsx)(H,{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)(81),{dataSource:n,organizationId:r,openGitHubRepositories:i}=e,a;t[0]===r?a=t[1]:(a=B(r),t[0]=r,t[1]=a);let o=a.queryKey,[c,l]=(0,Y.useState)(!1),u=(0,Y.useRef)(!1),d,g;t[2]!==n.provider||t[3]!==i?(d=()=>{u.current||i&&n.provider===`github`&&(l(!0),u.current=!0)},g=[n.provider,i],t[2]=n.provider,t[3]=i,t[4]=d,t[5]=g):(d=t[4],g=t[5]),(0,Y.useEffect)(d,g);let _;t[6]!==n.id||t[7]!==r?(_=async()=>se(n.id,r),t[6]=n.id,t[7]=r,t[8]=_):_=t[8];let v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=[`data-sources`],t[9]=v):v=t[9];let x;t[10]===_?x=t[11]:(x={mutationFn:_,mutationKey:v,onError:lt,onSuccess:ct},t[10]=_,t[11]=x);let S=j(x),C;t[12]!==n.id||t[13]!==r?(C=async()=>oe(n.id,r),t[12]=n.id,t[13]=r,t[14]=C):C=t[14];let w;t[15]!==n.id||t[16]!==o||t[17]!==C?(w={errorMessage:`Failed to delete data source`,itemId:n.id,mutationFn:C,queryKey:o,successMessage:`Data source deleted`},t[15]=n.id,t[16]=o,t[17]=C,t[18]=w):w=t[18];let T=O(w),E;t[19]===n.provider?E=t[20]:(E=_e(n.provider),t[19]=n.provider,t[20]=E);let D=E,ee;t[21]===n.provider?ee=t[22]:(ee=ge(n.provider),t[21]=n.provider,t[22]=ee);let k=ee,A=k?`Test Connection`:`Test Connection (Unsupported)`,M;t[23]===n.name?M=t[24]:(M=(0,X.jsx)(G,{className:`text-lg`,children:n.name}),t[23]=n.name,t[24]=M);let N;t[25]===D?N=t[26]:(N=(0,X.jsx)(D,{className:`h-4.5 w-4.5`}),t[25]=D,t[26]=N);let P;t[27]===n.provider?P=t[28]:(P=ve(n.provider),t[27]=n.provider,t[28]=P);let F;t[29]!==N||t[30]!==P?(F=(0,X.jsxs)(pe,{className:`flex items-center gap-1.5 mt-0.5`,children:[N,P]}),t[29]=N,t[30]=P,t[31]=F):F=t[31];let I;t[32]!==M||t[33]!==F?(I=(0,X.jsxs)(`div`,{children:[M,F]}),t[32]=M,t[33]=F,t[34]=I):I=t[34];let L;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsx)(f,{children:(0,X.jsx)(s,{variant:`ghost`,size:`icon-sm`,children:(0,X.jsx)(b,{size:16,stroke:2})})}),t[35]=L):L=t[35];let R;t[36]===S?R=t[37]:(R=()=>S.mutate(),t[36]=S,t[37]=R);let te=S.isPending||!k,ne;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,X.jsx)(re,{size:16,stroke:2}),t[38]=ne):ne=t[38];let ie=S.isPending?`Testing...`:A,z;t[39]!==R||t[40]!==te||t[41]!==ie?(z=(0,X.jsxs)(m,{onClick:R,disabled:te,children:[ne,ie]}),t[39]=R,t[40]=te,t[41]=ie,t[42]=z):z=t[42];let ae;t[43]===n.provider?ae=t[44]:(ae=n.provider===`github`?(0,X.jsxs)(m,{onClick:()=>l(!0),children:[(0,X.jsx)(he,{size:16,stroke:`2`}),`Select Repositories`]}):null,t[43]=n.provider,t[44]=ae);let V;t[45]===T?V=t[46]:(V=()=>T.mutate(),t[45]=T,t[46]=V);let ce;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,X.jsx)(y,{size:16,stroke:2}),t[47]=ce):ce=t[47];let H=T.isPending?`Deleting...`:`Delete`,U;t[48]!==T.isPending||t[49]!==V||t[50]!==H?(U=(0,X.jsxs)(m,{onClick:V,disabled:T.isPending,className:`text-destructive focus:text-destructive`,children:[ce,H]}),t[48]=T.isPending,t[49]=V,t[50]=H,t[51]=U):U=t[51];let W;t[52]!==z||t[53]!==ae||t[54]!==U?(W=(0,X.jsxs)(h,{children:[L,(0,X.jsxs)(p,{align:`end`,className:`min-w-40`,children:[z,ae,U]})]}),t[52]=z,t[53]=ae,t[54]=U,t[55]=W):W=t[55];let K;t[56]!==I||t[57]!==W?(K=(0,X.jsxs)(de,{className:`flex flex-row items-start justify-between space-y-0 pb-2`,children:[I,W]}),t[56]=I,t[57]=W,t[58]=K):K=t[58];let q;t[59]===n.status?q=t[60]:(q=at(n.status),t[59]=n.status,t[60]=q);let ye;t[61]!==n.status||t[62]!==q?(ye=(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsx)(ue,{variant:q,children:n.status})}),t[61]=n.status,t[62]=q,t[63]=ye):ye=t[63];let J;t[64]===n.lastUsedAt?J=t[65]:(J=n.lastUsedAt&&(0,X.jsxs)(`p`,{className:`text-sm text-muted-foreground mt-2`,children:[`Last used: `,le(n.lastUsedAt)]}),t[64]=n.lastUsedAt,t[65]=J);let Z;t[66]===n.errorMessage?Z=t[67]:(Z=(0,X.jsx)(ot,{errorMessage:n.errorMessage}),t[66]=n.errorMessage,t[67]=Z);let Q;t[68]!==ye||t[69]!==J||t[70]!==Z?(Q=(0,X.jsxs)(fe,{children:[ye,J,Z]}),t[68]=ye,t[69]=J,t[70]=Z,t[71]=Q):Q=t[71];let $;t[72]!==n.id||t[73]!==n.provider||t[74]!==r||t[75]!==c?($=n.provider===`github`?(0,X.jsx)(nt,{organizationId:r,dataSourceId:n.id,open:c,onOpenChange:l}):null,t[72]=n.id,t[73]=n.provider,t[74]=r,t[75]=c,t[76]=$):$=t[76];let xe;return t[77]!==K||t[78]!==Q||t[79]!==$?(xe=(0,X.jsxs)(me,{children:[K,Q,$]}),t[77]=K,t[78]=Q,t[79]=$,t[80]=xe):xe=t[80],xe}function ct(e){if(e.kind===`unsupported`){ie.info(e.message);return}if(e.result.success){ie.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)(18),n;t[0]===e.provider?n=t[1]:(n=_e(e.provider),t[0]=e.provider,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?a=t[5]:(a=ve(e.provider),t[4]=e.provider,t[5]=a);let o;t[6]===a?o=t[7]:(o=(0,X.jsx)(`p`,{className:`font-medium truncate`,children:a}),t[6]=a,t[7]=o);let c;t[8]!==i||t[9]!==o?(c=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[i,o]}),t[8]=i,t[9]=o,t[10]=c):c=t[10];let l;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(s,{variant:`secondary`,size:`sm`,children:`Connect`}),t[11]=l):l=t[11];let u;t[12]!==e.organizationId||t[13]!==e.provider?(u=(0,X.jsx)(Z,{organizationId:e.organizationId,initialProvider:e.provider,children:l}),t[12]=e.organizationId,t[13]=e.provider,t[14]=u):u=t[14];let d;return t[15]!==c||t[16]!==u?(d=(0,X.jsx)(me,{className:`border-dashed`,children:(0,X.jsx)(fe,{className:`p-4`,children:(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,u]})})}),t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function ft(e){let t=(0,be.c)(35),{organizationId:n,openGitHubDataSourceId:r}=e,i;t[0]===n?i=t[1]:(i=B(n),t[0]=n,t[1]=i);let{data:a}=N(i),o,c,l,u,d,f,p,m;if(t[2]!==a||t[3]!==r||t[4]!==n){let e=ut(a),i=new Set(e.map(pt)),h=K.filter(e=>!i.has(e)),g=e.length>0;d=`space-y-8`;let _;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=(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[13]=_):_=t[13];let v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsxs)(s,{children:[(0,X.jsx)(C,{size:16,stroke:2}),`Add Data Source`]}),t[14]=v):v=t[14],t[15]===n?f=t[16]:(f=(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[_,(0,X.jsx)(Z,{organizationId:n,children:v})]}),t[15]=n,t[16]=f),t[17]===g?p=t[18]:(p=g?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[17]=g,t[18]=p),m=g?(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},e.id))}):null,l=`space-y-4`,t[19]===Symbol.for(`react.memo_cache_sentinel`)?(u=(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[19]=u):u=t[19],o=`grid gap-4 md:grid-cols-2 lg:grid-cols-3`;let y;t[20]===n?y=t[21]:(y=e=>(0,X.jsx)(dt,{provider:e,organizationId:n},e),t[20]=n,t[21]=y),c=h.map(y),t[2]=a,t[3]=r,t[4]=n,t[5]=o,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m}else o=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12];let h;t[22]!==o||t[23]!==c?(h=(0,X.jsx)(`div`,{className:o,children:c}),t[22]=o,t[23]=c,t[24]=h):h=t[24];let g;t[25]!==h||t[26]!==l||t[27]!==u?(g=(0,X.jsxs)(`div`,{className:l,children:[u,h]}),t[25]=h,t[26]=l,t[27]=u,t[28]=g):g=t[28];let _;return t[29]!==g||t[30]!==d||t[31]!==f||t[32]!==p||t[33]!==m?(_=(0,X.jsxs)(`div`,{className:d,children:[f,p,m,g]}),t[29]=g,t[30]=d,t[31]=f,t[32]=p,t[33]=m,t[34]=_):_=t[34],_}function 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{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,o as a}from"./api-base-url-DIb6qukm.js";import{n as o}from"./createReactComponent-_L2mp4Ui.js";import{t as s}from"./IconCheck-Gc24xPT2.js";import{t as c}from"./IconLoader2-B3B6M8nQ.js";import{t as l}from"./IconX-BQkA009b.js";import{t as u}from"./auth-client-DF1BsKzX.js";import{a as d,i as f}from"./app-routes-CnJncMlZ.js";import{D as p,G as m,O as h}from"./index-ClzxEm7R.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./card-BWqhQk-T.js";import{a as S,i as C,n as w,o as T}from"./xstate-react.esm-U3P0kbzA.js";import{n as E,t as D}from"./dist-D0YU0n1N.js";var O=r(),k=e(t(),1),A=i(f),j=`Failed to accept invitation`,M=`Failed to navigate. Try again from home.`,N=1500,P={kind:`home`},F={ACCEPT:`inviteAccept/accept`,ACCEPT_FAILED:`inviteAccept/acceptFailed`,ACCEPT_SUCCEEDED:`inviteAccept/acceptSucceeded`,DECLINE:`inviteAccept/decline`,GO_HOME:`inviteAccept/goHome`,NAVIGATION_COMPLETED:`inviteAccept/navigationCompleted`,NAVIGATION_FAILED:`inviteAccept/navigationFailed`,NAVIGATION_STARTED:`inviteAccept/navigationStarted`,REDIRECT_RESOLUTION_FAILED:`inviteAccept/redirectResolutionFailed`,REDIRECT_RESOLVED:`inviteAccept/redirectResolved`},I={ACCEPTING:`accepting`,ERROR:`error`,NAVIGATING:`navigating`,READY:`ready`,REFRESHING_ORGANIZATIONS:`refreshingOrganizations`,SUCCESS_PENDING_REDIRECT:`successPendingRedirect`},L=class extends E(`InviteAcceptRequestError`)(){},R=class extends E(`InviteRedirectResolutionError`)(){};function z(){return{kind:`idle`}}function B(e){return{kind:`accepted`,organizationId:e}}function ee(e){return{kind:`error`,message:e}}function V(){return{navigation:null,nextNavigationId:1,nextRequestId:1,outcome:z(),pendingAcceptRequest:null,pendingRedirectResolution:null,redirectTarget:null}}function H(e){return{...V(),nextNavigationId:e.nextNavigationId,nextRequestId:e.nextRequestId}}function U(e,t){return{...H(e),outcome:ee(t)}}function W(e,t){return{navigation:{id:e.nextNavigationId,phase:`pending`,target:t},nextNavigationId:e.nextNavigationId+1}}function G(e){return e.redirectTarget??P}async function K(e){let t=await D.tryPromise({try:()=>u.acceptInvitation({invitationId:e}),catch:e=>new L({cause:e,message:j,reason:`request_failed`})});if(t.isErr())return D.err(t.error);let n=t.value;return n.error?D.err(new L({message:Y(n.error.message,j),reason:`response_failed`})):D.ok({acceptedOrganizationId:n.data.member.organizationId})}async function q(e){let t=await D.tryPromise({try:()=>e.refetchSession(),catch:t=>new R({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 X(t.error),D.err(t.error);let n=await D.tryPromise({try:()=>e.queryClient.fetchQuery({...p(e.userId),staleTime:0}),catch:t=>new R({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 X(n.error),D.err(n.error);let r=n.value.find(t=>t.id===e.acceptedOrganizationId);if(r)return D.ok({kind:`organization`,organizationSlug:h(r)});let i=await D.tryPromise({try:()=>u.getFullOrganization({query:{organizationId:e.acceptedOrganizationId}}),catch:t=>new R({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 X(i.error),D.err(i.error);if(i.value.data?.slug)return D.ok({kind:`organization`,organizationSlug:i.value.data.slug});let a=new R({acceptedOrganizationId:e.acceptedOrganizationId,message:`Accepted invitation but organization was not found`,reason:`organization_missing`,...e.userId?{userId:e.userId}:{}});return X(a),D.err(a)}function J(e,t){if(!(e instanceof Error))return t;let n=e.message.trim();return n.length===0?t:n}function Y(e,t){let n=e?.trim()??``;return n.length>0?n:t}function X(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 Z(e={}){let t=e.successRedirectDelayMs??N;return S({actions:{markNavigationRunning:T(({context:e,event:t})=>(C(t,F.NAVIGATION_STARTED),e.navigation?.id===t.id?{navigation:{...e.navigation,phase:`running`}}:{})),queueHomeNavigation:T(({context:e})=>W(e,P)),queueResolvedNavigation:T(({context:e})=>W(e,G(e))),resetFlow:T(({context:e,event:t})=>(C(t,F.NAVIGATION_COMPLETED),e.navigation?.id===t.id?H(e):{})),stageAcceptRequest:T(({context:e})=>({nextRequestId:e.nextRequestId+1,outcome:z(),pendingAcceptRequest:{requestId:e.nextRequestId},redirectTarget:null})),stageRedirectResolution:T(({context:e,event:t})=>(C(t,F.ACCEPT_SUCCEEDED),e.pendingAcceptRequest?.requestId===t.requestId?{nextRequestId:e.nextRequestId+1,pendingAcceptRequest:null,pendingRedirectResolution:{acceptedOrganizationId:t.acceptedOrganizationId,requestId:e.nextRequestId}}:{})),storeAcceptError:T(({context:e,event:t})=>(C(t,F.ACCEPT_FAILED),e.pendingAcceptRequest?.requestId===t.requestId?U(e,t.message):{})),storeAcceptedOrganizationId:T(({context:e,event:t})=>(C(t,F.ACCEPT_SUCCEEDED),e.pendingAcceptRequest?.requestId===t.requestId?{outcome:B(t.acceptedOrganizationId),redirectTarget:null}:{})),storeHomeRedirectTarget:T(({context:e,event:t})=>(C(t,F.REDIRECT_RESOLUTION_FAILED),e.pendingRedirectResolution?.requestId===t.requestId?{pendingRedirectResolution:null,redirectTarget:P}:{})),storeNavigationError:T(({context:e,event:t})=>(C(t,F.NAVIGATION_FAILED),e.navigation?.id===t.id?U(e,t.message):{})),storeResolvedRedirectTarget:T(({context:e,event:t})=>(C(t,F.REDIRECT_RESOLVED),e.pendingRedirectResolution?.requestId===t.requestId?{pendingRedirectResolution:null,redirectTarget:t.redirectTarget}:{}))},guards:{matchesPendingAcceptRequest:({context:e,event:t})=>t.type!==F.ACCEPT_FAILED&&t.type!==F.ACCEPT_SUCCEEDED?!1:e.pendingAcceptRequest?.requestId===t.requestId,matchesPendingRedirectResolution:({context:e,event:t})=>t.type!==F.REDIRECT_RESOLUTION_FAILED&&t.type!==F.REDIRECT_RESOLVED?!1:e.pendingRedirectResolution?.requestId===t.requestId},types:{}}).createMachine({context:V(),id:`inviteAccept`,initial:I.READY,states:{[I.READY]:{on:{[F.ACCEPT]:{actions:`stageAcceptRequest`,target:I.ACCEPTING},[F.DECLINE]:{actions:`queueHomeNavigation`,target:I.NAVIGATING}}},[I.ACCEPTING]:{on:{[F.ACCEPT_SUCCEEDED]:{actions:[`storeAcceptedOrganizationId`,`stageRedirectResolution`],guard:`matchesPendingAcceptRequest`,target:I.REFRESHING_ORGANIZATIONS},[F.ACCEPT_FAILED]:{actions:`storeAcceptError`,guard:`matchesPendingAcceptRequest`,target:I.ERROR}}},[I.REFRESHING_ORGANIZATIONS]:{on:{[F.REDIRECT_RESOLVED]:{actions:`storeResolvedRedirectTarget`,guard:`matchesPendingRedirectResolution`,target:I.SUCCESS_PENDING_REDIRECT},[F.REDIRECT_RESOLUTION_FAILED]:{actions:`storeHomeRedirectTarget`,guard:`matchesPendingRedirectResolution`,target:I.SUCCESS_PENDING_REDIRECT}}},[I.SUCCESS_PENDING_REDIRECT]:{after:{[t]:{actions:`queueResolvedNavigation`,target:I.NAVIGATING}}},[I.NAVIGATING]:{on:{[F.NAVIGATION_COMPLETED]:{actions:`resetFlow`,target:I.READY},[F.NAVIGATION_FAILED]:{actions:`storeNavigationError`,target:I.ERROR},[F.NAVIGATION_STARTED]:{actions:`markNavigationRunning`}}},[I.ERROR]:{on:{[F.GO_HOME]:{actions:`queueHomeNavigation`,target:I.NAVIGATING}}}}})}var Q=Z();function te(e){return e.matches(I.ACCEPTING)?`accepting`:e.matches(I.ERROR)||e.matches(I.NAVIGATING)&&e.context.outcome.kind===`error`?`error`:e.matches(I.REFRESHING_ORGANIZATIONS)||e.matches(I.SUCCESS_PENDING_REDIRECT)||e.matches(I.NAVIGATING)&&e.context.outcome.kind===`accepted`?`success`:`ready`}function ne(e){return e.context.outcome.kind===`error`?e.context.outcome.message:null}function re(e){return J(e,M)}function ie(){let e=(0,O.c)(42),t=a(),n=m(),{invitationId:r}=A.useParams(),{auth:i,refetchSession:o}=A.useRouteContext(),s=i.session?.user.id,c;e[0]===r?c=e[1]:(c=()=>K(r),e[0]=r,e[1]=c);let l=c,u;e[2]!==n||e[3]!==o||e[4]!==s?(u=e=>q({acceptedOrganizationId:e,queryClient:n,refetchSession:o,userId:s}),e[2]=n,e[3]=o,e[4]=s,e[5]=u):u=e[5];let f=u,[p,h]=w(Q),g=p.context.navigation,_=p.context.pendingAcceptRequest,v=p.context.pendingRedirectResolution,y;e[6]===p?y=e[7]:(y=p.matches(I.ACCEPTING),e[6]=p,e[7]=y);let b=y,x;e[8]===p?x=e[9]:(x=p.matches(I.REFRESHING_ORGANIZATIONS),e[8]=p,e[9]=x);let S=x,C,T;e[10]!==l||e[11]!==b||e[12]!==_||e[13]!==h?(C=()=>{if(!b||_===null)return;let e=!1;return l().then(t=>{if(!e){if(t.isErr()){h({message:t.error.message,requestId:_.requestId,type:F.ACCEPT_FAILED});return}h({acceptedOrganizationId:t.value.acceptedOrganizationId,requestId:_.requestId,type:F.ACCEPT_SUCCEEDED})}}),()=>{e=!0}},T=[l,b,_,h],e[10]=l,e[11]=b,e[12]=_,e[13]=h,e[14]=C,e[15]=T):(C=e[14],T=e[15]),(0,k.useEffect)(C,T);let E,D;e[16]!==S||e[17]!==v||e[18]!==f||e[19]!==h?(E=()=>{if(!S||v===null)return;let e=!1;return f(v.acceptedOrganizationId).then(t=>{if(!e){if(t.isErr()){h({requestId:v.requestId,type:F.REDIRECT_RESOLUTION_FAILED});return}h({redirectTarget:t.value,requestId:v.requestId,type:F.REDIRECT_RESOLVED})}}),()=>{e=!0}},D=[S,v,f,h],e[16]=S,e[17]=v,e[18]=f,e[19]=h,e[20]=E,e[21]=D):(E=e[20],D=e[21]),(0,k.useEffect)(E,D);let j,M;e[22]!==t||e[23]!==g||e[24]!==h?(j=()=>{g===null||g.phase!==`pending`||(h({id:g.id,type:F.NAVIGATION_STARTED}),(g.target.kind===`home`?t({to:`/`}):t({params:{org_slug:g.target.organizationSlug},to:d})).then(()=>{h({id:g.id,type:F.NAVIGATION_COMPLETED})}).catch(e=>{console.error(`[invite] failed to navigate after accepting invitation`,{error:e,navigation:g}),h({id:g.id,message:re(e),type:F.NAVIGATION_FAILED})}))},M=[t,g,h],e[22]=t,e[23]=g,e[24]=h,e[25]=j,e[26]=M):(j=e[25],M=e[26]),(0,k.useEffect)(j,M);let N,P;e[27]===h?(N=e[28],P=e[29]):(N=()=>{h({type:F.ACCEPT})},P=()=>{h({type:F.DECLINE})},e[27]=h,e[28]=N,e[29]=P);let L;e[30]===p?L=e[31]:(L=ne(p),e[30]=p,e[31]=L);let R;e[32]===h?R=e[33]:(R=()=>{h({type:F.GO_HOME})},e[32]=h,e[33]=R);let z;e[34]===p?z=e[35]:(z=te(p),e[34]=p,e[35]=z);let B;return e[36]!==N||e[37]!==P||e[38]!==L||e[39]!==R||e[40]!==z?(B={accept:N,decline:P,errorMessage:L,goHome:R,status:z},e[36]=N,e[37]=P,e[38]=L,e[39]=R,e[40]=z,e[41]=B):B=e[41],B}var $=n();function ae(){let e=(0,O.c)(28),{accept:t,decline:n,errorMessage:r,goHome:i,status:a}=ie(),u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsxs)(g,{className:`text-center`,children:[(0,$.jsx)(y,{className:`text-2xl`,children:`Organization Invitation`}),(0,$.jsx)(b,{children:`You've been invited to join an organization`})]}),e[0]=u):u=e[0];let d;e[1]===a?d=e[2]:(d=a===`ready`&&(0,$.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)(s,{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]=a,e[2]=d);let f;e[3]===a?f=e[4]:(f=a===`accepting`&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,$.jsx)(c,{size:48,className:`animate-spin text-primary`}),(0,$.jsx)(`p`,{className:`text-muted-foreground`,children:`Accepting invitation...`})]}),e[3]=a,e[4]=f);let p;e[5]===a?p=e[6]:(p=a===`success`&&(0,$.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)(s,{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]=a,e[6]=p);let m;e[7]!==r||e[8]!==a?(m=a===`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)(l,{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]=a,e[9]=m):m=e[9];let h;e[10]!==d||e[11]!==f||e[12]!==p||e[13]!==m?(h=(0,$.jsxs)(v,{className:`flex justify-center py-8`,children:[d,f,p,m]}),e[10]=d,e[11]=f,e[12]=p,e[13]=m,e[14]=h):h=e[14];let S;e[15]!==t||e[16]!==n||e[17]!==a?(S=a===`ready`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o,{variant:`outline`,onClick:n,children:`Decline`}),(0,$.jsx)(o,{onClick:t,children:`Accept Invitation`})]}),e[15]=t,e[16]=n,e[17]=a,e[18]=S):S=e[18];let C;e[19]!==i||e[20]!==a?(C=a===`error`&&(0,$.jsx)(o,{variant:`outline`,onClick:i,children:`Go to Home`}),e[19]=i,e[20]=a,e[21]=C):C=e[21];let w;e[22]!==S||e[23]!==C?(w=(0,$.jsxs)(_,{className:`flex justify-center gap-4`,children:[S,C]}),e[22]=S,e[23]=C,e[24]=w):w=e[24];let T;return e[25]!==h||e[26]!==w?(T=(0,$.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:(0,$.jsxs)(x,{className:`w-full max-w-md`,children:[u,h,w]})}),e[25]=h,e[26]=w,e[27]=T):T=e[27],T}var oe=ae;export{oe as component};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,o as a}from"./api-base-url-DIb6qukm.js";import{n as o}from"./createReactComponent-_L2mp4Ui.js";import{t as s}from"./IconCheck-Gc24xPT2.js";import{t as c}from"./IconLoader2-B3B6M8nQ.js";import{t as l}from"./IconX-BQkA009b.js";import{t as u}from"./auth-client-DF1BsKzX.js";import{a as d,i as f}from"./app-routes-CnJncMlZ.js";import{D as p,O as m,R as h}from"./index-B4tzcC1c.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./card-BWqhQk-T.js";import{a as S,i as C,n as w,o as T}from"./xstate-react.esm-U3P0kbzA.js";import{n as E,t as D}from"./dist-D0YU0n1N.js";var O=r(),k=e(t(),1),A=i(f),j=`Failed to accept invitation`,M=`Failed to navigate. Try again from home.`,N=1500,P={kind:`home`},F={ACCEPT:`inviteAccept/accept`,ACCEPT_FAILED:`inviteAccept/acceptFailed`,ACCEPT_SUCCEEDED:`inviteAccept/acceptSucceeded`,DECLINE:`inviteAccept/decline`,GO_HOME:`inviteAccept/goHome`,NAVIGATION_COMPLETED:`inviteAccept/navigationCompleted`,NAVIGATION_FAILED:`inviteAccept/navigationFailed`,NAVIGATION_STARTED:`inviteAccept/navigationStarted`,REDIRECT_RESOLUTION_FAILED:`inviteAccept/redirectResolutionFailed`,REDIRECT_RESOLVED:`inviteAccept/redirectResolved`},I={ACCEPTING:`accepting`,ERROR:`error`,NAVIGATING:`navigating`,READY:`ready`,REFRESHING_ORGANIZATIONS:`refreshingOrganizations`,SUCCESS_PENDING_REDIRECT:`successPendingRedirect`},L=class extends E(`InviteAcceptRequestError`)(){},R=class extends E(`InviteRedirectResolutionError`)(){};function z(){return{kind:`idle`}}function B(e){return{kind:`accepted`,organizationId:e}}function ee(e){return{kind:`error`,message:e}}function V(){return{navigation:null,nextNavigationId:1,nextRequestId:1,outcome:z(),pendingAcceptRequest:null,pendingRedirectResolution:null,redirectTarget:null}}function H(e){return{...V(),nextNavigationId:e.nextNavigationId,nextRequestId:e.nextRequestId}}function U(e,t){return{...H(e),outcome:ee(t)}}function W(e,t){return{navigation:{id:e.nextNavigationId,phase:`pending`,target:t},nextNavigationId:e.nextNavigationId+1}}function G(e){return e.redirectTarget??P}async function K(e){let t=await D.tryPromise({try:()=>u.acceptInvitation({invitationId:e}),catch:e=>new L({cause:e,message:j,reason:`request_failed`})});if(t.isErr())return D.err(t.error);let n=t.value;return n.error?D.err(new L({message:Y(n.error.message,j),reason:`response_failed`})):D.ok({acceptedOrganizationId:n.data.member.organizationId})}async function q(e){let t=await D.tryPromise({try:()=>e.refetchSession(),catch:t=>new R({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 X(t.error),D.err(t.error);let n=await D.tryPromise({try:()=>e.queryClient.fetchQuery({...p(e.userId),staleTime:0}),catch:t=>new R({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 X(n.error),D.err(n.error);let r=n.value.find(t=>t.id===e.acceptedOrganizationId);if(r)return D.ok({kind:`organization`,organizationSlug:m(r)});let i=await D.tryPromise({try:()=>u.getFullOrganization({query:{organizationId:e.acceptedOrganizationId}}),catch:t=>new R({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 X(i.error),D.err(i.error);if(i.value.data?.slug)return D.ok({kind:`organization`,organizationSlug:i.value.data.slug});let a=new R({acceptedOrganizationId:e.acceptedOrganizationId,message:`Accepted invitation but organization was not found`,reason:`organization_missing`,...e.userId?{userId:e.userId}:{}});return X(a),D.err(a)}function J(e,t){if(!(e instanceof Error))return t;let n=e.message.trim();return n.length===0?t:n}function Y(e,t){let n=e?.trim()??``;return n.length>0?n:t}function X(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 Z(e={}){let t=e.successRedirectDelayMs??N;return S({actions:{markNavigationRunning:T(({context:e,event:t})=>(C(t,F.NAVIGATION_STARTED),e.navigation?.id===t.id?{navigation:{...e.navigation,phase:`running`}}:{})),queueHomeNavigation:T(({context:e})=>W(e,P)),queueResolvedNavigation:T(({context:e})=>W(e,G(e))),resetFlow:T(({context:e,event:t})=>(C(t,F.NAVIGATION_COMPLETED),e.navigation?.id===t.id?H(e):{})),stageAcceptRequest:T(({context:e})=>({nextRequestId:e.nextRequestId+1,outcome:z(),pendingAcceptRequest:{requestId:e.nextRequestId},redirectTarget:null})),stageRedirectResolution:T(({context:e,event:t})=>(C(t,F.ACCEPT_SUCCEEDED),e.pendingAcceptRequest?.requestId===t.requestId?{nextRequestId:e.nextRequestId+1,pendingAcceptRequest:null,pendingRedirectResolution:{acceptedOrganizationId:t.acceptedOrganizationId,requestId:e.nextRequestId}}:{})),storeAcceptError:T(({context:e,event:t})=>(C(t,F.ACCEPT_FAILED),e.pendingAcceptRequest?.requestId===t.requestId?U(e,t.message):{})),storeAcceptedOrganizationId:T(({context:e,event:t})=>(C(t,F.ACCEPT_SUCCEEDED),e.pendingAcceptRequest?.requestId===t.requestId?{outcome:B(t.acceptedOrganizationId),redirectTarget:null}:{})),storeHomeRedirectTarget:T(({context:e,event:t})=>(C(t,F.REDIRECT_RESOLUTION_FAILED),e.pendingRedirectResolution?.requestId===t.requestId?{pendingRedirectResolution:null,redirectTarget:P}:{})),storeNavigationError:T(({context:e,event:t})=>(C(t,F.NAVIGATION_FAILED),e.navigation?.id===t.id?U(e,t.message):{})),storeResolvedRedirectTarget:T(({context:e,event:t})=>(C(t,F.REDIRECT_RESOLVED),e.pendingRedirectResolution?.requestId===t.requestId?{pendingRedirectResolution:null,redirectTarget:t.redirectTarget}:{}))},guards:{matchesPendingAcceptRequest:({context:e,event:t})=>t.type!==F.ACCEPT_FAILED&&t.type!==F.ACCEPT_SUCCEEDED?!1:e.pendingAcceptRequest?.requestId===t.requestId,matchesPendingRedirectResolution:({context:e,event:t})=>t.type!==F.REDIRECT_RESOLUTION_FAILED&&t.type!==F.REDIRECT_RESOLVED?!1:e.pendingRedirectResolution?.requestId===t.requestId},types:{}}).createMachine({context:V(),id:`inviteAccept`,initial:I.READY,states:{[I.READY]:{on:{[F.ACCEPT]:{actions:`stageAcceptRequest`,target:I.ACCEPTING},[F.DECLINE]:{actions:`queueHomeNavigation`,target:I.NAVIGATING}}},[I.ACCEPTING]:{on:{[F.ACCEPT_SUCCEEDED]:{actions:[`storeAcceptedOrganizationId`,`stageRedirectResolution`],guard:`matchesPendingAcceptRequest`,target:I.REFRESHING_ORGANIZATIONS},[F.ACCEPT_FAILED]:{actions:`storeAcceptError`,guard:`matchesPendingAcceptRequest`,target:I.ERROR}}},[I.REFRESHING_ORGANIZATIONS]:{on:{[F.REDIRECT_RESOLVED]:{actions:`storeResolvedRedirectTarget`,guard:`matchesPendingRedirectResolution`,target:I.SUCCESS_PENDING_REDIRECT},[F.REDIRECT_RESOLUTION_FAILED]:{actions:`storeHomeRedirectTarget`,guard:`matchesPendingRedirectResolution`,target:I.SUCCESS_PENDING_REDIRECT}}},[I.SUCCESS_PENDING_REDIRECT]:{after:{[t]:{actions:`queueResolvedNavigation`,target:I.NAVIGATING}}},[I.NAVIGATING]:{on:{[F.NAVIGATION_COMPLETED]:{actions:`resetFlow`,target:I.READY},[F.NAVIGATION_FAILED]:{actions:`storeNavigationError`,target:I.ERROR},[F.NAVIGATION_STARTED]:{actions:`markNavigationRunning`}}},[I.ERROR]:{on:{[F.GO_HOME]:{actions:`queueHomeNavigation`,target:I.NAVIGATING}}}}})}var Q=Z();function te(e){return e.matches(I.ACCEPTING)?`accepting`:e.matches(I.ERROR)||e.matches(I.NAVIGATING)&&e.context.outcome.kind===`error`?`error`:e.matches(I.REFRESHING_ORGANIZATIONS)||e.matches(I.SUCCESS_PENDING_REDIRECT)||e.matches(I.NAVIGATING)&&e.context.outcome.kind===`accepted`?`success`:`ready`}function ne(e){return e.context.outcome.kind===`error`?e.context.outcome.message:null}function re(e){return J(e,M)}function ie(){let e=(0,O.c)(42),t=a(),n=h(),{invitationId:r}=A.useParams(),{auth:i,refetchSession:o}=A.useRouteContext(),s=i.session?.user.id,c;e[0]===r?c=e[1]:(c=()=>K(r),e[0]=r,e[1]=c);let l=c,u;e[2]!==n||e[3]!==o||e[4]!==s?(u=e=>q({acceptedOrganizationId:e,queryClient:n,refetchSession:o,userId:s}),e[2]=n,e[3]=o,e[4]=s,e[5]=u):u=e[5];let f=u,[p,m]=w(Q),g=p.context.navigation,_=p.context.pendingAcceptRequest,v=p.context.pendingRedirectResolution,y;e[6]===p?y=e[7]:(y=p.matches(I.ACCEPTING),e[6]=p,e[7]=y);let b=y,x;e[8]===p?x=e[9]:(x=p.matches(I.REFRESHING_ORGANIZATIONS),e[8]=p,e[9]=x);let S=x,C,T;e[10]!==l||e[11]!==b||e[12]!==_||e[13]!==m?(C=()=>{if(!b||_===null)return;let e=!1;return l().then(t=>{if(!e){if(t.isErr()){m({message:t.error.message,requestId:_.requestId,type:F.ACCEPT_FAILED});return}m({acceptedOrganizationId:t.value.acceptedOrganizationId,requestId:_.requestId,type:F.ACCEPT_SUCCEEDED})}}),()=>{e=!0}},T=[l,b,_,m],e[10]=l,e[11]=b,e[12]=_,e[13]=m,e[14]=C,e[15]=T):(C=e[14],T=e[15]),(0,k.useEffect)(C,T);let E,D;e[16]!==S||e[17]!==v||e[18]!==f||e[19]!==m?(E=()=>{if(!S||v===null)return;let e=!1;return f(v.acceptedOrganizationId).then(t=>{if(!e){if(t.isErr()){m({requestId:v.requestId,type:F.REDIRECT_RESOLUTION_FAILED});return}m({redirectTarget:t.value,requestId:v.requestId,type:F.REDIRECT_RESOLVED})}}),()=>{e=!0}},D=[S,v,f,m],e[16]=S,e[17]=v,e[18]=f,e[19]=m,e[20]=E,e[21]=D):(E=e[20],D=e[21]),(0,k.useEffect)(E,D);let j,M;e[22]!==t||e[23]!==g||e[24]!==m?(j=()=>{g===null||g.phase!==`pending`||(m({id:g.id,type:F.NAVIGATION_STARTED}),(g.target.kind===`home`?t({to:`/`}):t({params:{org_slug:g.target.organizationSlug},to:d})).then(()=>{m({id:g.id,type:F.NAVIGATION_COMPLETED})}).catch(e=>{console.error(`[invite] failed to navigate after accepting invitation`,{error:e,navigation:g}),m({id:g.id,message:re(e),type:F.NAVIGATION_FAILED})}))},M=[t,g,m],e[22]=t,e[23]=g,e[24]=m,e[25]=j,e[26]=M):(j=e[25],M=e[26]),(0,k.useEffect)(j,M);let N,P;e[27]===m?(N=e[28],P=e[29]):(N=()=>{m({type:F.ACCEPT})},P=()=>{m({type:F.DECLINE})},e[27]=m,e[28]=N,e[29]=P);let L;e[30]===p?L=e[31]:(L=ne(p),e[30]=p,e[31]=L);let R;e[32]===m?R=e[33]:(R=()=>{m({type:F.GO_HOME})},e[32]=m,e[33]=R);let z;e[34]===p?z=e[35]:(z=te(p),e[34]=p,e[35]=z);let B;return e[36]!==N||e[37]!==P||e[38]!==L||e[39]!==R||e[40]!==z?(B={accept:N,decline:P,errorMessage:L,goHome:R,status:z},e[36]=N,e[37]=P,e[38]=L,e[39]=R,e[40]=z,e[41]=B):B=e[41],B}var $=n();function ae(){let e=(0,O.c)(28),{accept:t,decline:n,errorMessage:r,goHome:i,status:a}=ie(),u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsxs)(g,{className:`text-center`,children:[(0,$.jsx)(y,{className:`text-2xl`,children:`Organization Invitation`}),(0,$.jsx)(b,{children:`You've been invited to join an organization`})]}),e[0]=u):u=e[0];let d;e[1]===a?d=e[2]:(d=a===`ready`&&(0,$.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)(s,{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]=a,e[2]=d);let f;e[3]===a?f=e[4]:(f=a===`accepting`&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,$.jsx)(c,{size:48,className:`animate-spin text-primary`}),(0,$.jsx)(`p`,{className:`text-muted-foreground`,children:`Accepting invitation...`})]}),e[3]=a,e[4]=f);let p;e[5]===a?p=e[6]:(p=a===`success`&&(0,$.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)(s,{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]=a,e[6]=p);let m;e[7]!==r||e[8]!==a?(m=a===`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)(l,{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]=a,e[9]=m):m=e[9];let h;e[10]!==d||e[11]!==f||e[12]!==p||e[13]!==m?(h=(0,$.jsxs)(v,{className:`flex justify-center py-8`,children:[d,f,p,m]}),e[10]=d,e[11]=f,e[12]=p,e[13]=m,e[14]=h):h=e[14];let S;e[15]!==t||e[16]!==n||e[17]!==a?(S=a===`ready`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o,{variant:`outline`,onClick:n,children:`Decline`}),(0,$.jsx)(o,{onClick:t,children:`Accept Invitation`})]}),e[15]=t,e[16]=n,e[17]=a,e[18]=S):S=e[18];let C;e[19]!==i||e[20]!==a?(C=a===`error`&&(0,$.jsx)(o,{variant:`outline`,onClick:i,children:`Go to Home`}),e[19]=i,e[20]=a,e[21]=C):C=e[21];let w;e[22]!==S||e[23]!==C?(w=(0,$.jsxs)(_,{className:`flex justify-center gap-4`,children:[S,C]}),e[22]=S,e[23]=C,e[24]=w):w=e[24];let T;return e[25]!==h||e[26]!==w?(T=(0,$.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:(0,$.jsxs)(x,{className:`w-full max-w-md`,children:[u,h,w]})}),e[25]=h,e[26]=w,e[27]=T):T=e[27],T}var oe=ae;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-SKykt1po.js";import{o as s}from"./app-routes-CnJncMlZ.js";import{Q as c}from"./index-ClzxEm7R.js";var l=i(`outline`,`git-compare`,`GitCompare`,[[`path`,{d:`M4 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M16 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M11 6h5a2 2 0 0 1 2 2v8`,key:`svg-2`}],[`path`,{d:`M14 9l-3 -3l3 -3`,key:`svg-3`}],[`path`,{d:`M13 18h-5a2 2 0 0 1 -2 -2v-8`,key:`svg-4`}],[`path`,{d:`M10 15l3 3l-3 3`,key:`svg-5`}]]),u=i(`outline`,`robot`,`Robot`,[[`path`,{d:`M6 6a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -4`,key:`svg-0`}],[`path`,{d:`M12 2v2`,key:`svg-1`}],[`path`,{d:`M9 12v9`,key:`svg-2`}],[`path`,{d:`M15 12v9`,key:`svg-3`}],[`path`,{d:`M5 16l4 -2`,key:`svg-4`}],[`path`,{d:`M15 14l4 2`,key:`svg-5`}],[`path`,{d:`M9 18h6`,key:`svg-6`}],[`path`,{d:`M10 8v.01`,key:`svg-7`}],[`path`,{d:`M14 8v.01`,key:`svg-8`}]]),d=n(),f=e();function p(){let e=(0,d.c)(3),n,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight sm:text-3xl`,children:`Get started in minutes`}),i=(0,f.jsx)(`p`,{className:`mt-4 max-w-lg text-sm leading-6 text-muted-foreground sm:text-base`,children:`Self-host for free with a single command, or try the managed cloud version.`}),e[0]=n,e[1]=i):(n=e[0],i=e[1]);let o;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsx)(`div`,{className:`mx-auto max-w-6xl px-4 py-14 sm:px-6 sm:py-20`,children:(0,f.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[n,i,(0,f.jsx)(t,{to:s,className:a(r({size:`lg`}),`mt-7 px-8 sm:mt-8`),children:`Start Free`})]})})}),e[2]=o):o=e[2],o}var m=[{description:`Connect databases, analytics tools, and connectors without stitching together a custom control plane.`,icon:u,title:`Unified Access`},{description:`Run consistent workflows across databases, analytics, GitHub, and more from the same workspace.`,icon:l,title:`Cross-Source Coverage`},{description:`Manage data source connectivity, budgets, and team access from a single operational surface.`,icon:c,title:`Operational Control`}];function h(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight sm:text-3xl`,children:`One workspace for connected data`}),(0,f.jsx)(`p`,{className:`mx-auto mt-4 max-w-2xl text-sm leading-6 text-muted-foreground sm:text-base`,children:`Replace scattered setup steps with a single, consistent control plane.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsxs)(`div`,{className:`mx-auto max-w-6xl px-4 py-14 sm:px-6 sm:py-20`,children:[t,(0,f.jsx)(`div`,{className:`mt-10 grid gap-5 sm:mt-16 sm:gap-8 md:grid-cols-3`,children:m.map(g)})]})}),e[1]=n):n=e[1],n}function g(e){return(0,f.jsxs)(`div`,{className:`flex flex-col rounded-lg border border-border p-5 sm:p-6`,children:[(0,f.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-md bg-muted`,children:(0,f.jsx)(e.icon,{size:20,stroke:1.5,className:`size-5`})}),(0,f.jsx)(`h3`,{className:`mt-4 text-base font-semibold`,children:e.title}),(0,f.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-muted-foreground`,children:e.description})]},e.title)}function _(){let e=(0,d.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(`footer`,{className:`border-t border-border`,children:(0,f.jsx)(`div`,{className:`mx-auto flex max-w-6xl items-center justify-center px-6 py-8`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`div`,{className:`flex h-6 w-6 items-center justify-center rounded bg-foreground text-background text-xs font-bold`,children:`V`}),(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`OneQuery - Autonomous Data Workspace`})]})})}),e[0]=t):t=e[0],t}function v(){let e=(0,d.c)(3),n,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`h1`,{className:`max-w-4xl text-3xl font-bold leading-tight tracking-tight sm:text-5xl md:text-6xl`,children:`Your autonomous data workspace`}),i=(0,f.jsx)(`p`,{className:`mt-5 max-w-2xl text-base leading-7 text-muted-foreground sm:mt-6 sm:text-lg md:text-xl`,children:`Connect your data sources, query them from one place, and keep your team aligned on the systems that matter. OneQuery gives you a clean control plane for operating your data access.`}),e[0]=n,e[1]=i):(n=e[0],i=e[1]);let o;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,f.jsx)(`section`,{className:`mx-auto max-w-6xl px-4 py-14 sm:px-6 sm:py-20 md:py-28`,children:(0,f.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[n,i,(0,f.jsx)(t,{to:s,className:a(r({size:`lg`}),`mt-8 px-8 sm:mt-10`),children:`Get Started`})]})}),e[2]=o):o=e[2],o}var y=[`PostgreSQL`,`MySQL`,`BigQuery`,`Google Analytics`,`Amplitude`,`Mixpanel`,`PostHog`,`GitHub`,`Linear`];function b(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight sm:text-3xl`,children:`Connect your stack`}),(0,f.jsx)(`p`,{className:`mx-auto mt-4 max-w-xl text-sm leading-6 text-muted-foreground sm:text-base`,children:`OneQuery integrates with the tools you already use.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsxs)(`div`,{className:`mx-auto max-w-6xl px-4 py-14 sm:px-6 sm:py-20`,children:[t,(0,f.jsx)(`div`,{className:`mt-10 flex flex-wrap items-center justify-center gap-x-6 gap-y-4 sm:mt-12 sm:gap-x-8`,children:y.map(x)})]})}),e[1]=n):n=e[1],n}function x(e){return(0,f.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:e},e)}function S(){let e=(0,d.c)(4),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsxs)(t,{to:`/`,className:`flex items-center gap-2`,children:[(0,f.jsx)(`img`,{src:`/onequery.svg`,alt:`OneQuery`,className:`h-8 w-8`}),(0,f.jsx)(`span`,{className:`font-semibold text-base sm:text-lg`,children:`OneQuery`})]}),e[0]=n):n=e[0];let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,f.jsx)(o,{}),e[1]=i):i=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,f.jsx)(t,{to:s,className:a(r({size:`sm`,variant:`ghost`}),`hidden sm:inline-flex`),children:`Sign in`}),e[2]=c):c=e[2];let l;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,f.jsx)(`header`,{className:`sticky top-0 z-50 w-full border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:(0,f.jsxs)(`div`,{className:`mx-auto flex h-14 max-w-6xl items-center justify-between px-4 sm:px-6`,children:[n,(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i,c,(0,f.jsx)(t,{to:s,className:r({size:`sm`,variant:`default`}),children:`Get Started`})]})]})}),e[3]=l):l=e[3],l}function C(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(S,{}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsxs)(`div`,{className:`flex h-screen flex-col overflow-y-auto`,children:[t,(0,f.jsxs)(`main`,{className:`flex-1`,children:[(0,f.jsx)(v,{}),(0,f.jsx)(h,{}),(0,f.jsx)(b,{}),(0,f.jsx)(p,{})]}),(0,f.jsx)(_,{})]}),e[1]=n):n=e[1],n}var w=C;export{w as component};
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-7vhlmsbU.js";import{o as s}from"./app-routes-CnJncMlZ.js";import{G as c}from"./index-B4tzcC1c.js";var l=i(`outline`,`git-compare`,`GitCompare`,[[`path`,{d:`M4 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M16 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M11 6h5a2 2 0 0 1 2 2v8`,key:`svg-2`}],[`path`,{d:`M14 9l-3 -3l3 -3`,key:`svg-3`}],[`path`,{d:`M13 18h-5a2 2 0 0 1 -2 -2v-8`,key:`svg-4`}],[`path`,{d:`M10 15l3 3l-3 3`,key:`svg-5`}]]),u=i(`outline`,`robot`,`Robot`,[[`path`,{d:`M6 6a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -4`,key:`svg-0`}],[`path`,{d:`M12 2v2`,key:`svg-1`}],[`path`,{d:`M9 12v9`,key:`svg-2`}],[`path`,{d:`M15 12v9`,key:`svg-3`}],[`path`,{d:`M5 16l4 -2`,key:`svg-4`}],[`path`,{d:`M15 14l4 2`,key:`svg-5`}],[`path`,{d:`M9 18h6`,key:`svg-6`}],[`path`,{d:`M10 8v.01`,key:`svg-7`}],[`path`,{d:`M14 8v.01`,key:`svg-8`}]]),d=n(),f=e();function p(){let e=(0,d.c)(3),n,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight sm:text-3xl`,children:`Get started in minutes`}),i=(0,f.jsx)(`p`,{className:`mt-4 max-w-lg text-sm leading-6 text-muted-foreground sm:text-base`,children:`Self-host for free with a single command, or try the managed cloud version.`}),e[0]=n,e[1]=i):(n=e[0],i=e[1]);let o;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsx)(`div`,{className:`mx-auto max-w-6xl px-4 py-14 sm:px-6 sm:py-20`,children:(0,f.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[n,i,(0,f.jsx)(t,{to:s,className:a(r({size:`lg`}),`mt-7 px-8 sm:mt-8`),children:`Start Free`})]})})}),e[2]=o):o=e[2],o}var m=[{description:`Connect databases, analytics tools, and connectors without stitching together a custom control plane.`,icon:u,title:`Unified Access`},{description:`Run consistent workflows across databases, analytics, GitHub, and more from the same workspace.`,icon:l,title:`Cross-Source Coverage`},{description:`Manage data source connectivity, budgets, and team access from a single operational surface.`,icon:c,title:`Operational Control`}];function h(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight sm:text-3xl`,children:`One workspace for connected data`}),(0,f.jsx)(`p`,{className:`mx-auto mt-4 max-w-2xl text-sm leading-6 text-muted-foreground sm:text-base`,children:`Replace scattered setup steps with a single, consistent control plane.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsxs)(`div`,{className:`mx-auto max-w-6xl px-4 py-14 sm:px-6 sm:py-20`,children:[t,(0,f.jsx)(`div`,{className:`mt-10 grid gap-5 sm:mt-16 sm:gap-8 md:grid-cols-3`,children:m.map(g)})]})}),e[1]=n):n=e[1],n}function g(e){return(0,f.jsxs)(`div`,{className:`flex flex-col rounded-lg border border-border p-5 sm:p-6`,children:[(0,f.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-md bg-muted`,children:(0,f.jsx)(e.icon,{size:20,stroke:1.5,className:`size-5`})}),(0,f.jsx)(`h3`,{className:`mt-4 text-base font-semibold`,children:e.title}),(0,f.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-muted-foreground`,children:e.description})]},e.title)}function _(){let e=(0,d.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(`footer`,{className:`border-t border-border`,children:(0,f.jsx)(`div`,{className:`mx-auto flex max-w-6xl items-center justify-center px-6 py-8`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`div`,{className:`flex h-6 w-6 items-center justify-center rounded bg-foreground text-background text-xs font-bold`,children:`V`}),(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`OneQuery - Autonomous Data Workspace`})]})})}),e[0]=t):t=e[0],t}function v(){let e=(0,d.c)(3),n,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`h1`,{className:`max-w-4xl text-3xl font-bold leading-tight tracking-tight sm:text-5xl md:text-6xl`,children:`Your autonomous data workspace`}),i=(0,f.jsx)(`p`,{className:`mt-5 max-w-2xl text-base leading-7 text-muted-foreground sm:mt-6 sm:text-lg md:text-xl`,children:`Connect your data sources, query them from one place, and keep your team aligned on the systems that matter. OneQuery gives you a clean control plane for operating your data access.`}),e[0]=n,e[1]=i):(n=e[0],i=e[1]);let o;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,f.jsx)(`section`,{className:`mx-auto max-w-6xl px-4 py-14 sm:px-6 sm:py-20 md:py-28`,children:(0,f.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[n,i,(0,f.jsx)(t,{to:s,className:a(r({size:`lg`}),`mt-8 px-8 sm:mt-10`),children:`Get Started`})]})}),e[2]=o):o=e[2],o}var y=[`PostgreSQL`,`MySQL`,`BigQuery`,`Google Analytics`,`Amplitude`,`Mixpanel`,`PostHog`,`GitHub`,`Linear`];function b(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight sm:text-3xl`,children:`Connect your stack`}),(0,f.jsx)(`p`,{className:`mx-auto mt-4 max-w-xl text-sm leading-6 text-muted-foreground sm:text-base`,children:`OneQuery integrates with the tools you already use.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsxs)(`div`,{className:`mx-auto max-w-6xl px-4 py-14 sm:px-6 sm:py-20`,children:[t,(0,f.jsx)(`div`,{className:`mt-10 flex flex-wrap items-center justify-center gap-x-6 gap-y-4 sm:mt-12 sm:gap-x-8`,children:y.map(x)})]})}),e[1]=n):n=e[1],n}function x(e){return(0,f.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:e},e)}function S(){let e=(0,d.c)(4),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsxs)(t,{to:`/`,className:`flex items-center gap-2`,children:[(0,f.jsx)(`img`,{src:`/onequery.svg`,alt:`OneQuery`,className:`h-8 w-8`}),(0,f.jsx)(`span`,{className:`font-semibold text-base sm:text-lg`,children:`OneQuery`})]}),e[0]=n):n=e[0];let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,f.jsx)(o,{}),e[1]=i):i=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,f.jsx)(t,{to:s,className:a(r({size:`sm`,variant:`ghost`}),`hidden sm:inline-flex`),children:`Sign in`}),e[2]=c):c=e[2];let l;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,f.jsx)(`header`,{className:`sticky top-0 z-50 w-full border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:(0,f.jsxs)(`div`,{className:`mx-auto flex h-14 max-w-6xl items-center justify-between px-4 sm:px-6`,children:[n,(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i,c,(0,f.jsx)(t,{to:s,className:r({size:`sm`,variant:`default`}),children:`Get Started`})]})]})}),e[3]=l):l=e[3],l}function C(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(S,{}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsxs)(`div`,{className:`flex h-screen flex-col overflow-y-auto`,children:[t,(0,f.jsxs)(`main`,{className:`flex-1`,children:[(0,f.jsx)(v,{}),(0,f.jsx)(h,{}),(0,f.jsx)(b,{}),(0,f.jsx)(p,{})]}),(0,f.jsx)(_,{})]}),e[1]=n):n=e[1],n}var w=C;export{w as component};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{a as r}from"./link-Cgvqhh5w.js";import{t as i}from"./compiler-runtime-DCc3R3Xn.js";import{C as a,M as o,S as s,a as c,b as l,c as u,d,f,g as p,h as m,t as h,x as g,y as _}from"./createReactComponent-_L2mp4Ui.js";import{t as v}from"./utils-C8DGLIgm.js";import{t as y}from"./IconCheck-Gc24xPT2.js";import{t as b}from"./IconChevronDown-B-39MA7-.js";import{C as x,Ct as S,E as C,Et as w,F as ee,I as T,M as E,O as D,P as O,T as k,b as A,c as j,ct as M,d as te,l as N,n as P,o as F,s as I,t as ne,ut as re,w as L,wt as R,x as z,y as ie}from"./getDisabledMountTransitionStyles-Co-5TcgR.js";import{d as ae,i as B,n as V,r as H,t as U}from"./CompositeList-FRTEqUDK.js";import{_ as oe,d as se,l as W,n as ce,r as G}from"./useBaseUiId-BLFGpnYJ.js";import{a as K,c as le,i as q,l as ue,n as de,o as fe,r as J,s as pe,t as me}from"./getPseudoElementBounds-BefWKytd.js";import{a as he,i as ge,n as _e,o as ve,r as ye,s as be}from"./input-CG_cIxvO.js";import{t as xe}from"./useControlled-B8q0aJoo.js";import{t as Se}from"./useValueChanged-C3CBkPge.js";var Ce=h(`outline`,`chevron-up`,`ChevronUp`,[[`path`,{d:`M6 15l6 -6l6 6`,key:`svg-0`}]]),we=h(`outline`,`selector`,`Selector`,[[`path`,{d:`M8 9l4 -4l4 4`,key:`svg-0`}],[`path`,{d:`M16 15l-4 4l-4 -4`,key:`svg-1`}]]),Y=e(t());function Te(e){let t=Y.useRef(!0);t.current&&(t.current=!1,e())}var Ee=Y.createContext(null),De=Y.createContext(null);function X(){let e=Y.useContext(Ee);if(e===null)throw Error(_(60));return e}function Oe(){let e=Y.useContext(De);if(e===null)throw Error(_(61));return e}var ke=(e,t)=>Object.is(e,t);function Ae(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function je(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:Ae(e,t,n))}function Me(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:Ae(e,t,n))}function Ne(e,t,n){return e.filter(e=>!Ae(e,t,n))}function Pe(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var Z=n();function Fe(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function Ie(e){if(!Array.isArray(e))return e!=null&&!(`null`in e);if(Fe(e)){for(let t of e)for(let e of t.items)if(e&&e.value==null&&e.label!=null)return!0;return!1}for(let t of e)if(t&&t.value==null&&t.label!=null)return!0;return!1}function Le(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return Pe(e)}function Re(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?Pe(e.value):Pe(e)}function ze(e,t,n){function r(){return Le(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=Fe(t)?t.flatMap(e=>e.items):t;if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Be(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,Z.jsx)(Y.Fragment,{children:ze(r,t,n)},i)),e),[])}var Q={id:k(e=>e.id),modal:k(e=>e.modal),multiple:k(e=>e.multiple),items:k(e=>e.items),itemToStringLabel:k(e=>e.itemToStringLabel),itemToStringValue:k(e=>e.itemToStringValue),isItemEqualToValue:k(e=>e.isItemEqualToValue),value:k(e=>e.value),hasSelectedValue:k(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Re(t,r)!==``}),hasNullItemLabel:k((e,t)=>t?Ie(e.items):!1),open:k(e=>e.open),mounted:k(e=>e.mounted),forceMount:k(e=>e.forceMount),transitionStatus:k(e=>e.transitionStatus),openMethod:k(e=>e.openMethod),activeIndex:k(e=>e.activeIndex),selectedIndex:k(e=>e.selectedIndex),isActive:k((e,t)=>e.activeIndex===t),isSelected:k((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>Ae(e,n,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Ae(i,n,r)}),isSelectedByFocus:k((e,t)=>e.selectedIndex===t),popupProps:k(e=>e.popupProps),triggerProps:k(e=>e.triggerProps),triggerElement:k(e=>e.triggerElement),positionerElement:k(e=>e.positionerElement),listElement:k(e=>e.listElement),scrollUpArrowVisible:k(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:k(e=>e.scrollDownArrowVisible),hasScrollArrows:k(e=>e.hasScrollArrows)};function Ve(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:o,defaultOpen:c=!1,onOpenChange:u,name:p,disabled:h=!1,readOnly:_=!1,required:v=!1,modal:y=!0,actionsRef:b,inputRef:S,onOpenChangeComplete:w,items:E,multiple:D=!1,itemToStringLabel:O,itemToStringValue:k,isItemEqualToValue:A=ke,highlightItemOnHover:j=!0,children:M}=e,{clearErrors:P}=he(),{setDirty:F,setTouched:I,setFocused:ne,shouldValidateOnChange:re,validityData:ae,setFilled:B,name:V,disabled:H,validation:U,validationMode:oe}=ve(),W=ye({id:t}),G=H||h,K=V??p,[q,ue]=xe({controlled:n,default:D?r??d:r,name:`Select`,state:`value`}),[J,me]=xe({controlled:o,default:c,name:`Select`,state:`open`}),ge=Y.useRef([]),be=Y.useRef([]),Ce=Y.useRef(null),we=Y.useRef(null),X=Y.useRef(0),Oe=Y.useRef(null),Ae=Y.useRef([]),je=Y.useRef(!1),Ne=Y.useRef(!1),Pe=Y.useRef(null),Fe=Y.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),Ie=Y.useRef(!1),{mounted:Le,setMounted:ze,transitionStatus:Be}=z(J),{openMethod:Ve,triggerProps:He,reset:Ue}=de(J),$=a(()=>new x({id:W,modal:y,multiple:D,itemToStringLabel:O,itemToStringValue:k,isItemEqualToValue:A,value:q,open:J,mounted:Le,transitionStatus:Be,items:E,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,We=L($,Q.activeIndex),Ge=L($,Q.selectedIndex),Ke=L($,Q.triggerElement),qe=L($,Q.positionerElement),Je=Y.useMemo(()=>D&&Array.isArray(q)&&q.length===0?``:Re(q,k),[D,q,k]),Ye=Y.useMemo(()=>D&&Array.isArray(q)?q.map(e=>Re(e,k)):Re(q,k),[D,q,k]),Xe=R($.state.triggerElement);_e({id:W,commit:U.commit,value:q,controlRef:Xe,name:K,getValue:()=>Ye});let Ze=Y.useRef(q);g(()=>{q!==Ze.current&&$.set(`forceMount`,!0)},[$,q]),g(()=>{B(D?Array.isArray(q)&&q.length>0:q!=null)},[D,q,B]),g(function(){if(J)return;let e=Ae.current;if(D){let t=Array.isArray(q)?q:[];if(t.length===0){$.set(`selectedIndex`,null);return}let n=t[t.length-1],r=Me(e,n,A);$.set(`selectedIndex`,r===-1?null:r);return}let t=Me(e,q,A);$.set(`selectedIndex`,t===-1?null:t)},[D,J,q,Ae,A,$]),Se(q,()=>{P(K),F(q!==ae.initialValue),re()?U.commit(q):U.commit(q,!0)});let Qe=s((e,t)=>{if(u?.(e,t),!t.isCanceled&&(me(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(I(!0),ne(!1),oe===`onBlur`&&U.commit(q)),!e&&$.state.activeIndex!==null)){let e=ge.current[$.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),$e=s(()=>{ze(!1),$.set(`activeIndex`,null),Ue(),w?.(!1)});ie({enabled:!b,open:J,ref:Ce,onComplete(){J||$e()}}),Y.useImperativeHandle(b,()=>({unmount:$e}),[$e]);let et=s((e,t)=>{i?.(e,t),!t.isCanceled&&ue(e)}),tt=s(()=>{let e=$.state.listElement||Ce.current;if(!e)return;let t=e.scrollTop,n=e.scrollTop+e.clientHeight,r=t>1,i=n<e.scrollHeight-1;$.state.scrollUpArrowVisible!==r&&$.set(`scrollUpArrowVisible`,r),$.state.scrollDownArrowVisible!==i&&$.set(`scrollDownArrowVisible`,i)}),nt=te({open:J,onOpenChange:Qe,elements:{reference:Ke,floating:qe}}),{getReferenceProps:rt,getFloatingProps:it,getItemProps:at}=N([le(nt,{enabled:!_&&!G,event:`mousedown`}),C(nt,{bubbles:!1}),pe(nt,{enabled:!_&&!G,listRef:ge,activeIndex:We,selectedIndex:Ge,disabledIndices:d,onNavigate(e){e===null&&!J||$.set(`activeIndex`,e)},focusItemOnHover:!1}),fe(nt,{enabled:!_&&!G&&(J||!D),listRef:be,activeIndex:We,selectedIndex:Ge,onMatch(e){J?$.set(`activeIndex`,e):et(Ae.current[e],ce(`none`))},onTypingChange(e){je.current=e}})]),ot=Y.useMemo(()=>l(rt(),He,W?{id:W}:f),[rt,He,W]);Te(()=>{$.update({popupProps:it(),triggerProps:ot})}),g(()=>{$.update({id:W,modal:y,multiple:D,value:q,open:J,mounted:Le,transitionStatus:Be,popupProps:it(),triggerProps:ot,items:E,itemToStringLabel:O,itemToStringValue:k,isItemEqualToValue:A,openMethod:Ve})},[$,W,y,D,q,J,Le,Be,it,ot,E,O,k,A,Ve]);let st=Y.useMemo(()=>({store:$,name:K,required:v,disabled:G,readOnly:_,multiple:D,itemToStringLabel:O,itemToStringValue:k,highlightItemOnHover:j,setValue:et,setOpen:Qe,listRef:ge,popupRef:Ce,scrollHandlerRef:we,handleScrollArrowVisibility:tt,scrollArrowsMountedCountRef:X,getItemProps:at,events:nt.context.events,valueRef:Oe,valuesRef:Ae,labelsRef:be,typingRef:je,selectionRef:Fe,selectedItemTextRef:Pe,validation:U,onOpenChangeComplete:w,keyboardActiveRef:Ne,alignItemWithTriggerActiveRef:Ie,initialValueRef:Ze}),[$,K,v,G,_,D,O,k,j,et,Qe,at,nt.context.events,U,w,tt]),ct=m(S,U.inputRef),lt=D&&Array.isArray(q)&&q.length>0,ut=Y.useMemo(()=>!D||!Array.isArray(q)||!K?null:q.map(e=>{let t=Re(e,k);return(0,Z.jsx)(`input`,{type:`hidden`,name:K,value:t},t)}),[D,q,K,k]);return(0,Z.jsx)(Ee.Provider,{value:st,children:(0,Z.jsxs)(De.Provider,{value:nt,children:[M,(0,Z.jsx)(`input`,{...U.getInputValidationProps({onFocus(){$.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.value,n=ce(se,e.nativeEvent);function r(){if(D)return;let e=Ae.current.find(e=>Re(e,k).toLowerCase()===t.toLowerCase());e!=null&&(F(e!==ae.initialValue),et(e,n),re()&&U.commit(e))}$.set(`forceMount`,!0),queueMicrotask(r)}}),name:D?void 0:K,value:Je,disabled:G,required:v&&!lt,readOnly:_,ref:ct,style:K?T:ee,tabIndex:-1,"aria-hidden":!0}),ut]})})}var He=2,Ue=400,$=200,We={...I,...be,value:()=>null},Ge=Y.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,...u}=e,{setTouched:d,setFocused:f,validationMode:h,state:g,disabled:_}=ve(),{labelId:v}=ge(),{store:y,setOpen:b,selectionRef:x,validation:S,readOnly:C,required:ee,alignItemWithTriggerActiveRef:T,disabled:D,keyboardActiveRef:O}=X(),k=_||D||a,A=L(y,Q.open),j=L(y,Q.value),te=L(y,Q.triggerProps),N=L(y,Q.positionerElement),P=L(y,Q.listElement),F=L(y,Q.id),I=L(y,Q.hasSelectedValue),ne=!I&&A,z=L(y,Q.hasNullItemLabel,ne),ie=i??F;ye({id:ie});let ae=R(N),B=Y.useRef(null),{getButtonProps:V,buttonRef:H}=p({disabled:k,native:o}),U=m(t,B,H,s(e=>{y.set(`triggerElement`,e)})),oe=w(),W=w(),K=w(),le=w();Y.useEffect(()=>{if(A)return I||z?le.start($,()=>{x.current.allowUnselectedMouseUp=!0,K.start($,()=>{x.current.allowSelectedMouseUp=!0})}):K.start(Ue,()=>{x.current.allowUnselectedMouseUp=!0,x.current.allowSelectedMouseUp=!0}),()=>{K.clear(),le.clear()};x.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},W.clear()},[A,I,z,x,W,K,le]);let q=Y.useMemo(()=>P?.id??re(N)?.id,[P,N]),ue=l(te,{id:ie,role:`combobox`,"aria-expanded":A?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":A?q:void 0,"aria-labelledby":v,"aria-readonly":C||void 0,"aria-required":ee||void 0,tabIndex:k?-1:0,ref:U,onFocus(e){f(!0),A&&T.current&&b(!1,ce(se,e.nativeEvent)),oe.start(0,()=>{y.set(`forceMount`,!0)})},onBlur(e){M(N,e.relatedTarget)||(d(!0),f(!1),h===`onBlur`&&S.commit(j))},onPointerMove(){O.current=!1},onKeyDown(){O.current=!0},onMouseDown(e){if(A)return;let t=E(e.currentTarget);function n(e){if(!B.current)return;let t=e.target;if(M(B.current,t)||M(ae.current,t)||t===B.current)return;let n=me(B.current);e.clientX>=n.left-He&&e.clientX<=n.right+He&&e.clientY>=n.top-He&&e.clientY<=n.bottom+He||b(!1,ce(G,e))}W.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},S.getValidationProps,u,V);ue.role=`combobox`;let de=Y.useMemo(()=>({...g,open:A,disabled:k,value:j,readOnly:C,placeholder:!I}),[g,A,k,j,C,I]);return c(`button`,e,{ref:[t,B],state:de,stateAttributesMapping:We,props:ue})}),Ke={value:()=>null},qe=Y.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,...o}=e,{store:s,valueRef:l}=X(),u=L(s,Q.value),d=L(s,Q.items),f=L(s,Q.itemToStringLabel),p=L(s,Q.hasSelectedValue),m=!p&&a!=null&&i==null,h=L(s,Q.hasNullItemLabel,m),g=Y.useMemo(()=>({value:u,placeholder:!p}),[u,p]),_=null;return _=typeof i==`function`?i(u):i??(!p&&a!=null&&!h?a:Array.isArray(u)?Be(u,d,f):ze(u,d,f)),c(`span`,e,{state:g,ref:[t,l],props:[{children:_},o],stateAttributesMapping:Ke})}),Je=Y.forwardRef(function(e,t){let{className:n,render:r,...i}=e,{store:a}=X(),o=L(a,Q.open);return c(`span`,e,{state:Y.useMemo(()=>({open:o}),[o]),ref:t,props:[{"aria-hidden":!0,children:`▼`},i],stateAttributesMapping:j})}),Ye=Y.createContext(void 0),Xe=Y.forwardRef(function(e,t){let{store:n}=X(),r=L(n,Q.mounted),i=L(n,Q.forceMount);return r||i?(0,Z.jsx)(Ye.Provider,{value:!0,children:(0,Z.jsx)(D,{ref:t,...e})}):null}),Ze=Y.createContext(void 0);function Qe(){let e=Y.useContext(Ze);if(!e)throw Error(_(59));return e}function $e(e,t){e&&Object.assign(e.style,t)}var et={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},tt={position:`fixed`},nt=Y.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o=`bottom`,align:l=`center`,sideOffset:d=0,alignOffset:f=0,collisionBoundary:p=`clipping-ancestors`,collisionPadding:m,arrowPadding:h=5,sticky:_=!1,disableAnchorTracking:v,alignItemWithTrigger:y=!0,collisionAvoidance:b=u,...x}=e,{store:S,listRef:C,labelsRef:w,alignItemWithTriggerActiveRef:ee,selectedItemTextRef:T,valuesRef:E,initialValueRef:D,popupRef:O,setValue:k}=X(),A=Oe(),j=L(S,Q.open),M=L(S,Q.mounted),te=L(S,Q.modal),N=L(S,Q.value),I=L(S,Q.openMethod),ne=L(S,Q.positionerElement),re=L(S,Q.triggerElement),R=L(S,Q.isItemEqualToValue),z=Y.useRef(null),ie=Y.useRef(null),[ae,B]=Y.useState(y),V=M&&ae&&I!==`touch`;!M&&ae!==y&&B(y),g(()=>{M||(Q.scrollUpArrowVisible(S.state)&&S.set(`scrollUpArrowVisible`,!1),Q.scrollDownArrowVisible(S.state)&&S.set(`scrollDownArrowVisible`,!1))},[S,M]),Y.useImperativeHandle(ee,()=>V),J((V||te)&&j&&I!==`touch`,re);let H=P({anchor:n,floatingRootContext:A,positionMethod:r,mounted:M,side:o,sideOffset:d,align:l,alignOffset:f,arrowPadding:h,collisionBoundary:p,collisionPadding:m,sticky:_,disableAnchorTracking:v??V,collisionAvoidance:b,keepMounted:!0}),oe=V?`none`:H.side,W=V?tt:H.positionerStyles,G=Y.useMemo(()=>{let e={};return j||(e.pointerEvents=`none`),{role:`presentation`,hidden:!M,style:{...W,...e}}},[j,M,W]),le=Y.useMemo(()=>({open:j,side:oe,align:H.align,anchorHidden:H.anchorHidden}),[j,oe,H.align,H.anchorHidden]),ue=c(`div`,e,{ref:[t,s(e=>{S.set(`positionerElement`,e)})],state:le,stateAttributesMapping:F,props:[G,x]}),de=Y.useRef(0),fe=s(e=>{if(e.size===0&&de.current===0||E.current.length===0)return;let t=de.current;if(de.current=e.size,e.size===t)return;let n=ce(se);if(t!==0&&!S.state.multiple&&N!==null&&Me(E.current,N,R)===-1){let e=D.current,t=e!=null&&je(E.current,e,R)?e:null;k(t,n),t===null&&(S.set(`selectedIndex`,null),T.current=null)}if(t!==0&&S.state.multiple&&Array.isArray(N)){let e=N.filter(e=>je(E.current,e,R));(e.length!==N.length||e.some(e=>!je(N,e,R)))&&(k(e,n),e.length===0&&(S.set(`selectedIndex`,null),T.current=null))}if(j&&V){S.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};$e(ne,e),$e(O.current,e)}}),pe=Y.useMemo(()=>({...H,side:oe,alignItemWithTriggerActive:V,setControlledAlignItemWithTrigger:B,scrollUpArrowRef:z,scrollDownArrowRef:ie}),[H,oe,V,B]);return(0,Z.jsx)(U,{elementsRef:C,labelsRef:w,onMapChange:fe,children:(0,Z.jsxs)(Ze.Provider,{value:pe,children:[M&&te&&(0,Z.jsx)(q,{inert:K(!j),cutout:re}),ue]})})});function rt(e){let t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}var it=`base-ui-disable-scrollbar`,at={className:it,getElement(e){return(0,Z.jsx)(`style`,{nonce:e,href:it,precedence:`base-ui:low`,children:`.${it}{scrollbar-width:none}.${it}::-webkit-scrollbar{display:none}`})}};function ot(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var st=Y.createContext(void 0),ct={disableStyleElements:!1};function lt(){return Y.useContext(st)??ct}var ut=e(r()),dt={...F,...A},ft=Y.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{store:a,popupRef:l,onOpenChangeComplete:u,setOpen:d,valueRef:f,selectedItemTextRef:p,keyboardActiveRef:m,multiple:h,handleScrollArrowVisibility:_,scrollHandlerRef:v,highlightItemOnHover:y}=X(),{side:b,align:x,alignItemWithTriggerActive:C,setControlledAlignItemWithTrigger:ee,scrollDownArrowRef:T,scrollUpArrowRef:D}=Qe(),k=V(!0)!=null,A=Oe(),{nonce:j,disableStyleElements:M}=lt(),te=w(),N=L(a,Q.id),P=L(a,Q.open),F=L(a,Q.mounted),I=L(a,Q.popupProps),re=L(a,Q.transitionStatus),R=L(a,Q.triggerElement),z=L(a,Q.positionerElement),B=L(a,Q.listElement),H=Y.useRef(0),U=Y.useRef(!1),se=Y.useRef(0),W=Y.useRef(!1),G=Y.useRef({}),K=O(),le=s(e=>{if(!z||!l.current||!W.current)return;if(U.current||!C){_();return}let t=z.style.top===`0px`,n=z.style.bottom===`0px`,r=z.getBoundingClientRect().height,i=E(z),a=getComputedStyle(z),o=parseFloat(a.marginTop),s=parseFloat(a.marginBottom),c=pt(getComputedStyle(l.current)),u=i.documentElement.clientHeight-o-s,d=e.scrollTop,f=e.scrollHeight-e.clientHeight,p=0,m=null,h=!1;if(t){let e=r+(f-d),t=Math.min(e,u);p=t,t===u?h=!0:m=f}else if(n){let e=d-0,t=r+e,n=Math.min(t,u),i=t-u;p=n,n===u?(h=!0,d<f&&(m=d-(e-i))):m=0}p!==0&&(z.style.height=`${p}px`),m!=null&&(e.scrollTop=m),(h||p>=c)&&(U.current=!0),_()});Y.useImperativeHandle(v,()=>le,[le]),ie({open:P,ref:l,onComplete(){P&&u?.(!0)}});let q=Y.useMemo(()=>({open:P,transitionStatus:re,side:b,align:x}),[P,re,b,x]);g(()=>{!z||!l.current||Object.keys(G.current).length||(G.current={top:z.style.top||`0`,left:z.style.left||`0`,right:z.style.right,height:z.style.height,bottom:z.style.bottom,minHeight:z.style.minHeight,maxHeight:z.style.maxHeight,marginTop:z.style.marginTop,marginBottom:z.style.marginBottom})},[l,z]),g(()=>{P||C||(W.current=!1,U.current=!1,H.current=0,se.current=0,$e(z,G.current))},[P,C,z,l]),g(()=>{let e=l.current;if(!(!P||!R||!z||!e||a.state.transitionStatus===`ending`)){if(!C){W.current=!0,K.request(_),e.style.removeProperty(`--transform-origin`);return}queueMicrotask(()=>{let t=gt(e);e.style.removeProperty(`--transform-origin`);try{let t=getComputedStyle(z),n=getComputedStyle(e),r=E(R),i=o(z),a=R.getBoundingClientRect(),s=z.getBoundingClientRect(),c=a.left,l=a.height,u=B||e,d=u.scrollHeight,m=parseFloat(n.borderBottomWidth),h=parseFloat(t.marginTop)||10,g=parseFloat(t.marginBottom)||10,v=parseFloat(t.minHeight)||100,y=pt(n),b=r.documentElement.clientHeight-h-g,x=r.documentElement.clientWidth,C=b-a.bottom+l,w=p.current,T=f.current,D,O=0,k=0;if(w&&T){let e=T.getBoundingClientRect();D=w.getBoundingClientRect();let t=e.left-c,n=D.left-s.left,r=e.top-a.top+e.height/2,i=D.top-s.top+D.height/2;O=t-n,k=i-r}let A=C+k+g+m,j=Math.min(b,A),M=b-h-g,te=A-j,N=Math.max(5,c+O),P=x-5,F=Math.max(0,N+s.width-P);z.style.left=`${N-F}px`,z.style.height=`${j}px`,z.style.maxHeight=`auto`,z.style.marginTop=`${h}px`,z.style.marginBottom=`${g}px`,e.style.height=`100%`;let I=u.scrollHeight-u.clientHeight,ne=te>=I;ne&&(j=Math.min(b,s.height)-(te-I));let re=a.top<20||a.bottom>b-20||j<Math.min(d,v),L=(i.visualViewport?.scale??1)!==1&&S;if(re||L){W.current=!0,$e(z,G.current),ut.flushSync(()=>ee(!1));return}if(ne){let e=Math.max(0,b-A);z.style.top=s.height>=M?`0`:`${e}px`,z.style.height=`${j}px`,u.scrollTop=u.scrollHeight-u.clientHeight,H.current=Math.max(v,j)}else z.style.bottom=`0`,H.current=Math.max(v,j),u.scrollTop=te;if(D){let t=s.top,n=s.height,r=D.top+D.height/2,i=ot(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(H.current===b||j>=y)&&(U.current=!0),_(),setTimeout(()=>{W.current=!0})}finally{t()}})}},[a,P,z,R,f,p,l,_,C,ee,K,T,D,B]),Y.useEffect(()=>{if(!C||!z||!P)return;let e=o(z);function t(e){d(!1,ce(oe,e))}return e.addEventListener(`resize`,t),()=>{e.removeEventListener(`resize`,t)}},[d,C,z,P]);let de={...B?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":h||void 0,id:`${N}-list`},onKeyDown(e){m.current=!0,k&&ae.has(e.key)&&e.stopPropagation()},onMouseMove(){m.current=!1},onPointerLeave(e){if(!y||rt(e)||e.pointerType===`touch`)return;let t=e.currentTarget;te.start(0,()=>{a.set(`activeIndex`,null),t.focus({preventScroll:!0})})},onScroll(e){B||v.current?.(e.currentTarget)},...C&&{style:B?{height:`100%`}:et}},fe=c(`div`,e,{ref:[t,l],state:q,stateAttributesMapping:dt,props:[I,de,ne(re),{className:!B&&C?at.className:void 0},i]});return(0,Z.jsxs)(Y.Fragment,{children:[!M&&at.getElement(j),(0,Z.jsx)(ue,{context:A,modal:!1,disabled:!F,restoreFocus:!0,children:fe})]})});function pt(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}var mt={transform:`none`,scale:`1`,translate:`0 0`};function ht(e,t,n){n?e.setProperty(t,n):e.removeProperty(t)}function gt(e){let{style:t}=e,n={},r=Object.keys(mt);for(let e of r)n[e]=t.getPropertyValue(e),t.setProperty(e,mt[e]);return()=>{for(let e of r)ht(t,e,n[e])}}var _t=Y.forwardRef(function(e,t){let{className:n,render:r,...i}=e,{store:a,scrollHandlerRef:o}=X(),{alignItemWithTriggerActive:l}=Qe(),u=L(a,Q.hasScrollArrows),d=L(a,Q.openMethod),f=L(a,Q.multiple),p={id:`${L(a,Q.id)}-list`,role:`listbox`,"aria-multiselectable":f||void 0,onScroll(e){o.current?.(e.currentTarget)},...l&&{style:et},className:u&&d!==`touch`?at.className:void 0};return c(`div`,e,{ref:[t,s(e=>{a.set(`listElement`,e)})],props:[p,i]})}),vt=Y.createContext(void 0);function yt(){let e=Y.useContext(vt);if(!e)throw Error(_(57));return e}var bt=Y.memo(Y.forwardRef(function(e,t){let{render:n,className:r,value:i=null,label:a,disabled:o=!1,nativeButton:s=!1,...l}=e,u=Y.useRef(null),d=B({label:a,textRef:u,indexGuessBehavior:H.GuessFromOrder}),{store:f,getItemProps:m,setOpen:h,setValue:_,selectionRef:v,typingRef:y,valuesRef:b,keyboardActiveRef:x,multiple:S,highlightItemOnHover:C}=X(),ee=w(),T=L(f,Q.isActive,d.index),E=L(f,Q.isSelected,d.index,i),D=L(f,Q.isSelectedByFocus,d.index),O=L(f,Q.isItemEqualToValue),k=d.index,A=k!==-1,j=Y.useRef(null),M=R(k);g(()=>{if(!A)return;let e=b.current;return e[k]=i,()=>{delete e[k]}},[A,k,i,b]),g(()=>{if(!A)return;let e=f.state.value,t=e;S&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&Ae(t,i,O)&&f.set(`selectedIndex`,k)},[A,k,S,O,f,i]);let te=Y.useMemo(()=>({disabled:o,selected:E,highlighted:T}),[o,E,T]),N=m({active:T,selected:E});N.onFocus=void 0,N.id=void 0;let P=Y.useRef(null),F=Y.useRef(`mouse`),I=Y.useRef(!1),{getButtonProps:ne,buttonRef:re}=p({disabled:o,focusableWhenDisabled:!0,native:s});function z(e){let t=f.state.value;if(S){let n=Array.isArray(t)?t:[];_(E?Ne(n,i,O):[...n,i],ce(W,e))}else _(i,ce(W,e)),h(!1,ce(W,e))}let ie={role:`option`,"aria-selected":E,tabIndex:T?0:-1,onFocus(){f.set(`activeIndex`,k)},onMouseEnter(){!x.current&&f.state.selectedIndex===null&&f.set(`activeIndex`,k)},onMouseMove(){C&&f.set(`activeIndex`,k)},onMouseLeave(e){!C||x.current||rt(e)||ee.start(0,()=>{f.state.activeIndex===k&&f.set(`activeIndex`,null)})},onTouchStart(){v.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(e){P.current=e.key,f.set(`activeIndex`,k)},onClick(e){I.current=!1,!(e.type===`keydown`&&P.current===null)&&(o||P.current===` `&&y.current||F.current!==`touch`&&!T||(P.current=null,z(e.nativeEvent)))},onPointerEnter(e){F.current=e.pointerType},onPointerDown(e){F.current=e.pointerType,I.current=!0},onMouseUp(e){if(o)return;if(I.current){I.current=!1;return}let t=!v.current.allowSelectedMouseUp&&E,n=!v.current.allowUnselectedMouseUp&&!E;t||n||F.current!==`touch`&&!T||z(e.nativeEvent)}},ae=c(`div`,e,{ref:[re,t,d.ref,j],state:te,props:[N,ie,l,ne]}),V=Y.useMemo(()=>({selected:E,indexRef:M,textRef:u,selectedByFocus:D,hasRegistered:A}),[E,M,u,D,A]);return(0,Z.jsx)(vt.Provider,{value:V,children:ae})})),xt=Y.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=yt();return n||r?(0,Z.jsx)(St,{...e,ref:t}):null}),St=Y.memo(Y.forwardRef((e,t)=>{let{render:n,className:r,keepMounted:i,...a}=e,{selected:o}=yt(),s=Y.useRef(null),{transitionStatus:l,setMounted:u}=z(o),d=Y.useMemo(()=>({selected:o,transitionStatus:l}),[o,l]),f=c(`span`,e,{ref:[t,s],state:d,props:[{"aria-hidden":!0,children:`✔️`},a],stateAttributesMapping:A});return ie({open:o,ref:s,onComplete(){o||u(!1)}}),f})),Ct=Y.memo(Y.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=yt(),{selectedItemTextRef:o}=X(),{className:s,render:l,...u}=e;return c(`div`,e,{ref:[Y.useCallback(e=>{if(!e||!a)return;let t=o.current===null||!o.current.isConnected;(i||t&&n.current===0)&&(o.current=e)},[o,n,i,a]),t,r],props:u})})),wt=Y.forwardRef(function(e,t){let{render:n,className:r,direction:i,keepMounted:a=!1,...o}=e,{store:s,popupRef:l,listRef:u,handleScrollArrowVisibility:d,scrollArrowsMountedCountRef:f}=X(),{side:p,scrollDownArrowRef:m,scrollUpArrowRef:h}=Qe(),_=L(s,i===`up`?Q.scrollUpArrowVisible:Q.scrollDownArrowVisible),v=L(s,Q.openMethod),y=_&&v!==`touch`,b=w(),x=i===`up`?h:m,{transitionStatus:S,setMounted:C}=z(y);g(()=>(f.current+=1,s.state.hasScrollArrows||s.set(`hasScrollArrows`,!0),()=>{f.current=Math.max(0,f.current-1),f.current===0&&s.state.hasScrollArrows&&s.set(`hasScrollArrows`,!1)}),[s,f]),ie({open:y,ref:x,onComplete(){y||C(!1)}});let ee=Y.useMemo(()=>({direction:i,visible:y,side:p,transitionStatus:S}),[i,y,p,S]),T=c(`div`,e,{ref:[t,x],state:ee,props:[{"aria-hidden":!0,children:i===`up`?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;s.set(`activeIndex`,null);function t(){let e=s.state.listElement??l.current;if(!e)return;s.set(`activeIndex`,null),d();let n=e.scrollTop===0,r=Math.round(e.scrollTop+e.clientHeight)>=e.scrollHeight;if(u.current.length===0&&(i===`up`?s.set(`scrollUpArrowVisible`,!n):s.set(`scrollDownArrowVisible`,!r)),i===`up`&&n||i===`down`&&r){b.clear();return}if((s.state.listElement||l.current)&&u.current&&u.current.length>0){let t=u.current,n=x.current?.offsetHeight||0;if(i===`up`){let r=0,i=e.scrollTop+n;for(let e=0;e<t.length;e+=1){let n=t[e];if(n&&n.offsetTop>=i){r=e;break}}let a=Math.max(0,r-1);if(a<r){let r=t[a];r&&(e.scrollTop=Math.max(0,r.offsetTop-n))}else e.scrollTop=0}else{let r=t.length-1,i=e.scrollTop+e.clientHeight-n;for(let e=0;e<t.length;e+=1){let n=t[e];if(n&&n.offsetTop+n.offsetHeight>i){r=Math.max(0,e-1);break}}let a=Math.min(t.length-1,r+1);if(a>r){let r=t[a];r&&(e.scrollTop=r.offsetTop+r.offsetHeight-e.clientHeight+n)}else e.scrollTop=e.scrollHeight-e.clientHeight}}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},o]});return y||a?T:null}),Tt=Y.forwardRef(function(e,t){return(0,Z.jsx)(wt,{...e,ref:t,direction:`down`})}),Et=Y.forwardRef(function(e,t){return(0,Z.jsx)(wt,{...e,ref:t,direction:`up`})}),Dt=i(),Ot=Ve;function kt(e){let t=(0,Dt.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=v(`flex flex-1 text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(qe,{"data-slot":`select-value`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function At(e){let t=(0,Dt.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,size:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===r?s=t[6]:(s=v(`border-input data-[placeholder]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-lg border bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors select-none focus-visible:ring-[3px] aria-invalid:ring-[3px] data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-4 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Je,{render:(0,Z.jsx)(we,{className:`text-muted-foreground size-4 pointer-events-none`})}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==o||t[11]!==s?(l=(0,Z.jsxs)(Ge,{"data-slot":`select-trigger`,"data-size":o,className:s,...i,children:[n,c]}),t[8]=n,t[9]=i,t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function jt(e){let t=(0,Dt.c)(26),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({className:r,children:n,side:a,sideOffset:o,align:s,alignOffset:c,alignItemWithTrigger:l,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=a===void 0?`bottom`:a,d=o===void 0?4:o,f=s===void 0?`center`:s,p=c===void 0?0:c,m=l===void 0?!0:l,h;t[9]===r?h=t[10]:(h=v(`bg-popover text-popover-foreground 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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-36 rounded-lg shadow-md ring-1 duration-100 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto`,r),t[9]=r,t[10]=h);let g;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Nt,{}),t[11]=g):g=t[11];let _;t[12]===n?_=t[13]:(_=(0,Z.jsx)(_t,{children:n}),t[12]=n,t[13]=_);let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(Pt,{}),t[14]=y):y=t[14];let b;t[15]!==i||t[16]!==h||t[17]!==_?(b=(0,Z.jsxs)(ft,{"data-slot":`select-content`,className:h,...i,children:[g,_,y]}),t[15]=i,t[16]=h,t[17]=_,t[18]=b):b=t[18];let x;return t[19]!==f||t[20]!==m||t[21]!==p||t[22]!==u||t[23]!==d||t[24]!==b?(x=(0,Z.jsx)(Xe,{children:(0,Z.jsx)(nt,{side:u,sideOffset:d,align:f,alignOffset:p,alignItemWithTrigger:m,className:`isolate z-50`,children:b})}),t[19]=f,t[20]=m,t[21]=p,t[22]=u,t[23]=d,t[24]=b,t[25]=x):x=t[25],x}function Mt(e){let t=(0,Dt.c)(13),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=v(`focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=(0,Z.jsx)(Ct,{className:`flex flex-1 gap-2 shrink-0 whitespace-nowrap`,children:n}),t[6]=n,t[7]=o);let s;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(xt,{render:(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,Z.jsx)(y,{className:`pointer-events-none`})}),t[8]=s):s=t[8];let c;return t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Z.jsxs)(bt,{"data-slot":`select-item`,className:a,...i,children:[o,s]}),t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function Nt(e){let t=(0,Dt.c)(9),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=v(`bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4 top-0 w-full`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Ce,{}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,Z.jsx)(Et,{"data-slot":`select-scroll-up-button`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function Pt(e){let t=(0,Dt.c)(9),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=v(`bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4 bottom-0 w-full`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(b,{}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,Z.jsx)(Tt,{"data-slot":`select-scroll-down-button`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}export{kt as a,at as c,At as i,jt as n,lt as o,Mt as r,ot as s,Ot as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./compiler-runtime-DCc3R3Xn.js";import{t as n}from"./utils-C8DGLIgm.js";import{t as r}from"./Separator-vw4jPN_6.js";var i=t(),a=e();function o(e){let t=(0,i.c)(10),o,s,c;t[0]===e?(o=t[1],s=t[2],c=t[3]):({className:o,orientation:c,...s}=e,t[0]=e,t[1]=o,t[2]=s,t[3]=c);let l=c===void 0?`horizontal`:c,u;t[4]===o?u=t[5]:(u=n(`bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch`,o),t[4]=o,t[5]=u);let d;return t[6]!==l||t[7]!==s||t[8]!==u?(d=(0,a.jsx)(r,{"data-slot":`separator`,orientation:l,className:u,...s}),t[6]=l,t[7]=s,t[8]=u,t[9]=d):d=t[9],d}export{o as t};
1
+ import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./compiler-runtime-DCc3R3Xn.js";import{t as n}from"./utils-C8DGLIgm.js";import{t as r}from"./Separator-CHfSrIVw.js";var i=t(),a=e();function o(e){let t=(0,i.c)(10),o,s,c;t[0]===e?(o=t[1],s=t[2],c=t[3]):({className:o,orientation:c,...s}=e,t[0]=e,t[1]=o,t[2]=s,t[3]=c);let l=c===void 0?`horizontal`:c,u;t[4]===o?u=t[5]:(u=n(`bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch`,o),t[4]=o,t[5]=u);let d;return t[6]!==l||t[7]!==s||t[8]!==u?(d=(0,a.jsx)(r,{"data-slot":`separator`,orientation:l,className:u,...s}),t[6]=l,t[7]=s,t[8]=u,t[9]=d):d=t[9],d}export{o 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"./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-SKykt1po.js";import{i as u,n as d}from"./auth-client-DF1BsKzX.js";import{t as f}from"./useQuery-B9mB-acs.js";import{f as p,s as m,u as h}from"./schemas-n4sxh6jF.js";import{G as g,J as _,X as v,Z as y}from"./index-ClzxEm7R.js";import{t as b}from"./input-CG_cIxvO.js";import{t as x}from"./label-DDLGZnWP.js";import{a as S,n as C,o as w,r as T,t as E}from"./card-BWqhQk-T.js";import{n as D,t as O}from"./zod-Ch0Zejov.js";import{t as k}from"./auth-bootstrap-query-B7dkGOfQ.js";var A=e(t(),1),j=n(),M=h({email:m(`Please enter a valid email`),password:p().min(8,`Password must be at least 8 characters`)}),N=h({email:m(`Please enter a valid email`),name:p().min(2,`Name must be at least 2 characters`),password:p().min(8,`Password must be at least 8 characters`)}),P=N.extend({organizationName:p().min(2,`Organization name must be at least 2 characters`),organizationSlug:p().min(2,`Organization slug must be at least 2 characters`).regex(/^[a-z0-9-]+$/,`Organization slug can only contain lowercase letters, numbers, and hyphens`)}),F=a(`/signin`);function I(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,`-`).replaceAll(/^-|-$/g,``)}function L(e,t){if(!(e instanceof Error))return t;let n=e.message.trim();return n.length>0?n:t}async function R(e){let t=await e.json().catch(()=>null),n=h({error:p().optional(),message:p().optional()}).safeParse(t);return n.data?.error??n.data?.message??`Failed to complete bootstrap`}function z(){let e=o(),t=g(),n=i(),[a,m]=(0,A.useState)(`signin`),[z,B]=(0,A.useState)(!1),{redirect:V}=F.useSearch(),H=y(V),U=f(k()).data,W=U?.signupMode===`first-user`,G=W?`signup`:a,K=D({defaultValues:{email:``,password:``},resolver:O(M)}),q=D({defaultValues:{name:``,email:``,password:``},resolver:O(N)}),J=D({defaultValues:{email:``,name:``,organizationName:``,organizationSlug:``,password:``},resolver:O(P)}),Y=typeof window>`u`?`your-host`:window.location.host;async function X(t){B(!0);try{let r=await d.email({email:t.email,password:t.password});if(r.error){console.error(`[auth] sign-in failed`,{error:r.error}),K.setError(`root`,{message:r.error.message??`Invalid email or password`}),B(!1);return}await n.invalidate(),await e({to:H.path})}catch(e){console.error(`[auth] sign-in failed`,{error:e}),K.setError(`root`,{message:L(e,`Couldn't sign in right now. Try again.`)}),B(!1)}}async function Z(t){B(!0);try{let n=await u.email({email:t.email,name:t.name,password:t.password});if(n.error){console.error(`[auth] sign-up failed`,{error:n.error}),q.setError(`root`,{message:n.error.message??`Failed to create account`}),B(!1);return}await e({to:_(V)})}catch(e){console.error(`[auth] sign-up failed`,{error:e}),q.setError(`root`,{message:L(e,`Couldn't create your account right now. Try again.`)}),B(!1)}}async function Q(r){B(!0);try{let i=await fetch(`${s()}/api/bootstrap/complete`,{body:JSON.stringify(r),credentials:`include`,headers:{"content-type":`application/json`},method:`POST`});if(!i.ok){J.setError(`root`,{message:await R(i)}),B(!1);return}let a=h({bootstrap:h({organizationId:p().min(1)})}).safeParse(await i.json().catch(()=>null));if(!a.success){J.setError(`root`,{message:`Bootstrap completed, but the response was invalid`}),B(!1);return}let o=v({organizationId:a.data.bootstrap.organizationId,redirectPath:V});await t.invalidateQueries({queryKey:k().queryKey}),await n.invalidate({sync:!0}),await e({to:_(o)})}catch(e){console.error(`[auth] bootstrap failed`,{error:e}),J.setError(`root`,{message:L(e,`Couldn't finish setup right now. Try again.`)}),B(!1)}}function $(){W||(m(a===`signin`?`signup`:`signin`),K.reset(),q.reset())}let ee=J.watch(`organizationName`);return(0,j.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,j.jsxs)(`header`,{className:`flex h-14 items-center justify-between px-4 sm:px-6`,children:[(0,j.jsxs)(r,{to:`/`,className:`flex items-center gap-2`,children:[(0,j.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-md bg-foreground text-background font-bold`,children:`V`}),(0,j.jsx)(`span`,{className:`font-semibold text-base sm:text-lg`,children:`OneQuery`})]}),(0,j.jsx)(l,{})]}),(0,j.jsx)(`main`,{className:`flex flex-1 items-start justify-center px-4 pb-10 pt-12 sm:items-center sm:px-6 sm:py-6`,children:(0,j.jsxs)(E,{className:`w-full max-w-sm`,children:[(0,j.jsxs)(S,{className:`text-center`,children:[(0,j.jsx)(w,{className:`text-xl`,children:G===`signin`?`Sign in to OneQuery`:W?`Create the initial owner account`:`Create an account`}),(0,j.jsx)(T,{children:G===`signin`?`Enter your email and password to continue`:W?`Finish the first-run bootstrap by creating the owner account for this self-hosted server.`:U?.signupMode===`invite-only`?`Use the email address that received an invitation from your OneQuery admin.`:`Enter your details to get started`})]}),(0,j.jsx)(C,{children:G===`signin`?(0,j.jsxs)(`form`,{onSubmit:K.handleSubmit(X),className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`email`,children:`Email`}),(0,j.jsx)(b,{id:`email`,type:`email`,placeholder:`user@example.com`,autoComplete:`email`,...K.register(`email`)}),K.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`password`,children:`Password`}),(0,j.jsx)(b,{id:`password`,type:`password`,placeholder:`Enter your password`,autoComplete:`current-password`,...K.register(`password`)}),K.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.password.message})]}),K.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.root.message}),(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z,children:z?`Signing in...`:`Sign in`}),(0,j.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[U?.signupMode===`invite-only`?`Need an account? Ask an admin for an invitation, then use the invited email to sign up.`:`Don't have an account? `,U?.signupMode===`invite-only`?(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`I have an invitation`}):(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`Sign up`})]})]}):W?(0,j.jsxs)(`form`,{onSubmit:J.handleSubmit(Q),className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-name`,children:`Your name`}),(0,j.jsx)(b,{id:`bootstrap-name`,type:`text`,placeholder:`Jane Doe`,autoComplete:`name`,...J.register(`name`)}),J.formState.errors.name&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.name.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-email`,children:`Email`}),(0,j.jsx)(b,{id:`bootstrap-email`,type:`email`,placeholder:`owner@example.com`,autoComplete:`email`,...J.register(`email`)}),J.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-organization-name`,children:`Organization name`}),(0,j.jsx)(b,{id:`bootstrap-organization-name`,type:`text`,placeholder:`Acme Inc.`,...J.register(`organizationName`,{onChange:e=>{J.setValue(`organizationSlug`,I(e.target.value))}})}),J.formState.errors.organizationName&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.organizationName.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-organization-slug`,children:`URL slug`}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[Y,`/`]}),(0,j.jsx)(b,{id:`bootstrap-organization-slug`,placeholder:`acme`,...J.register(`organizationSlug`),className:`flex-1`})]}),J.formState.errors.organizationSlug&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.organizationSlug.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-password`,children:`Password`}),(0,j.jsx)(b,{id:`bootstrap-password`,type:`password`,placeholder:`Create a password`,autoComplete:`new-password`,...J.register(`password`)}),J.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.password.message})]}),J.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.root.message}),(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This setup screen is only available until the first owner account is created.`}),(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z||ee.trim().length===0,children:z?`Creating owner...`:`Create owner account`})]}):(0,j.jsxs)(`form`,{onSubmit:q.handleSubmit(Z),className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`name`,children:`Name`}),(0,j.jsx)(b,{id:`name`,type:`text`,placeholder:`John Doe`,autoComplete:`name`,...q.register(`name`)}),q.formState.errors.name&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.name.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`signup-email`,children:`Email`}),(0,j.jsx)(b,{id:`signup-email`,type:`email`,placeholder:`user@example.com`,autoComplete:`email`,...q.register(`email`)}),q.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`signup-password`,children:`Password`}),(0,j.jsx)(b,{id:`signup-password`,type:`password`,placeholder:`Create a password`,autoComplete:`new-password`,...q.register(`password`)}),q.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.password.message})]}),q.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.root.message}),U?.signupMode===`invite-only`?(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Account creation is limited to email addresses with a pending organization invitation.`}):null,(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z,children:z?`Creating account...`:W?`Create owner account`:`Create account`}),W?null:(0,j.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[`Already have an account?`,` `,(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`Sign in`})]})]})})]})})]})}var B=z;export{B as component};
1
+ 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-7vhlmsbU.js";import{i as u,n as d}from"./auth-client-DF1BsKzX.js";import{t as f}from"./useQuery-Cbo-5C23.js";import{f as p,s as m,u as h}from"./schemas-n4sxh6jF.js";import{R as g,U as _,V as v,W as y}from"./index-B4tzcC1c.js";import{t as b}from"./input-CG_cIxvO.js";import{t as x}from"./label-DDLGZnWP.js";import{a as S,n as C,o as w,r as T,t as E}from"./card-BWqhQk-T.js";import{n as D,t as O}from"./zod-Ch0Zejov.js";import{t as k}from"./auth-bootstrap-query-B7dkGOfQ.js";var A=e(t(),1),j=n(),M=h({email:m(`Please enter a valid email`),password:p().min(8,`Password must be at least 8 characters`)}),N=h({email:m(`Please enter a valid email`),name:p().min(2,`Name must be at least 2 characters`),password:p().min(8,`Password must be at least 8 characters`)}),P=N.extend({organizationName:p().min(2,`Organization name must be at least 2 characters`),organizationSlug:p().min(2,`Organization slug must be at least 2 characters`).regex(/^[a-z0-9-]+$/,`Organization slug can only contain lowercase letters, numbers, and hyphens`)}),F=a(`/signin`);function I(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,`-`).replaceAll(/^-|-$/g,``)}function L(e,t){if(!(e instanceof Error))return t;let n=e.message.trim();return n.length>0?n:t}async function R(e){let t=await e.json().catch(()=>null),n=h({error:p().optional(),message:p().optional()}).safeParse(t);return n.data?.error??n.data?.message??`Failed to complete bootstrap`}function z(){let e=o(),t=g(),n=i(),[a,m]=(0,A.useState)(`signin`),[z,B]=(0,A.useState)(!1),{redirect:V}=F.useSearch(),H=y(V),U=f(k()).data,W=U?.signupMode===`first-user`,G=W?`signup`:a,K=D({defaultValues:{email:``,password:``},resolver:O(M)}),q=D({defaultValues:{name:``,email:``,password:``},resolver:O(N)}),J=D({defaultValues:{email:``,name:``,organizationName:``,organizationSlug:``,password:``},resolver:O(P)}),Y=typeof window>`u`?`your-host`:window.location.host;async function X(t){B(!0);try{let r=await d.email({email:t.email,password:t.password});if(r.error){console.error(`[auth] sign-in failed`,{error:r.error}),K.setError(`root`,{message:r.error.message??`Invalid email or password`}),B(!1);return}await n.invalidate(),await e({to:H.path})}catch(e){console.error(`[auth] sign-in failed`,{error:e}),K.setError(`root`,{message:L(e,`Couldn't sign in right now. Try again.`)}),B(!1)}}async function Z(t){B(!0);try{let n=await u.email({email:t.email,name:t.name,password:t.password});if(n.error){console.error(`[auth] sign-up failed`,{error:n.error}),q.setError(`root`,{message:n.error.message??`Failed to create account`}),B(!1);return}await e({to:v(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=h({bootstrap:h({organizationId:p().min(1)})}).safeParse(await i.json().catch(()=>null));if(!a.success){J.setError(`root`,{message:`Bootstrap completed, but the response was invalid`}),B(!1);return}let o=_({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||(m(a===`signin`?`signup`:`signin`),K.reset(),q.reset())}let ee=J.watch(`organizationName`);return(0,j.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,j.jsxs)(`header`,{className:`flex h-14 items-center justify-between px-4 sm:px-6`,children:[(0,j.jsxs)(r,{to:`/`,className:`flex items-center gap-2`,children:[(0,j.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-md bg-foreground text-background font-bold`,children:`V`}),(0,j.jsx)(`span`,{className:`font-semibold text-base sm:text-lg`,children:`OneQuery`})]}),(0,j.jsx)(l,{})]}),(0,j.jsx)(`main`,{className:`flex flex-1 items-start justify-center px-4 pb-10 pt-12 sm:items-center sm:px-6 sm:py-6`,children:(0,j.jsxs)(E,{className:`w-full max-w-sm`,children:[(0,j.jsxs)(S,{className:`text-center`,children:[(0,j.jsx)(w,{className:`text-xl`,children:G===`signin`?`Sign in to OneQuery`:W?`Create the initial owner account`:`Create an account`}),(0,j.jsx)(T,{children:G===`signin`?`Enter your email and password to continue`:W?`Finish the first-run bootstrap by creating the owner account for this self-hosted server.`:U?.signupMode===`invite-only`?`Use the email address that received an invitation from your OneQuery admin.`:`Enter your details to get started`})]}),(0,j.jsx)(C,{children:G===`signin`?(0,j.jsxs)(`form`,{onSubmit:K.handleSubmit(X),className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`email`,children:`Email`}),(0,j.jsx)(b,{id:`email`,type:`email`,placeholder:`user@example.com`,autoComplete:`email`,...K.register(`email`)}),K.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`password`,children:`Password`}),(0,j.jsx)(b,{id:`password`,type:`password`,placeholder:`Enter your password`,autoComplete:`current-password`,...K.register(`password`)}),K.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.password.message})]}),K.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.root.message}),(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z,children:z?`Signing in...`:`Sign in`}),(0,j.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[U?.signupMode===`invite-only`?`Need an account? Ask an admin for an invitation, then use the invited email to sign up.`:`Don't have an account? `,U?.signupMode===`invite-only`?(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`I have an invitation`}):(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`Sign up`})]})]}):W?(0,j.jsxs)(`form`,{onSubmit:J.handleSubmit(Q),className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-name`,children:`Your name`}),(0,j.jsx)(b,{id:`bootstrap-name`,type:`text`,placeholder:`Jane Doe`,autoComplete:`name`,...J.register(`name`)}),J.formState.errors.name&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.name.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-email`,children:`Email`}),(0,j.jsx)(b,{id:`bootstrap-email`,type:`email`,placeholder:`owner@example.com`,autoComplete:`email`,...J.register(`email`)}),J.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-organization-name`,children:`Organization name`}),(0,j.jsx)(b,{id:`bootstrap-organization-name`,type:`text`,placeholder:`Acme Inc.`,...J.register(`organizationName`,{onChange:e=>{J.setValue(`organizationSlug`,I(e.target.value))}})}),J.formState.errors.organizationName&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.organizationName.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-organization-slug`,children:`URL slug`}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[Y,`/`]}),(0,j.jsx)(b,{id:`bootstrap-organization-slug`,placeholder:`acme`,...J.register(`organizationSlug`),className:`flex-1`})]}),J.formState.errors.organizationSlug&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.organizationSlug.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-password`,children:`Password`}),(0,j.jsx)(b,{id:`bootstrap-password`,type:`password`,placeholder:`Create a password`,autoComplete:`new-password`,...J.register(`password`)}),J.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.password.message})]}),J.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.root.message}),(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This setup screen is only available until the first owner account is created.`}),(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z||ee.trim().length===0,children:z?`Creating owner...`:`Create owner account`})]}):(0,j.jsxs)(`form`,{onSubmit:q.handleSubmit(Z),className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`name`,children:`Name`}),(0,j.jsx)(b,{id:`name`,type:`text`,placeholder:`John Doe`,autoComplete:`name`,...q.register(`name`)}),q.formState.errors.name&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.name.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`signup-email`,children:`Email`}),(0,j.jsx)(b,{id:`signup-email`,type:`email`,placeholder:`user@example.com`,autoComplete:`email`,...q.register(`email`)}),q.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`signup-password`,children:`Password`}),(0,j.jsx)(b,{id:`signup-password`,type:`password`,placeholder:`Create a password`,autoComplete:`new-password`,...q.register(`password`)}),q.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.password.message})]}),q.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.root.message}),U?.signupMode===`invite-only`?(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Account creation is limited to email addresses with a pending organization invitation.`}):null,(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z,children:z?`Creating account...`:W?`Create owner account`:`Create account`}),W?null:(0,j.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[`Already have an account?`,` `,(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`Sign in`})]})]})})]})})]})}var B=z;export{B as component};
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,n as a,t as o}from"./api-base-url-DIb6qukm.js";import{n as s,t as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./IconCheck-Gc24xPT2.js";import{d as u,n as d,r as f,t as p}from"./dropdown-menu-CrGReNWD.js";import{n as m,r as h,t as g}from"./checkbox-DYtEYWlC.js";import{t as _}from"./IconLoader2-B3B6M8nQ.js";import{t as v}from"./IconX-BQkA009b.js";import{l as y}from"./app-routes-CnJncMlZ.js";import{a as b,c as x,i as S,l as C,n as w,o as T,r as E,s as D,t as O,u as k}from"./use-optimistic-mutation-Dd5ntQWa.js";import{t as A}from"./useQuery-B9mB-acs.js";import{t as j}from"./useSuspenseQuery-Bq3OtiRW.js";import{f as M,h as N,s as P,u as F}from"./schemas-n4sxh6jF.js";import{n as I}from"./src-DCIPwIx0.js";import{a as L,r as R}from"./organization-permissions-BQQ5PJbI.js";import{G as z,U as B,b as V,x as H,y as ee}from"./index-ClzxEm7R.js";import{t as te}from"./input-CG_cIxvO.js";import{n as U,r as ne,t as re}from"./avatar-B8g7WJsq.js";import{t as ie}from"./format-date-Ctrh7my1.js";import{t as ae}from"./badge-CwG2ykXV.js";import{t as oe}from"./label-DDLGZnWP.js";import{a as se,i as W,n as ce,o as G,r as K,t as le}from"./table-Bzsu823v.js";import{a as ue,n as de,o as fe}from"./xstate-react.esm-U3P0kbzA.js";import{r as q}from"./api-paths-DM-NAvAZ.js";import{n as pe,t as me}from"./zod-Ch0Zejov.js";var he=c(`outline`,`copy`,`Copy`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}]]),ge=c(`outline`,`user-edit`,`UserEdit`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h3.5`,key:`svg-1`}],[`path`,{d:`M18.42 15.61a2.1 2.1 0 0 1 2.97 2.97l-3.39 3.42h-3v-3l3.42 -3.39`,key:`svg-2`}]]),_e=c(`outline`,`user-plus`,`UserPlus`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M16 19h6`,key:`svg-1`}],[`path`,{d:`M19 16v6`,key:`svg-2`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h4`,key:`svg-3`}]]),J=r(),Y=n();function ve(e){switch(e){case`owner`:return`default`;case`admin`:return`secondary`;case`member`:return`outline`}}function ye(e){switch(e){case`owner`:return`Owner`;case`admin`:return`Admin`;case`member`:return`Member`}}function be(e){let t=(0,J.c)(7),{role:n}=e,r;t[0]===n?r=t[1]:(r=ve(n),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=ye(n),t[2]=n,t[3]=i);let a;return t[4]!==r||t[5]!==i?(a=(0,Y.jsx)(ae,{variant:r,children:i}),t[4]=r,t[5]=i,t[6]=a):a=t[6],a}function xe(e){let t=(0,J.c)(9),{roleNames:n,rawRole:r,emptyLabel:i}=e;if(n.length===0){let e;t[0]!==i||t[1]!==r?(e=r?.trim()||i,t[0]=i,t[1]=r,t[2]=e):e=t[2];let n=e,a;return t[3]===n?a=t[4]:(a=n?(0,Y.jsx)(ae,{variant:`outline`,children:n}):null,t[3]=n,t[4]=a),a}let a;t[5]===n?a=t[6]:(a=n.map(Se),t[5]=n,t[6]=a);let o;return t[7]===a?o=t[8]:(o=(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:a}),t[7]=a,t[8]=o),o}function Se(e){return(0,Y.jsx)(be,{role:e},e)}var Ce=F({expiresAt:N().optional(),id:M(),role:M().optional()}),we=F({id:M(),role:M()}),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:M().optional(),error:M().optional(),message:M().optional()}).safeParse(n);if(r.success)return r.data.error??r.data.message??t}return await e.text().catch(()=>``)||t}async function X(e){let t=await fetch(`${o()}${e.path}`,{body:e.body?JSON.stringify(e.body):void 0,credentials:`include`,headers:{"Content-Type":`application/json`},method:e.method});if(!t.ok)throw Error(await Ee(t,e.errorMessage));let n=await t.json().catch(()=>null),r=e.successSchema.safeParse(n);if(!r.success)throw Error(e.errorMessage);return r.data}async function De(e){return X({body:{email:e.email,role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to create invitation link`,method:`POST`,path:q(e.organizationId,`invitations`),successSchema:Ce})}async function Oe(e){return X({errorMessage:`Failed to cancel invitation`,method:`DELETE`,path:q(e.organizationId,`invitations`,e.invitationId),successSchema:Ce})}async function ke(e){return X({body:{role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to update role`,method:`PATCH`,path:q(e.organizationId,`members`,e.memberId,`role`),successSchema:we})}async function Ae(e){return X({errorMessage:`Failed to remove member`,method:`DELETE`,path:q(e.organizationId,`members`,e.memberId),successSchema:Te})}function je(e){let t=Date.parse(e)-Date.now();if(t<0)return`Expired`;let n=Math.floor(t/(1e3*60*60*24)),r=Math.floor(t%(1e3*60*60*24)/(1e3*60*60));return n>0?`Expires in ${n}d`:r>0?`Expires in ${r}h`:`Expires soon`}function Me(e){let t=(0,J.c)(31),{invitation:n,currentUserId:r,organizationId:i,canManageInvitationMutations:a}=e,o=n.id,c;t[0]!==n.id||t[1]!==i?(c=async()=>{await Oe({invitationId:n.id,organizationId:i})},t[0]=n.id,t[1]=i,t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==n.organizationId?(l=ee(r,n.organizationId),t[3]=r,t[4]=n.organizationId,t[5]=l):l=t[5];let u;t[6]!==n.id||t[7]!==c||t[8]!==l.queryKey?(u={errorMessage:`Failed to cancel invitation`,itemId:o,mutationFn:c,queryKey:l.queryKey,successMessage:`Invitation cancelled`},t[6]=n.id,t[7]=c,t[8]=l.queryKey,t[9]=u):u=t[9];let d=w(u),f=n.expiresAt?Date.parse(n.expiresAt)<Date.now():!1,p;t[10]===n.email?p=t[11]:(p=(0,Y.jsx)(K,{children:(0,Y.jsx)(`span`,{className:`font-medium`,children:n.email})}),t[10]=n.email,t[11]=p);let m;t[12]!==n.rawRole||t[13]!==n.roleNames?(m=(0,Y.jsx)(K,{children:(0,Y.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole,emptyLabel:`Member`})}),t[12]=n.rawRole,t[13]=n.roleNames,t[14]=m):m=t[14];let h=f?`text-destructive`:`text-muted-foreground`,g;t[15]===n.expiresAt?g=t[16]:(g=n.expiresAt?je(n.expiresAt):`Pending`,t[15]=n.expiresAt,t[16]=g);let y;t[17]!==h||t[18]!==g?(y=(0,Y.jsx)(K,{children:(0,Y.jsx)(`span`,{className:h,children:g})}),t[17]=h,t[18]=g,t[19]=y):y=t[19];let b;t[20]!==a||t[21]!==d||t[22]!==f?(b=a&&!f&&(0,Y.jsx)(s,{variant:`ghost`,size:`icon-sm`,onClick:()=>d.mutate(),disabled:d.isPending,title:`Cancel invitation`,children:d.isPending?(0,Y.jsx)(_,{size:16,className:`animate-spin`}):(0,Y.jsx)(v,{size:16,stroke:2})}),t[20]=a,t[21]=d,t[22]=f,t[23]=b):b=t[23];let x;t[24]===b?x=t[25]:(x=(0,Y.jsx)(K,{className:`text-right`,children:b}),t[24]=b,t[25]=x);let S;return t[26]!==x||t[27]!==p||t[28]!==m||t[29]!==y?(S=(0,Y.jsxs)(G,{children:[p,m,y,x]}),t[26]=x,t[27]=p,t[28]=m,t[29]=y,t[30]=S):S=t[30],S}function Ne(e){let t=(0,J.c)(31),{currentUserId:n,organizationId:r,canManageInvitationMutations:i}=e,a;t[0]!==n||t[1]!==r?(a=ee(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=A(a);if(o.isPending){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`Loading invitations...`}),t[3]=e):e=t[3],e}if(o.isLoadingError){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-destructive`,children:`Failed to load invitations.`}),t[4]=e):e=t[4],e}let s=o.data,c,l,u,d,f,p;if(t[5]!==i||t[6]!==n||t[7]!==s||t[8]!==r){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=s.filter(Pe);if(e.length===0){let e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No pending invitations.`}),t[15]=e):e=t[15],p=e;break bb0}f=`rounded-md border`,l=le,t[16]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(se,{children:(0,Y.jsxs)(G,{children:[(0,Y.jsx)(W,{children:`Email`}),(0,Y.jsx)(W,{children:`Role`}),(0,Y.jsx)(W,{children:`Status`}),(0,Y.jsx)(W,{className:`text-right w-[50px]`})]})}),t[16]=d):d=t[16],c=ce;let a;t[17]!==i||t[18]!==n||t[19]!==r?(a=e=>(0,Y.jsx)(Me,{invitation:e,currentUserId:n,organizationId:r,canManageInvitationMutations:i},e.id),t[17]=i,t[18]=n,t[19]=r,t[20]=a):a=t[20],u=e.map(a)}t[5]=i,t[6]=n,t[7]=s,t[8]=r,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f,t[14]=p}else c=t[9],l=t[10],u=t[11],d=t[12],f=t[13],p=t[14];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[21]!==c||t[22]!==u?(m=(0,Y.jsx)(c,{children:u}),t[21]=c,t[22]=u,t[23]=m):m=t[23];let h;t[24]!==l||t[25]!==d||t[26]!==m?(h=(0,Y.jsxs)(l,{children:[d,m]}),t[24]=l,t[25]=d,t[26]=m,t[27]=h):h=t[27];let g;return t[28]!==f||t[29]!==h?(g=(0,Y.jsx)(`div`,{className:f,children:h}),t[28]=f,t[29]=h,t[30]=g):g=t[30],g}function Pe(e){return e.status===`pending`}var Z=e(t(),1);function Fe(e){let t=(0,J.c)(11),{value:n,className:r}=e,[i,a]=(0,Z.useState)(!1),o,c;t[0]===i?(o=t[1],c=t[2]):(o=()=>{if(!i)return;let e=setTimeout(()=>{a(!1)},2e3);return()=>clearTimeout(e)},c=[i],t[0]=i,t[1]=o,t[2]=c),(0,Z.useEffect)(o,c);let u;t[3]===n?u=t[4]:(u=()=>{navigator.clipboard.writeText(n),a(!0)},t[3]=n,t[4]=u);let d=u,f;t[5]===i?f=t[6]:(f=i?(0,Y.jsx)(l,{size:16,stroke:2}):(0,Y.jsx)(he,{size:16,stroke:2}),t[5]=i,t[6]=f);let p;return t[7]!==r||t[8]!==d||t[9]!==f?(p=(0,Y.jsx)(s,{type:`button`,variant:`outline`,size:`icon`,onClick:d,title:`Copy`,className:r,children:f}),t[7]=r,t[8]=d,t[9]=f,t[10]=p):p=t[10],p}var Ie=[`admin`,`member`],Le=[{label:`Admin`,value:`admin`},{label:`Member`,value:`member`}],Re=[`member`],Q={RESET:`teamRoleSelection/reset`,SOURCE_ROLE_NAMES_SYNCED:`teamRoleSelection/sourceRoleNamesSynced`,TOGGLE_ROLE:`teamRoleSelection/toggleRole`};function $(e){let t=new Set;for(let n of e)(n===`admin`||n===`member`)&&t.add(n);return Ie.filter(e=>t.has(e))}var ze=ue({actions:{resetSelectedRoleNames:fe({selectedRoleNames:({context:e})=>e.sourceRoleNames}),syncSourceRoleNames:fe({selectedRoleNames:(e,t)=>[...t.roleNames],sourceRoleNames:(e,t)=>[...t.roleNames]}),toggleRoleName:fe({selectedRoleNames:({context:e},t)=>{let n=new Set(e.selectedRoleNames);return n.has(t.roleName)?n.delete(t.roleName):n.add(t.roleName),Ie.filter(e=>n.has(e))}})},types:{}}).createMachine({context:({input:e})=>{let t=$(e.initialRoleNames);return{selectedRoleNames:t,sourceRoleNames:t}},id:`teamRoleSelection`,initial:`ready`,on:{[Q.RESET]:{actions:`resetSelectedRoleNames`},[Q.SOURCE_ROLE_NAMES_SYNCED]:{actions:{type:`syncSourceRoleNames`,params:({event:e})=>({roleNames:$(e.roleNames)})}},[Q.TOGGLE_ROLE]:{actions:{type:`toggleRoleName`,params:({event:e})=>({roleName:e.roleName})}}},states:{ready:{}}});function Be(e){let t=(0,J.c)(21),n;t[0]===e.initialRoleNames?n=t[1]:(n=$(e.initialRoleNames),t[0]=e.initialRoleNames,t[1]=n);let r;t[2]===n?r=t[3]:(r={input:{initialRoleNames:n}},t[2]=n,t[3]=r);let[i,a]=de(ze,r),o;t[4]===i.context.selectedRoleNames?o=t[5]:(o=L(i.context.selectedRoleNames),t[4]=i.context.selectedRoleNames,t[5]=o);let s=o,c;t[6]===i.context.sourceRoleNames?c=t[7]:(c=L(i.context.sourceRoleNames),t[6]=i.context.sourceRoleNames,t[7]=c);let l=s!==c,u=i.context.selectedRoleNames.length===0,d;t[8]===a?d=t[9]:(d=()=>{a({type:Q.RESET})},t[8]=a,t[9]=d);let f=d,p;t[10]===a?p=t[11]:(p=e=>{a({type:Q.SOURCE_ROLE_NAMES_SYNCED,roleNames:e})},t[10]=a,t[11]=p);let m=p,h;t[12]===a?h=t[13]:(h=e=>{a({type:Q.TOGGLE_ROLE,roleName:e})},t[12]=a,t[13]=h);let g=h,_;return t[14]!==i.context.selectedRoleNames||t[15]!==g||t[16]!==l||t[17]!==u||t[18]!==f||t[19]!==m?(_={hasChanges:l,isSelectionEmpty:u,reset:f,resetToRoleNames:m,selectedRoleNames:i.context.selectedRoleNames,toggleRole:g},t[14]=i.context.selectedRoleNames,t[15]=g,t[16]=l,t[17]=u,t[18]=f,t[19]=m,t[20]=_):_=t[20],_}function Ve(e){return e instanceof HTMLElement&&e.closest(`[data-slot="checkbox"]`)!==null}function He(e){let t=(0,J.c)(12),{errorMessage:n,helperText:r,onToggleRole:i,selectedRoleNames:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsx)(oe,{children:`Roles`}),t[0]=o):o=t[0];let s;t[1]!==i||t[2]!==a?(s=Le.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 rounded-md border px-3 py-2 text-left hover:bg-accent/40`,onClick:t=>{Ve(t.target)||i(e.value)},children:[(0,Y.jsx)(g,{checked:a.includes(e.value),onCheckedChange:()=>i(e.value)}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`p`,{className:`font-medium`,children:e.label})})]},e.value)),t[1]=i,t[2]=a,t[3]=s):s=t[3];let c;t[4]===s?c=t[5]:(c=(0,Y.jsx)(`div`,{className:`space-y-2`,children:s}),t[4]=s,t[5]=c);let l;t[6]!==n||t[7]!==r?(l=n?(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:n}):(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r}),t[6]=n,t[7]=r,t[8]=l):l=t[8];let u;return t[9]!==c||t[10]!==l?(u=(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[o,c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11],u}var Ue=F({email:P(`Please enter a valid email address`)});function We(e){let t=(0,J.c)(44),{children:n,currentUserId:r,organizationId:i}=e,[o,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={initialRoleNames:Re},t[0]=p):p=t[0];let m=Be(p),h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h={defaultValues:{email:``},resolver:me(Ue)},t[1]=h):h=t[1];let g=pe(h),_;t[2]===i?_=t[3]:(_=e=>({id:`temp-${crypto.randomUUID()}`,email:e.email,rawRole:L(e.roleNames),roleNames:[...e.roleNames],status:`pending`,expiresAt:I().toISOString(),organizationId:i,inviterId:`current-user`}),t[2]=i,t[3]=_);let v;t[4]===i?v=t[5]:(v=async e=>De({email:e.email,organizationId:i,roleNames:e.roleNames}),t[4]=i,t[5]=v);let w;t[6]!==g||t[7]!==m?(w=e=>{e?.id&&u({expiresAt:e.expiresAt??I().toISOString(),url:`${a()}${y(e.id)}`}),g.reset(),m.reset(),f(null)},t[6]=g,t[7]=m,t[8]=w):w=t[8];let k;t[9]!==r||t[10]!==i?(k=ee(r,i),t[9]=r,t[10]=i,t[11]=k):k=t[11];let A;t[12]!==_||t[13]!==v||t[14]!==w||t[15]!==k.queryKey?(A={createOptimisticItem:_,errorMessage:`Failed to create invitation link`,mutationFn:v,onSuccess:w,queryKey:k.queryKey,successMessage:`Invitation link created`},t[12]=_,t[13]=v,t[14]=w,t[15]=k.queryKey,t[16]=A):A=t[16];let j=O(A),M;t[17]!==j||t[18]!==m.isSelectionEmpty||t[19]!==m.selectedRoleNames?(M=e=>{if(m.isSelectionEmpty){f(`Select at least one role`);return}j.mutate({...e,roleNames:m.selectedRoleNames})},t[17]=j,t[18]=m.isSelectionEmpty,t[19]=m.selectedRoleNames,t[20]=M):M=t[20];let N=M,P;t[21]!==g||t[22]!==m?(P=e=>{c(e),e||(u(null),f(null),m.reset(),g.reset())},t[21]=g,t[22]=m,t[23]=P):P=t[23];let F=P,R;t[24]!==d||t[25]!==m?(R=e=>{d&&f(null),m.toggleRole(e)},t[24]=d,t[25]=m,t[26]=R):R=t[26];let z=R,B;t[27]===n?B=t[28]:(B=(0,Y.jsx)(C,{render:n}),t[27]=n,t[28]=B);let V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Y.jsxs)(D,{children:[(0,Y.jsx)(x,{children:`Create Invitation Link`}),(0,Y.jsx)(b,{children:`Create a shareable invitation link for this organization. The recipient will sign in with an existing account or create their own before accepting.`})]}),t[29]=V):V=t[29];let H;t[30]!==g||t[31]!==z||t[32]!==l||t[33]!==j||t[34]!==N||t[35]!==d||t[36]!==m.isSelectionEmpty||t[37]!==m.selectedRoleNames?(H=(0,Y.jsxs)(S,{className:`sm:max-w-[400px]`,children:[V,l?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`space-y-2 pt-4`,children:[(0,Y.jsx)(oe,{children:`Invitation Link`}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(te,{value:l.url,readOnly:!0,className:`flex-1 text-sm`}),(0,Y.jsx)(Fe,{value:l.url})]}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Share this link with the invitee. They'll accept it after signing in or creating an account. The link expires on`,` `,ie(l.expiresAt),`.`]})]}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>u(null),children:`Create Another Link`}),(0,Y.jsx)(s,{type:`button`,onClick:()=>c(!1),children:`Done`})]})]}):(0,Y.jsxs)(`form`,{onSubmit:g.handleSubmit(N),className:`space-y-4 pt-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(oe,{htmlFor:`email`,children:`Email Address`}),(0,Y.jsx)(te,{id:`email`,type:`email`,placeholder:`colleague@example.com`,...g.register(`email`)}),g.formState.errors.email&&(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:g.formState.errors.email.message})]}),(0,Y.jsx)(He,{errorMessage:d,helperText:`Select one or more roles for this invitation.`,onToggleRole:z,selectedRoleNames:m.selectedRoleNames}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>c(!1),children:`Cancel`}),(0,Y.jsx)(s,{type:`submit`,disabled:j.isPending||m.isSelectionEmpty,children:j.isPending?`Creating Link...`:`Create Invitation Link`})]})]})]}),t[30]=g,t[31]=z,t[32]=l,t[33]=j,t[34]=N,t[35]=d,t[36]=m.isSelectionEmpty,t[37]=m.selectedRoleNames,t[38]=H):H=t[38];let U;return t[39]!==F||t[40]!==o||t[41]!==B||t[42]!==H?(U=(0,Y.jsxs)(E,{open:o,onOpenChange:F,children:[B,H]}),t[39]=F,t[40]=o,t[41]=B,t[42]=H,t[43]=U):U=t[43],U}function Ge({currentUserId:e,open:t,onOpenChange:n,member:r}){let i=z(),a=(0,Z.useMemo)(()=>$(r.roleNames),[L(r.roleNames)]),o=Be({initialRoleNames:a});(0,Z.useEffect)(()=>{t&&o.resetToRoleNames(a)},[a,r.id,t,o.resetToRoleNames]);let c=k({mutationFn:async()=>{await ke({memberId:r.id,organizationId:r.organizationId,roleNames:o.selectedRoleNames})},onError:e=>{B.error(e.message||`Failed to update role`)},onSuccess:()=>{B.success(`Role updated`),i.invalidateQueries({queryKey:V(e,r.organizationId).queryKey}),n(!1)}});return(0,Y.jsx)(E,{open:t,onOpenChange:n,children:(0,Y.jsxs)(S,{className:`sm:max-w-[400px]`,children:[(0,Y.jsxs)(D,{children:[(0,Y.jsx)(x,{children:`Change Role`}),(0,Y.jsxs)(b,{children:[`Update the role for `,r.user.name]})]}),(0,Y.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),!o.hasChanges){n(!1);return}c.mutate()},className:`space-y-4 pt-4`,children:[(0,Y.jsx)(He,{helperText:`Select one or more roles for this member.`,onToggleRole:o.toggleRole,selectedRoleNames:o.selectedRoleNames}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Y.jsx)(s,{type:`submit`,disabled:c.isPending||o.isSelectionEmpty,children:c.isPending?`Updating...`:`Update Role`})]})]})]})})}function Ke(e){return e.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2)}function qe(e){let t=(0,J.c)(51),{member:n,currentUserId:r,canManageMemberMutations:i}=e,[a,o]=(0,Z.useState)(!1),c=n.userId===r,l;t[0]===n.rawRole?l=t[1]:(l=R({roleName:`owner`,rawRole:n.rawRole}),t[0]=n.rawRole,t[1]=l);let g=l,_=n.id,v;t[2]!==n.id||t[3]!==n.organizationId?(v=async()=>{await Ae({memberId:n.id,organizationId:n.organizationId})},t[2]=n.id,t[3]=n.organizationId,t[4]=v):v=t[4];let y;t[5]!==r||t[6]!==n.organizationId?(y=V(r,n.organizationId),t[5]=r,t[6]=n.organizationId,t[7]=y):y=t[7];let b;t[8]!==n.id||t[9]!==v||t[10]!==y.queryKey?(b={errorMessage:`Failed to remove member`,itemId:_,mutationFn:v,queryKey:y.queryKey,successMessage:`Member removed`},t[8]=n.id,t[9]=v,t[10]=y.queryKey,t[11]=b):b=t[11];let x=w(b),S=i&&!g&&!c,C=i&&!g&&!c,T;t[12]===n.user.image?T=t[13]:(T=n.user.image&&(0,Y.jsx)(ne,{src:n.user.image}),t[12]=n.user.image,t[13]=T);let E;t[14]===n.user.name?E=t[15]:(E=Ke(n.user.name),t[14]=n.user.name,t[15]=E);let D;t[16]===E?D=t[17]:(D=(0,Y.jsx)(U,{children:E}),t[16]=E,t[17]=D);let O;t[18]!==T||t[19]!==D?(O=(0,Y.jsxs)(re,{size:`sm`,children:[T,D]}),t[18]=T,t[19]=D,t[20]=O):O=t[20];let k;t[21]===n.user.name?k=t[22]:(k=(0,Y.jsx)(`div`,{className:`font-medium`,children:n.user.name}),t[21]=n.user.name,t[22]=k);let A;t[23]===n.user.email?A=t[24]:(A=(0,Y.jsx)(`div`,{className:`text-muted-foreground text-sm`,children:n.user.email}),t[23]=n.user.email,t[24]=A);let j;t[25]!==k||t[26]!==A?(j=(0,Y.jsxs)(`div`,{children:[k,A]}),t[25]=k,t[26]=A,t[27]=j):j=t[27];let M;t[28]!==j||t[29]!==O?(M=(0,Y.jsx)(K,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[O,j]})}),t[28]=j,t[29]=O,t[30]=M):M=t[30];let N;t[31]!==n.rawRole||t[32]!==n.roleNames?(N=(0,Y.jsx)(K,{children:(0,Y.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole})}),t[31]=n.rawRole,t[32]=n.roleNames,t[33]=N):N=t[33];let P;t[34]!==S||t[35]!==C||t[36]!==x?(P=(S||C)&&(0,Y.jsxs)(p,{children:[(0,Y.jsx)(u,{children:(0,Y.jsx)(s,{variant:`ghost`,size:`icon-sm`,children:(0,Y.jsx)(h,{size:16,stroke:2})})}),(0,Y.jsxs)(d,{align:`end`,children:[S&&(0,Y.jsxs)(f,{onClick:()=>o(!0),children:[(0,Y.jsx)(ge,{size:16,stroke:2}),`Change Role`]}),C&&(0,Y.jsxs)(f,{onClick:()=>x.mutate(),disabled:x.isPending,className:`text-destructive focus:text-destructive`,children:[(0,Y.jsx)(m,{size:16,stroke:2}),x.isPending?`Removing...`:`Remove`]})]})]}),t[34]=S,t[35]=C,t[36]=x,t[37]=P):P=t[37];let F;t[38]===P?F=t[39]:(F=(0,Y.jsx)(K,{className:`text-right`,children:P}),t[38]=P,t[39]=F);let I;t[40]!==M||t[41]!==N||t[42]!==F?(I=(0,Y.jsxs)(G,{children:[M,N,F]}),t[40]=M,t[41]=N,t[42]=F,t[43]=I):I=t[43];let L;t[44]!==r||t[45]!==n||t[46]!==a?(L=(0,Y.jsx)(Ge,{open:a,onOpenChange:o,currentUserId:r,member:n}),t[44]=r,t[45]=n,t[46]=a,t[47]=L):L=t[47];let z;return t[48]!==I||t[49]!==L?(z=(0,Y.jsxs)(Y.Fragment,{children:[I,L]}),t[48]=I,t[49]=L,t[50]=z):z=t[50],z}function Je(e){let t=(0,J.c)(11),{members:n,currentUserId:r,canManageMemberMutations:i}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No members found.`}),t[0]=e):e=t[0],e}let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(se,{children:(0,Y.jsxs)(G,{children:[(0,Y.jsx)(W,{children:`Member`}),(0,Y.jsx)(W,{children:`Role`}),(0,Y.jsx)(W,{className:`text-right w-[50px]`})]})}),t[1]=a):a=t[1];let o;if(t[2]!==i||t[3]!==r||t[4]!==n){let e;t[6]!==i||t[7]!==r?(e=e=>(0,Y.jsx)(qe,{member:e,currentUserId:r,canManageMemberMutations:i},e.id),t[6]=i,t[7]=r,t[8]=e):e=t[8],o=n.map(e),t[2]=i,t[3]=r,t[4]=n,t[5]=o}else o=t[5];let s;return t[9]===o?s=t[10]:(s=(0,Y.jsx)(`div`,{className:`rounded-md border`,children:(0,Y.jsxs)(le,{children:[a,(0,Y.jsx)(ce,{children:o})]})}),t[9]=o,t[10]=s),s}var Ye=i(`/_authenticated/$org_slug/team`);function Xe(e){let t=(0,J.c)(27),n;t[0]!==e.currentUserId||t[1]!==e.organizationId?(n=V(e.currentUserId,e.organizationId),t[0]=e.currentUserId,t[1]=e.organizationId,t[2]=n):n=t[2];let{data:r}=j(n),i;t[3]!==r||t[4]!==e.currentUserId?(i=H({currentUserId:e.currentUserId,members:r}),t[3]=r,t[4]=e.currentUserId,t[5]=i):i=t[5];let{canInviteMembers:a,canManageMembershipMutations:o,canReadInvitations:c}=i,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Members`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`People who have access to this organization. Invite teammates to let them join with their own account.`})]}),t[6]=l):l=t[6];let u;t[7]!==a||t[8]!==o||t[9]!==e.currentUserId||t[10]!==e.organizationId?(u=a?(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:o?(0,Y.jsx)(We,{currentUserId:e.currentUserId,organizationId:e.organizationId,children:(0,Y.jsxs)(s,{children:[(0,Y.jsx)(_e,{size:16,stroke:2}),`Create Invitation Link`]})}):null}):null,t[7]=a,t[8]=o,t[9]=e.currentUserId,t[10]=e.organizationId,t[11]=u):u=t[11];let d;t[12]===u?d=t[13]:(d=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[l,u]}),t[12]=u,t[13]=d);let f;t[14]!==o||t[15]!==r||t[16]!==e.currentUserId?(f=(0,Y.jsx)(Je,{members:r,currentUserId:e.currentUserId,canManageMemberMutations:o}),t[14]=o,t[15]=r,t[16]=e.currentUserId,t[17]=f):f=t[17];let p;t[18]!==o||t[19]!==c||t[20]!==e.currentUserId||t[21]!==e.organizationId?(p=c?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold mb-2`,children:`Pending Invitations`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:`Invitations that haven't been accepted yet.`}),(0,Y.jsx)(Ne,{currentUserId:e.currentUserId,organizationId:e.organizationId,canManageInvitationMutations:o})]}):null,t[18]=o,t[19]=c,t[20]=e.currentUserId,t[21]=e.organizationId,t[22]=p):p=t[22];let m;return t[23]!==d||t[24]!==f||t[25]!==p?(m=(0,Y.jsxs)(`div`,{className:`space-y-8`,children:[d,f,p]}),t[23]=d,t[24]=f,t[25]=p,t[26]=m):m=t[26],m}function Ze(){let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsxs)(`div`,{className:`mb-8`,children:[(0,Y.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Team`}),(0,Y.jsx)(`p`,{className:`text-muted-foreground mt-2`,children:`Manage your members and create invitation links for new teammates.`})]}),e[0]=t):t=e[0],t}function Qe(){let e=(0,J.c)(4),{organizationId:t,session:n}=Ye.useRouteContext(),r=n.user.id,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(Ze,{}),e[0]=i):i=e[0];let a;return e[1]!==r||e[2]!==t?(a=(0,Y.jsxs)(`div`,{className:`p-8`,children:[i,(0,Y.jsx)(Xe,{organizationId:t,currentUserId:r})]}),e[1]=r,e[2]=t,e[3]=a):a=e[3],a}var $e=Qe;export{$e as component};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,n as a,t as o}from"./api-base-url-DIb6qukm.js";import{n as s,t as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./IconCheck-Gc24xPT2.js";import{d as u,n as d,r as f,t as p}from"./dropdown-menu-Bb-uhONR.js";import{n as m,r as h,t as g}from"./checkbox-BRqndHHY.js";import{t as _}from"./IconLoader2-B3B6M8nQ.js";import{t as v}from"./IconX-BQkA009b.js";import{l as y}from"./app-routes-CnJncMlZ.js";import{a as b,c as x,i as S,l as C,n as w,o as T,r as E,s as D,t as O,u as k}from"./use-optimistic-mutation-F9aL7LPX.js";import{t as A}from"./useQuery-Cbo-5C23.js";import{t as j}from"./useSuspenseQuery-GImltoGU.js";import{f as M,h as N,s as P,u as F}from"./schemas-n4sxh6jF.js";import{n as I}from"./src-DCIPwIx0.js";import{a as L,r as R}from"./organization-permissions-BQQ5PJbI.js";import{I as z,R as B,b as V,x as H,y as ee}from"./index-B4tzcC1c.js";import{t as te}from"./input-CG_cIxvO.js";import{n as U,r as ne,t as re}from"./avatar-BJ8wGO2c.js";import{t as ie}from"./format-date-Ctrh7my1.js";import{t as ae}from"./badge-CwG2ykXV.js";import{t as oe}from"./label-DDLGZnWP.js";import{a as se,i as W,n as ce,o as G,r as K,t as le}from"./table-Bzsu823v.js";import{a as ue,n as de,o as fe}from"./xstate-react.esm-U3P0kbzA.js";import{r as q}from"./api-paths-DM-NAvAZ.js";import{n as pe,t as me}from"./zod-Ch0Zejov.js";var he=c(`outline`,`copy`,`Copy`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}]]),ge=c(`outline`,`user-edit`,`UserEdit`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h3.5`,key:`svg-1`}],[`path`,{d:`M18.42 15.61a2.1 2.1 0 0 1 2.97 2.97l-3.39 3.42h-3v-3l3.42 -3.39`,key:`svg-2`}]]),_e=c(`outline`,`user-plus`,`UserPlus`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M16 19h6`,key:`svg-1`}],[`path`,{d:`M19 16v6`,key:`svg-2`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h4`,key:`svg-3`}]]),J=r(),Y=n();function ve(e){switch(e){case`owner`:return`default`;case`admin`:return`secondary`;case`member`:return`outline`}}function ye(e){switch(e){case`owner`:return`Owner`;case`admin`:return`Admin`;case`member`:return`Member`}}function be(e){let t=(0,J.c)(7),{role:n}=e,r;t[0]===n?r=t[1]:(r=ve(n),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=ye(n),t[2]=n,t[3]=i);let a;return t[4]!==r||t[5]!==i?(a=(0,Y.jsx)(ae,{variant:r,children:i}),t[4]=r,t[5]=i,t[6]=a):a=t[6],a}function xe(e){let t=(0,J.c)(9),{roleNames:n,rawRole:r,emptyLabel:i}=e;if(n.length===0){let e;t[0]!==i||t[1]!==r?(e=r?.trim()||i,t[0]=i,t[1]=r,t[2]=e):e=t[2];let n=e,a;return t[3]===n?a=t[4]:(a=n?(0,Y.jsx)(ae,{variant:`outline`,children:n}):null,t[3]=n,t[4]=a),a}let a;t[5]===n?a=t[6]:(a=n.map(Se),t[5]=n,t[6]=a);let o;return t[7]===a?o=t[8]:(o=(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:a}),t[7]=a,t[8]=o),o}function Se(e){return(0,Y.jsx)(be,{role:e},e)}var Ce=F({expiresAt:N().optional(),id:M(),role:M().optional()}),we=F({id:M(),role:M()}),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:M().optional(),error:M().optional(),message:M().optional()}).safeParse(n);if(r.success)return r.data.error??r.data.message??t}return await e.text().catch(()=>``)||t}async function X(e){let t=await fetch(`${o()}${e.path}`,{body:e.body?JSON.stringify(e.body):void 0,credentials:`include`,headers:{"Content-Type":`application/json`},method:e.method});if(!t.ok)throw Error(await Ee(t,e.errorMessage));let n=await t.json().catch(()=>null),r=e.successSchema.safeParse(n);if(!r.success)throw Error(e.errorMessage);return r.data}async function De(e){return X({body:{email:e.email,role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to create invitation link`,method:`POST`,path:q(e.organizationId,`invitations`),successSchema:Ce})}async function Oe(e){return X({errorMessage:`Failed to cancel invitation`,method:`DELETE`,path:q(e.organizationId,`invitations`,e.invitationId),successSchema:Ce})}async function ke(e){return X({body:{role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to update role`,method:`PATCH`,path:q(e.organizationId,`members`,e.memberId,`role`),successSchema:we})}async function Ae(e){return X({errorMessage:`Failed to remove member`,method:`DELETE`,path:q(e.organizationId,`members`,e.memberId),successSchema:Te})}function je(e){let t=Date.parse(e)-Date.now();if(t<0)return`Expired`;let n=Math.floor(t/(1e3*60*60*24)),r=Math.floor(t%(1e3*60*60*24)/(1e3*60*60));return n>0?`Expires in ${n}d`:r>0?`Expires in ${r}h`:`Expires soon`}function Me(e){let t=(0,J.c)(31),{invitation:n,currentUserId:r,organizationId:i,canManageInvitationMutations:a}=e,o=n.id,c;t[0]!==n.id||t[1]!==i?(c=async()=>{await Oe({invitationId:n.id,organizationId:i})},t[0]=n.id,t[1]=i,t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==n.organizationId?(l=ee(r,n.organizationId),t[3]=r,t[4]=n.organizationId,t[5]=l):l=t[5];let u;t[6]!==n.id||t[7]!==c||t[8]!==l.queryKey?(u={errorMessage:`Failed to cancel invitation`,itemId:o,mutationFn:c,queryKey:l.queryKey,successMessage:`Invitation cancelled`},t[6]=n.id,t[7]=c,t[8]=l.queryKey,t[9]=u):u=t[9];let d=w(u),f=n.expiresAt?Date.parse(n.expiresAt)<Date.now():!1,p;t[10]===n.email?p=t[11]:(p=(0,Y.jsx)(K,{children:(0,Y.jsx)(`span`,{className:`font-medium`,children:n.email})}),t[10]=n.email,t[11]=p);let m;t[12]!==n.rawRole||t[13]!==n.roleNames?(m=(0,Y.jsx)(K,{children:(0,Y.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole,emptyLabel:`Member`})}),t[12]=n.rawRole,t[13]=n.roleNames,t[14]=m):m=t[14];let h=f?`text-destructive`:`text-muted-foreground`,g;t[15]===n.expiresAt?g=t[16]:(g=n.expiresAt?je(n.expiresAt):`Pending`,t[15]=n.expiresAt,t[16]=g);let y;t[17]!==h||t[18]!==g?(y=(0,Y.jsx)(K,{children:(0,Y.jsx)(`span`,{className:h,children:g})}),t[17]=h,t[18]=g,t[19]=y):y=t[19];let b;t[20]!==a||t[21]!==d||t[22]!==f?(b=a&&!f&&(0,Y.jsx)(s,{variant:`ghost`,size:`icon-sm`,onClick:()=>d.mutate(),disabled:d.isPending,title:`Cancel invitation`,children:d.isPending?(0,Y.jsx)(_,{size:16,className:`animate-spin`}):(0,Y.jsx)(v,{size:16,stroke:2})}),t[20]=a,t[21]=d,t[22]=f,t[23]=b):b=t[23];let x;t[24]===b?x=t[25]:(x=(0,Y.jsx)(K,{className:`text-right`,children:b}),t[24]=b,t[25]=x);let S;return t[26]!==x||t[27]!==p||t[28]!==m||t[29]!==y?(S=(0,Y.jsxs)(G,{children:[p,m,y,x]}),t[26]=x,t[27]=p,t[28]=m,t[29]=y,t[30]=S):S=t[30],S}function Ne(e){let t=(0,J.c)(31),{currentUserId:n,organizationId:r,canManageInvitationMutations:i}=e,a;t[0]!==n||t[1]!==r?(a=ee(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=A(a);if(o.isPending){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`Loading invitations...`}),t[3]=e):e=t[3],e}if(o.isLoadingError){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-destructive`,children:`Failed to load invitations.`}),t[4]=e):e=t[4],e}let s=o.data,c,l,u,d,f,p;if(t[5]!==i||t[6]!==n||t[7]!==s||t[8]!==r){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=s.filter(Pe);if(e.length===0){let e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No pending invitations.`}),t[15]=e):e=t[15],p=e;break bb0}f=`rounded-md border`,l=le,t[16]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(se,{children:(0,Y.jsxs)(G,{children:[(0,Y.jsx)(W,{children:`Email`}),(0,Y.jsx)(W,{children:`Role`}),(0,Y.jsx)(W,{children:`Status`}),(0,Y.jsx)(W,{className:`text-right w-[50px]`})]})}),t[16]=d):d=t[16],c=ce;let a;t[17]!==i||t[18]!==n||t[19]!==r?(a=e=>(0,Y.jsx)(Me,{invitation:e,currentUserId:n,organizationId:r,canManageInvitationMutations:i},e.id),t[17]=i,t[18]=n,t[19]=r,t[20]=a):a=t[20],u=e.map(a)}t[5]=i,t[6]=n,t[7]=s,t[8]=r,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f,t[14]=p}else c=t[9],l=t[10],u=t[11],d=t[12],f=t[13],p=t[14];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[21]!==c||t[22]!==u?(m=(0,Y.jsx)(c,{children:u}),t[21]=c,t[22]=u,t[23]=m):m=t[23];let h;t[24]!==l||t[25]!==d||t[26]!==m?(h=(0,Y.jsxs)(l,{children:[d,m]}),t[24]=l,t[25]=d,t[26]=m,t[27]=h):h=t[27];let g;return t[28]!==f||t[29]!==h?(g=(0,Y.jsx)(`div`,{className:f,children:h}),t[28]=f,t[29]=h,t[30]=g):g=t[30],g}function Pe(e){return e.status===`pending`}var Z=e(t(),1);function Fe(e){let t=(0,J.c)(11),{value:n,className:r}=e,[i,a]=(0,Z.useState)(!1),o,c;t[0]===i?(o=t[1],c=t[2]):(o=()=>{if(!i)return;let e=setTimeout(()=>{a(!1)},2e3);return()=>clearTimeout(e)},c=[i],t[0]=i,t[1]=o,t[2]=c),(0,Z.useEffect)(o,c);let u;t[3]===n?u=t[4]:(u=()=>{navigator.clipboard.writeText(n),a(!0)},t[3]=n,t[4]=u);let d=u,f;t[5]===i?f=t[6]:(f=i?(0,Y.jsx)(l,{size:16,stroke:2}):(0,Y.jsx)(he,{size:16,stroke:2}),t[5]=i,t[6]=f);let p;return t[7]!==r||t[8]!==d||t[9]!==f?(p=(0,Y.jsx)(s,{type:`button`,variant:`outline`,size:`icon`,onClick:d,title:`Copy`,className:r,children:f}),t[7]=r,t[8]=d,t[9]=f,t[10]=p):p=t[10],p}var Ie=[`admin`,`member`],Le=[{label:`Admin`,value:`admin`},{label:`Member`,value:`member`}],Re=[`member`],Q={RESET:`teamRoleSelection/reset`,SOURCE_ROLE_NAMES_SYNCED:`teamRoleSelection/sourceRoleNamesSynced`,TOGGLE_ROLE:`teamRoleSelection/toggleRole`};function $(e){let t=new Set;for(let n of e)(n===`admin`||n===`member`)&&t.add(n);return Ie.filter(e=>t.has(e))}var ze=ue({actions:{resetSelectedRoleNames:fe({selectedRoleNames:({context:e})=>e.sourceRoleNames}),syncSourceRoleNames:fe({selectedRoleNames:(e,t)=>[...t.roleNames],sourceRoleNames:(e,t)=>[...t.roleNames]}),toggleRoleName:fe({selectedRoleNames:({context:e},t)=>{let n=new Set(e.selectedRoleNames);return n.has(t.roleName)?n.delete(t.roleName):n.add(t.roleName),Ie.filter(e=>n.has(e))}})},types:{}}).createMachine({context:({input:e})=>{let t=$(e.initialRoleNames);return{selectedRoleNames:t,sourceRoleNames:t}},id:`teamRoleSelection`,initial:`ready`,on:{[Q.RESET]:{actions:`resetSelectedRoleNames`},[Q.SOURCE_ROLE_NAMES_SYNCED]:{actions:{type:`syncSourceRoleNames`,params:({event:e})=>({roleNames:$(e.roleNames)})}},[Q.TOGGLE_ROLE]:{actions:{type:`toggleRoleName`,params:({event:e})=>({roleName:e.roleName})}}},states:{ready:{}}});function Be(e){let t=(0,J.c)(21),n;t[0]===e.initialRoleNames?n=t[1]:(n=$(e.initialRoleNames),t[0]=e.initialRoleNames,t[1]=n);let r;t[2]===n?r=t[3]:(r={input:{initialRoleNames:n}},t[2]=n,t[3]=r);let[i,a]=de(ze,r),o;t[4]===i.context.selectedRoleNames?o=t[5]:(o=L(i.context.selectedRoleNames),t[4]=i.context.selectedRoleNames,t[5]=o);let s=o,c;t[6]===i.context.sourceRoleNames?c=t[7]:(c=L(i.context.sourceRoleNames),t[6]=i.context.sourceRoleNames,t[7]=c);let l=s!==c,u=i.context.selectedRoleNames.length===0,d;t[8]===a?d=t[9]:(d=()=>{a({type:Q.RESET})},t[8]=a,t[9]=d);let f=d,p;t[10]===a?p=t[11]:(p=e=>{a({type:Q.SOURCE_ROLE_NAMES_SYNCED,roleNames:e})},t[10]=a,t[11]=p);let m=p,h;t[12]===a?h=t[13]:(h=e=>{a({type:Q.TOGGLE_ROLE,roleName:e})},t[12]=a,t[13]=h);let g=h,_;return t[14]!==i.context.selectedRoleNames||t[15]!==g||t[16]!==l||t[17]!==u||t[18]!==f||t[19]!==m?(_={hasChanges:l,isSelectionEmpty:u,reset:f,resetToRoleNames:m,selectedRoleNames:i.context.selectedRoleNames,toggleRole:g},t[14]=i.context.selectedRoleNames,t[15]=g,t[16]=l,t[17]=u,t[18]=f,t[19]=m,t[20]=_):_=t[20],_}function Ve(e){return e instanceof HTMLElement&&e.closest(`[data-slot="checkbox"]`)!==null}function He(e){let t=(0,J.c)(12),{errorMessage:n,helperText:r,onToggleRole:i,selectedRoleNames:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsx)(oe,{children:`Roles`}),t[0]=o):o=t[0];let s;t[1]!==i||t[2]!==a?(s=Le.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 rounded-md border px-3 py-2 text-left hover:bg-accent/40`,onClick:t=>{Ve(t.target)||i(e.value)},children:[(0,Y.jsx)(g,{checked:a.includes(e.value),onCheckedChange:()=>i(e.value)}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`p`,{className:`font-medium`,children:e.label})})]},e.value)),t[1]=i,t[2]=a,t[3]=s):s=t[3];let c;t[4]===s?c=t[5]:(c=(0,Y.jsx)(`div`,{className:`space-y-2`,children:s}),t[4]=s,t[5]=c);let l;t[6]!==n||t[7]!==r?(l=n?(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:n}):(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r}),t[6]=n,t[7]=r,t[8]=l):l=t[8];let u;return t[9]!==c||t[10]!==l?(u=(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[o,c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11],u}var Ue=F({email:P(`Please enter a valid email address`)});function We(e){let t=(0,J.c)(44),{children:n,currentUserId:r,organizationId:i}=e,[o,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={initialRoleNames:Re},t[0]=p):p=t[0];let m=Be(p),h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h={defaultValues:{email:``},resolver:me(Ue)},t[1]=h):h=t[1];let g=pe(h),_;t[2]===i?_=t[3]:(_=e=>({id:`temp-${crypto.randomUUID()}`,email:e.email,rawRole:L(e.roleNames),roleNames:[...e.roleNames],status:`pending`,expiresAt:I().toISOString(),organizationId:i,inviterId:`current-user`}),t[2]=i,t[3]=_);let v;t[4]===i?v=t[5]:(v=async e=>De({email:e.email,organizationId:i,roleNames:e.roleNames}),t[4]=i,t[5]=v);let w;t[6]!==g||t[7]!==m?(w=e=>{e?.id&&u({expiresAt:e.expiresAt??I().toISOString(),url:`${a()}${y(e.id)}`}),g.reset(),m.reset(),f(null)},t[6]=g,t[7]=m,t[8]=w):w=t[8];let k;t[9]!==r||t[10]!==i?(k=ee(r,i),t[9]=r,t[10]=i,t[11]=k):k=t[11];let A;t[12]!==_||t[13]!==v||t[14]!==w||t[15]!==k.queryKey?(A={createOptimisticItem:_,errorMessage:`Failed to create invitation link`,mutationFn:v,onSuccess:w,queryKey:k.queryKey,successMessage:`Invitation link created`},t[12]=_,t[13]=v,t[14]=w,t[15]=k.queryKey,t[16]=A):A=t[16];let j=O(A),M;t[17]!==j||t[18]!==m.isSelectionEmpty||t[19]!==m.selectedRoleNames?(M=e=>{if(m.isSelectionEmpty){f(`Select at least one role`);return}j.mutate({...e,roleNames:m.selectedRoleNames})},t[17]=j,t[18]=m.isSelectionEmpty,t[19]=m.selectedRoleNames,t[20]=M):M=t[20];let N=M,P;t[21]!==g||t[22]!==m?(P=e=>{c(e),e||(u(null),f(null),m.reset(),g.reset())},t[21]=g,t[22]=m,t[23]=P):P=t[23];let F=P,R;t[24]!==d||t[25]!==m?(R=e=>{d&&f(null),m.toggleRole(e)},t[24]=d,t[25]=m,t[26]=R):R=t[26];let z=R,B;t[27]===n?B=t[28]:(B=(0,Y.jsx)(C,{render:n}),t[27]=n,t[28]=B);let V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Y.jsxs)(D,{children:[(0,Y.jsx)(x,{children:`Create Invitation Link`}),(0,Y.jsx)(b,{children:`Create a shareable invitation link for this organization. The recipient will sign in with an existing account or create their own before accepting.`})]}),t[29]=V):V=t[29];let H;t[30]!==g||t[31]!==z||t[32]!==l||t[33]!==j||t[34]!==N||t[35]!==d||t[36]!==m.isSelectionEmpty||t[37]!==m.selectedRoleNames?(H=(0,Y.jsxs)(S,{className:`sm:max-w-[400px]`,children:[V,l?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`space-y-2 pt-4`,children:[(0,Y.jsx)(oe,{children:`Invitation Link`}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(te,{value:l.url,readOnly:!0,className:`flex-1 text-sm`}),(0,Y.jsx)(Fe,{value:l.url})]}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Share this link with the invitee. They'll accept it after signing in or creating an account. The link expires on`,` `,ie(l.expiresAt),`.`]})]}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>u(null),children:`Create Another Link`}),(0,Y.jsx)(s,{type:`button`,onClick:()=>c(!1),children:`Done`})]})]}):(0,Y.jsxs)(`form`,{onSubmit:g.handleSubmit(N),className:`space-y-4 pt-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(oe,{htmlFor:`email`,children:`Email Address`}),(0,Y.jsx)(te,{id:`email`,type:`email`,placeholder:`colleague@example.com`,...g.register(`email`)}),g.formState.errors.email&&(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:g.formState.errors.email.message})]}),(0,Y.jsx)(He,{errorMessage:d,helperText:`Select one or more roles for this invitation.`,onToggleRole:z,selectedRoleNames:m.selectedRoleNames}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>c(!1),children:`Cancel`}),(0,Y.jsx)(s,{type:`submit`,disabled:j.isPending||m.isSelectionEmpty,children:j.isPending?`Creating Link...`:`Create Invitation Link`})]})]})]}),t[30]=g,t[31]=z,t[32]=l,t[33]=j,t[34]=N,t[35]=d,t[36]=m.isSelectionEmpty,t[37]=m.selectedRoleNames,t[38]=H):H=t[38];let U;return t[39]!==F||t[40]!==o||t[41]!==B||t[42]!==H?(U=(0,Y.jsxs)(E,{open:o,onOpenChange:F,children:[B,H]}),t[39]=F,t[40]=o,t[41]=B,t[42]=H,t[43]=U):U=t[43],U}function Ge({currentUserId:e,open:t,onOpenChange:n,member:r}){let i=B(),a=(0,Z.useMemo)(()=>$(r.roleNames),[L(r.roleNames)]),o=Be({initialRoleNames:a});(0,Z.useEffect)(()=>{t&&o.resetToRoleNames(a)},[a,r.id,t,o.resetToRoleNames]);let c=k({mutationFn:async()=>{await ke({memberId:r.id,organizationId:r.organizationId,roleNames:o.selectedRoleNames})},onError:e=>{z.error(e.message||`Failed to update role`)},onSuccess:()=>{z.success(`Role updated`),i.invalidateQueries({queryKey:V(e,r.organizationId).queryKey}),n(!1)}});return(0,Y.jsx)(E,{open:t,onOpenChange:n,children:(0,Y.jsxs)(S,{className:`sm:max-w-[400px]`,children:[(0,Y.jsxs)(D,{children:[(0,Y.jsx)(x,{children:`Change Role`}),(0,Y.jsxs)(b,{children:[`Update the role for `,r.user.name]})]}),(0,Y.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),!o.hasChanges){n(!1);return}c.mutate()},className:`space-y-4 pt-4`,children:[(0,Y.jsx)(He,{helperText:`Select one or more roles for this member.`,onToggleRole:o.toggleRole,selectedRoleNames:o.selectedRoleNames}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Y.jsx)(s,{type:`submit`,disabled:c.isPending||o.isSelectionEmpty,children:c.isPending?`Updating...`:`Update Role`})]})]})]})})}function Ke(e){return e.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2)}function qe(e){let t=(0,J.c)(51),{member:n,currentUserId:r,canManageMemberMutations:i}=e,[a,o]=(0,Z.useState)(!1),c=n.userId===r,l;t[0]===n.rawRole?l=t[1]:(l=R({roleName:`owner`,rawRole:n.rawRole}),t[0]=n.rawRole,t[1]=l);let g=l,_=n.id,v;t[2]!==n.id||t[3]!==n.organizationId?(v=async()=>{await Ae({memberId:n.id,organizationId:n.organizationId})},t[2]=n.id,t[3]=n.organizationId,t[4]=v):v=t[4];let y;t[5]!==r||t[6]!==n.organizationId?(y=V(r,n.organizationId),t[5]=r,t[6]=n.organizationId,t[7]=y):y=t[7];let b;t[8]!==n.id||t[9]!==v||t[10]!==y.queryKey?(b={errorMessage:`Failed to remove member`,itemId:_,mutationFn:v,queryKey:y.queryKey,successMessage:`Member removed`},t[8]=n.id,t[9]=v,t[10]=y.queryKey,t[11]=b):b=t[11];let x=w(b),S=i&&!g&&!c,C=i&&!g&&!c,T;t[12]===n.user.image?T=t[13]:(T=n.user.image&&(0,Y.jsx)(ne,{src:n.user.image}),t[12]=n.user.image,t[13]=T);let E;t[14]===n.user.name?E=t[15]:(E=Ke(n.user.name),t[14]=n.user.name,t[15]=E);let D;t[16]===E?D=t[17]:(D=(0,Y.jsx)(U,{children:E}),t[16]=E,t[17]=D);let O;t[18]!==T||t[19]!==D?(O=(0,Y.jsxs)(re,{size:`sm`,children:[T,D]}),t[18]=T,t[19]=D,t[20]=O):O=t[20];let k;t[21]===n.user.name?k=t[22]:(k=(0,Y.jsx)(`div`,{className:`font-medium`,children:n.user.name}),t[21]=n.user.name,t[22]=k);let A;t[23]===n.user.email?A=t[24]:(A=(0,Y.jsx)(`div`,{className:`text-muted-foreground text-sm`,children:n.user.email}),t[23]=n.user.email,t[24]=A);let j;t[25]!==k||t[26]!==A?(j=(0,Y.jsxs)(`div`,{children:[k,A]}),t[25]=k,t[26]=A,t[27]=j):j=t[27];let M;t[28]!==j||t[29]!==O?(M=(0,Y.jsx)(K,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[O,j]})}),t[28]=j,t[29]=O,t[30]=M):M=t[30];let N;t[31]!==n.rawRole||t[32]!==n.roleNames?(N=(0,Y.jsx)(K,{children:(0,Y.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole})}),t[31]=n.rawRole,t[32]=n.roleNames,t[33]=N):N=t[33];let P;t[34]!==S||t[35]!==C||t[36]!==x?(P=(S||C)&&(0,Y.jsxs)(p,{children:[(0,Y.jsx)(u,{children:(0,Y.jsx)(s,{variant:`ghost`,size:`icon-sm`,children:(0,Y.jsx)(h,{size:16,stroke:2})})}),(0,Y.jsxs)(d,{align:`end`,children:[S&&(0,Y.jsxs)(f,{onClick:()=>o(!0),children:[(0,Y.jsx)(ge,{size:16,stroke:2}),`Change Role`]}),C&&(0,Y.jsxs)(f,{onClick:()=>x.mutate(),disabled:x.isPending,className:`text-destructive focus:text-destructive`,children:[(0,Y.jsx)(m,{size:16,stroke:2}),x.isPending?`Removing...`:`Remove`]})]})]}),t[34]=S,t[35]=C,t[36]=x,t[37]=P):P=t[37];let F;t[38]===P?F=t[39]:(F=(0,Y.jsx)(K,{className:`text-right`,children:P}),t[38]=P,t[39]=F);let I;t[40]!==M||t[41]!==N||t[42]!==F?(I=(0,Y.jsxs)(G,{children:[M,N,F]}),t[40]=M,t[41]=N,t[42]=F,t[43]=I):I=t[43];let L;t[44]!==r||t[45]!==n||t[46]!==a?(L=(0,Y.jsx)(Ge,{open:a,onOpenChange:o,currentUserId:r,member:n}),t[44]=r,t[45]=n,t[46]=a,t[47]=L):L=t[47];let z;return t[48]!==I||t[49]!==L?(z=(0,Y.jsxs)(Y.Fragment,{children:[I,L]}),t[48]=I,t[49]=L,t[50]=z):z=t[50],z}function Je(e){let t=(0,J.c)(11),{members:n,currentUserId:r,canManageMemberMutations:i}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No members found.`}),t[0]=e):e=t[0],e}let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(se,{children:(0,Y.jsxs)(G,{children:[(0,Y.jsx)(W,{children:`Member`}),(0,Y.jsx)(W,{children:`Role`}),(0,Y.jsx)(W,{className:`text-right w-[50px]`})]})}),t[1]=a):a=t[1];let o;if(t[2]!==i||t[3]!==r||t[4]!==n){let e;t[6]!==i||t[7]!==r?(e=e=>(0,Y.jsx)(qe,{member:e,currentUserId:r,canManageMemberMutations:i},e.id),t[6]=i,t[7]=r,t[8]=e):e=t[8],o=n.map(e),t[2]=i,t[3]=r,t[4]=n,t[5]=o}else o=t[5];let s;return t[9]===o?s=t[10]:(s=(0,Y.jsx)(`div`,{className:`rounded-md border`,children:(0,Y.jsxs)(le,{children:[a,(0,Y.jsx)(ce,{children:o})]})}),t[9]=o,t[10]=s),s}var Ye=i(`/_authenticated/$org_slug/team`);function Xe(e){let t=(0,J.c)(27),n;t[0]!==e.currentUserId||t[1]!==e.organizationId?(n=V(e.currentUserId,e.organizationId),t[0]=e.currentUserId,t[1]=e.organizationId,t[2]=n):n=t[2];let{data:r}=j(n),i;t[3]!==r||t[4]!==e.currentUserId?(i=H({currentUserId:e.currentUserId,members:r}),t[3]=r,t[4]=e.currentUserId,t[5]=i):i=t[5];let{canInviteMembers:a,canManageMembershipMutations:o,canReadInvitations:c}=i,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Members`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`People who have access to this organization. Invite teammates to let them join with their own account.`})]}),t[6]=l):l=t[6];let u;t[7]!==a||t[8]!==o||t[9]!==e.currentUserId||t[10]!==e.organizationId?(u=a?(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:o?(0,Y.jsx)(We,{currentUserId:e.currentUserId,organizationId:e.organizationId,children:(0,Y.jsxs)(s,{children:[(0,Y.jsx)(_e,{size:16,stroke:2}),`Create Invitation Link`]})}):null}):null,t[7]=a,t[8]=o,t[9]=e.currentUserId,t[10]=e.organizationId,t[11]=u):u=t[11];let d;t[12]===u?d=t[13]:(d=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[l,u]}),t[12]=u,t[13]=d);let f;t[14]!==o||t[15]!==r||t[16]!==e.currentUserId?(f=(0,Y.jsx)(Je,{members:r,currentUserId:e.currentUserId,canManageMemberMutations:o}),t[14]=o,t[15]=r,t[16]=e.currentUserId,t[17]=f):f=t[17];let p;t[18]!==o||t[19]!==c||t[20]!==e.currentUserId||t[21]!==e.organizationId?(p=c?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold mb-2`,children:`Pending Invitations`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:`Invitations that haven't been accepted yet.`}),(0,Y.jsx)(Ne,{currentUserId:e.currentUserId,organizationId:e.organizationId,canManageInvitationMutations:o})]}):null,t[18]=o,t[19]=c,t[20]=e.currentUserId,t[21]=e.organizationId,t[22]=p):p=t[22];let m;return t[23]!==d||t[24]!==f||t[25]!==p?(m=(0,Y.jsxs)(`div`,{className:`space-y-8`,children:[d,f,p]}),t[23]=d,t[24]=f,t[25]=p,t[26]=m):m=t[26],m}function Ze(){let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsxs)(`div`,{className:`mb-8`,children:[(0,Y.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Team`}),(0,Y.jsx)(`p`,{className:`text-muted-foreground mt-2`,children:`Manage your members and create invitation links for new teammates.`})]}),e[0]=t):t=e[0],t}function Qe(){let e=(0,J.c)(4),{organizationId:t,session:n}=Ye.useRouteContext(),r=n.user.id,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(Ze,{}),e[0]=i):i=e[0];let a;return e[1]!==r||e[2]!==t?(a=(0,Y.jsxs)(`div`,{className:`p-8`,children:[i,(0,Y.jsx)(Xe,{organizationId:t,currentUserId:r})]}),e[1]=r,e[2]=t,e[3]=a):a=e[3],a}var $e=Qe;export{$e as component};
@@ -1 +1 @@
1
- import{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{S as i,_ as a,a as o,d as s,f as c,h as l}from"./createReactComponent-_L2mp4Ui.js";import{t as u}from"./utils-C8DGLIgm.js";import{i as d}from"./getDisabledMountTransitionStyles-BYKRz4ha.js";import{C as f,D as p,E as m,O as h,S as g,T as _,_ as v,a as y,b,c as x,g as S,h as C,l as w,m as T,o as E,p as D,s as O,t as k,u as A,v as j,w as M,x as N,y as P}from"./CompositeList-CX7HHxYw.js";function F(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var I=`data-composite-item-active`,L=e(t()),R=[];function z(e){let{itemSizes:t,cols:n=1,loopFocus:r=!0,dense:a=!1,orientation:o=`both`,direction:s,highlightedIndex:c,onHighlightedIndexChange:u,rootRef:d,enableHomeAndEndKeys:C=!1,stopEventPropagation:k=!1,disabledIndices:I,modifierKeys:z=R}=e,[V,H]=L.useState(0),U=n>1,W=L.useRef(null),G=l(W,d),K=L.useRef([]),q=L.useRef(!1),J=c??V,Y=i((e,t=!1)=>{if((u??H)(e),t){let t=K.current[e];P(W.current,t,s,o)}}),X=i(e=>{if(e.size===0||q.current)return;q.current=!0;let t=Array.from(e.keys()),n=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,r=n?t.indexOf(n):-1;r!==-1&&Y(r),P(W.current,n,s,o)}),Z=L.useMemo(()=>({"aria-orientation":o===`both`?void 0:o,ref:G,onFocus(e){!W.current||!j(e.target)||e.target.setSelectionRange(0,e.target.value.length??0)},onKeyDown(e){let i=C?y:O;if(!i.has(e.key)||B(e,z)||!W.current)return;let c=s===`rtl`,l=c?x:w,u={horizontal:l,vertical:E,both:l}[o],d=c?w:x,P={horizontal:d,vertical:A,both:d}[o];if(j(e.target)&&!F(e.target)){let t=e.target.selectionStart,n=e.target.selectionEnd,r=e.target.value??``;if(t==null||e.shiftKey||t!==n||e.key!==P&&t<r.length||e.key!==u&&t>0)return}let L=J,R=m(K,I),V=_(K,I);if(U){let i=t||Array.from({length:K.current.length},()=>({width:1,height:1})),s=b(i,n,a),l=s.findIndex(e=>e!=null&&!h(K,e,I)),u=s.reduce((e,t,n)=>t!=null&&!h(K,t,I)?n:e,-1);L=s[M({current:s.map(e=>e?K.current[e]:null)},{event:e,orientation:o,loopFocus:r,cols:n,disabledIndices:f([...I||K.current.map((e,t)=>h(K,t)?t:void 0),void 0],s),minIndex:l,maxIndex:u,prevIndex:g(J>V?R:J,i,s,n,e.key===`ArrowDown`?`bl`:e.key===`ArrowRight`?`tr`:`tl`),rtl:c})]}let H={horizontal:[l],vertical:[E],both:[l,E]}[o],G={horizontal:[d],vertical:[A],both:[d,A]}[o],q=U?i:{horizontal:C?T:D,vertical:C?v:S,both:i}[o];C&&(e.key===`Home`?L=R:e.key===`End`&&(L=V)),L===J&&(H.includes(e.key)||G.includes(e.key))&&(L=r&&L===V&&H.includes(e.key)?R:r&&L===R&&G.includes(e.key)?V:N(K,{startingIndex:L,decrement:G.includes(e.key),disabledIndices:I})),L!==J&&!p(K,L)&&(k&&e.stopPropagation(),q.has(e.key)&&e.preventDefault(),Y(L,!0),queueMicrotask(()=>{K.current[L]?.focus()}))}}),[n,a,s,I,K,C,J,U,t,r,G,z,Y,o,k]);return L.useMemo(()=>({props:Z,highlightedIndex:J,onHighlightedIndexChange:Y,elementsRef:K,disabledIndices:I,onMapChange:X,relayKeyboardEvent:Z.onKeyDown}),[Z,J,Y,K,I,X])}function B(e,t){for(let n of C.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}var V=n();function H(e){let{render:t,className:n,refs:r=s,props:i=s,state:l=c,stateAttributesMapping:u,highlightedIndex:f,onHighlightedIndexChange:p,orientation:m,dense:h,itemSizes:g,loopFocus:_,cols:v,enableHomeAndEndKeys:y,onMapChange:b,stopEventPropagation:x=!0,rootRef:S,disabledIndices:C,modifierKeys:w,highlightItemOnHover:T=!1,tag:E=`div`,...D}=e,{props:O,highlightedIndex:A,onHighlightedIndexChange:j,elementsRef:M,onMapChange:N,relayKeyboardEvent:P}=z({itemSizes:g,cols:v,loopFocus:_,dense:h,orientation:m,highlightedIndex:f,onHighlightedIndexChange:p,rootRef:S,stopEventPropagation:x,enableHomeAndEndKeys:y,direction:d(),disabledIndices:C,modifierKeys:w}),F=o(E,e,{state:l,ref:r,props:[O,...i,D],stateAttributesMapping:u}),I=L.useMemo(()=>({highlightedIndex:A,onHighlightedIndexChange:j,highlightItemOnHover:T,relayKeyboardEvent:P}),[A,j,T,P]);return(0,V.jsx)(a.Provider,{value:I,children:(0,V.jsx)(k,{elementsRef:M,onMapChange:e=>{b?.(e),N(e)},children:F})})}var U=r();function W(e){let t=(0,U.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=u(`border-input dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 rounded-lg border bg-transparent px-2.5 py-2 text-base transition-colors focus-visible:ring-[3px] aria-invalid:ring-[3px] md:text-sm placeholder:text-muted-foreground flex field-sizing-content min-h-16 w-full outline-none disabled:cursor-not-allowed disabled:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,V.jsx)(`textarea`,{"data-slot":`textarea`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}export{H as n,I as r,W as t};
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{S as i,_ as a,a as o,d as s,f as c,h as l}from"./createReactComponent-_L2mp4Ui.js";import{t as u}from"./utils-C8DGLIgm.js";import{i as d}from"./getDisabledMountTransitionStyles-Co-5TcgR.js";import{C as f,D as p,E as m,O as h,S as g,T as _,_ as v,a as y,b,c as x,g as S,h as C,l as w,m as T,o as E,p as D,s as O,t as k,u as A,v as j,w as M,x as N,y as P}from"./CompositeList-FRTEqUDK.js";function F(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var I=`data-composite-item-active`,L=e(t()),R=[];function z(e){let{itemSizes:t,cols:n=1,loopFocus:r=!0,dense:a=!1,orientation:o=`both`,direction:s,highlightedIndex:c,onHighlightedIndexChange:u,rootRef:d,enableHomeAndEndKeys:C=!1,stopEventPropagation:k=!1,disabledIndices:I,modifierKeys:z=R}=e,[V,H]=L.useState(0),U=n>1,W=L.useRef(null),G=l(W,d),K=L.useRef([]),q=L.useRef(!1),J=c??V,Y=i((e,t=!1)=>{if((u??H)(e),t){let t=K.current[e];P(W.current,t,s,o)}}),X=i(e=>{if(e.size===0||q.current)return;q.current=!0;let t=Array.from(e.keys()),n=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,r=n?t.indexOf(n):-1;r!==-1&&Y(r),P(W.current,n,s,o)}),Z=L.useMemo(()=>({"aria-orientation":o===`both`?void 0:o,ref:G,onFocus(e){!W.current||!j(e.target)||e.target.setSelectionRange(0,e.target.value.length??0)},onKeyDown(e){let i=C?y:O;if(!i.has(e.key)||B(e,z)||!W.current)return;let c=s===`rtl`,l=c?x:w,u={horizontal:l,vertical:E,both:l}[o],d=c?w:x,P={horizontal:d,vertical:A,both:d}[o];if(j(e.target)&&!F(e.target)){let t=e.target.selectionStart,n=e.target.selectionEnd,r=e.target.value??``;if(t==null||e.shiftKey||t!==n||e.key!==P&&t<r.length||e.key!==u&&t>0)return}let L=J,R=m(K,I),V=_(K,I);if(U){let i=t||Array.from({length:K.current.length},()=>({width:1,height:1})),s=b(i,n,a),l=s.findIndex(e=>e!=null&&!h(K,e,I)),u=s.reduce((e,t,n)=>t!=null&&!h(K,t,I)?n:e,-1);L=s[M({current:s.map(e=>e?K.current[e]:null)},{event:e,orientation:o,loopFocus:r,cols:n,disabledIndices:f([...I||K.current.map((e,t)=>h(K,t)?t:void 0),void 0],s),minIndex:l,maxIndex:u,prevIndex:g(J>V?R:J,i,s,n,e.key===`ArrowDown`?`bl`:e.key===`ArrowRight`?`tr`:`tl`),rtl:c})]}let H={horizontal:[l],vertical:[E],both:[l,E]}[o],G={horizontal:[d],vertical:[A],both:[d,A]}[o],q=U?i:{horizontal:C?T:D,vertical:C?v:S,both:i}[o];C&&(e.key===`Home`?L=R:e.key===`End`&&(L=V)),L===J&&(H.includes(e.key)||G.includes(e.key))&&(L=r&&L===V&&H.includes(e.key)?R:r&&L===R&&G.includes(e.key)?V:N(K,{startingIndex:L,decrement:G.includes(e.key),disabledIndices:I})),L!==J&&!p(K,L)&&(k&&e.stopPropagation(),q.has(e.key)&&e.preventDefault(),Y(L,!0),queueMicrotask(()=>{K.current[L]?.focus()}))}}),[n,a,s,I,K,C,J,U,t,r,G,z,Y,o,k]);return L.useMemo(()=>({props:Z,highlightedIndex:J,onHighlightedIndexChange:Y,elementsRef:K,disabledIndices:I,onMapChange:X,relayKeyboardEvent:Z.onKeyDown}),[Z,J,Y,K,I,X])}function B(e,t){for(let n of C.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}var V=n();function H(e){let{render:t,className:n,refs:r=s,props:i=s,state:l=c,stateAttributesMapping:u,highlightedIndex:f,onHighlightedIndexChange:p,orientation:m,dense:h,itemSizes:g,loopFocus:_,cols:v,enableHomeAndEndKeys:y,onMapChange:b,stopEventPropagation:x=!0,rootRef:S,disabledIndices:C,modifierKeys:w,highlightItemOnHover:T=!1,tag:E=`div`,...D}=e,{props:O,highlightedIndex:A,onHighlightedIndexChange:j,elementsRef:M,onMapChange:N,relayKeyboardEvent:P}=z({itemSizes:g,cols:v,loopFocus:_,dense:h,orientation:m,highlightedIndex:f,onHighlightedIndexChange:p,rootRef:S,stopEventPropagation:x,enableHomeAndEndKeys:y,direction:d(),disabledIndices:C,modifierKeys:w}),F=o(E,e,{state:l,ref:r,props:[O,...i,D],stateAttributesMapping:u}),I=L.useMemo(()=>({highlightedIndex:A,onHighlightedIndexChange:j,highlightItemOnHover:T,relayKeyboardEvent:P}),[A,j,T,P]);return(0,V.jsx)(a.Provider,{value:I,children:(0,V.jsx)(k,{elementsRef:M,onMapChange:e=>{b?.(e),N(e)},children:F})})}var U=r();function W(e){let t=(0,U.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=u(`border-input dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 rounded-lg border bg-transparent px-2.5 py-2 text-base transition-colors focus-visible:ring-[3px] aria-invalid:ring-[3px] md:text-sm placeholder:text-muted-foreground flex field-sizing-content min-h-16 w-full outline-none disabled:cursor-not-allowed disabled:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,V.jsx)(`textarea`,{"data-slot":`textarea`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}export{H as n,I as r,W as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./compiler-runtime-DCc3R3Xn.js";import{n,t as r}from"./createReactComponent-_L2mp4Ui.js";import{a as i,d as a,i as o,n as s,t as c}from"./dropdown-menu-CrGReNWD.js";import{W as l}from"./index-ClzxEm7R.js";var u=r(`outline`,`device-desktop`,`DeviceDesktop`,[[`path`,{d:`M3 5a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-10`,key:`svg-0`}],[`path`,{d:`M7 20h10`,key:`svg-1`}],[`path`,{d:`M9 16v4`,key:`svg-2`}],[`path`,{d:`M15 16v4`,key:`svg-3`}]]),d=r(`outline`,`moon`,`Moon`,[[`path`,{d:`M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454l0 .008`,key:`svg-0`}]]),f=r(`outline`,`sun`,`Sun`,[[`path`,{d:`M8 12a4 4 0 1 0 8 0a4 4 0 1 0 -8 0`,key:`svg-0`}],[`path`,{d:`M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7`,key:`svg-1`}]]),p=t(),m=e();function h(){let e=(0,p.c)(8),{theme:t,setTheme:r}=l(),h;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,m.jsx)(n,{variant:`ghost`,size:`icon`}),e[0]=h):h=e[0];let g;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,m.jsxs)(a,{render:h,"aria-label":`Toggle theme`,children:[(0,m.jsx)(f,{size:16,stroke:2,className:`rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,m.jsx)(d,{size:16,stroke:2,className:`absolute rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`})]}),e[1]=g):g=e[1];let _;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,m.jsxs)(i,{value:`light`,children:[(0,m.jsx)(f,{size:16,stroke:2,className:`mr-2`}),`Light`]}),e[2]=_):_=e[2];let v;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,m.jsxs)(i,{value:`dark`,children:[(0,m.jsx)(d,{size:16,stroke:2,className:`mr-2`}),`Dark`]}),e[3]=v):v=e[3];let y;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,m.jsxs)(i,{value:`system`,children:[(0,m.jsx)(u,{size:16,stroke:2,className:`mr-2`}),`System`]}),e[4]=y):y=e[4];let b;return e[5]!==r||e[6]!==t?(b=(0,m.jsxs)(c,{children:[g,(0,m.jsx)(s,{align:`end`,children:(0,m.jsxs)(o,{value:t,onValueChange:r,children:[_,v,y]})})]}),e[5]=r,e[6]=t,e[7]=b):b=e[7],b}export{h as t};
1
+ import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./compiler-runtime-DCc3R3Xn.js";import{n,t as r}from"./createReactComponent-_L2mp4Ui.js";import{a as i,d as a,i as o,n as s,t as c}from"./dropdown-menu-Bb-uhONR.js";import{L as l}from"./index-B4tzcC1c.js";var u=r(`outline`,`device-desktop`,`DeviceDesktop`,[[`path`,{d:`M3 5a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-10`,key:`svg-0`}],[`path`,{d:`M7 20h10`,key:`svg-1`}],[`path`,{d:`M9 16v4`,key:`svg-2`}],[`path`,{d:`M15 16v4`,key:`svg-3`}]]),d=r(`outline`,`moon`,`Moon`,[[`path`,{d:`M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454l0 .008`,key:`svg-0`}]]),f=r(`outline`,`sun`,`Sun`,[[`path`,{d:`M8 12a4 4 0 1 0 8 0a4 4 0 1 0 -8 0`,key:`svg-0`}],[`path`,{d:`M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7`,key:`svg-1`}]]),p=t(),m=e();function h(){let e=(0,p.c)(8),{theme:t,setTheme:r}=l(),h;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,m.jsx)(n,{variant:`ghost`,size:`icon`}),e[0]=h):h=e[0];let g;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,m.jsxs)(a,{render:h,"aria-label":`Toggle theme`,children:[(0,m.jsx)(f,{size:16,stroke:2,className:`rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,m.jsx)(d,{size:16,stroke:2,className:`absolute rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`})]}),e[1]=g):g=e[1];let _;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,m.jsxs)(i,{value:`light`,children:[(0,m.jsx)(f,{size:16,stroke:2,className:`mr-2`}),`Light`]}),e[2]=_):_=e[2];let v;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,m.jsxs)(i,{value:`dark`,children:[(0,m.jsx)(d,{size:16,stroke:2,className:`mr-2`}),`Dark`]}),e[3]=v):v=e[3];let y;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,m.jsxs)(i,{value:`system`,children:[(0,m.jsx)(u,{size:16,stroke:2,className:`mr-2`}),`System`]}),e[4]=y):y=e[4];let b;return e[5]!==r||e[6]!==t?(b=(0,m.jsxs)(c,{children:[g,(0,m.jsx)(s,{align:`end`,children:(0,m.jsxs)(o,{value:t,onValueChange:r,children:[_,v,y]})})]}),e[5]=r,e[6]=t,e[7]=b):b=e[7],b}export{h as t};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,g as a,n as o,o as s,y as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./utils-C8DGLIgm.js";import{t as u}from"./IconX-BQkA009b.js";import{A as d,E as f,T as p,b as m,m as h,o as g}from"./removable-BfDesq3B.js";import{_,c as v,l as y}from"./getDisabledMountTransitionStyles-Co-5TcgR.js";import{t as b}from"./useBaseUiId-BLFGpnYJ.js";import{c as x}from"./getPseudoElementBounds-BefWKytd.js";import{I as S,R as C,z as w}from"./index-B4tzcC1c.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-XJoEl7im.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??w();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`);S.error(i),o?.(e,t)},t[0]=c,t[1]=o,t[2]=l,t[3]=r,t[4]=u):u=t[4];let d;t[5]!==i||t[6]!==l||t[7]!==r?(d=async e=>{await l.cancelQueries({queryKey:r});let t=l.getQueryData(r);return t!==void 0&&l.setQueryData(r,t=>t===void 0?t:i(t,e)),{previousData:t}},t[5]=i,t[6]=l,t[7]=r,t[8]=d):d=t[8];let f;t[9]!==l||t[10]!==r?(f=()=>{l.invalidateQueries({queryKey:r})},t[9]=l,t[10]=r,t[11]=f):f=t[11];let p;t[12]!==a||t[13]!==s?(p=(e,t)=>{s&&S.success(s),a?.(e,t)},t[12]=a,t[13]=s,t[14]=p):p=t[14];let m;t[15]!==n||t[16]!==u||t[17]!==d||t[18]!==f||t[19]!==p?(m={mutationFn:n,onError:u,onMutate:d,onSettled:f,onSuccess:p},t[15]=n,t[16]=u,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h=F(m),g=h.mutate,_=h.mutateAsync,v;return t[21]!==h.isError||t[22]!==h.isPending||t[23]!==h.isSuccess||t[24]!==g||t[25]!==_?(v={isError:h.isError,isPending:h.isPending,isSuccess:h.isSuccess,mutate:g,mutateAsync:_},t[21]=h.isError,t[22]=h.isPending,t[23]=h.isSuccess,t[24]=g,t[25]=_,t[26]=v):v=t[26],v}function Y({mutationFn:e,queryKey:t,itemId:n,getId:r=e=>e.id,onSuccess:i,onError:a,successMessage:o,errorMessage:s=`Failed to delete`}){return J({errorMessage:s,mutationFn:async()=>e(),onError:a?e=>a(e):void 0,onSuccess:i?e=>i(e):void 0,optimisticUpdate:e=>e.filter(e=>r(e)!==n),queryKey:t,successMessage:o})}function X(e){let t=(0,L.c)(10),{mutationFn:n,queryKey:r,createOptimisticItem:i,onSuccess:a,onError:o,successMessage:s,errorMessage:c}=e,l;t[0]===i?l=t[1]:(l=(e,t)=>[...e,i(t)],t[0]=i,t[1]=l);let u;return t[2]!==c||t[3]!==n||t[4]!==o||t[5]!==a||t[6]!==r||t[7]!==s||t[8]!==l?(u={errorMessage:c,mutationFn:n,onError:o,onSuccess:a,optimisticUpdate:l,queryKey:r,successMessage:s},t[2]=c,t[3]=n,t[4]=o,t[5]=a,t[6]=r,t[7]=s,t[8]=l,t[9]=u):u=t[9],J(u)}export{q as a,K as c,U as i,B as l,Y as n,G as o,z as r,W as s,X as t,F as u};
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{A as r,C as i,E as a,O as o,S as s,T as c,_ as l,b as u,c as d,g as f,k as p,o as m,s as h,w as g}from"./removable-BfDesq3B.js";import{G as _,q as v}from"./index-ClzxEm7R.js";var y=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=h(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),x(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return S(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return S(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!c(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&C(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let a=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||a!==this.#p)&&this.#v(a)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return T(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u)),t}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(f||this.#r.isStale||!l(e))return;let t=o(this.#r.dataUpdatedAt,e)+1;this.#d=p.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(f||i(this.options.enabled,this.#t)===!1||!l(this.#p)||this.#p===0)&&(this.#f=p.setInterval(()=>{(this.options.refetchIntervalInBackground||d.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(p.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(p.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,a=this.#r,o=this.#i,c=this.#a,l=e===n?this.#n:e.state,{state:u}=e,d={...u},f=!1,p;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&x(e,t),o=i&&C(e,n,t,r);(a||o)&&(d={...d,...v(u.data,e.options)}),t._optimisticResults===`isRestoring`&&(d.fetchStatus=`idle`)}let{error:m,errorUpdatedAt:g,status:_}=d;p=d.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&_===`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&&(_=`success`,p=s(a?.data,e,t),f=!0)}if(t.select&&p!==void 0&&!y)if(a&&p===o?.data&&t.select===this.#c)p=this.#l;else try{this.#c=t.select,p=t.select(p),p=s(a?.data,p,t),this.#l=p,this.#s=null}catch(e){this.#s=e}this.#s&&(m=this.#s,p=this.#l,g=Date.now(),_=`error`);let b=d.fetchStatus===`fetching`,S=_===`pending`,T=_===`error`,E=S&&b,D=p!==void 0,O={status:_,fetchStatus:d.fetchStatus,isPending:S,isSuccess:_===`success`,isError:T,isInitialLoading:E,isLoading:E,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:b,isRefetching:b&&!S,isLoadingError:T&&!D,isPaused:d.fetchStatus===`paused`,isPlaceholderData:f,isRefetchError:T&&D,isStale:w(e,t),refetch:this.refetch,promise:this.#o,isEnabled:i(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},a=()=>{i(this.#o=O.promise=h())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||O.data!==o.value)&&a();break;case`rejected`:(!r||O.error!==o.reason)&&a();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!c(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){m.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function b(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function x(e,t){return b(e,t)||e.state.data!==void 0&&S(e,t,t.refetchOnMount)}function S(e,t,n){if(i(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&w(e,t)}return!1}function C(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&w(e,n)}function w(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}function T(e,t){return!c(e.getCurrentResult(),t)}var E=e(t(),1),D=E.createContext(!1),O=()=>E.useContext(D);D.Provider,n();function k(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var A=E.createContext(k()),j=()=>E.useContext(A),M=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?a(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},N=e=>{E.useEffect(()=>{e.clearReset()},[e])},P=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||a(n,[e.error,r])),F=(e,t)=>t.state.data===void 0,I=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},L=(e,t)=>e.isLoading&&e.isFetching&&!t,R=(e,t)=>e?.suspense&&t.isPending,z=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function B(e,t,n){let r=O(),i=j(),a=_(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,I(o),M(o,i,s),N(i);let c=!a.getQueryCache().get(o.queryHash),[l]=E.useState(()=>new t(a,o)),d=l.getOptimisticResult(o),p=!r&&e.subscribed!==!1;if(E.useSyncExternalStore(E.useCallback(e=>{let t=p?l.subscribe(m.batchCalls(e)):u;return l.updateResult(),t},[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),E.useEffect(()=>{l.setOptions(o)},[o,l]),R(o,d))throw z(o,l,i);if(P({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!f&&L(d,r)&&(c?z(o,l,i):s?.promise)?.catch(u).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?d:l.trackResult(d)}export{F as n,y as r,B as t};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{A as r,C as i,E as a,O as o,S as s,T as c,_ as l,b as u,c as d,g as f,k as p,o as m,s as h,w as g}from"./removable-BfDesq3B.js";import{B as _,R as v}from"./index-B4tzcC1c.js";var y=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=h(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),x(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return S(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return S(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!c(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&C(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let a=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||a!==this.#p)&&this.#v(a)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return T(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u)),t}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(f||this.#r.isStale||!l(e))return;let t=o(this.#r.dataUpdatedAt,e)+1;this.#d=p.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(f||i(this.options.enabled,this.#t)===!1||!l(this.#p)||this.#p===0)&&(this.#f=p.setInterval(()=>{(this.options.refetchIntervalInBackground||d.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(p.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(p.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,a=this.#r,o=this.#i,c=this.#a,l=e===n?this.#n:e.state,{state:u}=e,d={...u},f=!1,p;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&x(e,t),o=i&&C(e,n,t,r);(a||o)&&(d={...d,..._(u.data,e.options)}),t._optimisticResults===`isRestoring`&&(d.fetchStatus=`idle`)}let{error:m,errorUpdatedAt:g,status:v}=d;p=d.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&v===`pending`){let e;a?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=a.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(v=`success`,p=s(a?.data,e,t),f=!0)}if(t.select&&p!==void 0&&!y)if(a&&p===o?.data&&t.select===this.#c)p=this.#l;else try{this.#c=t.select,p=t.select(p),p=s(a?.data,p,t),this.#l=p,this.#s=null}catch(e){this.#s=e}this.#s&&(m=this.#s,p=this.#l,g=Date.now(),v=`error`);let b=d.fetchStatus===`fetching`,S=v===`pending`,T=v===`error`,E=S&&b,D=p!==void 0,O={status:v,fetchStatus:d.fetchStatus,isPending:S,isSuccess:v===`success`,isError:T,isInitialLoading:E,isLoading:E,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:b,isRefetching:b&&!S,isLoadingError:T&&!D,isPaused:d.fetchStatus===`paused`,isPlaceholderData:f,isRefetchError:T&&D,isStale:w(e,t),refetch:this.refetch,promise:this.#o,isEnabled:i(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},a=()=>{i(this.#o=O.promise=h())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||O.data!==o.value)&&a();break;case`rejected`:(!r||O.error!==o.reason)&&a();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!c(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){m.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function b(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function x(e,t){return b(e,t)||e.state.data!==void 0&&S(e,t,t.refetchOnMount)}function S(e,t,n){if(i(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&w(e,t)}return!1}function C(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&w(e,n)}function w(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}function T(e,t){return!c(e.getCurrentResult(),t)}var E=e(t(),1),D=E.createContext(!1),O=()=>E.useContext(D);D.Provider,n();function k(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var A=E.createContext(k()),j=()=>E.useContext(A),M=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?a(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},N=e=>{E.useEffect(()=>{e.clearReset()},[e])},P=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||a(n,[e.error,r])),F=(e,t)=>t.state.data===void 0,I=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},L=(e,t)=>e.isLoading&&e.isFetching&&!t,R=(e,t)=>e?.suspense&&t.isPending,z=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function B(e,t,n){let r=O(),i=j(),a=v(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,I(o),M(o,i,s),N(i);let c=!a.getQueryCache().get(o.queryHash),[l]=E.useState(()=>new t(a,o)),d=l.getOptimisticResult(o),p=!r&&e.subscribed!==!1;if(E.useSyncExternalStore(E.useCallback(e=>{let t=p?l.subscribe(m.batchCalls(e)):u;return l.updateResult(),t},[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),E.useEffect(()=>{l.setOptions(o)},[o,l]),R(o,d))throw z(o,l,i);if(P({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!f&&L(d,r)&&(c?z(o,l,i):s?.promise)?.catch(u).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?d:l.trackResult(d)}export{F as n,y as r,B as t};
@@ -1 +1 @@
1
- import{i as e,n as t}from"./jsx-runtime-DG_AJzB_.js";import{h as n,v as r}from"./createReactComponent-_L2mp4Ui.js";import{i}from"./CompositeList-CX7HHxYw.js";var a=e(t());function o(e={}){let{highlightItemOnHover:t,highlightedIndex:o,onHighlightedIndexChange:s}=r(),{ref:c,index:l}=i(e),u=o===l,d=a.useRef(null),f=n(c,d);return{compositeProps:a.useMemo(()=>({tabIndex:u?0:-1,onFocus(){s(l)},onMouseMove(){let e=d.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!u&&!n&&e.focus()}}),[u,s,l,t]),compositeRef:f,index:l}}export{o as t};
1
+ import{i as e,n as t}from"./jsx-runtime-DG_AJzB_.js";import{h as n,v as r}from"./createReactComponent-_L2mp4Ui.js";import{i}from"./CompositeList-FRTEqUDK.js";var a=e(t());function o(e={}){let{highlightItemOnHover:t,highlightedIndex:o,onHighlightedIndexChange:s}=r(),{ref:c,index:l}=i(e),u=o===l,d=a.useRef(null),f=n(c,d);return{compositeProps:a.useMemo(()=>({tabIndex:u?0:-1,onFocus(){s(l)},onMouseMove(){let e=d.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!u&&!n&&e.focus()}}),[u,s,l,t]),compositeRef:f,index:l}}export{o as t};
@@ -0,0 +1 @@
1
+ import{r as e,t}from"./useBaseQuery-O7HCqjpX.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-O7HCqjpX.js";function r(r,i){return n({...r,enabled:!0,suspense:!0,throwOnError:e,placeholderData:void 0},t,i)}export{r as t};