@onequery/cli 0.1.34-win32-x64 → 0.1.35-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 (155) hide show
  1. package/package.json +3 -3
  2. package/vendor/{x86_64-pc-windows-msvc/onequery/onequery.exe → aarch64-apple-darwin/onequery/onequery} +0 -0
  3. package/vendor/aarch64-apple-darwin/runtime/migrations/20260420071232_previous_justin_hammer.sql +141 -0
  4. package/vendor/aarch64-apple-darwin/runtime/migrations/20260420093157_spooky_cassandra_nova.sql +29 -0
  5. package/vendor/aarch64-apple-darwin/runtime/migrations/20260420101631_even_ogun.sql +5 -0
  6. package/vendor/aarch64-apple-darwin/runtime/migrations/meta/20260420071232_snapshot.json +3879 -0
  7. package/vendor/aarch64-apple-darwin/runtime/migrations/meta/20260420093157_snapshot.json +4088 -0
  8. package/vendor/aarch64-apple-darwin/runtime/migrations/meta/20260420101631_snapshot.json +3250 -0
  9. package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/_journal.json +21 -0
  10. package/vendor/aarch64-apple-darwin/runtime/web/assets/DialogTitle-DQANwbFs.js +1 -0
  11. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/_authenticated-DZPwfG3P.js → aarch64-apple-darwin/runtime/web/assets/_authenticated-CPN5v5Qw.js} +1 -1
  12. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/_org_slug-ZU7MFtro.js → aarch64-apple-darwin/runtime/web/assets/_org_slug-C7xefgZr.js} +1 -1
  13. package/vendor/aarch64-apple-darwin/runtime/web/assets/api-client-B2Cc7TWF.js +1 -0
  14. package/vendor/aarch64-apple-darwin/runtime/web/assets/audit-DgMDHyai.js +1 -0
  15. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/auth-bootstrap-query-CrWpT3WV.js → aarch64-apple-darwin/runtime/web/assets/auth-bootstrap-query-DlVmn2Fg.js} +1 -1
  16. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/auth-client-BlMeXgb4.js → aarch64-apple-darwin/runtime/web/assets/auth-client-DF1BsKzX.js} +1 -1
  17. package/vendor/aarch64-apple-darwin/runtime/web/assets/budget-CuOb-QPS.js +1 -0
  18. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/callback-B2lVZz5B.js → aarch64-apple-darwin/runtime/web/assets/callback-BkIYoADQ.js} +1 -1
  19. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/connect-database-BqVJwGWx.js → aarch64-apple-darwin/runtime/web/assets/connect-database-DgqtQjhR.js} +1 -1
  20. package/vendor/aarch64-apple-darwin/runtime/web/assets/create-org-CuqskeZt.js +1 -0
  21. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/data-source-connection-form-BKMHkF5S.js → aarch64-apple-darwin/runtime/web/assets/data-source-connection-form-H4N0pMiV.js} +2 -2
  22. package/vendor/aarch64-apple-darwin/runtime/web/assets/device-CCl13UTx.js +1 -0
  23. package/vendor/aarch64-apple-darwin/runtime/web/assets/dist-DAhKd1f7.js +2 -0
  24. package/vendor/aarch64-apple-darwin/runtime/web/assets/dropdown-menu-B6HlzguP.js +1 -0
  25. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/home-CcG2qLve.js → aarch64-apple-darwin/runtime/web/assets/home-DYXsI4sQ.js} +1 -1
  26. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/index-DGnxvx_K.css → aarch64-apple-darwin/runtime/web/assets/index-BS5Fb-IS.css} +1 -1
  27. package/vendor/aarch64-apple-darwin/runtime/web/assets/index-crEoj0do.js +10 -0
  28. package/vendor/aarch64-apple-darwin/runtime/web/assets/integrations-C3M7fwcd.js +1 -0
  29. package/vendor/aarch64-apple-darwin/runtime/web/assets/invite._invitationId-D-pQ_OmE.js +1 -0
  30. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/routes-BBWQP8ei.js → aarch64-apple-darwin/runtime/web/assets/routes-CKUAZtr8.js} +1 -1
  31. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/schemas-MsKXD_XQ.js → aarch64-apple-darwin/runtime/web/assets/schemas-n4sxh6jF.js} +2 -2
  32. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/signin-D87M0GJg.js → aarch64-apple-darwin/runtime/web/assets/signin-CF1sHLeY.js} +1 -1
  33. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/team-DOt1TVvS.js → aarch64-apple-darwin/runtime/web/assets/team-BRfBcT47.js} +1 -1
  34. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/theme-toggle-D-rc6UzS.js → aarch64-apple-darwin/runtime/web/assets/theme-toggle-DGw9lP2H.js} +1 -1
  35. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/use-optimistic-mutation-B6q6iB7T.js → aarch64-apple-darwin/runtime/web/assets/use-optimistic-mutation-BatdZy6t.js} +1 -1
  36. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/useBaseQuery-Bwqdm4hJ.js → aarch64-apple-darwin/runtime/web/assets/useBaseQuery-KlKRyws_.js} +1 -1
  37. package/vendor/aarch64-apple-darwin/runtime/web/assets/useQuery-K2VcQGgJ.js +1 -0
  38. package/vendor/aarch64-apple-darwin/runtime/web/assets/useSuspenseQuery-B2g_FID5.js +1 -0
  39. package/vendor/aarch64-apple-darwin/runtime/web/assets/xstate-react.esm-DhUG3dob.js +1 -0
  40. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/zod-C2fx2RN8.js → aarch64-apple-darwin/runtime/web/assets/zod-D58ea2dv.js} +1 -1
  41. package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/index.html +5 -5
  42. package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/server/onequery-server.mjs +11214 -6865
  43. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/DialogTitle-C7S-GNch.js +0 -1
  44. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/api-client-w1GRwBWy.js +0 -1
  45. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/audit-WhwKqWGH.js +0 -1
  46. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/budget-C3tdfVeU.js +0 -1
  47. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/create-org-Dk-TmEGt.js +0 -1
  48. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/device-Q4ZN6Fdq.js +0 -1
  49. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/dropdown-menu-BhdkLmzJ.js +0 -1
  50. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/index-DthpwdlN.js +0 -10
  51. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/integrations-CqOQH6vO.js +0 -1
  52. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/invite._invitationId-CJlS2Hoi.js +0 -1
  53. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/useQuery-BCl2C7k4.js +0 -1
  54. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/useSuspenseQuery-BoUwwhvS.js +0 -1
  55. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/xstate-react.esm-BlF76DuP.js +0 -1
  56. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260327065242_curious_nightmare.sql +0 -0
  57. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260403103652_slippery_hellfire_club.sql +0 -0
  58. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260403112219_gigantic_namora.sql +0 -0
  59. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260327065242_snapshot.json +0 -0
  60. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260403103652_snapshot.json +0 -0
  61. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260403112219_snapshot.json +0 -0
  62. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/initdb.wasm +0 -0
  63. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/pglite.data +0 -0
  64. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/pglite.wasm +0 -0
  65. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/sql-parser/sql_parser_wasm_bg.wasm +0 -0
  66. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/CompositeItem-D3nXGtvr.js +0 -0
  67. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/CompositeList-CX7HHxYw.js +0 -0
  68. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconArrowRight-DsOD7mDl.js +0 -0
  69. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconCheck-Gc24xPT2.js +0 -0
  70. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconChevronDown-B-39MA7-.js +0 -0
  71. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconCoins-C7Nn0L6R.js +0 -0
  72. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconHistory-BqAd-xl2.js +0 -0
  73. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconLoader2-B3B6M8nQ.js +0 -0
  74. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconPlus-C3-kRhGX.js +0 -0
  75. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconX-BQkA009b.js +0 -0
  76. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/Separator-vw4jPN_6.js +0 -0
  77. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/api-base-url-DIb6qukm.js +0 -0
  78. /package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/api-paths-ClEWWGwS.js → aarch64-apple-darwin/runtime/web/assets/api-paths-Cjr2f6P6.js} +0 -0
  79. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/app-routes-CnJncMlZ.js +0 -0
  80. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/avatar-B8g7WJsq.js +0 -0
  81. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/badge-C1_ZMBRy.js +0 -0
  82. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/card-Bsy6azfK.js +0 -0
  83. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/checkbox-CJcCVDm9.js +0 -0
  84. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/compiler-runtime-DCc3R3Xn.js +0 -0
  85. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/createReactComponent-_L2mp4Ui.js +0 -0
  86. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/empty-COnWCwda.js +0 -0
  87. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/format-date-Ctrh7my1.js +0 -0
  88. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/getDisabledMountTransitionStyles-BYKRz4ha.js +0 -0
  89. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/getPseudoElementBounds-InhM-dWf.js +0 -0
  90. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/input-CG_cIxvO.js +0 -0
  91. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  92. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  93. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  94. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  95. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  96. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  97. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  98. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/jsx-runtime-DG_AJzB_.js +0 -0
  99. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/label-CWOhoN_L.js +0 -0
  100. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/link-Cgvqhh5w.js +0 -0
  101. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/matchContext-CDajBC0L.js +0 -0
  102. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/organization-permissions-BQQ5PJbI.js +0 -0
  103. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/organization-query-keys-DwLucsD_.js +0 -0
  104. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/query-timing-LGzitMXx.js +0 -0
  105. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/queryOptions-BHw87wTZ.js +0 -0
  106. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/removable-BfDesq3B.js +0 -0
  107. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/select-D6km4Obp.js +0 -0
  108. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/separator-CWltZvB_.js +0 -0
  109. /package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/settings-5_Ep5M2N.js → aarch64-apple-darwin/runtime/web/assets/settings-C6cYEB0P.js} +0 -0
  110. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/src-DCIPwIx0.js +0 -0
  111. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/table-DCvfJyLS.js +0 -0
  112. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/textarea-DiU04l_U.js +0 -0
  113. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useBaseUiId-BLFGpnYJ.js +0 -0
  114. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useCompositeItem-BsMHgRi0.js +0 -0
  115. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useControlled-B8q0aJoo.js +0 -0
  116. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useRender-B2c9_UYd.js +0 -0
  117. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useRouterState-DpT8luFk.js +0 -0
  118. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useValueChanged-CqxkrqWn.js +0 -0
  119. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/utils-C8DGLIgm.js +0 -0
  120. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/favicon.ico +0 -0
  121. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step1_settings_sidebar.png +0 -0
  122. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step2_projects.png +0 -0
  123. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step3_project_keys.png +0 -0
  124. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step4_api_keys.png +0 -0
  125. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step1_service_accounts.png +0 -0
  126. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step2_bigquery_roles.png +0 -0
  127. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step3_add_key_menu.png +0 -0
  128. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step4_create_json_key.png +0 -0
  129. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step1_service_accounts.png +0 -0
  130. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step2_create_json_key.png +0 -0
  131. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step3_add_user_viewer.png +0 -0
  132. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step4_property_details.png +0 -0
  133. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step1_signin.png +0 -0
  134. /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
  135. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step3_permissions_configured_sanitized.png +0 -0
  136. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step4_token_created_sanitized.png +0 -0
  137. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step1_service_accounts.png +0 -0
  138. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step2_create_service_account.png +0 -0
  139. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step3_credentials.png +0 -0
  140. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step4_project_settings.png +0 -0
  141. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/postgresql/step1_create_user.png +0 -0
  142. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/postgresql/step2_connection.png +0 -0
  143. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/posthog/step1_project_settings.png +0 -0
  144. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/posthog/step2_personal_api_keys.png +0 -0
  145. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/posthog/step3_create_key_modal.png +0 -0
  146. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step1_connect.png +0 -0
  147. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step2_create_user.png +0 -0
  148. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step3_grant.png +0 -0
  149. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step4_info.png +0 -0
  150. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step1_personal_tokens.png +0 -0
  151. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step2_create_token_permissions.png +0 -0
  152. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step3_organization_slug.png +0 -0
  153. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step4_project_slug.png +0 -0
  154. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/linear.svg +0 -0
  155. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/onequery.svg +0 -0
@@ -22,6 +22,27 @@
22
22
  "when": 1775215339838,
23
23
  "tag": "20260403112219_gigantic_namora",
24
24
  "breakpoints": true
25
+ },
26
+ {
27
+ "idx": 3,
28
+ "version": "7",
29
+ "when": 1776669152203,
30
+ "tag": "20260420071232_previous_justin_hammer",
31
+ "breakpoints": true
32
+ },
33
+ {
34
+ "idx": 4,
35
+ "version": "7",
36
+ "when": 1776677517280,
37
+ "tag": "20260420093157_spooky_cassandra_nova",
38
+ "breakpoints": true
39
+ },
40
+ {
41
+ "idx": 5,
42
+ "version": "7",
43
+ "when": 1776680191903,
44
+ "tag": "20260420101631_even_ogun",
45
+ "breakpoints": true
25
46
  }
26
47
  ]
27
48
  }
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{C as r,S as i,a,g as o,y as s}from"./createReactComponent-_L2mp4Ui.js";import{S as c,a as l,at as u,b as d,d as f,f as p,g as m,l as h,nt as g,o as _,p as v,y}from"./getDisabledMountTransitionStyles-BYKRz4ha.js";import{d as b}from"./CompositeList-CX7HHxYw.js";import{c as x,i as S,n as C,t as w}from"./useBaseUiId-BLFGpnYJ.js";import{a as T,i as E,l as D,n as O,r as k}from"./getPseudoElementBounds-InhM-dWf.js";import{n as A}from"./Separator-vw4jPN_6.js";import{F as j,I as M,L as N,R as P,z as F}from"./index-crEoj0do.js";var I=e(t()),L=I.createContext(void 0);function R(e){let t=I.useContext(L);if(e===!1&&t===void 0)throw Error(s(27));return t}var z={..._,...v},B=I.forwardRef(function(e,t){let{render:n,className:r,forceRender:i=!1,...o}=e,{store:s}=R(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`),d=s.useState(`transitionStatus`);return a(`div`,e,{state:I.useMemo(()=>({open:c,transitionStatus:d}),[c,d]),ref:[s.context.backdropRef,t],stateAttributesMapping:z,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:i||!l})}),V=I.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:s=!0,...c}=e,{store:l}=R(),u=l.useState(`open`);function d(e){u&&l.setOpen(!1,C(S,e.nativeEvent))}let{getButtonProps:f,buttonRef:p}=o({disabled:i,native:s});return a(`button`,e,{state:I.useMemo(()=>({disabled:i}),[i]),ref:[t,p],props:[{onClick:d},c,f]})}),H=I.forwardRef(function(e,t){let{render:n,className:r,id:i,...o}=e,{store:s}=R(),c=w(i);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),a(`p`,e,{ref:t,props:[{id:c},o]})}),U=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),W=function(e){return e[e.open=l.open]=`open`,e[e.closed=l.closed]=`closed`,e[e.startingStyle=l.startingStyle]=`startingStyle`,e[e.endingStyle=l.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),G=I.createContext(void 0);function K(){let e=I.useContext(G);if(e===void 0)throw Error(s(26));return e}var q=n(),J={..._,...v,nestedDialogOpen(e){return e?{[W.nestedDialogOpen]:``}:null}},Y=I.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:o,...s}=e,{store:c}=R(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),m=c.useState(`modal`),h=c.useState(`mounted`),g=c.useState(`nested`),_=c.useState(`nestedOpenDialogCount`),v=c.useState(`open`),y=c.useState(`openMethod`),x=c.useState(`titleElementId`),S=c.useState(`transitionStatus`),C=c.useState(`role`);K(),p({open:v,ref:c.context.popupRef,onComplete(){v&&c.context.onOpenChangeComplete?.(!0)}});function w(e){return e===`touch`?c.context.popupRef.current:!0}let T=i===void 0?w:i,E=_>0,O=a(`div`,e,{state:I.useMemo(()=>({open:v,nested:g,transitionStatus:S,nestedDialogOpen:E}),[v,g,S,E]),props:[f,{"aria-labelledby":x??void 0,"aria-describedby":l??void 0,role:C,tabIndex:-1,hidden:!h,onKeyDown(e){b.has(e.key)&&e.stopPropagation()},style:{[U.nestedDialogs]:_}},s],ref:[t,c.context.popupRef,c.useStateSetter(`popupElement`)],stateAttributesMapping:J});return(0,q.jsx)(D,{context:d,openInteractionType:y,disabled:!h,closeOnFocusOut:!u,initialFocus:T,returnFocus:r,modal:m!==!1,restoreFocus:`popup`,children:O})}),X=I.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=R(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,q.jsx)(G.Provider,{value:n,children:(0,q.jsxs)(c,{ref:t,...r,children:[a&&o===!0&&(0,q.jsx)(E,{ref:i.context.internalBackdropRef,inert:T(!s)}),e.children]})}):null});function Z(e){let{store:t,parentContext:n,actionsRef:r}=e,a=t.useState(`open`),o=t.useState(`disablePointerDismissal`),s=t.useState(`modal`),c=t.useState(`popupElement`),{openMethod:l,triggerProps:f,reset:p}=O(a);P(t);let{forceUnmount:m}=F(a,t,()=>{p()}),_=i(e=>{let n=C(e);return n.preventUnmountOnClose=()=>{t.set(`preventUnmountingOnClose`,!0)},n}),v=I.useCallback(()=>{t.setOpen(!1,_(x))},[t,_]);I.useImperativeHandle(r,()=>({unmount:m,close:v}),[m,v]);let y=j({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[b,S]=I.useState(0),w=b===0,T=A(y),E=d(y,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:s===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=u(e);if(w&&!o){let e=n;return s&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||g(e,c)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:w});k(a&&s===!0,c);let{getReferenceProps:D,getFloatingProps:M,getTriggerProps:N}=h([T,E]);t.useContextCallback(`onNestedDialogOpen`,e=>{S(e+1)}),t.useContextCallback(`onNestedDialogClose`,()=>{S(0)}),I.useEffect(()=>(n?.onNestedDialogOpen&&a&&n.onNestedDialogOpen(b),n?.onNestedDialogClose&&!a&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&a&&n.onNestedDialogClose()}),[a,n,b]);let L=I.useMemo(()=>D(f),[D,f]),R=I.useMemo(()=>N(f),[N,f]),z=I.useMemo(()=>M(),[M]);t.useSyncedValues({openMethod:l,activeTriggerProps:L,inactiveTriggerProps:R,popupProps:z,floatingRootContext:y,nestedOpenDialogCount:b})}var Q={...N,modal:y(e=>e.modal),nested:y(e=>e.nested),nestedOpenDialogCount:y(e=>e.nestedOpenDialogCount),disablePointerDismissal:y(e=>e.disablePointerDismissal),openMethod:y(e=>e.openMethod),descriptionElementId:y(e=>e.descriptionElementId),titleElementId:y(e=>e.titleElementId),viewportElement:y(e=>e.viewportElement),role:y(e=>e.role)},$=class extends m{constructor(e){super(ee(e),{popupRef:I.createRef(),backdropRef:I.createRef(),internalBackdropRef:I.createRef(),triggerElements:new f,onOpenChange:void 0,onOpenChangeComplete:void 0},Q)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;let n={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit(`openchange`,n);let r={open:e},i=t.trigger?.id??null;(i||e)&&(r.activeTriggerId=i,r.activeTriggerElement=t.trigger??null),this.update(r)}};function ee(e={}){return{...M(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:`dialog`,...e}}function te(e){let{children:t,open:n,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=e,p=R(!0),m=!!p,h=r(()=>u?.store??new $({open:n??i,activeTriggerId:d===void 0?f:d,modal:c,disablePointerDismissal:s,nested:m})).current;h.useControlledProp(`open`,n,i),h.useControlledProp(`activeTriggerId`,d,f),h.useSyncedValues({disablePointerDismissal:s,nested:m,modal:c}),h.useContextCallback(`onOpenChange`,a),h.useContextCallback(`onOpenChangeComplete`,o);let g=h.useState(`payload`);Z({store:h,actionsRef:l,parentContext:p?.store.context,onOpenChange:a,triggerIdProp:d});let _=I.useMemo(()=>({store:h}),[h]);return(0,q.jsx)(L.Provider,{value:_,children:typeof t==`function`?t({payload:g}):t})}var ne=I.forwardRef(function(e,t){let{render:n,className:r,id:i,...o}=e,{store:s}=R(),c=w(i);return s.useSyncedValueWithCleanup(`titleElementId`,c),a(`h2`,e,{ref:t,props:[{id:c},o]})});export{H as a,R as c,Y as i,te as n,V as o,X as r,B as s,ne as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./compiler-runtime-DCc3R3Xn.js";import{et as n}from"./index-DthpwdlN.js";var r=t(),i=e();function a(){let e=(0,r.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,i.jsx)(n,{}),e[0]=t):t=e[0],t}export{a as component};
1
+ import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./compiler-runtime-DCc3R3Xn.js";import{tt as n}from"./index-crEoj0do.js";var r=t(),i=e();function a(){let e=(0,r.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,i.jsx)(n,{}),e[0]=t):t=e[0],t}export{a as component};
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./link-Cgvqhh5w.js";import{t as i}from"./compiler-runtime-DCc3R3Xn.js";import{n as a,t as o}from"./useRouterState-DpT8luFk.js";import{a as s,c,o as l}from"./api-base-url-DIb6qukm.js";import{b as u,i as d,n as f,r as p,t as m}from"./createReactComponent-_L2mp4Ui.js";import{t as h}from"./utils-C8DGLIgm.js";import{t as g}from"./IconCheck-Gc24xPT2.js";import{t as _}from"./IconChevronDown-B-39MA7-.js";import{c as v,d as y,l as b,n as x,o as S,r as C,s as w,t as T,u as E}from"./dropdown-menu-BhdkLmzJ.js";import{t as D}from"./IconCoins-C7Nn0L6R.js";import{t as O}from"./theme-toggle-D-rc6UzS.js";import{t as k}from"./IconHistory-BqAd-xl2.js";import{t as A}from"./IconPlus-C3-kRhGX.js";import{t as j}from"./IconX-BQkA009b.js";import{r as M}from"./auth-client-BlMeXgb4.js";import{t as ee}from"./useQuery-BCl2C7k4.js";import{t as N}from"./useSuspenseQuery-BoUwwhvS.js";import{n as te,t as P}from"./organization-permissions-BQQ5PJbI.js";import{D as F,E as ne,O as I,T as L,et as R,k as z,v as re,w as ie}from"./index-DthpwdlN.js";import{t as B}from"./useRender-B2c9_UYd.js";import"./input-CG_cIxvO.js";import{t as V}from"./separator-CWltZvB_.js";import{a as H,i as U,n as W,o as G,r as K,s as q,t as J}from"./DialogTitle-C7S-GNch.js";import{n as Y,t as X}from"./avatar-B8g7WJsq.js";function ae(e){return o({select:t=>e?.select?e.select(t.location):t.location})}var oe=m(`outline`,`home`,`Home`,[[`path`,{d:`M5 12l-2 0l9 -9l9 9l-2 0`,key:`svg-0`}],[`path`,{d:`M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7`,key:`svg-1`}],[`path`,{d:`M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6`,key:`svg-2`}]]),se=m(`outline`,`layout-sidebar`,`LayoutSidebar`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M9 4l0 16`,key:`svg-1`}]]),ce=m(`outline`,`logout`,`Logout`,[[`path`,{d:`M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2`,key:`svg-0`}],[`path`,{d:`M9 12h12l-3 -3`,key:`svg-1`}],[`path`,{d:`M18 15l3 -3`,key:`svg-2`}]]),le=m(`outline`,`plug-connected`,`PlugConnected`,[[`path`,{d:`M7 12l5 5l-1.5 1.5a3.536 3.536 0 1 1 -5 -5l1.5 -1.5`,key:`svg-0`}],[`path`,{d:`M17 12l-5 -5l1.5 -1.5a3.536 3.536 0 1 1 5 5l-1.5 1.5`,key:`svg-1`}],[`path`,{d:`M3 21l2.5 -2.5`,key:`svg-2`}],[`path`,{d:`M18.5 5.5l2.5 -2.5`,key:`svg-3`}],[`path`,{d:`M10 11l-2 2`,key:`svg-4`}],[`path`,{d:`M13 14l-2 2`,key:`svg-5`}]]),ue=m(`outline`,`settings`,`Settings`,[[`path`,{d:`M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065`,key:`svg-0`}],[`path`,{d:`M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0`,key:`svg-1`}]]),de=m(`outline`,`users`,`Users`,[[`path`,{d:`M5 7a4 4 0 1 0 8 0a4 4 0 1 0 -8 0`,key:`svg-0`}],[`path`,{d:`M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2`,key:`svg-1`}],[`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`,key:`svg-2`}],[`path`,{d:`M21 21v-2a4 4 0 0 0 -3 -3.85`,key:`svg-3`}]]),Z=i(),Q=e(t(),1),$=n();function fe(e){let t=(0,Z.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,$.jsx)(W,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function pe(e){let t=(0,Z.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,$.jsx)(K,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function me(e){let t=(0,Z.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=h(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(q,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function he(e){let t=(0,Z.c)(17),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,side:a,showCloseButton:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?`right`:a,c=o===void 0?!0:o,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(me,{}),t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=h(`bg-background data-open:animate-in data-closed:animate-out data-[side=right]:data-closed:slide-out-to-right-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=top]:data-closed:slide-out-to-top-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=bottom]:data-open:slide-in-from-bottom-10 fixed z-50 flex flex-col gap-4 bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,r),t[7]=r,t[8]=u);let d;t[9]===c?d=t[10]:(d=c&&(0,$.jsxs)(G,{"data-slot":`sheet-close`,render:(0,$.jsx)(f,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[(0,$.jsx)(j,{}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[9]=c,t[10]=d);let p;return t[11]!==n||t[12]!==i||t[13]!==s||t[14]!==u||t[15]!==d?(p=(0,$.jsxs)(pe,{children:[l,(0,$.jsxs)(U,{"data-slot":`sheet-content`,"data-side":s,className:u,...i,children:[n,d]})]}),t[11]=n,t[12]=i,t[13]=s,t[14]=u,t[15]=d,t[16]=p):p=t[16],p}function ge(e){let t=(0,Z.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=h(`gap-0.5 p-4 flex flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _e(e){let t=(0,Z.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=h(`text-foreground text-base font-medium`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(J,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ve(e){let t=(0,Z.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=h(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(H,{"data-slot":`sheet-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ye(e){let t=(0,Z.c)(3),n=e===void 0?768:e,[r,i]=Q.useState(void 0),a,o;return t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=window.matchMedia(`(max-width: ${n-1}px)`),t=()=>{i(window.innerWidth<n)};return e.addEventListener(`change`,t),i(window.innerWidth<n),()=>e.removeEventListener(`change`,t)},o=[n],t[0]=n,t[1]=a,t[2]=o),Q.useEffect(a,o),!!r}var be=`sidebar_state`,xe=3600*24*7,Se=`16rem`,Ce=`18rem`,we=`3rem`,Te=`b`,Ee=Q.createContext(null);function De(){let e=Q.useContext(Ee);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Oe(e){let t=(0,Z.c)(36),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({defaultOpen:c,open:i,onOpenChange:o,className:r,style:s,children:n,...a}=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);let l=c===void 0?!0:c,u=ye(),[d,f]=Q.useState(!1),[p,m]=Q.useState(l),g=i??p,_;t[8]!==g||t[9]!==o?(_=e=>{let t=typeof e==`function`?e(g):e;o?o(t):m(t),document.cookie=`${be}=${t}; path=/; max-age=${xe}`},t[8]=g,t[9]=o,t[10]=_):_=t[10];let v=_,y;t[11]!==u||t[12]!==v?(y=()=>u?f(Ae):v(ke),t[11]=u,t[12]=v,t[13]=y):y=t[13];let b=y,x,S;t[14]===b?(x=t[15],S=t[16]):(x=()=>{let e=e=>{e.key===Te&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),b())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},S=[b],t[14]=b,t[15]=x,t[16]=S),Q.useEffect(x,S);let C=g?`expanded`:`collapsed`,w;t[17]!==u||t[18]!==g||t[19]!==d||t[20]!==v||t[21]!==C||t[22]!==b?(w={state:C,open:g,setOpen:v,isMobile:u,openMobile:d,setOpenMobile:f,toggleSidebar:b},t[17]=u,t[18]=g,t[19]=d,t[20]=v,t[21]=C,t[22]=b,t[23]=w):w=t[23];let T=w,E;t[24]===s?E=t[25]:(E={"--sidebar-width":Se,"--sidebar-width-icon":we,...s},t[24]=s,t[25]=E);let D=E,O;t[26]===r?O=t[27]:(O=h(`group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full`,r),t[26]=r,t[27]=O);let k;t[28]!==n||t[29]!==a||t[30]!==D||t[31]!==O?(k=(0,$.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:D,className:O,...a,children:n}),t[28]=n,t[29]=a,t[30]=D,t[31]=O,t[32]=k):k=t[32];let A;return t[33]!==T||t[34]!==k?(A=(0,$.jsx)(Ee.Provider,{value:T,children:k}),t[33]=T,t[34]=k,t[35]=A):A=t[35],A}function ke(e){return!e}function Ae(e){return!e}function je(e){let t=(0,Z.c)(46),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offExamples`:s,{isMobile:d,state:f,openMobile:p,setOpenMobile:m}=De();if(u===`none`){let e;t[7]===r?e=t[8]:(e=h(`bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e?(a=(0,$.jsx)(`div`,{"data-slot":`sidebar`,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=a):a=t[12],a}if(d){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e={"--sidebar-width":Ce},t[13]=e):e=t[13];let r;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(ge,{className:`sr-only`,children:[(0,$.jsx)(_e,{children:`Sidebar`}),(0,$.jsx)(ve,{children:`Displays the mobile sidebar.`})]}),t[14]=r):r=t[14];let a;t[15]===n?a=t[16]:(a=(0,$.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:n}),t[15]=n,t[16]=a);let o;t[17]!==c||t[18]!==a?(o=(0,$.jsxs)(he,{"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden`,style:e,side:c,children:[r,a]}),t[17]=c,t[18]=a,t[19]=o):o=t[19];let s;return t[20]!==p||t[21]!==i||t[22]!==m||t[23]!==o?(s=(0,$.jsx)(fe,{open:p,onOpenChange:m,...i,children:o}),t[20]=p,t[21]=i,t[22]=m,t[23]=o,t[24]=s):s=t[24],s}let g=f===`collapsed`?u:``,_=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,v;t[25]===_?v=t[26]:(v=h(`transition-[width] duration-200 ease-linear relative w-(--sidebar-width) bg-transparent`,`group-data-[collapsible=offExamples]:w-0`,`group-data-[side=right]:rotate-180`,_),t[25]=_,t[26]=v);let y;t[27]===v?y=t[28]:(y=(0,$.jsx)(`div`,{"data-slot":`sidebar-gap`,className:v}),t[27]=v,t[28]=y);let b=c===`left`?`left-0 group-data-[collapsible=offExamples]:left-[calc(var(--sidebar-width)*-1)]`:`right-0 group-data-[collapsible=offExamples]:right-[calc(var(--sidebar-width)*-1)]`,x=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,S;t[29]!==r||t[30]!==b||t[31]!==x?(S=h(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex`,b,x,r),t[29]=r,t[30]=b,t[31]=x,t[32]=S):S=t[32];let C;t[33]===n?C=t[34]:(C=(0,$.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`bg-sidebar group-data-[variant=floating]:ring-sidebar-border group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 flex size-full flex-col`,children:n}),t[33]=n,t[34]=C);let w;t[35]!==i||t[36]!==S||t[37]!==C?(w=(0,$.jsx)(`div`,{"data-slot":`sidebar-container`,className:S,...i,children:C}),t[35]=i,t[36]=S,t[37]=C,t[38]=w):w=t[38];let T;return t[39]!==c||t[40]!==f||t[41]!==w||t[42]!==g||t[43]!==y||t[44]!==l?(T=(0,$.jsxs)(`div`,{className:`group peer text-sidebar-foreground hidden md:block`,"data-state":f,"data-collapsible":g,"data-variant":l,"data-side":c,"data-slot":`sidebar`,children:[y,w]}),t[39]=c,t[40]=f,t[41]=w,t[42]=g,t[43]=y,t[44]=l,t[45]=T):T=t[45],T}function Me(e){let t=(0,Z.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{toggleSidebar:a}=De(),o;t[4]===n?o=t[5]:(o=h(n),t[4]=n,t[5]=o);let s;t[6]!==r||t[7]!==a?(s=e=>{r?.(e),a()},t[6]=r,t[7]=a,t[8]=s):s=t[8];let c,l;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(se,{}),l=(0,$.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`}),t[9]=c,t[10]=l):(c=t[9],l=t[10]);let u;return t[11]!==i||t[12]!==o||t[13]!==s?(u=(0,$.jsxs)(f,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,className:o,onClick:s,...i,children:[c,l]}),t[11]=i,t[12]=o,t[13]=s,t[14]=u):u=t[14],u}function Ne(e){let t=(0,Z.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=h(`bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 relative flex w-full flex-1 flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`main`,{"data-slot":`sidebar-inset`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Pe(e){let t=(0,Z.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=h(`gap-2 p-2 flex flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Fe(e){let t=(0,Z.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=h(`no-scrollbar gap-0 flex min-h-0 flex-1 flex-col overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ie(e){let t=(0,Z.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=h(`p-2 relative flex w-full min-w-0 flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Le(e){let t=(0,Z.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=h(`text-sm w-full`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Re(e){let t=(0,Z.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=h(`gap-0 flex w-full min-w-0 flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ze(e){let t=(0,Z.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=h(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Be=d(`ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground gap-2 rounded-md p-2 text-left text-sm transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 data-active:font-medium peer/menu-button flex w-full items-center overflow-hidden outline-hidden group/menu-button disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function Ve(e){let t=(0,Z.c)(15),{render:n,isActive:r,variant:i,size:a,tooltip:o,className:s,...c}=e,l=r===void 0?!1:r,d=i===void 0?`default`:i,f=a===void 0?`default`:a,{isMobile:p,state:m}=De(),g=u({className:h(Be({variant:d,size:f}),s)},c),_=o?z:n,v;t[0]!==l||t[1]!==f?(v={slot:`sidebar-menu-button`,sidebar:`menu-button`,size:f,active:l},t[0]=l,t[1]=f,t[2]=v):v=t[2];let y;t[3]!==g||t[4]!==_||t[5]!==v?(y={defaultTagName:`button`,props:g,render:_,state:v},t[3]=g,t[4]=_,t[5]=v,t[6]=y):y=t[6];let b=B(y);if(!o)return b;if(typeof o==`string`){let e;t[7]===o?e=t[8]:(e={children:o},t[7]=o,t[8]=e),o=e}let x=m!==`collapsed`||p,S;t[9]!==x||t[10]!==o?(S=(0,$.jsx)(I,{side:`right`,align:`center`,hidden:x,...o}),t[9]=x,t[10]=o,t[11]=S):S=t[11];let C;return t[12]!==b||t[13]!==S?(C=(0,$.jsxs)(F,{children:[b,S]}),t[12]=b,t[13]=S,t[14]=C):C=t[14],C}var He=[{icon:oe,label:`Home`,to:`/$org_slug/home`},{icon:k,label:`Audit`,to:`/$org_slug/audit`},{icon:D,label:`Budget`,to:`/$org_slug/budget`},{icon:le,label:`Integrations`,to:`/$org_slug/integrations`},{icon:de,label:`Team`,to:`/$org_slug/team`}];function Ue(e,t){let n=e.replace(`/$org_slug/`,``);return n===`home`?t.endsWith(`/home`):t.includes(`/${n}`)}var We=s(`/_authenticated/$org_slug`);function Ge(e){let t=e?.trim();if(!t)return`?`;let n=t.split(/\s+/),r=n.at(0);if(!r)return`?`;let i=r.at(0);if(!i)return`?`;if(n.length===1)return i.toUpperCase();let a=n.at(-1);if(!a)return i.toUpperCase();let o=a.at(0);return o?`${i}${o}`.toUpperCase():i.toUpperCase()}function Ke(e){for(let t of He)if(Ue(t.to,e))return t.label;return`OneQuery`}function qe(){let e=(0,Z.c)(23),t=ae(),n=l(),r=We.useRouteContext(),i=a(),o=r.session.user,s=o?.name,c=o?.email,u;e[0]===s?u=e[1]:(u=Ge(s),e[0]=s,e[1]=u);let d=u,f;e[2]===t.pathname?f=e[3]:(f=Ke(t.pathname),e[2]=t.pathname,e[3]=f);let m=f,h;e[4]!==n||e[5]!==i?(h=async function(){await M(),await i.invalidate(),await n({to:`/`})},e[4]=n,e[5]=i,e[6]=h):h=e[6];let g=h,_,v;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(Me,{className:`-ml-1`}),v=(0,$.jsx)(V,{orientation:`vertical`,className:`mr-2 h-4`}),e[7]=_,e[8]=v):(_=e[7],v=e[8]);let b;e[9]===m?b=e[10]:(b=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,v,(0,$.jsx)(`span`,{className:`font-medium truncate max-w-[70vw]`,children:m})]}),e[9]=m,e[10]=b);let w;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(O,{}),e[11]=w):w=e[11];let E;e[12]!==g||e[13]!==o||e[14]!==c||e[15]!==d||e[16]!==s?(E=o&&(0,$.jsxs)(T,{children:[(0,$.jsxs)(y,{className:p({className:`gap-2`,size:`sm`,variant:`ghost`}),children:[(0,$.jsx)(X,{size:`sm`,children:(0,$.jsx)(Y,{children:d})}),(0,$.jsx)(`span`,{className:`text-sm`,children:s})]}),(0,$.jsxs)(x,{align:`end`,className:`min-w-56`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 px-2 py-2`,children:[(0,$.jsx)(X,{children:(0,$.jsx)(Y,{children:d})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:s}),(0,$.jsx)(`span`,{className:`truncate text-xs font-normal text-muted-foreground`,children:c})]})]}),(0,$.jsx)(S,{}),(0,$.jsxs)(C,{onClick:g,children:[(0,$.jsx)(ce,{size:16,stroke:2}),`Sign out`]})]})]}),e[12]=g,e[13]=o,e[14]=c,e[15]=d,e[16]=s,e[17]=E):E=e[17];let D;e[18]===E?D=e[19]:(D=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[w,E]}),e[18]=E,e[19]=D);let k;return e[20]!==b||e[21]!==D?(k=(0,$.jsxs)(`header`,{className:`sticky top-0 z-10 bg-background flex h-[var(--app-header-height)] shrink-0 items-center justify-between gap-2 border-b px-4`,children:[b,D]}),e[20]=b,e[21]=D,e[22]=k):k=e[22],k}var Je=s(`/_authenticated/$org_slug`);function Ye(e){let t=(0,Z.c)(55),{activeOrganization:n,organizations:r,menuOrgSlug:i}=e,a=l(),o=Je.useRouteContext(),s;t[0]!==o.organizationId||t[1]!==o.session.user.id?(s=re(o.session.user.id,o.organizationId),t[0]=o.organizationId,t[1]=o.session.user.id,t[2]=s):s=t[2];let c=ee(s),u=n.name,d;t[3]===n.name?d=t[4]:(d=ie(n.name),t[3]=n.name,t[4]=d);let f=d,m=r.length>0,h;if(t[5]!==c.data||t[6]!==o.session.user.id){let e=c.data?.find(e=>e.userId===o.session.user.id)?.rawRole;h=te({permission:`organizationUpdate`,rawRole:e}),t[5]=c.data,t[6]=o.session.user.id,t[7]=h}else h=t[7];let D=h,O;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=p({className:`-mx-2 h-auto w-full justify-start gap-2 rounded-md px-2 py-1.5 text-left`,size:`sm`,variant:`ghost`}),t[8]=O):O=t[8];let k;t[9]===f?k=t[10]:(k=(0,$.jsx)(`div`,{className:`flex size-6 items-center justify-center rounded bg-primary text-xs font-semibold text-primary-foreground`,children:f}),t[9]=f,t[10]=k);let j;t[11]===u?j=t[12]:(j=(0,$.jsx)(`span`,{className:`truncate text-sm font-medium`,children:u}),t[11]=u,t[12]=j);let M;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(_,{size:12,stroke:2,className:`shrink-0 opacity-50`}),t[13]=M):M=t[13];let N;t[14]===j?N=t[15]:(N=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[j,M]}),t[14]=j,t[15]=N);let P;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(`div`,{className:`text-xs leading-none text-muted-foreground`,children:`Workspace`}),t[16]=P):P=t[16];let F;t[17]===N?F=t[18]:(F=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[N,P]}),t[17]=N,t[18]=F);let I;t[19]!==F||t[20]!==k?(I=(0,$.jsx)(y,{className:O,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[k,F]})}),t[19]=F,t[20]=k,t[21]=I):I=t[21];let L;t[22]!==D||t[23]!==i||t[24]!==a?(L=D?(0,$.jsxs)(C,{onClick:async()=>a({params:{org_slug:i},to:`/$org_slug/settings`}),children:[(0,$.jsx)(ue,{size:16,stroke:2}),`Settings`]}):null,t[22]=D,t[23]=i,t[24]=a,t[25]=L):L=t[25];let R;t[26]!==i||t[27]!==a?(R=async()=>a({params:{org_slug:i},to:`/$org_slug/team`}),t[26]=i,t[27]=a,t[28]=R):R=t[28];let z;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(de,{size:16,stroke:2}),t[29]=z):z=t[29];let B;t[30]===R?B=t[31]:(B=(0,$.jsxs)(C,{onClick:R,children:[z,`Invite and manage members`]}),t[30]=R,t[31]=B);let V;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(S,{}),t[32]=V):V=t[32];let H;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(E,{children:`Switch organization`}),t[33]=H):H=t[33];let U;t[34]!==n.id||t[35]!==m||t[36]!==a||t[37]!==r?(U=m?r.map(e=>{let t=n.id===e.id,r=ne(e);return(0,$.jsxs)(C,{onClick:async()=>a({params:{org_slug:r},to:`/$org_slug/home`}),children:[(0,$.jsx)(`span`,{className:`truncate`,children:e.name}),t?(0,$.jsx)(w,{children:(0,$.jsx)(g,{size:16,stroke:2})}):null]},e.id)}):(0,$.jsx)(C,{disabled:!0,children:`No organizations`}),t[34]=n.id,t[35]=m,t[36]=a,t[37]=r,t[38]=U):U=t[38];let W;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(S,{}),t[39]=W):W=t[39];let G;t[40]===a?G=t[41]:(G=async()=>a({to:`/onboarding/create-org`}),t[40]=a,t[41]=G);let K;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(A,{size:16,stroke:2}),t[42]=K):K=t[42];let q;t[43]===G?q=t[44]:(q=(0,$.jsxs)(C,{onClick:G,children:[K,`Create organization`]}),t[43]=G,t[44]=q);let J;t[45]!==U||t[46]!==q?(J=(0,$.jsxs)(v,{children:[H,(0,$.jsxs)(b,{className:`w-56`,children:[U,W,q]})]}),t[45]=U,t[46]=q,t[47]=J):J=t[47];let Y;t[48]!==L||t[49]!==B||t[50]!==J?(Y=(0,$.jsxs)(x,{align:`start`,className:`w-64`,children:[L,B,V,J]}),t[48]=L,t[49]=B,t[50]=J,t[51]=Y):Y=t[51];let X;return t[52]!==I||t[53]!==Y?(X=(0,$.jsx)(Pe,{className:`h-14 flex-row items-center border-b px-3`,children:(0,$.jsxs)(T,{children:[I,Y]})}),t[52]=I,t[53]=Y,t[54]=X):X=t[54],X}var Xe=s(`/_authenticated/$org_slug`);function Ze(e){let t=(0,Z.c)(31),{orgSlug:n}=e,r=ae(),i=Xe.useRouteContext(),a;t[0]!==i.organizationId||t[1]!==i.session.user.id?(a=re(i.session.user.id,i.organizationId),t[0]=i.organizationId,t[1]=i.session.user.id,t[2]=a):a=t[2];let o;t[3]===a?o=t[4]:(o={...a},t[3]=a,t[4]=o);let s=ee(o),c,l,u,d,f,p;if(t[5]!==r||t[6]!==s.data||t[7]!==n||t[8]!==i.session.user.id){let e=s.data?.find(e=>e.userId===i.session.user.id)?.rawRole,a=P({rawRole:e}),o=He.filter(e=>!e.organizationAdminOnly||a);d=Fe,p=`overflow-hidden`,u=Ie,l=Le,c=Re;let m;t[15]!==r||t[16]!==n?(m=e=>(0,$.jsx)(Qe,{item:e,orgSlug:n,pathname:r.pathname},e.to),t[15]=r,t[16]=n,t[17]=m):m=t[17],f=o.map(m),t[5]=r,t[6]=s.data,t[7]=n,t[8]=i.session.user.id,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];let m;t[18]!==c||t[19]!==f?(m=(0,$.jsx)(c,{children:f}),t[18]=c,t[19]=f,t[20]=m):m=t[20];let h;t[21]!==l||t[22]!==m?(h=(0,$.jsx)(l,{children:m}),t[21]=l,t[22]=m,t[23]=h):h=t[23];let g;t[24]!==u||t[25]!==h?(g=(0,$.jsx)(u,{children:h}),t[24]=u,t[25]=h,t[26]=g):g=t[26];let _;return t[27]!==d||t[28]!==p||t[29]!==g?(_=(0,$.jsx)(d,{className:p,children:g}),t[27]=d,t[28]=p,t[29]=g,t[30]=_):_=t[30],_}function Qe(e){let t=(0,Z.c)(19),{item:n,orgSlug:i,pathname:a,onClick:o}=e,s;t[0]!==n.to||t[1]!==a?(s=Ue(n.to,a),t[0]=n.to,t[1]=a,t[2]=s):s=t[2];let c=s,l=c?`!bg-foreground/10 hover:!bg-foreground/10`:``,u;t[3]===i?u=t[4]:(u={org_slug:i},t[3]=i,t[4]=u);let d;t[5]!==n.to||t[6]!==u?(d=(0,$.jsx)(r,{to:n.to,params:u}),t[5]=n.to,t[6]=u,t[7]=d):d=t[7];let f;t[8]===n.icon?f=t[9]:(f=(0,$.jsx)(n.icon,{size:20,stroke:1.5}),t[8]=n.icon,t[9]=f);let p;t[10]===n.label?p=t[11]:(p=(0,$.jsx)(`span`,{children:n.label}),t[10]=n.label,t[11]=p);let m;return t[12]!==c||t[13]!==o||t[14]!==l||t[15]!==d||t[16]!==f||t[17]!==p?(m=(0,$.jsx)(ze,{children:(0,$.jsxs)(Ve,{isActive:c,className:l,onClick:o,render:d,children:[f,p]})}),t[12]=c,t[13]=o,t[14]=l,t[15]=d,t[16]=f,t[17]=p,t[18]=m):m=t[18],m}var $e=s(`/_authenticated/$org_slug`);function et(e){let t=(0,Z.c)(18),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={from:`/_authenticated/$org_slug`},t[0]=r):r=t[0];let i=c(r),a=$e.useRouteContext(),o=i.org_slug??``,s;t[1]===a.session.user.id?s=t[2]:(s=L(a.session.user.id),t[1]=a.session.user.id,t[2]=s);let l=N(s).data,u=a.organization,d=a.organizationSlug,f;t[3]!==u||t[4]!==d||t[5]!==l?(f=(0,$.jsx)(Ye,{activeOrganization:u,organizations:l,menuOrgSlug:d}),t[3]=u,t[4]=d,t[5]=l,t[6]=f):f=t[6];let p;t[7]===o?p=t[8]:(p=(0,$.jsx)(Ze,{orgSlug:o}),t[7]=o,t[8]=p);let m;t[9]!==f||t[10]!==p?(m=(0,$.jsxs)(je,{children:[f,p]}),t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(qe,{}),t[12]=h):h=t[12];let g;t[13]===n?g=t[14]:(g=(0,$.jsxs)(Ne,{className:`flex min-h-0 overflow-y-auto [--app-header-height:3.5rem]`,children:[h,(0,$.jsx)(`main`,{className:`h-[calc(100%-var(--app-header-height))]`,children:n})]}),t[13]=n,t[14]=g);let _;return t[15]!==m||t[16]!==g?(_=(0,$.jsxs)(Oe,{className:`!h-svh`,children:[m,g]}),t[15]=m,t[16]=g,t[17]=_):_=t[17],_}function tt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(et,{children:(0,$.jsx)(R,{})}),e[0]=t):t=e[0],t}export{tt 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{t as i}from"./compiler-runtime-DCc3R3Xn.js";import{n as a,t as o}from"./useRouterState-DpT8luFk.js";import{a as s,c,o as l}from"./api-base-url-DIb6qukm.js";import{b as u,i as d,n as f,r as p,t as m}from"./createReactComponent-_L2mp4Ui.js";import{t as h}from"./utils-C8DGLIgm.js";import{t as g}from"./IconCheck-Gc24xPT2.js";import{t as _}from"./IconChevronDown-B-39MA7-.js";import{c as v,d as y,l as b,n as x,o as S,r as C,s as w,t as T,u as E}from"./dropdown-menu-B6HlzguP.js";import{t as D}from"./IconCoins-C7Nn0L6R.js";import{t as O}from"./theme-toggle-DGw9lP2H.js";import{t as k}from"./IconHistory-BqAd-xl2.js";import{t as A}from"./IconPlus-C3-kRhGX.js";import{t as j}from"./IconX-BQkA009b.js";import{r as M}from"./auth-client-DF1BsKzX.js";import{t as ee}from"./useQuery-K2VcQGgJ.js";import{t as N}from"./useSuspenseQuery-B2g_FID5.js";import{n as te,t as P}from"./organization-permissions-BQQ5PJbI.js";import{A as F,D as ne,E as I,O as L,T as re,k as R,tt as z,y as ie}from"./index-crEoj0do.js";import{t as B}from"./useRender-B2c9_UYd.js";import"./input-CG_cIxvO.js";import{t as V}from"./separator-CWltZvB_.js";import{a as H,i as U,n as W,o as G,r as K,s as q,t as J}from"./DialogTitle-DQANwbFs.js";import{n as Y,t as X}from"./avatar-B8g7WJsq.js";function ae(e){return o({select:t=>e?.select?e.select(t.location):t.location})}var oe=m(`outline`,`home`,`Home`,[[`path`,{d:`M5 12l-2 0l9 -9l9 9l-2 0`,key:`svg-0`}],[`path`,{d:`M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7`,key:`svg-1`}],[`path`,{d:`M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6`,key:`svg-2`}]]),se=m(`outline`,`layout-sidebar`,`LayoutSidebar`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M9 4l0 16`,key:`svg-1`}]]),ce=m(`outline`,`logout`,`Logout`,[[`path`,{d:`M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2`,key:`svg-0`}],[`path`,{d:`M9 12h12l-3 -3`,key:`svg-1`}],[`path`,{d:`M18 15l3 -3`,key:`svg-2`}]]),le=m(`outline`,`plug-connected`,`PlugConnected`,[[`path`,{d:`M7 12l5 5l-1.5 1.5a3.536 3.536 0 1 1 -5 -5l1.5 -1.5`,key:`svg-0`}],[`path`,{d:`M17 12l-5 -5l1.5 -1.5a3.536 3.536 0 1 1 5 5l-1.5 1.5`,key:`svg-1`}],[`path`,{d:`M3 21l2.5 -2.5`,key:`svg-2`}],[`path`,{d:`M18.5 5.5l2.5 -2.5`,key:`svg-3`}],[`path`,{d:`M10 11l-2 2`,key:`svg-4`}],[`path`,{d:`M13 14l-2 2`,key:`svg-5`}]]),ue=m(`outline`,`settings`,`Settings`,[[`path`,{d:`M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065`,key:`svg-0`}],[`path`,{d:`M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0`,key:`svg-1`}]]),de=m(`outline`,`users`,`Users`,[[`path`,{d:`M5 7a4 4 0 1 0 8 0a4 4 0 1 0 -8 0`,key:`svg-0`}],[`path`,{d:`M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2`,key:`svg-1`}],[`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`,key:`svg-2`}],[`path`,{d:`M21 21v-2a4 4 0 0 0 -3 -3.85`,key:`svg-3`}]]),Z=i(),Q=e(t(),1),$=n();function fe(e){let t=(0,Z.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,$.jsx)(W,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function pe(e){let t=(0,Z.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,$.jsx)(K,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function me(e){let t=(0,Z.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=h(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(q,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function he(e){let t=(0,Z.c)(17),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,side:a,showCloseButton:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?`right`:a,c=o===void 0?!0:o,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(me,{}),t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=h(`bg-background data-open:animate-in data-closed:animate-out data-[side=right]:data-closed:slide-out-to-right-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=top]:data-closed:slide-out-to-top-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=bottom]:data-open:slide-in-from-bottom-10 fixed z-50 flex flex-col gap-4 bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,r),t[7]=r,t[8]=u);let d;t[9]===c?d=t[10]:(d=c&&(0,$.jsxs)(G,{"data-slot":`sheet-close`,render:(0,$.jsx)(f,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[(0,$.jsx)(j,{}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[9]=c,t[10]=d);let p;return t[11]!==n||t[12]!==i||t[13]!==s||t[14]!==u||t[15]!==d?(p=(0,$.jsxs)(pe,{children:[l,(0,$.jsxs)(U,{"data-slot":`sheet-content`,"data-side":s,className:u,...i,children:[n,d]})]}),t[11]=n,t[12]=i,t[13]=s,t[14]=u,t[15]=d,t[16]=p):p=t[16],p}function ge(e){let t=(0,Z.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=h(`gap-0.5 p-4 flex flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _e(e){let t=(0,Z.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=h(`text-foreground text-base font-medium`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(J,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ve(e){let t=(0,Z.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=h(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(H,{"data-slot":`sheet-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ye(e){let t=(0,Z.c)(3),n=e===void 0?768:e,[r,i]=Q.useState(void 0),a,o;return t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=window.matchMedia(`(max-width: ${n-1}px)`),t=()=>{i(window.innerWidth<n)};return e.addEventListener(`change`,t),i(window.innerWidth<n),()=>e.removeEventListener(`change`,t)},o=[n],t[0]=n,t[1]=a,t[2]=o),Q.useEffect(a,o),!!r}var be=`sidebar_state`,xe=3600*24*7,Se=`16rem`,Ce=`18rem`,we=`3rem`,Te=`b`,Ee=Q.createContext(null);function De(){let e=Q.useContext(Ee);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Oe(e){let t=(0,Z.c)(36),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({defaultOpen:c,open:i,onOpenChange:o,className:r,style:s,children:n,...a}=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);let l=c===void 0?!0:c,u=ye(),[d,f]=Q.useState(!1),[p,m]=Q.useState(l),g=i??p,_;t[8]!==g||t[9]!==o?(_=e=>{let t=typeof e==`function`?e(g):e;o?o(t):m(t),document.cookie=`${be}=${t}; path=/; max-age=${xe}`},t[8]=g,t[9]=o,t[10]=_):_=t[10];let v=_,y;t[11]!==u||t[12]!==v?(y=()=>u?f(Ae):v(ke),t[11]=u,t[12]=v,t[13]=y):y=t[13];let b=y,x,S;t[14]===b?(x=t[15],S=t[16]):(x=()=>{let e=e=>{e.key===Te&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),b())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},S=[b],t[14]=b,t[15]=x,t[16]=S),Q.useEffect(x,S);let C=g?`expanded`:`collapsed`,w;t[17]!==u||t[18]!==g||t[19]!==d||t[20]!==v||t[21]!==C||t[22]!==b?(w={state:C,open:g,setOpen:v,isMobile:u,openMobile:d,setOpenMobile:f,toggleSidebar:b},t[17]=u,t[18]=g,t[19]=d,t[20]=v,t[21]=C,t[22]=b,t[23]=w):w=t[23];let T=w,E;t[24]===s?E=t[25]:(E={"--sidebar-width":Se,"--sidebar-width-icon":we,...s},t[24]=s,t[25]=E);let D=E,O;t[26]===r?O=t[27]:(O=h(`group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full`,r),t[26]=r,t[27]=O);let k;t[28]!==n||t[29]!==a||t[30]!==D||t[31]!==O?(k=(0,$.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:D,className:O,...a,children:n}),t[28]=n,t[29]=a,t[30]=D,t[31]=O,t[32]=k):k=t[32];let A;return t[33]!==T||t[34]!==k?(A=(0,$.jsx)(Ee.Provider,{value:T,children:k}),t[33]=T,t[34]=k,t[35]=A):A=t[35],A}function ke(e){return!e}function Ae(e){return!e}function je(e){let t=(0,Z.c)(46),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offExamples`:s,{isMobile:d,state:f,openMobile:p,setOpenMobile:m}=De();if(u===`none`){let e;t[7]===r?e=t[8]:(e=h(`bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e?(a=(0,$.jsx)(`div`,{"data-slot":`sidebar`,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=a):a=t[12],a}if(d){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e={"--sidebar-width":Ce},t[13]=e):e=t[13];let r;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(ge,{className:`sr-only`,children:[(0,$.jsx)(_e,{children:`Sidebar`}),(0,$.jsx)(ve,{children:`Displays the mobile sidebar.`})]}),t[14]=r):r=t[14];let a;t[15]===n?a=t[16]:(a=(0,$.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:n}),t[15]=n,t[16]=a);let o;t[17]!==c||t[18]!==a?(o=(0,$.jsxs)(he,{"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden`,style:e,side:c,children:[r,a]}),t[17]=c,t[18]=a,t[19]=o):o=t[19];let s;return t[20]!==p||t[21]!==i||t[22]!==m||t[23]!==o?(s=(0,$.jsx)(fe,{open:p,onOpenChange:m,...i,children:o}),t[20]=p,t[21]=i,t[22]=m,t[23]=o,t[24]=s):s=t[24],s}let g=f===`collapsed`?u:``,_=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,v;t[25]===_?v=t[26]:(v=h(`transition-[width] duration-200 ease-linear relative w-(--sidebar-width) bg-transparent`,`group-data-[collapsible=offExamples]:w-0`,`group-data-[side=right]:rotate-180`,_),t[25]=_,t[26]=v);let y;t[27]===v?y=t[28]:(y=(0,$.jsx)(`div`,{"data-slot":`sidebar-gap`,className:v}),t[27]=v,t[28]=y);let b=c===`left`?`left-0 group-data-[collapsible=offExamples]:left-[calc(var(--sidebar-width)*-1)]`:`right-0 group-data-[collapsible=offExamples]:right-[calc(var(--sidebar-width)*-1)]`,x=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,S;t[29]!==r||t[30]!==b||t[31]!==x?(S=h(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex`,b,x,r),t[29]=r,t[30]=b,t[31]=x,t[32]=S):S=t[32];let C;t[33]===n?C=t[34]:(C=(0,$.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`bg-sidebar group-data-[variant=floating]:ring-sidebar-border group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 flex size-full flex-col`,children:n}),t[33]=n,t[34]=C);let w;t[35]!==i||t[36]!==S||t[37]!==C?(w=(0,$.jsx)(`div`,{"data-slot":`sidebar-container`,className:S,...i,children:C}),t[35]=i,t[36]=S,t[37]=C,t[38]=w):w=t[38];let T;return t[39]!==c||t[40]!==f||t[41]!==w||t[42]!==g||t[43]!==y||t[44]!==l?(T=(0,$.jsxs)(`div`,{className:`group peer text-sidebar-foreground hidden md:block`,"data-state":f,"data-collapsible":g,"data-variant":l,"data-side":c,"data-slot":`sidebar`,children:[y,w]}),t[39]=c,t[40]=f,t[41]=w,t[42]=g,t[43]=y,t[44]=l,t[45]=T):T=t[45],T}function Me(e){let t=(0,Z.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{toggleSidebar:a}=De(),o;t[4]===n?o=t[5]:(o=h(n),t[4]=n,t[5]=o);let s;t[6]!==r||t[7]!==a?(s=e=>{r?.(e),a()},t[6]=r,t[7]=a,t[8]=s):s=t[8];let c,l;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(se,{}),l=(0,$.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`}),t[9]=c,t[10]=l):(c=t[9],l=t[10]);let u;return t[11]!==i||t[12]!==o||t[13]!==s?(u=(0,$.jsxs)(f,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,className:o,onClick:s,...i,children:[c,l]}),t[11]=i,t[12]=o,t[13]=s,t[14]=u):u=t[14],u}function Ne(e){let t=(0,Z.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=h(`bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 relative flex w-full flex-1 flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`main`,{"data-slot":`sidebar-inset`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Pe(e){let t=(0,Z.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=h(`gap-2 p-2 flex flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Fe(e){let t=(0,Z.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=h(`no-scrollbar gap-0 flex min-h-0 flex-1 flex-col overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ie(e){let t=(0,Z.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=h(`p-2 relative flex w-full min-w-0 flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Le(e){let t=(0,Z.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=h(`text-sm w-full`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Re(e){let t=(0,Z.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=h(`gap-0 flex w-full min-w-0 flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ze(e){let t=(0,Z.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=h(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Be=d(`ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground gap-2 rounded-md p-2 text-left text-sm transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 data-active:font-medium peer/menu-button flex w-full items-center overflow-hidden outline-hidden group/menu-button disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function Ve(e){let t=(0,Z.c)(15),{render:n,isActive:r,variant:i,size:a,tooltip:o,className:s,...c}=e,l=r===void 0?!1:r,d=i===void 0?`default`:i,f=a===void 0?`default`:a,{isMobile:p,state:m}=De(),g=u({className:h(Be({variant:d,size:f}),s)},c),_=o?F:n,v;t[0]!==l||t[1]!==f?(v={slot:`sidebar-menu-button`,sidebar:`menu-button`,size:f,active:l},t[0]=l,t[1]=f,t[2]=v):v=t[2];let y;t[3]!==g||t[4]!==_||t[5]!==v?(y={defaultTagName:`button`,props:g,render:_,state:v},t[3]=g,t[4]=_,t[5]=v,t[6]=y):y=t[6];let b=B(y);if(!o)return b;if(typeof o==`string`){let e;t[7]===o?e=t[8]:(e={children:o},t[7]=o,t[8]=e),o=e}let x=m!==`collapsed`||p,S;t[9]!==x||t[10]!==o?(S=(0,$.jsx)(R,{side:`right`,align:`center`,hidden:x,...o}),t[9]=x,t[10]=o,t[11]=S):S=t[11];let C;return t[12]!==b||t[13]!==S?(C=(0,$.jsxs)(L,{children:[b,S]}),t[12]=b,t[13]=S,t[14]=C):C=t[14],C}var He=[{icon:oe,label:`Home`,to:`/$org_slug/home`},{icon:k,label:`Audit`,to:`/$org_slug/audit`},{icon:D,label:`Budget`,to:`/$org_slug/budget`},{icon:le,label:`Integrations`,to:`/$org_slug/integrations`},{icon:de,label:`Team`,to:`/$org_slug/team`}];function Ue(e,t){let n=e.replace(`/$org_slug/`,``);return n===`home`?t.endsWith(`/home`):t.includes(`/${n}`)}var We=s(`/_authenticated/$org_slug`);function Ge(e){let t=e?.trim();if(!t)return`?`;let n=t.split(/\s+/),r=n.at(0);if(!r)return`?`;let i=r.at(0);if(!i)return`?`;if(n.length===1)return i.toUpperCase();let a=n.at(-1);if(!a)return i.toUpperCase();let o=a.at(0);return o?`${i}${o}`.toUpperCase():i.toUpperCase()}function Ke(e){for(let t of He)if(Ue(t.to,e))return t.label;return`OneQuery`}function qe(){let e=(0,Z.c)(23),t=ae(),n=l(),r=We.useRouteContext(),i=a(),o=r.session.user,s=o?.name,c=o?.email,u;e[0]===s?u=e[1]:(u=Ge(s),e[0]=s,e[1]=u);let d=u,f;e[2]===t.pathname?f=e[3]:(f=Ke(t.pathname),e[2]=t.pathname,e[3]=f);let m=f,h;e[4]!==n||e[5]!==i?(h=async function(){await M(),await i.invalidate(),await n({to:`/`})},e[4]=n,e[5]=i,e[6]=h):h=e[6];let g=h,_,v;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(Me,{className:`-ml-1`}),v=(0,$.jsx)(V,{orientation:`vertical`,className:`mr-2 h-4`}),e[7]=_,e[8]=v):(_=e[7],v=e[8]);let b;e[9]===m?b=e[10]:(b=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,v,(0,$.jsx)(`span`,{className:`font-medium truncate max-w-[70vw]`,children:m})]}),e[9]=m,e[10]=b);let w;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(O,{}),e[11]=w):w=e[11];let E;e[12]!==g||e[13]!==o||e[14]!==c||e[15]!==d||e[16]!==s?(E=o&&(0,$.jsxs)(T,{children:[(0,$.jsxs)(y,{className:p({className:`gap-2`,size:`sm`,variant:`ghost`}),children:[(0,$.jsx)(X,{size:`sm`,children:(0,$.jsx)(Y,{children:d})}),(0,$.jsx)(`span`,{className:`text-sm`,children:s})]}),(0,$.jsxs)(x,{align:`end`,className:`min-w-56`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 px-2 py-2`,children:[(0,$.jsx)(X,{children:(0,$.jsx)(Y,{children:d})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:s}),(0,$.jsx)(`span`,{className:`truncate text-xs font-normal text-muted-foreground`,children:c})]})]}),(0,$.jsx)(S,{}),(0,$.jsxs)(C,{onClick:g,children:[(0,$.jsx)(ce,{size:16,stroke:2}),`Sign out`]})]})]}),e[12]=g,e[13]=o,e[14]=c,e[15]=d,e[16]=s,e[17]=E):E=e[17];let D;e[18]===E?D=e[19]:(D=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[w,E]}),e[18]=E,e[19]=D);let k;return e[20]!==b||e[21]!==D?(k=(0,$.jsxs)(`header`,{className:`sticky top-0 z-10 bg-background flex h-[var(--app-header-height)] shrink-0 items-center justify-between gap-2 border-b px-4`,children:[b,D]}),e[20]=b,e[21]=D,e[22]=k):k=e[22],k}var Je=s(`/_authenticated/$org_slug`);function Ye(e){let t=(0,Z.c)(55),{activeOrganization:n,organizations:r,menuOrgSlug:i}=e,a=l(),o=Je.useRouteContext(),s;t[0]!==o.organizationId||t[1]!==o.session.user.id?(s=ie(o.session.user.id,o.organizationId),t[0]=o.organizationId,t[1]=o.session.user.id,t[2]=s):s=t[2];let c=ee(s),u=n.name,d;t[3]===n.name?d=t[4]:(d=re(n.name),t[3]=n.name,t[4]=d);let f=d,m=r.length>0,h;if(t[5]!==c.data||t[6]!==o.session.user.id){let e=c.data?.find(e=>e.userId===o.session.user.id)?.rawRole;h=te({permission:`organizationUpdate`,rawRole:e}),t[5]=c.data,t[6]=o.session.user.id,t[7]=h}else h=t[7];let D=h,O;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=p({className:`-mx-2 h-auto w-full justify-start gap-2 rounded-md px-2 py-1.5 text-left`,size:`sm`,variant:`ghost`}),t[8]=O):O=t[8];let k;t[9]===f?k=t[10]:(k=(0,$.jsx)(`div`,{className:`flex size-6 items-center justify-center rounded bg-primary text-xs font-semibold text-primary-foreground`,children:f}),t[9]=f,t[10]=k);let j;t[11]===u?j=t[12]:(j=(0,$.jsx)(`span`,{className:`truncate text-sm font-medium`,children:u}),t[11]=u,t[12]=j);let M;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(_,{size:12,stroke:2,className:`shrink-0 opacity-50`}),t[13]=M):M=t[13];let N;t[14]===j?N=t[15]:(N=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[j,M]}),t[14]=j,t[15]=N);let P;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(`div`,{className:`text-xs leading-none text-muted-foreground`,children:`Workspace`}),t[16]=P):P=t[16];let F;t[17]===N?F=t[18]:(F=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[N,P]}),t[17]=N,t[18]=F);let I;t[19]!==F||t[20]!==k?(I=(0,$.jsx)(y,{className:O,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[k,F]})}),t[19]=F,t[20]=k,t[21]=I):I=t[21];let L;t[22]!==D||t[23]!==i||t[24]!==a?(L=D?(0,$.jsxs)(C,{onClick:async()=>a({params:{org_slug:i},to:`/$org_slug/settings`}),children:[(0,$.jsx)(ue,{size:16,stroke:2}),`Settings`]}):null,t[22]=D,t[23]=i,t[24]=a,t[25]=L):L=t[25];let R;t[26]!==i||t[27]!==a?(R=async()=>a({params:{org_slug:i},to:`/$org_slug/team`}),t[26]=i,t[27]=a,t[28]=R):R=t[28];let z;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(de,{size:16,stroke:2}),t[29]=z):z=t[29];let B;t[30]===R?B=t[31]:(B=(0,$.jsxs)(C,{onClick:R,children:[z,`Invite and manage members`]}),t[30]=R,t[31]=B);let V;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(S,{}),t[32]=V):V=t[32];let H;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(E,{children:`Switch organization`}),t[33]=H):H=t[33];let U;t[34]!==n.id||t[35]!==m||t[36]!==a||t[37]!==r?(U=m?r.map(e=>{let t=n.id===e.id,r=ne(e);return(0,$.jsxs)(C,{onClick:async()=>a({params:{org_slug:r},to:`/$org_slug/home`}),children:[(0,$.jsx)(`span`,{className:`truncate`,children:e.name}),t?(0,$.jsx)(w,{children:(0,$.jsx)(g,{size:16,stroke:2})}):null]},e.id)}):(0,$.jsx)(C,{disabled:!0,children:`No organizations`}),t[34]=n.id,t[35]=m,t[36]=a,t[37]=r,t[38]=U):U=t[38];let W;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(S,{}),t[39]=W):W=t[39];let G;t[40]===a?G=t[41]:(G=async()=>a({to:`/onboarding/create-org`}),t[40]=a,t[41]=G);let K;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(A,{size:16,stroke:2}),t[42]=K):K=t[42];let q;t[43]===G?q=t[44]:(q=(0,$.jsxs)(C,{onClick:G,children:[K,`Create organization`]}),t[43]=G,t[44]=q);let J;t[45]!==U||t[46]!==q?(J=(0,$.jsxs)(v,{children:[H,(0,$.jsxs)(b,{className:`w-56`,children:[U,W,q]})]}),t[45]=U,t[46]=q,t[47]=J):J=t[47];let Y;t[48]!==L||t[49]!==B||t[50]!==J?(Y=(0,$.jsxs)(x,{align:`start`,className:`w-64`,children:[L,B,V,J]}),t[48]=L,t[49]=B,t[50]=J,t[51]=Y):Y=t[51];let X;return t[52]!==I||t[53]!==Y?(X=(0,$.jsx)(Pe,{className:`h-14 flex-row items-center border-b px-3`,children:(0,$.jsxs)(T,{children:[I,Y]})}),t[52]=I,t[53]=Y,t[54]=X):X=t[54],X}var Xe=s(`/_authenticated/$org_slug`);function Ze(e){let t=(0,Z.c)(31),{orgSlug:n}=e,r=ae(),i=Xe.useRouteContext(),a;t[0]!==i.organizationId||t[1]!==i.session.user.id?(a=ie(i.session.user.id,i.organizationId),t[0]=i.organizationId,t[1]=i.session.user.id,t[2]=a):a=t[2];let o;t[3]===a?o=t[4]:(o={...a},t[3]=a,t[4]=o);let s=ee(o),c,l,u,d,f,p;if(t[5]!==r||t[6]!==s.data||t[7]!==n||t[8]!==i.session.user.id){let e=s.data?.find(e=>e.userId===i.session.user.id)?.rawRole,a=P({rawRole:e}),o=He.filter(e=>!e.organizationAdminOnly||a);d=Fe,p=`overflow-hidden`,u=Ie,l=Le,c=Re;let m;t[15]!==r||t[16]!==n?(m=e=>(0,$.jsx)(Qe,{item:e,orgSlug:n,pathname:r.pathname},e.to),t[15]=r,t[16]=n,t[17]=m):m=t[17],f=o.map(m),t[5]=r,t[6]=s.data,t[7]=n,t[8]=i.session.user.id,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];let m;t[18]!==c||t[19]!==f?(m=(0,$.jsx)(c,{children:f}),t[18]=c,t[19]=f,t[20]=m):m=t[20];let h;t[21]!==l||t[22]!==m?(h=(0,$.jsx)(l,{children:m}),t[21]=l,t[22]=m,t[23]=h):h=t[23];let g;t[24]!==u||t[25]!==h?(g=(0,$.jsx)(u,{children:h}),t[24]=u,t[25]=h,t[26]=g):g=t[26];let _;return t[27]!==d||t[28]!==p||t[29]!==g?(_=(0,$.jsx)(d,{className:p,children:g}),t[27]=d,t[28]=p,t[29]=g,t[30]=_):_=t[30],_}function Qe(e){let t=(0,Z.c)(19),{item:n,orgSlug:i,pathname:a,onClick:o}=e,s;t[0]!==n.to||t[1]!==a?(s=Ue(n.to,a),t[0]=n.to,t[1]=a,t[2]=s):s=t[2];let c=s,l=c?`!bg-foreground/10 hover:!bg-foreground/10`:``,u;t[3]===i?u=t[4]:(u={org_slug:i},t[3]=i,t[4]=u);let d;t[5]!==n.to||t[6]!==u?(d=(0,$.jsx)(r,{to:n.to,params:u}),t[5]=n.to,t[6]=u,t[7]=d):d=t[7];let f;t[8]===n.icon?f=t[9]:(f=(0,$.jsx)(n.icon,{size:20,stroke:1.5}),t[8]=n.icon,t[9]=f);let p;t[10]===n.label?p=t[11]:(p=(0,$.jsx)(`span`,{children:n.label}),t[10]=n.label,t[11]=p);let m;return t[12]!==c||t[13]!==o||t[14]!==l||t[15]!==d||t[16]!==f||t[17]!==p?(m=(0,$.jsx)(ze,{children:(0,$.jsxs)(Ve,{isActive:c,className:l,onClick:o,render:d,children:[f,p]})}),t[12]=c,t[13]=o,t[14]=l,t[15]=d,t[16]=f,t[17]=p,t[18]=m):m=t[18],m}var $e=s(`/_authenticated/$org_slug`);function et(e){let t=(0,Z.c)(18),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={from:`/_authenticated/$org_slug`},t[0]=r):r=t[0];let i=c(r),a=$e.useRouteContext(),o=i.org_slug??``,s;t[1]===a.session.user.id?s=t[2]:(s=I(a.session.user.id),t[1]=a.session.user.id,t[2]=s);let l=N(s).data,u=a.organization,d=a.organizationSlug,f;t[3]!==u||t[4]!==d||t[5]!==l?(f=(0,$.jsx)(Ye,{activeOrganization:u,organizations:l,menuOrgSlug:d}),t[3]=u,t[4]=d,t[5]=l,t[6]=f):f=t[6];let p;t[7]===o?p=t[8]:(p=(0,$.jsx)(Ze,{orgSlug:o}),t[7]=o,t[8]=p);let m;t[9]!==f||t[10]!==p?(m=(0,$.jsxs)(je,{children:[f,p]}),t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(qe,{}),t[12]=h):h=t[12];let g;t[13]===n?g=t[14]:(g=(0,$.jsxs)(Ne,{className:`flex min-h-0 overflow-y-auto [--app-header-height:3.5rem]`,children:[h,(0,$.jsx)(`main`,{className:`h-[calc(100%-var(--app-header-height))]`,children:n})]}),t[13]=n,t[14]=g);let _;return t[15]!==m||t[16]!==g?(_=(0,$.jsxs)(Oe,{className:`!h-svh`,children:[m,g]}),t[15]=m,t[16]=g,t[17]=_):_=t[17],_}function tt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(et,{children:(0,$.jsx)(z,{})}),e[0]=t):t=e[0],t}export{tt as component};
@@ -0,0 +1 @@
1
+ import{t as e}from"./api-base-url-DIb6qukm.js";var t=/^[\w!#$%&'*.^`|~+-]+$/,n=(e,n,r={})=>{if(!t.test(e))throw Error(`Invalid cookie name`);let i=`${e}=${n}`;if(e.startsWith(`__Secure-`)&&!r.secure)throw Error(`__Secure- Cookie must have Secure attributes`);if(e.startsWith(`__Host-`)){if(!r.secure)throw Error(`__Host- Cookie must have Secure attributes`);if(r.path!==`/`)throw Error(`__Host- Cookie must have Path attributes with "/"`);if(r.domain)throw Error(`__Host- Cookie must not have Domain attributes`)}for(let e of[`domain`,`path`])if(r[e]&&/[;\r\n]/.test(r[e]))throw Error(`${e} must not contain ";", "\\r", or "\\n"`);if(r&&typeof r.maxAge==`number`&&r.maxAge>=0){if(r.maxAge>3456e4)throw Error(`Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.`);i+=`; Max-Age=${r.maxAge|0}`}if(r.domain&&r.prefix!==`host`&&(i+=`; Domain=${r.domain}`),r.path&&(i+=`; Path=${r.path}`),r.expires){if(r.expires.getTime()-Date.now()>3456e7)throw Error(`Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.`);i+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(i+=`; HttpOnly`),r.secure&&(i+=`; Secure`),r.sameSite&&(i+=`; SameSite=${r.sameSite.charAt(0).toUpperCase()+r.sameSite.slice(1)}`),r.priority&&(i+=`; Priority=${r.priority.charAt(0).toUpperCase()+r.priority.slice(1)}`),r.partitioned){if(!r.secure)throw Error(`Partitioned Cookie must have Secure attributes`);i+=`; Partitioned`}return i},r=(e,t,r)=>(t=encodeURIComponent(t),n(e,t,r)),i=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),a=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??`);e=e.replace(t,r?`/${r}`:``)}return e},o=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.set(n,r);return t},s=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},c=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function l(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function u(e,t){if(!l(e)&&!l(t))return t;let n={...e};for(let e in t){let r=t[e];l(n[e])&&l(r)?n[e]=u(n[e],r):n[e]=r}return n}var d=(e,t)=>new Proxy(()=>{},{get(n,r){if(!(typeof r!=`string`||r===`then`))return d(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),f=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(e,t,n){this.url=e,this.method=t,this.buildSearchParams=n.buildSearchParams}fetch=async(e,t)=>{if(e){if(e.query&&(this.queryParams=this.buildSearchParams(e.query)),e.form){let t=new FormData;for(let[n,r]of Object.entries(e.form))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.append(n,r);this.rBody=t}e.json&&(this.rBody=JSON.stringify(e.json),this.cType=`application/json`),e.param&&(this.pathParams=e.param)}let n=this.method.toUpperCase(),i={...e?.header,...typeof t?.headers==`function`?await t.headers():t?.headers};if(e?.cookie){let t=[];for(let[n,i]of Object.entries(e.cookie))t.push(r(n,i,{path:`/`}));i.Cookie=t.join(`,`)}this.cType&&(i[`Content-Type`]=this.cType);let o=new Headers(i??void 0),s=this.url;s=c(s),s=a(s,this.pathParams),this.queryParams&&(s=s+`?`+this.queryParams.toString()),n=this.method.toUpperCase();let l=!(n===`GET`||n===`HEAD`);return(t?.fetch||fetch)(s,{body:l?this.rBody:void 0,method:n,headers:o,...t?.init})}},p=(e,t)=>d(function n(r){let l=t?.buildSearchParams??o,d=[...r.path],p=d.slice(-3).reverse();if(p[0]===`toString`)return p[1]===`name`?p[2]||``:n.toString();if(p[0]===`valueOf`)return p[1]===`name`?p[2]||``:n;let m=``;if(/^\$/.test(p[0])){let e=d.pop();e&&(m=e.replace(/^\$/,``))}let h=i(e,d.join(`/`));if(m===`url`||m===`path`){let t=h;return r.args[0]&&(r.args[0].param&&(t=a(h,r.args[0].param)),r.args[0].query&&(t=t+`?`+l(r.args[0].query).toString())),t=c(t),m===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(m===`ws`){let e=s(r.args[0]&&r.args[0].param?a(h,r.args[0].param):h,`ws`),n=new URL(e),i=r.args[0]?.query;return i&&Object.entries(i).forEach(([e,t])=>{Array.isArray(t)?t.forEach(t=>n.searchParams.append(e,t)):n.searchParams.set(e,t)}),((...e)=>t?.webSocket!==void 0&&typeof t.webSocket==`function`?t.webSocket(...e):new WebSocket(...e))(n.toString())}let g=new f(h,m,{buildSearchParams:l});if(m){t??={};let e=u(t,{...r.args[1]});return g.fetch(r.args[0],e)}return g},[]);function m(e=``,t){return p(e,t)}function h(t=e(),n){return m(t,n)}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,o as a}from"./api-base-url-DIb6qukm.js";import{n as o,t as s}from"./createReactComponent-_L2mp4Ui.js";import{t as c}from"./IconArrowRight-DsOD7mDl.js";import{a as l,i as u,n as d,r as f,t as p}from"./select-D6km4Obp.js";import{t as m}from"./IconHistory-BqAd-xl2.js";import{t as h}from"./useSuspenseQuery-B2g_FID5.js";import{i as g,n as _,r as v,t as y}from"./index-crEoj0do.js";import{t as b}from"./input-CG_cIxvO.js";import{n as x}from"./format-date-Ctrh7my1.js";import{t as ee}from"./badge-C1_ZMBRy.js";import{a as S,i as C,n as w,r as T,t as E}from"./empty-COnWCwda.js";import{t as D}from"./label-CWOhoN_L.js";import{a as O,i as k,n as A,o as te,r as j,t as M}from"./table-DCvfJyLS.js";var N=s(`outline`,`arrow-left`,`ArrowLeft`,[[`path`,{d:`M5 12l14 0`,key:`svg-0`}],[`path`,{d:`M5 12l6 6`,key:`svg-1`}],[`path`,{d:`M5 12l6 -6`,key:`svg-2`}]]),ne=r(),P=e(t(),1),F=n(),I=i(`/_authenticated/$org_slug/audit`);function L(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function re(e){let t=e.trim();return t.length>0?t:void 0}function R(e,t=160){return e.length<=t?e:`${e.slice(0,t-1)}…`}function ie(e){return e===`succeeded`?`secondary`:e===`pending`?`outline`:`destructive`}function ae(e){return e.originActor.email??`System`}function oe(e){return e.family===`query_action`?[e.metrics?.elapsedMs!==null&&e.metrics?.elapsedMs!==void 0?`${e.metrics.elapsedMs} ms`:null,e.metrics?.rowCount!==null&&e.metrics?.rowCount!==void 0?`${e.metrics.rowCount} rows`:null].filter(Boolean).join(` · `):[e.metrics?.pageCount!==null&&e.metrics?.pageCount!==void 0?`${e.metrics.pageCount} pages`:null,e.metrics?.httpStatus!==null&&e.metrics?.httpStatus!==void 0?`HTTP ${e.metrics.httpStatus}`:null].filter(Boolean).join(` · `)}function se(e){return e.family===`query_action`?R(e.preview?.queryText??e.subtitle):R([e.preview?.method,e.preview?.selector].filter(Boolean).join(` `)||e.subtitle)}function ce(e){let t=(0,ne.c)(74),{item:n}=e,r;t[0]===n?r=t[1]:(r=oe(n),t[0]=n,t[1]=r);let i=r,a;t[2]===n.startedAt?a=t[3]:(a=x(n.startedAt),t[2]=n.startedAt,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,F.jsx)(`div`,{className:`font-medium`,children:a}),t[4]=a,t[5]=o);let s;t[6]===n.originSurface?s=t[7]:(s=L(n.originSurface),t[6]=n.originSurface,t[7]=s);let c;t[8]===s?c=t[9]:(c=(0,F.jsxs)(`div`,{className:`text-muted-foreground mt-1 text-xs`,children:[`Started · `,s]}),t[8]=s,t[9]=c);let l;t[10]!==n.lastEventAt||t[11]!==n.startedAt?(l=n.lastEventAt===n.startedAt?null:(0,F.jsxs)(`div`,{className:`text-muted-foreground mt-1 text-xs`,children:[`Last event · `,x(n.lastEventAt)]}),t[10]=n.lastEventAt,t[11]=n.startedAt,t[12]=l):l=t[12];let u;t[13]!==o||t[14]!==c||t[15]!==l?(u=(0,F.jsx)(j,{className:`align-top`,children:(0,F.jsxs)(`div`,{className:`min-w-[170px]`,children:[o,c,l]})}),t[13]=o,t[14]=c,t[15]=l,t[16]=u):u=t[16];let d;t[17]===n?d=t[18]:(d=ae(n),t[17]=n,t[18]=d);let f;t[19]===d?f=t[20]:(f=(0,F.jsx)(`div`,{className:`font-medium`,children:d}),t[19]=d,t[20]=f);let p;t[21]===n.originActor.membershipRoles?p=t[22]:(p=n.originActor.membershipRoles.length>0?n.originActor.membershipRoles.map(L).join(`, `):`No membership roles recorded`,t[21]=n.originActor.membershipRoles,t[22]=p);let m;t[23]===p?m=t[24]:(m=(0,F.jsx)(`div`,{className:`text-muted-foreground mt-1 text-xs`,children:p}),t[23]=p,t[24]=m);let h;t[25]!==m||t[26]!==f?(h=(0,F.jsxs)(j,{className:`align-top whitespace-normal`,children:[f,m]}),t[25]=m,t[26]=f,t[27]=h):h=t[27];let g;t[28]===n.family?g=t[29]:(g=L(n.family),t[28]=n.family,t[29]=g);let _;t[30]===g?_=t[31]:(_=(0,F.jsx)(ee,{variant:`outline`,children:g}),t[30]=g,t[31]=_);let v;t[32]===n.title?v=t[33]:(v=(0,F.jsx)(`span`,{className:`font-medium`,children:n.title}),t[32]=n.title,t[33]=v);let y;t[34]!==_||t[35]!==v?(y=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[_,v]}),t[34]=_,t[35]=v,t[36]=y):y=t[36];let b;t[37]===n.subtitle?b=t[38]:(b=(0,F.jsx)(`div`,{className:`text-muted-foreground mt-2 text-sm`,children:n.subtitle}),t[37]=n.subtitle,t[38]=b);let S;t[39]===n?S=t[40]:(S=se(n),t[39]=n,t[40]=S);let C;t[41]===S?C=t[42]:(C=(0,F.jsx)(`div`,{className:`text-muted-foreground mt-2 text-xs font-mono break-words`,children:S}),t[41]=S,t[42]=C);let w;t[43]!==y||t[44]!==b||t[45]!==C?(w=(0,F.jsxs)(j,{className:`min-w-[420px] align-top whitespace-normal`,children:[y,b,C]}),t[43]=y,t[44]=b,t[45]=C,t[46]=w):w=t[46];let T;t[47]===n.outcome?T=t[48]:(T=ie(n.outcome),t[47]=n.outcome,t[48]=T);let E;t[49]===n.outcome?E=t[50]:(E=L(n.outcome),t[49]=n.outcome,t[50]=E);let D;t[51]!==T||t[52]!==E?(D=(0,F.jsx)(ee,{variant:T,children:E}),t[51]=T,t[52]=E,t[53]=D):D=t[53];let O;t[54]===n.phase?O=t[55]:(O=L(n.phase),t[54]=n.phase,t[55]=O);let k;t[56]===O?k=t[57]:(k=(0,F.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:O}),t[56]=O,t[57]=k);let A;t[58]===n.lastEventType?A=t[59]:(A=L(n.lastEventType),t[58]=n.lastEventType,t[59]=A);let M;t[60]===A?M=t[61]:(M=(0,F.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:A}),t[60]=A,t[61]=M);let N;t[62]===i?N=t[63]:(N=i?(0,F.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:i}):null,t[62]=i,t[63]=N);let P;t[64]!==D||t[65]!==k||t[66]!==M||t[67]!==N?(P=(0,F.jsx)(j,{className:`align-top whitespace-normal`,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[D,k,M,N]})}),t[64]=D,t[65]=k,t[66]=M,t[67]=N,t[68]=P):P=t[68];let I;return t[69]!==h||t[70]!==w||t[71]!==P||t[72]!==u?(I=(0,F.jsxs)(te,{children:[u,h,w,P]}),t[69]=h,t[70]=w,t[71]=P,t[72]=u,t[73]=I):I=t[73],I}function le(){let e=(0,ne.c)(93),t=a(),{organizationSlug:n,session:r}=I.useRouteContext(),i=I.useSearch(),s;e[0]!==n||e[1]!==i||e[2]!==r.user.id?(s=y(r.user.id,n,i),e[0]=n,e[1]=i,e[2]=r.user.id,e[3]=s):s=e[3];let{data:x,isFetching:ee}=h(s),[j,L]=(0,P.useState)(i.q??``),[R,ie]=(0,P.useState)(i.sourceKey??``),ae,oe;e[4]===i.q?(ae=e[5],oe=e[6]):(ae=()=>{L(i.q??``)},oe=[i.q],e[4]=i.q,e[5]=ae,e[6]=oe),(0,P.useEffect)(ae,oe);let se,ce;e[7]===i.sourceKey?(se=e[8],ce=e[9]):(se=()=>{ie(i.sourceKey??``)},ce=[i.sourceKey],e[7]=i.sourceKey,e[8]=se,e[9]=ce),(0,P.useEffect)(se,ce);let le;e[10]!==t||e[11]!==n?(le=function(e){(0,P.startTransition)(()=>{t({params:{org_slug:n},replace:!0,search:t=>({...t,limit:t.limit,...e}),to:`/$org_slug/audit`})})},e[10]=t,e[11]=n,e[12]=le):le=e[12];let z=le,me;e[13]!==j||e[14]!==R||e[15]!==z?(me=function(e){e.preventDefault(),z({cursor:void 0,q:re(j),sourceKey:re(R)})},e[13]=j,e[14]=R,e[15]=z,e[16]=me):me=e[16];let he=me,ge;e[17]!==t||e[18]!==n||e[19]!==i.limit?(ge=function(){L(``),ie(``),(0,P.startTransition)(()=>{t({params:{org_slug:n},replace:!0,search:{actionName:void 0,cursor:void 0,family:void 0,limit:i.limit,outcome:void 0,q:void 0,sourceKey:void 0},to:`/$org_slug/audit`})})},e[17]=t,e[18]=n,e[19]=i.limit,e[20]=ge):ge=e[20];let _e=ge,ve;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Audit`}),(0,F.jsx)(`p`,{className:`text-muted-foreground mt-2`,children:`One row per audited action across query and source API workflows. Ordered by action start time so pagination stays stable while actions continue to evolve.`})]}),e[21]=ve):ve=e[21];let ye;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,F.jsx)(D,{htmlFor:`audit-search`,children:`Search`}),e[22]=ye):ye=e[22];let be;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(be=e=>L(e.target.value),e[23]=be):be=e[23];let B;e[24]===j?B=e[25]:(B=(0,F.jsxs)(`div`,{className:`space-y-2`,children:[ye,(0,F.jsx)(b,{id:`audit-search`,value:j,onChange:be,placeholder:`Actor, query text, operation, or title`})]}),e[24]=j,e[25]=B);let xe;e[26]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,F.jsx)(D,{htmlFor:`audit-source-key`,children:`Source Key`}),e[26]=xe):xe=e[26];let Se;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(Se=e=>ie(e.target.value),e[27]=Se):Se=e[27];let V;e[28]===R?V=e[29]:(V=(0,F.jsxs)(`div`,{className:`space-y-2`,children:[xe,(0,F.jsx)(b,{id:`audit-source-key`,value:R,onChange:Se,placeholder:`warehouse`})]}),e[28]=R,e[29]=V);let Ce;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,F.jsx)(D,{htmlFor:`audit-outcome`,children:`Outcome`}),e[30]=Ce):Ce=e[30];let we=i.outcome??`all`,H;e[31]===z?H=e[32]:(H=e=>{z({cursor:void 0,outcome:e&&e!==`all`?e:void 0})},e[31]=z,e[32]=H);let Te;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,F.jsx)(u,{id:`audit-outcome`,className:`w-full`,children:(0,F.jsx)(l,{})}),e[33]=Te):Te=e[33];let Ee;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,F.jsxs)(d,{children:[(0,F.jsx)(f,{value:`all`,children:`All outcomes`}),g.map(pe)]}),e[34]=Ee):Ee=e[34];let U;e[35]!==we||e[36]!==H?(U=(0,F.jsxs)(`div`,{className:`space-y-2`,children:[Ce,(0,F.jsxs)(p,{value:we,onValueChange:H,children:[Te,Ee]})]}),e[35]=we,e[36]=H,e[37]=U):U=e[37];let De;e[38]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,F.jsx)(D,{htmlFor:`audit-family`,children:`Family`}),e[38]=De):De=e[38];let Oe=i.family??`all`,W;e[39]===z?W=e[40]:(W=e=>{z({cursor:void 0,family:e&&e!==`all`?e:void 0})},e[39]=z,e[40]=W);let ke;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,F.jsx)(u,{id:`audit-family`,className:`w-full`,children:(0,F.jsx)(l,{})}),e[41]=ke):ke=e[41];let Ae;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,F.jsxs)(d,{children:[(0,F.jsx)(f,{value:`all`,children:`All families`}),v.map(fe)]}),e[42]=Ae):Ae=e[42];let G;e[43]!==Oe||e[44]!==W?(G=(0,F.jsxs)(`div`,{className:`space-y-2`,children:[De,(0,F.jsxs)(p,{value:Oe,onValueChange:W,children:[ke,Ae]})]}),e[43]=Oe,e[44]=W,e[45]=G):G=e[45];let je;e[46]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,F.jsx)(D,{htmlFor:`audit-action-name`,children:`Action`}),e[46]=je):je=e[46];let Me=i.actionName??`all`,K;e[47]===z?K=e[48]:(K=e=>{z({actionName:e&&e!==`all`?e:void 0,cursor:void 0})},e[47]=z,e[48]=K);let Ne;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,F.jsx)(u,{id:`audit-action-name`,className:`w-full`,children:(0,F.jsx)(l,{})}),e[49]=Ne):Ne=e[49];let Pe;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,F.jsxs)(d,{children:[(0,F.jsx)(f,{value:`all`,children:`All actions`}),_.map(de)]}),e[50]=Pe):Pe=e[50];let q;e[51]!==Me||e[52]!==K?(q=(0,F.jsxs)(`div`,{className:`space-y-2`,children:[je,(0,F.jsxs)(p,{value:Me,onValueChange:K,children:[Ne,Pe]})]}),e[51]=Me,e[52]=K,e[53]=q):q=e[53];let Fe;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,F.jsx)(`div`,{className:`flex items-end`,children:(0,F.jsx)(o,{type:`submit`,className:`w-full lg:w-auto`,children:`Apply`})}),e[54]=Fe):Fe=e[54];let J;e[55]===_e?J=e[56]:(J=(0,F.jsx)(`div`,{className:`flex items-end`,children:(0,F.jsx)(o,{type:`button`,variant:`ghost`,className:`w-full lg:w-auto`,onClick:_e,children:`Clear`})}),e[55]=_e,e[56]=J);let Y;e[57]!==he||e[58]!==B||e[59]!==V||e[60]!==U||e[61]!==G||e[62]!==q||e[63]!==J?(Y=(0,F.jsxs)(`form`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1.2fr)_minmax(0,0.8fr)_180px_180px_180px_auto_auto]`,onSubmit:he,children:[B,V,U,G,q,Fe,J]}),e[57]=he,e[58]=B,e[59]=V,e[60]=U,e[61]=G,e[62]=q,e[63]=J,e[64]=Y):Y=e[64];let Ie=i.cursor?` · viewing older results`:` · newest first`,Le=ee?` · updating`:``,X;e[65]!==x.items.length||e[66]!==Ie||e[67]!==Le?(X=(0,F.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[x.items.length,` entries on this page`,Ie,Le]}),e[65]=x.items.length,e[66]=Ie,e[67]=Le,e[68]=X):X=e[68];let Z;e[69]!==i.cursor||e[70]!==z?(Z=i.cursor?(0,F.jsxs)(o,{type:`button`,variant:`outline`,onClick:()=>z({cursor:void 0}),children:[(0,F.jsx)(N,{size:16,stroke:2}),`Newest`]}):null,e[69]=i.cursor,e[70]=z,e[71]=Z):Z=e[71];let Q;e[72]!==x.nextCursor||e[73]!==z?(Q=()=>{x.nextCursor&&z({cursor:x.nextCursor})},e[72]=x.nextCursor,e[73]=z,e[74]=Q):Q=e[74];let Re=!x.nextCursor,ze;e[75]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,F.jsx)(c,{size:16,stroke:2}),e[75]=ze):ze=e[75];let Be;e[76]!==Q||e[77]!==Re?(Be=(0,F.jsxs)(o,{type:`button`,variant:`outline`,onClick:Q,disabled:Re,children:[`Older`,ze]}),e[76]=Q,e[77]=Re,e[78]=Be):Be=e[78];let Ve;e[79]!==Z||e[80]!==Be?(Ve=(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Z,Be]}),e[79]=Z,e[80]=Be,e[81]=Ve):Ve=e[81];let He;e[82]!==X||e[83]!==Ve?(He=(0,F.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[X,Ve]}),e[82]=X,e[83]=Ve,e[84]=He):He=e[84];let Ue;e[85]!==Y||e[86]!==He?(Ue=(0,F.jsxs)(`section`,{className:`rounded-xl border p-4`,children:[Y,He]}),e[85]=Y,e[86]=He,e[87]=Ue):Ue=e[87];let $;e[88]===x.items?$=e[89]:($=x.items.length===0?(0,F.jsx)(E,{className:`border`,children:(0,F.jsxs)(T,{children:[(0,F.jsx)(C,{variant:`icon`,children:(0,F.jsx)(m,{size:18,stroke:1.75})}),(0,F.jsx)(S,{children:`No audit entries matched these filters`}),(0,F.jsx)(w,{children:`Try clearing the filters or waiting for new workflow activity in this organization.`})]})}):(0,F.jsx)(`div`,{className:`rounded-md border`,children:(0,F.jsxs)(M,{children:[(0,F.jsx)(O,{children:(0,F.jsxs)(te,{children:[(0,F.jsx)(k,{children:`When`}),(0,F.jsx)(k,{children:`Actor`}),(0,F.jsx)(k,{children:`Activity`}),(0,F.jsx)(k,{children:`Status`})]})}),(0,F.jsx)(A,{children:x.items.map(ue)})]})}),e[88]=x.items,e[89]=$);let We;return e[90]!==Ue||e[91]!==$?(We=(0,F.jsxs)(`div`,{className:`space-y-8 p-8`,children:[ve,Ue,$]}),e[90]=Ue,e[91]=$,e[92]=We):We=e[92],We}function ue(e){return(0,F.jsx)(ce,{item:e},e.id)}function de(e){return(0,F.jsx)(f,{value:e,children:L(e)},e)}function fe(e){return(0,F.jsx)(f,{value:e,children:L(e)},e)}function pe(e){return(0,F.jsx)(f,{value:e,children:L(e)},e)}var z=le;export{z as component};
@@ -1 +1 @@
1
- import{t as e}from"./api-base-url-DIb6qukm.js";import{t}from"./queryOptions-BHw87wTZ.js";import{a as n}from"./query-timing-LGzitMXx.js";import{i as r,l as i,n as a}from"./schemas-MsKXD_XQ.js";import{n as o}from"./api-paths-ClEWWGwS.js";var s=i({emailDeliveryMode:a([`manual-link`,`smtp`]),hasUsers:r(),publicSignupAllowed:r(),signupMode:a([`first-user`,`invite-only`])});async function c(){let t=await fetch(`${e()}${o}`,{credentials:`include`});if(!t.ok)throw Error(`Failed to load auth bootstrap state`);let n=await t.json().catch(()=>null);return s.parse(n)}function l(){return t({queryFn:c,queryKey:[`auth`,`bootstrap-state`],staleTime:n})}export{l as t};
1
+ import{t as e}from"./api-base-url-DIb6qukm.js";import{t}from"./queryOptions-BHw87wTZ.js";import{a as n}from"./query-timing-LGzitMXx.js";import{i as r,n as i,u as a}from"./schemas-n4sxh6jF.js";import{n as o}from"./api-paths-Cjr2f6P6.js";var s=a({emailDeliveryMode:i([`manual-link`,`smtp`]),hasUsers:r(),publicSignupAllowed:r(),signupMode:i([`first-user`,`invite-only`])});async function c(){let t=await fetch(`${e()}${o}`,{credentials:`include`});if(!t.ok)throw Error(`Failed to load auth bootstrap state`);let n=await t.json().catch(()=>null);return s.parse(n)}function l(){return t({queryFn:c,queryKey:[`auth`,`bootstrap-state`],staleTime:n})}export{l as t};
@@ -1,3 +1,3 @@
1
1
  import{i as e,n as t}from"./jsx-runtime-DG_AJzB_.js";import{t as n}from"./api-base-url-DIb6qukm.js";function r(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}]))}r({FAILED_TO_CREATE_USER:`Failed to create user`,USER_ALREADY_EXISTS:`User already exists.`,USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:`User already exists. Use another email.`,YOU_CANNOT_BAN_YOURSELF:`You cannot ban yourself`,YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE:`You are not allowed to change users role`,YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS:`You are not allowed to create users`,YOU_ARE_NOT_ALLOWED_TO_LIST_USERS:`You are not allowed to list users`,YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS:`You are not allowed to list users sessions`,YOU_ARE_NOT_ALLOWED_TO_BAN_USERS:`You are not allowed to ban users`,YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS:`You are not allowed to impersonate users`,YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS:`You are not allowed to revoke users sessions`,YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS:`You are not allowed to delete users`,YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD:`You are not allowed to set users password`,BANNED_USER:`You have been banned from this application`,YOU_ARE_NOT_ALLOWED_TO_GET_USER:`You are not allowed to get user`,NO_DATA_TO_UPDATE:`No data to update`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS:`You are not allowed to update users`,YOU_CANNOT_REMOVE_YOURSELF:`You cannot remove yourself`,YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE:`You are not allowed to set a non-existent role value`,YOU_CANNOT_IMPERSONATE_ADMINS:`You cannot impersonate admins`,INVALID_ROLE_TYPE:`Invalid role type`}),r({USER_NOT_FOUND:`User not found`,FAILED_TO_CREATE_USER:`Failed to create user`,FAILED_TO_CREATE_SESSION:`Failed to create session`,FAILED_TO_UPDATE_USER:`Failed to update user`,FAILED_TO_GET_SESSION:`Failed to get session`,INVALID_PASSWORD:`Invalid password`,INVALID_EMAIL:`Invalid email`,INVALID_EMAIL_OR_PASSWORD:`Invalid email or password`,INVALID_USER:`Invalid user`,SOCIAL_ACCOUNT_ALREADY_LINKED:`Social account already linked`,PROVIDER_NOT_FOUND:`Provider not found`,INVALID_TOKEN:`Invalid token`,TOKEN_EXPIRED:`Token expired`,ID_TOKEN_NOT_SUPPORTED:`id_token not supported`,FAILED_TO_GET_USER_INFO:`Failed to get user info`,USER_EMAIL_NOT_FOUND:`User email not found`,EMAIL_NOT_VERIFIED:`Email not verified`,PASSWORD_TOO_SHORT:`Password too short`,PASSWORD_TOO_LONG:`Password too long`,USER_ALREADY_EXISTS:`User already exists.`,USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:`User already exists. Use another email.`,EMAIL_CAN_NOT_BE_UPDATED:`Email can not be updated`,CREDENTIAL_ACCOUNT_NOT_FOUND:`Credential account not found`,SESSION_EXPIRED:`Session expired. Re-authenticate to perform this action.`,FAILED_TO_UNLINK_LAST_ACCOUNT:`You can't unlink your last account`,ACCOUNT_NOT_FOUND:`Account not found`,USER_ALREADY_HAS_PASSWORD:`User already has a password. Provide that to delete the account.`,CROSS_SITE_NAVIGATION_LOGIN_BLOCKED:`Cross-site navigation login blocked. This request appears to be a CSRF attack.`,VERIFICATION_EMAIL_NOT_ENABLED:`Verification email isn't enabled`,EMAIL_ALREADY_VERIFIED:`Email is already verified`,EMAIL_MISMATCH:`Email mismatch`,SESSION_NOT_FRESH:`Session is not fresh`,LINKED_ACCOUNT_ALREADY_EXISTS:`Linked account already exists`,INVALID_ORIGIN:`Invalid origin`,INVALID_CALLBACK_URL:`Invalid callbackURL`,INVALID_REDIRECT_URL:`Invalid redirectURL`,INVALID_ERROR_CALLBACK_URL:`Invalid errorCallbackURL`,INVALID_NEW_USER_CALLBACK_URL:`Invalid newUserCallbackURL`,MISSING_OR_NULL_ORIGIN:`Missing or null Origin`,CALLBACK_URL_REQUIRED:`callbackURL is required`,FAILED_TO_CREATE_VERIFICATION:`Unable to create verification`,FIELD_NOT_ALLOWED:`Field not allowed to be set`,ASYNC_VALIDATION_NOT_SUPPORTED:`Async validation is not supported`,VALIDATION_ERROR:`Validation Error`,MISSING_FIELD:`Field is required`,METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED:`POST method requires deferSessionRefresh to be enabled in session config`,BODY_MUST_BE_AN_OBJECT:`Body must be an object`,PASSWORD_ALREADY_SET:`User already has a password set`});function i(){let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,`writable`)?e.writable:e.set!==void 0}function a(e){let t=e.split(`
2
2
  at `);return t.length<=1?e:(t.splice(1,1),t.join(`
3
- at `))}function o(e,t){class n extends e{#e;constructor(...e){if(i()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let t=Error().stack;t&&(this.#e=a(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(n.prototype,`constructor`,{get(){return t},enumerable:!1,configurable:!0}),n}var s={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511};o(class extends Error{constructor(e=`INTERNAL_SERVER_ERROR`,t=void 0,n={},r=typeof e==`number`?e:s[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=n,this.statusCode=r,this.name=`APIError`,this.status=e,this.headers=n,this.statusCode=r,this.body=t}},Error);var c=class extends Error{constructor(e,t){super(e,t),this.name=`BetterAuthError`,this.message=e,this.stack=``}};function l(e){return{authorize(t,n=`AND`){let r=!1;for(let[i,a]of Object.entries(t)){let t=e[i];if(!t)return{success:!1,error:`You are not allowed to access resource: ${i}`};if(Array.isArray(a))r=a.every(e=>t.includes(e));else if(typeof a==`object`){let e=a;r=e.connector===`OR`?e.actions.some(e=>t.includes(e)):e.actions.every(e=>t.includes(e))}else throw new c(`Invalid access control request`);if(r&&n===`OR`)return{success:r};if(!r&&n===`AND`)return{success:!1,error:`unauthorized to access resource "${i}"`}}return r?{success:r}:{success:!1,error:`Not authorized`}},statements:e}}function u(e){return{newRole(e){return l(e)},statements:e}}var d=u({user:[`create`,`list`,`set-role`,`ban`,`impersonate`,`impersonate-admins`,`delete`,`set-password`,`get`,`update`],session:[`list`,`revoke`,`delete`]});d.newRole({user:[`create`,`list`,`set-role`,`ban`,`impersonate`,`delete`,`set-password`,`get`,`update`],session:[`list`,`revoke`,`delete`]}),d.newRole({user:[],session:[]}),r({INVALID_EMAIL_FORMAT:`Email was not generated in a valid format`,FAILED_TO_CREATE_USER:`Failed to create user`,COULD_NOT_CREATE_SESSION:`Could not create session`,ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY:`Anonymous users cannot sign in again anonymously`,FAILED_TO_DELETE_ANONYMOUS_USER:`Failed to delete anonymous user`,USER_IS_NOT_ANONYMOUS:`User is not anonymous`,DELETE_ANONYMOUS_USER_DISABLED:`Deleting anonymous users is disabled`}),r({OTP_EXPIRED:`OTP expired`,INVALID_OTP:`Invalid OTP`,TOO_MANY_ATTEMPTS:`Too many attempts`}),r({INVALID_OAUTH_CONFIGURATION:`Invalid OAuth configuration`,TOKEN_URL_NOT_FOUND:`Invalid OAuth configuration. Token URL not found.`,PROVIDER_CONFIG_NOT_FOUND:`No config found for provider`,PROVIDER_ID_REQUIRED:`Provider ID is required`,INVALID_OAUTH_CONFIG:`Invalid OAuth configuration.`,SESSION_REQUIRED:`Session is required`,ISSUER_MISMATCH:`OAuth issuer mismatch. The authorization server issuer does not match the expected value (RFC 9207).`,ISSUER_MISSING:`OAuth issuer parameter missing. The authorization server did not include the required iss parameter (RFC 9207).`}),r({INVALID_SESSION_TOKEN:`Invalid session token`});var f=r({YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION:`You are not allowed to create a new organization`,YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS:`You have reached the maximum number of organizations`,ORGANIZATION_ALREADY_EXISTS:`Organization already exists`,ORGANIZATION_SLUG_ALREADY_TAKEN:`Organization slug already taken`,ORGANIZATION_NOT_FOUND:`Organization not found`,USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION:`User is not a member of the organization`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION:`You are not allowed to update this organization`,YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION:`You are not allowed to delete this organization`,NO_ACTIVE_ORGANIZATION:`No active organization`,USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION:`User is already a member of this organization`,MEMBER_NOT_FOUND:`Member not found`,ROLE_NOT_FOUND:`Role not found`,YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM:`You are not allowed to create a new team`,TEAM_ALREADY_EXISTS:`Team already exists`,TEAM_NOT_FOUND:`Team not found`,YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER:`You cannot leave the organization as the only owner`,YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER:`You cannot leave the organization without an owner`,YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER:`You are not allowed to delete this member`,YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION:`You are not allowed to invite users to this organization`,USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION:`User is already invited to this organization`,INVITATION_NOT_FOUND:`Invitation not found`,YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION:`You are not the recipient of the invitation`,EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION:`Email verification required before accepting or rejecting invitation`,YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION:`You are not allowed to cancel this invitation`,INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION:`Inviter is no longer a member of the organization`,YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE:`You are not allowed to invite a user with this role`,FAILED_TO_RETRIEVE_INVITATION:`Failed to retrieve invitation`,YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS:`You have reached the maximum number of teams`,UNABLE_TO_REMOVE_LAST_TEAM:`Unable to remove last team`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER:`You are not allowed to update this member`,ORGANIZATION_MEMBERSHIP_LIMIT_REACHED:`Organization membership limit reached`,YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION:`You are not allowed to create teams in this organization`,YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION:`You are not allowed to delete teams in this organization`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM:`You are not allowed to update this team`,YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM:`You are not allowed to delete this team`,INVITATION_LIMIT_REACHED:`Invitation limit reached`,TEAM_MEMBER_LIMIT_REACHED:`Team member limit reached`,USER_IS_NOT_A_MEMBER_OF_THE_TEAM:`User is not a member of the team`,YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM:`You are not allowed to list the members of this team`,YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM:`You do not have an active team`,YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER:`You are not allowed to create a new member`,YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER:`You are not allowed to remove a team member`,YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION:`You are not allowed to access this organization as an owner`,YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION:`You are not a member of this organization`,MISSING_AC_INSTANCE:`Dynamic Access Control requires a pre-defined ac instance on the server auth plugin. Read server logs for more information`,YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE:`You must be in an organization to create a role`,YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE:`You are not allowed to create a role`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE:`You are not allowed to update a role`,YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE:`You are not allowed to delete a role`,YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE:`You are not allowed to read a role`,YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE:`You are not allowed to list a role`,YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE:`You are not allowed to get a role`,TOO_MANY_ROLES:`This organization has too many roles`,INVALID_RESOURCE:`The provided permission includes an invalid resource`,ROLE_NAME_IS_ALREADY_TAKEN:`That role name is already taken`,CANNOT_DELETE_A_PRE_DEFINED_ROLE:`Cannot delete a pre-defined role`,ROLE_IS_ASSIGNED_TO_MEMBERS:`Cannot delete a role that is assigned to members. Please reassign the members to a different role first`}),p=[],m=0,h=4,g=0,_=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},init:e,lc:0,listen(e){return n.lc=t.push(e),()=>{for(let t=m+h;t<p.length;)p[t]===e?p.splice(t,h):t+=h;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}},notify(e,r){g++;let i=!p.length;for(let i of t)p.push(i,n.value,e,r);if(i){for(m=0;m<p.length;m+=h)p[m](p[m+1],p[m+2],p[m+3]);p.length=0}},off(){},set(e){let t=n.value;t!==e&&(n.value=e,n.notify(t))},subscribe(e){let t=n.listen(e);return e(n.value),t},value:e};return n},v=5,y=6,b=10,ee=(e,t,n,r)=>(e.events=e.events||{},e.events[n+b]||(e.events[n+b]=r(t=>{e.events[n].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let r=e.events[n],i=r.indexOf(t);r.splice(i,1),r.length||(delete e.events[n],e.events[n+b](),delete e.events[n+b])}),te=1e3,x=(e,t)=>ee(e,n=>{let r=t(n);r&&e.events[y].push(r)},v,t=>{let n=e.listen;e.listen=(...r)=>(!e.lc&&!e.active&&(e.active=!0,t()),n(...r));let r=e.off;return e.events[y]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[y])t();e.events[y]=[]}},te)},()=>{e.listen=n,e.off=r}});function ne(e,t,n){let r=new Set(t).add(void 0);return e.listen((e,t,i)=>{r.has(i)&&n(e,t,i)})}var re=()=>typeof window>`u`,S=(e,t,n,r)=>{let i=_({data:null,error:null,isPending:!0,isRefetching:!1,refetch:e=>a(e)}),a=async e=>new Promise(a=>{let o=typeof r==`function`?r({data:i.get().data,error:i.get().error,isPending:i.get().isPending}):r;n(t,{...o,query:{...o?.query,...e?.query},async onSuccess(e){i.set({data:e.data,error:null,isPending:!1,isRefetching:!1,refetch:i.value.refetch}),await o?.onSuccess?.(e)},async onError(e){let{request:t}=e,n=typeof t.retry==`number`?t.retry:t.retry?.attempts,r=t.retryAttempt||0;if(n&&r<n)return;let a=e.error.status===401;i.set({error:e.error,data:a?null:i.get().data,isPending:!1,isRefetching:!1,refetch:i.value.refetch}),await o?.onError?.(e)},async onRequest(e){let t=i.get();i.set({isPending:t.data===null,data:t.data,error:null,isRefetching:!0,refetch:i.value.refetch}),await o?.onRequest?.(e)}}).catch(e=>{i.set({error:e,data:i.get().data,isPending:!1,isRefetching:!1,refetch:i.value.refetch})}).finally(()=>{a(void 0)})});e=Array.isArray(e)?e:[e];let o=!1;for(let t of e)t.subscribe(async()=>{re()||(o?await a():x(i,()=>{let e=setTimeout(async()=>{o||=(await a(),!0)},0);return()=>{i.off(),t.off(),clearTimeout(e)}}))});return i},C=Symbol.for(`better-auth:broadcast-channel`),ie=()=>Math.floor(Date.now()/1e3),ae=class{listeners=new Set;name;constructor(e=`better-auth.message`){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(!(typeof window>`u`))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:ie()}))}catch{}}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=e=>{if(e.key!==this.name)return;let t=JSON.parse(e.newValue??`{}`);t?.event!==`session`||!t?.data||this.listeners.forEach(e=>e(t))};return window.addEventListener(`storage`,e),()=>{window.removeEventListener(`storage`,e)}}};function w(e=`better-auth.message`){return globalThis[C]||(globalThis[C]=new ae(e)),globalThis[C]}var T=Symbol.for(`better-auth:focus-manager`),oe=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||typeof document>`u`||window.addEventListener===void 0)return()=>{};let e=()=>{document.visibilityState===`visible`&&this.setFocused(!0)};return document.addEventListener(`visibilitychange`,e,!1),()=>{document.removeEventListener(`visibilitychange`,e,!1)}}};function se(){return globalThis[T]||(globalThis[T]=new oe),globalThis[T]}var E=Symbol.for(`better-auth:online-manager`),ce=class{listeners=new Set;isOnline=typeof navigator<`u`?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener(`online`,e,!1),window.addEventListener(`offline`,t,!1),()=>{window.removeEventListener(`online`,e,!1),window.removeEventListener(`offline`,t,!1)}}};function D(){return globalThis[E]||(globalThis[E]=new ce),globalThis[E]}var le={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},ue=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,de={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},fe=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function pe(e){return e instanceof Date&&!isNaN(e.getTime())}function me(e){let t=fe.exec(e);if(!t)return null;let[,n,r,i,a,o,s,c,l,u,d]=t,f=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(i,10),parseInt(a,10),parseInt(o,10),parseInt(s,10),c?parseInt(c.padEnd(3,`0`),10):0));if(l){let e=(parseInt(u,10)*60+parseInt(d,10))*(l===`+`?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return pe(f)?f:null}function he(e,t={}){let{strict:n=!1,warnings:r=!1,reviver:i,parseDates:a=!0}=t;if(typeof e!=`string`)return e;let o=e.trim();if(o.length>0&&o[0]===`"`&&o.endsWith(`"`)&&!o.slice(1,-1).includes(`"`))return o.slice(1,-1);let s=o.toLowerCase();if(s.length<=9&&s in de)return de[s];if(!ue.test(o)){if(n)throw SyntaxError(`[better-json] Invalid JSON`);return e}if(Object.entries(le).some(([e,t])=>{let n=t.test(o);return n&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`),n})&&n)throw Error(`[better-json] Potential prototype pollution attempt detected`);try{return JSON.parse(o,(e,t)=>{if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){r&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(a&&typeof t==`string`){let e=me(t);if(e)return e}return i?i(e,t):t})}catch(t){if(n)throw t;return e}}function ge(e,t={strict:!0}){return he(e,t)}var O=()=>Math.floor(Date.now()/1e3),_e=5;function ve(e){let{sessionAtom:t,sessionSignal:n,$fetch:r,options:i={}}=e,a=i.sessionOptions?.refetchInterval??0,o=i.sessionOptions?.refetchOnWindowFocus??!0,s=i.sessionOptions?.refetchWhenOffline??!1,c={lastSync:0,lastSessionRequest:0,cachedSession:void 0},l=()=>s||D().isOnline,u=e=>{if(!l())return;if(e?.event===`storage`){c.lastSync=O(),n.set(!n.get());return}let i=t.get(),a=()=>{c.lastSessionRequest=O(),r(`/get-session`).then(async e=>{let a=e.data,o=e.error||null;if(a?.needsRefresh)try{let e=await r(`/get-session`,{method:`POST`});a=e.data,o=e.error||null}catch{}let s=a?.session&&a?.user?a:null;t.set({...i,data:s,error:o}),c.lastSync=O(),n.set(!n.get())}).catch(()=>{})};if(e?.event===`poll`){a();return}if(e?.event===`visibilitychange`){if(O()-c.lastSessionRequest<_e)return;c.lastSessionRequest=O()}if(e?.event===`visibilitychange`){a();return}(i?.data===null||i?.data===void 0)&&(c.lastSync=O(),n.set(!n.get()))},d=e=>{w().post({event:`session`,data:{trigger:e},clientId:Math.random().toString(36).substring(7)})},f=()=>{a&&a>0&&(c.pollInterval=setInterval(()=>{t.get()?.data&&u({event:`poll`})},a*1e3))},p=()=>{c.unsubscribeBroadcast=w().subscribe(()=>{u({event:`storage`})})},m=()=>{o&&(c.unsubscribeFocus=se().subscribe(()=>{u({event:`visibilitychange`})}))},h=()=>{c.unsubscribeOnline=D().subscribe(e=>{e&&u({event:`visibilitychange`})})};return{init:()=>{f(),p(),m(),h(),w().setup(),se().setup(),D().setup()},cleanup:()=>{c.pollInterval&&=(clearInterval(c.pollInterval),void 0),c.unsubscribeBroadcast&&=(c.unsubscribeBroadcast(),void 0),c.unsubscribeFocus&&=(c.unsubscribeFocus(),void 0),c.unsubscribeOnline&&=(c.unsubscribeOnline(),void 0),c.lastSync=0,c.lastSessionRequest=0,c.cachedSession=void 0},triggerRefetch:u,broadcastSessionUpdate:d}}var k=Object.create(null),A=e=>({}),j=new Proxy(k,{get(e,t){return A()[t]??k[t]},has(e,t){return t in A()||t in k},set(e,t,n){let r=A(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;let n=A(!0);return delete n[t],!0},ownKeys(){let e=A(!0);return Object.keys(e)}});function M(e,t){return typeof process<`u`?{}[e]??t:typeof Deno<`u`?Deno.env.get(e)??t:typeof Bun<`u`?Bun.env[e]??t:t}Object.freeze({get BETTER_AUTH_SECRET(){return M(`BETTER_AUTH_SECRET`)},get AUTH_SECRET(){return M(`AUTH_SECRET`)},get BETTER_AUTH_TELEMETRY(){return M(`BETTER_AUTH_TELEMETRY`)},get BETTER_AUTH_TELEMETRY_ID(){return M(`BETTER_AUTH_TELEMETRY_ID`)},get NODE_ENV(){return M(`NODE_ENV`,`development`)},get PACKAGE_VERSION(){return M(`PACKAGE_VERSION`,`0.0.0`)},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return M(`BETTER_AUTH_TELEMETRY_ENDPOINT`,``)}});var N=1,P=4,F=8,I=24,L={eterm:P,cons25:P,console:P,cygwin:P,dtterm:P,gnome:P,hurd:P,jfbterm:P,konsole:P,kterm:P,mlterm:P,mosh:I,putty:P,st:P,"rxvt-unicode-24bit":I,terminator:I,"xterm-kitty":I},ye=new Map(Object.entries({APPVEYOR:F,BUILDKITE:F,CIRCLECI:I,DRONE:F,GITEA_ACTIONS:I,GITHUB_ACTIONS:I,GITLAB_CI:F,TRAVIS:F})),be=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function xe(){if(M(`FORCE_COLOR`)!==void 0)switch(M(`FORCE_COLOR`)){case``:case`1`:case`true`:return P;case`2`:return F;case`3`:return I;default:return N}if(M(`NODE_DISABLE_COLORS`)!==void 0&&M(`NODE_DISABLE_COLORS`)!==``||M(`NO_COLOR`)!==void 0&&M(`NO_COLOR`)!==``||M(`TERM`)===`dumb`)return N;if(M(`TMUX`))return I;if(`TF_BUILD`in j&&`AGENT_NAME`in j)return P;if(`CI`in j){for(let{0:e,1:t}of ye)if(e in j)return t;return M(`CI_NAME`)===`codeship`?F:N}if(`TEAMCITY_VERSION`in j)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(M(`TEAMCITY_VERSION`))===null?N:P;switch(M(`TERM_PROGRAM`)){case`iTerm.app`:return!M(`TERM_PROGRAM_VERSION`)||/^[0-2]\./.exec(M(`TERM_PROGRAM_VERSION`))!==null?F:I;case`HyperTerm`:case`MacTerm`:return I;case`Apple_Terminal`:return F}if(M(`COLORTERM`)===`truecolor`||M(`COLORTERM`)===`24bit`)return I;if(M(`TERM`)){if(/truecolor/.exec(M(`TERM`))!==null)return I;if(/^xterm-256/.exec(M(`TERM`))!==null)return F;let e=M(`TERM`).toLowerCase();if(L[e])return L[e];if(be.some(t=>t.exec(e)!==null))return P}return M(`COLORTERM`)?P:N}var R={reset:`\x1B[0m`,bright:`\x1B[1m`,dim:`\x1B[2m`,undim:`\x1B[22m`,underscore:`\x1B[4m`,blink:`\x1B[5m`,reverse:`\x1B[7m`,hidden:`\x1B[8m`,fg:{black:`\x1B[30m`,red:`\x1B[31m`,green:`\x1B[32m`,yellow:`\x1B[33m`,blue:`\x1B[34m`,magenta:`\x1B[35m`,cyan:`\x1B[36m`,white:`\x1B[37m`},bg:{black:`\x1B[40m`,red:`\x1B[41m`,green:`\x1B[42m`,yellow:`\x1B[43m`,blue:`\x1B[44m`,magenta:`\x1B[45m`,cyan:`\x1B[46m`,white:`\x1B[47m`}},z=[`debug`,`info`,`success`,`warn`,`error`];function Se(e,t){return z.indexOf(t)>=z.indexOf(e)}var Ce={info:R.fg.blue,success:R.fg.green,warn:R.fg.yellow,error:R.fg.red,debug:R.fg.magenta},we=(e,t,n)=>{let r=new Date().toISOString();return n?`${R.dim}${r}${R.reset} ${Ce[e]}${e.toUpperCase()}${R.reset} ${R.bright}[Better Auth]:${R.reset} ${t}`:`${r} ${e.toUpperCase()} [Better Auth]: ${t}`};(e=>{let t=e?.disabled!==!0,n=e?.level??`warn`,r=e?.disableColors===void 0?xe()!==1:!e.disableColors,i=(i,a,o=[])=>{if(!t||!Se(n,i))return;let s=we(i,a,r);if(!e||typeof e.log!=`function`){i===`error`?console.error(s,...o):i===`warn`?console.warn(s,...o):console.log(s,...o);return}e.log(i===`success`?`info`:i,a,...o)};return{...Object.fromEntries(z.map(e=>[e,(...[t,...n])=>i(e,t,n)])),get level(){return n}}})();function Te(e){try{return(new URL(e).pathname.replace(/\/+$/,``)||`/`)!==`/`}catch{throw new c(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function Ee(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new c(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof c?t:new c(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function B(e,t=`/api/auth`){if(Ee(e),Te(e))return e;let n=e.replace(/\/+$/,``);return!t||t===`/`?n:(t=t.startsWith(`/`)?t:`/${t}`,`${n}${t}`)}function De(e,t){return!e||e.trim()===``?!1:t===`proto`?e===`http`||e===`https`:t===`host`?[/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(t=>t.test(e))?!1:/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e):!1}function Oe(e,t,n,r,i){if(e)return B(e,t);if(r!==!1){let e=j.BETTER_AUTH_URL||j.NEXT_PUBLIC_BETTER_AUTH_URL||j.PUBLIC_BETTER_AUTH_URL||j.NUXT_PUBLIC_BETTER_AUTH_URL||j.NUXT_PUBLIC_AUTH_URL||(j.BASE_URL===`/`?void 0:j.BASE_URL);if(e)return B(e,t)}let a=n?.headers.get(`x-forwarded-host`),o=n?.headers.get(`x-forwarded-proto`);if(a&&o&&i&&De(o,`proto`)&&De(a,`host`))try{return B(`${o}://${a}`,t)}catch{}if(n){let e=ke(n.url);if(!e)throw new c(`Could not get origin from request. Please provide a valid base URL.`);return B(e,t)}if(typeof window<`u`&&window.location)return B(window.location.origin,t)}function ke(e){try{let t=new URL(e);return t.origin===`null`?null:t.origin}catch{return null}}var Ae={id:`redirect`,name:`Redirect`,hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&typeof window<`u`&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};function je(e,t){let n=_(!1),r=S(n,`/get-session`,e,{method:`GET`}),i=()=>{};return x(r,()=>{let a=ve({sessionAtom:r,sessionSignal:n,$fetch:e,options:t});return a.init(),i=a.broadcastSessionUpdate,()=>{a.cleanup()}}),{session:r,$sessionSignal:n,broadcastSessionUpdate:e=>i(e)}}function V(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function H(e,t,n=`.`,r){if(!V(t))return H(e,{},n,r);let i=Object.assign({},t);for(let t in e){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:V(a)&&V(i[t])?i[t]=H(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function Me(e){return(...t)=>t.reduce((t,n)=>H(t,n,``,e),{})}var Ne=Me(),Pe=Object.defineProperty,Fe=Object.defineProperties,Ie=Object.getOwnPropertyDescriptors,Le=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,ze=Object.prototype.propertyIsEnumerable,Be=(e,t,n)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t)=>{for(var n in t||={})Re.call(t,n)&&Be(e,n,t[n]);if(Le)for(var n of Le(t))ze.call(t,n)&&Be(e,n,t[n]);return e},W=(e,t)=>Fe(e,Ie(t)),Ve=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n,Error.captureStackTrace(this,this.constructor)}},He=async(e,t)=>{let n=t||{},r={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:n,hooks:r};for(let i of t?.plugins||[]){if(i.init){let r=await i.init?.call(i,e.toString(),t);n=r.options||n,e=r.url}r.onRequest.push(i.hooks?.onRequest),r.onResponse.push(i.hooks?.onResponse),r.onSuccess.push(i.hooks?.onSuccess),r.onError.push(i.hooks?.onError),r.onRetry.push(i.hooks?.onRetry)}return{url:e,options:n,hooks:r}},G=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},Ue=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function We(e){if(typeof e==`number`)return new G({type:`linear`,attempts:e,delay:1e3});switch(e.type){case`linear`:return new G(e);case`exponential`:return new Ue(e);default:throw Error(`Invalid retry strategy`)}}var Ge=async e=>{let t={},n=async e=>typeof e==`function`?await e():e;if(e?.auth){if(e.auth.type===`Bearer`){let r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type===`Basic`){let[r,i]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!i)return t;t.authorization=`Basic ${btoa(`${r}:${i}`)}`}else if(e.auth.type===`Custom`){let[r,i]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!i)return t;t.authorization=`${r??``} ${i}`}}return t},Ke=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function qe(e){let t=e.headers.get(`content-type`),n=new Set([`image/svg`,`application/xml`,`application/xhtml`,`application/html`]);if(!t)return`json`;let r=t.split(`;`).shift()||``;return Ke.test(r)?`json`:n.has(r)||r.startsWith(`text/`)?`text`:`blob`}function Je(e){try{return JSON.parse(e),!0}catch{return!1}}function K(e){if(e===void 0)return!1;let t=typeof e;return t===`string`||t===`number`||t===`boolean`||t===null?!0:t===`object`?Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name===`Object`||typeof e.toJSON==`function`:!1}function q(e){try{return JSON.parse(e)}catch{return e}}function J(e){return typeof e==`function`}function Ye(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<`u`&&J(globalThis.fetch))return globalThis.fetch;if(typeof window<`u`&&J(window.fetch))return window.fetch;throw Error(`No fetch implementation found`)}async function Xe(e){let t=new Headers(e?.headers),n=await Ge(e);for(let[e,r]of Object.entries(n||{}))t.set(e,r);if(!t.has(`content-type`)){let n=Ze(e?.body);n&&t.set(`content-type`,n)}return t}function Ze(e){return K(e)?`application/json`:null}function Qe(e){if(!e?.body)return null;let t=new Headers(e?.headers);if(K(e.body)&&!t.has(`content-type`)){for(let[t,n]of Object.entries(e?.body))n instanceof Date&&(e.body[t]=n.toISOString());return JSON.stringify(e.body)}return t.has(`content-type`)&&t.get(`content-type`)===`application/x-www-form-urlencoded`&&K(e.body)?new URLSearchParams(e.body).toString():e.body}function $e(e,t){if(t?.method)return t.method.toUpperCase();if(e.startsWith(`@`)){let n=e.split(`@`)[1]?.split(`/`)[0];return nt.includes(n)?n.toUpperCase():t?.body?`POST`:`GET`}return t?.body?`POST`:`GET`}function et(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var tt=class e extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function Y(e,t){let n=await e[`~standard`].validate(t);if(n.issues)throw new tt(n.issues);return n.value}var nt=[`get`,`post`,`put`,`patch`,`delete`],rt=e=>({id:`apply-schema`,name:`Apply Schema`,version:`1.0.0`,async init(t,n){let r=e.plugins?.find(e=>e.schema?.config?t.startsWith(e.schema.config.baseURL||``)||t.startsWith(e.schema.config.prefix||``):!1)?.schema||e.schema;if(r){let e=t;r.config?.prefix&&e.startsWith(r.config.prefix)&&(e=e.replace(r.config.prefix,``),r.config.baseURL&&(t=t.replace(r.config.prefix,r.config.baseURL))),r.config?.baseURL&&e.startsWith(r.config.baseURL)&&(e=e.replace(r.config.baseURL,``));let i=r.schema[e];if(i){let e=W(U({},n),{method:i.method,output:i.output});return n?.disableValidation||(e=W(U({},e),{body:i.input?await Y(i.input,n?.body):n?.body,params:i.params?await Y(i.params,n?.params):n?.params,query:i.query?await Y(i.query,n?.query):n?.query})),{url:t,options:e}}}return{url:t,options:n}}}),it=e=>{async function t(t,n){let r=W(U(U({},e),n),{plugins:[...e?.plugins||[],rt(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await X(t,r)}catch(e){return{data:null,error:{status:500,statusText:`Fetch Error`,message:`Fetch related error. Captured by catchAllError option. See error property for more details.`,error:e}}}return await X(t,r)}return t};function at(e,t){let{baseURL:n,params:r,query:i}=t||{query:{},params:{},baseURL:``},a=e.startsWith(`http`)?e.split(`/`).slice(0,3).join(`/`):n||``;if(e.startsWith(`@`)){let t=e.toString().split(`@`)[1].split(`/`)[0];nt.includes(t)&&(e=e.replace(`@${t}/`,`/`))}a.endsWith(`/`)||(a+=`/`);let[o,s]=e.replace(a,``).split(`?`),c=new URLSearchParams(s);for(let[e,t]of Object.entries(i||{})){if(t==null)continue;let n;if(typeof t==`string`)n=t;else if(Array.isArray(t)){for(let n of t)c.append(e,n);continue}else n=JSON.stringify(t);c.set(e,n)}if(r)if(Array.isArray(r)){let e=o.split(`/`).filter(e=>e.startsWith(`:`));for(let[t,n]of e.entries()){let e=r[t];o=o.replace(n,e)}}else for(let[e,t]of Object.entries(r))o=o.replace(`:${e}`,String(t));o=o.split(`/`).map(encodeURIComponent).join(`/`),o.startsWith(`/`)&&(o=o.slice(1));let l=c.toString();return l=l.length>0?`?${l}`.replace(/\+/g,`%20`):``,a.startsWith(`http`)?new URL(`${o}${l}`,a):`${a}${o}${l}`}var X=async(e,t)=>{let{hooks:n,url:r,options:i}=await He(e,t),a=Ye(i),o=new AbortController,s=i.signal??o.signal,c=at(r,i),l=Qe(i),u=await Xe(i),d=$e(r,i),f=W(U({},i),{url:c,headers:u,body:l,method:d,signal:s});for(let e of n.onRequest)if(e){let t=await e(f);typeof t==`object`&&t&&(f=t)}(`pipeTo`in f&&typeof f.pipeTo==`function`||typeof t?.body?.pipe==`function`)&&(`duplex`in f||(f.duplex=`half`));let{clearTimeout:p}=et(i,o),m=await a(f.url,f);p();let h={response:m,request:f};for(let e of n.onResponse)if(e){let n=await e(W(U({},h),{response:t?.hookOptions?.cloneResponse?m.clone():m}));n instanceof Response?m=n:typeof n==`object`&&n&&(m=n.response)}if(m.ok){if(f.method===`HEAD`)return{data:``,error:null};let e=qe(m),r={data:null,response:m,request:f};if(e===`json`||e===`text`){let e=await m.text();r.data=await(f.jsonParser??q)(e)}else r.data=await m[e]();f?.output&&f.output&&!f.disableValidation&&(r.data=await Y(f.output,r.data));for(let e of n.onSuccess)e&&await e(W(U({},r),{response:t?.hookOptions?.cloneResponse?m.clone():m}));return t?.throw?r.data:{data:r.data,error:null}}let g=t?.jsonParser??q,_=await m.text(),v=Je(_),y=v?await g(_):null,b={response:m,responseText:_,request:f,error:W(U({},y),{status:m.status,statusText:m.statusText})};for(let e of n.onError)e&&await e(W(U({},b),{response:t?.hookOptions?.cloneResponse?m.clone():m}));if(t?.retry){let r=We(t.retry),i=t.retryAttempt??0;if(await r.shouldAttemptRetry(i,m)){for(let e of n.onRetry)e&&await e(h);let a=r.getDelay(i);return await new Promise(e=>setTimeout(e,a)),await X(e,W(U({},t),{retryAttempt:i+1}))}}if(t?.throw)throw new Ve(m.status,m.statusText,v?y:_);return{data:null,error:W(U({},y),{status:m.status,statusText:m.statusText})}},ot=e=>{if(typeof process>`u`)return;let t=e??`/api/auth`;if({}.NEXT_PUBLIC_AUTH_URL)return{}.NEXT_PUBLIC_AUTH_URL;if(typeof window>`u`){if({}.NEXTAUTH_URL)try{return{}.NEXTAUTH_URL}catch{}if({}.VERCEL_URL)try{let e={}.VERCEL_URL.startsWith(`http`)?``:`https://`;return`${new URL(`${e}${{}.VERCEL_URL}`).origin}${t}`}catch{}}},st=(e,t)=>{let n=`credentials`in Request.prototype,r=Oe(e?.baseURL,e?.basePath,void 0,t)??ot(e?.basePath)??`/api/auth`,i=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>e!==void 0)||[],a={id:`lifecycle-hooks`,name:`lifecycle-hooks`,hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:o,onError:s,onRequest:c,onResponse:l,...u}=e?.fetchOptions||{},d=it({baseURL:r,...n?{credentials:`include`}:{},method:`GET`,jsonParser(e){return e?ge(e,{strict:!1}):null},customFetchImpl:fetch,...u,plugins:[a,...u.plugins||[],...e?.disableDefaultFetchPlugins?[]:[Ae],...i]}),{$sessionSignal:f,session:p,broadcastSessionUpdate:m}=je(d,e),h=e?.plugins||[],g={},_={$sessionSignal:f,session:p},v={"/sign-out":`POST`,"/revoke-sessions":`POST`,"/revoke-other-sessions":`POST`,"/delete-user":`POST`},y=[{signal:`$sessionSignal`,matcher(e){return e===`/sign-out`||e===`/update-user`||e===`/update-session`||e===`/sign-up/email`||e===`/sign-in/email`||e===`/delete-user`||e===`/verify-email`||e===`/revoke-sessions`||e===`/revoke-session`||e===`/change-email`},callback(e){e===`/sign-out`?m(`signout`):(e===`/update-user`||e===`/update-session`)&&m(`updateUser`)}}];for(let e of h)e.getAtoms&&Object.assign(_,e.getAtoms?.(d)),e.pathMethods&&Object.assign(v,e.pathMethods),e.atomListeners&&y.push(...e.atomListeners);let b={notify:e=>{_[e].set(!_[e].get())},listen:(e,t)=>{_[e].subscribe(t)},atoms:_};for(let t of h)t.getActions&&(g=Ne(t.getActions?.(d,b,e)??{},g));return{get baseURL(){return r},pluginsActions:g,pluginsAtoms:_,pluginPathMethods:v,atomListeners:y,$fetch:d,$store:b}};function ct(e){return typeof e==`object`&&!!e&&`get`in e&&typeof e.get==`function`&&`lc`in e&&typeof e.lc==`number`}function lt(e,t,n){let r=t[e],{fetchOptions:i,query:a,...o}=n||{};return r||(i?.method?i.method:o&&Object.keys(o).length>0?`POST`:`GET`)}function ut(e,t,n,r,i){function a(o=[]){return new Proxy(function(){},{get(t,n){if(typeof n!=`string`||n===`then`||n===`catch`||n===`finally`)return;let r=[...o,n],i=e;for(let e of r)if(i&&typeof i==`object`&&e in i)i=i[e];else{i=void 0;break}return typeof i==`function`||ct(i)?i:a(r)},apply:async(e,a,s)=>{let c=`/`+o.map(e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)).join(`/`),l=s[0]||{},u=s[1]||{},{query:d,fetchOptions:f,...p}=l,m={...u,...f},h=lt(c,n,l);return await t(c,{...m,body:h===`GET`?void 0:{...p,...m?.body||{}},query:d||m?.query,method:h,async onSuccess(e){if(await m?.onSuccess?.(e),!i||m.disableSignal)return;let t=i.filter(e=>e.matcher(c));if(!t.length)return;let n=new Set;for(let e of t){let t=r[e.signal];if(!t)return;if(n.has(e.signal))continue;n.add(e.signal);let i=t.get();setTimeout(()=>{t.set(!i)},10),e.callback?.(c)}}})}})}return a()}function dt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Z=u({organization:[`update`,`delete`],member:[`create`,`update`,`delete`],invitation:[`create`,`cancel`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),ft=Z.newRole({organization:[`update`],invitation:[`create`,`cancel`],member:[`create`,`update`,`delete`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),pt=Z.newRole({organization:[`update`,`delete`],member:[`create`,`update`,`delete`],invitation:[`create`,`cancel`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),mt=Z.newRole({organization:[],member:[],invitation:[],team:[],ac:[`read`]}),ht={admin:ft,owner:pt,member:mt},gt=(e,t)=>{if(!e.permissions)return!1;let n=e.role.split(`,`),r=e.options.creatorRole||`owner`,i=n.includes(r),a=e.allowCreatorAllPermissions||!1;if(i&&a)return!0;for(let r of n)if(t[r]?.authorize(e.permissions)?.success)return!0;return!1},_t=e=>gt(e,e.options.roles||ht),vt=e=>{let t=_(!1),n=_(!1),r=_(!1),i=_(!1),a={admin:ft,member:mt,owner:pt,...e?.roles};return{id:`organization`,$InferServerPlugin:{},getActions:(t,n,r)=>({$Infer:{ActiveOrganization:{},Organization:{},Invitation:{},Member:{},Team:{}},organization:{checkRolePermission:t=>_t({role:t.role,options:{ac:e?.ac,roles:a},permissions:t.permissions})}}),getAtoms:e=>{let a=S(t,`/organization/list`,e,{method:`GET`});return{$listOrg:t,$activeOrgSignal:n,$activeMemberSignal:r,$activeMemberRoleSignal:i,activeOrganization:S([n],`/organization/get-full-organization`,e,()=>({method:`GET`})),listOrganizations:a,activeMember:S([n,r],`/organization/get-active-member`,e,{method:`GET`}),activeMemberRole:S([n,i],`/organization/get-active-member-role`,e,{method:`GET`})}},pathMethods:{"/organization/get-full-organization":`GET`,"/organization/list-user-teams":`GET`},atomListeners:[{matcher(e){return e===`/organization/create`||e===`/organization/delete`||e===`/organization/update`},signal:`$listOrg`},{matcher(e){return e.startsWith(`/organization`)},signal:`$activeOrgSignal`},{matcher(e){return e.startsWith(`/organization/set-active`)||e===`/organization/create`||e===`/organization/delete`||e===`/organization/remove-member`||e===`/organization/leave`||e===`/organization/accept-invitation`},signal:`$sessionSignal`},{matcher(e){return e.includes(`/organization/update-member-role`)||e.startsWith(`/organization/set-active`)},signal:`$activeMemberSignal`},{matcher(e){return e.includes(`/organization/update-member-role`)||e.startsWith(`/organization/set-active`)},signal:`$activeMemberRoleSignal`}],$ERROR_CODES:f}};r({INVALID_PHONE_NUMBER:`Invalid phone number`,PHONE_NUMBER_EXIST:`Phone number already exists`,PHONE_NUMBER_NOT_EXIST:`phone number isn't registered`,INVALID_PHONE_NUMBER_OR_PASSWORD:`Invalid phone number or password`,UNEXPECTED_ERROR:`Unexpected error`,OTP_NOT_FOUND:`OTP not found`,OTP_EXPIRED:`OTP expired`,INVALID_OTP:`Invalid OTP`,PHONE_NUMBER_NOT_VERIFIED:`Phone number not verified`,PHONE_NUMBER_CANNOT_BE_UPDATED:`Phone number cannot be updated`,SEND_OTP_NOT_IMPLEMENTED:`sendOTP not implemented`,TOO_MANY_ATTEMPTS:`Too many attempts`}),r({OTP_NOT_ENABLED:`OTP not enabled`,OTP_HAS_EXPIRED:`OTP has expired`,TOTP_NOT_ENABLED:`TOTP not enabled`,TWO_FACTOR_NOT_ENABLED:`Two factor isn't enabled`,BACKUP_CODES_NOT_ENABLED:`Backup codes aren't enabled`,INVALID_BACKUP_CODE:`Invalid backup code`,INVALID_CODE:`Invalid code`,TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE:`Too many attempts. Please request a new code.`,INVALID_TWO_FACTOR_COOKIE:`Invalid two factor cookie`}),r({INVALID_USERNAME_OR_PASSWORD:`Invalid username or password`,EMAIL_NOT_VERIFIED:`Email not verified`,UNEXPECTED_ERROR:`Unexpected error`,USERNAME_IS_ALREADY_TAKEN:`Username is already taken. Please try another.`,USERNAME_TOO_SHORT:`Username is too short`,USERNAME_TOO_LONG:`Username is too long`,INVALID_USERNAME:`Username is invalid`,INVALID_DISPLAY_USERNAME:`Display username is invalid`});var Q=e(t(),1);function yt(e,t={}){let n=(0,Q.useRef)(e.get()),{keys:r,deps:i=[e,r]}=t,a=(0,Q.useCallback)(t=>{let i=e=>{n.current!==e&&(n.current=e,t())};return i(e.value),r?.length?ne(e,r,i):e.listen(i)},i),o=()=>n.current;return(0,Q.useSyncExternalStore)(a,o,o)}function bt(e){return`use${dt(e)}`}function xt(e){let{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,$fetch:i,$store:a,atomListeners:o}=st(e),s={};for(let[e,t]of Object.entries(r))s[bt(e)]=()=>yt(t);return ut({...n,...s,$fetch:i,$store:a},i,t,r,o)}var $=xt({baseURL:n(),plugins:[vt()]}),{useSession:St}=$,{signIn:Ct}=$,{signOut:wt}=$,{signUp:Tt}=$,{organization:Et}=$;$.getSession;export{St as a,Tt as i,Ct as n,wt as r,Et as t};
3
+ at `))}function o(e,t){class n extends e{#e;constructor(...e){if(i()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let t=Error().stack;t&&(this.#e=a(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(n.prototype,`constructor`,{get(){return t},enumerable:!1,configurable:!0}),n}var s={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511};o(class extends Error{constructor(e=`INTERNAL_SERVER_ERROR`,t=void 0,n={},r=typeof e==`number`?e:s[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=n,this.statusCode=r,this.name=`APIError`,this.status=e,this.headers=n,this.statusCode=r,this.body=t}},Error);var c=class extends Error{constructor(e,t){super(e,t),this.name=`BetterAuthError`,this.message=e,this.stack=``}};function l(e){return{authorize(t,n=`AND`){let r=!1;for(let[i,a]of Object.entries(t)){let t=e[i];if(!t)return{success:!1,error:`You are not allowed to access resource: ${i}`};if(Array.isArray(a))r=a.every(e=>t.includes(e));else if(typeof a==`object`){let e=a;r=e.connector===`OR`?e.actions.some(e=>t.includes(e)):e.actions.every(e=>t.includes(e))}else throw new c(`Invalid access control request`);if(r&&n===`OR`)return{success:r};if(!r&&n===`AND`)return{success:!1,error:`unauthorized to access resource "${i}"`}}return r?{success:r}:{success:!1,error:`Not authorized`}},statements:e}}function u(e){return{newRole(e){return l(e)},statements:e}}var d=u({user:[`create`,`list`,`set-role`,`ban`,`impersonate`,`impersonate-admins`,`delete`,`set-password`,`get`,`update`],session:[`list`,`revoke`,`delete`]});d.newRole({user:[`create`,`list`,`set-role`,`ban`,`impersonate`,`delete`,`set-password`,`get`,`update`],session:[`list`,`revoke`,`delete`]}),d.newRole({user:[],session:[]}),r({INVALID_EMAIL_FORMAT:`Email was not generated in a valid format`,FAILED_TO_CREATE_USER:`Failed to create user`,COULD_NOT_CREATE_SESSION:`Could not create session`,ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY:`Anonymous users cannot sign in again anonymously`,FAILED_TO_DELETE_ANONYMOUS_USER:`Failed to delete anonymous user`,USER_IS_NOT_ANONYMOUS:`User is not anonymous`,DELETE_ANONYMOUS_USER_DISABLED:`Deleting anonymous users is disabled`}),r({OTP_EXPIRED:`OTP expired`,INVALID_OTP:`Invalid OTP`,TOO_MANY_ATTEMPTS:`Too many attempts`}),r({INVALID_OAUTH_CONFIGURATION:`Invalid OAuth configuration`,TOKEN_URL_NOT_FOUND:`Invalid OAuth configuration. Token URL not found.`,PROVIDER_CONFIG_NOT_FOUND:`No config found for provider`,PROVIDER_ID_REQUIRED:`Provider ID is required`,INVALID_OAUTH_CONFIG:`Invalid OAuth configuration.`,SESSION_REQUIRED:`Session is required`,ISSUER_MISMATCH:`OAuth issuer mismatch. The authorization server issuer does not match the expected value (RFC 9207).`,ISSUER_MISSING:`OAuth issuer parameter missing. The authorization server did not include the required iss parameter (RFC 9207).`}),r({INVALID_SESSION_TOKEN:`Invalid session token`});var f=r({YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION:`You are not allowed to create a new organization`,YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS:`You have reached the maximum number of organizations`,ORGANIZATION_ALREADY_EXISTS:`Organization already exists`,ORGANIZATION_SLUG_ALREADY_TAKEN:`Organization slug already taken`,ORGANIZATION_NOT_FOUND:`Organization not found`,USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION:`User is not a member of the organization`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION:`You are not allowed to update this organization`,YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION:`You are not allowed to delete this organization`,NO_ACTIVE_ORGANIZATION:`No active organization`,USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION:`User is already a member of this organization`,MEMBER_NOT_FOUND:`Member not found`,ROLE_NOT_FOUND:`Role not found`,YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM:`You are not allowed to create a new team`,TEAM_ALREADY_EXISTS:`Team already exists`,TEAM_NOT_FOUND:`Team not found`,YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER:`You cannot leave the organization as the only owner`,YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER:`You cannot leave the organization without an owner`,YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER:`You are not allowed to delete this member`,YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION:`You are not allowed to invite users to this organization`,USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION:`User is already invited to this organization`,INVITATION_NOT_FOUND:`Invitation not found`,YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION:`You are not the recipient of the invitation`,EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION:`Email verification required before accepting or rejecting invitation`,YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION:`You are not allowed to cancel this invitation`,INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION:`Inviter is no longer a member of the organization`,YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE:`You are not allowed to invite a user with this role`,FAILED_TO_RETRIEVE_INVITATION:`Failed to retrieve invitation`,YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS:`You have reached the maximum number of teams`,UNABLE_TO_REMOVE_LAST_TEAM:`Unable to remove last team`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER:`You are not allowed to update this member`,ORGANIZATION_MEMBERSHIP_LIMIT_REACHED:`Organization membership limit reached`,YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION:`You are not allowed to create teams in this organization`,YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION:`You are not allowed to delete teams in this organization`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM:`You are not allowed to update this team`,YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM:`You are not allowed to delete this team`,INVITATION_LIMIT_REACHED:`Invitation limit reached`,TEAM_MEMBER_LIMIT_REACHED:`Team member limit reached`,USER_IS_NOT_A_MEMBER_OF_THE_TEAM:`User is not a member of the team`,YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM:`You are not allowed to list the members of this team`,YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM:`You do not have an active team`,YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER:`You are not allowed to create a new member`,YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER:`You are not allowed to remove a team member`,YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION:`You are not allowed to access this organization as an owner`,YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION:`You are not a member of this organization`,MISSING_AC_INSTANCE:`Dynamic Access Control requires a pre-defined ac instance on the server auth plugin. Read server logs for more information`,YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE:`You must be in an organization to create a role`,YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE:`You are not allowed to create a role`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE:`You are not allowed to update a role`,YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE:`You are not allowed to delete a role`,YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE:`You are not allowed to read a role`,YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE:`You are not allowed to list a role`,YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE:`You are not allowed to get a role`,TOO_MANY_ROLES:`This organization has too many roles`,INVALID_RESOURCE:`The provided permission includes an invalid resource`,ROLE_NAME_IS_ALREADY_TAKEN:`That role name is already taken`,CANNOT_DELETE_A_PRE_DEFINED_ROLE:`Cannot delete a pre-defined role`,ROLE_IS_ASSIGNED_TO_MEMBERS:`Cannot delete a role that is assigned to members. Please reassign the members to a different role first`}),p=[],m=0,h=4,g=0,_=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},init:e,lc:0,listen(e){return n.lc=t.push(e),()=>{for(let t=m+h;t<p.length;)p[t]===e?p.splice(t,h):t+=h;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}},notify(e,r){g++;let i=!p.length;for(let i of t)p.push(i,n.value,e,r);if(i){for(m=0;m<p.length;m+=h)p[m](p[m+1],p[m+2],p[m+3]);p.length=0}},off(){},set(e){let t=n.value;t!==e&&(n.value=e,n.notify(t))},subscribe(e){let t=n.listen(e);return e(n.value),t},value:e};return n},v=5,y=6,b=10,ee=(e,t,n,r)=>(e.events=e.events||{},e.events[n+b]||(e.events[n+b]=r(t=>{e.events[n].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let r=e.events[n],i=r.indexOf(t);r.splice(i,1),r.length||(delete e.events[n],e.events[n+b](),delete e.events[n+b])}),te=1e3,x=(e,t)=>ee(e,n=>{let r=t(n);r&&e.events[y].push(r)},v,t=>{let n=e.listen;e.listen=(...r)=>(!e.lc&&!e.active&&(e.active=!0,t()),n(...r));let r=e.off;return e.events[y]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[y])t();e.events[y]=[]}},te)},()=>{e.listen=n,e.off=r}});function ne(e,t,n){let r=new Set(t).add(void 0);return e.listen((e,t,i)=>{r.has(i)&&n(e,t,i)})}var re=()=>typeof window>`u`,S=(e,t,n,r)=>{let i=_({data:null,error:null,isPending:!0,isRefetching:!1,refetch:e=>a(e)}),a=async e=>new Promise(a=>{let o=typeof r==`function`?r({data:i.get().data,error:i.get().error,isPending:i.get().isPending}):r;n(t,{...o,query:{...o?.query,...e?.query},async onSuccess(e){i.set({data:e.data,error:null,isPending:!1,isRefetching:!1,refetch:i.value.refetch}),await o?.onSuccess?.(e)},async onError(e){let{request:t}=e,n=typeof t.retry==`number`?t.retry:t.retry?.attempts,r=t.retryAttempt||0;if(n&&r<n)return;let a=e.error.status===401;i.set({error:e.error,data:a?null:i.get().data,isPending:!1,isRefetching:!1,refetch:i.value.refetch}),await o?.onError?.(e)},async onRequest(e){let t=i.get();i.set({isPending:t.data===null,data:t.data,error:null,isRefetching:!0,refetch:i.value.refetch}),await o?.onRequest?.(e)}}).catch(e=>{i.set({error:e,data:i.get().data,isPending:!1,isRefetching:!1,refetch:i.value.refetch})}).finally(()=>{a(void 0)})});e=Array.isArray(e)?e:[e];let o=!1;for(let t of e)t.subscribe(async()=>{re()||(o?await a():x(i,()=>{let e=setTimeout(async()=>{o||=(await a(),!0)},0);return()=>{i.off(),t.off(),clearTimeout(e)}}))});return i},C=Symbol.for(`better-auth:broadcast-channel`),ie=()=>Math.floor(Date.now()/1e3),ae=class{listeners=new Set;name;constructor(e=`better-auth.message`){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(!(typeof window>`u`))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:ie()}))}catch{}}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=e=>{if(e.key!==this.name)return;let t=JSON.parse(e.newValue??`{}`);t?.event!==`session`||!t?.data||this.listeners.forEach(e=>e(t))};return window.addEventListener(`storage`,e),()=>{window.removeEventListener(`storage`,e)}}};function w(e=`better-auth.message`){return globalThis[C]||(globalThis[C]=new ae(e)),globalThis[C]}var T=Symbol.for(`better-auth:focus-manager`),oe=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||typeof document>`u`||window.addEventListener===void 0)return()=>{};let e=()=>{document.visibilityState===`visible`&&this.setFocused(!0)};return document.addEventListener(`visibilitychange`,e,!1),()=>{document.removeEventListener(`visibilitychange`,e,!1)}}};function se(){return globalThis[T]||(globalThis[T]=new oe),globalThis[T]}var E=Symbol.for(`better-auth:online-manager`),ce=class{listeners=new Set;isOnline=typeof navigator<`u`?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener(`online`,e,!1),window.addEventListener(`offline`,t,!1),()=>{window.removeEventListener(`online`,e,!1),window.removeEventListener(`offline`,t,!1)}}};function D(){return globalThis[E]||(globalThis[E]=new ce),globalThis[E]}var le={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},ue=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,de={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},fe=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function pe(e){return e instanceof Date&&!isNaN(e.getTime())}function me(e){let t=fe.exec(e);if(!t)return null;let[,n,r,i,a,o,s,c,l,u,d]=t,f=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(i,10),parseInt(a,10),parseInt(o,10),parseInt(s,10),c?parseInt(c.padEnd(3,`0`),10):0));if(l){let e=(parseInt(u,10)*60+parseInt(d,10))*(l===`+`?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return pe(f)?f:null}function he(e,t={}){let{strict:n=!1,warnings:r=!1,reviver:i,parseDates:a=!0}=t;if(typeof e!=`string`)return e;let o=e.trim();if(o.length>0&&o[0]===`"`&&o.endsWith(`"`)&&!o.slice(1,-1).includes(`"`))return o.slice(1,-1);let s=o.toLowerCase();if(s.length<=9&&s in de)return de[s];if(!ue.test(o)){if(n)throw SyntaxError(`[better-json] Invalid JSON`);return e}if(Object.entries(le).some(([e,t])=>{let n=t.test(o);return n&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`),n})&&n)throw Error(`[better-json] Potential prototype pollution attempt detected`);try{return JSON.parse(o,(e,t)=>{if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){r&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(a&&typeof t==`string`){let e=me(t);if(e)return e}return i?i(e,t):t})}catch(t){if(n)throw t;return e}}function ge(e,t={strict:!0}){return he(e,t)}var O=()=>Math.floor(Date.now()/1e3),_e=5;function ve(e){let{sessionAtom:t,sessionSignal:n,$fetch:r,options:i={}}=e,a=i.sessionOptions?.refetchInterval??0,o=i.sessionOptions?.refetchOnWindowFocus??!0,s=i.sessionOptions?.refetchWhenOffline??!1,c={lastSync:0,lastSessionRequest:0,cachedSession:void 0},l=()=>s||D().isOnline,u=e=>{if(!l())return;if(e?.event===`storage`){c.lastSync=O(),n.set(!n.get());return}let i=t.get(),a=()=>{c.lastSessionRequest=O(),r(`/get-session`).then(async e=>{let a=e.data,o=e.error||null;if(a?.needsRefresh)try{let e=await r(`/get-session`,{method:`POST`});a=e.data,o=e.error||null}catch{}let s=a?.session&&a?.user?a:null;t.set({...i,data:s,error:o}),c.lastSync=O(),n.set(!n.get())}).catch(()=>{})};if(e?.event===`poll`){a();return}if(e?.event===`visibilitychange`){if(O()-c.lastSessionRequest<_e)return;c.lastSessionRequest=O()}if(e?.event===`visibilitychange`){a();return}(i?.data===null||i?.data===void 0)&&(c.lastSync=O(),n.set(!n.get()))},d=e=>{w().post({event:`session`,data:{trigger:e},clientId:Math.random().toString(36).substring(7)})},f=()=>{a&&a>0&&(c.pollInterval=setInterval(()=>{t.get()?.data&&u({event:`poll`})},a*1e3))},p=()=>{c.unsubscribeBroadcast=w().subscribe(()=>{u({event:`storage`})})},m=()=>{o&&(c.unsubscribeFocus=se().subscribe(()=>{u({event:`visibilitychange`})}))},h=()=>{c.unsubscribeOnline=D().subscribe(e=>{e&&u({event:`visibilitychange`})})};return{init:()=>{f(),p(),m(),h(),w().setup(),se().setup(),D().setup()},cleanup:()=>{c.pollInterval&&=(clearInterval(c.pollInterval),void 0),c.unsubscribeBroadcast&&=(c.unsubscribeBroadcast(),void 0),c.unsubscribeFocus&&=(c.unsubscribeFocus(),void 0),c.unsubscribeOnline&&=(c.unsubscribeOnline(),void 0),c.lastSync=0,c.lastSessionRequest=0,c.cachedSession=void 0},triggerRefetch:u,broadcastSessionUpdate:d}}var k=Object.create(null),A=e=>({}),j=new Proxy(k,{get(e,t){return A()[t]??k[t]},has(e,t){return t in A()||t in k},set(e,t,n){let r=A(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;let n=A(!0);return delete n[t],!0},ownKeys(){let e=A(!0);return Object.keys(e)}});function M(e,t){return typeof process<`u`?{}[e]??t:typeof Deno<`u`?Deno.env.get(e)??t:typeof Bun<`u`?Bun.env[e]??t:t}Object.freeze({get BETTER_AUTH_SECRET(){return M(`BETTER_AUTH_SECRET`)},get AUTH_SECRET(){return M(`AUTH_SECRET`)},get BETTER_AUTH_TELEMETRY(){return M(`BETTER_AUTH_TELEMETRY`)},get BETTER_AUTH_TELEMETRY_ID(){return M(`BETTER_AUTH_TELEMETRY_ID`)},get NODE_ENV(){return M(`NODE_ENV`,`development`)},get PACKAGE_VERSION(){return M(`PACKAGE_VERSION`,`0.0.0`)},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return M(`BETTER_AUTH_TELEMETRY_ENDPOINT`,``)}});var N=1,P=4,F=8,I=24,L={eterm:P,cons25:P,console:P,cygwin:P,dtterm:P,gnome:P,hurd:P,jfbterm:P,konsole:P,kterm:P,mlterm:P,mosh:I,putty:P,st:P,"rxvt-unicode-24bit":I,terminator:I,"xterm-kitty":I},ye=new Map(Object.entries({APPVEYOR:F,BUILDKITE:F,CIRCLECI:I,DRONE:F,GITEA_ACTIONS:I,GITHUB_ACTIONS:I,GITLAB_CI:F,TRAVIS:F})),be=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function xe(){if(M(`FORCE_COLOR`)!==void 0)switch(M(`FORCE_COLOR`)){case``:case`1`:case`true`:return P;case`2`:return F;case`3`:return I;default:return N}if(M(`NODE_DISABLE_COLORS`)!==void 0&&M(`NODE_DISABLE_COLORS`)!==``||M(`NO_COLOR`)!==void 0&&M(`NO_COLOR`)!==``||M(`TERM`)===`dumb`)return N;if(M(`TMUX`))return I;if(`TF_BUILD`in j&&`AGENT_NAME`in j)return P;if(`CI`in j){for(let{0:e,1:t}of ye)if(e in j)return t;return M(`CI_NAME`)===`codeship`?F:N}if(`TEAMCITY_VERSION`in j)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(M(`TEAMCITY_VERSION`))===null?N:P;switch(M(`TERM_PROGRAM`)){case`iTerm.app`:return!M(`TERM_PROGRAM_VERSION`)||/^[0-2]\./.exec(M(`TERM_PROGRAM_VERSION`))!==null?F:I;case`HyperTerm`:case`MacTerm`:return I;case`Apple_Terminal`:return F}if(M(`COLORTERM`)===`truecolor`||M(`COLORTERM`)===`24bit`)return I;if(M(`TERM`)){if(/truecolor/.exec(M(`TERM`))!==null)return I;if(/^xterm-256/.exec(M(`TERM`))!==null)return F;let e=M(`TERM`).toLowerCase();if(L[e])return L[e];if(be.some(t=>t.exec(e)!==null))return P}return M(`COLORTERM`)?P:N}var R={reset:`\x1B[0m`,bright:`\x1B[1m`,dim:`\x1B[2m`,undim:`\x1B[22m`,underscore:`\x1B[4m`,blink:`\x1B[5m`,reverse:`\x1B[7m`,hidden:`\x1B[8m`,fg:{black:`\x1B[30m`,red:`\x1B[31m`,green:`\x1B[32m`,yellow:`\x1B[33m`,blue:`\x1B[34m`,magenta:`\x1B[35m`,cyan:`\x1B[36m`,white:`\x1B[37m`},bg:{black:`\x1B[40m`,red:`\x1B[41m`,green:`\x1B[42m`,yellow:`\x1B[43m`,blue:`\x1B[44m`,magenta:`\x1B[45m`,cyan:`\x1B[46m`,white:`\x1B[47m`}},z=[`debug`,`info`,`success`,`warn`,`error`];function Se(e,t){return z.indexOf(t)>=z.indexOf(e)}var Ce={info:R.fg.blue,success:R.fg.green,warn:R.fg.yellow,error:R.fg.red,debug:R.fg.magenta},we=(e,t,n)=>{let r=new Date().toISOString();return n?`${R.dim}${r}${R.reset} ${Ce[e]}${e.toUpperCase()}${R.reset} ${R.bright}[Better Auth]:${R.reset} ${t}`:`${r} ${e.toUpperCase()} [Better Auth]: ${t}`};(e=>{let t=e?.disabled!==!0,n=e?.level??`warn`,r=e?.disableColors===void 0?xe()!==1:!e.disableColors,i=(i,a,o=[])=>{if(!t||!Se(n,i))return;let s=we(i,a,r);if(!e||typeof e.log!=`function`){i===`error`?console.error(s,...o):i===`warn`?console.warn(s,...o):console.log(s,...o);return}e.log(i===`success`?`info`:i,a,...o)};return{...Object.fromEntries(z.map(e=>[e,(...[t,...n])=>i(e,t,n)])),get level(){return n}}})();function Te(e){try{return(new URL(e).pathname.replace(/\/+$/,``)||`/`)!==`/`}catch{throw new c(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function Ee(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new c(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof c?t:new c(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function B(e,t=`/api/auth`){if(Ee(e),Te(e))return e;let n=e.replace(/\/+$/,``);return!t||t===`/`?n:(t=t.startsWith(`/`)?t:`/${t}`,`${n}${t}`)}function De(e,t){return!e||e.trim()===``?!1:t===`proto`?e===`http`||e===`https`:t===`host`?[/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(t=>t.test(e))?!1:/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e):!1}function Oe(e,t,n,r,i){if(e)return B(e,t);if(r!==!1){let e=j.BETTER_AUTH_URL||j.NEXT_PUBLIC_BETTER_AUTH_URL||j.PUBLIC_BETTER_AUTH_URL||j.NUXT_PUBLIC_BETTER_AUTH_URL||j.NUXT_PUBLIC_AUTH_URL||(j.BASE_URL===`/`?void 0:j.BASE_URL);if(e)return B(e,t)}let a=n?.headers.get(`x-forwarded-host`),o=n?.headers.get(`x-forwarded-proto`);if(a&&o&&i&&De(o,`proto`)&&De(a,`host`))try{return B(`${o}://${a}`,t)}catch{}if(n){let e=ke(n.url);if(!e)throw new c(`Could not get origin from request. Please provide a valid base URL.`);return B(e,t)}if(typeof window<`u`&&window.location)return B(window.location.origin,t)}function ke(e){try{let t=new URL(e);return t.origin===`null`?null:t.origin}catch{return null}}var Ae={id:`redirect`,name:`Redirect`,hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&typeof window<`u`&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};function je(e,t){let n=_(!1),r=S(n,`/get-session`,e,{method:`GET`}),i=()=>{};return x(r,()=>{let a=ve({sessionAtom:r,sessionSignal:n,$fetch:e,options:t});return a.init(),i=a.broadcastSessionUpdate,()=>{a.cleanup()}}),{session:r,$sessionSignal:n,broadcastSessionUpdate:e=>i(e)}}function V(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function H(e,t,n=`.`,r){if(!V(t))return H(e,{},n,r);let i={...t};for(let t of Object.keys(e)){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:V(a)&&V(i[t])?i[t]=H(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function Me(e){return(...t)=>t.reduce((t,n)=>H(t,n,``,e),{})}var Ne=Me(),Pe=Object.defineProperty,Fe=Object.defineProperties,Ie=Object.getOwnPropertyDescriptors,Le=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,ze=Object.prototype.propertyIsEnumerable,Be=(e,t,n)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t)=>{for(var n in t||={})Re.call(t,n)&&Be(e,n,t[n]);if(Le)for(var n of Le(t))ze.call(t,n)&&Be(e,n,t[n]);return e},W=(e,t)=>Fe(e,Ie(t)),Ve=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n,Error.captureStackTrace(this,this.constructor)}},He=async(e,t)=>{let n=t||{},r={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:n,hooks:r};for(let i of t?.plugins||[]){if(i.init){let r=await i.init?.call(i,e.toString(),t);n=r.options||n,e=r.url}r.onRequest.push(i.hooks?.onRequest),r.onResponse.push(i.hooks?.onResponse),r.onSuccess.push(i.hooks?.onSuccess),r.onError.push(i.hooks?.onError),r.onRetry.push(i.hooks?.onRetry)}return{url:e,options:n,hooks:r}},G=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},Ue=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function We(e){if(typeof e==`number`)return new G({type:`linear`,attempts:e,delay:1e3});switch(e.type){case`linear`:return new G(e);case`exponential`:return new Ue(e);default:throw Error(`Invalid retry strategy`)}}var Ge=async e=>{let t={},n=async e=>typeof e==`function`?await e():e;if(e?.auth){if(e.auth.type===`Bearer`){let r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type===`Basic`){let[r,i]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!i)return t;t.authorization=`Basic ${btoa(`${r}:${i}`)}`}else if(e.auth.type===`Custom`){let[r,i]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!i)return t;t.authorization=`${r??``} ${i}`}}return t},Ke=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function qe(e){let t=e.headers.get(`content-type`),n=new Set([`image/svg`,`application/xml`,`application/xhtml`,`application/html`]);if(!t)return`json`;let r=t.split(`;`).shift()||``;return Ke.test(r)?`json`:n.has(r)||r.startsWith(`text/`)?`text`:`blob`}function Je(e){try{return JSON.parse(e),!0}catch{return!1}}function K(e){if(e===void 0)return!1;let t=typeof e;return t===`string`||t===`number`||t===`boolean`||t===null?!0:t===`object`?Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name===`Object`||typeof e.toJSON==`function`:!1}function q(e){try{return JSON.parse(e)}catch{return e}}function J(e){return typeof e==`function`}function Ye(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<`u`&&J(globalThis.fetch))return globalThis.fetch;if(typeof window<`u`&&J(window.fetch))return window.fetch;throw Error(`No fetch implementation found`)}async function Xe(e){let t=new Headers(e?.headers),n=await Ge(e);for(let[e,r]of Object.entries(n||{}))t.set(e,r);if(!t.has(`content-type`)){let n=Ze(e?.body);n&&t.set(`content-type`,n)}return t}function Ze(e){return K(e)?`application/json`:null}function Qe(e){if(!e?.body)return null;let t=new Headers(e?.headers);if(K(e.body)&&!t.has(`content-type`)){for(let[t,n]of Object.entries(e?.body))n instanceof Date&&(e.body[t]=n.toISOString());return JSON.stringify(e.body)}return t.has(`content-type`)&&t.get(`content-type`)===`application/x-www-form-urlencoded`&&K(e.body)?new URLSearchParams(e.body).toString():e.body}function $e(e,t){if(t?.method)return t.method.toUpperCase();if(e.startsWith(`@`)){let n=e.split(`@`)[1]?.split(`/`)[0];return nt.includes(n)?n.toUpperCase():t?.body?`POST`:`GET`}return t?.body?`POST`:`GET`}function et(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var tt=class e extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function Y(e,t){let n=await e[`~standard`].validate(t);if(n.issues)throw new tt(n.issues);return n.value}var nt=[`get`,`post`,`put`,`patch`,`delete`],rt=e=>({id:`apply-schema`,name:`Apply Schema`,version:`1.0.0`,async init(t,n){let r=e.plugins?.find(e=>e.schema?.config?t.startsWith(e.schema.config.baseURL||``)||t.startsWith(e.schema.config.prefix||``):!1)?.schema||e.schema;if(r){let e=t;r.config?.prefix&&e.startsWith(r.config.prefix)&&(e=e.replace(r.config.prefix,``),r.config.baseURL&&(t=t.replace(r.config.prefix,r.config.baseURL))),r.config?.baseURL&&e.startsWith(r.config.baseURL)&&(e=e.replace(r.config.baseURL,``));let i=r.schema[e];if(i){let e=W(U({},n),{method:i.method,output:i.output});return n?.disableValidation||(e=W(U({},e),{body:i.input?await Y(i.input,n?.body):n?.body,params:i.params?await Y(i.params,n?.params):n?.params,query:i.query?await Y(i.query,n?.query):n?.query})),{url:t,options:e}}}return{url:t,options:n}}}),it=e=>{async function t(t,n){let r=W(U(U({},e),n),{plugins:[...e?.plugins||[],rt(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await X(t,r)}catch(e){return{data:null,error:{status:500,statusText:`Fetch Error`,message:`Fetch related error. Captured by catchAllError option. See error property for more details.`,error:e}}}return await X(t,r)}return t};function at(e,t){let{baseURL:n,params:r,query:i}=t||{query:{},params:{},baseURL:``},a=e.startsWith(`http`)?e.split(`/`).slice(0,3).join(`/`):n||``;if(e.startsWith(`@`)){let t=e.toString().split(`@`)[1].split(`/`)[0];nt.includes(t)&&(e=e.replace(`@${t}/`,`/`))}a.endsWith(`/`)||(a+=`/`);let[o,s]=e.replace(a,``).split(`?`),c=new URLSearchParams(s);for(let[e,t]of Object.entries(i||{})){if(t==null)continue;let n;if(typeof t==`string`)n=t;else if(Array.isArray(t)){for(let n of t)c.append(e,n);continue}else n=JSON.stringify(t);c.set(e,n)}if(r)if(Array.isArray(r)){let e=o.split(`/`).filter(e=>e.startsWith(`:`));for(let[t,n]of e.entries()){let e=r[t];o=o.replace(n,e)}}else for(let[e,t]of Object.entries(r))o=o.replace(`:${e}`,String(t));o=o.split(`/`).map(encodeURIComponent).join(`/`),o.startsWith(`/`)&&(o=o.slice(1));let l=c.toString();return l=l.length>0?`?${l}`.replace(/\+/g,`%20`):``,a.startsWith(`http`)?new URL(`${o}${l}`,a):`${a}${o}${l}`}var X=async(e,t)=>{let{hooks:n,url:r,options:i}=await He(e,t),a=Ye(i),o=new AbortController,s=i.signal??o.signal,c=at(r,i),l=Qe(i),u=await Xe(i),d=$e(r,i),f=W(U({},i),{url:c,headers:u,body:l,method:d,signal:s});for(let e of n.onRequest)if(e){let t=await e(f);typeof t==`object`&&t&&(f=t)}(`pipeTo`in f&&typeof f.pipeTo==`function`||typeof t?.body?.pipe==`function`)&&(`duplex`in f||(f.duplex=`half`));let{clearTimeout:p}=et(i,o),m=await a(f.url,f);p();let h={response:m,request:f};for(let e of n.onResponse)if(e){let n=await e(W(U({},h),{response:t?.hookOptions?.cloneResponse?m.clone():m}));n instanceof Response?m=n:typeof n==`object`&&n&&(m=n.response)}if(m.ok){if(f.method===`HEAD`)return{data:``,error:null};let e=qe(m),r={data:null,response:m,request:f};if(e===`json`||e===`text`){let e=await m.text();r.data=await(f.jsonParser??q)(e)}else r.data=await m[e]();f?.output&&f.output&&!f.disableValidation&&(r.data=await Y(f.output,r.data));for(let e of n.onSuccess)e&&await e(W(U({},r),{response:t?.hookOptions?.cloneResponse?m.clone():m}));return t?.throw?r.data:{data:r.data,error:null}}let g=t?.jsonParser??q,_=await m.text(),v=Je(_),y=v?await g(_):null,b={response:m,responseText:_,request:f,error:W(U({},y),{status:m.status,statusText:m.statusText})};for(let e of n.onError)e&&await e(W(U({},b),{response:t?.hookOptions?.cloneResponse?m.clone():m}));if(t?.retry){let r=We(t.retry),i=t.retryAttempt??0;if(await r.shouldAttemptRetry(i,m)){for(let e of n.onRetry)e&&await e(h);let a=r.getDelay(i);return await new Promise(e=>setTimeout(e,a)),await X(e,W(U({},t),{retryAttempt:i+1}))}}if(t?.throw)throw new Ve(m.status,m.statusText,v?y:_);return{data:null,error:W(U({},y),{status:m.status,statusText:m.statusText})}},ot=e=>{if(typeof process>`u`)return;let t=e??`/api/auth`;if({}.NEXT_PUBLIC_AUTH_URL)return{}.NEXT_PUBLIC_AUTH_URL;if(typeof window>`u`){if({}.NEXTAUTH_URL)try{return{}.NEXTAUTH_URL}catch{}if({}.VERCEL_URL)try{let e={}.VERCEL_URL.startsWith(`http`)?``:`https://`;return`${new URL(`${e}${{}.VERCEL_URL}`).origin}${t}`}catch{}}},st=(e,t)=>{let n=`credentials`in Request.prototype,r=Oe(e?.baseURL,e?.basePath,void 0,t)??ot(e?.basePath)??`/api/auth`,i=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>e!==void 0)||[],a={id:`lifecycle-hooks`,name:`lifecycle-hooks`,hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:o,onError:s,onRequest:c,onResponse:l,...u}=e?.fetchOptions||{},d=it({baseURL:r,...n?{credentials:`include`}:{},method:`GET`,jsonParser(e){return e?ge(e,{strict:!1}):null},customFetchImpl:fetch,...u,plugins:[a,...u.plugins||[],...e?.disableDefaultFetchPlugins?[]:[Ae],...i]}),{$sessionSignal:f,session:p,broadcastSessionUpdate:m}=je(d,e),h=e?.plugins||[],g={},_={$sessionSignal:f,session:p},v={"/sign-out":`POST`,"/revoke-sessions":`POST`,"/revoke-other-sessions":`POST`,"/delete-user":`POST`},y=[{signal:`$sessionSignal`,matcher(e){return e===`/sign-out`||e===`/update-user`||e===`/update-session`||e===`/sign-up/email`||e===`/sign-in/email`||e===`/delete-user`||e===`/verify-email`||e===`/revoke-sessions`||e===`/revoke-session`||e===`/change-email`},callback(e){e===`/sign-out`?m(`signout`):(e===`/update-user`||e===`/update-session`)&&m(`updateUser`)}}];for(let e of h)e.getAtoms&&Object.assign(_,e.getAtoms?.(d)),e.pathMethods&&Object.assign(v,e.pathMethods),e.atomListeners&&y.push(...e.atomListeners);let b={notify:e=>{_[e].set(!_[e].get())},listen:(e,t)=>{_[e].subscribe(t)},atoms:_};for(let t of h)t.getActions&&(g=Ne(t.getActions?.(d,b,e)??{},g));return{get baseURL(){return r},pluginsActions:g,pluginsAtoms:_,pluginPathMethods:v,atomListeners:y,$fetch:d,$store:b}};function ct(e){return typeof e==`object`&&!!e&&`get`in e&&typeof e.get==`function`&&`lc`in e&&typeof e.lc==`number`}function lt(e,t,n){let r=t[e],{fetchOptions:i,query:a,...o}=n||{};return r||(i?.method?i.method:o&&Object.keys(o).length>0?`POST`:`GET`)}function ut(e,t,n,r,i){function a(o=[]){return new Proxy(function(){},{get(t,n){if(typeof n!=`string`||n===`then`||n===`catch`||n===`finally`)return;let r=[...o,n],i=e;for(let e of r)if(i&&typeof i==`object`&&e in i)i=i[e];else{i=void 0;break}return typeof i==`function`||ct(i)?i:a(r)},apply:async(e,a,s)=>{let c=`/`+o.map(e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)).join(`/`),l=s[0]||{},u=s[1]||{},{query:d,fetchOptions:f,...p}=l,m={...u,...f},h=lt(c,n,l);return await t(c,{...m,body:h===`GET`?void 0:{...p,...m?.body||{}},query:d||m?.query,method:h,async onSuccess(e){if(await m?.onSuccess?.(e),!i||m.disableSignal)return;let t=i.filter(e=>e.matcher(c));if(!t.length)return;let n=new Set;for(let e of t){let t=r[e.signal];if(!t)return;if(n.has(e.signal))continue;n.add(e.signal);let i=t.get();setTimeout(()=>{t.set(!i)},10),e.callback?.(c)}}})}})}return a()}function dt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Z=u({organization:[`update`,`delete`],member:[`create`,`update`,`delete`],invitation:[`create`,`cancel`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),ft=Z.newRole({organization:[`update`],invitation:[`create`,`cancel`],member:[`create`,`update`,`delete`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),pt=Z.newRole({organization:[`update`,`delete`],member:[`create`,`update`,`delete`],invitation:[`create`,`cancel`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),mt=Z.newRole({organization:[],member:[],invitation:[],team:[],ac:[`read`]}),ht={admin:ft,owner:pt,member:mt},gt=(e,t)=>{if(!e.permissions)return!1;let n=e.role.split(`,`),r=e.options.creatorRole||`owner`,i=n.includes(r),a=e.allowCreatorAllPermissions||!1;if(i&&a)return!0;for(let r of n)if(t[r]?.authorize(e.permissions)?.success)return!0;return!1},_t=e=>gt(e,e.options.roles||ht),vt=e=>{let t=_(!1),n=_(!1),r=_(!1),i=_(!1),a={admin:ft,member:mt,owner:pt,...e?.roles};return{id:`organization`,$InferServerPlugin:{},getActions:(t,n,r)=>({$Infer:{ActiveOrganization:{},Organization:{},Invitation:{},Member:{},Team:{}},organization:{checkRolePermission:t=>_t({role:t.role,options:{ac:e?.ac,roles:a},permissions:t.permissions})}}),getAtoms:e=>{let a=S(t,`/organization/list`,e,{method:`GET`});return{$listOrg:t,$activeOrgSignal:n,$activeMemberSignal:r,$activeMemberRoleSignal:i,activeOrganization:S([n],`/organization/get-full-organization`,e,()=>({method:`GET`})),listOrganizations:a,activeMember:S([n,r],`/organization/get-active-member`,e,{method:`GET`}),activeMemberRole:S([n,i],`/organization/get-active-member-role`,e,{method:`GET`})}},pathMethods:{"/organization/get-full-organization":`GET`,"/organization/list-user-teams":`GET`},atomListeners:[{matcher(e){return e===`/organization/create`||e===`/organization/delete`||e===`/organization/update`},signal:`$listOrg`},{matcher(e){return e.startsWith(`/organization`)},signal:`$activeOrgSignal`},{matcher(e){return e.startsWith(`/organization/set-active`)||e===`/organization/create`||e===`/organization/delete`||e===`/organization/remove-member`||e===`/organization/leave`||e===`/organization/accept-invitation`},signal:`$sessionSignal`},{matcher(e){return e.includes(`/organization/update-member-role`)||e.startsWith(`/organization/set-active`)},signal:`$activeMemberSignal`},{matcher(e){return e.includes(`/organization/update-member-role`)||e.startsWith(`/organization/set-active`)},signal:`$activeMemberRoleSignal`}],$ERROR_CODES:f}};r({INVALID_PHONE_NUMBER:`Invalid phone number`,PHONE_NUMBER_EXIST:`Phone number already exists`,PHONE_NUMBER_NOT_EXIST:`phone number isn't registered`,INVALID_PHONE_NUMBER_OR_PASSWORD:`Invalid phone number or password`,UNEXPECTED_ERROR:`Unexpected error`,OTP_NOT_FOUND:`OTP not found`,OTP_EXPIRED:`OTP expired`,INVALID_OTP:`Invalid OTP`,PHONE_NUMBER_NOT_VERIFIED:`Phone number not verified`,PHONE_NUMBER_CANNOT_BE_UPDATED:`Phone number cannot be updated`,SEND_OTP_NOT_IMPLEMENTED:`sendOTP not implemented`,TOO_MANY_ATTEMPTS:`Too many attempts`}),r({OTP_NOT_ENABLED:`OTP not enabled`,OTP_HAS_EXPIRED:`OTP has expired`,TOTP_NOT_ENABLED:`TOTP not enabled`,TWO_FACTOR_NOT_ENABLED:`Two factor isn't enabled`,BACKUP_CODES_NOT_ENABLED:`Backup codes aren't enabled`,INVALID_BACKUP_CODE:`Invalid backup code`,INVALID_CODE:`Invalid code`,TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE:`Too many attempts. Please request a new code.`,INVALID_TWO_FACTOR_COOKIE:`Invalid two factor cookie`}),r({INVALID_USERNAME_OR_PASSWORD:`Invalid username or password`,EMAIL_NOT_VERIFIED:`Email not verified`,UNEXPECTED_ERROR:`Unexpected error`,USERNAME_IS_ALREADY_TAKEN:`Username is already taken. Please try another.`,USERNAME_TOO_SHORT:`Username is too short`,USERNAME_TOO_LONG:`Username is too long`,INVALID_USERNAME:`Username is invalid`,INVALID_DISPLAY_USERNAME:`Display username is invalid`});var Q=e(t(),1);function yt(e,t={}){let n=(0,Q.useRef)(e.get()),{keys:r,deps:i=[e,r]}=t,a=(0,Q.useCallback)(t=>{let i=e=>{n.current!==e&&(n.current=e,t())};return i(e.value),r?.length?ne(e,r,i):e.listen(i)},i),o=()=>n.current;return(0,Q.useSyncExternalStore)(a,o,o)}function bt(e){return`use${dt(e)}`}function xt(e){let{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,$fetch:i,$store:a,atomListeners:o}=st(e),s={};for(let[e,t]of Object.entries(r))s[bt(e)]=()=>yt(t);return ut({...n,...s,$fetch:i,$store:a},i,t,r,o)}var $=xt({baseURL:n(),plugins:[vt()]}),{useSession:St}=$,{signIn:Ct}=$,{signOut:wt}=$,{signUp:Tt}=$,{organization:Et}=$;$.getSession;export{St as a,Tt as i,Ct as n,wt as r,Et 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,o as a}from"./api-base-url-DIb6qukm.js";import{S as o,a as s,g as c,i as l,n as u,t as d,y as f}from"./createReactComponent-_L2mp4Ui.js";import{t as p}from"./utils-C8DGLIgm.js";import{t as m}from"./IconCheck-Gc24xPT2.js";import{t as h}from"./IconCoins-C7Nn0L6R.js";import{t as g}from"./IconLoader2-B3B6M8nQ.js";import{t as _}from"./useSuspenseQuery-B2g_FID5.js";import{n as v}from"./CompositeList-CX7HHxYw.js";import{d as y,n as b,t as x}from"./useBaseUiId-BLFGpnYJ.js";import{$ as S,A as C,H as w,O as T,S as E,W as D,a as O,b as k,c as A,d as ee,f as j,k as M,l as N,o as P,s as te,u as ne,x as re,y as ie}from"./index-crEoj0do.js";import{t as F}from"./input-CG_cIxvO.js";import{t as I}from"./useControlled-B8q0aJoo.js";import{t as L}from"./CompositeItem-D3nXGtvr.js";import{t as R}from"./badge-C1_ZMBRy.js";import{a as z,i as B,n as ae,r as oe,t as se}from"./empty-COnWCwda.js";import{t as ce}from"./label-CWOhoN_L.js";import{a as V,n as H,o as U,r as W,t as G}from"./card-Bsy6azfK.js";import{n as le}from"./textarea-DiU04l_U.js";import{a as ue,i as de,n as fe,o as K}from"./xstate-react.esm-DhUG3dob.js";import{n as pe,t as me}from"./dist-DAhKd1f7.js";var he=d(`outline`,`receipt-2`,`Receipt2`,[[`path`,{d:`M5 21v-16a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v16l-3 -2l-2 2l-2 -2l-2 2l-2 -2l-3 2`,key:`svg-0`}],[`path`,{d:`M14 8h-2.5a1.5 1.5 0 0 0 0 3h1a1.5 1.5 0 0 1 0 3h-2.5m2 0v1.5m0 -9v1.5`,key:`svg-1`}]]),ge=d(`outline`,`stack-2`,`Stack2`,[[`path`,{d:`M12 4l-8 4l8 4l8 -4l-8 -4`,key:`svg-0`}],[`path`,{d:`M4 12l8 4l8 -4`,key:`svg-1`}],[`path`,{d:`M4 16l8 4l8 -4`,key:`svg-2`}]]),q=r(),J=e(t()),_e=new Intl.NumberFormat(`en-US`,{currency:`USD`,maximumFractionDigits:4,minimumFractionDigits:2,style:`currency`}),ve=new Intl.NumberFormat(`en-US`);function Y(e){return _e.format(e)}function ye(e){return ve.format(e)}function be(e){return e===null||!Number.isFinite(e)?``:Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,``)}function xe(e){let[t=``,...n]=e.replaceAll(/[^0-9.]/g,``).split(`.`);return n.length===0?t:`${t}.${n.join(``).slice(0,2)}`}function X(e){let t=e.trim();if(t.length===0)return null;if(!/^\d+(\.\d{0,2})?$/.test(t))return`invalid`;let n=Number(t);return!Number.isFinite(n)||n<0?`invalid`:n}function Se(e){return e===null?null:Math.round(e*100)}function Ce(e){return e.isPending||e.parsedBudgetInput===`invalid`?!0:Se(e.parsedBudgetInput)===Se(e.currentBudgetUsd)}function we(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{day:`numeric`,month:`short`,timeZone:`UTC`})}function Te(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{day:`numeric`,hour:`numeric`,minute:`2-digit`,month:`short`})}function Ee(e){return e<=0?`0%`:e<10?`${e.toFixed(1)}%`:`${Math.round(e)}%`}function De(e){return e.map((e,t)=>`${t===0?`M`:`L`}${e.x},${e.y}`).join(` `)}var Z=n();function Oe(e){let t=(0,q.c)(12),{title:n,description:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(U,{children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Z.jsx)(W,{children:r}),t[2]=r,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(V,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=(0,Z.jsx)(H,{children:i}),t[7]=i,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsxs)(G,{children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function ke(e){let t=(0,q.c)(10),{dailyCost:n,totalSpendUsd:r}=e,i,a;if(t[0]!==n||t[1]!==r){let e=j(n),o=e.reduce(Ae,0);i=`space-y-3`;let s;t[4]!==o||t[5]!==r?(s=e=>{let t=o<=0?0:Math.max(e.totalCostUsd/o*100,2);return(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`min-w-0 font-medium`,children:we(e.date)}),(0,Z.jsxs)(`div`,{className:`text-right`,children:[(0,Z.jsx)(`p`,{className:`font-medium tabular-nums`,children:Y(e.totalCostUsd)}),(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[Ee(N(e.totalCostUsd,r)),` `,`of spend`]})]})]}),(0,Z.jsx)(`div`,{className:`h-2 rounded-full bg-muted/60`,children:(0,Z.jsx)(`div`,{className:`h-2 rounded-full bg-primary transition-all`,style:{width:`${t}%`}})})]},e.date)},t[4]=o,t[5]=r,t[6]=s):s=t[6],a=e.map(s),t[0]=n,t[1]=r,t[2]=i,t[3]=a}else i=t[2],a=t[3];let o;return t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(`div`,{className:i,children:a}),t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function Ae(e,t){return Math.max(e,t.totalCostUsd)}function je(e){let t=(0,q.c)(48),{dailyCost:n,monthlyBudgetUsd:r,totalSpendUsd:i}=e,a,o,s,c,l,u;if(t[0]!==n||t[1]!==r){let e=A({dailyCost:n,monthlyBudgetUsd:r}),i=e.reduce(Fe,100),d=Math.max(100,Math.ceil(i/25)*25),f=e.map((t,n)=>{let r=e.length===1?50:n/Math.max(e.length-1,1)*100,i=100-t.usagePercent/d*100;return{date:t.date,x:r,y:i}}),p=f.length===0?``:De(f),m=f.length===0?``:`${p} L${f.at(-1)?.x??0},100 L${f[0]?.x??0},100 Z`,h=100-100/d*100,g;t[8]===d?g=t[9]:(g=Array.from({length:4},(e,t)=>d/4*(t+1)),t[8]=d,t[9]=g);let _=g,v=e.length<=3?e:[e[0],e[Math.floor((e.length-1)/2)],e.at(-1)].filter(Pe);u=`space-y-4`,s=`rounded-lg border bg-muted/10 p-4`;let y,b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`span`,{children:`0%`}),b=(0,Z.jsx)(`span`,{children:`100% target`}),t[10]=y,t[11]=b):(y=t[10],b=t[11]);let x;t[12]===d?x=t[13]:(x=Math.round(d),t[12]=d,t[13]=x),t[14]===x?c=t[15]:(c=(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3 text-xs text-muted-foreground`,children:[y,b,(0,Z.jsxs)(`span`,{children:[x,`% scale`]})]}),t[14]=x,t[15]=c);let S;t[16]!==_||t[17]!==d?(S=_.map(e=>{let t=100-e/d*100;return(0,Z.jsx)(`line`,{x1:`0`,y1:t,x2:`100`,y2:t,stroke:`var(--color-border)`,strokeDasharray:`2 3`,strokeWidth:`0.5`},e)}),t[16]=_,t[17]=d,t[18]=S):S=t[18];let C;t[19]===h?C=t[20]:(C=(0,Z.jsx)(`line`,{x1:`0`,y1:h,x2:`100`,y2:h,stroke:`var(--color-border)`,strokeDasharray:`4 3`,strokeWidth:`0.8`}),t[19]=h,t[20]=C);let w;t[21]===m?w=t[22]:(w=m.length>0?(0,Z.jsx)(`path`,{d:m,fill:`var(--color-chart-2)`,opacity:`0.18`}):null,t[21]=m,t[22]=w),l=(0,Z.jsx)(`div`,{className:`h-64 w-full`,children:(0,Z.jsxs)(`svg`,{viewBox:`0 0 100 100`,className:`h-full w-full overflow-visible`,role:`img`,"aria-label":`Budget usage percentage graph`,preserveAspectRatio:`none`,children:[S,C,w,p.length>0?(0,Z.jsx)(`path`,{d:p,fill:`none`,stroke:`var(--color-chart-2)`,strokeWidth:`1.8`,vectorEffect:`non-scaling-stroke`}):null,f.map(Ne)]})}),a=`mt-3 flex items-center justify-between gap-3 text-xs text-muted-foreground`,o=v.map(Me),t[0]=n,t[1]=r,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l,t[7]=u}else a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7];let d;t[23]!==a||t[24]!==o?(d=(0,Z.jsx)(`div`,{className:a,children:o}),t[23]=a,t[24]=o,t[25]=d):d=t[25];let f;t[26]!==s||t[27]!==c||t[28]!==l||t[29]!==d?(f=(0,Z.jsxs)(`div`,{className:s,children:[c,l,d]}),t[26]=s,t[27]=c,t[28]=l,t[29]=d,t[30]=f):f=t[30];let p;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`Cumulative spend`}),t[31]=p):p=t[31];let m;t[32]===i?m=t[33]:(m=Y(i),t[32]=i,t[33]=m);let h;t[34]===m?h=t[35]:(h=(0,Z.jsxs)(`div`,{children:[p,(0,Z.jsx)(`p`,{className:`font-medium tabular-nums`,children:m})]}),t[34]=m,t[35]=h);let g;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`Limit`}),t[36]=g):g=t[36];let _;t[37]===r?_=t[38]:(_=Y(r),t[37]=r,t[38]=_);let v;t[39]===_?v=t[40]:(v=(0,Z.jsxs)(`div`,{className:`text-right`,children:[g,(0,Z.jsx)(`p`,{className:`font-medium tabular-nums`,children:_})]}),t[39]=_,t[40]=v);let y;t[41]!==h||t[42]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border bg-muted/15 p-3 text-sm`,children:[h,v]}),t[41]=h,t[42]=v,t[43]=y):y=t[43];let b;return t[44]!==y||t[45]!==u||t[46]!==f?(b=(0,Z.jsxs)(`div`,{className:u,children:[f,y]}),t[44]=y,t[45]=u,t[46]=f,t[47]=b):b=t[47],b}function Me(e){return(0,Z.jsx)(`span`,{children:we(e.date)},e.date)}function Ne(e){return(0,Z.jsx)(`circle`,{cx:e.x,cy:e.y,r:`1.6`,fill:`var(--color-chart-2)`},e.date)}function Pe(e){return e!==void 0}function Fe(e,t){return Math.max(e,t.usagePercent)}function Ie(e){let t=(0,q.c)(12),{data:n,budgetLimitState:r}=e;if(n.overview.queryCount===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(se,{className:`border`,children:(0,Z.jsxs)(oe,{children:[(0,Z.jsx)(B,{variant:`icon`,children:(0,Z.jsx)(h,{size:18,stroke:1.75})}),(0,Z.jsx)(z,{children:`No query-cost data yet`}),(0,Z.jsx)(ae,{children:"Run an agent workflow that executes database queries with stats enabled, then this dashboard will populate from `data_source_query_costs`."})]})}),t[0]=e):e=t[0],e}let i;t[1]!==r.kind||t[2]!==r.monthlyBudgetUsd||t[3]!==n.dailyCost||t[4]!==n.overview.totalCostUsd?(i=(0,Z.jsx)(Oe,{title:`Budget Usage`,description:`Cumulative spend as a percentage of your monthly budget.`,children:r.kind===`unlimited`?(0,Z.jsx)(`div`,{className:`flex h-72 items-center justify-center rounded-lg border border-dashed bg-muted/10 p-6 text-center text-sm text-muted-foreground`,children:`Set a monthly budget above to see how quickly the current window is consuming your monthly budget.`}):r.kind===`blocked`?(0,Z.jsxs)(`div`,{className:`flex h-72 items-center justify-center rounded-lg border border-dashed bg-muted/10 p-6 text-center text-sm text-muted-foreground`,children:[`Monthly budget is`,` `,Y(r.monthlyBudgetUsd),`. Increase the limit to chart usage against an available budget.`]}):(0,Z.jsx)(je,{dailyCost:n.dailyCost,monthlyBudgetUsd:r.monthlyBudgetUsd,totalSpendUsd:n.overview.totalCostUsd})}),t[1]=r.kind,t[2]=r.monthlyBudgetUsd,t[3]=n.dailyCost,t[4]=n.overview.totalCostUsd,t[5]=i):i=t[5];let a;t[6]!==n.dailyCost||t[7]!==n.overview.totalCostUsd?(a=(0,Z.jsx)(Oe,{title:`Daily Spend`,description:`Latest daily costs inside the selected reporting window.`,children:(0,Z.jsx)(ke,{dailyCost:n.dailyCost,totalSpendUsd:n.overview.totalCostUsd})}),t[6]=n.dailyCost,t[7]=n.overview.totalCostUsd,t[8]=a):a=t[8];let o;return t[9]!==i||t[10]!==a?(o=(0,Z.jsx)(`div`,{className:`space-y-4`,children:(0,Z.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[1.1fr_0.9fr]`,children:[i,a]})}),t[9]=i,t[10]=a,t[11]=o):o=t[11],o}var Le=J.createContext(void 0);function Re(e=!0){let t=J.useContext(Le);if(t===void 0&&!e)throw Error(f(7));return t}var ze=J.forwardRef(function(e,t){let{className:n,defaultPressed:r=!1,disabled:i=!1,form:a,onPressedChange:l,pressed:u,render:d,type:f,value:p,nativeButton:m=!0,...h}=e,g=x(p||void 0),_=Re(),v=_?.value??[],S=_?void 0:r,C=(i||_?.disabled)??!1,[w,T]=I({controlled:_?v?.indexOf(g)>-1:u,default:S,name:`Toggle`,state:`pressed`}),E=o((e,t)=>{g&&_?.setGroupValue?.(g,e,t),l?.(e,t)}),{getButtonProps:D,buttonRef:O}=c({disabled:C,native:m}),k=J.useMemo(()=>({disabled:C,pressed:w}),[C,w]),A=[O,t],ee=[{"aria-pressed":w,onClick(e){let t=!w,n=b(y,e.nativeEvent);E(t,n),!n.isCanceled&&T(t)}},h,D],j=s(`button`,e,{enabled:!_,state:k,ref:A,props:ee});return _?(0,Z.jsx)(L,{tag:`button`,render:d,className:n,state:k,refs:A,props:ee}):j}),Be=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e.multiple=`data-multiple`,e}({}),Ve={multiple(e){return e?{[Be.multiple]:``}:null}},He=J.forwardRef(function(e,t){let{defaultValue:n,disabled:r=!1,loopFocus:i=!0,onValueChange:a,orientation:c=`horizontal`,multiple:l=!1,value:u,className:d,render:f,...p}=e,m=v(!0),h=J.useMemo(()=>{if(u===void 0)return n??[]},[u,n]),g=(m?.disabled??!1)||r,[_,y]=I({controlled:u,default:h,name:`ToggleGroup`,state:`value`}),b=o((e,t,n)=>{let r;if(l?(r=_.slice(),t?r.push(e):r.splice(_.indexOf(e),1)):r=t?[e]:[],Array.isArray(r)){if(a?.(r,n),n.isCanceled)return;y(r)}}),x=J.useMemo(()=>({disabled:g,multiple:l,orientation:c}),[g,c,l]),S=J.useMemo(()=>({disabled:g,orientation:c,setGroupValue:b,value:_}),[g,c,b,_]),C={role:`group`},w=s(`div`,e,{enabled:!!m,state:x,ref:t,props:[C,p],stateAttributesMapping:Ve});return(0,Z.jsx)(Le.Provider,{value:S,children:m?w:(0,Z.jsx)(le,{render:f,className:d,state:x,refs:[t],props:[C,p],stateAttributesMapping:Ve,loopFocus:i})})}),Ue=l(`hover:text-foreground aria-pressed:bg-muted focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[state=on]:bg-muted gap-1 rounded-lg text-sm font-medium transition-all [&_svg:not([class*='size-'])]:size-4 group/toggle hover:bg-muted inline-flex items-center justify-center whitespace-nowrap outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,outline:`border-input hover:bg-muted border bg-transparent`},size:{default:`h-8 min-w-8 px-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-1.5 text-[0.8rem]`,lg:`h-9 min-w-9 px-2.5`}},defaultVariants:{variant:`default`,size:`default`}}),We=J.createContext({size:`default`,variant:`default`,spacing:0,orientation:`horizontal`});function Ge(e){let t=(0,q.c)(29),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({className:r,variant:c,size:a,spacing:o,orientation:s,children:n,...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);let l=o===void 0?0:o,u=s===void 0?`horizontal`:s,d;t[8]===l?d=t[9]:(d={"--gap":l},t[8]=l,t[9]=d);let f=d,m;t[10]===r?m=t[11]:(m=p(`rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch`,r),t[10]=r,t[11]=m);let h;t[12]!==u||t[13]!==a||t[14]!==l||t[15]!==c?(h={variant:c,size:a,spacing:l,orientation:u},t[12]=u,t[13]=a,t[14]=l,t[15]=c,t[16]=h):h=t[16];let g;t[17]!==n||t[18]!==h?(g=(0,Z.jsx)(We.Provider,{value:h,children:n}),t[17]=n,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==u||t[21]!==i||t[22]!==a||t[23]!==l||t[24]!==f||t[25]!==m||t[26]!==g||t[27]!==c?(_=(0,Z.jsx)(He,{"data-slot":`toggle-group`,"data-variant":c,"data-size":a,"data-spacing":l,"data-orientation":u,style:f,className:m,...i,children:g}),t[20]=u,t[21]=i,t[22]=a,t[23]=l,t[24]=f,t[25]=m,t[26]=g,t[27]=c,t[28]=_):_=t[28],_}function Ke(e){let t=(0,q.c)(19),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,variant:a,size:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?`default`:a,c=o===void 0?`default`:o,l=J.useContext(We),u=l.variant||s,d=l.size||c,f=l.spacing,m;t[6]!==r||t[7]!==l.size||t[8]!==l.variant||t[9]!==c||t[10]!==s?(m=p(`group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg shrink-0 focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t`,Ue({variant:l.variant||s,size:l.size||c}),r),t[6]=r,t[7]=l.size,t[8]=l.variant,t[9]=c,t[10]=s,t[11]=m):m=t[11];let h;return t[12]!==n||t[13]!==l.spacing||t[14]!==i||t[15]!==u||t[16]!==d||t[17]!==m?(h=(0,Z.jsx)(ze,{"data-slot":`toggle-group-item`,"data-variant":u,"data-size":d,"data-spacing":f,className:m,...i,children:n}),t[12]=n,t[13]=l.spacing,t[14]=i,t[15]=u,t[16]=d,t[17]=m,t[18]=h):h=t[18],h}function qe(e){switch(e.kind){case`unlimited`:return`No budget set`;case`blocked`:return`No spend allowed`;case`limited`:return`${Y(e.monthlyBudgetUsd)} / month`}return e}function Je(e){let t=(0,q.c)(23),{budgetLimitState:n,generatedAt:r,isWindowChangePending:i,selectedDays:a,onWindowChange:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Budget`}),t[0]=s):s=t[0];let c;t[1]===n?c=t[2]:(c=qe(n),t[1]=n,t[2]=c);let l;t[3]===c?l=t[4]:(l=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[s,(0,Z.jsx)(R,{variant:`outline`,children:c})]}),t[3]=c,t[4]=l);let u;t[5]===r?u=t[6]:(u=Te(r),t[5]=r,t[6]=u);let d=i?` Refreshing selected window...`:``,f;t[7]!==u||t[8]!==d?(f=(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Updated `,u,d]}),t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;t[10]!==l||t[11]!==f?(p=(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[l,f]}),t[10]=l,t[11]=f,t[12]=p):p=t[12];let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.18em] text-muted-foreground`,children:`Window`}),t[13]=m):m=t[13];let h=String(a),g;t[14]===h?g=t[15]:(g=[h],t[14]=h,t[15]=g);let _;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=P.map(Ye),t[16]=_):_=t[16];let v;t[17]!==o||t[18]!==g?(v=(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[m,(0,Z.jsx)(Ge,{value:g,onValueChange:o,variant:`outline`,size:`sm`,"aria-label":`Budget window`,children:_})]}),t[17]=o,t[18]=g,t[19]=v):v=t[19];let y;return t[20]!==v||t[21]!==p?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 xl:flex-row xl:items-end xl:justify-between`,children:[p,v]}),t[20]=v,t[21]=p,t[22]=y):y=t[22],y}function Ye(e){return(0,Z.jsxs)(Ke,{value:String(e),className:`min-w-20 justify-center`,children:[e,` days`]},e)}function Xe(e){let t=(0,q.c)(13),{children:n,tooltip:r}=e;if(!r)return n;let i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a=`More information about ${n}`,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(S,{size:14,stroke:1.75}),t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=(0,Z.jsx)(C,{className:`inline-flex size-4 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground`,"aria-label":a,children:o}),t[3]=a,t[4]=s);let c;t[5]===r?c=t[6]:(c=(0,Z.jsx)(M,{children:r}),t[5]=r,t[6]=c);let l;t[7]!==s||t[8]!==c?(l=(0,Z.jsxs)(T,{children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;return t[10]!==i||t[11]!==l?(u=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[i,l]}),t[10]=i,t[11]=l,t[12]=u):u=t[12],u}function Ze(e){let t=(0,q.c)(17),{title:n,value:r,description:i,icon:a}=e,o;t[0]===a?o=t[1]:(o=(0,Z.jsx)(`div`,{className:`w-fit rounded-lg border bg-muted/30 p-2`,children:(0,Z.jsx)(a,{size:18,stroke:1.75})}),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,Z.jsx)(W,{children:n}),t[2]=n,t[3]=s);let c;t[4]===r?c=t[5]:(c=(0,Z.jsx)(U,{className:`text-2xl`,children:r}),t[4]=r,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==o||t[10]!==l?(u=(0,Z.jsxs)(V,{className:`space-y-4`,children:[o,l]}),t[9]=o,t[10]=l,t[11]=u):u=t[11];let d;t[12]===i?d=t[13]:(d=(0,Z.jsx)(H,{className:`pt-0 text-sm text-muted-foreground`,children:i}),t[12]=i,t[13]=d);let f;return t[14]!==u||t[15]!==d?(f=(0,Z.jsxs)(G,{children:[u,d]}),t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function Qe(e){let t=(0,q.c)(31),{budgetLimitState:n,overview:r,peakSpendDay:i}=e,a;t[0]!==n.budgetUsedPercent||t[1]!==n.kind?(a=n.kind===`unlimited`?`Not set`:n.kind===`blocked`?`Blocked`:Ee(n.budgetUsedPercent),t[0]=n.budgetUsedPercent,t[1]=n.kind,t[2]=a):a=t[2];let o=a,s;t[3]!==n.kind||t[4]!==n.monthlyBudgetUsd||t[5]!==r.totalCostUsd?(s=n.kind===`unlimited`?`Set a monthly budget to track percentage use.`:n.kind===`blocked`?`${Y(n.monthlyBudgetUsd)} monthly budget blocks new agent runs.`:`${Y(r.totalCostUsd)} of ${Y(n.monthlyBudgetUsd)} monthly budget used`,t[3]=n.kind,t[4]=n.monthlyBudgetUsd,t[5]=r.totalCostUsd,t[6]=s):s=t[6];let c=s,l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Xe,{tooltip:`Uses actualCostUsd when available, and falls back to estimatedCostUsd when only estimated spend is recorded.`,children:`Observed Spend`}),t[7]=l):l=t[7];let u;t[8]===r.totalCostUsd?u=t[9]:(u=Y(r.totalCostUsd),t[8]=r.totalCostUsd,t[9]=u);let d;t[10]===r.activeConnectionCount?d=t[11]:(d=ye(r.activeConnectionCount),t[10]=r.activeConnectionCount,t[11]=d);let f;t[12]===r.activeProviderCount?f=t[13]:(f=ye(r.activeProviderCount),t[12]=r.activeProviderCount,t[13]=f);let p=`${d} connections across ${f} providers`,m;t[14]!==u||t[15]!==p?(m=(0,Z.jsx)(Ze,{title:l,value:u,description:p,icon:h}),t[14]=u,t[15]=p,t[16]=m):m=t[16];let g;t[17]!==c||t[18]!==o?(g=(0,Z.jsx)(Ze,{title:`Budget Used`,value:o,description:c,icon:he}),t[17]=c,t[18]=o,t[19]=g):g=t[19];let _;t[20]===i?_=t[21]:(_=i?Y(i.totalCostUsd):`No spend`,t[20]=i,t[21]=_);let v;t[22]===i?v=t[23]:(v=i?`${we(i.date)} recorded the highest spend.`:`No observed query spend in this window`,t[22]=i,t[23]=v);let y;t[24]!==_||t[25]!==v?(y=(0,Z.jsx)(Ze,{title:`Peak Spend Day`,value:_,description:v,icon:ge}),t[24]=_,t[25]=v,t[26]=y):y=t[26];let b;return t[27]!==y||t[28]!==m||t[29]!==g?(b=(0,Z.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:[m,g,y]}),t[27]=y,t[28]=m,t[29]=g,t[30]=b):b=t[30],b}function $e(e){let t=(0,q.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=p(`border-input dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-disabled:bg-input/50 dark:has-disabled:bg-input/80 h-8 rounded-lg border transition-colors has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot][aria-invalid=true]]:ring-[3px] has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 [[data-slot=combobox-content]_&]:focus-within:border-inherit [[data-slot=combobox-content]_&]:focus-within:ring-0 group/input-group relative flex w-full min-w-0 items-center outline-none has-[>textarea]:h-auto`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var et=l(`text-muted-foreground h-auto gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4 flex cursor-text items-center justify-center select-none`,{variants:{align:{"inline-start":`pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem] order-first`,"inline-end":`pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem] order-last`,"block-start":`px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start`,"block-end":`px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start`}},defaultVariants:{align:`inline-start`}});function tt(e){let t=(0,q.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,align:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`inline-start`:i,o;t[4]!==a||t[5]!==n?(o=p(et({align:a}),n),t[4]=a,t[5]=n,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Z.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":a,className:o,onClick:nt,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function nt(e){e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()}l(`gap-2 text-sm shadow-none flex items-center`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function rt(e){let t=(0,q.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=p(`text-muted-foreground gap-2 text-sm [&_svg:not([class*='size-'])]:size-4 flex items-center [&_svg]:pointer-events-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function it(e){let t=(0,q.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=p(`rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent flex-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(F,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function at(e){let t=(0,q.c)(14),{status:n,className:r}=e;if(n===`idle`)return null;let i=n===`error`&&`text-destructive`,a;t[0]!==r||t[1]!==i?(a=p(`flex items-center gap-1.5 text-xs text-muted-foreground transition-opacity`,i,r),t[0]=r,t[1]=i,t[2]=a):a=t[2];let o;t[3]===n?o=t[4]:(o=n===`saving`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(g,{size:14,className:`animate-spin`}),(0,Z.jsx)(`span`,{children:`Saving...`})]}),t[3]=n,t[4]=o);let s;t[5]===n?s=t[6]:(s=n===`saved`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(m,{size:14,className:`text-green-600`}),(0,Z.jsx)(`span`,{children:`Saved`})]}),t[5]=n,t[6]=s);let c;t[7]===n?c=t[8]:(c=n===`error`&&(0,Z.jsx)(`span`,{children:`Failed to save`}),t[7]=n,t[8]=c);let l;return t[9]!==a||t[10]!==o||t[11]!==s||t[12]!==c?(l=(0,Z.jsxs)(`div`,{className:a,children:[o,s,c]}),t[9]=a,t[10]=o,t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function ot(e){let t=(0,q.c)(68),n;bb0:{switch(e.budgetLimitState.kind){case`unlimited`:{let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`rounded-lg border border-dashed bg-muted/10 p-4 text-sm text-muted-foreground`,children:`Set a limit to track usage.`}),t[0]=e):e=t[0],n=e;break bb0}case`blocked`:{let r;t[1]===e.budgetLimitState.monthlyBudgetUsd?r=t[2]:(r=Y(e.budgetLimitState.monthlyBudgetUsd),t[1]=e.budgetLimitState.monthlyBudgetUsd,t[2]=r);let i;t[3]===r?i=t[4]:(i=(0,Z.jsxs)(`div`,{className:`rounded-lg border border-dashed bg-muted/10 p-4 text-sm text-muted-foreground`,children:[`Monthly budget is`,` `,r,`. Agent runs are blocked until you raise the limit.`]}),t[3]=r,t[4]=i),n=i;break bb0}case`limited`:{let r=Math.min(e.budgetLimitState.budgetUsedPercent,100),i;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{children:(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:`Spend vs. limit`})}),t[5]=i):i=t[5];let a;t[6]===e.totalSpendUsd?a=t[7]:(a=Y(e.totalSpendUsd),t[6]=e.totalSpendUsd,t[7]=a);let o;t[8]===e.budgetLimitState.monthlyBudgetUsd?o=t[9]:(o=Y(e.budgetLimitState.monthlyBudgetUsd),t[8]=e.budgetLimitState.monthlyBudgetUsd,t[9]=o);let s;t[10]!==a||t[11]!==o?(s=(0,Z.jsxs)(`p`,{className:`font-medium tabular-nums`,children:[a,` /`,` `,o]}),t[10]=a,t[11]=o,t[12]=s):s=t[12];let c;t[13]!==e.budgetLimitState.isOverBudget||t[14]!==e.budgetLimitState.remainingBudgetUsd?(c=e.budgetLimitState.isOverBudget?`${Y(Math.abs(e.budgetLimitState.remainingBudgetUsd))} over`:`${Y(e.budgetLimitState.remainingBudgetUsd)} remaining`,t[13]=e.budgetLimitState.isOverBudget,t[14]=e.budgetLimitState.remainingBudgetUsd,t[15]=c):c=t[15];let l;t[16]===c?l=t[17]:(l=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c}),t[16]=c,t[17]=l);let u;t[18]!==s||t[19]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[i,(0,Z.jsxs)(`div`,{className:`text-right`,children:[s,l]})]}),t[18]=s,t[19]=l,t[20]=u):u=t[20];let d=`h-2 rounded-full transition-all ${e.budgetLimitState.isOverBudget?`bg-destructive`:`bg-primary`}`,f=`${r}%`,p;t[21]===f?p=t[22]:(p={width:f},t[21]=f,t[22]=p);let m;t[23]!==p||t[24]!==d?(m=(0,Z.jsx)(`div`,{className:`h-2 rounded-full bg-muted/60`,children:(0,Z.jsx)(`div`,{className:d,style:p})}),t[23]=p,t[24]=d,t[25]=m):m=t[25];let h;t[26]===e.budgetLimitState.budgetUsedPercent?h=t[27]:(h=Ee(e.budgetLimitState.budgetUsedPercent),t[26]=e.budgetLimitState.budgetUsedPercent,t[27]=h);let g;t[28]===h?g=t[29]:(g=(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Using`,` `,h,` of the limit.`]}),t[28]=h,t[29]=g);let _;t[30]!==m||t[31]!==g||t[32]!==u?(_=(0,Z.jsxs)(`div`,{className:`space-y-3 rounded-lg border bg-muted/15 p-4`,children:[u,m,g]}),t[30]=m,t[31]=g,t[32]=u,t[33]=_):_=t[33],n=_;break bb0}}n=e.budgetLimitState}let r=n,i;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(U,{children:`Spend Limit`}),(0,Z.jsx)(W,{children:`Cap monthly spend.`})]}),t[34]=i):i=t[34];let a;t[35]===e.saveStatus?a=t[36]:(a=(0,Z.jsx)(V,{className:`space-y-3`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[i,(0,Z.jsx)(at,{status:e.saveStatus})]})}),t[35]=e.saveStatus,t[36]=a);let o;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(ce,{htmlFor:`budget-target`,children:`Limit (USD)`}),t[37]=o):o=t[37];let s;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(tt,{align:`inline-start`,children:(0,Z.jsx)(rt,{children:`$`})}),t[38]=s):s=t[38];let c=!e.canEditBudget,l;t[39]===e?l=t[40]:(l=t=>e.onBudgetInputChange(xe(t.target.value)),t[39]=e,t[40]=l);let d;t[41]!==e.budgetInput||t[42]!==c||t[43]!==l?(d=(0,Z.jsxs)($e,{className:`flex-1`,children:[s,(0,Z.jsx)(it,{id:`budget-target`,inputMode:`decimal`,placeholder:`2500`,value:e.budgetInput,disabled:c,onChange:l})]}),t[41]=e.budgetInput,t[42]=c,t[43]=l,t[44]=d):d=t[44];let f=!e.canEditBudget||e.isSaveDisabled,p;t[45]!==e.onBudgetSave||t[46]!==f?(p=(0,Z.jsx)(u,{type:`button`,onClick:e.onBudgetSave,disabled:f,children:`Save`}),t[45]=e.onBudgetSave,t[46]=f,t[47]=p):p=t[47];let m=!e.canEditBudget||e.isSavePending||!e.hasBudgetConfigured&&e.budgetInput.length===0,h;t[48]!==e.onBudgetClear||t[49]!==m?(h=(0,Z.jsx)(u,{type:`button`,variant:`outline`,onClick:e.onBudgetClear,disabled:m,children:`Clear`}),t[48]=e.onBudgetClear,t[49]=m,t[50]=h):h=t[50];let g;t[51]!==h||t[52]!==p?(g=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2 xl:shrink-0`,children:[p,h]}),t[51]=h,t[52]=p,t[53]=g):g=t[53];let _;t[54]!==g||t[55]!==d?(_=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 xl:flex-row xl:items-center`,children:[d,g]}),t[54]=g,t[55]=d,t[56]=_):_=t[56];let v=e.canEditBudget?e.isBudgetInputInvalid?`Enter a valid non-negative USD amount.`:`Leave blank to clear the limit.`:`Only admins and owners can update the monthly spend limit.`,y;t[57]===v?y=t[58]:(y=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:v}),t[57]=v,t[58]=y);let b;t[59]!==_||t[60]!==y?(b=(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[o,_,y]}),t[59]=_,t[60]=y,t[61]=b):b=t[61];let x;t[62]!==r||t[63]!==b?(x=(0,Z.jsxs)(H,{className:`space-y-4`,children:[b,r]}),t[62]=r,t[63]=b,t[64]=x):x=t[64];let S;return t[65]!==x||t[66]!==a?(S=(0,Z.jsxs)(G,{children:[a,x]}),t[65]=x,t[66]=a,t[67]=S):S=t[67],S}var st=2e3,ct=3e3,lt=`Failed to save monthly budget`,Q={CLEAR:`budgetSettings/clear`,INPUT_CHANGED:`budgetSettings/inputChanged`,SAVE:`budgetSettings/save`,SAVE_FAILED:`budgetSettings/saveFailed`,SAVE_SUCCEEDED:`budgetSettings/saveSucceeded`,SETTINGS_SYNCED:`budgetSettings/settingsSynced`},$={EDITING:`editing`,ERROR:`error`,SAVED:`saved`,SAVING:`saving`},ut=class extends pe(`BudgetSaveError`)(){};function dt(e){return{budgetInput:be(e),nextSaveRequestId:1,pendingSaveRequest:null,persistedBudgetUsd:e}}function ft(e){let t=X(e.budgetInput);if(t===`invalid`)throw Error(`Budget input must be valid before saving`);return t}function pt(e){return!Ce({currentBudgetUsd:e.persistedBudgetUsd,isPending:!1,parsedBudgetInput:X(e.budgetInput)})}function mt(e){return e.persistedBudgetUsd!==null||e.budgetInput.trim().length>0}function ht(e){return e===$.SAVING?`saving`:e===$.SAVED?`saved`:e===$.ERROR?`error`:`idle`}async function gt(e){return me.tryPromise({try:()=>e.saveBudget(e.nextBudgetUsd),catch:t=>new ut({cause:t,message:e.errorMessage})})}function _t(e,t={}){let n=t.savedIdleDelayMs??st,r=t.errorIdleDelayMs??ct;return ue({actions:{clearPendingSaveRequest:K({pendingSaveRequest:()=>null}),updateBudgetInput:K({budgetInput:(e,t)=>t.value}),clearBudgetInput:K({budgetInput:()=>``}),syncBudgetFromSettings:K({persistedBudgetUsd:(e,t)=>t.monthlyBudgetUsd,budgetInput:(e,t)=>be(t.monthlyBudgetUsd)}),startSaveRequest:K(({context:e})=>({nextSaveRequestId:e.nextSaveRequestId+1,pendingSaveRequest:{nextBudgetUsd:ft(e),requestId:e.nextSaveRequestId}})),storePersistedBudget:K(({context:e,event:t})=>(de(t,Q.SAVE_SUCCEEDED),e.pendingSaveRequest?.requestId===t.requestId?{budgetInput:be(t.monthlyBudgetUsd),persistedBudgetUsd:t.monthlyBudgetUsd}:{}))},guards:{canSave:({context:e})=>pt(e),canClear:({context:e})=>mt(e),matchesPendingSaveRequest:({context:e,event:t})=>t.type!==Q.SAVE_FAILED&&t.type!==Q.SAVE_SUCCEEDED?!1:e.pendingSaveRequest?.requestId===t.requestId},types:{}}).createMachine({context:dt(e.initialBudgetUsd),id:`budgetSettings`,initial:$.EDITING,on:{[Q.SETTINGS_SYNCED]:{actions:{type:`syncBudgetFromSettings`,params:({event:e})=>({monthlyBudgetUsd:e.monthlyBudgetUsd})}}},states:{[$.EDITING]:{on:{[Q.INPUT_CHANGED]:{actions:{type:`updateBudgetInput`,params:({event:e})=>({value:e.value})}},[Q.SAVE]:{guard:`canSave`,actions:`startSaveRequest`,target:$.SAVING},[Q.CLEAR]:{guard:`canClear`,actions:[`clearBudgetInput`,`startSaveRequest`],target:$.SAVING}}},[$.SAVING]:{on:{[Q.INPUT_CHANGED]:{actions:{type:`updateBudgetInput`,params:({event:e})=>({value:e.value})}},[Q.SAVE_SUCCEEDED]:{actions:[`storePersistedBudget`,`clearPendingSaveRequest`],guard:`matchesPendingSaveRequest`,target:$.SAVED},[Q.SAVE_FAILED]:{actions:`clearPendingSaveRequest`,guard:`matchesPendingSaveRequest`,target:$.ERROR}}},[$.SAVED]:{after:{[n]:$.EDITING},on:{[Q.INPUT_CHANGED]:{target:$.EDITING,actions:{type:`updateBudgetInput`,params:({event:e})=>({value:e.value})}},[Q.SAVE]:{guard:`canSave`,actions:`startSaveRequest`,target:$.SAVING},[Q.CLEAR]:{guard:`canClear`,actions:[`clearBudgetInput`,`startSaveRequest`],target:$.SAVING}}},[$.ERROR]:{after:{[r]:$.EDITING},on:{[Q.INPUT_CHANGED]:{target:$.EDITING,actions:{type:`updateBudgetInput`,params:({event:e})=>({value:e.value})}},[Q.SAVE]:{guard:`canSave`,actions:`startSaveRequest`,target:$.SAVING},[Q.CLEAR]:{guard:`canClear`,actions:[`clearBudgetInput`,`startSaveRequest`],target:$.SAVING}}}}})}function vt(e){let t=(0,q.c)(41),n;t[0]===e.monthlyBudgetUsd?n=t[1]:(n=()=>_t({initialBudgetUsd:e.monthlyBudgetUsd}),t[0]=e.monthlyBudgetUsd,t[1]=n);let[r]=(0,J.useState)(n),[i,a]=fe(r),o=i.context.pendingSaveRequest,s;t[2]===i?s=t[3]:(s=i.matches($.SAVING),t[2]=i,t[3]=s);let c=s,l,u;t[4]!==e.monthlyBudgetUsd||t[5]!==a?(l=()=>{a({monthlyBudgetUsd:e.monthlyBudgetUsd,type:Q.SETTINGS_SYNCED})},u=[e.monthlyBudgetUsd,a],t[4]=e.monthlyBudgetUsd,t[5]=a,t[6]=l,t[7]=u):(l=t[6],u=t[7]),(0,J.useEffect)(l,u);let d,f;t[8]!==e.errorMessage||t[9]!==e.saveBudget||t[10]!==c||t[11]!==o||t[12]!==a?(d=()=>{if(!c||o===null)return;let t=!1;return gt({errorMessage:e.errorMessage??lt,nextBudgetUsd:o.nextBudgetUsd,saveBudget:e.saveBudget}).then(e=>{if(!t){if(e.isErr()){w.error(e.error.message),a({requestId:o.requestId,type:Q.SAVE_FAILED});return}a({monthlyBudgetUsd:e.value.monthlyBudgetUsd,requestId:o.requestId,type:Q.SAVE_SUCCEEDED})}}),()=>{t=!0}},f=[e.errorMessage,e.saveBudget,c,o,a],t[8]=e.errorMessage,t[9]=e.saveBudget,t[10]=c,t[11]=o,t[12]=a,t[13]=d,t[14]=f):(d=t[13],f=t[14]),(0,J.useEffect)(d,f);let p;t[15]===a?p=t[16]:(p=e=>{a({type:Q.INPUT_CHANGED,value:e})},t[15]=a,t[16]=p);let m=p,h;t[17]===a?h=t[18]:(h=()=>{a({type:Q.SAVE})},t[17]=a,t[18]=h);let g=h,_;t[19]===a?_=t[20]:(_=()=>{a({type:Q.CLEAR})},t[19]=a,t[20]=_);let v=_,y,b,x,S,C,T;if(t[21]!==v||t[22]!==i){let e=X(i.context.budgetInput);y=i.matches($.SAVING),T=i.context.budgetInput,b=v,x=i.context.persistedBudgetUsd!==null,S=e===`invalid`,C=Ce({parsedBudgetInput:e,currentBudgetUsd:i.context.persistedBudgetUsd,isPending:y}),t[21]=v,t[22]=i,t[23]=y,t[24]=b,t[25]=x,t[26]=S,t[27]=C,t[28]=T}else y=t[23],b=t[24],x=t[25],S=t[26],C=t[27],T=t[28];let E=String(i.value),D;t[29]===E?D=t[30]:(D=ht(E),t[29]=E,t[30]=D);let O;return t[31]!==y||t[32]!==g||t[33]!==m||t[34]!==b||t[35]!==x||t[36]!==S||t[37]!==C||t[38]!==D||t[39]!==T?(O={budgetInput:T,clear:b,hasBudgetConfigured:x,isBudgetInputInvalid:S,isSaveDisabled:C,isSavePending:y,save:g,saveStatus:D,setBudgetInput:m},t[31]=y,t[32]=g,t[33]=m,t[34]=b,t[35]=x,t[36]=S,t[37]=C,t[38]=D,t[39]=T,t[40]=O):O=t[40],O}var yt=i(`/_authenticated/$org_slug/budget`);function bt(){let e=(0,q.c)(57),t=a(),n=D(),{organizationId:r,organizationSlug:i,session:o}=yt.useRouteContext(),s=o.user.id,{days:c}=yt.useSearch(),l=(0,J.useDeferredValue)(c),u=l!==c,d;e[0]===i?d=e[1]:(d=re(i),e[0]=i,e[1]=d);let f=d,p;e[2]!==s||e[3]!==r?(p=ie(s,r),e[2]=s,e[3]=r,e[4]=p):p=e[4];let{data:m}=_(p),h;e[5]!==l||e[6]!==r?(h=O(r,l),e[5]=l,e[6]=r,e[7]=h):h=e[7];let{data:g}=_(h),{data:v}=_(f),y;e[8]!==s||e[9]!==m?(y=k({currentUserId:s,members:m}),e[8]=s,e[9]=m,e[10]=y):y=e[10];let{canUpdateOrganizationSettings:b}=y,x;e[11]===g.dailyCost?x=e[12]:(x=ee(g.dailyCost),e[11]=g.dailyCost,e[12]=x);let S=x,C=v.monthlyBudgetUsd,w;e[13]!==g.overview.totalCostUsd||e[14]!==C?(w=ne({monthlyBudgetUsd:C,totalSpendUsd:g.overview.totalCostUsd}),e[13]=g.overview.totalCostUsd,e[14]=C,e[15]=w):w=e[15];let T=w,A;e[16]!==i||e[17]!==n?(A=async e=>{let t=await E(i,{monthlyBudgetUsd:e});return n.setQueryData(re(i).queryKey,t),t},e[16]=i,e[17]=n,e[18]=A):A=e[18];let j=A,M;e[19]!==j||e[20]!==v.monthlyBudgetUsd?(M={errorMessage:`Failed to save monthly budget`,monthlyBudgetUsd:v.monthlyBudgetUsd,saveBudget:j},e[19]=j,e[20]=v.monthlyBudgetUsd,e[21]=M):M=e[21];let N=vt(M),P;e[22]!==t||e[23]!==i||e[24]!==c?(P=function(e){let n=e[0];if(!n)return;let r=Number(n),a=te.safeParse(r);!a.success||a.data===c||(0,J.startTransition)(()=>{t({params:{org_slug:i},replace:!0,search:{days:a.data},to:`/$org_slug/budget`})})},e[22]=t,e[23]=i,e[24]=c,e[25]=P):P=e[25];let F=P,I;e[26]!==T||e[27]!==g.generatedAt||e[28]!==F||e[29]!==u||e[30]!==c?(I=(0,Z.jsx)(Je,{budgetLimitState:T,generatedAt:g.generatedAt,isWindowChangePending:u,selectedDays:c,onWindowChange:F}),e[26]=T,e[27]=g.generatedAt,e[28]=F,e[29]=u,e[30]=c,e[31]=I):I=e[31];let L;e[32]!==T||e[33]!==N.budgetInput||e[34]!==N.clear||e[35]!==N.hasBudgetConfigured||e[36]!==N.isBudgetInputInvalid||e[37]!==N.isSaveDisabled||e[38]!==N.isSavePending||e[39]!==N.save||e[40]!==N.saveStatus||e[41]!==N.setBudgetInput||e[42]!==b||e[43]!==g.overview.totalCostUsd?(L=(0,Z.jsx)(ot,{budgetInput:N.budgetInput,onBudgetInputChange:N.setBudgetInput,onBudgetSave:N.save,onBudgetClear:N.clear,canEditBudget:b,saveStatus:N.saveStatus,isSavePending:N.isSavePending,isSaveDisabled:N.isSaveDisabled,hasBudgetConfigured:N.hasBudgetConfigured,isBudgetInputInvalid:N.isBudgetInputInvalid,budgetLimitState:T,totalSpendUsd:g.overview.totalCostUsd}),e[32]=T,e[33]=N.budgetInput,e[34]=N.clear,e[35]=N.hasBudgetConfigured,e[36]=N.isBudgetInputInvalid,e[37]=N.isSaveDisabled,e[38]=N.isSavePending,e[39]=N.save,e[40]=N.saveStatus,e[41]=N.setBudgetInput,e[42]=b,e[43]=g.overview.totalCostUsd,e[44]=L):L=e[44];let R;e[45]!==T||e[46]!==g.overview||e[47]!==S?(R=(0,Z.jsx)(Qe,{budgetLimitState:T,overview:g.overview,peakSpendDay:S}),e[45]=T,e[46]=g.overview,e[47]=S,e[48]=R):R=e[48];let z;e[49]!==T||e[50]!==g?(z=(0,Z.jsx)(Ie,{data:g,budgetLimitState:T}),e[49]=T,e[50]=g,e[51]=z):z=e[51];let B;return e[52]!==L||e[53]!==R||e[54]!==z||e[55]!==I?(B=(0,Z.jsxs)(`div`,{className:`space-y-8 p-8`,children:[I,L,R,z]}),e[52]=L,e[53]=R,e[54]=z,e[55]=I,e[56]=B):B=e[56],B}var xt=bt;export{xt as component};
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{n as r}from"./useRouterState-DpT8luFk.js";import{a as i,o as a}from"./api-base-url-DIb6qukm.js";import{t as o}from"./auth-client-BlMeXgb4.js";import{t as s}from"./queryOptions-BHw87wTZ.js";import{t as c}from"./query-timing-LGzitMXx.js";import{d as l,l as u,m as d,r as f}from"./schemas-MsKXD_XQ.js";import{t as p}from"./organization-query-keys-DwLucsD_.js";import{E as m,T as h,q as g}from"./index-DthpwdlN.js";import{t as _}from"./auth-bootstrap-query-CrWpT3WV.js";var v=e(t(),1);function y(e){let t=e.organizations.at(0);if(t)return{kind:`organizationHome`,organizationSlug:m(t)};let n=b(e.pendingInvitations);return n?{kind:`invite`,invitationId:n.id}:e.signupMode===`invite-only`?{kind:`inviteOnlyPendingAccess`}:{kind:`onboardingCreateOrg`}}function b(e){return e.length===0?null:[...e].sort(x)[0]??null}function x(e,t){let n=Date.parse(t.createdAt)-Date.parse(e.createdAt);return n===0?e.id.localeCompare(t.id):n}var S=f(u({createdAt:d(),email:l(),expiresAt:d(),id:l(),inviterId:l(),organizationId:l(),organizationName:l(),role:l().nullable().optional(),status:l(),teamId:l().nullable().optional()}));async function C(){let e=await o.listUserInvitations();if(!e.data)throw Error(`Failed to fetch pending invitations`);return S.parse(e.data)}function w(e){return s({queryFn:C,queryKey:p.pendingInvitations(e),staleTime:c})}var T=n(),E=i(`/auth/callback`),D=`Your account is signed in, but you do not have access to an organization yet. Ask an admin to send or resend your invitation link.`;function O(){let e=a(),t=r(),n=(0,v.useRef)(!1),[i,o]=(0,v.useState)(0),[s,c]=(0,v.useState)(`Setting up your account...`),{redirect:l}=E.useSearch(),{auth:u,queryClient:d,refetchSession:f}=E.useRouteContext(),p=g(l);return(0,v.useEffect)(()=>{let r=!0;async function i(){try{let i=u;if(!i.session?.user){if(!n.current){console.warn(`[auth] callback missing session, retrying refetch`),n.current=!0,await f(),r&&o(e=>e+1);return}if(!i.session?.user){console.error(`[auth] callback failed: session is still missing`),r&&await e({to:`/signin`});return}}if(await t.invalidate({sync:!0}),r&&c(`Setting up your account...`),!r)return;if(p&&p.path!==`/auth/callback`){await e({to:p.path});return}let a=i.session?.user.id;if(!a){console.error(`[auth] callback failed: authenticated user is missing`),r&&await e({to:`/signin`});return}let s=await d.fetchQuery({...h(a),staleTime:0}).catch(e=>(console.error(`[auth] callback failed to load organizations`,{error:e}),null));if(!s){r&&await e({to:`/signin`});return}if(!r)return;let l=y({organizations:s,pendingInvitations:s.length===0?await d.fetchQuery({...w(a),staleTime:0}).catch(e=>(console.error(`[auth] callback failed to load pending invitations`,{error:e}),[])):[],signupMode:(await d.fetchQuery({..._(),staleTime:0}).catch(e=>(console.error(`[auth] callback failed to load bootstrap state`,{error:e}),null)))?.signupMode});if(l.kind===`organizationHome`){await e({params:{org_slug:l.organizationSlug},to:`/$org_slug/home`});return}if(l.kind===`invite`){await e({params:{invitationId:l.invitationId},to:`/invite/$invitationId`});return}if(l.kind===`inviteOnlyPendingAccess`){console.warn(`[auth] callback found no organizations or pending invitations in invite-only mode`),r&&c(D);return}console.warn(`[auth] callback found no organizations or pending invitations, onboarding redirect`),await e({to:`/onboarding/create-org`})}catch(t){console.error(`[auth] callback failed unexpectedly`,{error:t}),r&&await e({to:`/signin`})}}return i(),()=>{r=!1}},[u.session?.user.id,e,d,p,i,f,t]),(0,T.jsx)(`div`,{className:`flex min-h-screen items-center justify-center`,children:(0,T.jsx)(`div`,{className:`max-w-md text-center text-muted-foreground`,children:s})})}var k=O;export{k as component};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{n as r}from"./useRouterState-DpT8luFk.js";import{a as i,o as a}from"./api-base-url-DIb6qukm.js";import{t as o}from"./auth-client-DF1BsKzX.js";import{t as s}from"./queryOptions-BHw87wTZ.js";import{t as c}from"./query-timing-LGzitMXx.js";import{f as l,h as u,r as d,u as f}from"./schemas-n4sxh6jF.js";import{t as p}from"./organization-query-keys-DwLucsD_.js";import{D as m,E as h,J as g}from"./index-crEoj0do.js";import{t as _}from"./auth-bootstrap-query-DlVmn2Fg.js";var v=e(t(),1);function y(e){let t=e.organizations.at(0);if(t)return{kind:`organizationHome`,organizationSlug:m(t)};let n=b(e.pendingInvitations);return n?{kind:`invite`,invitationId:n.id}:e.signupMode===`invite-only`?{kind:`inviteOnlyPendingAccess`}:{kind:`onboardingCreateOrg`}}function b(e){return e.length===0?null:[...e].sort(x)[0]??null}function x(e,t){let n=Date.parse(t.createdAt)-Date.parse(e.createdAt);return n===0?e.id.localeCompare(t.id):n}var S=d(f({createdAt:u(),email:l(),expiresAt:u(),id:l(),inviterId:l(),organizationId:l(),organizationName:l(),role:l().nullable().optional(),status:l(),teamId:l().nullable().optional()}));async function C(){let e=await o.listUserInvitations();if(!e.data)throw Error(`Failed to fetch pending invitations`);return S.parse(e.data)}function w(e){return s({queryFn:C,queryKey:p.pendingInvitations(e),staleTime:c})}var T=n(),E=i(`/auth/callback`),D=`Your account is signed in, but you do not have access to an organization yet. Ask an admin to send or resend your invitation link.`;function O(){let e=a(),t=r(),n=(0,v.useRef)(!1),[i,o]=(0,v.useState)(0),[s,c]=(0,v.useState)(`Setting up your account...`),{redirect:l}=E.useSearch(),{auth:u,queryClient:d,refetchSession:f}=E.useRouteContext(),p=g(l);return(0,v.useEffect)(()=>{let r=!0;async function i(){try{let i=u;if(!i.session?.user){if(!n.current){console.warn(`[auth] callback missing session, retrying refetch`),n.current=!0,await f(),r&&o(e=>e+1);return}if(!i.session?.user){console.error(`[auth] callback failed: session is still missing`),r&&await e({to:`/signin`});return}}if(await t.invalidate({sync:!0}),r&&c(`Setting up your account...`),!r)return;if(p&&p.path!==`/auth/callback`){await e({to:p.path});return}let a=i.session?.user.id;if(!a){console.error(`[auth] callback failed: authenticated user is missing`),r&&await e({to:`/signin`});return}let s=await d.fetchQuery({...h(a),staleTime:0}).catch(e=>(console.error(`[auth] callback failed to load organizations`,{error:e}),null));if(!s){r&&await e({to:`/signin`});return}if(!r)return;let l=y({organizations:s,pendingInvitations:s.length===0?await d.fetchQuery({...w(a),staleTime:0}).catch(e=>(console.error(`[auth] callback failed to load pending invitations`,{error:e}),[])):[],signupMode:(await d.fetchQuery({..._(),staleTime:0}).catch(e=>(console.error(`[auth] callback failed to load bootstrap state`,{error:e}),null)))?.signupMode});if(l.kind===`organizationHome`){await e({params:{org_slug:l.organizationSlug},to:`/$org_slug/home`});return}if(l.kind===`invite`){await e({params:{invitationId:l.invitationId},to:`/invite/$invitationId`});return}if(l.kind===`inviteOnlyPendingAccess`){console.warn(`[auth] callback found no organizations or pending invitations in invite-only mode`),r&&c(D);return}console.warn(`[auth] callback found no organizations or pending invitations, onboarding redirect`),await e({to:`/onboarding/create-org`})}catch(t){console.error(`[auth] callback failed unexpectedly`,{error:t}),r&&await e({to:`/signin`})}}return i(),()=>{r=!1}},[u.session?.user.id,e,d,p,i,f,t]),(0,T.jsx)(`div`,{className:`flex min-h-screen items-center justify-center`,children:(0,T.jsx)(`div`,{className:`max-w-md text-center text-muted-foreground`,children:s})})}var k=O;export{k as component};