@onequery/cli 0.1.50-alpha.1-win32-x64 → 0.1.50-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.
- package/package.json +3 -3
- package/vendor/{x86_64-pc-windows-msvc/onequery/onequery.exe → aarch64-apple-darwin/onequery/onequery} +0 -0
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/_authenticated-CGmAYz8Z.js → aarch64-apple-darwin/runtime/dashboard/assets/_authenticated-DJ_4zmt8.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/_org_slug-f6xppY7b.js → aarch64-apple-darwin/runtime/dashboard/assets/_org_slug-COtToeSC.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/audit-LQg_2-5v.js → aarch64-apple-darwin/runtime/dashboard/assets/audit-L0p_sbmf.js} +1 -1
- package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/budget-CpNnCDvc.js +1 -0
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/callback-wu4tr9JD.js → aarch64-apple-darwin/runtime/dashboard/assets/callback-DX7qJ2z3.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/connect-database-3pvIA31m.js → aarch64-apple-darwin/runtime/dashboard/assets/connect-database-veJddN9s.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/create-org-DiO7zB9V.js → aarch64-apple-darwin/runtime/dashboard/assets/create-org-DcFcmY-G.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/data-source-connection-form-C0JyH5J3.js → aarch64-apple-darwin/runtime/dashboard/assets/data-source-connection-form-DGIyt0OF.js} +2 -2
- package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/device-GZIoJtbw.js +1 -0
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/dropdown-menu-CLot8VIw.js → aarch64-apple-darwin/runtime/dashboard/assets/dropdown-menu-1lFANFIg.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/home-CZKXq9HA.js → aarch64-apple-darwin/runtime/dashboard/assets/home-BL1SSXlH.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/index-C_q-gtGv.js → aarch64-apple-darwin/runtime/dashboard/assets/index-BZrWlEXZ.js} +2 -2
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/integrations-B2b7o-ye.js → aarch64-apple-darwin/runtime/dashboard/assets/integrations-B4PT4c-V.js} +1 -1
- package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/invite._invitationId-D0BbiY9f.js +1 -0
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/routes-BTttPHZm.js → aarch64-apple-darwin/runtime/dashboard/assets/routes-jr9opiO_.js} +1 -1
- package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/signin-VOTh7Maw.js +1 -0
- package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/team-CWGusGkh.js +1 -0
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/theme-toggle-CcB6O_vF.js → aarch64-apple-darwin/runtime/dashboard/assets/theme-toggle-CdJo4s34.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/use-optimistic-mutation-BCZ8tApt.js → aarch64-apple-darwin/runtime/dashboard/assets/use-optimistic-mutation-D88ezW6g.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/useBaseQuery-B3PCmH7w.js → aarch64-apple-darwin/runtime/dashboard/assets/useBaseQuery-C_843G5v.js} +1 -1
- package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/useQuery-jz7A3Y4u.js +1 -0
- package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/useSuspenseQuery-BXj42YYV.js +1 -0
- package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/xstate-react.esm--l_MSO73.js +1 -0
- package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/index.html +1 -1
- package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/server/onequery-server.mjs +328 -320
- package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/budget-jeO_g_0N.js +0 -1
- package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/device-DJhBvm-V.js +0 -1
- package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/invite._invitationId-Dt2OlNDo.js +0 -1
- package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/signin-DNF0ckUg.js +0 -1
- package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/team-BL56C5sF.js +0 -1
- package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/useQuery-Bj5cJCZc.js +0 -1
- package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/useSuspenseQuery-ZQGYM-g4.js +0 -1
- package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/xstate-react.esm-CfqAjJyu.js +0 -1
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/CompositeItem-CZdKsA45.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/CompositeList-C9xWKWEY.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/DialogTitle-DSjY6Xud.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconArrowRight-DsOD7mDl.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconCheck-Gc24xPT2.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconChevronDown-B-39MA7-.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconChevronRight-DD16tNHZ.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconCoins-C7Nn0L6R.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconDatabase-BLZDgpcN.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconHistory-k3NVXypq.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconLoader2-CZSIppar.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconPlus-Ie-KpLOF.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconX-Cg43mUxH.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/Separator-Di8cGnYl.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/alert-TnJXtO0T.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/api-base-url-DIb6qukm.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/api-client-F8Y7IuHn.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/api-paths-DcYkf-C_.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/app-routes-DM5pppqD.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/auth-bootstrap-query-KhD_VRw3.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/auth-client-Dj6z7Pcl.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/avatar-DoLsibq3.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/badge-D8XKsDus.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/card-CZCl7QNy.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/checkbox-BLYovhFU.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/compiler-runtime-DCc3R3Xn.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/createReactComponent-_L2mp4Ui.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/dist-Cg-lnuP8.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/empty-DjRo5ytz.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/format-date-B5v-Ga9z.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/getDisabledMountTransitionStyles-f3pOCbyk.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/getPseudoElementBounds-BpCtHFAC.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/index-ClbN-fUj.css +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/input-DSkIbIFK.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/jsx-runtime-DG_AJzB_.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/label-CUY3W2yp.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/link-Cgvqhh5w.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/matchContext-CDajBC0L.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/organization-permissions-PidGz2SY.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/organization-query-keys-Dl2dsKXD.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/query-timing-C8VVOl1e.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/queryOptions-LX_zDC40.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/removable-DwbP0VJV.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/schemas-K0ZhTj23.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/select-BSubTgC3.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/separator-CWjuJH0f.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/settings-B3gO4YZk.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/src-Cs2YIecp.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/table-mA0t_uVk.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/textarea-B57VG43g.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useBaseUiId-Cn1kR417.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useCompositeItem-DqawtL5i.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useControlled-C1S7R-1A.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useRender-DFMo54_d.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useRouterState-DpT8luFk.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useValueChanged-CH03vPJ5.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/utils-C8DGLIgm.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/zod-BgAmwIO1.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/favicon.ico +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/amplitude/step1_settings_sidebar.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/amplitude/step2_projects.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/amplitude/step3_project_keys.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/amplitude/step4_api_keys.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/bigquery/step1_service_accounts.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/bigquery/step2_bigquery_roles.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/bigquery/step3_add_key_menu.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/bigquery/step4_create_json_key.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/ga4/step1_service_accounts.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/ga4/step2_create_json_key.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/ga4/step3_add_user_viewer.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/ga4/step4_property_details.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/github-token-guide/step1_signin.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/github-token-guide/step2_new_fine_grained_token_sanitized.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/github-token-guide/step3_permissions_configured_sanitized.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/github-token-guide/step4_token_created_sanitized.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/mixpanel/step1_service_accounts.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/mixpanel/step2_create_service_account.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/mixpanel/step3_credentials.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/mixpanel/step4_project_settings.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/postgresql/step1_create_user.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/postgresql/step2_connection.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/posthog/step1_project_settings.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/posthog/step2_personal_api_keys.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/posthog/step3_create_key_modal.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/rds/step1_connect.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/rds/step2_create_user.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/rds/step3_grant.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/rds/step4_info.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/sentry/step1_personal_tokens.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/sentry/step2_create_token_permissions.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/sentry/step3_organization_slug.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/sentry/step4_project_slug.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/linear.svg +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/onequery.svg +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260327065242_curious_nightmare.sql +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260403103652_slippery_hellfire_club.sql +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260403112219_gigantic_namora.sql +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260420071232_previous_justin_hammer.sql +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260420093157_spooky_cassandra_nova.sql +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260420101631_even_ogun.sql +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260425110519_smart_amazoness.sql +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260428033542_rename_source_query_interface_missing.sql +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260327065242_snapshot.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260403103652_snapshot.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260403112219_snapshot.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260420071232_snapshot.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260420093157_snapshot.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260420101631_snapshot.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260425110519_snapshot.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260428033542_snapshot.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/_journal.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/initdb.wasm +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/pglite.data +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/pglite.wasm +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/sql-parser/sql_parser_wasm_bg.wasm +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i}from"./api-base-url-DIb6qukm.js";import{S as a,a as o,n as s,t as c,x as l,y as u}from"./createReactComponent-_L2mp4Ui.js";import{t as d}from"./utils-C8DGLIgm.js";import{c as f,o as p,s as m}from"./select-BSubTgC3.js";import{n as h,r as g,t as _}from"./checkbox-BLYovhFU.js";import{t as v}from"./IconLoader2-CZSIppar.js";import{t as y}from"./IconPlus-Ie-KpLOF.js";import{a as b,c as x,i as S,l as C,n as w,o as T,r as E,s as ee,u as D}from"./use-optimistic-mutation-BCZ8tApt.js";import{t as te}from"./useQuery-Bj5cJCZc.js";import{t as O}from"./useSuspenseQuery-ZQGYM-g4.js";import{t as k}from"./queryOptions-LX_zDC40.js";import{Ct as A,Et as j,ct as M,i as N}from"./getDisabledMountTransitionStyles-f3pOCbyk.js";import{t as ne}from"./useBaseUiId-Cn1kR417.js";import{t as P}from"./api-client-F8Y7IuHn.js";import{K as F,L as I,T as L,Y as R,_ as re,v as ie,y as ae,z as oe}from"./index-C_q-gtGv.js";import{t as se}from"./input-DSkIbIFK.js";import{d as z,n as B,r as ce,t as le}from"./dropdown-menu-CLot8VIw.js";import{t as ue}from"./format-date-B5v-Ga9z.js";import{n as V,r as H,t as U}from"./alert-TnJXtO0T.js";import{t as de}from"./badge-D8XKsDus.js";import{a as fe,n as pe,o as W,r as me,t as he}from"./card-CZCl7QNy.js";import{a as ge,i as _e,n as G,o as ve,r as ye,t as K}from"./data-source-connection-form-C0JyH5J3.js";var be=c(`outline`,`search`,`Search`,[[`path`,{d:`M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`,key:`svg-0`}],[`path`,{d:`M21 21l-6 -6`,key:`svg-1`}]]);function q(e){return e}var xe=r(),J=e(t(),1),Y=n();function X(e){let t=(0,xe.c)(13),[n,r]=(0,J.useState)(!1),i;t[0]===e?i=t[1]:(i=t=>{e.onSuccess?.(t),r(!1)},t[0]=e,t[1]=i);let a=i,o;t[2]===e.children?o=t[3]:(o=(0,Y.jsx)(C,{render:e.children}),t[2]=e.children,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsxs)(ee,{children:[(0,Y.jsx)(x,{children:`Add Data Source`}),(0,Y.jsx)(b,{children:`Connect a data source so OneQuery can query your workspace data.`})]}),t[4]=s):s=t[4];let c;t[5]!==a||t[6]!==e.initialProvider||t[7]!==e.organizationId?(c=(0,Y.jsxs)(S,{className:`sm:max-w-[720px] max-h-[85vh] overflow-y-auto overflow-x-hidden`,children:[s,(0,Y.jsx)(K,{organizationId:e.organizationId,onSuccess:a,className:`py-4`,initialProvider:e.initialProvider})]}),t[5]=a,t[6]=e.initialProvider,t[7]=e.organizationId,t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==o||t[11]!==c?(l=(0,Y.jsxs)(E,{open:n,onOpenChange:r,children:[o,c]}),t[9]=n,t[10]=o,t[11]=c,t[12]=l):l=t[12],l}var Z=180,Q=/\b(api[-_ ]?key|authorization|bearer|cookie|password|secret|token)\b|-----BEGIN/i;function Se(e,t){let n=t?.replaceAll(/\s+/g,` `).trim();if(n&&n!==e)return n.length>Z||Q.test(n)?`Review the data source settings and try again.`:n}function Ce(e){let t=Se(e.title,e.description);return I.error(e.title,{action:e.action,className:`max-w-[34rem]`,closeButton:!0,description:t,descriptionClassName:`whitespace-pre-wrap break-words`,duration:t?12e3:8e3,position:`top-center`,richColors:!0})}var we=P();async function Te(e,t){let n=await we.api[`data-sources`][`:id`][`github-repositories`].$get({param:{id:t},query:{organizationId:e}});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(L(e,`Failed to fetch GitHub repositories`))}return n.json()}function Ee(e,t){return k({queryFn:async()=>Te(e,t),queryKey:[`github-repositories`,t]})}async function De(e,t,n){let r=await we.api[`data-sources`][`:id`][`github-repositories`].$post({json:{repositories:n},param:{id:t},query:{organizationId:e}});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(L(e,`Failed to update GitHub repositories`))}return r.json()}function Oe({queryClient:e,organizationId:t,dataSourceId:n,onSuccess:r,onError:i}){let a=Ee(t,n);return q({mutationFn:async e=>De(t,n,e.repositories),mutationKey:[`github-repositories`,n,`update`],onError:i,onSuccess:(t,n)=>{e.setQueryData(a.queryKey,e=>e&&{...e,selected:t.repositories}),r?.(t,n)}})}var ke=J.createContext(void 0);function Ae(){let e=J.useContext(ke);if(e===void 0)throw Error(u(53));return e}var je=function(e){return e.scrollAreaCornerHeight=`--scroll-area-corner-height`,e.scrollAreaCornerWidth=`--scroll-area-corner-width`,e}({});function $(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=n===`x`?`Inline`:`Block`;return n===`x`&&t===`margin`?parseFloat(r[`${t}InlineStart`])*2:parseFloat(r[`${t}${i}Start`])+parseFloat(r[`${t}${i}End`])}var Me=function(e){return e.orientation=`data-orientation`,e.hovering=`data-hovering`,e.scrolling=`data-scrolling`,e.hasOverflowX=`data-has-overflow-x`,e.hasOverflowY=`data-has-overflow-y`,e.overflowXStart=`data-overflow-x-start`,e.overflowXEnd=`data-overflow-x-end`,e.overflowYStart=`data-overflow-y-start`,e.overflowYEnd=`data-overflow-y-end`,e}({}),Ne=function(e){return e.hasOverflowX=`data-has-overflow-x`,e.hasOverflowY=`data-has-overflow-y`,e.overflowXStart=`data-overflow-x-start`,e.overflowXEnd=`data-overflow-x-end`,e.overflowYStart=`data-overflow-y-start`,e.overflowYEnd=`data-overflow-y-end`,e}({}),Pe={hasOverflowX:e=>e?{[Ne.hasOverflowX]:``}:null,hasOverflowY:e=>e?{[Ne.hasOverflowY]:``}:null,overflowXStart:e=>e?{[Ne.overflowXStart]:``}:null,overflowXEnd:e=>e?{[Ne.overflowXEnd]:``}:null,overflowYStart:e=>e?{[Ne.overflowYStart]:``}:null,overflowYEnd:e=>e?{[Ne.overflowYEnd]:``}:null,cornerHidden:()=>null},Fe={x:0,y:0},Ie={width:0,height:0},Le={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Re={x:!1,y:!1,corner:!1},ze=J.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,...s}=e,c=Be(i),l=ne(),u=j(),d=j(),{nonce:m,disableStyleElements:h}=p(),[g,_]=J.useState(!1),[v,y]=J.useState(!1),[b,x]=J.useState(!1),[S,C]=J.useState(!1),[w,T]=J.useState(Ie),[E,ee]=J.useState(Ie),[D,te]=J.useState(Le),[O,k]=J.useState(Re),A=J.useRef(null),N=J.useRef(null),P=J.useRef(null),F=J.useRef(null),I=J.useRef(null),L=J.useRef(null),R=J.useRef(null),re=J.useRef(!1),ie=J.useRef(0),ae=J.useRef(0),oe=J.useRef(0),se=J.useRef(0),z=J.useRef(`vertical`),B=J.useRef(Fe),ce=a(e=>{let t=e.x-B.current.x,n=e.y-B.current.y;B.current=e,n!==0&&(x(!0),u.start(500,()=>{x(!1)})),t!==0&&(y(!0),d.start(500,()=>{y(!1)}))}),le=a(e=>{e.button===0&&(re.current=!0,ie.current=e.clientY,ae.current=e.clientX,z.current=e.currentTarget.getAttribute(Me.orientation),N.current&&(oe.current=N.current.scrollTop,se.current=N.current.scrollLeft),I.current&&z.current===`vertical`&&I.current.setPointerCapture(e.pointerId),L.current&&z.current===`horizontal`&&L.current.setPointerCapture(e.pointerId))}),ue=a(e=>{if(!re.current)return;let t=e.clientY-ie.current,n=e.clientX-ae.current;if(N.current){let r=N.current.scrollHeight,i=N.current.clientHeight,a=N.current.scrollWidth,o=N.current.clientWidth;if(I.current&&P.current&&z.current===`vertical`){let n=$(P.current,`padding`,`y`),a=$(I.current,`margin`,`y`),o=I.current.offsetHeight,s=t/(P.current.offsetHeight-o-n-a);N.current.scrollTop=oe.current+s*(r-i),e.preventDefault(),x(!0),u.start(500,()=>{x(!1)})}if(L.current&&F.current&&z.current===`horizontal`){let t=$(F.current,`padding`,`x`),r=$(L.current,`margin`,`x`),i=L.current.offsetWidth,s=n/(F.current.offsetWidth-i-t-r);N.current.scrollLeft=se.current+s*(a-o),e.preventDefault(),y(!0),d.start(500,()=>{y(!1)})}}}),V=a(e=>{re.current=!1,I.current&&z.current===`vertical`&&I.current.releasePointerCapture(e.pointerId),L.current&&z.current===`horizontal`&&L.current.releasePointerCapture(e.pointerId)});function H(e){C(e.pointerType===`touch`)}function U(e){H(e),e.pointerType!==`touch`&&_(M(A.current,e.target))}let de=J.useMemo(()=>({hasOverflowX:!O.x,hasOverflowY:!O.y,overflowXStart:D.xStart,overflowXEnd:D.xEnd,overflowYStart:D.yStart,overflowYEnd:D.yEnd,cornerHidden:O.corner}),[O.x,O.y,O.corner,D]),fe={role:`presentation`,onPointerEnter:U,onPointerMove:U,onPointerDown:H,onPointerLeave(){_(!1)},style:{position:`relative`,[je.scrollAreaCornerHeight]:`${w.height}px`,[je.scrollAreaCornerWidth]:`${w.width}px`}},pe=o(`div`,e,{state:de,ref:[t,A],props:[fe,s],stateAttributesMapping:Pe}),W=J.useMemo(()=>({handlePointerDown:le,handlePointerMove:ue,handlePointerUp:V,handleScroll:ce,cornerSize:w,setCornerSize:T,thumbSize:E,setThumbSize:ee,touchModality:S,cornerRef:R,scrollingX:v,setScrollingX:y,scrollingY:b,setScrollingY:x,hovering:g,setHovering:_,viewportRef:N,rootRef:A,scrollbarYRef:P,scrollbarXRef:F,thumbYRef:I,thumbXRef:L,rootId:l,hiddenState:O,setHiddenState:k,overflowEdges:D,setOverflowEdges:te,viewportState:de,overflowEdgeThreshold:c}),[le,ue,V,ce,w,E,S,v,y,b,x,g,_,l,O,D,de,c]);return(0,Y.jsxs)(ke.Provider,{value:W,children:[!h&&f.getElement(m),pe]})});function Be(e){if(typeof e==`number`){let t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}var Ve=J.createContext(void 0);function He(e,t){if(typeof IntersectionObserver>`u`)return()=>{};let n=new IntersectionObserver(e=>{e.forEach(e=>{e.intersectionRatio>0&&(t(),n.disconnect())})});return n.observe(e),()=>{n.disconnect()}}var Ue=function(e){return e.scrollAreaOverflowXStart=`--scroll-area-overflow-x-start`,e.scrollAreaOverflowXEnd=`--scroll-area-overflow-x-end`,e.scrollAreaOverflowYStart=`--scroll-area-overflow-y-start`,e.scrollAreaOverflowYEnd=`--scroll-area-overflow-y-end`,e}({}),We=!1;function Ge(){We||A||(typeof CSS<`u`&&`registerProperty`in CSS&&[Ue.scrollAreaOverflowXStart,Ue.scrollAreaOverflowXEnd,Ue.scrollAreaOverflowYStart,Ue.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),We=!0)}var Ke=J.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{viewportRef:s,scrollbarYRef:c,scrollbarXRef:u,thumbYRef:d,thumbXRef:p,cornerRef:h,cornerSize:g,setCornerSize:_,setThumbSize:v,rootId:y,setHiddenState:b,hiddenState:x,handleScroll:S,setHovering:C,setOverflowEdges:w,overflowEdges:T,overflowEdgeThreshold:E}=Ae(),ee=N(),D=J.useRef(!0),te=j(),O=j(),k=a(()=>{let e=s.current,t=c.current,n=u.current,r=d.current,i=p.current,a=h.current;if(!e)return;let o=e.scrollHeight,l=e.scrollWidth,f=e.clientHeight,y=e.clientWidth,x=e.scrollTop,S=e.scrollLeft;if(o===0||l===0)return;let C=f>=o,T=y>=l,D=y/l,te=f/o,O=Math.max(0,l-y),k=Math.max(0,o-f),A=0,j=0;T||(A=m(ee===`rtl`?-S:S,0,O),j=O-A);let M=C?0:m(x,0,k),N=C?0:k-M,ne=T?0:y,P=C?0:f,F=0,I=0;!T&&!C&&(F=t?.offsetWidth||0,I=n?.offsetHeight||0);let L=g.width===0&&g.height===0,R=L?F:0,re=L?I:0,ie=$(n,`padding`,`x`),ae=$(t,`padding`,`y`),oe=$(i,`margin`,`x`),se=$(r,`margin`,`y`),z=ne-ie-oe,B=P-ae-se,ce=n?Math.min(n.offsetWidth-R,z):z,le=t?Math.min(t.offsetHeight-re,B):B,ue=Math.max(16,ce*D),V=Math.max(16,le*te);if(v(e=>e.height===V&&e.width===ue?e:{width:ue,height:V}),t&&r){let e=t.offsetHeight-V-ae-se,n=o-f,i=n===0?0:x/n,a=Math.min(e,Math.max(0,i*e));r.style.transform=`translate3d(0,${a}px,0)`}if(n&&i){let e=n.offsetWidth-ue-ie-oe,t=l-y,r=t===0?0:S/t,a=ee===`rtl`?m(r*e,-e,0):m(r*e,0,e);i.style.transform=`translate3d(${a}px,0,0)`}let H=m(A,0,O),U=m(j,0,O),de=m(M,0,k),fe=m(N,0,k),pe=[[Ue.scrollAreaOverflowXStart,H],[Ue.scrollAreaOverflowXEnd,U],[Ue.scrollAreaOverflowYStart,de],[Ue.scrollAreaOverflowYEnd,fe]];for(let[t,n]of pe)e.style.setProperty(t,`${n}px`);a&&(T||C?_({width:0,height:0}):!T&&!C&&_({width:F,height:I})),b(e=>{let t=C||T;return e.y===C&&e.x===T&&e.corner===t?e:{y:C,x:T,corner:t}});let W={xStart:!T&&H>E.xStart,xEnd:!T&&U>E.xEnd,yStart:!C&&de>E.yStart,yEnd:!C&&fe>E.yEnd};w(e=>e.xStart===W.xStart&&e.xEnd===W.xEnd&&e.yStart===W.yStart&&e.yEnd===W.yEnd?e:W)});l(()=>{if(!s.current)return;Ge();let e=!1;return He(s.current,()=>{if(!e){e=!0;return}k()})},[k,s]),l(()=>{queueMicrotask(k)},[k,x,ee]),l(()=>{s.current?.matches(`:hover`)&&C(!0)},[s,C]),J.useEffect(()=>{let e=s.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;return}k()});return n.observe(e),O.start(0,()=>{let t=e.getAnimations({subtree:!0});t.length!==0&&Promise.all(t.map(e=>e.finished)).then(k).catch(()=>{})}),()=>{n.disconnect(),O.clear()}},[k,s,O]);function A(){D.current=!1}let M={role:`presentation`,...y&&{"data-id":`${y}-viewport`},...(!x.x||!x.y)&&{tabIndex:0},className:f.className,style:{overflow:`scroll`},onScroll(){s.current&&(k(),D.current||S({x:s.current.scrollLeft,y:s.current.scrollTop}),te.start(100,()=>{D.current=!0}))},onWheel:A,onTouchMove:A,onPointerMove:A,onPointerEnter:A,onKeyDown:A},ne=J.useMemo(()=>({hasOverflowX:!x.x,hasOverflowY:!x.y,overflowXStart:T.xStart,overflowXEnd:T.xEnd,overflowYStart:T.yStart,overflowYEnd:T.yEnd,cornerHidden:x.corner}),[x.x,x.y,x.corner,T]),P=o(`div`,e,{ref:[t,s],state:ne,props:[M,i],stateAttributesMapping:Pe}),F=J.useMemo(()=>({computeThumbPosition:k}),[k]);return(0,Y.jsx)(Ve.Provider,{value:F,children:P})}),qe=J.createContext(void 0);function Je(){let e=J.useContext(qe);if(e===void 0)throw Error(u(54));return e}var Ye=function(e){return e.scrollAreaThumbHeight=`--scroll-area-thumb-height`,e.scrollAreaThumbWidth=`--scroll-area-thumb-width`,e}({}),Xe=J.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,overflowEdges:f,scrollbarYRef:p,scrollbarXRef:m,viewportRef:h,thumbYRef:g,thumbXRef:_,handlePointerDown:v,handlePointerUp:y,rootId:b,thumbSize:x}=Ae(),S=J.useMemo(()=>({hovering:c,scrolling:{horizontal:l,vertical:u}[i],orientation:i,hasOverflowX:!d.x,hasOverflowY:!d.y,overflowXStart:f.xStart,overflowXEnd:f.xEnd,overflowYStart:f.yStart,overflowYEnd:f.yEnd,cornerHidden:d.corner}),[c,l,u,i,d,f]),C=N();J.useEffect(()=>{let e=h.current,t=i===`vertical`?p.current:m.current;if(!t)return;function n(n){if(!(!e||!t||n.ctrlKey)){if(n.preventDefault(),i===`vertical`){if(e.scrollTop===0&&n.deltaY<0)return}else if(e.scrollLeft===0&&n.deltaX<0)return;if(i===`vertical`){if(e.scrollTop===e.scrollHeight-e.clientHeight&&n.deltaY>0)return}else if(e.scrollLeft===e.scrollWidth-e.clientWidth&&n.deltaX>0)return;i===`vertical`?e.scrollTop+=n.deltaY:e.scrollLeft+=n.deltaX}}return t.addEventListener(`wheel`,n,{passive:!1}),()=>{t.removeEventListener(`wheel`,n)}},[i,m,p,h]);let w={...b&&{"data-id":`${b}-scrollbar`},onPointerDown(e){if(e.button===0&&e.currentTarget===e.target&&h.current){if(g.current&&p.current&&i===`vertical`){let t=$(g.current,`margin`,`y`),n=$(p.current,`padding`,`y`),r=g.current.offsetHeight,i=p.current.getBoundingClientRect(),a=e.clientY-i.top-r/2-n+t/2,o=h.current.scrollHeight,s=h.current.clientHeight,c=a/(p.current.offsetHeight-r-n-t)*(o-s);h.current.scrollTop=c}if(_.current&&m.current&&i===`horizontal`){let t=$(_.current,`margin`,`x`),n=$(m.current,`padding`,`x`),r=_.current.offsetWidth,i=m.current.getBoundingClientRect(),a=e.clientX-i.left-r/2-n+t/2,o=h.current.scrollWidth,s=h.current.clientWidth,c=a/(m.current.offsetWidth-r-n-t),l;C===`rtl`?(l=(1-c)*(o-s),h.current.scrollLeft<=0&&(l=-l)):l=c*(o-s),h.current.scrollLeft=l}v(e)}},onPointerUp:y,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,...i===`vertical`&&{top:0,bottom:`var(${je.scrollAreaCornerHeight})`,insetInlineEnd:0,[Ye.scrollAreaThumbHeight]:`${x.height}px`},...i===`horizontal`&&{insetInlineStart:0,insetInlineEnd:`var(${je.scrollAreaCornerWidth})`,bottom:0,[Ye.scrollAreaThumbWidth]:`${x.width}px`}}},T=o(`div`,e,{ref:[t,i===`vertical`?p:m],state:S,props:[w,s],stateAttributesMapping:Pe}),E=J.useMemo(()=>({orientation:i}),[i]),ee=i===`vertical`?d.y:d.x;return a||!ee?(0,Y.jsx)(qe.Provider,{value:E,children:T}):null}),Ze=J.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{thumbYRef:a,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,setScrollingX:d,setScrollingY:f}=Ae(),{orientation:p}=Je(),m=J.useMemo(()=>({orientation:p}),[p]);return o(`div`,e,{ref:[t,p===`vertical`?a:s],state:m,props:[{onPointerDown:c,onPointerMove:l,onPointerUp(e){p===`vertical`&&f(!1),p===`horizontal`&&d(!1),u(e)},style:{...p===`vertical`&&{height:`var(${Ye.scrollAreaThumbHeight})`},...p===`horizontal`&&{width:`var(${Ye.scrollAreaThumbWidth})`}}},i]})}),Qe=J.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{cornerRef:a,cornerSize:s,hiddenState:c}=Ae(),l=o(`div`,e,{ref:[t,a],props:[{style:{position:`absolute`,bottom:0,insetInlineEnd:0,width:s.width,height:s.height}},i]});return c.corner?null:l});function $e(e){let t=(0,xe.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=d(`relative`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=(0,Y.jsx)(Ke,{"data-slot":`scroll-area-viewport`,className:`focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1`,children:n}),t[6]=n,t[7]=o);let s,c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsx)(et,{}),c=(0,Y.jsx)(Qe,{}),t[8]=s,t[9]=c):(s=t[8],c=t[9]);let l;return t[10]!==i||t[11]!==a||t[12]!==o?(l=(0,Y.jsxs)(ze,{"data-slot":`scroll-area`,className:a,...i,children:[o,s,c]}),t[10]=i,t[11]=a,t[12]=o,t[13]=l):l=t[13],l}function et(e){let t=(0,xe.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]===n?o=t[5]:(o=d(`data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent flex touch-none p-px transition-colors select-none`,n),t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsx)(Ze,{"data-slot":`scroll-area-thumb`,className:`rounded-full bg-border relative flex-1`}),t[6]=s):s=t[6];let c;return t[7]!==a||t[8]!==r||t[9]!==o?(c=(0,Y.jsx)(Xe,{"data-slot":`scroll-area-scrollbar`,"data-orientation":a,orientation:a,className:o,...r,children:s}),t[7]=a,t[8]=r,t[9]=o,t[10]=c):c=t[10],c}function tt(e,t){if(e.length!==t.length)return!0;let n=new Set(e);return t.some(e=>!n.has(e))}function nt(e){let t=(0,xe.c)(94),[n,r]=(0,J.useState)(``),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,J.useState)(i),c=(0,J.useRef)(!1),l=oe(),u;t[1]!==e.dataSourceId||t[2]!==e.organizationId?(u=Ee(e.organizationId,e.dataSourceId),t[1]=e.dataSourceId,t[2]=e.organizationId,t[3]=u):u=t[3];let d;t[4]!==e.open||t[5]!==u?(d={...u,enabled:e.open},t[4]=e.open,t[5]=u,t[6]=d):d=t[6];let f=te(d),p;t[7]===f.data?.repositories?p=t[8]:(p=f.data?.repositories??[],t[7]=f.data?.repositories,t[8]=p);let m=p,h;t[9]===f.data?.selected?h=t[10]:(h=f.data?.selected??[],t[9]=f.data?.selected,t[10]=h);let g=h,y,C;t[11]!==g||t[12]!==e.open||t[13]!==f.data?(y=()=>{if(!e.open){c.current=!1,r(``);return}f.data&&(c.current||=(o(g),!0))},C=[g,e.open,f.data],t[11]=g,t[12]=e.open,t[13]=f.data,t[14]=y,t[15]=C):(y=t[14],C=t[15]),(0,J.useEffect)(y,C);let w;if(t[16]!==m||t[17]!==n){bb0:{let e=n.trim().toLowerCase();if(!e){w=m;break bb0}w=m.filter(t=>{let n=t.owner.toLowerCase(),r=t.name.toLowerCase(),i=t.fullName.toLowerCase();return n.includes(e)||r.includes(e)||i.includes(e)})}t[16]=m,t[17]=n,t[18]=w}else w=t[18];let O=w,k;t[19]!==g||t[20]!==a?(k=tt(a,g),t[19]=g,t[20]=a,t[21]=k):k=t[21];let A=k,j;t[22]===e?j=t[23]:(j=()=>{I.success(`GitHub repositories updated`),e.onOpenChange(!1)},t[22]=e,t[23]=j);let M;t[24]!==e.dataSourceId||t[25]!==e.organizationId||t[26]!==l||t[27]!==j?(M=Oe({dataSourceId:e.dataSourceId,onError:it,onSuccess:j,organizationId:e.organizationId,queryClient:l}),t[24]=e.dataSourceId,t[25]=e.organizationId,t[26]=l,t[27]=j,t[28]=M):M=t[28];let N=D(M),ne;t[29]===a?ne=t[30]:(ne=new Set(a),t[29]=a,t[30]=ne);let P=ne,F;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){o(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},t[31]=F):F=t[31];let L=F,R;t[32]===O?R=t[33]:(R=function(){let e=O.map(rt);o(t=>[...new Set([...t,...e])])},t[32]=O,t[33]=R);let re=R,ie;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){o([])},t[34]=ie):ie=t[34];let ae=ie,z=f.isLoading,B=f.isError,ce=A&&!N.isPending,le;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Y.jsxs)(ee,{children:[(0,Y.jsx)(x,{children:`Select GitHub Repositories`}),(0,Y.jsx)(b,{children:`Choose repositories to use for this data source. We only read from the repositories your saved token can access and that you select here.`})]}),t[35]=le):le=t[35];let ue;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Y.jsx)(be,{size:16,className:`absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`}),t[36]=ue):ue=t[36];let V;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(V=e=>r(e.target.value),t[37]=V):V=t[37];let H;t[38]===n?H=t[39]:(H=(0,Y.jsxs)(`div`,{className:`relative flex-1`,children:[ue,(0,Y.jsx)(se,{value:n,onChange:V,placeholder:`Search repositories...`,className:`pl-9`})]}),t[38]=n,t[39]=H);let U=O.length===0,fe;t[40]!==re||t[41]!==U?(fe=(0,Y.jsx)(s,{variant:`outline`,size:`sm`,onClick:re,disabled:U,children:`Select visible`}),t[40]=re,t[41]=U,t[42]=fe):fe=t[42];let pe=a.length===0,W;t[43]===pe?W=t[44]:(W=(0,Y.jsx)(s,{variant:`ghost`,size:`sm`,onClick:ae,disabled:pe,children:`Clear`}),t[43]=pe,t[44]=W);let me;t[45]!==H||t[46]!==fe||t[47]!==W?(me=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[H,fe,W]}),t[45]=H,t[46]=fe,t[47]=W,t[48]=me):me=t[48];let he=m.length>0?` • ${m.length} available`:``,ge;t[49]!==a.length||t[50]!==he?(ge=(0,Y.jsxs)(`span`,{children:[a.length,` selected`,he]}),t[49]=a.length,t[50]=he,t[51]=ge):ge=t[51];let _e;t[52]===A?_e=t[53]:(_e=A?(0,Y.jsx)(de,{variant:`outline`,children:`Unsaved`}):null,t[52]=A,t[53]=_e);let G;t[54]!==ge||t[55]!==_e?(G=(0,Y.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[ge,_e]}),t[54]=ge,t[55]=_e,t[56]=G):G=t[56];let ve;t[57]===z?ve=t[58]:(ve=z?(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-12 text-muted-foreground`,children:(0,Y.jsx)(v,{size:24,className:`animate-spin`})}):null,t[57]=z,t[58]=ve);let ye;t[59]===B?ye=t[60]:(ye=B?(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:`Unable to load repositories. Please try again.`}):null,t[59]=B,t[60]=ye);let K;t[61]!==O||t[62]!==B||t[63]!==z||t[64]!==P?(K=!z&&!B?(0,Y.jsx)($e,{className:`h-[320px] rounded-md border`,children:(0,Y.jsxs)(`div`,{className:`p-2 space-y-1`,children:[O.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground px-3 py-6 text-center`,children:`No repositories found.`}):null,O.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:`w-full flex items-center gap-3 rounded-md px-3 py-2 hover:bg-accent transition-colors text-left`,onClick:t=>{let n=t.target;n instanceof HTMLElement&&(n.closest(`[data-slot="checkbox"]`)||L(e.fullName))},children:[(0,Y.jsx)(_,{checked:P.has(e.fullName),onCheckedChange:()=>L(e.fullName)}),(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:e.fullName}),e.private?(0,Y.jsx)(de,{variant:`secondary`,children:`Private`}):null]}),(0,Y.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Owner: `,e.owner]})]})]},e.id))]})}):null,t[61]=O,t[62]=B,t[63]=z,t[64]=P,t[65]=K):K=t[65];let q;t[66]!==me||t[67]!==G||t[68]!==ve||t[69]!==ye||t[70]!==K?(q=(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[me,G,ve,ye,K]}),t[66]=me,t[67]=G,t[68]=ve,t[69]=ye,t[70]=K,t[71]=q):q=t[71];let X;t[72]===e?X=t[73]:(X=()=>e.onOpenChange(!1),t[72]=e,t[73]=X);let Z;t[74]!==X||t[75]!==N.isPending?(Z=(0,Y.jsx)(s,{variant:`outline`,onClick:X,disabled:N.isPending,children:`Cancel`}),t[74]=X,t[75]=N.isPending,t[76]=Z):Z=t[76];let Q;t[77]!==a||t[78]!==N?(Q=()=>N.mutate({repositories:a}),t[77]=a,t[78]=N,t[79]=Q):Q=t[79];let Se=!ce,Ce=N.isPending?`Saving...`:`Save`,we;t[80]!==Q||t[81]!==Se||t[82]!==Ce?(we=(0,Y.jsx)(s,{onClick:Q,disabled:Se,children:Ce}),t[80]=Q,t[81]=Se,t[82]=Ce,t[83]=we):we=t[83];let Te;t[84]!==Z||t[85]!==we?(Te=(0,Y.jsxs)(T,{children:[Z,we]}),t[84]=Z,t[85]=we,t[86]=Te):Te=t[86];let De;t[87]!==q||t[88]!==Te?(De=(0,Y.jsxs)(S,{className:`sm:max-w-[680px]`,children:[le,q,Te]}),t[87]=q,t[88]=Te,t[89]=De):De=t[89];let ke;return t[90]!==e.onOpenChange||t[91]!==e.open||t[92]!==De?(ke=(0,Y.jsx)(E,{open:e.open,onOpenChange:e.onOpenChange,children:De}),t[90]=e.onOpenChange,t[91]=e.open,t[92]=De,t[93]=ke):ke=t[93],ke}function rt(e){return e.fullName}function it(e){Ce({title:`Failed to update GitHub repositories`,description:e.message})}function at(e){switch(e){case`active`:return`default`;case`error`:return`destructive`;case`disconnected`:return`secondary`;default:return`outline`}}function ot(e){let t=(0,xe.c)(4);if(!e.errorMessage)return null;let n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(R,{className:`size-4`}),r=(0,Y.jsx)(H,{children:`Connection needs attention`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e.errorMessage?i=t[3]:(i=(0,Y.jsxs)(U,{variant:`destructive`,className:`mt-3 border-destructive/30 bg-destructive/5`,children:[n,r,(0,Y.jsx)(V,{className:`max-h-32 overflow-y-auto whitespace-pre-wrap break-words pr-1`,children:e.errorMessage})]}),t[2]=e.errorMessage,t[3]=i),i}function st(e){let t=(0,xe.c)(81),{dataSource:n,organizationId:r,openGitHubRepositories:i}=e,a;t[0]===r?a=t[1]:(a=re(r),t[0]=r,t[1]=a);let o=a.queryKey,[c,l]=(0,J.useState)(!1),u=(0,J.useRef)(!1),d,f;t[2]!==n.provider||t[3]!==i?(d=()=>{u.current||i&&n.provider===`github`&&(l(!0),u.current=!0)},f=[n.provider,i],t[2]=n.provider,t[3]=i,t[4]=d,t[5]=f):(d=t[4],f=t[5]),(0,J.useEffect)(d,f);let p;t[6]!==n.id||t[7]!==r?(p=async()=>ae(n.id,r),t[6]=n.id,t[7]=r,t[8]=p):p=t[8];let m;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=[`data-sources`],t[9]=m):m=t[9];let _;t[10]===p?_=t[11]:(_={mutationFn:p,mutationKey:m,onError:lt,onSuccess:ct},t[10]=p,t[11]=_);let v=D(_),y;t[12]!==n.id||t[13]!==r?(y=async()=>ie(n.id,r),t[12]=n.id,t[13]=r,t[14]=y):y=t[14];let b;t[15]!==n.id||t[16]!==o||t[17]!==y?(b={errorMessage:`Failed to delete data source`,itemId:n.id,mutationFn:y,queryKey:o,successMessage:`Data source deleted`},t[15]=n.id,t[16]=o,t[17]=y,t[18]=b):b=t[18];let x=w(b),S;t[19]===n.provider?S=t[20]:(S=ve(n.provider),t[19]=n.provider,t[20]=S);let C=S,T;t[21]===n.provider?T=t[22]:(T=_e(n.provider),t[21]=n.provider,t[22]=T);let E=T,ee=E?`Test Connection`:`Test Connection (Unsupported)`,te;t[23]===n.name?te=t[24]:(te=(0,Y.jsx)(W,{className:`text-lg`,children:n.name}),t[23]=n.name,t[24]=te);let O;t[25]===C?O=t[26]:(O=(0,Y.jsx)(C,{className:`h-4.5 w-4.5`}),t[25]=C,t[26]=O);let k;t[27]===n.provider?k=t[28]:(k=ye(n.provider),t[27]=n.provider,t[28]=k);let A;t[29]!==O||t[30]!==k?(A=(0,Y.jsxs)(me,{className:`flex items-center gap-1.5 mt-0.5`,children:[O,k]}),t[29]=O,t[30]=k,t[31]=A):A=t[31];let j;t[32]!==te||t[33]!==A?(j=(0,Y.jsxs)(`div`,{children:[te,A]}),t[32]=te,t[33]=A,t[34]=j):j=t[34];let M;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Y.jsx)(z,{children:(0,Y.jsx)(s,{variant:`ghost`,size:`icon-sm`,children:(0,Y.jsx)(g,{size:16,stroke:2})})}),t[35]=M):M=t[35];let N;t[36]===v?N=t[37]:(N=()=>v.mutate(),t[36]=v,t[37]=N);let ne=v.isPending||!E,P;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Y.jsx)(F,{size:16,stroke:2}),t[38]=P):P=t[38];let I=v.isPending?`Testing...`:ee,L;t[39]!==N||t[40]!==ne||t[41]!==I?(L=(0,Y.jsxs)(ce,{onClick:N,disabled:ne,children:[P,I]}),t[39]=N,t[40]=ne,t[41]=I,t[42]=L):L=t[42];let R;t[43]===n.provider?R=t[44]:(R=n.provider===`github`?(0,Y.jsxs)(ce,{onClick:()=>l(!0),children:[(0,Y.jsx)(ge,{size:16,stroke:`2`}),`Select Repositories`]}):null,t[43]=n.provider,t[44]=R);let oe;t[45]===x?oe=t[46]:(oe=()=>x.mutate(),t[45]=x,t[46]=oe);let se;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Y.jsx)(h,{size:16,stroke:2}),t[47]=se):se=t[47];let V=x.isPending?`Deleting...`:`Delete`,H;t[48]!==x.isPending||t[49]!==oe||t[50]!==V?(H=(0,Y.jsxs)(ce,{onClick:oe,disabled:x.isPending,className:`text-destructive focus:text-destructive`,children:[se,V]}),t[48]=x.isPending,t[49]=oe,t[50]=V,t[51]=H):H=t[51];let U;t[52]!==L||t[53]!==R||t[54]!==H?(U=(0,Y.jsxs)(le,{children:[M,(0,Y.jsxs)(B,{align:`end`,className:`min-w-40`,children:[L,R,H]})]}),t[52]=L,t[53]=R,t[54]=H,t[55]=U):U=t[55];let G;t[56]!==j||t[57]!==U?(G=(0,Y.jsxs)(fe,{className:`flex flex-row items-start justify-between space-y-0 pb-2`,children:[j,U]}),t[56]=j,t[57]=U,t[58]=G):G=t[58];let K;t[59]===n.status?K=t[60]:(K=at(n.status),t[59]=n.status,t[60]=K);let be;t[61]!==n.status||t[62]!==K?(be=(0,Y.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Y.jsx)(de,{variant:K,children:n.status})}),t[61]=n.status,t[62]=K,t[63]=be):be=t[63];let q;t[64]===n.lastUsedAt?q=t[65]:(q=n.lastUsedAt&&(0,Y.jsxs)(`p`,{className:`text-sm text-muted-foreground mt-2`,children:[`Last used: `,ue(n.lastUsedAt)]}),t[64]=n.lastUsedAt,t[65]=q);let X;t[66]===n.errorMessage?X=t[67]:(X=(0,Y.jsx)(ot,{errorMessage:n.errorMessage}),t[66]=n.errorMessage,t[67]=X);let Z;t[68]!==be||t[69]!==q||t[70]!==X?(Z=(0,Y.jsxs)(pe,{children:[be,q,X]}),t[68]=be,t[69]=q,t[70]=X,t[71]=Z):Z=t[71];let Q;t[72]!==n.id||t[73]!==n.provider||t[74]!==r||t[75]!==c?(Q=n.provider===`github`?(0,Y.jsx)(nt,{organizationId:r,dataSourceId:n.id,open:c,onOpenChange:l}):null,t[72]=n.id,t[73]=n.provider,t[74]=r,t[75]=c,t[76]=Q):Q=t[76];let Se;return t[77]!==G||t[78]!==Z||t[79]!==Q?(Se=(0,Y.jsxs)(he,{children:[G,Z,Q]}),t[77]=G,t[78]=Z,t[79]=Q,t[80]=Se):Se=t[80],Se}function ct(e){if(e.kind===`unsupported`){I.info(e.message);return}if(e.result.success){I.success(`Data source test successful`);return}Ce({title:`Data source test failed`,description:e.result.error??e.result.message??`Unknown error`})}function lt(e){return Ce({title:`Failed to test data source`,description:e.message})}function ut(e){return e}function dt(e){let t=(0,xe.c)(18),n;t[0]===e.provider?n=t[1]:(n=ve(e.provider),t[0]=e.provider,t[1]=n);let r=n,i;t[2]===r?i=t[3]:(i=(0,Y.jsx)(r,{className:`h-5 w-5 text-muted-foreground shrink-0`}),t[2]=r,t[3]=i);let a;t[4]===e.provider?a=t[5]:(a=ye(e.provider),t[4]=e.provider,t[5]=a);let o;t[6]===a?o=t[7]:(o=(0,Y.jsx)(`p`,{className:`font-medium truncate`,children:a}),t[6]=a,t[7]=o);let c;t[8]!==i||t[9]!==o?(c=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[i,o]}),t[8]=i,t[9]=o,t[10]=c):c=t[10];let l;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(s,{variant:`secondary`,size:`sm`,children:`Connect`}),t[11]=l):l=t[11];let u;t[12]!==e.organizationId||t[13]!==e.provider?(u=(0,Y.jsx)(X,{organizationId:e.organizationId,initialProvider:e.provider,children:l}),t[12]=e.organizationId,t[13]=e.provider,t[14]=u):u=t[14];let d;return t[15]!==c||t[16]!==u?(d=(0,Y.jsx)(he,{className:`border-dashed`,children:(0,Y.jsx)(pe,{className:`p-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,u]})})}),t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function ft(e){let t=(0,xe.c)(35),{organizationId:n,openGitHubDataSourceId:r}=e,i;t[0]===n?i=t[1]:(i=re(n),t[0]=n,t[1]=i);let{data:a}=O(i),o,c,l,u,d,f,p,m;if(t[2]!==a||t[3]!==r||t[4]!==n){let e=ut(a),i=new Set(e.map(pt)),h=G.filter(e=>!i.has(e)),g=e.length>0;d=`space-y-8`;let _;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Connected`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Data sources already connected to your workspace.`})]}),t[13]=_):_=t[13];let v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Y.jsxs)(s,{children:[(0,Y.jsx)(y,{size:16,stroke:2}),`Add Data Source`]}),t[14]=v):v=t[14],t[15]===n?f=t[16]:(f=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[_,(0,Y.jsx)(X,{organizationId:n,children:v})]}),t[15]=n,t[16]=f),t[17]===g?p=t[18]:(p=g?null:(0,Y.jsxs)(`div`,{className:`text-center py-12`,children:[(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:`No connected data sources yet.`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Connect one below or add a new data source to get started.`})]}),t[17]=g,t[18]=p),m=g?(0,Y.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>(0,Y.jsx)(st,{dataSource:e,organizationId:n,openGitHubRepositories:r===e.id},e.id))}):null,l=`space-y-4`,t[19]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Not connected`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Available data sources you can connect next.`})]}),t[19]=u):u=t[19],o=`grid gap-4 md:grid-cols-2 lg:grid-cols-3`;let b;t[20]===n?b=t[21]:(b=e=>(0,Y.jsx)(dt,{provider:e,organizationId:n},e),t[20]=n,t[21]=b),c=h.map(b),t[2]=a,t[3]=r,t[4]=n,t[5]=o,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m}else o=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12];let h;t[22]!==o||t[23]!==c?(h=(0,Y.jsx)(`div`,{className:o,children:c}),t[22]=o,t[23]=c,t[24]=h):h=t[24];let g;t[25]!==h||t[26]!==l||t[27]!==u?(g=(0,Y.jsxs)(`div`,{className:l,children:[u,h]}),t[25]=h,t[26]=l,t[27]=u,t[28]=g):g=t[28];let _;return t[29]!==g||t[30]!==d||t[31]!==f||t[32]!==p||t[33]!==m?(_=(0,Y.jsxs)(`div`,{className:d,children:[f,p,m,g]}),t[29]=g,t[30]=d,t[31]=f,t[32]=p,t[33]=m,t[34]=_):_=t[34],_}function pt(e){return e.provider}var mt=i(`/_authenticated/$org_slug/integrations`);function ht(){let e=(0,xe.c)(4),{organizationId:t}=mt.useRouteContext(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(`section`,{children:(0,Y.jsxs)(`div`,{className:`mb-6`,children:[(0,Y.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Integrations`}),(0,Y.jsx)(`p`,{className:`text-muted-foreground mt-2`,children:`Manage the data sources connected to your workspace.`})]})}),e[0]=n):n=e[0];let r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Y.jsxs)(`div`,{className:`mb-4`,children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Data Sources`}),(0,Y.jsx)(`p`,{className:`text-muted-foreground text-sm mt-1`,children:`Connect databases, analytics platforms, and other services to provide data for your agents.`})]}),e[1]=r):r=e[1];let i;return e[2]===t?i=e[3]:(i=(0,Y.jsxs)(`div`,{className:`p-8 space-y-12`,children:[n,(0,Y.jsxs)(`section`,{children:[r,(0,Y.jsx)(ft,{organizationId:t})]})]}),e[2]=t,e[3]=i),i}var gt=ht;export{gt as component};
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i}from"./api-base-url-DIb6qukm.js";import{S as a,a as o,n as s,t as c,x as l,y as u}from"./createReactComponent-_L2mp4Ui.js";import{t as d}from"./utils-C8DGLIgm.js";import{c as f,o as p,s as m}from"./select-BSubTgC3.js";import{n as h,r as g,t as _}from"./checkbox-BLYovhFU.js";import{t as v}from"./IconLoader2-CZSIppar.js";import{t as y}from"./IconPlus-Ie-KpLOF.js";import{a as b,c as x,i as S,l as C,n as w,o as T,r as E,s as ee,u as D}from"./use-optimistic-mutation-D88ezW6g.js";import{t as te}from"./useQuery-jz7A3Y4u.js";import{t as O}from"./useSuspenseQuery-BXj42YYV.js";import{t as k}from"./queryOptions-LX_zDC40.js";import{Ct as A,Et as j,ct as M,i as N}from"./getDisabledMountTransitionStyles-f3pOCbyk.js";import{t as ne}from"./useBaseUiId-Cn1kR417.js";import{t as P}from"./api-client-F8Y7IuHn.js";import{K as F,L as I,T as L,Y as R,_ as re,v as ie,y as ae,z as oe}from"./index-BZrWlEXZ.js";import{t as se}from"./input-DSkIbIFK.js";import{d as z,n as B,r as ce,t as le}from"./dropdown-menu-1lFANFIg.js";import{t as ue}from"./format-date-B5v-Ga9z.js";import{n as V,r as H,t as U}from"./alert-TnJXtO0T.js";import{t as de}from"./badge-D8XKsDus.js";import{a as fe,n as pe,o as W,r as me,t as he}from"./card-CZCl7QNy.js";import{a as ge,i as _e,n as G,o as ve,r as ye,t as K}from"./data-source-connection-form-DGIyt0OF.js";var be=c(`outline`,`search`,`Search`,[[`path`,{d:`M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`,key:`svg-0`}],[`path`,{d:`M21 21l-6 -6`,key:`svg-1`}]]);function q(e){return e}var xe=r(),J=e(t(),1),Y=n();function X(e){let t=(0,xe.c)(13),[n,r]=(0,J.useState)(!1),i;t[0]===e?i=t[1]:(i=t=>{e.onSuccess?.(t),r(!1)},t[0]=e,t[1]=i);let a=i,o;t[2]===e.children?o=t[3]:(o=(0,Y.jsx)(C,{render:e.children}),t[2]=e.children,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsxs)(ee,{children:[(0,Y.jsx)(x,{children:`Add Data Source`}),(0,Y.jsx)(b,{children:`Connect a data source so OneQuery can query your workspace data.`})]}),t[4]=s):s=t[4];let c;t[5]!==a||t[6]!==e.initialProvider||t[7]!==e.organizationId?(c=(0,Y.jsxs)(S,{className:`sm:max-w-[720px] max-h-[85vh] overflow-y-auto overflow-x-hidden`,children:[s,(0,Y.jsx)(K,{organizationId:e.organizationId,onSuccess:a,className:`py-4`,initialProvider:e.initialProvider})]}),t[5]=a,t[6]=e.initialProvider,t[7]=e.organizationId,t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==o||t[11]!==c?(l=(0,Y.jsxs)(E,{open:n,onOpenChange:r,children:[o,c]}),t[9]=n,t[10]=o,t[11]=c,t[12]=l):l=t[12],l}var Z=180,Q=/\b(api[-_ ]?key|authorization|bearer|cookie|password|secret|token)\b|-----BEGIN/i;function Se(e,t){let n=t?.replaceAll(/\s+/g,` `).trim();if(n&&n!==e)return n.length>Z||Q.test(n)?`Review the data source settings and try again.`:n}function Ce(e){let t=Se(e.title,e.description);return I.error(e.title,{action:e.action,className:`max-w-[34rem]`,closeButton:!0,description:t,descriptionClassName:`whitespace-pre-wrap break-words`,duration:t?12e3:8e3,position:`top-center`,richColors:!0})}var we=P();async function Te(e,t){let n=await we.api[`data-sources`][`:id`][`github-repositories`].$get({param:{id:t},query:{organizationId:e}});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(L(e,`Failed to fetch GitHub repositories`))}return n.json()}function Ee(e,t){return k({queryFn:async()=>Te(e,t),queryKey:[`github-repositories`,t]})}async function De(e,t,n){let r=await we.api[`data-sources`][`:id`][`github-repositories`].$post({json:{repositories:n},param:{id:t},query:{organizationId:e}});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(L(e,`Failed to update GitHub repositories`))}return r.json()}function Oe({queryClient:e,organizationId:t,dataSourceId:n,onSuccess:r,onError:i}){let a=Ee(t,n);return q({mutationFn:async e=>De(t,n,e.repositories),mutationKey:[`github-repositories`,n,`update`],onError:i,onSuccess:(t,n)=>{e.setQueryData(a.queryKey,e=>e&&{...e,selected:t.repositories}),r?.(t,n)}})}var ke=J.createContext(void 0);function Ae(){let e=J.useContext(ke);if(e===void 0)throw Error(u(53));return e}var je=function(e){return e.scrollAreaCornerHeight=`--scroll-area-corner-height`,e.scrollAreaCornerWidth=`--scroll-area-corner-width`,e}({});function $(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=n===`x`?`Inline`:`Block`;return n===`x`&&t===`margin`?parseFloat(r[`${t}InlineStart`])*2:parseFloat(r[`${t}${i}Start`])+parseFloat(r[`${t}${i}End`])}var Me=function(e){return e.orientation=`data-orientation`,e.hovering=`data-hovering`,e.scrolling=`data-scrolling`,e.hasOverflowX=`data-has-overflow-x`,e.hasOverflowY=`data-has-overflow-y`,e.overflowXStart=`data-overflow-x-start`,e.overflowXEnd=`data-overflow-x-end`,e.overflowYStart=`data-overflow-y-start`,e.overflowYEnd=`data-overflow-y-end`,e}({}),Ne=function(e){return e.hasOverflowX=`data-has-overflow-x`,e.hasOverflowY=`data-has-overflow-y`,e.overflowXStart=`data-overflow-x-start`,e.overflowXEnd=`data-overflow-x-end`,e.overflowYStart=`data-overflow-y-start`,e.overflowYEnd=`data-overflow-y-end`,e}({}),Pe={hasOverflowX:e=>e?{[Ne.hasOverflowX]:``}:null,hasOverflowY:e=>e?{[Ne.hasOverflowY]:``}:null,overflowXStart:e=>e?{[Ne.overflowXStart]:``}:null,overflowXEnd:e=>e?{[Ne.overflowXEnd]:``}:null,overflowYStart:e=>e?{[Ne.overflowYStart]:``}:null,overflowYEnd:e=>e?{[Ne.overflowYEnd]:``}:null,cornerHidden:()=>null},Fe={x:0,y:0},Ie={width:0,height:0},Le={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Re={x:!1,y:!1,corner:!1},ze=J.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,...s}=e,c=Be(i),l=ne(),u=j(),d=j(),{nonce:m,disableStyleElements:h}=p(),[g,_]=J.useState(!1),[v,y]=J.useState(!1),[b,x]=J.useState(!1),[S,C]=J.useState(!1),[w,T]=J.useState(Ie),[E,ee]=J.useState(Ie),[D,te]=J.useState(Le),[O,k]=J.useState(Re),A=J.useRef(null),N=J.useRef(null),P=J.useRef(null),F=J.useRef(null),I=J.useRef(null),L=J.useRef(null),R=J.useRef(null),re=J.useRef(!1),ie=J.useRef(0),ae=J.useRef(0),oe=J.useRef(0),se=J.useRef(0),z=J.useRef(`vertical`),B=J.useRef(Fe),ce=a(e=>{let t=e.x-B.current.x,n=e.y-B.current.y;B.current=e,n!==0&&(x(!0),u.start(500,()=>{x(!1)})),t!==0&&(y(!0),d.start(500,()=>{y(!1)}))}),le=a(e=>{e.button===0&&(re.current=!0,ie.current=e.clientY,ae.current=e.clientX,z.current=e.currentTarget.getAttribute(Me.orientation),N.current&&(oe.current=N.current.scrollTop,se.current=N.current.scrollLeft),I.current&&z.current===`vertical`&&I.current.setPointerCapture(e.pointerId),L.current&&z.current===`horizontal`&&L.current.setPointerCapture(e.pointerId))}),ue=a(e=>{if(!re.current)return;let t=e.clientY-ie.current,n=e.clientX-ae.current;if(N.current){let r=N.current.scrollHeight,i=N.current.clientHeight,a=N.current.scrollWidth,o=N.current.clientWidth;if(I.current&&P.current&&z.current===`vertical`){let n=$(P.current,`padding`,`y`),a=$(I.current,`margin`,`y`),o=I.current.offsetHeight,s=t/(P.current.offsetHeight-o-n-a);N.current.scrollTop=oe.current+s*(r-i),e.preventDefault(),x(!0),u.start(500,()=>{x(!1)})}if(L.current&&F.current&&z.current===`horizontal`){let t=$(F.current,`padding`,`x`),r=$(L.current,`margin`,`x`),i=L.current.offsetWidth,s=n/(F.current.offsetWidth-i-t-r);N.current.scrollLeft=se.current+s*(a-o),e.preventDefault(),y(!0),d.start(500,()=>{y(!1)})}}}),V=a(e=>{re.current=!1,I.current&&z.current===`vertical`&&I.current.releasePointerCapture(e.pointerId),L.current&&z.current===`horizontal`&&L.current.releasePointerCapture(e.pointerId)});function H(e){C(e.pointerType===`touch`)}function U(e){H(e),e.pointerType!==`touch`&&_(M(A.current,e.target))}let de=J.useMemo(()=>({hasOverflowX:!O.x,hasOverflowY:!O.y,overflowXStart:D.xStart,overflowXEnd:D.xEnd,overflowYStart:D.yStart,overflowYEnd:D.yEnd,cornerHidden:O.corner}),[O.x,O.y,O.corner,D]),fe={role:`presentation`,onPointerEnter:U,onPointerMove:U,onPointerDown:H,onPointerLeave(){_(!1)},style:{position:`relative`,[je.scrollAreaCornerHeight]:`${w.height}px`,[je.scrollAreaCornerWidth]:`${w.width}px`}},pe=o(`div`,e,{state:de,ref:[t,A],props:[fe,s],stateAttributesMapping:Pe}),W=J.useMemo(()=>({handlePointerDown:le,handlePointerMove:ue,handlePointerUp:V,handleScroll:ce,cornerSize:w,setCornerSize:T,thumbSize:E,setThumbSize:ee,touchModality:S,cornerRef:R,scrollingX:v,setScrollingX:y,scrollingY:b,setScrollingY:x,hovering:g,setHovering:_,viewportRef:N,rootRef:A,scrollbarYRef:P,scrollbarXRef:F,thumbYRef:I,thumbXRef:L,rootId:l,hiddenState:O,setHiddenState:k,overflowEdges:D,setOverflowEdges:te,viewportState:de,overflowEdgeThreshold:c}),[le,ue,V,ce,w,E,S,v,y,b,x,g,_,l,O,D,de,c]);return(0,Y.jsxs)(ke.Provider,{value:W,children:[!h&&f.getElement(m),pe]})});function Be(e){if(typeof e==`number`){let t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}var Ve=J.createContext(void 0);function He(e,t){if(typeof IntersectionObserver>`u`)return()=>{};let n=new IntersectionObserver(e=>{e.forEach(e=>{e.intersectionRatio>0&&(t(),n.disconnect())})});return n.observe(e),()=>{n.disconnect()}}var Ue=function(e){return e.scrollAreaOverflowXStart=`--scroll-area-overflow-x-start`,e.scrollAreaOverflowXEnd=`--scroll-area-overflow-x-end`,e.scrollAreaOverflowYStart=`--scroll-area-overflow-y-start`,e.scrollAreaOverflowYEnd=`--scroll-area-overflow-y-end`,e}({}),We=!1;function Ge(){We||A||(typeof CSS<`u`&&`registerProperty`in CSS&&[Ue.scrollAreaOverflowXStart,Ue.scrollAreaOverflowXEnd,Ue.scrollAreaOverflowYStart,Ue.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),We=!0)}var Ke=J.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{viewportRef:s,scrollbarYRef:c,scrollbarXRef:u,thumbYRef:d,thumbXRef:p,cornerRef:h,cornerSize:g,setCornerSize:_,setThumbSize:v,rootId:y,setHiddenState:b,hiddenState:x,handleScroll:S,setHovering:C,setOverflowEdges:w,overflowEdges:T,overflowEdgeThreshold:E}=Ae(),ee=N(),D=J.useRef(!0),te=j(),O=j(),k=a(()=>{let e=s.current,t=c.current,n=u.current,r=d.current,i=p.current,a=h.current;if(!e)return;let o=e.scrollHeight,l=e.scrollWidth,f=e.clientHeight,y=e.clientWidth,x=e.scrollTop,S=e.scrollLeft;if(o===0||l===0)return;let C=f>=o,T=y>=l,D=y/l,te=f/o,O=Math.max(0,l-y),k=Math.max(0,o-f),A=0,j=0;T||(A=m(ee===`rtl`?-S:S,0,O),j=O-A);let M=C?0:m(x,0,k),N=C?0:k-M,ne=T?0:y,P=C?0:f,F=0,I=0;!T&&!C&&(F=t?.offsetWidth||0,I=n?.offsetHeight||0);let L=g.width===0&&g.height===0,R=L?F:0,re=L?I:0,ie=$(n,`padding`,`x`),ae=$(t,`padding`,`y`),oe=$(i,`margin`,`x`),se=$(r,`margin`,`y`),z=ne-ie-oe,B=P-ae-se,ce=n?Math.min(n.offsetWidth-R,z):z,le=t?Math.min(t.offsetHeight-re,B):B,ue=Math.max(16,ce*D),V=Math.max(16,le*te);if(v(e=>e.height===V&&e.width===ue?e:{width:ue,height:V}),t&&r){let e=t.offsetHeight-V-ae-se,n=o-f,i=n===0?0:x/n,a=Math.min(e,Math.max(0,i*e));r.style.transform=`translate3d(0,${a}px,0)`}if(n&&i){let e=n.offsetWidth-ue-ie-oe,t=l-y,r=t===0?0:S/t,a=ee===`rtl`?m(r*e,-e,0):m(r*e,0,e);i.style.transform=`translate3d(${a}px,0,0)`}let H=m(A,0,O),U=m(j,0,O),de=m(M,0,k),fe=m(N,0,k),pe=[[Ue.scrollAreaOverflowXStart,H],[Ue.scrollAreaOverflowXEnd,U],[Ue.scrollAreaOverflowYStart,de],[Ue.scrollAreaOverflowYEnd,fe]];for(let[t,n]of pe)e.style.setProperty(t,`${n}px`);a&&(T||C?_({width:0,height:0}):!T&&!C&&_({width:F,height:I})),b(e=>{let t=C||T;return e.y===C&&e.x===T&&e.corner===t?e:{y:C,x:T,corner:t}});let W={xStart:!T&&H>E.xStart,xEnd:!T&&U>E.xEnd,yStart:!C&&de>E.yStart,yEnd:!C&&fe>E.yEnd};w(e=>e.xStart===W.xStart&&e.xEnd===W.xEnd&&e.yStart===W.yStart&&e.yEnd===W.yEnd?e:W)});l(()=>{if(!s.current)return;Ge();let e=!1;return He(s.current,()=>{if(!e){e=!0;return}k()})},[k,s]),l(()=>{queueMicrotask(k)},[k,x,ee]),l(()=>{s.current?.matches(`:hover`)&&C(!0)},[s,C]),J.useEffect(()=>{let e=s.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;return}k()});return n.observe(e),O.start(0,()=>{let t=e.getAnimations({subtree:!0});t.length!==0&&Promise.all(t.map(e=>e.finished)).then(k).catch(()=>{})}),()=>{n.disconnect(),O.clear()}},[k,s,O]);function A(){D.current=!1}let M={role:`presentation`,...y&&{"data-id":`${y}-viewport`},...(!x.x||!x.y)&&{tabIndex:0},className:f.className,style:{overflow:`scroll`},onScroll(){s.current&&(k(),D.current||S({x:s.current.scrollLeft,y:s.current.scrollTop}),te.start(100,()=>{D.current=!0}))},onWheel:A,onTouchMove:A,onPointerMove:A,onPointerEnter:A,onKeyDown:A},ne=J.useMemo(()=>({hasOverflowX:!x.x,hasOverflowY:!x.y,overflowXStart:T.xStart,overflowXEnd:T.xEnd,overflowYStart:T.yStart,overflowYEnd:T.yEnd,cornerHidden:x.corner}),[x.x,x.y,x.corner,T]),P=o(`div`,e,{ref:[t,s],state:ne,props:[M,i],stateAttributesMapping:Pe}),F=J.useMemo(()=>({computeThumbPosition:k}),[k]);return(0,Y.jsx)(Ve.Provider,{value:F,children:P})}),qe=J.createContext(void 0);function Je(){let e=J.useContext(qe);if(e===void 0)throw Error(u(54));return e}var Ye=function(e){return e.scrollAreaThumbHeight=`--scroll-area-thumb-height`,e.scrollAreaThumbWidth=`--scroll-area-thumb-width`,e}({}),Xe=J.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,overflowEdges:f,scrollbarYRef:p,scrollbarXRef:m,viewportRef:h,thumbYRef:g,thumbXRef:_,handlePointerDown:v,handlePointerUp:y,rootId:b,thumbSize:x}=Ae(),S=J.useMemo(()=>({hovering:c,scrolling:{horizontal:l,vertical:u}[i],orientation:i,hasOverflowX:!d.x,hasOverflowY:!d.y,overflowXStart:f.xStart,overflowXEnd:f.xEnd,overflowYStart:f.yStart,overflowYEnd:f.yEnd,cornerHidden:d.corner}),[c,l,u,i,d,f]),C=N();J.useEffect(()=>{let e=h.current,t=i===`vertical`?p.current:m.current;if(!t)return;function n(n){if(!(!e||!t||n.ctrlKey)){if(n.preventDefault(),i===`vertical`){if(e.scrollTop===0&&n.deltaY<0)return}else if(e.scrollLeft===0&&n.deltaX<0)return;if(i===`vertical`){if(e.scrollTop===e.scrollHeight-e.clientHeight&&n.deltaY>0)return}else if(e.scrollLeft===e.scrollWidth-e.clientWidth&&n.deltaX>0)return;i===`vertical`?e.scrollTop+=n.deltaY:e.scrollLeft+=n.deltaX}}return t.addEventListener(`wheel`,n,{passive:!1}),()=>{t.removeEventListener(`wheel`,n)}},[i,m,p,h]);let w={...b&&{"data-id":`${b}-scrollbar`},onPointerDown(e){if(e.button===0&&e.currentTarget===e.target&&h.current){if(g.current&&p.current&&i===`vertical`){let t=$(g.current,`margin`,`y`),n=$(p.current,`padding`,`y`),r=g.current.offsetHeight,i=p.current.getBoundingClientRect(),a=e.clientY-i.top-r/2-n+t/2,o=h.current.scrollHeight,s=h.current.clientHeight,c=a/(p.current.offsetHeight-r-n-t)*(o-s);h.current.scrollTop=c}if(_.current&&m.current&&i===`horizontal`){let t=$(_.current,`margin`,`x`),n=$(m.current,`padding`,`x`),r=_.current.offsetWidth,i=m.current.getBoundingClientRect(),a=e.clientX-i.left-r/2-n+t/2,o=h.current.scrollWidth,s=h.current.clientWidth,c=a/(m.current.offsetWidth-r-n-t),l;C===`rtl`?(l=(1-c)*(o-s),h.current.scrollLeft<=0&&(l=-l)):l=c*(o-s),h.current.scrollLeft=l}v(e)}},onPointerUp:y,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,...i===`vertical`&&{top:0,bottom:`var(${je.scrollAreaCornerHeight})`,insetInlineEnd:0,[Ye.scrollAreaThumbHeight]:`${x.height}px`},...i===`horizontal`&&{insetInlineStart:0,insetInlineEnd:`var(${je.scrollAreaCornerWidth})`,bottom:0,[Ye.scrollAreaThumbWidth]:`${x.width}px`}}},T=o(`div`,e,{ref:[t,i===`vertical`?p:m],state:S,props:[w,s],stateAttributesMapping:Pe}),E=J.useMemo(()=>({orientation:i}),[i]),ee=i===`vertical`?d.y:d.x;return a||!ee?(0,Y.jsx)(qe.Provider,{value:E,children:T}):null}),Ze=J.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{thumbYRef:a,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,setScrollingX:d,setScrollingY:f}=Ae(),{orientation:p}=Je(),m=J.useMemo(()=>({orientation:p}),[p]);return o(`div`,e,{ref:[t,p===`vertical`?a:s],state:m,props:[{onPointerDown:c,onPointerMove:l,onPointerUp(e){p===`vertical`&&f(!1),p===`horizontal`&&d(!1),u(e)},style:{...p===`vertical`&&{height:`var(${Ye.scrollAreaThumbHeight})`},...p===`horizontal`&&{width:`var(${Ye.scrollAreaThumbWidth})`}}},i]})}),Qe=J.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{cornerRef:a,cornerSize:s,hiddenState:c}=Ae(),l=o(`div`,e,{ref:[t,a],props:[{style:{position:`absolute`,bottom:0,insetInlineEnd:0,width:s.width,height:s.height}},i]});return c.corner?null:l});function $e(e){let t=(0,xe.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=d(`relative`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=(0,Y.jsx)(Ke,{"data-slot":`scroll-area-viewport`,className:`focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1`,children:n}),t[6]=n,t[7]=o);let s,c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsx)(et,{}),c=(0,Y.jsx)(Qe,{}),t[8]=s,t[9]=c):(s=t[8],c=t[9]);let l;return t[10]!==i||t[11]!==a||t[12]!==o?(l=(0,Y.jsxs)(ze,{"data-slot":`scroll-area`,className:a,...i,children:[o,s,c]}),t[10]=i,t[11]=a,t[12]=o,t[13]=l):l=t[13],l}function et(e){let t=(0,xe.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]===n?o=t[5]:(o=d(`data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent flex touch-none p-px transition-colors select-none`,n),t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsx)(Ze,{"data-slot":`scroll-area-thumb`,className:`rounded-full bg-border relative flex-1`}),t[6]=s):s=t[6];let c;return t[7]!==a||t[8]!==r||t[9]!==o?(c=(0,Y.jsx)(Xe,{"data-slot":`scroll-area-scrollbar`,"data-orientation":a,orientation:a,className:o,...r,children:s}),t[7]=a,t[8]=r,t[9]=o,t[10]=c):c=t[10],c}function tt(e,t){if(e.length!==t.length)return!0;let n=new Set(e);return t.some(e=>!n.has(e))}function nt(e){let t=(0,xe.c)(94),[n,r]=(0,J.useState)(``),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,J.useState)(i),c=(0,J.useRef)(!1),l=oe(),u;t[1]!==e.dataSourceId||t[2]!==e.organizationId?(u=Ee(e.organizationId,e.dataSourceId),t[1]=e.dataSourceId,t[2]=e.organizationId,t[3]=u):u=t[3];let d;t[4]!==e.open||t[5]!==u?(d={...u,enabled:e.open},t[4]=e.open,t[5]=u,t[6]=d):d=t[6];let f=te(d),p;t[7]===f.data?.repositories?p=t[8]:(p=f.data?.repositories??[],t[7]=f.data?.repositories,t[8]=p);let m=p,h;t[9]===f.data?.selected?h=t[10]:(h=f.data?.selected??[],t[9]=f.data?.selected,t[10]=h);let g=h,y,C;t[11]!==g||t[12]!==e.open||t[13]!==f.data?(y=()=>{if(!e.open){c.current=!1,r(``);return}f.data&&(c.current||=(o(g),!0))},C=[g,e.open,f.data],t[11]=g,t[12]=e.open,t[13]=f.data,t[14]=y,t[15]=C):(y=t[14],C=t[15]),(0,J.useEffect)(y,C);let w;if(t[16]!==m||t[17]!==n){bb0:{let e=n.trim().toLowerCase();if(!e){w=m;break bb0}w=m.filter(t=>{let n=t.owner.toLowerCase(),r=t.name.toLowerCase(),i=t.fullName.toLowerCase();return n.includes(e)||r.includes(e)||i.includes(e)})}t[16]=m,t[17]=n,t[18]=w}else w=t[18];let O=w,k;t[19]!==g||t[20]!==a?(k=tt(a,g),t[19]=g,t[20]=a,t[21]=k):k=t[21];let A=k,j;t[22]===e?j=t[23]:(j=()=>{I.success(`GitHub repositories updated`),e.onOpenChange(!1)},t[22]=e,t[23]=j);let M;t[24]!==e.dataSourceId||t[25]!==e.organizationId||t[26]!==l||t[27]!==j?(M=Oe({dataSourceId:e.dataSourceId,onError:it,onSuccess:j,organizationId:e.organizationId,queryClient:l}),t[24]=e.dataSourceId,t[25]=e.organizationId,t[26]=l,t[27]=j,t[28]=M):M=t[28];let N=D(M),ne;t[29]===a?ne=t[30]:(ne=new Set(a),t[29]=a,t[30]=ne);let P=ne,F;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){o(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},t[31]=F):F=t[31];let L=F,R;t[32]===O?R=t[33]:(R=function(){let e=O.map(rt);o(t=>[...new Set([...t,...e])])},t[32]=O,t[33]=R);let re=R,ie;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){o([])},t[34]=ie):ie=t[34];let ae=ie,z=f.isLoading,B=f.isError,ce=A&&!N.isPending,le;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Y.jsxs)(ee,{children:[(0,Y.jsx)(x,{children:`Select GitHub Repositories`}),(0,Y.jsx)(b,{children:`Choose repositories to use for this data source. We only read from the repositories your saved token can access and that you select here.`})]}),t[35]=le):le=t[35];let ue;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Y.jsx)(be,{size:16,className:`absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`}),t[36]=ue):ue=t[36];let V;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(V=e=>r(e.target.value),t[37]=V):V=t[37];let H;t[38]===n?H=t[39]:(H=(0,Y.jsxs)(`div`,{className:`relative flex-1`,children:[ue,(0,Y.jsx)(se,{value:n,onChange:V,placeholder:`Search repositories...`,className:`pl-9`})]}),t[38]=n,t[39]=H);let U=O.length===0,fe;t[40]!==re||t[41]!==U?(fe=(0,Y.jsx)(s,{variant:`outline`,size:`sm`,onClick:re,disabled:U,children:`Select visible`}),t[40]=re,t[41]=U,t[42]=fe):fe=t[42];let pe=a.length===0,W;t[43]===pe?W=t[44]:(W=(0,Y.jsx)(s,{variant:`ghost`,size:`sm`,onClick:ae,disabled:pe,children:`Clear`}),t[43]=pe,t[44]=W);let me;t[45]!==H||t[46]!==fe||t[47]!==W?(me=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[H,fe,W]}),t[45]=H,t[46]=fe,t[47]=W,t[48]=me):me=t[48];let he=m.length>0?` • ${m.length} available`:``,ge;t[49]!==a.length||t[50]!==he?(ge=(0,Y.jsxs)(`span`,{children:[a.length,` selected`,he]}),t[49]=a.length,t[50]=he,t[51]=ge):ge=t[51];let _e;t[52]===A?_e=t[53]:(_e=A?(0,Y.jsx)(de,{variant:`outline`,children:`Unsaved`}):null,t[52]=A,t[53]=_e);let G;t[54]!==ge||t[55]!==_e?(G=(0,Y.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[ge,_e]}),t[54]=ge,t[55]=_e,t[56]=G):G=t[56];let ve;t[57]===z?ve=t[58]:(ve=z?(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-12 text-muted-foreground`,children:(0,Y.jsx)(v,{size:24,className:`animate-spin`})}):null,t[57]=z,t[58]=ve);let ye;t[59]===B?ye=t[60]:(ye=B?(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:`Unable to load repositories. Please try again.`}):null,t[59]=B,t[60]=ye);let K;t[61]!==O||t[62]!==B||t[63]!==z||t[64]!==P?(K=!z&&!B?(0,Y.jsx)($e,{className:`h-[320px] rounded-md border`,children:(0,Y.jsxs)(`div`,{className:`p-2 space-y-1`,children:[O.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground px-3 py-6 text-center`,children:`No repositories found.`}):null,O.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:`w-full flex items-center gap-3 rounded-md px-3 py-2 hover:bg-accent transition-colors text-left`,onClick:t=>{let n=t.target;n instanceof HTMLElement&&(n.closest(`[data-slot="checkbox"]`)||L(e.fullName))},children:[(0,Y.jsx)(_,{checked:P.has(e.fullName),onCheckedChange:()=>L(e.fullName)}),(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:e.fullName}),e.private?(0,Y.jsx)(de,{variant:`secondary`,children:`Private`}):null]}),(0,Y.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Owner: `,e.owner]})]})]},e.id))]})}):null,t[61]=O,t[62]=B,t[63]=z,t[64]=P,t[65]=K):K=t[65];let q;t[66]!==me||t[67]!==G||t[68]!==ve||t[69]!==ye||t[70]!==K?(q=(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[me,G,ve,ye,K]}),t[66]=me,t[67]=G,t[68]=ve,t[69]=ye,t[70]=K,t[71]=q):q=t[71];let X;t[72]===e?X=t[73]:(X=()=>e.onOpenChange(!1),t[72]=e,t[73]=X);let Z;t[74]!==X||t[75]!==N.isPending?(Z=(0,Y.jsx)(s,{variant:`outline`,onClick:X,disabled:N.isPending,children:`Cancel`}),t[74]=X,t[75]=N.isPending,t[76]=Z):Z=t[76];let Q;t[77]!==a||t[78]!==N?(Q=()=>N.mutate({repositories:a}),t[77]=a,t[78]=N,t[79]=Q):Q=t[79];let Se=!ce,Ce=N.isPending?`Saving...`:`Save`,we;t[80]!==Q||t[81]!==Se||t[82]!==Ce?(we=(0,Y.jsx)(s,{onClick:Q,disabled:Se,children:Ce}),t[80]=Q,t[81]=Se,t[82]=Ce,t[83]=we):we=t[83];let Te;t[84]!==Z||t[85]!==we?(Te=(0,Y.jsxs)(T,{children:[Z,we]}),t[84]=Z,t[85]=we,t[86]=Te):Te=t[86];let De;t[87]!==q||t[88]!==Te?(De=(0,Y.jsxs)(S,{className:`sm:max-w-[680px]`,children:[le,q,Te]}),t[87]=q,t[88]=Te,t[89]=De):De=t[89];let ke;return t[90]!==e.onOpenChange||t[91]!==e.open||t[92]!==De?(ke=(0,Y.jsx)(E,{open:e.open,onOpenChange:e.onOpenChange,children:De}),t[90]=e.onOpenChange,t[91]=e.open,t[92]=De,t[93]=ke):ke=t[93],ke}function rt(e){return e.fullName}function it(e){Ce({title:`Failed to update GitHub repositories`,description:e.message})}function at(e){switch(e){case`active`:return`default`;case`error`:return`destructive`;case`disconnected`:return`secondary`;default:return`outline`}}function ot(e){let t=(0,xe.c)(4);if(!e.errorMessage)return null;let n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(R,{className:`size-4`}),r=(0,Y.jsx)(H,{children:`Connection needs attention`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e.errorMessage?i=t[3]:(i=(0,Y.jsxs)(U,{variant:`destructive`,className:`mt-3 border-destructive/30 bg-destructive/5`,children:[n,r,(0,Y.jsx)(V,{className:`max-h-32 overflow-y-auto whitespace-pre-wrap break-words pr-1`,children:e.errorMessage})]}),t[2]=e.errorMessage,t[3]=i),i}function st(e){let t=(0,xe.c)(81),{dataSource:n,organizationId:r,openGitHubRepositories:i}=e,a;t[0]===r?a=t[1]:(a=re(r),t[0]=r,t[1]=a);let o=a.queryKey,[c,l]=(0,J.useState)(!1),u=(0,J.useRef)(!1),d,f;t[2]!==n.provider||t[3]!==i?(d=()=>{u.current||i&&n.provider===`github`&&(l(!0),u.current=!0)},f=[n.provider,i],t[2]=n.provider,t[3]=i,t[4]=d,t[5]=f):(d=t[4],f=t[5]),(0,J.useEffect)(d,f);let p;t[6]!==n.id||t[7]!==r?(p=async()=>ae(n.id,r),t[6]=n.id,t[7]=r,t[8]=p):p=t[8];let m;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=[`data-sources`],t[9]=m):m=t[9];let _;t[10]===p?_=t[11]:(_={mutationFn:p,mutationKey:m,onError:lt,onSuccess:ct},t[10]=p,t[11]=_);let v=D(_),y;t[12]!==n.id||t[13]!==r?(y=async()=>ie(n.id,r),t[12]=n.id,t[13]=r,t[14]=y):y=t[14];let b;t[15]!==n.id||t[16]!==o||t[17]!==y?(b={errorMessage:`Failed to delete data source`,itemId:n.id,mutationFn:y,queryKey:o,successMessage:`Data source deleted`},t[15]=n.id,t[16]=o,t[17]=y,t[18]=b):b=t[18];let x=w(b),S;t[19]===n.provider?S=t[20]:(S=ve(n.provider),t[19]=n.provider,t[20]=S);let C=S,T;t[21]===n.provider?T=t[22]:(T=_e(n.provider),t[21]=n.provider,t[22]=T);let E=T,ee=E?`Test Connection`:`Test Connection (Unsupported)`,te;t[23]===n.name?te=t[24]:(te=(0,Y.jsx)(W,{className:`text-lg`,children:n.name}),t[23]=n.name,t[24]=te);let O;t[25]===C?O=t[26]:(O=(0,Y.jsx)(C,{className:`h-4.5 w-4.5`}),t[25]=C,t[26]=O);let k;t[27]===n.provider?k=t[28]:(k=ye(n.provider),t[27]=n.provider,t[28]=k);let A;t[29]!==O||t[30]!==k?(A=(0,Y.jsxs)(me,{className:`flex items-center gap-1.5 mt-0.5`,children:[O,k]}),t[29]=O,t[30]=k,t[31]=A):A=t[31];let j;t[32]!==te||t[33]!==A?(j=(0,Y.jsxs)(`div`,{children:[te,A]}),t[32]=te,t[33]=A,t[34]=j):j=t[34];let M;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Y.jsx)(z,{children:(0,Y.jsx)(s,{variant:`ghost`,size:`icon-sm`,children:(0,Y.jsx)(g,{size:16,stroke:2})})}),t[35]=M):M=t[35];let N;t[36]===v?N=t[37]:(N=()=>v.mutate(),t[36]=v,t[37]=N);let ne=v.isPending||!E,P;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Y.jsx)(F,{size:16,stroke:2}),t[38]=P):P=t[38];let I=v.isPending?`Testing...`:ee,L;t[39]!==N||t[40]!==ne||t[41]!==I?(L=(0,Y.jsxs)(ce,{onClick:N,disabled:ne,children:[P,I]}),t[39]=N,t[40]=ne,t[41]=I,t[42]=L):L=t[42];let R;t[43]===n.provider?R=t[44]:(R=n.provider===`github`?(0,Y.jsxs)(ce,{onClick:()=>l(!0),children:[(0,Y.jsx)(ge,{size:16,stroke:`2`}),`Select Repositories`]}):null,t[43]=n.provider,t[44]=R);let oe;t[45]===x?oe=t[46]:(oe=()=>x.mutate(),t[45]=x,t[46]=oe);let se;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Y.jsx)(h,{size:16,stroke:2}),t[47]=se):se=t[47];let V=x.isPending?`Deleting...`:`Delete`,H;t[48]!==x.isPending||t[49]!==oe||t[50]!==V?(H=(0,Y.jsxs)(ce,{onClick:oe,disabled:x.isPending,className:`text-destructive focus:text-destructive`,children:[se,V]}),t[48]=x.isPending,t[49]=oe,t[50]=V,t[51]=H):H=t[51];let U;t[52]!==L||t[53]!==R||t[54]!==H?(U=(0,Y.jsxs)(le,{children:[M,(0,Y.jsxs)(B,{align:`end`,className:`min-w-40`,children:[L,R,H]})]}),t[52]=L,t[53]=R,t[54]=H,t[55]=U):U=t[55];let G;t[56]!==j||t[57]!==U?(G=(0,Y.jsxs)(fe,{className:`flex flex-row items-start justify-between space-y-0 pb-2`,children:[j,U]}),t[56]=j,t[57]=U,t[58]=G):G=t[58];let K;t[59]===n.status?K=t[60]:(K=at(n.status),t[59]=n.status,t[60]=K);let be;t[61]!==n.status||t[62]!==K?(be=(0,Y.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Y.jsx)(de,{variant:K,children:n.status})}),t[61]=n.status,t[62]=K,t[63]=be):be=t[63];let q;t[64]===n.lastUsedAt?q=t[65]:(q=n.lastUsedAt&&(0,Y.jsxs)(`p`,{className:`text-sm text-muted-foreground mt-2`,children:[`Last used: `,ue(n.lastUsedAt)]}),t[64]=n.lastUsedAt,t[65]=q);let X;t[66]===n.errorMessage?X=t[67]:(X=(0,Y.jsx)(ot,{errorMessage:n.errorMessage}),t[66]=n.errorMessage,t[67]=X);let Z;t[68]!==be||t[69]!==q||t[70]!==X?(Z=(0,Y.jsxs)(pe,{children:[be,q,X]}),t[68]=be,t[69]=q,t[70]=X,t[71]=Z):Z=t[71];let Q;t[72]!==n.id||t[73]!==n.provider||t[74]!==r||t[75]!==c?(Q=n.provider===`github`?(0,Y.jsx)(nt,{organizationId:r,dataSourceId:n.id,open:c,onOpenChange:l}):null,t[72]=n.id,t[73]=n.provider,t[74]=r,t[75]=c,t[76]=Q):Q=t[76];let Se;return t[77]!==G||t[78]!==Z||t[79]!==Q?(Se=(0,Y.jsxs)(he,{children:[G,Z,Q]}),t[77]=G,t[78]=Z,t[79]=Q,t[80]=Se):Se=t[80],Se}function ct(e){if(e.kind===`unsupported`){I.info(e.message);return}if(e.result.success){I.success(`Data source test successful`);return}Ce({title:`Data source test failed`,description:e.result.error??e.result.message??`Unknown error`})}function lt(e){return Ce({title:`Failed to test data source`,description:e.message})}function ut(e){return e}function dt(e){let t=(0,xe.c)(18),n;t[0]===e.provider?n=t[1]:(n=ve(e.provider),t[0]=e.provider,t[1]=n);let r=n,i;t[2]===r?i=t[3]:(i=(0,Y.jsx)(r,{className:`h-5 w-5 text-muted-foreground shrink-0`}),t[2]=r,t[3]=i);let a;t[4]===e.provider?a=t[5]:(a=ye(e.provider),t[4]=e.provider,t[5]=a);let o;t[6]===a?o=t[7]:(o=(0,Y.jsx)(`p`,{className:`font-medium truncate`,children:a}),t[6]=a,t[7]=o);let c;t[8]!==i||t[9]!==o?(c=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[i,o]}),t[8]=i,t[9]=o,t[10]=c):c=t[10];let l;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(s,{variant:`secondary`,size:`sm`,children:`Connect`}),t[11]=l):l=t[11];let u;t[12]!==e.organizationId||t[13]!==e.provider?(u=(0,Y.jsx)(X,{organizationId:e.organizationId,initialProvider:e.provider,children:l}),t[12]=e.organizationId,t[13]=e.provider,t[14]=u):u=t[14];let d;return t[15]!==c||t[16]!==u?(d=(0,Y.jsx)(he,{className:`border-dashed`,children:(0,Y.jsx)(pe,{className:`p-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,u]})})}),t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function ft(e){let t=(0,xe.c)(35),{organizationId:n,openGitHubDataSourceId:r}=e,i;t[0]===n?i=t[1]:(i=re(n),t[0]=n,t[1]=i);let{data:a}=O(i),o,c,l,u,d,f,p,m;if(t[2]!==a||t[3]!==r||t[4]!==n){let e=ut(a),i=new Set(e.map(pt)),h=G.filter(e=>!i.has(e)),g=e.length>0;d=`space-y-8`;let _;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Connected`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Data sources already connected to your workspace.`})]}),t[13]=_):_=t[13];let v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Y.jsxs)(s,{children:[(0,Y.jsx)(y,{size:16,stroke:2}),`Add Data Source`]}),t[14]=v):v=t[14],t[15]===n?f=t[16]:(f=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[_,(0,Y.jsx)(X,{organizationId:n,children:v})]}),t[15]=n,t[16]=f),t[17]===g?p=t[18]:(p=g?null:(0,Y.jsxs)(`div`,{className:`text-center py-12`,children:[(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:`No connected data sources yet.`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Connect one below or add a new data source to get started.`})]}),t[17]=g,t[18]=p),m=g?(0,Y.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>(0,Y.jsx)(st,{dataSource:e,organizationId:n,openGitHubRepositories:r===e.id},e.id))}):null,l=`space-y-4`,t[19]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Not connected`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Available data sources you can connect next.`})]}),t[19]=u):u=t[19],o=`grid gap-4 md:grid-cols-2 lg:grid-cols-3`;let b;t[20]===n?b=t[21]:(b=e=>(0,Y.jsx)(dt,{provider:e,organizationId:n},e),t[20]=n,t[21]=b),c=h.map(b),t[2]=a,t[3]=r,t[4]=n,t[5]=o,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m}else o=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12];let h;t[22]!==o||t[23]!==c?(h=(0,Y.jsx)(`div`,{className:o,children:c}),t[22]=o,t[23]=c,t[24]=h):h=t[24];let g;t[25]!==h||t[26]!==l||t[27]!==u?(g=(0,Y.jsxs)(`div`,{className:l,children:[u,h]}),t[25]=h,t[26]=l,t[27]=u,t[28]=g):g=t[28];let _;return t[29]!==g||t[30]!==d||t[31]!==f||t[32]!==p||t[33]!==m?(_=(0,Y.jsxs)(`div`,{className:d,children:[f,p,m,g]}),t[29]=g,t[30]=d,t[31]=f,t[32]=p,t[33]=m,t[34]=_):_=t[34],_}function pt(e){return e.provider}var mt=i(`/_authenticated/$org_slug/integrations`);function ht(){let e=(0,xe.c)(4),{organizationId:t}=mt.useRouteContext(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(`section`,{children:(0,Y.jsxs)(`div`,{className:`mb-6`,children:[(0,Y.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Integrations`}),(0,Y.jsx)(`p`,{className:`text-muted-foreground mt-2`,children:`Manage the data sources connected to your workspace.`})]})}),e[0]=n):n=e[0];let r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Y.jsxs)(`div`,{className:`mb-4`,children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Data Sources`}),(0,Y.jsx)(`p`,{className:`text-muted-foreground text-sm mt-1`,children:`Connect databases, analytics platforms, and other services to provide data for your agents.`})]}),e[1]=r):r=e[1];let i;return e[2]===t?i=e[3]:(i=(0,Y.jsxs)(`div`,{className:`p-8 space-y-12`,children:[n,(0,Y.jsxs)(`section`,{children:[r,(0,Y.jsx)(ft,{organizationId:t})]})]}),e[2]=t,e[3]=i),i}var gt=ht;export{gt as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./compiler-runtime-DCc3R3Xn.js";import{a as n,o as r}from"./api-base-url-DIb6qukm.js";import{n as i}from"./createReactComponent-_L2mp4Ui.js";import{t as a}from"./IconCheck-Gc24xPT2.js";import{t as o}from"./IconLoader2-CZSIppar.js";import{t as s}from"./IconX-Cg43mUxH.js";import{t as c}from"./auth-client-Dj6z7Pcl.js";import{a as l,i as u}from"./app-routes-DM5pppqD.js";import{O as d,k as f,z as p}from"./index-BZrWlEXZ.js";import{a as m,i as h,n as g,o as _,r as v,t as y}from"./card-CZCl7QNy.js";import{a as b,i as x,r as S,t as C}from"./xstate-react.esm--l_MSO73.js";import{n as w,t as T}from"./dist-Cg-lnuP8.js";var E=t(),D=n(u),O=`Failed to accept invitation`,k=`Failed to navigate. Try again from home.`,A=1500,j={kind:`home`},M={ACCEPT:`inviteAccept/accept`,DECLINE:`inviteAccept/decline`,GO_HOME:`inviteAccept/goHome`},N={ACCEPTING:`accepting`,ERROR:`error`,NAVIGATING:`navigating`,NAVIGATING_FROM_ERROR:`fromError`,NAVIGATING_FROM_READY:`fromReady`,NAVIGATING_FROM_SUCCESS:`fromSuccess`,READY:`ready`,REFRESHING_ORGANIZATIONS:`refreshingOrganizations`,SUCCESS_PENDING_REDIRECT:`successPendingRedirect`},P={ACCEPTING:`accepting`,ERROR:`error`,READY:`ready`,SUCCESS:`success`},F=class extends w(`InviteAcceptRequestError`)(){},I=class extends w(`InviteRedirectResolutionError`)(){};function L(){return{kind:`idle`}}function R(e){return{kind:`accepted`,organizationId:e}}function z(e){return{kind:`error`,message:e}}function B(e){return{invitationId:e,outcome:L(),redirectTarget:null}}function V(e){return B(e.invitationId)}function H(e,t){return{...V(e),outcome:z(t)}}function U(e){return e.redirectTarget??j}function W(e){if(e.outcome.kind!==`accepted`)throw Error(`Accepted organization id is required to resolve redirect`);return e.outcome.organizationId}async function G(e){let t=await T.tryPromise({try:()=>c.acceptInvitation({invitationId:e}),catch:e=>new F({cause:e,message:O,reason:`request_failed`})});if(t.isErr())return T.err(t.error);let n=t.value;return n.error?T.err(new F({message:J(n.error.message,O),reason:`response_failed`})):T.ok({acceptedOrganizationId:n.data.member.organizationId})}async function K(e){let t=await T.tryPromise({try:()=>e.refetchSession(),catch:t=>new I({acceptedOrganizationId:e.acceptedOrganizationId,cause:t,message:`Failed to refresh organizations after accepting invitation`,reason:`session_refresh_failed`,...e.userId?{userId:e.userId}:{}})});if(t.isErr())return Y(t.error),T.err(t.error);let n=await T.tryPromise({try:()=>e.queryClient.fetchQuery({...d(e.userId),staleTime:0}),catch:t=>new I({acceptedOrganizationId:e.acceptedOrganizationId,cause:t,message:`Failed to refresh organizations after accepting invitation`,reason:`organization_list_failed`,...e.userId?{userId:e.userId}:{}})});if(n.isErr())return Y(n.error),T.err(n.error);let r=n.value.find(t=>t.id===e.acceptedOrganizationId);if(r)return T.ok({kind:`organization`,organizationSlug:f(r)});let i=await T.tryPromise({try:()=>c.getFullOrganization({query:{organizationId:e.acceptedOrganizationId}}),catch:t=>new I({acceptedOrganizationId:e.acceptedOrganizationId,cause:t,message:`Failed to load accepted organization details`,reason:`organization_lookup_failed`,...e.userId?{userId:e.userId}:{}})});if(i.isErr())return Y(i.error),T.err(i.error);if(i.value.data?.slug)return T.ok({kind:`organization`,organizationSlug:i.value.data.slug});let a=new I({acceptedOrganizationId:e.acceptedOrganizationId,message:`Accepted invitation but organization was not found`,reason:`organization_missing`,...e.userId?{userId:e.userId}:{}});return Y(a),T.err(a)}function q(e,t){if(!(e instanceof Error))return t;let n=e.message.trim();return n.length===0?t:n}function J(e,t){let n=e?.trim()??``;return n.length>0?n:t}function Y(e){if(e.reason===`organization_missing`){console.error(`[invite] accepted invitation but organization was not found`,{acceptedOrganizationId:e.acceptedOrganizationId,userId:e.userId});return}console.error(`[invite] accepted invitation but failed to refresh orgs`,{acceptedOrganizationId:e.acceptedOrganizationId,error:e.cause??e.message,reason:e.reason,userId:e.userId})}function X(e={}){return Z.provide({delays:{successRedirect:e.successRedirectDelayMs??A}})}var Z=S({actions:{prepareAcceptRequest:x(()=>({outcome:L(),redirectTarget:null})),resetFlow:x(({context:e})=>V(e)),setHomeRedirectTarget:x({redirectTarget:()=>j}),storeAcceptError:x(({context:e},t)=>H(e,q(t.error,O))),storeAcceptedOrganizationId:x({outcome:(e,t)=>R(t.acceptedOrganizationId),redirectTarget:()=>null}),storeNavigationError:x(({context:e},t)=>H(e,Q(t.error))),storeResolvedRedirectTarget:x({redirectTarget:(e,t)=>t.redirectTarget})},actors:{acceptInvitation:b(async({input:e})=>{let t=await G(e.invitationId);if(t.isErr())throw t.error;return t.value}),navigateToInviteTarget:b(async e=>void 0),resolveRedirect:b(async e=>j)},delays:{successRedirect:A},types:{}}).createMachine({context:({input:e})=>B(e.invitationId),id:`inviteAccept`,initial:N.READY,states:{[N.READY]:{tags:P.READY,on:{[M.ACCEPT]:{actions:`prepareAcceptRequest`,target:N.ACCEPTING},[M.DECLINE]:{actions:`setHomeRedirectTarget`,target:`${N.NAVIGATING}.${N.NAVIGATING_FROM_READY}`}}},[N.ACCEPTING]:{tags:P.ACCEPTING,invoke:{src:`acceptInvitation`,input:({context:e})=>({invitationId:e.invitationId}),onDone:{actions:{type:`storeAcceptedOrganizationId`,params:({event:e})=>({acceptedOrganizationId:e.output.acceptedOrganizationId})},target:N.REFRESHING_ORGANIZATIONS},onError:{actions:{type:`storeAcceptError`,params:({event:e})=>({error:e.error})},target:N.ERROR}}},[N.REFRESHING_ORGANIZATIONS]:{tags:P.SUCCESS,invoke:{src:`resolveRedirect`,input:({context:e})=>({acceptedOrganizationId:W(e)}),onDone:{actions:{type:`storeResolvedRedirectTarget`,params:({event:e})=>({redirectTarget:e.output})},target:N.SUCCESS_PENDING_REDIRECT},onError:{actions:`setHomeRedirectTarget`,target:N.SUCCESS_PENDING_REDIRECT}}},[N.SUCCESS_PENDING_REDIRECT]:{tags:P.SUCCESS,after:{successRedirect:`${N.NAVIGATING}.${N.NAVIGATING_FROM_SUCCESS}`}},[N.NAVIGATING]:{initial:N.NAVIGATING_FROM_READY,invoke:{src:`navigateToInviteTarget`,input:({context:e})=>({target:U(e)}),onDone:{actions:`resetFlow`,target:N.READY},onError:{actions:{type:`storeNavigationError`,params:({event:e})=>({error:e.error})},target:N.ERROR}},states:{[N.NAVIGATING_FROM_ERROR]:{tags:P.ERROR},[N.NAVIGATING_FROM_READY]:{tags:P.READY},[N.NAVIGATING_FROM_SUCCESS]:{tags:P.SUCCESS}}},[N.ERROR]:{tags:P.ERROR,on:{[M.GO_HOME]:{actions:`setHomeRedirectTarget`,target:`${N.NAVIGATING}.${N.NAVIGATING_FROM_ERROR}`}}}}}),ee=X();function te(e){return e.hasTag(P.ACCEPTING)?`accepting`:e.hasTag(P.ERROR)?`error`:e.hasTag(P.SUCCESS)?`success`:`ready`}function ne(e){return e.context.outcome.kind===`error`?e.context.outcome.message:null}function Q(e){return q(e,k)}function re(){let e=(0,E.c)(28),t=r(),n=p(),{invitationId:i}=D.useParams(),{auth:a,refetchSession:o}=D.useRouteContext(),s=a.session?.user.id,c;if(e[0]!==t||e[1]!==n||e[2]!==o||e[3]!==s){let r;e[5]===t?r=e[6]:(r=async e=>{let{input:n}=e;try{if(n.target.kind===`home`){await t({to:`/`});return}await t({params:{org_slug:n.target.organizationSlug},to:l})}catch(e){let t=e;throw console.error(`[invite] failed to navigate after accepting invitation`,{error:t,navigationTarget:n.target}),Error(Q(t),{cause:t})}},e[5]=t,e[6]=r);let i;e[7]!==n||e[8]!==o||e[9]!==s?(i=async e=>{let{input:t}=e,r=await K({acceptedOrganizationId:t.acceptedOrganizationId,queryClient:n,refetchSession:o,userId:s});if(r.isErr())throw r.error;return r.value},e[7]=n,e[8]=o,e[9]=s,e[10]=i):i=e[10],c=ee.provide({actors:{navigateToInviteTarget:b(r),resolveRedirect:b(i)}}),e[0]=t,e[1]=n,e[2]=o,e[3]=s,e[4]=c}else c=e[4];let u;e[11]===i?u=e[12]:(u={input:{invitationId:i}},e[11]=i,e[12]=u);let[d,f]=C(c,u),m,h;e[13]===f?(m=e[14],h=e[15]):(m=()=>{f({type:M.ACCEPT})},h=()=>{f({type:M.DECLINE})},e[13]=f,e[14]=m,e[15]=h);let g;e[16]===d?g=e[17]:(g=ne(d),e[16]=d,e[17]=g);let _;e[18]===f?_=e[19]:(_=()=>{f({type:M.GO_HOME})},e[18]=f,e[19]=_);let v;e[20]===d?v=e[21]:(v=te(d),e[20]=d,e[21]=v);let y;return e[22]!==m||e[23]!==h||e[24]!==g||e[25]!==_||e[26]!==v?(y={accept:m,decline:h,errorMessage:g,goHome:_,status:v},e[22]=m,e[23]=h,e[24]=g,e[25]=_,e[26]=v,e[27]=y):y=e[27],y}var $=e();function ie(){let e=(0,E.c)(2),{invitationId:t}=D.useParams(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(ae,{},t),e[0]=t,e[1]=n),n}function ae(){let e=(0,E.c)(28),{accept:t,decline:n,errorMessage:r,goHome:c,status:l}=re(),u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsxs)(m,{className:`text-center`,children:[(0,$.jsx)(_,{className:`text-2xl`,children:`Organization Invitation`}),(0,$.jsx)(v,{children:`You've been invited to join an organization`})]}),e[0]=u):u=e[0];let d;e[1]===l?d=e[2]:(d=l===`ready`&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,$.jsx)(`div`,{className:`rounded-full bg-primary/10 p-4`,children:(0,$.jsx)(a,{size:48,className:`text-primary`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium`,children:`Ready to join`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Click the button below to accept the invitation and join the organization.`})]})]}),e[1]=l,e[2]=d);let f;e[3]===l?f=e[4]:(f=l===`accepting`&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,$.jsx)(o,{size:48,className:`animate-spin text-primary`}),(0,$.jsx)(`p`,{className:`text-muted-foreground`,children:`Accepting invitation...`})]}),e[3]=l,e[4]=f);let p;e[5]===l?p=e[6]:(p=l===`success`&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,$.jsx)(`div`,{className:`rounded-full bg-green-500/10 p-4`,children:(0,$.jsx)(a,{size:48,className:`text-green-500`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium text-green-600`,children:`Successfully joined!`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Redirecting to your dashboard...`})]})]}),e[5]=l,e[6]=p);let b;e[7]!==r||e[8]!==l?(b=l===`error`&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,$.jsx)(`div`,{className:`rounded-full bg-destructive/10 p-4`,children:(0,$.jsx)(s,{size:48,className:`text-destructive`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium text-destructive`,children:`Failed to accept invitation`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:r||`The invitation may have expired or already been used.`})]})]}),e[7]=r,e[8]=l,e[9]=b):b=e[9];let x;e[10]!==d||e[11]!==f||e[12]!==p||e[13]!==b?(x=(0,$.jsxs)(g,{className:`flex justify-center py-8`,children:[d,f,p,b]}),e[10]=d,e[11]=f,e[12]=p,e[13]=b,e[14]=x):x=e[14];let S;e[15]!==t||e[16]!==n||e[17]!==l?(S=l===`ready`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(i,{variant:`outline`,onClick:n,children:`Decline`}),(0,$.jsx)(i,{onClick:t,children:`Accept Invitation`})]}),e[15]=t,e[16]=n,e[17]=l,e[18]=S):S=e[18];let C;e[19]!==c||e[20]!==l?(C=l===`error`&&(0,$.jsx)(i,{variant:`outline`,onClick:c,children:`Go to Home`}),e[19]=c,e[20]=l,e[21]=C):C=e[21];let w;e[22]!==S||e[23]!==C?(w=(0,$.jsxs)(h,{className:`flex justify-center gap-4`,children:[S,C]}),e[22]=S,e[23]=C,e[24]=w):w=e[24];let T;return e[25]!==x||e[26]!==w?(T=(0,$.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:(0,$.jsxs)(y,{className:`w-full max-w-md`,children:[u,x,w]})}),e[25]=x,e[26]=w,e[27]=T):T=e[27],T}var oe=ie;export{oe as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./link-Cgvqhh5w.js";import{t as n}from"./compiler-runtime-DCc3R3Xn.js";import{r,t as i}from"./createReactComponent-_L2mp4Ui.js";import{t as a}from"./utils-C8DGLIgm.js";import{t as o}from"./theme-toggle-
|
|
1
|
+
import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./link-Cgvqhh5w.js";import{t as n}from"./compiler-runtime-DCc3R3Xn.js";import{r,t as i}from"./createReactComponent-_L2mp4Ui.js";import{t as a}from"./utils-C8DGLIgm.js";import{t as o}from"./theme-toggle-CdJo4s34.js";import{o as s}from"./app-routes-DM5pppqD.js";import{K as c}from"./index-BZrWlEXZ.js";var l=i(`outline`,`git-compare`,`GitCompare`,[[`path`,{d:`M4 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M16 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M11 6h5a2 2 0 0 1 2 2v8`,key:`svg-2`}],[`path`,{d:`M14 9l-3 -3l3 -3`,key:`svg-3`}],[`path`,{d:`M13 18h-5a2 2 0 0 1 -2 -2v-8`,key:`svg-4`}],[`path`,{d:`M10 15l3 3l-3 3`,key:`svg-5`}]]),u=i(`outline`,`robot`,`Robot`,[[`path`,{d:`M6 6a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -4`,key:`svg-0`}],[`path`,{d:`M12 2v2`,key:`svg-1`}],[`path`,{d:`M9 12v9`,key:`svg-2`}],[`path`,{d:`M15 12v9`,key:`svg-3`}],[`path`,{d:`M5 16l4 -2`,key:`svg-4`}],[`path`,{d:`M15 14l4 2`,key:`svg-5`}],[`path`,{d:`M9 18h6`,key:`svg-6`}],[`path`,{d:`M10 8v.01`,key:`svg-7`}],[`path`,{d:`M14 8v.01`,key:`svg-8`}]]),d=n(),f=e();function p(){let e=(0,d.c)(3),n,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight sm:text-3xl`,children:`Get started in minutes`}),i=(0,f.jsx)(`p`,{className:`mt-4 max-w-lg text-sm leading-6 text-muted-foreground sm:text-base`,children:`Self-host for free with a single command, or try the managed cloud version.`}),e[0]=n,e[1]=i):(n=e[0],i=e[1]);let o;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsx)(`div`,{className:`mx-auto max-w-6xl px-4 py-14 sm:px-6 sm:py-20`,children:(0,f.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[n,i,(0,f.jsx)(t,{to:s,className:a(r({size:`lg`}),`mt-7 px-8 sm:mt-8`),children:`Start Free`})]})})}),e[2]=o):o=e[2],o}var m=[{description:`Connect databases, analytics tools, and connectors without stitching together a custom control plane.`,icon:u,title:`Unified Access`},{description:`Run consistent workflows across databases, analytics, GitHub, and more from the same workspace.`,icon:l,title:`Cross-Source Coverage`},{description:`Manage data source connectivity, budgets, and team access from a single operational surface.`,icon:c,title:`Operational Control`}];function h(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight sm:text-3xl`,children:`One workspace for connected data`}),(0,f.jsx)(`p`,{className:`mx-auto mt-4 max-w-2xl text-sm leading-6 text-muted-foreground sm:text-base`,children:`Replace scattered setup steps with a single, consistent control plane.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsxs)(`div`,{className:`mx-auto max-w-6xl px-4 py-14 sm:px-6 sm:py-20`,children:[t,(0,f.jsx)(`div`,{className:`mt-10 grid gap-5 sm:mt-16 sm:gap-8 md:grid-cols-3`,children:m.map(g)})]})}),e[1]=n):n=e[1],n}function g(e){return(0,f.jsxs)(`div`,{className:`flex flex-col rounded-lg border border-border p-5 sm:p-6`,children:[(0,f.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-md bg-muted`,children:(0,f.jsx)(e.icon,{size:20,stroke:1.5,className:`size-5`})}),(0,f.jsx)(`h3`,{className:`mt-4 text-base font-semibold`,children:e.title}),(0,f.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-muted-foreground`,children:e.description})]},e.title)}function _(){let e=(0,d.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(`footer`,{className:`border-t border-border`,children:(0,f.jsx)(`div`,{className:`mx-auto flex max-w-6xl items-center justify-center px-6 py-8`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`div`,{className:`flex h-6 w-6 items-center justify-center rounded bg-foreground text-background text-xs font-bold`,children:`V`}),(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`OneQuery - Autonomous Data Workspace`})]})})}),e[0]=t):t=e[0],t}function v(){let e=(0,d.c)(3),n,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`h1`,{className:`max-w-4xl text-3xl font-bold leading-tight tracking-tight sm:text-5xl md:text-6xl`,children:`Your autonomous data workspace`}),i=(0,f.jsx)(`p`,{className:`mt-5 max-w-2xl text-base leading-7 text-muted-foreground sm:mt-6 sm:text-lg md:text-xl`,children:`Connect your data sources, query them from one place, and keep your team aligned on the systems that matter. OneQuery gives you a clean control plane for operating your data access.`}),e[0]=n,e[1]=i):(n=e[0],i=e[1]);let o;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,f.jsx)(`section`,{className:`mx-auto max-w-6xl px-4 py-14 sm:px-6 sm:py-20 md:py-28`,children:(0,f.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[n,i,(0,f.jsx)(t,{to:s,className:a(r({size:`lg`}),`mt-8 px-8 sm:mt-10`),children:`Get Started`})]})}),e[2]=o):o=e[2],o}var y=[`PostgreSQL`,`MySQL`,`BigQuery`,`Google Analytics`,`Amplitude`,`Mixpanel`,`PostHog`,`GitHub`,`Linear`];function b(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight sm:text-3xl`,children:`Connect your stack`}),(0,f.jsx)(`p`,{className:`mx-auto mt-4 max-w-xl text-sm leading-6 text-muted-foreground sm:text-base`,children:`OneQuery integrates with the tools you already use.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsxs)(`div`,{className:`mx-auto max-w-6xl px-4 py-14 sm:px-6 sm:py-20`,children:[t,(0,f.jsx)(`div`,{className:`mt-10 flex flex-wrap items-center justify-center gap-x-6 gap-y-4 sm:mt-12 sm:gap-x-8`,children:y.map(x)})]})}),e[1]=n):n=e[1],n}function x(e){return(0,f.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:e},e)}function S(){let e=(0,d.c)(4),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsxs)(t,{to:`/`,className:`flex items-center gap-2`,children:[(0,f.jsx)(`img`,{src:`/onequery.svg`,alt:`OneQuery`,className:`h-8 w-8`}),(0,f.jsx)(`span`,{className:`font-semibold text-base sm:text-lg`,children:`OneQuery`})]}),e[0]=n):n=e[0];let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,f.jsx)(o,{}),e[1]=i):i=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,f.jsx)(t,{to:s,className:a(r({size:`sm`,variant:`ghost`}),`hidden sm:inline-flex`),children:`Sign in`}),e[2]=c):c=e[2];let l;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,f.jsx)(`header`,{className:`sticky top-0 z-50 w-full border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:(0,f.jsxs)(`div`,{className:`mx-auto flex h-14 max-w-6xl items-center justify-between px-4 sm:px-6`,children:[n,(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i,c,(0,f.jsx)(t,{to:s,className:r({size:`sm`,variant:`default`}),children:`Get Started`})]})]})}),e[3]=l):l=e[3],l}function C(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(S,{}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsxs)(`div`,{className:`flex h-screen flex-col overflow-y-auto`,children:[t,(0,f.jsxs)(`main`,{className:`flex-1`,children:[(0,f.jsx)(v,{}),(0,f.jsx)(h,{}),(0,f.jsx)(b,{}),(0,f.jsx)(p,{})]}),(0,f.jsx)(_,{})]}),e[1]=n):n=e[1],n}var w=C;export{w as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./link-Cgvqhh5w.js";import{n as i}from"./useRouterState-DpT8luFk.js";import{a,o,t as s}from"./api-base-url-DIb6qukm.js";import{n as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./theme-toggle-CdJo4s34.js";import{i as u,n as d}from"./auth-client-Dj6z7Pcl.js";import{t as f}from"./useQuery-jz7A3Y4u.js";import{f as p,s as m,u as h}from"./schemas-K0ZhTj23.js";import{G as g,H as _,W as v,z as y}from"./index-BZrWlEXZ.js";import{t as b}from"./input-DSkIbIFK.js";import{t as x}from"./label-CUY3W2yp.js";import{a as S,n as C,o as w,r as T,t as E}from"./card-CZCl7QNy.js";import{n as D,t as O}from"./zod-BgAmwIO1.js";import{t as k}from"./auth-bootstrap-query-KhD_VRw3.js";var A=e(t(),1),j=n(),M=h({email:m(`Please enter a valid email`),password:p().min(8,`Password must be at least 8 characters`)}),N=h({email:m(`Please enter a valid email`),name:p().min(2,`Name must be at least 2 characters`),password:p().min(8,`Password must be at least 8 characters`)}),P=N.extend({organizationName:p().min(2,`Organization name must be at least 2 characters`),organizationSlug:p().min(2,`Organization slug must be at least 2 characters`).regex(/^[a-z0-9-]+$/,`Organization slug can only contain lowercase letters, numbers, and hyphens`)}),F=a(`/signin`);function I(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,`-`).replaceAll(/^-|-$/g,``)}function L(e,t){if(!(e instanceof Error))return t;let n=e.message.trim();return n.length>0?n:t}async function R(e){let t=await e.json().catch(()=>null),n=h({error:p().optional(),message:p().optional()}).safeParse(t);return n.data?.error??n.data?.message??`Failed to complete bootstrap`}function z(){let e=o(),t=y(),n=i(),[a,m]=(0,A.useState)(`signin`),[z,B]=(0,A.useState)(!1),{redirect:V}=F.useSearch(),H=g(V),U=f(k()).data,W=U?.signupMode===`first-user`,G=W?`signup`:a,K=D({defaultValues:{email:``,password:``},resolver:O(M)}),q=D({defaultValues:{name:``,email:``,password:``},resolver:O(N)}),J=D({defaultValues:{email:``,name:``,organizationName:``,organizationSlug:``,password:``},resolver:O(P)}),Y=typeof window>`u`?`your-host`:window.location.host;async function X(t){B(!0);try{let r=await d.email({email:t.email,password:t.password});if(r.error){console.error(`[auth] sign-in failed`,{error:r.error}),K.setError(`root`,{message:r.error.message??`Invalid email or password`}),B(!1);return}await n.invalidate(),await e({to:H.path})}catch(e){console.error(`[auth] sign-in failed`,{error:e}),K.setError(`root`,{message:L(e,`Couldn't sign in right now. Try again.`)}),B(!1)}}async function Z(t){B(!0);try{let n=await u.email({email:t.email,name:t.name,password:t.password});if(n.error){console.error(`[auth] sign-up failed`,{error:n.error}),q.setError(`root`,{message:n.error.message??`Failed to create account`}),B(!1);return}await e({to:_(V)})}catch(e){console.error(`[auth] sign-up failed`,{error:e}),q.setError(`root`,{message:L(e,`Couldn't create your account right now. Try again.`)}),B(!1)}}async function Q(r){B(!0);try{let i=await fetch(`${s()}/api/bootstrap/complete`,{body:JSON.stringify(r),credentials:`include`,headers:{"content-type":`application/json`},method:`POST`});if(!i.ok){J.setError(`root`,{message:await R(i)}),B(!1);return}let a=h({bootstrap:h({organizationId:p().min(1)})}).safeParse(await i.json().catch(()=>null));if(!a.success){J.setError(`root`,{message:`Bootstrap completed, but the response was invalid`}),B(!1);return}let o=v({organizationId:a.data.bootstrap.organizationId,redirectPath:V});await t.invalidateQueries({queryKey:k().queryKey}),await n.invalidate({sync:!0}),await e({to:_(o)})}catch(e){console.error(`[auth] bootstrap failed`,{error:e}),J.setError(`root`,{message:L(e,`Couldn't finish setup right now. Try again.`)}),B(!1)}}function $(){W||(m(a===`signin`?`signup`:`signin`),K.reset(),q.reset())}let ee=J.watch(`organizationName`);return(0,j.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,j.jsxs)(`header`,{className:`flex h-14 items-center justify-between px-4 sm:px-6`,children:[(0,j.jsxs)(r,{to:`/`,className:`flex items-center gap-2`,children:[(0,j.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-md bg-foreground text-background font-bold`,children:`V`}),(0,j.jsx)(`span`,{className:`font-semibold text-base sm:text-lg`,children:`OneQuery`})]}),(0,j.jsx)(l,{})]}),(0,j.jsx)(`main`,{className:`flex flex-1 items-start justify-center px-4 pb-10 pt-12 sm:items-center sm:px-6 sm:py-6`,children:(0,j.jsxs)(E,{className:`w-full max-w-sm`,children:[(0,j.jsxs)(S,{className:`text-center`,children:[(0,j.jsx)(w,{className:`text-xl`,children:G===`signin`?`Sign in to OneQuery`:W?`Create the initial owner account`:`Create an account`}),(0,j.jsx)(T,{children:G===`signin`?`Enter your email and password to continue`:W?`Finish the first-run bootstrap by creating the owner account for this self-hosted server.`:U?.signupMode===`invite-only`?`Use the email address that received an invitation from your OneQuery admin.`:`Enter your details to get started`})]}),(0,j.jsx)(C,{children:G===`signin`?(0,j.jsxs)(`form`,{onSubmit:e=>{K.handleSubmit(X)(e)},className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`email`,children:`Email`}),(0,j.jsx)(b,{id:`email`,type:`email`,placeholder:`user@example.com`,autoComplete:`email`,...K.register(`email`)}),K.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`password`,children:`Password`}),(0,j.jsx)(b,{id:`password`,type:`password`,placeholder:`Enter your password`,autoComplete:`current-password`,...K.register(`password`)}),K.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.password.message})]}),K.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.root.message}),(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z,children:z?`Signing in...`:`Sign in`}),(0,j.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[U?.signupMode===`invite-only`?`Need an account? Ask an admin for an invitation, then use the invited email to sign up.`:`Don't have an account? `,U?.signupMode===`invite-only`?(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`I have an invitation`}):(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`Sign up`})]})]}):W?(0,j.jsxs)(`form`,{onSubmit:e=>{J.handleSubmit(Q)(e)},className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-name`,children:`Your name`}),(0,j.jsx)(b,{id:`bootstrap-name`,type:`text`,placeholder:`Jane Doe`,autoComplete:`name`,...J.register(`name`)}),J.formState.errors.name&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.name.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-email`,children:`Email`}),(0,j.jsx)(b,{id:`bootstrap-email`,type:`email`,placeholder:`owner@example.com`,autoComplete:`email`,...J.register(`email`)}),J.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-organization-name`,children:`Organization name`}),(0,j.jsx)(b,{id:`bootstrap-organization-name`,type:`text`,placeholder:`Acme Inc.`,...J.register(`organizationName`,{onChange:e=>{J.setValue(`organizationSlug`,I(e.target.value))}})}),J.formState.errors.organizationName&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.organizationName.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-organization-slug`,children:`URL slug`}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[Y,`/`]}),(0,j.jsx)(b,{id:`bootstrap-organization-slug`,placeholder:`acme`,...J.register(`organizationSlug`),className:`flex-1`})]}),J.formState.errors.organizationSlug&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.organizationSlug.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-password`,children:`Password`}),(0,j.jsx)(b,{id:`bootstrap-password`,type:`password`,placeholder:`Create a password`,autoComplete:`new-password`,...J.register(`password`)}),J.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.password.message})]}),J.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.root.message}),(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This setup screen is only available until the first owner account is created.`}),(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z||ee.trim().length===0,children:z?`Creating owner...`:`Create owner account`})]}):(0,j.jsxs)(`form`,{onSubmit:e=>{q.handleSubmit(Z)(e)},className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`name`,children:`Name`}),(0,j.jsx)(b,{id:`name`,type:`text`,placeholder:`John Doe`,autoComplete:`name`,...q.register(`name`)}),q.formState.errors.name&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.name.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`signup-email`,children:`Email`}),(0,j.jsx)(b,{id:`signup-email`,type:`email`,placeholder:`user@example.com`,autoComplete:`email`,...q.register(`email`)}),q.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`signup-password`,children:`Password`}),(0,j.jsx)(b,{id:`signup-password`,type:`password`,placeholder:`Create a password`,autoComplete:`new-password`,...q.register(`password`)}),q.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.password.message})]}),q.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.root.message}),U?.signupMode===`invite-only`?(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Account creation is limited to email addresses with a pending organization invitation.`}):null,(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z,children:z?`Creating account...`:W?`Create owner account`:`Create account`}),W?null:(0,j.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[`Already have an account?`,` `,(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`Sign in`})]})]})})]})})]})}var B=z;export{B as component};
|
|
@@ -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,n as a,t as o}from"./api-base-url-DIb6qukm.js";import{n as s,t as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./IconCheck-Gc24xPT2.js";import{n as u,r as d,t as f}from"./checkbox-BLYovhFU.js";import{t as p}from"./IconLoader2-CZSIppar.js";import{t as m}from"./IconX-Cg43mUxH.js";import{l as h}from"./app-routes-DM5pppqD.js";import{a as g,c as _,i as v,l as y,n as b,o as x,r as S,s as C,t as w,u as T}from"./use-optimistic-mutation-D88ezW6g.js";import{t as E}from"./useQuery-jz7A3Y4u.js";import{t as D}from"./useSuspenseQuery-BXj42YYV.js";import{f as O,g as k,s as A,u as j}from"./schemas-K0ZhTj23.js";import{n as M}from"./src-Cs2YIecp.js";import{a as N,r as P}from"./organization-permissions-PidGz2SY.js";import{L as F,S as I,b as ee,x as L,z as R}from"./index-BZrWlEXZ.js";import{t as te}from"./input-DSkIbIFK.js";import{n as z,r as B,t as V}from"./avatar-DoLsibq3.js";import{d as H,n as U,r as ne,t as re}from"./dropdown-menu-1lFANFIg.js";import{t as ie}from"./format-date-B5v-Ga9z.js";import{t as ae}from"./badge-D8XKsDus.js";import{t as oe}from"./label-CUY3W2yp.js";import{a as se,i as W,n as ce,o as G,r as K,t as le}from"./table-mA0t_uVk.js";import{i as ue,r as de,t as fe}from"./xstate-react.esm--l_MSO73.js";import{r as q}from"./api-paths-DcYkf-C_.js";import{n as pe,t as me}from"./zod-BgAmwIO1.js";var he=c(`outline`,`copy`,`Copy`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}]]),ge=c(`outline`,`user-edit`,`UserEdit`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h3.5`,key:`svg-1`}],[`path`,{d:`M18.42 15.61a2.1 2.1 0 0 1 2.97 2.97l-3.39 3.42h-3v-3l3.42 -3.39`,key:`svg-2`}]]),_e=c(`outline`,`user-plus`,`UserPlus`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M16 19h6`,key:`svg-1`}],[`path`,{d:`M19 16v6`,key:`svg-2`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h4`,key:`svg-3`}]]),J=r(),Y=n();function ve(e){switch(e){case`owner`:return`default`;case`admin`:return`secondary`;case`member`:return`outline`}}function ye(e){switch(e){case`owner`:return`Owner`;case`admin`:return`Admin`;case`member`:return`Member`}}function be(e){let t=(0,J.c)(7),{role:n}=e,r;t[0]===n?r=t[1]:(r=ve(n),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=ye(n),t[2]=n,t[3]=i);let a;return t[4]!==r||t[5]!==i?(a=(0,Y.jsx)(ae,{variant:r,children:i}),t[4]=r,t[5]=i,t[6]=a):a=t[6],a}function xe(e){let t=(0,J.c)(9),{roleNames:n,rawRole:r,emptyLabel:i}=e;if(n.length===0){let e;t[0]!==i||t[1]!==r?(e=r?.trim()||i,t[0]=i,t[1]=r,t[2]=e):e=t[2];let n=e,a;return t[3]===n?a=t[4]:(a=n?(0,Y.jsx)(ae,{variant:`outline`,children:n}):null,t[3]=n,t[4]=a),a}let a;t[5]===n?a=t[6]:(a=n.map(Se),t[5]=n,t[6]=a);let o;return t[7]===a?o=t[8]:(o=(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:a}),t[7]=a,t[8]=o),o}function Se(e){return(0,Y.jsx)(be,{role:e},e)}var Ce=j({expiresAt:k().optional(),id:O(),role:O().optional()}),we=j({id:O(),role:O()}),Te=j({member:we});async function Ee(e,t){if((e.headers.get(`content-type`)??``).includes(`application/json`)){let n=await e.json().catch(()=>null),r=j({code:O().optional(),error:O().optional(),message:O().optional()}).safeParse(n);if(r.success)return r.data.error??r.data.message??t}return await e.text().catch(()=>``)||t}async function X(e){let t=await fetch(`${o()}${e.path}`,{body:e.body?JSON.stringify(e.body):void 0,credentials:`include`,headers:{"Content-Type":`application/json`},method:e.method});if(!t.ok)throw Error(await Ee(t,e.errorMessage));let n=await t.json().catch(()=>null),r=e.successSchema.safeParse(n);if(!r.success)throw Error(e.errorMessage);return r.data}async function De(e){return X({body:{email:e.email,role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to create invitation link`,method:`POST`,path:q(e.organizationId,`invitations`),successSchema:Ce})}async function Oe(e){return X({errorMessage:`Failed to cancel invitation`,method:`DELETE`,path:q(e.organizationId,`invitations`,e.invitationId),successSchema:Ce})}async function ke(e){return X({body:{role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to update role`,method:`PATCH`,path:q(e.organizationId,`members`,e.memberId,`role`),successSchema:we})}async function Ae(e){return X({errorMessage:`Failed to remove member`,method:`DELETE`,path:q(e.organizationId,`members`,e.memberId),successSchema:Te})}function je(e){let t=Date.parse(e)-Date.now();if(t<0)return`Expired`;let n=Math.floor(t/(1e3*60*60*24)),r=Math.floor(t%(1e3*60*60*24)/(1e3*60*60));return n>0?`Expires in ${n}d`:r>0?`Expires in ${r}h`:`Expires soon`}function Me(e){let t=(0,J.c)(31),{invitation:n,currentUserId:r,organizationId:i,canManageInvitationMutations:a}=e,o=n.id,c;t[0]!==n.id||t[1]!==i?(c=async()=>{await Oe({invitationId:n.id,organizationId:i})},t[0]=n.id,t[1]=i,t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==n.organizationId?(l=ee(r,n.organizationId),t[3]=r,t[4]=n.organizationId,t[5]=l):l=t[5];let u;t[6]!==n.id||t[7]!==c||t[8]!==l.queryKey?(u={errorMessage:`Failed to cancel invitation`,itemId:o,mutationFn:c,queryKey:l.queryKey,successMessage:`Invitation cancelled`},t[6]=n.id,t[7]=c,t[8]=l.queryKey,t[9]=u):u=t[9];let d=b(u),f=n.expiresAt?Date.parse(n.expiresAt)<Date.now():!1,h;t[10]===n.email?h=t[11]:(h=(0,Y.jsx)(K,{children:(0,Y.jsx)(`span`,{className:`font-medium`,children:n.email})}),t[10]=n.email,t[11]=h);let g;t[12]!==n.rawRole||t[13]!==n.roleNames?(g=(0,Y.jsx)(K,{children:(0,Y.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole,emptyLabel:`Member`})}),t[12]=n.rawRole,t[13]=n.roleNames,t[14]=g):g=t[14];let _=f?`text-destructive`:`text-muted-foreground`,v;t[15]===n.expiresAt?v=t[16]:(v=n.expiresAt?je(n.expiresAt):`Pending`,t[15]=n.expiresAt,t[16]=v);let y;t[17]!==_||t[18]!==v?(y=(0,Y.jsx)(K,{children:(0,Y.jsx)(`span`,{className:_,children:v})}),t[17]=_,t[18]=v,t[19]=y):y=t[19];let x;t[20]!==a||t[21]!==d||t[22]!==f?(x=a&&!f&&(0,Y.jsx)(s,{variant:`ghost`,size:`icon-sm`,onClick:()=>d.mutate(),disabled:d.isPending,title:`Cancel invitation`,children:d.isPending?(0,Y.jsx)(p,{size:16,className:`animate-spin`}):(0,Y.jsx)(m,{size:16,stroke:2})}),t[20]=a,t[21]=d,t[22]=f,t[23]=x):x=t[23];let S;t[24]===x?S=t[25]:(S=(0,Y.jsx)(K,{className:`text-right`,children:x}),t[24]=x,t[25]=S);let C;return t[26]!==S||t[27]!==h||t[28]!==g||t[29]!==y?(C=(0,Y.jsxs)(G,{children:[h,g,y,S]}),t[26]=S,t[27]=h,t[28]=g,t[29]=y,t[30]=C):C=t[30],C}function Ne(e){let t=(0,J.c)(31),{currentUserId:n,organizationId:r,canManageInvitationMutations:i}=e,a;t[0]!==n||t[1]!==r?(a=ee(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=E(a);if(o.isPending){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`Loading invitations...`}),t[3]=e):e=t[3],e}if(o.isLoadingError){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-destructive`,children:`Failed to load invitations.`}),t[4]=e):e=t[4],e}let s=o.data,c,l,u,d,f,p;if(t[5]!==i||t[6]!==n||t[7]!==s||t[8]!==r){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=s.filter(Pe);if(e.length===0){let e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No pending invitations.`}),t[15]=e):e=t[15],p=e;break bb0}f=`rounded-md border`,l=le,t[16]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(se,{children:(0,Y.jsxs)(G,{children:[(0,Y.jsx)(W,{children:`Email`}),(0,Y.jsx)(W,{children:`Role`}),(0,Y.jsx)(W,{children:`Status`}),(0,Y.jsx)(W,{className:`text-right w-[50px]`})]})}),t[16]=d):d=t[16],c=ce;let a;t[17]!==i||t[18]!==n||t[19]!==r?(a=e=>(0,Y.jsx)(Me,{invitation:e,currentUserId:n,organizationId:r,canManageInvitationMutations:i},e.id),t[17]=i,t[18]=n,t[19]=r,t[20]=a):a=t[20],u=e.map(a)}t[5]=i,t[6]=n,t[7]=s,t[8]=r,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f,t[14]=p}else c=t[9],l=t[10],u=t[11],d=t[12],f=t[13],p=t[14];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[21]!==c||t[22]!==u?(m=(0,Y.jsx)(c,{children:u}),t[21]=c,t[22]=u,t[23]=m):m=t[23];let h;t[24]!==l||t[25]!==d||t[26]!==m?(h=(0,Y.jsxs)(l,{children:[d,m]}),t[24]=l,t[25]=d,t[26]=m,t[27]=h):h=t[27];let g;return t[28]!==f||t[29]!==h?(g=(0,Y.jsx)(`div`,{className:f,children:h}),t[28]=f,t[29]=h,t[30]=g):g=t[30],g}function Pe(e){return e.status===`pending`}var Z=e(t(),1);function Fe(e){let t=(0,J.c)(11),{value:n,className:r}=e,[i,a]=(0,Z.useState)(!1),o,c;t[0]===i?(o=t[1],c=t[2]):(o=()=>{if(!i)return;let e=setTimeout(()=>{a(!1)},2e3);return()=>clearTimeout(e)},c=[i],t[0]=i,t[1]=o,t[2]=c),(0,Z.useEffect)(o,c);let u;t[3]===n?u=t[4]:(u=()=>{navigator.clipboard.writeText(n),a(!0)},t[3]=n,t[4]=u);let d=u,f;t[5]===i?f=t[6]:(f=i?(0,Y.jsx)(l,{size:16,stroke:2}):(0,Y.jsx)(he,{size:16,stroke:2}),t[5]=i,t[6]=f);let p;return t[7]!==r||t[8]!==d||t[9]!==f?(p=(0,Y.jsx)(s,{type:`button`,variant:`outline`,size:`icon`,onClick:d,title:`Copy`,className:r,children:f}),t[7]=r,t[8]=d,t[9]=f,t[10]=p):p=t[10],p}var Ie=[`admin`,`member`],Le=[{label:`Admin`,value:`admin`},{label:`Member`,value:`member`}],Re=[`member`],Q={RESET:`teamRoleSelection/reset`,SOURCE_ROLE_NAMES_SYNCED:`teamRoleSelection/sourceRoleNamesSynced`,TOGGLE_ROLE:`teamRoleSelection/toggleRole`},$={CLEAN:`clean`,DIRTY:`dirty`,EVALUATING:`evaluating`},ze={DIRTY:`dirty`};function Be(e){let t=new Set;for(let n of e)(n===`admin`||n===`member`)&&t.add(n);return Ie.filter(e=>t.has(e))}function Ve(e){let t=Be(e);return{selectedRoleNames:[...t],sourceRoleNames:[...t]}}var He=de({actions:{resetSelectedRoleNames:ue({selectedRoleNames:({context:e})=>[...e.sourceRoleNames]}),syncSourceRoleNames:ue({selectedRoleNames:(e,t)=>[...t.roleNames],sourceRoleNames:(e,t)=>[...t.roleNames]}),toggleRoleName:ue({selectedRoleNames:({context:e},t)=>{let n=new Set(e.selectedRoleNames);return n.has(t.roleName)?n.delete(t.roleName):n.add(t.roleName),Ie.filter(e=>n.has(e))}})},guards:{hasRoleSelectionChanges:({context:e})=>N(e.selectedRoleNames)!==N(e.sourceRoleNames)},types:{}}).createMachine({context:({input:e})=>Ve(e.initialRoleNames),id:`teamRoleSelection`,initial:$.EVALUATING,on:{[Q.RESET]:{actions:`resetSelectedRoleNames`,target:`.${$.EVALUATING}`},[Q.SOURCE_ROLE_NAMES_SYNCED]:{actions:{type:`syncSourceRoleNames`,params:({event:e})=>({roleNames:Be(e.roleNames)})},target:`.${$.EVALUATING}`},[Q.TOGGLE_ROLE]:{actions:{type:`toggleRoleName`,params:({event:e})=>({roleName:e.roleName})},target:`.${$.EVALUATING}`}},states:{[$.EVALUATING]:{always:[{guard:`hasRoleSelectionChanges`,target:$.DIRTY},{target:$.CLEAN}]},[$.CLEAN]:{},[$.DIRTY]:{tags:ze.DIRTY}}});function Ue(e){let t=(0,J.c)(19),n;t[0]===e.initialRoleNames?n=t[1]:(n=Be(e.initialRoleNames),t[0]=e.initialRoleNames,t[1]=n);let r;t[2]===n?r=t[3]:(r={input:{initialRoleNames:n}},t[2]=n,t[3]=r);let[i,a]=fe(He,r),o;t[4]===i?o=t[5]:(o=i.hasTag(ze.DIRTY),t[4]=i,t[5]=o);let s=i.context.selectedRoleNames.length===0,c;t[6]===a?c=t[7]:(c=()=>{a({type:Q.RESET})},t[6]=a,t[7]=c);let l=c,u;t[8]===a?u=t[9]:(u=e=>{a({type:Q.SOURCE_ROLE_NAMES_SYNCED,roleNames:e})},t[8]=a,t[9]=u);let d=u,f;t[10]===a?f=t[11]:(f=e=>{a({type:Q.TOGGLE_ROLE,roleName:e})},t[10]=a,t[11]=f);let p=f,m;return t[12]!==i.context.selectedRoleNames||t[13]!==o||t[14]!==s||t[15]!==l||t[16]!==d||t[17]!==p?(m={hasChanges:o,isSelectionEmpty:s,reset:l,resetToRoleNames:d,selectedRoleNames:i.context.selectedRoleNames,toggleRole:p},t[12]=i.context.selectedRoleNames,t[13]=o,t[14]=s,t[15]=l,t[16]=d,t[17]=p,t[18]=m):m=t[18],m}function We(e){return e instanceof HTMLElement&&e.closest(`[data-slot="checkbox"]`)!==null}function Ge(e){let t=(0,J.c)(12),{errorMessage:n,helperText:r,onToggleRole:i,selectedRoleNames:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsx)(oe,{children:`Roles`}),t[0]=o):o=t[0];let s;t[1]!==i||t[2]!==a?(s=Le.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 rounded-md border px-3 py-2 text-left hover:bg-accent/40`,onClick:t=>{We(t.target)||i(e.value)},children:[(0,Y.jsx)(f,{checked:a.includes(e.value),onCheckedChange:()=>i(e.value)}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`p`,{className:`font-medium`,children:e.label})})]},e.value)),t[1]=i,t[2]=a,t[3]=s):s=t[3];let c;t[4]===s?c=t[5]:(c=(0,Y.jsx)(`div`,{className:`space-y-2`,children:s}),t[4]=s,t[5]=c);let l;t[6]!==n||t[7]!==r?(l=n?(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:n}):(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r}),t[6]=n,t[7]=r,t[8]=l):l=t[8];let u;return t[9]!==c||t[10]!==l?(u=(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[o,c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11],u}var Ke=j({email:A(`Please enter a valid email address`)});function qe(e){let t=(0,J.c)(44),{children:n,currentUserId:r,organizationId:i}=e,[o,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={initialRoleNames:Re},t[0]=p):p=t[0];let m=Ue(p),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b={defaultValues:{email:``},resolver:me(Ke)},t[1]=b):b=t[1];let T=pe(b),E;t[2]===i?E=t[3]:(E=e=>({id:`temp-${crypto.randomUUID()}`,email:e.email,rawRole:N(e.roleNames),roleNames:[...e.roleNames],status:`pending`,expiresAt:M().toISOString(),organizationId:i,inviterId:`current-user`}),t[2]=i,t[3]=E);let D;t[4]===i?D=t[5]:(D=async e=>De({email:e.email,organizationId:i,roleNames:e.roleNames}),t[4]=i,t[5]=D);let O;t[6]!==T||t[7]!==m?(O=e=>{e?.id&&u({expiresAt:e.expiresAt??M().toISOString(),url:`${a()}${h(e.id)}`}),T.reset(),m.reset(),f(null)},t[6]=T,t[7]=m,t[8]=O):O=t[8];let k;t[9]!==r||t[10]!==i?(k=ee(r,i),t[9]=r,t[10]=i,t[11]=k):k=t[11];let A;t[12]!==E||t[13]!==D||t[14]!==O||t[15]!==k.queryKey?(A={createOptimisticItem:E,errorMessage:`Failed to create invitation link`,mutationFn:D,onSuccess:O,queryKey:k.queryKey,successMessage:`Invitation link created`},t[12]=E,t[13]=D,t[14]=O,t[15]=k.queryKey,t[16]=A):A=t[16];let j=w(A),P;t[17]!==j||t[18]!==m.isSelectionEmpty||t[19]!==m.selectedRoleNames?(P=e=>{if(m.isSelectionEmpty){f(`Select at least one role`);return}j.mutate({...e,roleNames:m.selectedRoleNames})},t[17]=j,t[18]=m.isSelectionEmpty,t[19]=m.selectedRoleNames,t[20]=P):P=t[20];let F=P,I;t[21]!==T||t[22]!==m?(I=e=>{c(e),e||(u(null),f(null),m.reset(),T.reset())},t[21]=T,t[22]=m,t[23]=I):I=t[23];let L=I,R;t[24]!==d||t[25]!==m?(R=e=>{d&&f(null),m.toggleRole(e)},t[24]=d,t[25]=m,t[26]=R):R=t[26];let z=R,B;t[27]===n?B=t[28]:(B=(0,Y.jsx)(y,{render:n}),t[27]=n,t[28]=B);let V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Y.jsxs)(C,{children:[(0,Y.jsx)(_,{children:`Create Invitation Link`}),(0,Y.jsx)(g,{children:`Create a shareable invitation link for this organization. The recipient will sign in with an existing account or create their own before accepting.`})]}),t[29]=V):V=t[29];let H;t[30]!==T||t[31]!==z||t[32]!==l||t[33]!==j||t[34]!==F||t[35]!==d||t[36]!==m.isSelectionEmpty||t[37]!==m.selectedRoleNames?(H=(0,Y.jsxs)(v,{className:`sm:max-w-[400px]`,children:[V,l?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`space-y-2 pt-4`,children:[(0,Y.jsx)(oe,{children:`Invitation Link`}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(te,{value:l.url,readOnly:!0,className:`flex-1 text-sm`}),(0,Y.jsx)(Fe,{value:l.url})]}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Share this link with the invitee. They'll accept it after signing in or creating an account. The link expires on`,` `,ie(l.expiresAt),`.`]})]}),(0,Y.jsxs)(x,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>u(null),children:`Create Another Link`}),(0,Y.jsx)(s,{type:`button`,onClick:()=>c(!1),children:`Done`})]})]}):(0,Y.jsxs)(`form`,{onSubmit:e=>{T.handleSubmit(F)(e)},className:`space-y-4 pt-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(oe,{htmlFor:`email`,children:`Email Address`}),(0,Y.jsx)(te,{id:`email`,type:`email`,placeholder:`colleague@example.com`,...T.register(`email`)}),T.formState.errors.email&&(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:T.formState.errors.email.message})]}),(0,Y.jsx)(Ge,{errorMessage:d,helperText:`Select one or more roles for this invitation.`,onToggleRole:z,selectedRoleNames:m.selectedRoleNames}),(0,Y.jsxs)(x,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>c(!1),children:`Cancel`}),(0,Y.jsx)(s,{type:`submit`,disabled:j.isPending||m.isSelectionEmpty,children:j.isPending?`Creating Link...`:`Create Invitation Link`})]})]})]}),t[30]=T,t[31]=z,t[32]=l,t[33]=j,t[34]=F,t[35]=d,t[36]=m.isSelectionEmpty,t[37]=m.selectedRoleNames,t[38]=H):H=t[38];let U;return t[39]!==L||t[40]!==o||t[41]!==B||t[42]!==H?(U=(0,Y.jsxs)(S,{open:o,onOpenChange:L,children:[B,H]}),t[39]=L,t[40]=o,t[41]=B,t[42]=H,t[43]=U):U=t[43],U}function Je({currentUserId:e,open:t,onOpenChange:n,member:r}){let i=R(),a=(0,Z.useMemo)(()=>Be(r.roleNames),[N(r.roleNames)]),o=Ue({initialRoleNames:a});(0,Z.useEffect)(()=>{t&&o.resetToRoleNames(a)},[a,r.id,t,o.resetToRoleNames]);let c=T({mutationFn:async()=>{await ke({memberId:r.id,organizationId:r.organizationId,roleNames:o.selectedRoleNames})},onError:e=>{F.error(e.message||`Failed to update role`)},onSuccess:()=>{F.success(`Role updated`),i.invalidateQueries({queryKey:L(e,r.organizationId).queryKey}),n(!1)}});return(0,Y.jsx)(S,{open:t,onOpenChange:n,children:(0,Y.jsxs)(v,{className:`sm:max-w-[400px]`,children:[(0,Y.jsxs)(C,{children:[(0,Y.jsx)(_,{children:`Change Role`}),(0,Y.jsxs)(g,{children:[`Update the role for `,r.user.name]})]}),(0,Y.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),!o.hasChanges){n(!1);return}c.mutate()},className:`space-y-4 pt-4`,children:[(0,Y.jsx)(Ge,{helperText:`Select one or more roles for this member.`,onToggleRole:o.toggleRole,selectedRoleNames:o.selectedRoleNames}),(0,Y.jsxs)(x,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Y.jsx)(s,{type:`submit`,disabled:c.isPending||o.isSelectionEmpty,children:c.isPending?`Updating...`:`Update Role`})]})]})]})})}function Ye(e){return e.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2)}function Xe(e){let t=(0,J.c)(51),{member:n,currentUserId:r,canManageMemberMutations:i}=e,[a,o]=(0,Z.useState)(!1),c=n.userId===r,l;t[0]===n.rawRole?l=t[1]:(l=P({roleName:`owner`,rawRole:n.rawRole}),t[0]=n.rawRole,t[1]=l);let f=l,p=n.id,m;t[2]!==n.id||t[3]!==n.organizationId?(m=async()=>{await Ae({memberId:n.id,organizationId:n.organizationId})},t[2]=n.id,t[3]=n.organizationId,t[4]=m):m=t[4];let h;t[5]!==r||t[6]!==n.organizationId?(h=L(r,n.organizationId),t[5]=r,t[6]=n.organizationId,t[7]=h):h=t[7];let g;t[8]!==n.id||t[9]!==m||t[10]!==h.queryKey?(g={errorMessage:`Failed to remove member`,itemId:p,mutationFn:m,queryKey:h.queryKey,successMessage:`Member removed`},t[8]=n.id,t[9]=m,t[10]=h.queryKey,t[11]=g):g=t[11];let _=b(g),v=i&&!f&&!c,y=i&&!f&&!c,x;t[12]===n.user.image?x=t[13]:(x=n.user.image&&(0,Y.jsx)(B,{src:n.user.image}),t[12]=n.user.image,t[13]=x);let S;t[14]===n.user.name?S=t[15]:(S=Ye(n.user.name),t[14]=n.user.name,t[15]=S);let C;t[16]===S?C=t[17]:(C=(0,Y.jsx)(z,{children:S}),t[16]=S,t[17]=C);let w;t[18]!==x||t[19]!==C?(w=(0,Y.jsxs)(V,{size:`sm`,children:[x,C]}),t[18]=x,t[19]=C,t[20]=w):w=t[20];let T;t[21]===n.user.name?T=t[22]:(T=(0,Y.jsx)(`div`,{className:`font-medium`,children:n.user.name}),t[21]=n.user.name,t[22]=T);let E;t[23]===n.user.email?E=t[24]:(E=(0,Y.jsx)(`div`,{className:`text-muted-foreground text-sm`,children:n.user.email}),t[23]=n.user.email,t[24]=E);let D;t[25]!==T||t[26]!==E?(D=(0,Y.jsxs)(`div`,{children:[T,E]}),t[25]=T,t[26]=E,t[27]=D):D=t[27];let O;t[28]!==D||t[29]!==w?(O=(0,Y.jsx)(K,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[w,D]})}),t[28]=D,t[29]=w,t[30]=O):O=t[30];let k;t[31]!==n.rawRole||t[32]!==n.roleNames?(k=(0,Y.jsx)(K,{children:(0,Y.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole})}),t[31]=n.rawRole,t[32]=n.roleNames,t[33]=k):k=t[33];let A;t[34]!==v||t[35]!==y||t[36]!==_?(A=(v||y)&&(0,Y.jsxs)(re,{children:[(0,Y.jsx)(H,{children:(0,Y.jsx)(s,{variant:`ghost`,size:`icon-sm`,children:(0,Y.jsx)(d,{size:16,stroke:2})})}),(0,Y.jsxs)(U,{align:`end`,children:[v&&(0,Y.jsxs)(ne,{onClick:()=>o(!0),children:[(0,Y.jsx)(ge,{size:16,stroke:2}),`Change Role`]}),y&&(0,Y.jsxs)(ne,{onClick:()=>_.mutate(),disabled:_.isPending,className:`text-destructive focus:text-destructive`,children:[(0,Y.jsx)(u,{size:16,stroke:2}),_.isPending?`Removing...`:`Remove`]})]})]}),t[34]=v,t[35]=y,t[36]=_,t[37]=A):A=t[37];let j;t[38]===A?j=t[39]:(j=(0,Y.jsx)(K,{className:`text-right`,children:A}),t[38]=A,t[39]=j);let M;t[40]!==O||t[41]!==k||t[42]!==j?(M=(0,Y.jsxs)(G,{children:[O,k,j]}),t[40]=O,t[41]=k,t[42]=j,t[43]=M):M=t[43];let N;t[44]!==r||t[45]!==n||t[46]!==a?(N=(0,Y.jsx)(Je,{open:a,onOpenChange:o,currentUserId:r,member:n}),t[44]=r,t[45]=n,t[46]=a,t[47]=N):N=t[47];let F;return t[48]!==M||t[49]!==N?(F=(0,Y.jsxs)(Y.Fragment,{children:[M,N]}),t[48]=M,t[49]=N,t[50]=F):F=t[50],F}function Ze(e){let t=(0,J.c)(11),{members:n,currentUserId:r,canManageMemberMutations:i}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No members found.`}),t[0]=e):e=t[0],e}let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(se,{children:(0,Y.jsxs)(G,{children:[(0,Y.jsx)(W,{children:`Member`}),(0,Y.jsx)(W,{children:`Role`}),(0,Y.jsx)(W,{className:`text-right w-[50px]`})]})}),t[1]=a):a=t[1];let o;if(t[2]!==i||t[3]!==r||t[4]!==n){let e;t[6]!==i||t[7]!==r?(e=e=>(0,Y.jsx)(Xe,{member:e,currentUserId:r,canManageMemberMutations:i},e.id),t[6]=i,t[7]=r,t[8]=e):e=t[8],o=n.map(e),t[2]=i,t[3]=r,t[4]=n,t[5]=o}else o=t[5];let s;return t[9]===o?s=t[10]:(s=(0,Y.jsx)(`div`,{className:`rounded-md border`,children:(0,Y.jsxs)(le,{children:[a,(0,Y.jsx)(ce,{children:o})]})}),t[9]=o,t[10]=s),s}var Qe=i(`/_authenticated/$org_slug/team`);function $e(e){let t=(0,J.c)(27),n;t[0]!==e.currentUserId||t[1]!==e.organizationId?(n=L(e.currentUserId,e.organizationId),t[0]=e.currentUserId,t[1]=e.organizationId,t[2]=n):n=t[2];let{data:r}=D(n),i;t[3]!==r||t[4]!==e.currentUserId?(i=I({currentUserId:e.currentUserId,members:r}),t[3]=r,t[4]=e.currentUserId,t[5]=i):i=t[5];let{canInviteMembers:a,canManageMembershipMutations:o,canReadInvitations:c}=i,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Members`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`People who have access to this organization. Invite teammates to let them join with their own account.`})]}),t[6]=l):l=t[6];let u;t[7]!==a||t[8]!==o||t[9]!==e.currentUserId||t[10]!==e.organizationId?(u=a?(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:o?(0,Y.jsx)(qe,{currentUserId:e.currentUserId,organizationId:e.organizationId,children:(0,Y.jsxs)(s,{children:[(0,Y.jsx)(_e,{size:16,stroke:2}),`Create Invitation Link`]})}):null}):null,t[7]=a,t[8]=o,t[9]=e.currentUserId,t[10]=e.organizationId,t[11]=u):u=t[11];let d;t[12]===u?d=t[13]:(d=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[l,u]}),t[12]=u,t[13]=d);let f;t[14]!==o||t[15]!==r||t[16]!==e.currentUserId?(f=(0,Y.jsx)(Ze,{members:r,currentUserId:e.currentUserId,canManageMemberMutations:o}),t[14]=o,t[15]=r,t[16]=e.currentUserId,t[17]=f):f=t[17];let p;t[18]!==o||t[19]!==c||t[20]!==e.currentUserId||t[21]!==e.organizationId?(p=c?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold mb-2`,children:`Pending Invitations`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:`Invitations that haven't been accepted yet.`}),(0,Y.jsx)(Ne,{currentUserId:e.currentUserId,organizationId:e.organizationId,canManageInvitationMutations:o})]}):null,t[18]=o,t[19]=c,t[20]=e.currentUserId,t[21]=e.organizationId,t[22]=p):p=t[22];let m;return t[23]!==d||t[24]!==f||t[25]!==p?(m=(0,Y.jsxs)(`div`,{className:`space-y-8`,children:[d,f,p]}),t[23]=d,t[24]=f,t[25]=p,t[26]=m):m=t[26],m}function et(){let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsxs)(`div`,{className:`mb-8`,children:[(0,Y.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Team`}),(0,Y.jsx)(`p`,{className:`text-muted-foreground mt-2`,children:`Manage your members and create invitation links for new teammates.`})]}),e[0]=t):t=e[0],t}function tt(){let e=(0,J.c)(4),{organizationId:t,session:n}=Qe.useRouteContext(),r=n.user.id,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(et,{}),e[0]=i):i=e[0];let a;return e[1]!==r||e[2]!==t?(a=(0,Y.jsxs)(`div`,{className:`p-8`,children:[i,(0,Y.jsx)($e,{organizationId:t,currentUserId:r})]}),e[1]=r,e[2]=t,e[3]=a):a=e[3],a}var nt=tt;export{nt as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./compiler-runtime-DCc3R3Xn.js";import{n,t as r}from"./createReactComponent-_L2mp4Ui.js";import{R as i}from"./index-
|
|
1
|
+
import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./compiler-runtime-DCc3R3Xn.js";import{n,t as r}from"./createReactComponent-_L2mp4Ui.js";import{R as i}from"./index-BZrWlEXZ.js";import{a,d as o,i as s,n as c,t as l}from"./dropdown-menu-1lFANFIg.js";var u=r(`outline`,`device-desktop`,`DeviceDesktop`,[[`path`,{d:`M3 5a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-10`,key:`svg-0`}],[`path`,{d:`M7 20h10`,key:`svg-1`}],[`path`,{d:`M9 16v4`,key:`svg-2`}],[`path`,{d:`M15 16v4`,key:`svg-3`}]]),d=r(`outline`,`moon`,`Moon`,[[`path`,{d:`M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454l0 .008`,key:`svg-0`}]]),f=r(`outline`,`sun`,`Sun`,[[`path`,{d:`M8 12a4 4 0 1 0 8 0a4 4 0 1 0 -8 0`,key:`svg-0`}],[`path`,{d:`M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7`,key:`svg-1`}]]),p=t(),m=e();function h(){let e=(0,p.c)(8),{theme:t,setTheme:r}=i(),h;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,m.jsx)(n,{variant:`ghost`,size:`icon`}),e[0]=h):h=e[0];let g;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,m.jsxs)(o,{render:h,"aria-label":`Toggle theme`,children:[(0,m.jsx)(f,{size:16,stroke:2,className:`rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,m.jsx)(d,{size:16,stroke:2,className:`absolute rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`})]}),e[1]=g):g=e[1];let _;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,m.jsxs)(a,{value:`light`,children:[(0,m.jsx)(f,{size:16,stroke:2,className:`mr-2`}),`Light`]}),e[2]=_):_=e[2];let v;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,m.jsxs)(a,{value:`dark`,children:[(0,m.jsx)(d,{size:16,stroke:2,className:`mr-2`}),`Dark`]}),e[3]=v):v=e[3];let y;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,m.jsxs)(a,{value:`system`,children:[(0,m.jsx)(u,{size:16,stroke:2,className:`mr-2`}),`System`]}),e[4]=y):y=e[4];let b;return e[5]!==r||e[6]!==t?(b=(0,m.jsxs)(l,{children:[g,(0,m.jsx)(c,{align:`end`,children:(0,m.jsxs)(s,{value:t,onValueChange:r,children:[_,v,y]})})]}),e[5]=r,e[6]=t,e[7]=b):b=e[7],b}export{h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,g as a,n as o,o as s,y as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./utils-C8DGLIgm.js";import{t as u}from"./IconX-Cg43mUxH.js";import{A as d,E as f,T as p,b as m,m as h,o as g}from"./removable-DwbP0VJV.js";import{_,c as v,l as y}from"./getDisabledMountTransitionStyles-f3pOCbyk.js";import{t as b}from"./useBaseUiId-Cn1kR417.js";import{c as x}from"./getPseudoElementBounds-BpCtHFAC.js";import{B as S,L as C,z as w}from"./index-
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,g as a,n as o,o as s,y as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./utils-C8DGLIgm.js";import{t as u}from"./IconX-Cg43mUxH.js";import{A as d,E as f,T as p,b as m,m as h,o as g}from"./removable-DwbP0VJV.js";import{_,c as v,l as y}from"./getDisabledMountTransitionStyles-f3pOCbyk.js";import{t as b}from"./useBaseUiId-Cn1kR417.js";import{c as x}from"./getPseudoElementBounds-BpCtHFAC.js";import{B as S,L as C,z as w}from"./index-BZrWlEXZ.js";import{a as T,c as E,i as D,n as O,o as k,r as A,s as j,t as M}from"./DialogTitle-DSjY6Xud.js";var N=class extends d{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),p(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&h(t.mutationKey)!==h(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??S();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){g.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},P=e(t(),1);function F(e,t){let n=w(t),[r]=P.useState(()=>new N(n,e));P.useEffect(()=>{r.setOptions(e)},[r,e]);let i=P.useSyncExternalStore(P.useCallback(e=>r.subscribe(g.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=P.useCallback((e,t)=>{r.mutate(e,t).catch(m)},[r]);if(i.error&&f(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var I=P.forwardRef(function(e,t){let{render:n,className:r,disabled:o=!1,nativeButton:l=!0,id:u,payload:d,handle:f,...p}=e,m=E(!0),h=f?.store??m?.store;if(!h)throw Error(c(79));let g=b(u),S=h.useState(`floatingRootContext`),C=h.useState(`isOpenedByTrigger`,g),w=P.useRef(null),{registerTrigger:T,isMountedByThisTrigger:D}=_(g,w,h,{payload:d}),{getButtonProps:O,buttonRef:k}=a({disabled:o,native:l}),A=y([x(S,{enabled:S!=null})]),j=P.useMemo(()=>({disabled:o,open:C}),[o,C]),M=h.useState(`triggerProps`,D);return i(`button`,e,{state:j,ref:[k,t,T,w],props:[A.getReferenceProps(),M,{[s]:``,id:g},p,O],stateAttributesMapping:v})}),L=r(),R=n();function z(e){let t=(0,L.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,R.jsx)(O,{"data-slot":`dialog`,...n}),t[2]=n,t[3]=r),r}function B(e){let t=(0,L.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,R.jsx)(I,{"data-slot":`dialog-trigger`,...n}),t[2]=n,t[3]=r),r}function V(e){let t=(0,L.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,R.jsx)(A,{"data-slot":`dialog-portal`,...n}),t[2]=n,t[3]=r),r}function H(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(j,{"data-slot":`dialog-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function U(e){let t=(0,L.c)(20),n,r,i,a,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5]):({className:r,children:n,showCloseButton:s,overlayClassName:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s);let c=s===void 0?!0:s,d;t[6]===i?d=t[7]:(d=(0,R.jsx)(H,{className:i}),t[6]=i,t[7]=d);let f;t[8]===r?f=t[9]:(f=l(`bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-xl p-4 text-sm ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none`,r),t[8]=r,t[9]=f);let p;t[10]===c?p=t[11]:(p=c&&(0,R.jsxs)(k,{"data-slot":`dialog-close`,render:(0,R.jsx)(o,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,R.jsx)(u,{}),(0,R.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[10]=c,t[11]=p);let m;t[12]!==n||t[13]!==a||t[14]!==f||t[15]!==p?(m=(0,R.jsxs)(D,{"data-slot":`dialog-content`,className:f,...a,children:[n,p]}),t[12]=n,t[13]=a,t[14]=f,t[15]=p,t[16]=m):m=t[16];let h;return t[17]!==d||t[18]!==m?(h=(0,R.jsxs)(V,{children:[d,m]}),t[17]=d,t[18]=m,t[19]=h):h=t[19],h}function W(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`gap-2 flex flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(`div`,{"data-slot":`dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function G(e){let t=(0,L.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,showCloseButton:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let s=a===void 0?!1:a,c;t[5]===r?c=t[6]:(c=l(`bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,r),t[5]=r,t[6]=c);let u;t[7]===s?u=t[8]:(u=s&&(0,R.jsx)(k,{render:(0,R.jsx)(o,{variant:`outline`}),children:`Close`}),t[7]=s,t[8]=u);let d;return t[9]!==n||t[10]!==i||t[11]!==c||t[12]!==u?(d=(0,R.jsxs)(`div`,{"data-slot":`dialog-footer`,className:c,...i,children:[n,u]}),t[9]=n,t[10]=i,t[11]=c,t[12]=u,t[13]=d):d=t[13],d}function K(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`text-sm leading-none font-medium`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(M,{"data-slot":`dialog-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function q(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(T,{"data-slot":`dialog-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function J(e){let t=(0,L.c)(27),{mutationFn:n,queryKey:r,optimisticUpdate:i,onSuccess:a,onError:o,successMessage:s,errorMessage:c}=e,l=w(),u;t[0]!==c||t[1]!==o||t[2]!==l||t[3]!==r?(u=(e,t,n)=>{n?.previousData!==void 0&&l.setQueryData(r,n.previousData);let i=c??(e.message?e.message:`Operation failed`);C.error(i),o?.(e,t)},t[0]=c,t[1]=o,t[2]=l,t[3]=r,t[4]=u):u=t[4];let d;t[5]!==i||t[6]!==l||t[7]!==r?(d=async e=>{await l.cancelQueries({queryKey:r});let t=l.getQueryData(r);return t!==void 0&&l.setQueryData(r,t=>t===void 0?t:i(t,e)),{previousData:t}},t[5]=i,t[6]=l,t[7]=r,t[8]=d):d=t[8];let f;t[9]!==l||t[10]!==r?(f=()=>{l.invalidateQueries({queryKey:r})},t[9]=l,t[10]=r,t[11]=f):f=t[11];let p;t[12]!==a||t[13]!==s?(p=(e,t)=>{s&&C.success(s),a?.(e,t)},t[12]=a,t[13]=s,t[14]=p):p=t[14];let m;t[15]!==n||t[16]!==u||t[17]!==d||t[18]!==f||t[19]!==p?(m={mutationFn:n,onError:u,onMutate:d,onSettled:f,onSuccess:p},t[15]=n,t[16]=u,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h=F(m),g=h.mutate,_=h.mutateAsync,v;return t[21]!==h.isError||t[22]!==h.isPending||t[23]!==h.isSuccess||t[24]!==g||t[25]!==_?(v={isError:h.isError,isPending:h.isPending,isSuccess:h.isSuccess,mutate:g,mutateAsync:_},t[21]=h.isError,t[22]=h.isPending,t[23]=h.isSuccess,t[24]=g,t[25]=_,t[26]=v):v=t[26],v}function Y({mutationFn:e,queryKey:t,itemId:n,getId:r=e=>e.id,onSuccess:i,onError:a,successMessage:o,errorMessage:s=`Failed to delete`}){return J({errorMessage:s,mutationFn:async()=>e(),onError:a?e=>a(e):void 0,onSuccess:i?e=>i(e):void 0,optimisticUpdate:e=>e.filter(e=>r(e)!==n),queryKey:t,successMessage:o})}function X(e){let t=(0,L.c)(10),{mutationFn:n,queryKey:r,createOptimisticItem:i,onSuccess:a,onError:o,successMessage:s,errorMessage:c}=e,l;t[0]===i?l=t[1]:(l=(e,t)=>[...e,i(t)],t[0]=i,t[1]=l);let u;return t[2]!==c||t[3]!==n||t[4]!==o||t[5]!==a||t[6]!==r||t[7]!==s||t[8]!==l?(u={errorMessage:c,mutationFn:n,onError:o,onSuccess:a,optimisticUpdate:l,queryKey:r,successMessage:s},t[2]=c,t[3]=n,t[4]=o,t[5]=a,t[6]=r,t[7]=s,t[8]=l,t[9]=u):u=t[9],J(u)}export{q as a,K as c,U as i,B as l,Y as n,G as o,z as r,W as s,X as t,F as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{A as r,C as i,E as a,O as o,S as s,T as c,_ as l,b as u,c as d,g as f,k as p,o as m,s as h,w as g}from"./removable-DwbP0VJV.js";import{V as _,z as v}from"./index-
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{A as r,C as i,E as a,O as o,S as s,T as c,_ as l,b as u,c as d,g as f,k as p,o as m,s as h,w as g}from"./removable-DwbP0VJV.js";import{V as _,z as v}from"./index-BZrWlEXZ.js";var y=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=h(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),x(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return S(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return S(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!c(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&C(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let a=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||a!==this.#p)&&this.#v(a)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return T(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u)),t}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(f||this.#r.isStale||!l(e))return;let t=o(this.#r.dataUpdatedAt,e)+1;this.#d=p.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(f||i(this.options.enabled,this.#t)===!1||!l(this.#p)||this.#p===0)&&(this.#f=p.setInterval(()=>{(this.options.refetchIntervalInBackground||d.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(p.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(p.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,a=this.#r,o=this.#i,c=this.#a,l=e===n?this.#n:e.state,{state:u}=e,d={...u},f=!1,p;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&x(e,t),o=i&&C(e,n,t,r);(a||o)&&(d={...d,..._(u.data,e.options)}),t._optimisticResults===`isRestoring`&&(d.fetchStatus=`idle`)}let{error:m,errorUpdatedAt:g,status:v}=d;p=d.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&v===`pending`){let e;a?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=a.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(v=`success`,p=s(a?.data,e,t),f=!0)}if(t.select&&p!==void 0&&!y)if(a&&p===o?.data&&t.select===this.#c)p=this.#l;else try{this.#c=t.select,p=t.select(p),p=s(a?.data,p,t),this.#l=p,this.#s=null}catch(e){this.#s=e}this.#s&&(m=this.#s,p=this.#l,g=Date.now(),v=`error`);let b=d.fetchStatus===`fetching`,S=v===`pending`,T=v===`error`,E=S&&b,D=p!==void 0,O={status:v,fetchStatus:d.fetchStatus,isPending:S,isSuccess:v===`success`,isError:T,isInitialLoading:E,isLoading:E,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:b,isRefetching:b&&!S,isLoadingError:T&&!D,isPaused:d.fetchStatus===`paused`,isPlaceholderData:f,isRefetchError:T&&D,isStale:w(e,t),refetch:this.refetch,promise:this.#o,isEnabled:i(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},a=()=>{i(this.#o=O.promise=h())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||O.data!==o.value)&&a();break;case`rejected`:(!r||O.error!==o.reason)&&a();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!c(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){m.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function b(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function x(e,t){return b(e,t)||e.state.data!==void 0&&S(e,t,t.refetchOnMount)}function S(e,t,n){if(i(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&w(e,t)}return!1}function C(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&w(e,n)}function w(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}function T(e,t){return!c(e.getCurrentResult(),t)}var E=e(t(),1),D=E.createContext(!1),O=()=>E.useContext(D);D.Provider,n();function k(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var A=E.createContext(k()),j=()=>E.useContext(A),M=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?a(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},N=e=>{E.useEffect(()=>{e.clearReset()},[e])},P=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||a(n,[e.error,r])),F=(e,t)=>t.state.data===void 0,I=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},L=(e,t)=>e.isLoading&&e.isFetching&&!t,R=(e,t)=>e?.suspense&&t.isPending,z=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function B(e,t,n){let r=O(),i=j(),a=v(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,I(o),M(o,i,s),N(i);let c=!a.getQueryCache().get(o.queryHash),[l]=E.useState(()=>new t(a,o)),d=l.getOptimisticResult(o),p=!r&&e.subscribed!==!1;if(E.useSyncExternalStore(E.useCallback(e=>{let t=p?l.subscribe(m.batchCalls(e)):u;return l.updateResult(),t},[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),E.useEffect(()=>{l.setOptions(o)},[o,l]),R(o,d))throw z(o,l,i);if(P({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!f&&L(d,r)&&(c?z(o,l,i):s?.promise)?.catch(u).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?d:l.trackResult(d)}export{F as n,y as r,B as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,t}from"./useBaseQuery-C_843G5v.js";function n(n,r){return t(n,e,r)}export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./useBaseQuery-C_843G5v.js";function r(r,i){return n({...r,enabled:!0,suspense:!0,throwOnError:e,placeholderData:void 0},t,i)}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,n as t}from"./jsx-runtime-DG_AJzB_.js";import{a as n,i as r}from"./useRouterState-DpT8luFk.js";var i=e(t()),a=i.useLayoutEffect;function o(){if(typeof globalThis<`u`)return globalThis;if(typeof self<`u`)return self;if(typeof window<`u`)return window;if(typeof global<`u`)return global}function s(){let e=o();if(e.__xstate__)return e.__xstate__}var c=e=>{if(typeof window>`u`)return;let t=s();t&&t.register(e)},l=class{constructor(e){this._process=e,this._active=!1,this._current=null,this._last=null}start(){this._active=!0,this.flush()}clear(){this._current&&(this._current.next=null,this._last=this._current)}enqueue(e){let t={value:e,next:null};if(this._current){this._last.next=t,this._last=t;return}this._current=t,this._last=t,this._active&&this.flush()}flush(){for(;this._current;){let e=this._current;this._process(e.value),this._current=e.next}this._last=null}},u=``,d=`#`,f=`*`,p=`xstate.init`,m=`xstate.stop`;function ee(e,t){return{type:`xstate.after.${e}.${t}`}}function h(e,t){return{type:`xstate.done.state.${e}`,output:t}}function te(e,t){return{type:`xstate.done.actor.${e}`,output:t,actorId:e}}function ne(e,t){return{type:`xstate.error.actor.${e}`,error:t,actorId:e}}function re(e){return{type:p,input:e}}function g(e){setTimeout(()=>{throw e})}var ie=typeof Symbol==`function`&&Symbol.observable||`@@observable`;function ae(e,t){let n=oe(e),r=oe(t);return typeof r==`string`?typeof n==`string`?r===n:!1:typeof n==`string`?n in r:Object.keys(n).every(e=>e in r?ae(n[e],r[e]):!1)}function _(e){if(de(e))return e;let t=[],n=``;for(let r=0;r<e.length;r++){switch(e.charCodeAt(r)){case 92:n+=e[r+1],r++;continue;case 46:t.push(n),n=``;continue}n+=e[r]}return t.push(n),t}function oe(e){return ct(e)?e.value:typeof e==`string`?se(_(e)):e}function se(e){if(e.length===1)return e[0];let t={},n=t;for(let t=0;t<e.length-1;t++)if(t===e.length-2)n[e[t]]=e[t+1];else{let r=n;n={},r[e[t]]=n}return t}function ce(e,t){let n={},r=Object.keys(e);for(let i=0;i<r.length;i++){let a=r[i];n[a]=t(e[a],a,e,i)}return n}function le(e){return de(e)?e:[e]}function v(e){return e===void 0?[]:le(e)}function ue(e,t,n,r){return typeof e==`function`?e({context:t,event:n,self:r}):e}function de(e){return Array.isArray(e)}function fe(e){return e.type.startsWith(`xstate.error.actor`)}function y(e){return le(e).map(e=>e===void 0||typeof e==`string`?{target:e}:e)}function pe(e){if(!(e===void 0||e===u))return v(e)}function b(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}function me(e,t){return`${t}.${e}`}function x(e,t){let n=t.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return e.implementations.actors[t];let[,r,i]=n,a=e.getStateNodeById(i).config.invoke;return(Array.isArray(a)?a[r]:a).src}function he(e,t){if(t===e||t===f)return!0;if(!t.endsWith(`.*`))return!1;let n=t.split(`.`),r=e.split(`.`);for(let e=0;e<n.length;e++){let t=n[e],i=r[e];if(t===`*`)return e===n.length-1;if(t!==i)return!1}return!0}function ge(e,t){return`${e.sessionId}.${t}`}var _e=0;function ve(e,t){let n=new Map,r=new Map,i=new WeakMap,a=new Set,o={},{clock:s,logger:c}=t,l={schedule:(e,t,n,r,i=Math.random().toString(36).slice(2))=>{let a={source:e,target:t,event:n,delay:r,id:i,startedAt:Date.now()},c=ge(e,i);u._snapshot._scheduledEvents[c]=a,o[c]=s.setTimeout(()=>{delete o[c],delete u._snapshot._scheduledEvents[c],u._relay(e,t,n)},r)},cancel:(e,t)=>{let n=ge(e,t),r=o[n];delete o[n],delete u._snapshot._scheduledEvents[n],r!==void 0&&s.clearTimeout(r)},cancelAll:e=>{for(let t in u._snapshot._scheduledEvents){let n=u._snapshot._scheduledEvents[t];n.source===e&&l.cancel(e,n.id)}}},u={_snapshot:{_scheduledEvents:(t?.snapshot&&t.snapshot.scheduler)??{}},_bookId:()=>`x:${_e++}`,_register:(e,t)=>(n.set(e,t),e),_unregister:e=>{n.delete(e.sessionId);let t=i.get(e);t!==void 0&&(r.delete(t),i.delete(e))},get:e=>r.get(e),getAll:()=>Object.fromEntries(r.entries()),_set:(e,t)=>{let n=r.get(e);if(n&&n!==t)throw Error(`Actor with system ID '${e}' already exists.`);r.set(e,t),i.set(t,e)},inspect:e=>{let t=b(e);return a.add(t),{unsubscribe(){a.delete(t)}}},_sendInspectionEvent:t=>{if(!a.size)return;let n={...t,rootId:e.sessionId};a.forEach(e=>e.next?.(n))},_relay:(e,t,n)=>{u._sendInspectionEvent({type:`@xstate.event`,sourceRef:e,actorRef:t,event:n}),t._send(n)},scheduler:l,getSnapshot:()=>({_scheduledEvents:{...u._snapshot._scheduledEvents}}),start:()=>{let e=u._snapshot._scheduledEvents;u._snapshot._scheduledEvents={};for(let t in e){let{source:n,target:r,event:i,delay:a,id:o}=e[t];l.schedule(n,r,i,a,o)}},_clock:s,_logger:c};return u}var S=!1,C=function(e){return e[e.NotStarted=0]=`NotStarted`,e[e.Running=1]=`Running`,e[e.Stopped=2]=`Stopped`,e}({}),ye={clock:{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},logger:console.log.bind(console),devTools:!1},be=class{constructor(e,t){this.logic=e,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new l(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=C.NotStarted,this._parent=void 0,this._syncSnapshot=void 0,this.ref=void 0,this._actorScope=void 0,this.systemId=void 0,this.sessionId=void 0,this.system=void 0,this._doneEvent=void 0,this.src=void 0,this._deferred=[];let n={...ye,...t},{clock:r,logger:i,parent:a,syncSnapshot:o,id:s,systemId:c,inspect:u}=n;this.system=a?a.system:ve(this,{clock:r,logger:i}),u&&!a&&this.system.inspect(b(u)),this.sessionId=this.system._bookId(),this.id=s??this.sessionId,this.logger=t?.logger??this.system._logger,this.clock=t?.clock??this.system._clock,this._parent=a,this._syncSnapshot=o,this.options=n,this.src=n.src??e,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:e=>{this._deferred.push(e)},system:this.system,stopChild:e=>{if(e._parent!==this)throw Error(`Cannot stop child actor ${e.id} of ${this.id} because it is not a child`);e._stop()},emit:e=>{let t=this.eventListeners.get(e.type),n=this.eventListeners.get(`*`);if(!t&&!n)return;let r=[...t?t.values():[],...n?n.values():[]];for(let t of r)try{t(e)}catch(e){g(e)}},actionExecutor:e=>{let t=()=>{if(this._actorScope.system._sendInspectionEvent({type:`@xstate.action`,actorRef:this,action:{type:e.type,params:e.params}}),!e.exec)return;let t=S;try{S=!0,e.exec(e.info,e.params)}finally{S=t}};this._processingStatus===C.Running?t():this._deferred.push(t)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:`@xstate.actor`,actorRef:this}),c&&(this.systemId=c,this.system._set(c,this)),this._initState(t?.snapshot??t?.state),c&&this._snapshot.status!==`active`&&this.system._unregister(this)}_initState(e){try{this._snapshot=e?this.logic.restoreSnapshot?this.logic.restoreSnapshot(e,this._actorScope):e:this.logic.getInitialSnapshot(this._actorScope,this.options?.input)}catch(e){this._snapshot={status:`error`,output:void 0,error:e}}}update(e,t){this._snapshot=e;let n;for(;n=this._deferred.shift();)try{n()}catch(t){this._deferred.length=0,this._snapshot={...e,status:`error`,error:t}}switch(this._snapshot.status){case`active`:for(let t of this.observers)try{t.next?.(e)}catch(e){g(e)}break;case`done`:for(let t of this.observers)try{t.next?.(e)}catch(e){g(e)}this._stopProcedure(),this._complete(),this._doneEvent=te(this.id,this._snapshot.output),this._parent&&this.system._relay(this,this._parent,this._doneEvent);break;case`error`:this._error(this._snapshot.error);break}this.system._sendInspectionEvent({type:`@xstate.snapshot`,actorRef:this,event:t,snapshot:e})}subscribe(e,t,n){let r=b(e,t,n);if(this._processingStatus!==C.Stopped)this.observers.add(r);else switch(this._snapshot.status){case`done`:try{r.complete?.()}catch(e){g(e)}break;case`error`:{let e=this._snapshot.error;if(!r.error)g(e);else try{r.error(e)}catch(e){g(e)}break}}return{unsubscribe:()=>{this.observers.delete(r)}}}on(e,t){let n=this.eventListeners.get(e);n||(n=new Set,this.eventListeners.set(e,n));let r=t.bind(void 0);return n.add(r),{unsubscribe:()=>{n.delete(r)}}}select(e,t=Object.is){return{subscribe:n=>{let r=b(n),i=e(this.getSnapshot());return this.subscribe(n=>{let a=e(n);t(i,a)||(i=a,r.next?.(a))})},get:()=>e(this.getSnapshot())}}start(){if(this._processingStatus===C.Running)return this;this._syncSnapshot&&this.subscribe({next:e=>{e.status===`active`&&this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:e})},error:()=>{}}),this.system._register(this.sessionId,this),this.systemId&&this.system._set(this.systemId,this),this._processingStatus=C.Running;let e=re(this.options.input);switch(this.system._sendInspectionEvent({type:`@xstate.event`,sourceRef:this._parent,actorRef:this,event:e}),this._snapshot.status){case`done`:return this.update(this._snapshot,e),this;case`error`:return this._error(this._snapshot.error),this}if(this._parent||this.system.start(),this.logic.start)try{this.logic.start(this._snapshot,this._actorScope)}catch(e){return this._snapshot={...this._snapshot,status:`error`,error:e},this._error(e),this}return this.update(this._snapshot,e),this.options.devTools&&this.attachDevTools(),this.mailbox.start(),this}_process(e){let t,n;try{t=this.logic.transition(this._snapshot,e,this._actorScope)}catch(e){n={err:e}}if(n){let{err:e}=n;this._snapshot={...this._snapshot,status:`error`,error:e},this._error(e);return}this.update(t,e),e.type===`xstate.stop`&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===C.Stopped?this:(this.mailbox.clear(),this._processingStatus===C.NotStarted?(this._processingStatus=C.Stopped,this):(this.mailbox.enqueue({type:m}),this))}stop(){if(this._parent)throw Error(`A non-root actor cannot be stopped directly.`);return this._stop()}_complete(){for(let e of this.observers)try{e.complete?.()}catch(e){g(e)}this.observers.clear(),this.eventListeners.clear()}_reportError(e){if(!this.observers.size){this._parent||g(e),this.eventListeners.clear();return}let t=!1;for(let n of this.observers){let r=n.error;t||=!r;try{r?.(e)}catch(e){g(e)}}this.observers.clear(),this.eventListeners.clear(),t&&g(e)}_error(e){this._stopProcedure(),this._reportError(e),this._parent&&this.system._relay(this,this._parent,ne(this.id,e))}_stopProcedure(){return this._processingStatus===C.Running?(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new l(this._process.bind(this)),this._processingStatus=C.Stopped,this.system._unregister(this),this):this}_send(e){this._processingStatus!==C.Stopped&&this.mailbox.enqueue(e)}send(e){this.system._relay(void 0,this,e)}attachDevTools(){let{devTools:e}=this.options;e&&(typeof e==`function`?e:c)(this)}toJSON(){return{xstate$$type:1,id:this.id}}getPersistedSnapshot(e){return this.logic.getPersistedSnapshot(this._snapshot,e)}[ie](){return this}getSnapshot(){return this._snapshot}};function w(e,...[t]){return new be(e,t)}function xe(e,t,n,r,{sendId:i}){return[t,{sendId:typeof i==`function`?i(n,r):i},void 0]}function Se(e,t){e.defer(()=>{e.system.scheduler.cancel(e.self,t.sendId)})}function T(e){function t(e,t){}return t.type=`xstate.cancel`,t.sendId=e,t.resolve=xe,t.execute=Se,t}function Ce(e,t,n,r,{id:i,systemId:a,src:o,input:s,syncSnapshot:c}){let l=typeof o==`string`?x(t.machine,o):o,u=typeof i==`function`?i(n):i,d,f;return l&&(f=typeof s==`function`?s({context:t.context,event:n.event,self:e.self}):s,d=w(l,{id:u,src:o,parent:e.self,syncSnapshot:c,systemId:a,input:f})),[Y(t,{children:{...t.children,[u]:d}}),{id:i,systemId:a,actorRef:d,src:o,input:f},void 0]}function we(e,{actorRef:t}){t&&e.defer(()=>{t._processingStatus!==C.Stopped&&t.start()})}function E(...[e,{id:t,systemId:n,input:r,syncSnapshot:i=!1}={}]){function a(e,t){}return a.type=`xstate.spawnChild`,a.id=t,a.systemId=n,a.src=e,a.input=r,a.syncSnapshot=i,a.resolve=Ce,a.execute=we,a}function Te(e,t,n,r,{actorRef:i}){let a=typeof i==`function`?i(n,r):i,o=typeof a==`string`?t.children[a]:a,s=t.children;return o&&(s={...s},delete s[o.id]),[Y(t,{children:s}),o,void 0]}function Ee(e,t){let n=t.getSnapshot();if(n&&`children`in n)for(let t of Object.values(n.children))Ee(e,t);e.system._unregister(t)}function De(e,t){if(t){if(Ee(e,t),t._processingStatus!==C.Running){e.stopChild(t);return}e.defer(()=>{e.stopChild(t)})}}function D(e){function t(e,t){}return t.type=`xstate.stopChild`,t.actorRef=e,t.resolve=Te,t.execute=De,t}function O(e,t,n,r){let{machine:i}=r,a=typeof e==`function`,o=a?e:i.implementations.guards[typeof e==`string`?e:e.type];if(!a&&!o)throw Error(`Guard '${typeof e==`string`?e:e.type}' is not implemented.'.`);if(typeof o!=`function`)return O(o,t,n,r);let s={context:t,event:n},c=a||typeof e==`string`?void 0:`params`in e?typeof e.params==`function`?e.params({context:t,event:n}):e.params:void 0;return`check`in o?o.check(r,s,o):o(s,c)}function Oe(e){return e.type===`atomic`||e.type===`final`}function k(e){return Object.values(e.states).filter(e=>e.type!==`history`)}function A(e,t){let n=[];if(t===e)return n;let r=e.parent;for(;r&&r!==t;)n.push(r),r=r.parent;return n}function j(e){let t=new Set(e),n=Ae(t);for(let e of t)if(e.type===`compound`&&(!n.get(e)||!n.get(e).length))ze(e).forEach(e=>t.add(e));else if(e.type===`parallel`){for(let n of k(e))if(n.type!==`history`&&!t.has(n)){let e=ze(n);for(let n of e)t.add(n)}}for(let e of t){let n=e.parent;for(;n;)t.add(n),n=n.parent}return t}function ke(e,t){let n=t.get(e);if(!n)return{};if(e.type===`compound`){let e=n[0];if(e){if(Oe(e))return e.key}else return{}}let r={};for(let e of n)r[e.key]=ke(e,t);return r}function Ae(e){let t=new Map;for(let n of e)t.has(n)||t.set(n,[]),n.parent&&(t.has(n.parent)||t.set(n.parent,[]),t.get(n.parent).push(n));return t}function je(e,t){return ke(e,Ae(j(t)))}function M(e,t){return t.type===`compound`?k(t).some(t=>t.type===`final`&&e.has(t)):t.type===`parallel`?k(t).every(t=>M(e,t)):t.type===`final`}var N=e=>e[0]===d;function Me(e,t){return e.transitions.get(t)||[...e.transitions.keys()].filter(e=>he(t,e)).sort((e,t)=>t.length-e.length).flatMap(t=>e.transitions.get(t))}function Ne(e){let t=e.config.after;if(!t)return[];let n=t=>{let n=ee(t,e.id),r=n.type;return e.entry.push(yt(n,{id:r,delay:t})),e.exit.push(T(r)),r};return Object.keys(t).flatMap(e=>{let r=t[e],i=typeof r==`string`?{target:r}:r,a=Number.isNaN(+e)?e:+e,o=n(a);return v(i).map(e=>({...e,event:o,delay:a}))}).map(t=>{let{delay:n}=t;return{...P(e,t.event,t),delay:n}})}function P(e,t,n){let r=pe(n.target),i=n.reenter??!1,a=Le(e,r),o={...n,actions:v(n.actions),guard:n.guard,target:a,source:e,reenter:i,eventType:t,toJSON:()=>({...o,source:`#${e.id}`,target:a?a.map(e=>`#${e.id}`):void 0})};return o}function Pe(e){let t=new Map;if(e.config.on)for(let n of Object.keys(e.config.on)){if(n===``)throw Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');let r=e.config.on[n];t.set(n,y(r).map(t=>P(e,n,t)))}if(e.config.onDone){let n=`xstate.done.state.${e.id}`;t.set(n,y(e.config.onDone).map(t=>P(e,n,t)))}for(let n of e.invoke){if(n.onDone){let r=`xstate.done.actor.${n.id}`;t.set(r,y(n.onDone).map(t=>P(e,r,t)))}if(n.onError){let r=`xstate.error.actor.${n.id}`;t.set(r,y(n.onError).map(t=>P(e,r,t)))}if(n.onSnapshot){let r=`xstate.snapshot.${n.id}`;t.set(r,y(n.onSnapshot).map(t=>P(e,r,t)))}}for(let n of e.after){let e=t.get(n.eventType);e||(e=[],t.set(n.eventType,e)),e.push(n)}return t}function Fe(e){let t=[],n=r=>{Object.values(r).forEach(r=>{if(r.config.route&&r.config.id){let n=r.config.id,i=r.config.route.guard,a=(e,t)=>e.event.to===`#${n}`?i&&typeof i==`function`?i(e,t):!0:!1,o={...r.config.route,guard:a,target:`#${n}`};t.push(P(e,`xstate.route`,o))}r.states&&n(r.states)})};n(e.states),t.length>0&&e.transitions.set(`xstate.route`,t)}function Ie(e,t){let n=typeof t==`string`?e.states[t]:t?e.states[t.target]:void 0;if(!n&&t)throw Error(`Initial state node "${t}" not found on parent state node #${e.id}`);let r={source:e,actions:!t||typeof t==`string`?[]:v(t.actions),eventType:null,reenter:!1,target:n?[n]:[],toJSON:()=>({...r,source:`#${e.id}`,target:n?[`#${n.id}`]:[]})};return r}function Le(e,t){if(t!==void 0)return t.map(t=>{if(typeof t!=`string`)return t;if(N(t))return e.machine.getStateNodeById(t);let n=t[0]===`.`;if(n&&!e.parent)return L(e,t.slice(1));let r=n?e.key+t:t;if(e.parent)try{return L(e.parent,r)}catch(t){throw Error(`Invalid transition definition for state node '${e.id}':\n${t.message}`)}else throw Error(`Invalid target: "${t}" is not a valid target from the root node. Did you mean ".${t}"?`)})}function Re(e){let t=pe(e.config.target);return t?{target:t.map(t=>typeof t==`string`?L(e.parent,t):t)}:e.parent.initial}function F(e){return e.type===`history`}function ze(e){let t=Be(e);for(let n of t)for(let r of A(n,e))t.add(r);return t}function Be(e){let t=new Set;function n(e){if(!t.has(e)){if(t.add(e),e.type===`compound`)n(e.initial.target[0]);else if(e.type===`parallel`)for(let t of k(e))n(t)}}return n(e),t}function I(e,t){if(N(t))return e.machine.getStateNodeById(t);if(!e.states)throw Error(`Unable to retrieve child state '${t}' from '${e.id}'; no child states exist.`);let n=e.states[t];if(!n)throw Error(`Child state '${t}' does not exist on '${e.id}'`);return n}function L(e,t){if(typeof t==`string`&&N(t))try{return e.machine.getStateNodeById(t)}catch{}let n=_(t).slice(),r=e;for(;n.length;){let e=n.shift();if(!e.length)break;r=I(r,e)}return r}function R(e,t){if(typeof t==`string`){let n=e.states[t];if(!n)throw Error(`State '${t}' does not exist on '${e.id}'`);return[e,n]}let n=Object.keys(t),r=n.map(t=>I(e,t)).filter(Boolean);return[e.machine.root,e].concat(r,n.reduce((n,r)=>{let i=I(e,r);if(!i)return n;let a=R(i,t[r]);return n.concat(a)},[]))}function Ve(e,t,n,r){let i=I(e,t).next(n,r);return!i||!i.length?e.next(n,r):i}function He(e,t,n,r){let i=Object.keys(t),a=z(I(e,i[0]),t[i[0]],n,r);return!a||!a.length?e.next(n,r):a}function Ue(e,t,n,r){let i=[];for(let a of Object.keys(t)){let o=t[a];if(!o)continue;let s=z(I(e,a),o,n,r);s&&i.push(...s)}return i.length?i:e.next(n,r)}function z(e,t,n,r){return typeof t==`string`?Ve(e,t,n,r):Object.keys(t).length===1?He(e,t,n,r):Ue(e,t,n,r)}function We(e){return Object.keys(e.states).map(t=>e.states[t]).filter(e=>e.type===`history`)}function B(e,t){let n=e;for(;n.parent&&n.parent!==t;)n=n.parent;return n.parent===t}function Ge(e,t){let n=new Set(e),r=new Set(t);for(let e of n)if(r.has(e))return!0;for(let e of r)if(n.has(e))return!0;return!1}function Ke(e,t,n){let r=new Set;for(let i of e){let e=!1,a=new Set;for(let o of r)if(Ge(H([i],t,n),H([o],t,n)))if(B(i.source,o.source))a.add(o);else{e=!0;break}if(!e){for(let e of a)r.delete(e);r.add(i)}}return Array.from(r)}function qe(e){let[t,...n]=e;for(let e of A(t,void 0))if(n.every(t=>B(t,e)))return e}function V(e,t){if(!e.target)return[];let n=new Set;for(let r of e.target)if(F(r))if(t[r.id])for(let e of t[r.id])n.add(e);else for(let e of V(Re(r),t))n.add(e);else n.add(r);return[...n]}function Je(e,t){let n=V(e,t);if(!n)return;if(!e.reenter&&n.every(t=>t===e.source||B(t,e.source)))return e.source;let r=qe(n.concat(e.source));if(r)return r;if(!e.reenter)return e.source.machine.root}function H(e,t,n){let r=new Set;for(let i of e)if(i.target?.length){let e=Je(i,n);i.reenter&&i.source===e&&r.add(e);for(let n of t)B(n,e)&&r.add(n)}return[...r]}function Ye(e,t){if(e.length!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Xe(e,t,n,r,i){return U([{target:[...Be(e)],source:e,reenter:!0,actions:[],eventType:null,toJSON:null}],t,n,r,!0,i)}function U(e,t,n,r,i,a){let o=[];if(!e.length)return[t,o];let s=n.actionExecutor;n.actionExecutor=e=>{o.push(e),s(e)};try{let s=new Set(t._nodes),c=t.historyValue,l=Ke(e,s,c),u=t;i||([u,c]=tt(u,r,n,l,s,c,a,n.actionExecutor)),u=K(u,r,n,l.flatMap(e=>e.actions),a,void 0),u=Qe(u,r,n,l,s,a,c,i);let d=[...s];u.status===`done`&&(u=K(u,r,n,d.sort((e,t)=>t.order-e.order).flatMap(e=>e.exit),a,void 0));try{return c===t.historyValue&&Ye(t._nodes,s)?[u,o]:[Y(u,{_nodes:d,historyValue:c}),o]}catch(e){throw e}}finally{n.actionExecutor=s}}function Ze(e,t,n,r,i){if(r.output===void 0)return;let a=h(i.id,i.output!==void 0&&i.parent?ue(i.output,e.context,t,n.self):void 0);return ue(r.output,e.context,a,n.self)}function Qe(e,t,n,r,i,a,o,s){let c=e,l=new Set,u=new Set;$e(r,o,u,l),s&&u.add(e.machine.root);let d=new Set;for(let e of[...l].sort((e,t)=>e.order-t.order)){i.add(e);let r=[];r.push(...e.entry);for(let t of e.invoke)r.push(E(t.src,{...t,syncSnapshot:!!t.onSnapshot}));if(u.has(e)){let t=e.initial.actions;r.push(...t)}if(c=K(c,t,n,r,a,e.invoke.map(e=>e.id)),e.type===`final`){let r=e.parent,o=r?.type===`parallel`?r:r?.parent,s=o||e;for(r?.type===`compound`&&a.push(h(r.id,e.output===void 0?void 0:ue(e.output,c.context,t,n.self)));o?.type===`parallel`&&!d.has(o)&&M(i,o);)d.add(o),a.push(h(o.id)),s=o,o=o.parent;if(o)continue;c=Y(c,{status:`done`,output:Ze(c,t,n,c.machine.root,s)})}}return c}function $e(e,t,n,r){for(let i of e){let e=Je(i,t);for(let a of i.target||[])!F(a)&&(i.source!==a||i.source!==e||i.reenter)&&(r.add(a),n.add(a)),W(a,t,n,r);let a=V(i,t);for(let o of a){let a=A(o,e);e?.type===`parallel`&&a.push(e),et(r,t,n,a,!i.source.parent&&i.reenter?void 0:e)}}}function W(e,t,n,r){if(F(e))if(t[e.id]){let i=t[e.id];for(let e of i)r.add(e),W(e,t,n,r);for(let a of i)G(a,e.parent,r,t,n)}else{let i=Re(e);for(let a of i.target)r.add(a),i===e.parent?.initial&&n.add(e.parent),W(a,t,n,r);for(let a of i.target)G(a,e.parent,r,t,n)}else if(e.type===`compound`){let[i]=e.initial.target;F(i)||(r.add(i),n.add(i)),W(i,t,n,r),G(i,e,r,t,n)}else if(e.type===`parallel`)for(let i of k(e).filter(e=>!F(e)))[...r].some(e=>B(e,i))||(F(i)||(r.add(i),n.add(i)),W(i,t,n,r))}function et(e,t,n,r,i){for(let a of r)if((!i||B(a,i))&&e.add(a),a.type===`parallel`)for(let r of k(a).filter(e=>!F(e)))[...e].some(e=>B(e,r))||(e.add(r),W(r,t,n,e))}function G(e,t,n,r,i){et(n,r,i,A(e,t))}function tt(e,t,n,r,i,a,o,s){let c=e,l=H(r,i,a);l.sort((e,t)=>t.order-e.order);let u;for(let e of l)for(let t of We(e)){let n;n=t.history===`deep`?t=>Oe(t)&&B(t,e):t=>t.parent===e,u??={...a},u[t.id]=Array.from(i).filter(n)}for(let e of l)c=K(c,t,n,[...e.exit,...e.invoke.map(e=>D(e.id))],o,void 0),i.delete(e);return[c,u||a]}function nt(e,t){return e.implementations.actions[t]}function rt(e,t,n,r,i,a){let{machine:o}=e,s=e;for(let e of r){let r=typeof e==`function`,c=r?e:nt(o,typeof e==`string`?e:e.type),l={context:s.context,event:t,self:n.self,system:n.system},u=r||typeof e==`string`?void 0:`params`in e?typeof e.params==`function`?e.params({context:s.context,event:t}):e.params:void 0;if(!c||!(`resolve`in c)){n.actionExecutor({type:typeof e==`string`?e:typeof e==`object`?e.type:e.name||`(anonymous)`,info:l,params:u,exec:c});continue}let d=c,[f,p,m]=d.resolve(n,s,l,u,c,i);s=f,`retryResolve`in d&&a?.push([d,p]),`execute`in d&&n.actionExecutor({type:d.type,info:l,params:p,exec:d.execute.bind(null,n,p)}),m&&(s=rt(s,t,n,m,i,a))}return s}function K(e,t,n,r,i,a){let o=a?[]:void 0,s=rt(e,t,n,r,{internalQueue:i,deferredActorIds:a},o);return o?.forEach(([e,t])=>{e.retryResolve(n,s,t)}),s}function q(e,t,n,r){let i=e,a=[];function o(e,t,r){n.system._sendInspectionEvent({type:`@xstate.microstep`,actorRef:n.self,event:t,snapshot:e[0],_transitions:r}),a.push(e)}if(t.type===`xstate.stop`)return i=Y(it(i,t,n),{status:`stopped`}),o([i,[]],t,[]),{snapshot:i,microsteps:a};let s=t;if(s.type!==p){let t=s,c=fe(t),l=at(t,i);if(c&&!l.length)return i=Y(e,{status:`error`,error:t.error}),o([i,[]],t,[]),{snapshot:i,microsteps:a};let u=U(l,e,n,s,!1,r);i=u[0],o(u,t,l)}let c=!0,l=e.machine.options?.maxIterations??1/0,u=0;for(;i.status===`active`;){if(u++,u>l)throw Error(`Infinite loop detected: the machine has processed more than ${l} microsteps without reaching a stable state. This usually happens when there's a cycle of transitions (e.g., eventless transitions or raised events causing state A -> B -> C -> A).`);let e=c?ot(i,s):[],t=e.length?i:void 0;if(!e.length){if(!r.length)break;s=r.shift(),e=at(s,i)}let a=U(e,i,n,s,!1,r);i=a[0],c=i!==t,o(a,s,e)}return i.status!==`active`&&it(i,s,n),{snapshot:i,microsteps:a}}function it(e,t,n){return K(e,t,n,Object.values(e.children).map(e=>D(e)),[],void 0)}function at(e,t){return t.machine.getTransitionData(t,e)}function ot(e,t){let n=new Set,r=e._nodes.filter(Oe);for(let i of r)loop:for(let r of[i].concat(A(i,void 0)))if(r.always){for(let i of r.always)if(i.guard===void 0||O(i.guard,e.context,t,e)){n.add(i);break loop}}return Ke(Array.from(n),new Set(e._nodes),e.historyValue)}function st(e,t){return je(e,[...j(R(e,t))])}function ct(e){return!!e&&typeof e==`object`&&`machine`in e&&`value`in e}var lt=function(e){return ae(e,this.value)},ut=function(e){return this.tags.has(e)},dt=function(e){let t=this.machine.getTransitionData(this,e);return!!t?.length&&t.some(e=>e.target!==void 0||e.actions.length)},ft=function(){let{_nodes:e,tags:t,machine:n,getMeta:r,toJSON:i,can:a,hasTag:o,matches:s,...c}=this;return{...c,tags:Array.from(t)}},pt=function(){return this._nodes.reduce((e,t)=>(t.meta!==void 0&&(e[t.id]=t.meta),e),{})};function J(e,t){return{status:e.status,output:e.output,error:e.error,machine:t,context:e.context,_nodes:e._nodes,value:je(t.root,e._nodes),tags:new Set(e._nodes.flatMap(e=>e.tags)),children:e.children,historyValue:e.historyValue||{},matches:lt,hasTag:ut,can:dt,getMeta:pt,toJSON:ft}}function Y(e,t={}){return J({...e,...t},e.machine)}function mt(e){if(typeof e!=`object`||!e)return{};let t={};for(let n in e){let r=e[n];Array.isArray(r)&&(t[n]=r.map(e=>({id:e.id})))}return t}function ht(e,t){let{_nodes:n,tags:r,machine:i,children:a,context:o,can:s,hasTag:c,matches:l,getMeta:u,toJSON:d,...f}=e,p={};for(let e in a){let n=a[e];p[e]={snapshot:n.getPersistedSnapshot(t),src:n.src,systemId:n.systemId,syncSnapshot:n._syncSnapshot}}return{...f,context:gt(o),children:p,historyValue:mt(f.historyValue)}}function gt(e){let t;for(let n in e){let r=e[n];if(r&&typeof r==`object`)if(`sessionId`in r&&`send`in r&&`ref`in r)t??=Array.isArray(e)?e.slice():{...e},t[n]={xstate$$type:1,id:r.id};else{let i=gt(r);i!==r&&(t??=Array.isArray(e)?e.slice():{...e},t[n]=i)}}return t??e}function _t(e,t,n,r,{event:i,id:a,delay:o},{internalQueue:s}){let c=t.machine.implementations.delays;if(typeof i==`string`)throw Error(`Only event objects may be used with raise; use raise({ type: "${i}" }) instead`);let l=typeof i==`function`?i(n,r):i,u;if(typeof o==`string`){let e=c&&c[o];u=typeof e==`function`?e(n,r):e}else u=typeof o==`function`?o(n,r):o;return typeof u!=`number`&&s.push(l),[t,{event:l,id:a,delay:u},void 0]}function vt(e,t){let{event:n,delay:r,id:i}=t;if(typeof r==`number`){e.defer(()=>{let t=e.self;e.system.scheduler.schedule(t,t,n,r,i)});return}}function yt(e,t){function n(e,t){}return n.type=`xstate.raise`,n.event=e,n.id=t?.id,n.delay=t?.delay,n.resolve=_t,n.execute=vt,n}var bt=`xstate.promise.resolve`,xt=`xstate.promise.reject`,X=new WeakMap;function St(e){return{config:e,transition:(e,t,n)=>{if(e.status!==`active`)return e;switch(t.type){case bt:{let n=t.data;return{...e,status:`done`,output:n,input:void 0}}case xt:return{...e,status:`error`,error:t.data,input:void 0};case m:return X.get(n.self)?.abort(),X.delete(n.self),{...e,status:`stopped`,input:void 0};default:return e}},start:(t,{self:n,system:r,emit:i})=>{if(t.status!==`active`)return;let a=new AbortController;X.set(n,a),Promise.resolve(e({input:t.input,system:r,self:n,signal:a.signal,emit:i})).then(e=>{n.getSnapshot().status===`active`&&(X.delete(n),r._relay(n,n,{type:bt,data:e}))},e=>{n.getSnapshot().status===`active`&&(X.delete(n),r._relay(n,n,{type:xt,data:e}))})},getInitialSnapshot:(e,t)=>({status:`active`,output:void 0,error:void 0,input:t}),getPersistedSnapshot:e=>e,restoreSnapshot:e=>e}}function Ct(e,{machine:t,context:n},r,i){let a=(a,o)=>{if(typeof a==`string`){let s=x(t,a);if(!s)throw Error(`Actor logic '${a}' not implemented in machine '${t.id}'`);let c=w(s,{id:o?.id,parent:e.self,syncSnapshot:o?.syncSnapshot,input:typeof o?.input==`function`?o.input({context:n,event:r,self:e.self}):o?.input,src:a,systemId:o?.systemId});return i[c.id]=c,c}else return w(a,{id:o?.id,parent:e.self,syncSnapshot:o?.syncSnapshot,input:o?.input,src:a,systemId:o?.systemId})};return(t,n)=>{let r=a(t,n);return i[r.id]=r,e.defer(()=>{r._processingStatus!==C.Stopped&&r.start()}),r}}function wt(e,t,n,r,{assignment:i}){if(!t.context)throw Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");let a={},o={context:t.context,event:n.event,spawn:Ct(e,t,n.event,a),self:e.self,system:e.system},s={};if(typeof i==`function`)s=i(o,r);else for(let e of Object.keys(i)){let t=i[e];s[e]=typeof t==`function`?t(o,r):t}return[Y(t,{context:Object.assign({},t.context,s),children:Object.keys(a).length?{...t.children,...a}:t.children}),void 0,void 0]}function Z(e){function t(e,t){}return t.type=`xstate.assign`,t.assignment=e,t.resolve=wt,t}var Tt=new WeakMap;function Q(e,t,n){let r=Tt.get(e);return r?t in r||(r[t]=n()):(r={[t]:n()},Tt.set(e,r)),r[t]}var Et={},$=e=>typeof e==`string`?{type:e}:typeof e==`function`?`resolve`in e?{type:e.type}:{type:e.name}:e,Dt=class e{constructor(t,n){if(this.config=t,this.key=void 0,this.id=void 0,this.type=void 0,this.path=void 0,this.states=void 0,this.history=void 0,this.entry=void 0,this.exit=void 0,this.parent=void 0,this.machine=void 0,this.meta=void 0,this.output=void 0,this.order=-1,this.description=void 0,this.tags=[],this.transitions=void 0,this.always=void 0,this.parent=n._parent,this.key=n._key,this.machine=n._machine,this.path=this.parent?this.parent.path.concat(this.key):[],this.id=this.config.id||[this.machine.id,...this.path].join(`.`),this.type=this.config.type||(this.config.states&&Object.keys(this.config.states).length?`compound`:this.config.history?`history`:`atomic`),this.description=this.config.description,this.order=this.machine.idMap.size,this.machine.idMap.set(this.id,this),this.states=this.config.states?ce(this.config.states,(t,n)=>new e(t,{_parent:this,_key:n,_machine:this.machine})):Et,this.type===`compound`&&!this.config.initial)throw Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);this.history=this.config.history===!0?`shallow`:this.config.history||!1,this.entry=v(this.config.entry).slice(),this.exit=v(this.config.exit).slice(),this.meta=this.config.meta,this.output=this.type===`final`||!this.parent?this.config.output:void 0,this.tags=v(t.tags).slice()}_initialize(){this.transitions=Pe(this),this.config.always&&(this.always=y(this.config.always).map(e=>P(this,``,e))),Object.keys(this.states).forEach(e=>{this.states[e]._initialize()})}get definition(){return{id:this.id,key:this.key,version:this.machine.version,type:this.type,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map($),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(e=>`#${e.id}`),source:`#${this.id}`,actions:this.initial.actions.map($),eventType:null})}:void 0,history:this.history,states:ce(this.states,e=>e.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(e=>({...e,actions:e.actions.map($)})),entry:this.entry.map($),exit:this.exit.map($),meta:this.meta,order:this.order||-1,output:this.output,invoke:this.invoke,description:this.description,tags:this.tags}}toJSON(){return this.definition}get invoke(){return Q(this,`invoke`,()=>v(this.config.invoke).map((e,t)=>{let{src:n,systemId:r}=e,i=e.id??me(this.id,t),a=typeof n==`string`?n:`xstate.invoke.${me(this.id,t)}`;return{...e,src:a,id:i,systemId:r,toJSON(){let{onDone:t,onError:n,...r}=e;return{...r,type:`xstate.invoke`,src:a,id:i}}}}))}get on(){return Q(this,`on`,()=>[...this.transitions].flatMap(([e,t])=>t.map(t=>[e,t])).reduce((e,[t,n])=>(e[t]=e[t]||[],e[t].push(n),e),{}))}get after(){return Q(this,`delayedTransitions`,()=>Ne(this))}get initial(){return Q(this,`initial`,()=>Ie(this,this.config.initial))}next(e,t){let n=t.type,r=[],i,a=Q(this,`candidates-${n}`,()=>Me(this,n));for(let o of a){let{guard:a}=o,s=e.context,c=!1;try{c=!a||O(a,s,t,e)}catch(e){let t=typeof a==`string`?a:typeof a==`object`?a.type:void 0;throw Error(`Unable to evaluate guard ${t?`'${t}' `:``}in transition for event '${n}' in state node '${this.id}':\n${e.message}`)}if(c){r.push(...o.actions),i=o;break}}return i?[i]:void 0}get events(){return Q(this,`events`,()=>{let{states:e}=this,t=new Set(this.ownEvents);if(e)for(let n of Object.keys(e)){let r=e[n];if(r.states)for(let e of r.events)t.add(`${e}`)}return Array.from(t)})}get ownEvents(){let e=Object.keys(Object.fromEntries(this.transitions)),t=new Set(e.filter(e=>this.transitions.get(e).some(e=>!(!e.target&&!e.actions.length&&!e.reenter))));return Array.from(t)}},Ot=class e{constructor(e,t){this.config=e,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.options=void 0,this.__xstatenode=!0,this.idMap=new Map,this.root=void 0,this.id=void 0,this.states=void 0,this.events=void 0,this.id=e.id||`(machine)`,this.implementations={actors:t?.actors??{},actions:t?.actions??{},delays:t?.delays??{},guards:t?.guards??{}},this.version=this.config.version,this.schemas=this.config.schemas,this.options={maxIterations:1/0,...this.config.options},this.transition=this.transition.bind(this),this.getInitialSnapshot=this.getInitialSnapshot.bind(this),this.getPersistedSnapshot=this.getPersistedSnapshot.bind(this),this.restoreSnapshot=this.restoreSnapshot.bind(this),this.start=this.start.bind(this),this.root=new Dt(e,{_key:this.id,_machine:this}),this.root._initialize(),Fe(this.root),this.states=this.root.states,this.events=this.root.events}provide(t){let{actions:n,guards:r,actors:i,delays:a}=this.implementations;return new e(this.config,{actions:{...n,...t.actions},guards:{...r,...t.guards},actors:{...i,...t.actors},delays:{...a,...t.delays}})}resolveState(e){let t=st(this.root,e.value),n=j(R(this.root,t));return J({_nodes:[...n],context:e.context||{},children:{},status:M(n,this.root)?`done`:e.status||`active`,output:e.output,error:e.error,historyValue:e.historyValue},this)}transition(e,t,n){return q(e,t,n,[]).snapshot}microstep(e,t,n){return q(e,t,n,[]).microsteps.map(([e])=>e)}getTransitionData(e,t){return z(this.root,e.value,e,t)||[]}_getPreInitialState(e,t,n){let{context:r}=this.config,i=J({context:typeof r!=`function`&&r?r:{},_nodes:[this.root],children:{},status:`active`},this);return typeof r==`function`?K(i,t,e,[Z(({spawn:e,event:t,self:n})=>r({spawn:e,input:t.input,self:n}))],n,void 0):i}getInitialSnapshot(e,t){let n=re(t),r=[],i=this._getPreInitialState(e,n,r),[a]=Xe(this.root,i,e,n,r),{snapshot:o}=q(a,n,e,r);return o}start(e){Object.values(e.children).forEach(e=>{e.getSnapshot().status===`active`&&e.start()})}getStateNodeById(e){let t=_(e),n=t.slice(1),r=N(t[0])?t[0].slice(1):t[0],i=this.idMap.get(r);if(!i)throw Error(`Child state node '#${r}' does not exist on machine '${this.id}'`);return L(i,n)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(e,t){return ht(e,t)}restoreSnapshot(e,t){let n={},r=e.children;Object.keys(r).forEach(e=>{let i=r[e],a=i.snapshot,o=i.src,s=typeof o==`string`?x(this,o):o;s&&(n[e]=w(s,{id:e,parent:t.self,syncSnapshot:i.syncSnapshot,snapshot:a,src:o,systemId:i.systemId}))});function i(e,t){if(t instanceof Dt)return t;try{return e.machine.getStateNodeById(t.id)}catch{}}function a(e,t){if(!t||typeof t!=`object`)return{};let n={};for(let r in t){let a=t[r];for(let t of a){let a=i(e,t);a&&(n[r]??=[],n[r].push(a))}}return n}let o=a(this.root,e.historyValue),s=J({...e,children:n,_nodes:Array.from(j(R(this.root,e.value))),historyValue:o},this),c=new Set;function l(e,t){if(!c.has(e)){c.add(e);for(let n in e){let r=e[n];if(r&&typeof r==`object`){if(`xstate$$type`in r&&r.xstate$$type===1){e[n]=t[r.id];continue}l(r,t)}}}}return l(s.context,n),s}};function kt(e,t,n,r,{event:i}){return[t,{event:typeof i==`function`?i(n,r):i},void 0]}function At(e,{event:t}){e.defer(()=>e.emit(t))}function jt(e){function t(e,t){}return t.type=`xstate.emit`,t.event=e,t.resolve=kt,t.execute=At,t}var Mt=function(e){return e.Parent=`#_parent`,e.Internal=`#_internal`,e}({});function Nt(e,t,n,r,{to:i,event:a,id:o,delay:s},c){let l=t.machine.implementations.delays;if(typeof a==`string`)throw Error(`Only event objects may be used with sendTo; use sendTo({ type: "${a}" }) instead`);let u=typeof a==`function`?a(n,r):a,d;if(typeof s==`string`){let e=l&&l[s];d=typeof e==`function`?e(n,r):e}else d=typeof s==`function`?s(n,r):s;let f=typeof i==`function`?i(n,r):i,p;if(typeof f==`string`){if(p=f===Mt.Parent?e.self._parent:f===Mt.Internal?e.self:f.startsWith(`#_`)?t.children[f.slice(2)]:c.deferredActorIds?.includes(f)?f:t.children[f],!p)throw Error(`Unable to send event to actor '${f}' from machine '${t.machine.id}'.`)}else p=f||e.self;return[t,{to:p,targetId:typeof f==`string`?f:void 0,event:u,id:o,delay:d},void 0]}function Pt(e,t,n){typeof n.to==`string`&&(n.to=t.children[n.to])}function Ft(e,t){e.defer(()=>{let{to:n,event:r,delay:i,id:a}=t;if(typeof i==`number`){e.system.scheduler.schedule(e.self,n,r,i,a);return}e.system._relay(e.self,n,r.type===`xstate.error`?ne(e.self.id,r.data):r)})}function It(e,t,n){function r(e,t){}return r.type=`xstate.sendTo`,r.to=e,r.event=t,r.id=n?.id,r.delay=n?.delay,r.resolve=Nt,r.retryResolve=Pt,r.execute=Ft,r}function Lt(e,t){return It(Mt.Parent,e,t)}function Rt(e,t,n,r,{collect:i}){let a=[],o=function(e){a.push(e)};return o.assign=(...e)=>{a.push(Z(...e))},o.cancel=(...e)=>{a.push(T(...e))},o.raise=(...e)=>{a.push(yt(...e))},o.sendTo=(...e)=>{a.push(It(...e))},o.sendParent=(...e)=>{a.push(Lt(...e))},o.spawnChild=(...e)=>{a.push(E(...e))},o.stopChild=(...e)=>{a.push(D(...e))},o.emit=(...e)=>{a.push(jt(...e))},i({context:n.context,event:n.event,enqueue:o,check:e=>O(e,t.context,n.event,t),self:e.self,system:e.system},r),[t,void 0,a]}function zt(e){function t(e,t){}return t.type=`xstate.enqueueActions`,t.collect=e,t.resolve=Rt,t}function Bt(e,t,n,r,{value:i,label:a}){return[t,{value:typeof i==`function`?i(n,r):i,label:a},void 0]}function Vt({logger:e},{value:t,label:n}){n?e(n,t):e(t)}function Ht(e=({context:e,event:t})=>({context:e,event:t}),t){function n(e,t){}return n.type=`xstate.log`,n.value=e,n.label=t,n.resolve=Bt,n.execute=Vt,n}function Ut(e,t){let n=v(t);if(!n.some(t=>he(e.type,t))){let t=n.length===1?`type matching "${n[0]}"`:`one of types matching "${n.join(`", "`)}"`;throw Error(`Expected event ${JSON.stringify(e)} to have ${t}`)}}function Wt(e,t){return new Ot(e,t)}function Gt({schemas:e,actors:t,actions:n,guards:r,delays:i}){return{assign:Z,sendTo:It,raise:yt,log:Ht,cancel:T,stopChild:D,enqueueActions:zt,emit:jt,spawnChild:E,createStateConfig:e=>e,createAction:e=>e,createMachine:a=>Wt({...a,schemas:e},{actors:t,actions:n,guards:r,delays:i}),extend:a=>Gt({schemas:e,actors:t,actions:{...n,...a.actions},guards:{...r,...a.guards},delays:{...i,...a.delays}})}}r();var Kt=n(),qt=(e,t)=>{t(e);let n=e.getSnapshot().children;n&&Object.values(n).forEach(e=>{qt(e,t)})};function Jt(e){let t=[];qt(e,e=>{t.push([e,e.getSnapshot()]),e.observers=new Set});let n=e.system.getSnapshot?.();e.stop(),e.system._snapshot=n,t.forEach(([e,t])=>{e._processingStatus=0,e._snapshot=t})}function Yt(e,...[t]){let[[n,r],o]=(0,i.useState)(()=>{let n=w(e,t);return[e.config,n]});if(e.config!==n){let n=w(e,{...t,snapshot:r.getPersistedSnapshot({__unsafeAllowInlineActors:!0})});o([e.config,n]),r=n}return a(()=>{r.logic.implementations=e.implementations}),r}function Xt(e,...[t]){let n=Yt(e,t),r=(0,i.useCallback)(()=>n.getSnapshot(),[n]),a=(0,Kt.useSyncExternalStore)((0,i.useCallback)(e=>{let{unsubscribe:t}=n.subscribe({next:e,error:e});return t},[n]),r,r),o=`status`in a?a:void 0;if(o?.status===`error`)throw o.error;return(0,i.useEffect)(()=>(n.start(),()=>{Jt(n)}),[n]),[a,n.send,n]}export{St as a,Z as i,Ut as n,Gt as r,Xt as t};
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
})();
|
|
20
20
|
</script>
|
|
21
|
-
<script type="module" crossorigin src="/assets/index-
|
|
21
|
+
<script type="module" crossorigin src="/assets/index-BZrWlEXZ.js"></script>
|
|
22
22
|
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-DG_AJzB_.js">
|
|
23
23
|
<link rel="modulepreload" crossorigin href="/assets/useRouterState-DpT8luFk.js">
|
|
24
24
|
<link rel="modulepreload" crossorigin href="/assets/link-Cgvqhh5w.js">
|