@astralbeam/sdk 0.15.0 → 0.15.2
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/README.md +24 -24
- package/dist/{api-UjE4fiRE.js → api-r11gRy91.js} +1 -1
- package/dist/api.js +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +1 -1
- package/dist/constants-enyqxaJi.js +1 -0
- package/dist/{core-CQcf1z-y.js → core-BGDo_tQ4.js} +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/{index-BlOXkzYq.d.ts → index-DUznpmNz.d.ts} +1 -1
- package/dist/{listings-BQZUPClK.js → listings-6eaCXB6G.js} +2 -2
- package/dist/react.d.ts +1 -1
- package/dist/react.js +2 -2
- package/dist/styles.generated-Bub4csY_.js +60 -0
- package/dist/widget-Bjm0sUjE.js +26 -0
- package/package.json +8 -8
- package/dist/constants-CgaMxV3q.js +0 -1
- package/dist/styles.generated-D-Scd4Y1.js +0 -60
- package/dist/widget-CPr8YOFO.js +0 -26
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ npm install @astralbeam/sdk
|
|
|
8
8
|
|
|
9
9
|
## Quick start
|
|
10
10
|
|
|
11
|
-
One component in React, one function everywhere else. Full setup, including the required token endpoint, is in [Getting started](https://
|
|
11
|
+
One component in React, one function everywhere else. Full setup, including the required token endpoint, is in [Getting started](https://astralbeam.ai/docs/sdk/getting-started).
|
|
12
12
|
|
|
13
13
|
```tsx
|
|
14
14
|
import { AstralBeamChat } from "@astralbeam/sdk/react"
|
|
@@ -25,11 +25,11 @@ const handle = mountAstralBeamChat(document.getElementById("sidebar"), {})
|
|
|
25
25
|
// Update with handle.update({ colorScheme: "dark" }), then clean up with handle.unmount().
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
Without npm or a bundler, import the same entry from jsDelivr in a module script. Pin an exact version and the full `/dist/client.js` path, because the loader imports its lazy chunks relative to itself. See [Script tag](https://
|
|
28
|
+
Without npm or a bundler, import the same entry from jsDelivr in a module script. Pin an exact version and the full `/dist/client.js` path, because the loader imports its lazy chunks relative to itself. See [Script tag](https://astralbeam.ai/docs/sdk/script-tag).
|
|
29
29
|
|
|
30
30
|
```html
|
|
31
31
|
<script type="module">
|
|
32
|
-
import { mountAstralBeamChat } from "https://cdn.jsdelivr.net/npm/@astralbeam/sdk@0.15.
|
|
32
|
+
import { mountAstralBeamChat } from "https://cdn.jsdelivr.net/npm/@astralbeam/sdk@0.15.2/dist/client.js"
|
|
33
33
|
|
|
34
34
|
mountAstralBeamChat(document.getElementById("sidebar"), {})
|
|
35
35
|
</script>
|
|
@@ -43,7 +43,7 @@ Without npm or a bundler, import the same entry from jsDelivr in a module script
|
|
|
43
43
|
|
|
44
44
|
## Authentication
|
|
45
45
|
|
|
46
|
-
Your server must authenticate the host session and mint a chat token before the widget can chat. Keep the API key server-only. See [Authentication](https://
|
|
46
|
+
Your server must authenticate the host session and mint a chat token before the widget can chat. Keep the API key server-only. See [Authentication](https://astralbeam.ai/docs/sdk/authentication).
|
|
47
47
|
|
|
48
48
|
```ts
|
|
49
49
|
import { createAstralBeamToken } from "@astralbeam/sdk/server"
|
|
@@ -79,19 +79,19 @@ export async function POST(request: Request) {
|
|
|
79
79
|
- Authenticate once and derive stable `user.id` and `tenant.id` values from that trusted session.
|
|
80
80
|
- Keep API keys server-only. Tokens are signed, not encrypted, so their claims must contain no secrets.
|
|
81
81
|
- Return `Cache-Control: no-store` and fail closed when configuration or authentication is missing.
|
|
82
|
-
- Directory access additionally requires signed `user.admin: true`, derived from trusted tenant permissions, and persisted records. Follow [Tenant directories](https://
|
|
83
|
-
- For employee-facing Tenant management, use `createAstralBeamOrganizationToken`. The [API client guide](https://
|
|
82
|
+
- Directory access additionally requires signed `user.admin: true`, derived from trusted tenant permissions, and persisted records. Follow [Tenant directories](https://astralbeam.ai/docs/sdk/listings).
|
|
83
|
+
- For employee-facing Tenant management, use `createAstralBeamOrganizationToken`. The [API client guide](https://astralbeam.ai/docs/sdk/api) covers database-backed roles and browser integration.
|
|
84
84
|
|
|
85
|
-
Existing token props and the default chat endpoint keep working. After acquiring a token, components call `POST /api/v1/me` and renew before expiry. See [authentication and refresh behavior](https://
|
|
85
|
+
Existing token props and the default chat endpoint keep working. After acquiring a token, components call `POST /api/v1/me` and renew before expiry. See [authentication and refresh behavior](https://astralbeam.ai/docs/sdk/authentication).
|
|
86
86
|
|
|
87
87
|
## Options
|
|
88
88
|
|
|
89
|
-
Every option is also a prop on `<AstralBeamChat>`. `handle.update(options)` applies any subset in place, and no option is fixed at mount. Details in [Configuration](https://
|
|
89
|
+
Every option is also a prop on `<AstralBeamChat>`. `handle.update(options)` applies any subset in place, and no option is fixed at mount. Details in [Configuration](https://astralbeam.ai/docs/sdk/configuration).
|
|
90
90
|
|
|
91
91
|
| Option | Default | Meaning |
|
|
92
92
|
| --- | --- | --- |
|
|
93
93
|
| `agentId` | organization's default | `agent_<orgId>_<id>`, copied from the dashboard |
|
|
94
|
-
| `apiUrl` | `https://
|
|
94
|
+
| `apiUrl` | `https://astralbeam.ai/api` | Base URL of the AstralBeam API. The widget calls `/v1/chat` there |
|
|
95
95
|
| `fetchAstralBeamToken` | `{ url: "/api/astralbeam/token" }` | Chat auth token endpoint as `{ url, ...RequestInit }`, or a minter |
|
|
96
96
|
| `title`, `showHeader` | `"AstralBeam"`, `true` | Header text, and whether the header and reset button show |
|
|
97
97
|
| `emptyTitle`, `emptyDescription` | generic copy | Headline and subtitle of the empty transcript |
|
|
@@ -107,7 +107,7 @@ A `ref` on `<AstralBeamChat>` (and the vanilla handle) exposes `reset()` and `st
|
|
|
107
107
|
|
|
108
108
|
## Tools and widgets
|
|
109
109
|
|
|
110
|
-
A tool does something: its `execute` runs in your page. A widget shows something: its `render` draws your UI into the conversation. Both are declared with a `description` and a `parameters` schema. See [Tools and widgets](https://
|
|
110
|
+
A tool does something: its `execute` runs in your page. A widget shows something: its `render` draws your UI into the conversation. Both are declared with a `description` and a `parameters` schema. See [Tools and widgets](https://astralbeam.ai/docs/sdk/tools-and-widgets).
|
|
111
111
|
|
|
112
112
|
```tsx
|
|
113
113
|
tools: {
|
|
@@ -135,23 +135,23 @@ widgets: {
|
|
|
135
135
|
|
|
136
136
|
| Guide | Covers |
|
|
137
137
|
| --- | --- |
|
|
138
|
-
| [API client](https://
|
|
139
|
-
| [Getting started](https://
|
|
140
|
-
| [Script tag](https://
|
|
141
|
-
| [Authentication](https://
|
|
142
|
-
| [Tenant directories](https://
|
|
143
|
-
| [Configuration](https://
|
|
144
|
-
| [Theming](https://
|
|
145
|
-
| [Tools and widgets](https://
|
|
146
|
-
| [Attachments](https://
|
|
147
|
-
| [Limits](https://
|
|
148
|
-
| [Sandbox](https://
|
|
149
|
-
| [Headless](https://
|
|
150
|
-
| [Security model](https://
|
|
138
|
+
| [API client](https://astralbeam.ai/docs/sdk/api) | Typed resource and chat requests with API keys or JWTs. |
|
|
139
|
+
| [Getting started](https://astralbeam.ai/docs/sdk/getting-started) | install, mount, layout requirements. |
|
|
140
|
+
| [Script tag](https://astralbeam.ai/docs/sdk/script-tag) | loading from jsDelivr without a bundler, and Ruby on Rails. |
|
|
141
|
+
| [Authentication](https://astralbeam.ai/docs/sdk/authentication) | the token endpoint, its security rules, and minting in other languages. |
|
|
142
|
+
| [Tenant directories](https://astralbeam.ai/docs/sdk/listings) | provisioning, tenant-user and Tenant listings, lifecycle, and options. |
|
|
143
|
+
| [Configuration](https://astralbeam.ai/docs/sdk/configuration) | every option, and what `update` can change. |
|
|
144
|
+
| [Theming](https://astralbeam.ai/docs/sdk/theming) | color schemes, CSS tokens, the shadow-root boundary. |
|
|
145
|
+
| [Tools and widgets](https://astralbeam.ai/docs/sdk/tools-and-widgets) | schemas, live state, rendering into the transcript. |
|
|
146
|
+
| [Attachments](https://astralbeam.ai/docs/sdk/attachments) | file kinds, limits, what the endpoint enforces. |
|
|
147
|
+
| [Limits](https://astralbeam.ai/docs/sdk/limits) | request, attachment, and sandbox limits. |
|
|
148
|
+
| [Sandbox](https://astralbeam.ai/docs/sdk/sandbox) | steps, the opt-in panel, downloads, inline images. |
|
|
149
|
+
| [Headless](https://astralbeam.ai/docs/sdk/headless) | own the whole chat UI on the same session. |
|
|
150
|
+
| [Security model](https://astralbeam.ai/docs/sdk/security) | who grants, who enforces, what the client can change. |
|
|
151
151
|
|
|
152
152
|
## Entry points
|
|
153
153
|
|
|
154
|
-
Read-only Tenant and TenantUser widgets are available from `/client` and `/react`. See [Tenant directories](https://
|
|
154
|
+
Read-only Tenant and TenantUser widgets are available from `/client` and `/react`. See [Tenant directories](https://astralbeam.ai/docs/sdk/listings) for setup and embedding examples.
|
|
155
155
|
|
|
156
156
|
There is no root export. Conversation history is not built yet.
|
|
157
157
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/lib/constants.ts
|
|
2
2
|
/** Base URL of the AstralBeam API when the mount options give none; versioned routes hang off it. */
|
|
3
|
-
const DEFAULT_API_URL = "https://
|
|
3
|
+
const DEFAULT_API_URL = "https://astralbeam.ai/api";
|
|
4
4
|
/** Host endpoint that mints chat JWTs when the mount options give none. */
|
|
5
5
|
const DEFAULT_CHAT_AUTH_TOKEN_URL = "/api/astralbeam/token";
|
|
6
6
|
/** Color scheme used when the mount options and the React prop give none. */
|
package/dist/api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as listTenants, D as updateTenantUser, E as updateTenant, S as getUpdateTenantUserUrl, T as runChat, _ as getOrganization, a as getChatFile, b as getTenantUser, c as getCurrentUser, d as getGetCurrentUserUrl, f as getGetOrganizationUrl, g as getListUsersForTenantUrl, h as getListTenantsUrl, i as getChatConfig, k as isAstralBeamApiError, l as getGetChatConfigUrl, m as getGetTenantUserUrl, n as createTenant, o as getCreateTenantUrl, p as getGetTenantUrl, r as createTenantUser, s as getCreateTenantUserUrl, t as ListUsersForTenantFilterAdmin, u as getGetChatFileUrl, v as getRunChatUrl, w as listUsersForTenant, x as getUpdateTenantUrl, y as getTenant } from "./api-
|
|
1
|
+
import { C as listTenants, D as updateTenantUser, E as updateTenant, S as getUpdateTenantUserUrl, T as runChat, _ as getOrganization, a as getChatFile, b as getTenantUser, c as getCurrentUser, d as getGetCurrentUserUrl, f as getGetOrganizationUrl, g as getListUsersForTenantUrl, h as getListTenantsUrl, i as getChatConfig, k as isAstralBeamApiError, l as getGetChatConfigUrl, m as getGetTenantUserUrl, n as createTenant, o as getCreateTenantUrl, p as getGetTenantUrl, r as createTenantUser, s as getCreateTenantUserUrl, t as ListUsersForTenantFilterAdmin, u as getGetChatFileUrl, v as getRunChatUrl, w as listUsersForTenant, x as getUpdateTenantUrl, y as getTenant } from "./api-r11gRy91.js";
|
|
2
2
|
export { ListUsersForTenantFilterAdmin, createTenant, createTenantUser, getChatConfig, getChatFile, getCreateTenantUrl, getCreateTenantUserUrl, getCurrentUser, getGetChatConfigUrl, getGetChatFileUrl, getGetCurrentUserUrl, getGetOrganizationUrl, getGetTenantUrl, getGetTenantUserUrl, getListTenantsUrl, getListUsersForTenantUrl, getOrganization, getRunChatUrl, getTenant, getTenantUser, getUpdateTenantUrl, getUpdateTenantUserUrl, isAstralBeamApiError, listTenants, listUsersForTenant, runChat, updateTenant, updateTenantUser };
|
package/dist/client.d.ts
CHANGED
|
@@ -155,7 +155,7 @@ interface MountAstralBeamChatOptions {
|
|
|
155
155
|
emptyDescription?: string | undefined;
|
|
156
156
|
/**
|
|
157
157
|
* Base URL of the AstralBeam API; the widget calls `/v1/chat` and its subroutes under it. Read for
|
|
158
|
-
* every request, so a change moves the next one. Default `"https://
|
|
158
|
+
* every request, so a change moves the next one. Default `"https://astralbeam.ai/api"`, the
|
|
159
159
|
* hosted cloud; self-hosted deployments must set their own origin.
|
|
160
160
|
*/
|
|
161
161
|
apiUrl?: string | undefined;
|
package/dist/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./constants-
|
|
1
|
+
import{s as e}from"./constants-enyqxaJi.js";import{t}from"./debug-qLts7gEt.js";function n(e,t,n,r){let i=n.colorScheme??`system`,a=i===`dark`||i===`system`&&r;e.classList.toggle(`dark`,a);for(let n of t)e.style.removeProperty(n);t.clear();let o={...n.theme?.light,...a?n.theme?.dark:void 0};for(let[n,r]of Object.entries(o))n.startsWith(`--`)&&(e.style.setProperty(n,r),t.add(n));return{colorScheme:i,dark:a}}function r(e){return e}function i(e){return e}function a(e,t){return s(e,t,`tenants`)}function o(e,t){return s(e,t,`users`)}function s(t,n,r){let i=t.shadowRoot??t.attachShadow({mode:`open`}),a=document.createElement(`div`);a.className=`${e} bg-transparent`,a.style.height=`100%`,i.append(a);let o=matchMedia(`(prefers-color-scheme: dark)`),s={options:{...n},kind:r,shadow:i,container:a,media:o,variables:new Set,disposed:!1},f=()=>c(s);return f(),o.addEventListener(`change`,f),l(s),{update:e=>u(s,e),refresh:()=>{!s.disposed&&s.renderer&&s.runtime.refreshListing(s.renderer)},reset:()=>{!s.disposed&&s.renderer&&s.runtime.resetListing(s.renderer)},unmount:()=>d(s,f)}}function c({options:e,media:t,container:r,variables:i}){n(r,i,e,t.matches)}async function l(e){e.retryLoad?.remove();try{if(e.runtime=await import(`./listings-6eaCXB6G.js`),e.disposed)return;e.renderer=e.runtime.renderListing(e.shadow,e.container,e.options,e.kind)}catch{if(e.disposed)return;e.retryLoad=document.createElement(`button`),e.retryLoad.textContent=`Could not load directory. Retry`,e.retryLoad.onclick=()=>void l(e),e.container.append(e.retryLoad)}}function u(e,t){e.disposed||(e.options={...e.options,...t},c(e),e.renderer&&e.runtime.updateListing(e.renderer,e.options))}function d(e,t){e.disposed||(e.disposed=!0,e.media.removeEventListener(`change`,t),e.renderer&&e.runtime.disposeListing(e.renderer),e.container.remove())}function f(r,i){let a={...i},o=t(a.debug);o?.(`mount`,`mounting chat widget`,{agentId:a.agentId??`(organization default)`,title:a.title??`AstralBeam`,showHeader:a.showHeader??!0,emptyTitle:a.emptyTitle??`Ask the assistant`,emptyDescription:a.emptyDescription??`It can answer questions and act through this app's own tools and widgets.`,apiUrl:a.apiUrl??`https://astralbeam.ai/api`,authentication:`configured`,colorScheme:a.colorScheme??`system`,theme:a.theme,tools:Object.keys(a.tools??{}),widgets:Object.keys(a.widgets??{}),attachments:a.attachments??!0});let s=r.shadowRoot??r.attachShadow({mode:`open`}),c=document.createElement(`div`);c.className=e,c.style.height=`100%`,s.append(c);let l=matchMedia(`(prefers-color-scheme: dark)`),u=new Set,d=()=>{let{colorScheme:e,dark:t}=n(c,u,a,l.matches);o?.(`theme`,`color scheme "${e}" resolved to ${t?`dark`:`light`}`,{themeVariables:[...u]})};d(),l.addEventListener(`change`,d);let f=!1,p;return import(`./widget-Bjm0sUjE.js`).then(({renderChat:e})=>{o?.(`mount`,`chat chunk loaded`),f||(p=e(s,c,a))}),{update:e=>{a={...a,...e},o=t(a.debug),o?.(`mount`,`options updated`,{changed:Object.keys(e)}),d(),p?.update(a)},reset:()=>p?.reset(),stop:()=>p?.stop(),unmount:()=>{o?.(`mount`,`unmounting chat widget`),f=!0,l.removeEventListener(`change`,d),p?.dispose(),p=void 0,c.remove()}}}export{r as defineTool,i as defineWidget,f as mountAstralBeamChat,a as mountAstralBeamTenantList,o as mountAstralBeamTenantUserList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=`AstralBeam`,t=`Ask the assistant`,n=`It can answer questions and act through this app's own tools and widgets.`,r=`https://astralbeam.ai/api`,i=`/api/astralbeam/token`,a=`system`,o=`astralbeam-root`;export{t as a,n as i,i as n,e as o,a as r,o as s,r as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as resolveApiUrl, O as astralBeamChatFetch, c as getCurrentUser, i as getChatConfig, k as isAstralBeamApiError, v as getRunChatUrl } from "./api-
|
|
1
|
+
import { A as resolveApiUrl, O as astralBeamChatFetch, c as getCurrentUser, i as getChatConfig, k as isAstralBeamApiError, v as getRunChatUrl } from "./api-r11gRy91.js";
|
|
2
2
|
import { d as JWTInvalid, h as strictDecoder, r as isObject, s as decode } from "./type_checks-C-WTHaWs.js";
|
|
3
3
|
//#region \0rolldown/runtime.js
|
|
4
4
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
package/dist/core.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as RenderWidgetInput, B as JsonSchemaObject, C as AstralBeamChatState, D as ChatAuthenticationState, E as createAstralBeamChat, F as SandboxStatus, H as StandardSchemaV1, M as SandboxArtifact, N as SandboxCommandRun, O as WidgetDeclaration, P as SandboxFileWrite, S as AstralBeamChatCoreOptions, T as WidgetRenderRequest, U as ToolDefinition, V as ParametersSchema, _ as hasPendingToolRun, a as SANDBOX_PUBLISH_ARTIFACT_TOOL, b as AgentToolInfo, c as SANDBOX_STATUS_EVENT, d as describeSandboxCommandRun, f as isSandboxTool, g as sandboxRefusal, h as readSandboxFileWrite, i as SANDBOX_LIST_FILES_TOOL, j as SandboxActivity, k as buildAgentTools, l as SANDBOX_WRITE_FILE_TOOL, m as readSandboxCommandRun, n as ASK_QUESTIONNAIRE_TOOL, o as SANDBOX_READ_FILE_TOOL, p as readSandboxArtifact, r as RENDER_WIDGET_TOOL, s as SANDBOX_RUN_COMMAND_TOOL, t as defineTool, u as collectSandboxActivity, v as isSettledToolCall, w as ChatStreamCallbacks, x as AstralBeamChatCore, y as lastPartInProgress, z as InferParameters } from "./index-
|
|
1
|
+
import { A as RenderWidgetInput, B as JsonSchemaObject, C as AstralBeamChatState, D as ChatAuthenticationState, E as createAstralBeamChat, F as SandboxStatus, H as StandardSchemaV1, M as SandboxArtifact, N as SandboxCommandRun, O as WidgetDeclaration, P as SandboxFileWrite, S as AstralBeamChatCoreOptions, T as WidgetRenderRequest, U as ToolDefinition, V as ParametersSchema, _ as hasPendingToolRun, a as SANDBOX_PUBLISH_ARTIFACT_TOOL, b as AgentToolInfo, c as SANDBOX_STATUS_EVENT, d as describeSandboxCommandRun, f as isSandboxTool, g as sandboxRefusal, h as readSandboxFileWrite, i as SANDBOX_LIST_FILES_TOOL, j as SandboxActivity, k as buildAgentTools, l as SANDBOX_WRITE_FILE_TOOL, m as readSandboxCommandRun, n as ASK_QUESTIONNAIRE_TOOL, o as SANDBOX_READ_FILE_TOOL, p as readSandboxArtifact, r as RENDER_WIDGET_TOOL, s as SANDBOX_RUN_COMMAND_TOOL, t as defineTool, u as collectSandboxActivity, v as isSettledToolCall, w as ChatStreamCallbacks, x as AstralBeamChatCore, y as lastPartInProgress, z as InferParameters } from "./index-DUznpmNz.js";
|
|
2
2
|
export { ASK_QUESTIONNAIRE_TOOL, type AgentToolInfo, type AstralBeamChatCore, type AstralBeamChatCoreOptions, type AstralBeamChatState, type ChatAuthenticationState, type ChatStreamCallbacks, type InferParameters, type JsonSchemaObject, type ParametersSchema, RENDER_WIDGET_TOOL, type RenderWidgetInput, SANDBOX_LIST_FILES_TOOL, SANDBOX_PUBLISH_ARTIFACT_TOOL, SANDBOX_READ_FILE_TOOL, SANDBOX_RUN_COMMAND_TOOL, SANDBOX_STATUS_EVENT, SANDBOX_WRITE_FILE_TOOL, type SandboxActivity, type SandboxArtifact, type SandboxCommandRun, type SandboxFileWrite, type SandboxStatus, type StandardSchemaV1, type ToolDefinition, type WidgetDeclaration, type WidgetRenderRequest, buildAgentTools, collectSandboxActivity, createAstralBeamChat, defineTool, describeSandboxCommandRun, hasPendingToolRun, isSandboxTool, isSettledToolCall, lastPartInProgress, readSandboxArtifact, readSandboxCommandRun, readSandboxFileWrite, sandboxRefusal };
|
package/dist/core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { S as SANDBOX_WRITE_FILE_TOOL, _ as SANDBOX_LIST_FILES_TOOL, a as describeSandboxCommandRun, b as SANDBOX_RUN_COMMAND_TOOL, c as readSandboxCommandRun, d as hasPendingToolRun, f as isSettledToolCall, g as RENDER_WIDGET_TOOL, h as ASK_QUESTIONNAIRE_TOOL, i as collectSandboxActivity, l as readSandboxFileWrite, m as buildAgentTools, o as isSandboxTool, p as lastPartInProgress, r as createAstralBeamChat, s as readSandboxArtifact, t as defineTool, u as sandboxRefusal, v as SANDBOX_PUBLISH_ARTIFACT_TOOL, x as SANDBOX_STATUS_EVENT, y as SANDBOX_READ_FILE_TOOL } from "./core-
|
|
1
|
+
import { S as SANDBOX_WRITE_FILE_TOOL, _ as SANDBOX_LIST_FILES_TOOL, a as describeSandboxCommandRun, b as SANDBOX_RUN_COMMAND_TOOL, c as readSandboxCommandRun, d as hasPendingToolRun, f as isSettledToolCall, g as RENDER_WIDGET_TOOL, h as ASK_QUESTIONNAIRE_TOOL, i as collectSandboxActivity, l as readSandboxFileWrite, m as buildAgentTools, o as isSandboxTool, p as lastPartInProgress, r as createAstralBeamChat, s as readSandboxArtifact, t as defineTool, u as sandboxRefusal, v as SANDBOX_PUBLISH_ARTIFACT_TOOL, x as SANDBOX_STATUS_EVENT, y as SANDBOX_READ_FILE_TOOL } from "./core-BGDo_tQ4.js";
|
|
2
2
|
export { ASK_QUESTIONNAIRE_TOOL, RENDER_WIDGET_TOOL, SANDBOX_LIST_FILES_TOOL, SANDBOX_PUBLISH_ARTIFACT_TOOL, SANDBOX_READ_FILE_TOOL, SANDBOX_RUN_COMMAND_TOOL, SANDBOX_STATUS_EVENT, SANDBOX_WRITE_FILE_TOOL, buildAgentTools, collectSandboxActivity, createAstralBeamChat, defineTool, describeSandboxCommandRun, hasPendingToolRun, isSandboxTool, isSettledToolCall, lastPartInProgress, readSandboxArtifact, readSandboxCommandRun, readSandboxFileWrite, sandboxRefusal };
|
|
@@ -5816,7 +5816,7 @@ interface MountAstralBeamChatOptions {
|
|
|
5816
5816
|
emptyDescription?: string | undefined;
|
|
5817
5817
|
/**
|
|
5818
5818
|
* Base URL of the AstralBeam API; the widget calls `/v1/chat` and its subroutes under it. Read for
|
|
5819
|
-
* every request, so a change moves the next one. Default `"https://
|
|
5819
|
+
* every request, so a change moves the next one. Default `"https://astralbeam.ai/api"`, the
|
|
5820
5820
|
* hosted cloud; self-hosted deployments must set their own origin.
|
|
5821
5821
|
*/
|
|
5822
5822
|
apiUrl?: string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$n as e,$t as t,A as n,An as r,At as i,B as a,Bn as o,Bt as s,C as c,Cn as l,Ct as u,D as d,Dn as f,Dt as p,En as m,Et as h,F as g,Fn as _,Ft as v,G as y,Gn as b,Gt as x,Hn as S,Ht as C,I as w,In as T,It as E,J as D,Jn as O,Jt as k,K as A,Kn as j,Kt as M,L as N,Ln as P,Lt as F,Mn as I,Mt as L,N as ee,Nn as R,Nt as z,O as te,Ot as B,P as V,Pn as H,Pt as U,Q as W,Qn as ne,R as re,Rn as G,Rt as ie,S as ae,Sn as K,St as oe,T as se,Tn as ce,Tt as le,U as ue,Un as de,Ut as fe,V as pe,Vn as me,Vt as he,W as ge,Wn as _e,Wt as ve,X as ye,Xn as be,Xt as xe,Yn as Se,Yt as Ce,Z as we,Zn as Te,Zt as Ee,_ as q,_n as De,_t as Oe,a as ke,an as Ae,ar as je,at as Me,bt as Ne,c as Pe,cn as Fe,cr as Ie,ct as Le,d as Re,dn as ze,dt as Be,en as Ve,er as He,et as Ue,f as We,fn as Ge,ft as Ke,g as qe,gn as Je,gt as Ye,h as Xe,ht as Ze,i as Qe,in as $e,ir as J,it as et,j as tt,jn as nt,jt as rt,k as it,kt as at,l as ot,ln as st,lt as ct,m as lt,mn as ut,mt as dt,n as ft,nn as pt,nr as mt,nt as ht,o as gt,on as _t,or as Y,ot as vt,p as yt,pn as bt,pt as xt,q as St,qn as Ct,qt as wt,r as Tt,rn as Et,rr as Dt,rt as Ot,sn as kt,sr as At,t as jt,tn as Mt,tr as Nt,tt as Pt,u as Ft,un as It,ut as Lt,vn as Rt,vt as zt,wn as Bt,wt as Vt,x as Ht,xn as Ut,xt as Wt,yn as Gt,yt as Kt,zn as qt,zt as Jt}from"./styles.generated-D-Scd4Y1.js";var X=Ie(Y(),1);const Yt=new Map([[`bold`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M244,56v48a12,12,0,0,1-12,12H184a12,12,0,1,1,0-24H201.1l-19-17.38c-.13-.12-.26-.24-.38-.37A76,76,0,1,0,127,204h1a75.53,75.53,0,0,0,52.15-20.72,12,12,0,0,1,16.49,17.45A99.45,99.45,0,0,1,128,228h-1.37A100,100,0,1,1,198.51,57.06L220,76.72V56a12,12,0,0,1,24,0Z`}))],[`duotone`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),X.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`fill`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1-5.66-13.66l17-17-10.55-9.65-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,1,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60l10.93,10L226.34,50.3A8,8,0,0,1,240,56Z`}))],[`light`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M238,56v48a6,6,0,0,1-6,6H184a6,6,0,0,1,0-12h32.55l-30.38-27.8c-.06-.06-.12-.13-.19-.19a82,82,0,1,0-1.7,117.65,6,6,0,0,1,8.24,8.73A93.46,93.46,0,0,1,128,222h-1.28A94,94,0,1,1,194.37,61.4L226,90.35V56a6,6,0,1,1,12,0Z`}))],[`regular`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`thin`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M236,56v48a4,4,0,0,1-4,4H184a4,4,0,0,1,0-8h37.7L187.53,68.69l-.13-.12a84,84,0,1,0-1.75,120.51,4,4,0,0,1,5.5,5.82A91.43,91.43,0,0,1,128,220h-1.26A92,92,0,1,1,193,62.84l35,32.05V56a4,4,0,1,1,8,0Z`}))]]),Xt=new Map([[`bold`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,204H228V96a20,20,0,0,0-20-20H172V32a20,20,0,0,0-28.45-18.12l-104,48.54A20.06,20.06,0,0,0,28,80.55V204H16a12,12,0,0,0,0,24H240a12,12,0,0,0,0-24ZM204,100V204H172V100ZM52,83.09,148,38.3V204H52ZM132,112v12a12,12,0,0,1-24,0V112a12,12,0,0,1,24,0Zm-40,0v12a12,12,0,0,1-24,0V112a12,12,0,0,1,24,0Zm0,52v12a12,12,0,0,1-24,0V164a12,12,0,0,1,24,0Zm40,0v12a12,12,0,0,1-24,0V164a12,12,0,0,1,24,0Z`}))],[`duotone`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M136,32V216H40V85.35a8,8,0,0,1,3.56-6.66l80-53.33A8,8,0,0,1,136,32Z`,opacity:`0.2`}),X.createElement(`path`,{d:`M240,208H224V96a16,16,0,0,0-16-16H144V32a16,16,0,0,0-24.88-13.32L39.12,72A16,16,0,0,0,32,85.34V208H16a8,8,0,0,0,0,16H240a8,8,0,0,0,0-16ZM208,96V208H144V96ZM48,85.34,128,32V208H48ZM112,112v16a8,8,0,0,1-16,0V112a8,8,0,1,1,16,0Zm-32,0v16a8,8,0,0,1-16,0V112a8,8,0,1,1,16,0Zm0,56v16a8,8,0,0,1-16,0V168a8,8,0,0,1,16,0Zm32,0v16a8,8,0,0,1-16,0V168a8,8,0,0,1,16,0Z`}))],[`fill`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M239.73,208H224V96a16,16,0,0,0-16-16H164a4,4,0,0,0-4,4V208H144V32.41a16.43,16.43,0,0,0-6.16-13,16,16,0,0,0-18.72-.69L39.12,72A16,16,0,0,0,32,85.34V208H16.27A8.18,8.18,0,0,0,8,215.47,8,8,0,0,0,16,224H240a8,8,0,0,0,8-8.53A8.18,8.18,0,0,0,239.73,208ZM76,184a8,8,0,0,1-8.53,8A8.18,8.18,0,0,1,60,183.72V168.27A8.19,8.19,0,0,1,67.47,160,8,8,0,0,1,76,168Zm0-56a8,8,0,0,1-8.53,8A8.19,8.19,0,0,1,60,127.72V112.27A8.19,8.19,0,0,1,67.47,104,8,8,0,0,1,76,112Zm40,56a8,8,0,0,1-8.53,8,8.18,8.18,0,0,1-7.47-8.26V168.27a8.19,8.19,0,0,1,7.47-8.26,8,8,0,0,1,8.53,8Zm0-56a8,8,0,0,1-8.53,8,8.19,8.19,0,0,1-7.47-8.26V112.27a8.19,8.19,0,0,1,7.47-8.26,8,8,0,0,1,8.53,8Z`}))],[`light`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,210H222V96a14,14,0,0,0-14-14H142V32a14,14,0,0,0-21.77-11.64l-80,53.33A14,14,0,0,0,34,85.34V210H16a6,6,0,0,0,0,12H240a6,6,0,0,0,0-12ZM208,94a2,2,0,0,1,2,2V210H142V94ZM46,85.34a2,2,0,0,1,.89-1.66l80-53.34A2,2,0,0,1,130,32V210H46ZM110,112v16a6,6,0,0,1-12,0V112a6,6,0,0,1,12,0Zm-32,0v16a6,6,0,0,1-12,0V112a6,6,0,0,1,12,0Zm0,56v16a6,6,0,0,1-12,0V168a6,6,0,0,1,12,0Zm32,0v16a6,6,0,0,1-12,0V168a6,6,0,0,1,12,0Z`}))],[`regular`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,208H224V96a16,16,0,0,0-16-16H144V32a16,16,0,0,0-24.88-13.32L39.12,72A16,16,0,0,0,32,85.34V208H16a8,8,0,0,0,0,16H240a8,8,0,0,0,0-16ZM208,96V208H144V96ZM48,85.34,128,32V208H48ZM112,112v16a8,8,0,0,1-16,0V112a8,8,0,1,1,16,0Zm-32,0v16a8,8,0,0,1-16,0V112a8,8,0,1,1,16,0Zm0,56v16a8,8,0,0,1-16,0V168a8,8,0,0,1,16,0Zm32,0v16a8,8,0,0,1-16,0V168a8,8,0,0,1,16,0Z`}))],[`thin`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,212H220V96a12,12,0,0,0-12-12H140V32a12,12,0,0,0-18.66-10l-80,53.33a12,12,0,0,0-5.34,10V212H16a4,4,0,0,0,0,8H240a4,4,0,0,0,0-8ZM208,92a4,4,0,0,1,4,4V212H140V92ZM44,85.34A4,4,0,0,1,45.78,82l80-53.33A4,4,0,0,1,132,32V212H44ZM108,112v16a4,4,0,0,1-8,0V112a4,4,0,0,1,8,0Zm-32,0v16a4,4,0,0,1-8,0V112a4,4,0,0,1,8,0Zm0,56v16a4,4,0,0,1-8,0V168a4,4,0,0,1,8,0Zm32,0v16a4,4,0,0,1-8,0V168a4,4,0,0,1,8,0Z`}))]]),Zt=new Map([[`bold`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z`}))],[`duotone`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),X.createElement(`path`,{d:`M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z`}))],[`fill`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z`}))],[`light`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z`}))]]),Qt=new Map([[`bold`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M125.18,156.94a64,64,0,1,0-82.36,0,100.23,100.23,0,0,0-39.49,32,12,12,0,0,0,19.35,14.2,76,76,0,0,1,122.64,0,12,12,0,0,0,19.36-14.2A100.33,100.33,0,0,0,125.18,156.94ZM44,108a40,40,0,1,1,40,40A40,40,0,0,1,44,108Zm206.1,97.67a12,12,0,0,1-16.78-2.57A76.31,76.31,0,0,0,172,172a12,12,0,0,1,0-24,40,40,0,1,0-10.3-78.67,12,12,0,1,1-6.16-23.19,64,64,0,0,1,57.64,110.8,100.23,100.23,0,0,1,39.49,32A12,12,0,0,1,250.1,205.67Z`}))],[`duotone`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M136,108A52,52,0,1,1,84,56,52,52,0,0,1,136,108Z`,opacity:`0.2`}),X.createElement(`path`,{d:`M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z`}))],[`fill`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M164.47,195.63a8,8,0,0,1-6.7,12.37H10.23a8,8,0,0,1-6.7-12.37,95.83,95.83,0,0,1,47.22-37.71,60,60,0,1,1,66.5,0A95.83,95.83,0,0,1,164.47,195.63Zm87.91-.15a95.87,95.87,0,0,0-47.13-37.56A60,60,0,0,0,144.7,54.59a4,4,0,0,0-1.33,6A75.83,75.83,0,0,1,147,150.53a4,4,0,0,0,1.07,5.53,112.32,112.32,0,0,1,29.85,30.83,23.92,23.92,0,0,1,3.65,16.47,4,4,0,0,0,3.95,4.64h60.3a8,8,0,0,0,7.73-5.93A8.22,8.22,0,0,0,252.38,195.48Z`}))],[`light`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M112.6,158.43a58,58,0,1,0-57.2,0A93.83,93.83,0,0,0,5.21,196.72a6,6,0,0,0,10.05,6.56,82,82,0,0,1,137.48,0,6,6,0,0,0,10-6.56A93.83,93.83,0,0,0,112.6,158.43ZM38,108a46,46,0,1,1,46,46A46.06,46.06,0,0,1,38,108Zm211,97a6,6,0,0,1-8.3-1.74A81.8,81.8,0,0,0,172,166a6,6,0,0,1,0-12,46,46,0,1,0-17.08-88.73,6,6,0,1,1-4.46-11.14,58,58,0,0,1,50.14,104.3,93.83,93.83,0,0,1,50.19,38.29A6,6,0,0,1,249,205Z`}))],[`regular`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z`}))],[`thin`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M107.19,159a56,56,0,1,0-46.38,0A91.83,91.83,0,0,0,6.88,197.81a4,4,0,1,0,6.7,4.37,84,84,0,0,1,140.84,0,4,4,0,1,0,6.7-4.37A91.83,91.83,0,0,0,107.19,159ZM36,108a48,48,0,1,1,48,48A48.05,48.05,0,0,1,36,108Zm212,95.35a4,4,0,0,1-5.53-1.17A83.81,83.81,0,0,0,172,164a4,4,0,0,1,0-8,48,48,0,1,0-17.82-92.58,4,4,0,1,1-3-7.43,56,56,0,0,1,44,103,91.83,91.83,0,0,1,53.93,38.86A4,4,0,0,1,248,203.35Z`}))]]),$t=X.forwardRef((e,t)=>X.createElement(Dt,{ref:t,...e,weights:Yt}));$t.displayName=`ArrowClockwiseIcon`;const en=X.forwardRef((e,t)=>X.createElement(Dt,{ref:t,...e,weights:Xt}));en.displayName=`BuildingsIcon`;const tn=X.forwardRef((e,t)=>X.createElement(Dt,{ref:t,...e,weights:Zt}));tn.displayName=`CaretDownIcon`;const nn=X.forwardRef((e,t)=>X.createElement(Dt,{ref:t,...e,weights:Qt}));nn.displayName=`UsersIcon`;const rn=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`),an=!rn&&Et.includes(`firefox`);!rn&&Et.includes(`chrom`);const on=Mt;function sn(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function cn(e){return e.matches(`html,body`)}function ln(e){return j(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function un(e){return e?e.getAttribute(`role`)===`combobox`&&ln(e):!1}function dn(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function fn(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...fn(e,t.id,n)])}function pn(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function mn(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return be(n)?n.host:null}function hn(e){for(let t of Array.from(e.children))if(qt(t)===`summary`)return t;return null}function gn(e,t){let n=hn(t);return!!n&&(e===n||x(n,e))}function _n(e){let t=e?qt(e):``;return e!=null&&e.matches(`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`)&&(t!==`summary`||e.parentElement!=null&&qt(e.parentElement)===`details`&&hn(e.parentElement)===e)&&(t!==`details`||hn(e)==null)&&(t!==`input`||e.type!==`hidden`)}function vn(e){if(!_n(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=mn(t)){let n=t!==e,r=qt(t)===`slot`;if(t.hasAttribute(`inert`)||n&&qt(t)===`details`&&!t.open&&!gn(e,t)||t.hasAttribute(`hidden`)||!r&&!yn(t,n))return!1}return!0}function yn(e,t){let n=_(e);return t?n.display!==`none`:Ye(e,n)}function bn(e){let t=e.tabIndex;if(t<0){let t=qt(e);if(t===`details`||t===`audio`||t===`video`||j(e)&&e.isContentEditable)return 0}return t}function xn(e){if(qt(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Sn(e,t){let n=xn(e);if(!n)return!0;let r=t.find(e=>{let t=xn(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=xn(e);return t?.name===n.name&&t.form===n.form})===n}function Cn(e){if(j(e)&&qt(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return j(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function wn(e,t){Cn(e).forEach(e=>{_n(e)&&t.push(e),wn(e,t)})}function Tn(e,t,n){Cn(e).forEach(e=>{j(e)&&e.matches(t)&&n.push(e),Tn(e,t,n)})}function En(e){return vn(e)&&bn(e)>=0}function Dn(e){let t=[];return wn(e,t),t.filter(vn)}function On(e){let t=Dn(e);return t.filter(e=>bn(e)>=0&&Sn(e,t))}function kn(e,t){let n=On(e),r=n.length;if(r===0)return;let i=ve(f(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function An(e){return kn(f(e).body,1)||e}function jn(e){return kn(f(e).body,-1)||e}function Mn(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!x(n,r)}function Nn(e){On(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Pn(e){let t=[];Tn(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var Fn=class e{static create(){return new e}currentId=0;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=0,t()},e)}isStarted(){return this.currentId!==0}clear=()=>{this.currentId!==0&&(clearTimeout(this.currentId),this.currentId=0)};disposeEffect=()=>this.clear};function In(){let e=H(Fn.create).current;return Be(e.disposeEffect),e}
|
|
1
|
+
import{$n as e,$t as t,A as n,An as r,At as i,B as a,Bn as o,Bt as s,C as c,Cn as l,Ct as u,D as d,Dn as f,Dt as p,En as m,Et as h,F as g,Fn as _,Ft as v,G as y,Gn as b,Gt as x,Hn as S,Ht as C,I as w,In as T,It as E,J as D,Jn as O,Jt as k,K as A,Kn as j,Kt as M,L as N,Ln as P,Lt as F,Mn as I,Mt as L,N as ee,Nn as R,Nt as z,O as te,Ot as B,P as V,Pn as H,Pt as U,Q as W,Qn as ne,R as re,Rn as G,Rt as ie,S as ae,Sn as K,St as oe,T as se,Tn as ce,Tt as le,U as ue,Un as de,Ut as fe,V as pe,Vn as me,Vt as he,W as ge,Wn as _e,Wt as ve,X as ye,Xn as be,Xt as xe,Yn as Se,Yt as Ce,Z as we,Zn as Te,Zt as Ee,_ as q,_n as De,_t as Oe,a as ke,an as Ae,ar as je,at as Me,bt as Ne,c as Pe,cn as Fe,cr as Ie,ct as Le,d as Re,dn as ze,dt as Be,en as Ve,er as He,et as Ue,f as We,fn as Ge,ft as Ke,g as qe,gn as Je,gt as Ye,h as Xe,ht as Ze,i as Qe,in as $e,ir as J,it as et,j as tt,jn as nt,jt as rt,k as it,kt as at,l as ot,ln as st,lt as ct,m as lt,mn as ut,mt as dt,n as ft,nn as pt,nr as mt,nt as ht,o as gt,on as _t,or as Y,ot as vt,p as yt,pn as bt,pt as xt,q as St,qn as Ct,qt as wt,r as Tt,rn as Et,rr as Dt,rt as Ot,sn as kt,sr as At,t as jt,tn as Mt,tr as Nt,tt as Pt,u as Ft,un as It,ut as Lt,vn as Rt,vt as zt,wn as Bt,wt as Vt,x as Ht,xn as Ut,xt as Wt,yn as Gt,yt as Kt,zn as qt,zt as Jt}from"./styles.generated-Bub4csY_.js";var X=Ie(Y(),1);const Yt=new Map([[`bold`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M244,56v48a12,12,0,0,1-12,12H184a12,12,0,1,1,0-24H201.1l-19-17.38c-.13-.12-.26-.24-.38-.37A76,76,0,1,0,127,204h1a75.53,75.53,0,0,0,52.15-20.72,12,12,0,0,1,16.49,17.45A99.45,99.45,0,0,1,128,228h-1.37A100,100,0,1,1,198.51,57.06L220,76.72V56a12,12,0,0,1,24,0Z`}))],[`duotone`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),X.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`fill`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1-5.66-13.66l17-17-10.55-9.65-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,1,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60l10.93,10L226.34,50.3A8,8,0,0,1,240,56Z`}))],[`light`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M238,56v48a6,6,0,0,1-6,6H184a6,6,0,0,1,0-12h32.55l-30.38-27.8c-.06-.06-.12-.13-.19-.19a82,82,0,1,0-1.7,117.65,6,6,0,0,1,8.24,8.73A93.46,93.46,0,0,1,128,222h-1.28A94,94,0,1,1,194.37,61.4L226,90.35V56a6,6,0,1,1,12,0Z`}))],[`regular`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`thin`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M236,56v48a4,4,0,0,1-4,4H184a4,4,0,0,1,0-8h37.7L187.53,68.69l-.13-.12a84,84,0,1,0-1.75,120.51,4,4,0,0,1,5.5,5.82A91.43,91.43,0,0,1,128,220h-1.26A92,92,0,1,1,193,62.84l35,32.05V56a4,4,0,1,1,8,0Z`}))]]),Xt=new Map([[`bold`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,204H228V96a20,20,0,0,0-20-20H172V32a20,20,0,0,0-28.45-18.12l-104,48.54A20.06,20.06,0,0,0,28,80.55V204H16a12,12,0,0,0,0,24H240a12,12,0,0,0,0-24ZM204,100V204H172V100ZM52,83.09,148,38.3V204H52ZM132,112v12a12,12,0,0,1-24,0V112a12,12,0,0,1,24,0Zm-40,0v12a12,12,0,0,1-24,0V112a12,12,0,0,1,24,0Zm0,52v12a12,12,0,0,1-24,0V164a12,12,0,0,1,24,0Zm40,0v12a12,12,0,0,1-24,0V164a12,12,0,0,1,24,0Z`}))],[`duotone`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M136,32V216H40V85.35a8,8,0,0,1,3.56-6.66l80-53.33A8,8,0,0,1,136,32Z`,opacity:`0.2`}),X.createElement(`path`,{d:`M240,208H224V96a16,16,0,0,0-16-16H144V32a16,16,0,0,0-24.88-13.32L39.12,72A16,16,0,0,0,32,85.34V208H16a8,8,0,0,0,0,16H240a8,8,0,0,0,0-16ZM208,96V208H144V96ZM48,85.34,128,32V208H48ZM112,112v16a8,8,0,0,1-16,0V112a8,8,0,1,1,16,0Zm-32,0v16a8,8,0,0,1-16,0V112a8,8,0,1,1,16,0Zm0,56v16a8,8,0,0,1-16,0V168a8,8,0,0,1,16,0Zm32,0v16a8,8,0,0,1-16,0V168a8,8,0,0,1,16,0Z`}))],[`fill`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M239.73,208H224V96a16,16,0,0,0-16-16H164a4,4,0,0,0-4,4V208H144V32.41a16.43,16.43,0,0,0-6.16-13,16,16,0,0,0-18.72-.69L39.12,72A16,16,0,0,0,32,85.34V208H16.27A8.18,8.18,0,0,0,8,215.47,8,8,0,0,0,16,224H240a8,8,0,0,0,8-8.53A8.18,8.18,0,0,0,239.73,208ZM76,184a8,8,0,0,1-8.53,8A8.18,8.18,0,0,1,60,183.72V168.27A8.19,8.19,0,0,1,67.47,160,8,8,0,0,1,76,168Zm0-56a8,8,0,0,1-8.53,8A8.19,8.19,0,0,1,60,127.72V112.27A8.19,8.19,0,0,1,67.47,104,8,8,0,0,1,76,112Zm40,56a8,8,0,0,1-8.53,8,8.18,8.18,0,0,1-7.47-8.26V168.27a8.19,8.19,0,0,1,7.47-8.26,8,8,0,0,1,8.53,8Zm0-56a8,8,0,0,1-8.53,8,8.19,8.19,0,0,1-7.47-8.26V112.27a8.19,8.19,0,0,1,7.47-8.26,8,8,0,0,1,8.53,8Z`}))],[`light`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,210H222V96a14,14,0,0,0-14-14H142V32a14,14,0,0,0-21.77-11.64l-80,53.33A14,14,0,0,0,34,85.34V210H16a6,6,0,0,0,0,12H240a6,6,0,0,0,0-12ZM208,94a2,2,0,0,1,2,2V210H142V94ZM46,85.34a2,2,0,0,1,.89-1.66l80-53.34A2,2,0,0,1,130,32V210H46ZM110,112v16a6,6,0,0,1-12,0V112a6,6,0,0,1,12,0Zm-32,0v16a6,6,0,0,1-12,0V112a6,6,0,0,1,12,0Zm0,56v16a6,6,0,0,1-12,0V168a6,6,0,0,1,12,0Zm32,0v16a6,6,0,0,1-12,0V168a6,6,0,0,1,12,0Z`}))],[`regular`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,208H224V96a16,16,0,0,0-16-16H144V32a16,16,0,0,0-24.88-13.32L39.12,72A16,16,0,0,0,32,85.34V208H16a8,8,0,0,0,0,16H240a8,8,0,0,0,0-16ZM208,96V208H144V96ZM48,85.34,128,32V208H48ZM112,112v16a8,8,0,0,1-16,0V112a8,8,0,1,1,16,0Zm-32,0v16a8,8,0,0,1-16,0V112a8,8,0,1,1,16,0Zm0,56v16a8,8,0,0,1-16,0V168a8,8,0,0,1,16,0Zm32,0v16a8,8,0,0,1-16,0V168a8,8,0,0,1,16,0Z`}))],[`thin`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M240,212H220V96a12,12,0,0,0-12-12H140V32a12,12,0,0,0-18.66-10l-80,53.33a12,12,0,0,0-5.34,10V212H16a4,4,0,0,0,0,8H240a4,4,0,0,0,0-8ZM208,92a4,4,0,0,1,4,4V212H140V92ZM44,85.34A4,4,0,0,1,45.78,82l80-53.33A4,4,0,0,1,132,32V212H44ZM108,112v16a4,4,0,0,1-8,0V112a4,4,0,0,1,8,0Zm-32,0v16a4,4,0,0,1-8,0V112a4,4,0,0,1,8,0Zm0,56v16a4,4,0,0,1-8,0V168a4,4,0,0,1,8,0Zm32,0v16a4,4,0,0,1-8,0V168a4,4,0,0,1,8,0Z`}))]]),Zt=new Map([[`bold`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z`}))],[`duotone`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),X.createElement(`path`,{d:`M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z`}))],[`fill`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z`}))],[`light`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z`}))]]),Qt=new Map([[`bold`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M125.18,156.94a64,64,0,1,0-82.36,0,100.23,100.23,0,0,0-39.49,32,12,12,0,0,0,19.35,14.2,76,76,0,0,1,122.64,0,12,12,0,0,0,19.36-14.2A100.33,100.33,0,0,0,125.18,156.94ZM44,108a40,40,0,1,1,40,40A40,40,0,0,1,44,108Zm206.1,97.67a12,12,0,0,1-16.78-2.57A76.31,76.31,0,0,0,172,172a12,12,0,0,1,0-24,40,40,0,1,0-10.3-78.67,12,12,0,1,1-6.16-23.19,64,64,0,0,1,57.64,110.8,100.23,100.23,0,0,1,39.49,32A12,12,0,0,1,250.1,205.67Z`}))],[`duotone`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M136,108A52,52,0,1,1,84,56,52,52,0,0,1,136,108Z`,opacity:`0.2`}),X.createElement(`path`,{d:`M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z`}))],[`fill`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M164.47,195.63a8,8,0,0,1-6.7,12.37H10.23a8,8,0,0,1-6.7-12.37,95.83,95.83,0,0,1,47.22-37.71,60,60,0,1,1,66.5,0A95.83,95.83,0,0,1,164.47,195.63Zm87.91-.15a95.87,95.87,0,0,0-47.13-37.56A60,60,0,0,0,144.7,54.59a4,4,0,0,0-1.33,6A75.83,75.83,0,0,1,147,150.53a4,4,0,0,0,1.07,5.53,112.32,112.32,0,0,1,29.85,30.83,23.92,23.92,0,0,1,3.65,16.47,4,4,0,0,0,3.95,4.64h60.3a8,8,0,0,0,7.73-5.93A8.22,8.22,0,0,0,252.38,195.48Z`}))],[`light`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M112.6,158.43a58,58,0,1,0-57.2,0A93.83,93.83,0,0,0,5.21,196.72a6,6,0,0,0,10.05,6.56,82,82,0,0,1,137.48,0,6,6,0,0,0,10-6.56A93.83,93.83,0,0,0,112.6,158.43ZM38,108a46,46,0,1,1,46,46A46.06,46.06,0,0,1,38,108Zm211,97a6,6,0,0,1-8.3-1.74A81.8,81.8,0,0,0,172,166a6,6,0,0,1,0-12,46,46,0,1,0-17.08-88.73,6,6,0,1,1-4.46-11.14,58,58,0,0,1,50.14,104.3,93.83,93.83,0,0,1,50.19,38.29A6,6,0,0,1,249,205Z`}))],[`regular`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z`}))],[`thin`,X.createElement(X.Fragment,null,X.createElement(`path`,{d:`M107.19,159a56,56,0,1,0-46.38,0A91.83,91.83,0,0,0,6.88,197.81a4,4,0,1,0,6.7,4.37,84,84,0,0,1,140.84,0,4,4,0,1,0,6.7-4.37A91.83,91.83,0,0,0,107.19,159ZM36,108a48,48,0,1,1,48,48A48.05,48.05,0,0,1,36,108Zm212,95.35a4,4,0,0,1-5.53-1.17A83.81,83.81,0,0,0,172,164a4,4,0,0,1,0-8,48,48,0,1,0-17.82-92.58,4,4,0,1,1-3-7.43,56,56,0,0,1,44,103,91.83,91.83,0,0,1,53.93,38.86A4,4,0,0,1,248,203.35Z`}))]]),$t=X.forwardRef((e,t)=>X.createElement(Dt,{ref:t,...e,weights:Yt}));$t.displayName=`ArrowClockwiseIcon`;const en=X.forwardRef((e,t)=>X.createElement(Dt,{ref:t,...e,weights:Xt}));en.displayName=`BuildingsIcon`;const tn=X.forwardRef((e,t)=>X.createElement(Dt,{ref:t,...e,weights:Zt}));tn.displayName=`CaretDownIcon`;const nn=X.forwardRef((e,t)=>X.createElement(Dt,{ref:t,...e,weights:Qt}));nn.displayName=`UsersIcon`;const rn=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`),an=!rn&&Et.includes(`firefox`);!rn&&Et.includes(`chrom`);const on=Mt;function sn(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function cn(e){return e.matches(`html,body`)}function ln(e){return j(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function un(e){return e?e.getAttribute(`role`)===`combobox`&&ln(e):!1}function dn(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function fn(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...fn(e,t.id,n)])}function pn(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function mn(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return be(n)?n.host:null}function hn(e){for(let t of Array.from(e.children))if(qt(t)===`summary`)return t;return null}function gn(e,t){let n=hn(t);return!!n&&(e===n||x(n,e))}function _n(e){let t=e?qt(e):``;return e!=null&&e.matches(`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`)&&(t!==`summary`||e.parentElement!=null&&qt(e.parentElement)===`details`&&hn(e.parentElement)===e)&&(t!==`details`||hn(e)==null)&&(t!==`input`||e.type!==`hidden`)}function vn(e){if(!_n(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=mn(t)){let n=t!==e,r=qt(t)===`slot`;if(t.hasAttribute(`inert`)||n&&qt(t)===`details`&&!t.open&&!gn(e,t)||t.hasAttribute(`hidden`)||!r&&!yn(t,n))return!1}return!0}function yn(e,t){let n=_(e);return t?n.display!==`none`:Ye(e,n)}function bn(e){let t=e.tabIndex;if(t<0){let t=qt(e);if(t===`details`||t===`audio`||t===`video`||j(e)&&e.isContentEditable)return 0}return t}function xn(e){if(qt(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Sn(e,t){let n=xn(e);if(!n)return!0;let r=t.find(e=>{let t=xn(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=xn(e);return t?.name===n.name&&t.form===n.form})===n}function Cn(e){if(j(e)&&qt(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return j(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function wn(e,t){Cn(e).forEach(e=>{_n(e)&&t.push(e),wn(e,t)})}function Tn(e,t,n){Cn(e).forEach(e=>{j(e)&&e.matches(t)&&n.push(e),Tn(e,t,n)})}function En(e){return vn(e)&&bn(e)>=0}function Dn(e){let t=[];return wn(e,t),t.filter(vn)}function On(e){let t=Dn(e);return t.filter(e=>bn(e)>=0&&Sn(e,t))}function kn(e,t){let n=On(e),r=n.length;if(r===0)return;let i=ve(f(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function An(e){return kn(f(e).body,1)||e}function jn(e){return kn(f(e).body,-1)||e}function Mn(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!x(n,r)}function Nn(e){On(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Pn(e){let t=[];Tn(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var Fn=class e{static create(){return new e}currentId=0;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=0,t()},e)}isStarted(){return this.currentId!==0}clear=()=>{this.currentId!==0&&(clearTimeout(this.currentId),this.currentId=0)};disposeEffect=()=>this.clear};function In(){let e=H(Fn.create).current;return Be(e.disposeEffect),e}
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* use-sync-external-store-shim.production.js
|
|
@@ -8,7 +8,7 @@ import{$n as e,$t as t,A as n,An as r,At as i,B as a,Bn as o,Bt as s,C as c,Cn a
|
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
10
|
*/
|
|
11
|
-
var Ln=At((e=>{var t=Y();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Rn=At(((e,t)=>{t.exports=Ln()})),Z=Je();const zn=X.createContext(void 0),Bn=e=>{let t=X.useContext(zn);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Vn=({client:e,children:t})=>(X.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,Z.jsx)(zn.Provider,{value:e,children:t})),Hn={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Un=new class{#e=Hn;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Wn(e){setTimeout(e,0)}const Gn=typeof window>`u`||`Deno`in globalThis;function Kn(){}function qn(e,t){return typeof e==`function`?e(t):e}function Jn(e){return typeof e==`number`&&e>=0&&e!==1/0}function Yn(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Xn(e,t){return typeof e==`function`?e(t):e}function Zn(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==$n(o,t.options))return!1}else if(!tr(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Qn(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(er(t.options.mutationKey)!==er(a))return!1}else if(!tr(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function $n(e,t){return(t?.queryKeyHashFn||er)(e)}function er(e){return JSON.stringify(e,(e,t)=>or(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function tr(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!tr(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!tr(e[r],t[r]))return!1;return!0}return!1}const nr=Object.prototype.hasOwnProperty;function rr(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ar(e)&&ar(t);if(!r&&!(or(e)&&or(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:nr.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=rr(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ir(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ar(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function or(e){if(!sr(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!sr(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function sr(e){return Object.prototype.toString.call(e)===`[object Object]`}function cr(e){return new Promise(t=>{Un.setTimeout(t,e)})}function lr(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:rr(e,t)}function ur(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function dr(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}const fr=Symbol();function pr(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===fr?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function mr(e,t){return typeof e==`function`?e(...t):!!e}function hr(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}let gr=()=>Gn;const _r=()=>gr();var vr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};const yr=new class extends vr{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},br=Wn;function xr(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=br,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}const Sr=xr(),Cr=new class extends vr{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function wr(e){return Math.min(1e3*2**e,3e4)}function Tr(e){return(e??`online`)!==`online`||Cr.isOnline()}var Er=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Dr(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(Kn);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Er(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>yr.isFocused()&&(e.networkMode===`always`||Cr.isOnline())&&e.canRun(),p=()=>Tr(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(_r()?0:3),a=e.retryDelay??wr,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),cr(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Or=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Jn(this.gcTime)&&(this.#e=Un.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(_r()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Un.clearTimeout(this.#e),this.#e=void 0)}};function kr(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{hr(e,()=>t.signal,()=>n=!0)},u=pr(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?dr:ur;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?jr:Ar,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ar(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Ar(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function jr(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Mr(e,t){return t?Ar(e,t)!=null:!1}function Nr(e,t){return!t||!e.getPreviousPageParam?!1:jr(e,t)!=null}var Pr=class extends Or{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Lr(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Lr(this.options);e.data!==void 0&&(this.setState(Ir(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=lr(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(Kn).catch(Kn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Xn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===fr||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Xn(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Yn(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=pr(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?kr(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Dr({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Er&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Er){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Fr(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ir(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Sr.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Fr(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Tr(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ir(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Lr(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Rr=class extends vr{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Br(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Vr(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Vr(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 Xn(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&&!ir(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Hr(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||Xn(this.options.enabled,this.#t)!==Xn(t.enabled,this.#t)||Xn(this.options.staleTime,this.#t)!==Xn(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Xn(this.options.enabled,this.#t)!==Xn(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ir(this.getCurrentResult(),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),Reflect.get(e,n))})}trackProp(e){this.#p.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),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Kn)),t}#h(e){return!_r()&&Xn(this.options.enabled,this.#t)!==!1&&Jn(e)}#g(){this.#b();let e=Xn(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=Yn(this.#r.dataUpdatedAt,e)+1;this.#u=Un.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.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=Un.setInterval(()=>{(this.options.refetchIntervalInBackground||yr.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(Un.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(Un.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Br(e,t),o=i&&Hr(e,n,t,r);(a||o)&&(l={...l,...Fr(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=lr(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=lr(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Ur(e,t),refetch:this.refetch,isEnabled:Xn(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),ir(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);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)})})();Sr.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#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()}};function zr(e,t){return Xn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&Xn(t.retryOnMount,e)===!1)}function Br(e,t){return zr(e,t)||e.state.data!==void 0&&Vr(e,t,t.refetchOnMount)}function Vr(e,t,n){if(Xn(t.enabled,e)!==!1&&Xn(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Ur(e,t)}return!1}function Hr(e,t,n,r){return(e!==t||Xn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ur(e,n)}function Ur(e,t){return Xn(t.enabled,e)!==!1&&e.isStaleByTime(Xn(t.staleTime,e))}var Wr=class extends Rr{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Mr(t,n.data),hasPreviousPage:Nr(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Gr=class extends Or{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Kr(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=Dr({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Sr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Kr(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var qr=class extends vr{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Gr({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Jr(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Jr(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Jr(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Jr(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Sr.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Qn(t,e))}findAll(e={}){return this.getAll().filter(t=>Qn(e,t))}notify(e){Sr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Sr.batch(()=>Promise.all(e.map(e=>e.continue().catch(Kn))))}};function Jr(e){return e.options.scope?.id}var Yr=class extends vr{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??$n(r,t),a=this.get(i);return a||(a=new Pr({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Sr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Zn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Zn(e,t)):t}notify(e){Sr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Sr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Sr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Xr=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Yr,this.#t=e.mutationCache||new qr,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=yr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Cr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Xn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=qn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Sr.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Sr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Sr.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=Sr.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Kn).catch(Kn)}invalidateQueries(e,t={}){return Sr.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Sr.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Kn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Kn)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Xn(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Xn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Kn).catch(Kn)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Kn).catch(Kn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Cr.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(er(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{tr(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(er(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{tr(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=$n(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===fr&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};const Zr=X.createContext(!1),Qr=()=>X.useContext(Zr);Zr.Provider;function $r(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}const ei=X.createContext($r()),ti=()=>X.useContext(ei),ni=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?mr(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},ri=e=>{X.useEffect(()=>{e.clearReset()},[e])},ii=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||mr(n,[e.error,r])),ai=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))}},oi=(e,t)=>e?.suspense&&t.isPending,si=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ci(e,t,n){let r=Qr(),i=ti(),a=Bn(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,ai(o),ni(o,i,s),ri(i);let[l]=X.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(X.useSyncExternalStore(X.useCallback(e=>{let t=d?l.subscribe(Sr.batchCalls(e)):Kn;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),X.useEffect(()=>{l.setOptions(o)},[o,l]),oi(o,u))throw si(o,l,i);if(ii({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function li(e,t){return ci(e,Rr,t)}function ui(e,t){let n=Bn(t),r=n.getQueryCache();return X.useSyncExternalStore(X.useCallback(e=>r.subscribe(Sr.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}function di(e,t){return ci(e,Wr,t)}var fi=J();function pi(e,t){let n={options:e,onIdentityChange:t,abortController:new AbortController,auth:ke({apiUrl:e.apiUrl,fetchAstralBeamToken:e.fetchAstralBeamToken})};return Ft(n.auth,()=>{let e=Qe(n.auth);e.status===`error`&&mi(n,e.error)}),n}function mi(e,t){try{e.options.onError?.(t instanceof Error?t:Error(String(t)))}catch{}}function hi(e){e.abortController.abort(),gt(e.auth)}function gi(e,t){return yi(e,t,async t=>{let{tenantId:n,tenantExternalId:r}=e.options;return n===void 0?(await ae({page_size:1,...r===void 0?{}:{"filter[external_id]":r}},t)).items[0]??null:Ht(n,t)})}function _i(e,t,n){return yi(e,n,e=>ae(t,e))}function vi(e,t,n){return yi(e,n,async e=>{let{kind:n,tenantId:r,q:i,admin:a,size:o,cursor:s}=t,l={q:i,page_size:o,...s};if(n===`users`){if(!r)throw Error(`Select a tenant before listing its users.`);return c(r,{...l,...a===`all`?{}:{"filter[admin]":a}},e)}if(r){let t=await Ht(r,e);return{items:!i||[t.name??``,t.external_id].some(e=>e.toLocaleLowerCase().includes(i.toLocaleLowerCase()))?[t]:[],page_after:null,page_before:null}}return ae(l,e)})}function yi(e,t,n){let r=bi(e,t,n);return r.catch(n=>{let r=Qe(e.auth);!(r.status===`error`&&r.error===n)&&!e.abortController.signal.aborted&&!t.aborted&&!e.auth.session.abortController.signal.aborted&&!(n instanceof Error&&n.name===`AbortError`)&&mi(e,n)}),r}async function bi(e,t,n){let r=AbortSignal.any([t,e.abortController.signal,e.auth.session.abortController.signal]);for(let t=0;t<2;t++){r.throwIfAborted(),Re(e.auth,{apiUrl:e.options.apiUrl,fetchAstralBeamToken:e.options.fetchAstralBeamToken});let i=await Pe({...e.auth,retryUnauthorized:t===0});r.throwIfAborted();let a=Qe(e.auth);if(a.status!==`ready`)throw Error(`Authentication is not ready`);let o=a.currentUser.scope===`organization`,s=Tt(a.currentUser,e.auth.session.cached.tenantAdmin);if(e.identity!==void 0&&e.identity!==s)throw e.onIdentityChange(),new DOMException(`Identity changed`,`AbortError`);if(e.identity=s,e.options.scope===`organization`&&!o)throw Error(`Organization mode requires an organization-management token.`);if((e.options.scope??`tenant`)===`tenant`&&o&&!e.options.tenantId&&e.options.tenantExternalId===void 0)throw Error(`tenantId or tenantExternalId is required for a tenant view using an organization token.`);try{let t=await n({apiUrl:e.auth.apiUrl,astralBeamToken:i,signal:r});return r.throwIfAborted(),t}catch(n){if(t||!se(n)||n.status!==401)throw n;await ot(e.auth,i)}}throw Error(`Authentication failed`)}const xi=(0,X.createContext)(null);function Si(){return(0,X.useContext)(xi)?.defaultOptions??{}}function Ci(e){return typeof e==`function`}function wi(e,...t){return Ci(e)?e(...t):e}function Ti({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Ei(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)}}const Di=[];let Oi=0;const{link:ki,unlink:Ai,propagate:ji,checkDirty:Mi,shallowPropagate:Ni}=Ti({update(e){return e._update()},notify(e){Di[Fi++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,zi(e))}});let Pi=0,Fi=0,Ii,Li=0;function Ri(e){try{++Li,e()}finally{--Li||Bi()}}function zi(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Ai(n,e)}function Bi(){if(!(Li>0)){for(;Pi<Fi;){let e=Di[Pi];Di[Pi++]=void 0,e.notify()}Pi=0,Fi=0}}function Vi(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return Ii!==void 0&&ki(i,Ii,Oi),i._snapshot},subscribe(e){let t=Ei(e),n={current:!1},r=Hi(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Ii,o=t?.compare??Object.is;if(n)Ii=i,++Oi,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Ii=a,n&&(i.flags&=-5),zi(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Mi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Ni(e)}}else e&32&&(i.flags=e&-33);return Ii!==void 0&&ki(i,Ii,Oi),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(ji(e),Ni(e),Bi())}},i}function Hi(e){let t=()=>{let t=Ii;Ii=n,++Oi,n.depsTail=void 0,n.flags=6;try{return e()}finally{Ii=t,n.flags&=-5,zi(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&Mi(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,zi(this)}};return t(),n}var Ui=class{constructor(e,t){this.atom=Vi(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(Ei(e))}};function Wi(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=Gi(e);if(n.length!==Gi(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Gi(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var Ki=class{#e;constructor({pluginId:e}){this.#e=e}getPluginId(){return this.#e}createEventPayload(e,t){return{type:`${this.#e}:${e}`,payload:t,pluginId:this.#e}}emit(e,t){}on(e,t,n){return()=>{}}onAll(e){return()=>{}}onAllPluginEvents(e){return()=>{}}};const qi=new Map;function Ji(e,t){qi.set(e,t)}function Yi(e){if(e!==void 0)try{return JSON.parse(JSON.stringify(e))}catch{return null}}function Xi(e){return typeof e.get==`function`?e.get():e.state}function Zi(e){return{key:e.key,store:{state:Yi(Xi(e.store))},options:Yi(e.options)}}var Qi=class extends Ki{constructor(e){super({pluginId:`pacer`,debug:e?.debug,reconnectEveryMs:1e3})}};const $i=(e,t)=>{let n=t.key;n&&(Ji(n,t),ea.emit(e,Zi({...t,key:n})))},ea=new Qi;
|
|
11
|
+
var Ln=At((e=>{var t=Y();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Rn=At(((e,t)=>{t.exports=Ln()})),Z=Je();const zn=X.createContext(void 0),Bn=e=>{let t=X.useContext(zn);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Vn=({client:e,children:t})=>(X.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,Z.jsx)(zn.Provider,{value:e,children:t})),Hn={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Un=new class{#e=Hn;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Wn(e){setTimeout(e,0)}const Gn=typeof window>`u`||`Deno`in globalThis;function Kn(){}function qn(e,t){return typeof e==`function`?e(t):e}function Jn(e){return typeof e==`number`&&e>=0&&e!==1/0}function Yn(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Xn(e,t){return typeof e==`function`?e(t):e}function Zn(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==$n(o,t.options))return!1}else if(!tr(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Qn(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(er(t.options.mutationKey)!==er(a))return!1}else if(!tr(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function $n(e,t){return(t?.queryKeyHashFn||er)(e)}function er(e){return JSON.stringify(e,(e,t)=>or(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function tr(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!tr(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!tr(e[r],t[r]))return!1;return!0}return!1}const nr=Object.prototype.hasOwnProperty;function rr(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ar(e)&&ar(t);if(!r&&!(or(e)&&or(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:nr.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=rr(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ir(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ar(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function or(e){if(!sr(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!sr(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function sr(e){return Object.prototype.toString.call(e)===`[object Object]`}function cr(e){return new Promise(t=>{Un.setTimeout(t,e)})}function lr(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:rr(e,t)}function ur(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function dr(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}const fr=Symbol();function pr(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===fr?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function mr(e,t){return typeof e==`function`?e(...t):!!e}function hr(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}let gr=()=>Gn;const _r=()=>gr();var vr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};const yr=new class extends vr{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},br=Wn;function xr(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=br,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}const Sr=xr(),Cr=new class extends vr{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function wr(e){return Math.min(1e3*2**e,3e4)}function Tr(e){return(e??`online`)!==`online`||Cr.isOnline()}var Er=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Dr(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(Kn);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Er(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>yr.isFocused()&&(e.networkMode===`always`||Cr.isOnline())&&e.canRun(),p=()=>Tr(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(_r()?0:3),a=e.retryDelay??wr,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),cr(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Or=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Jn(this.gcTime)&&(this.#e=Un.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(_r()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Un.clearTimeout(this.#e),this.#e=void 0)}};function kr(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{hr(e,()=>t.signal,()=>n=!0)},u=pr(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?dr:ur;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?jr:Ar,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ar(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Ar(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function jr(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Mr(e,t){return t?Ar(e,t)!=null:!1}function Nr(e,t){return!t||!e.getPreviousPageParam?!1:jr(e,t)!=null}var Pr=class extends Or{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Lr(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Lr(this.options);e.data!==void 0&&(this.setState(Ir(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=lr(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(Kn).catch(Kn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Xn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===fr||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Xn(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Yn(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=pr(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?kr(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Dr({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Er&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Er){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Fr(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ir(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Sr.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Fr(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Tr(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ir(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Lr(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Rr=class extends vr{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Br(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Vr(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Vr(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 Xn(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&&!ir(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Hr(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||Xn(this.options.enabled,this.#t)!==Xn(t.enabled,this.#t)||Xn(this.options.staleTime,this.#t)!==Xn(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Xn(this.options.enabled,this.#t)!==Xn(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ir(this.getCurrentResult(),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),Reflect.get(e,n))})}trackProp(e){this.#p.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),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Kn)),t}#h(e){return!_r()&&Xn(this.options.enabled,this.#t)!==!1&&Jn(e)}#g(){this.#b();let e=Xn(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=Yn(this.#r.dataUpdatedAt,e)+1;this.#u=Un.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return Xn(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=Un.setInterval(()=>{(this.options.refetchIntervalInBackground||yr.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(Un.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(Un.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Br(e,t),o=i&&Hr(e,n,t,r);(a||o)&&(l={...l,...Fr(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=lr(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=lr(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Ur(e,t),refetch:this.refetch,isEnabled:Xn(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),ir(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);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)})})();Sr.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#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()}};function zr(e,t){return Xn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&Xn(t.retryOnMount,e)===!1)}function Br(e,t){return zr(e,t)||e.state.data!==void 0&&Vr(e,t,t.refetchOnMount)}function Vr(e,t,n){if(Xn(t.enabled,e)!==!1&&Xn(t.staleTime,e)!==`static`){let r=Xn(n,e);return r===`always`||r!==!1&&Ur(e,t)}return!1}function Hr(e,t,n,r){return(e!==t||Xn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ur(e,n)}function Ur(e,t){return Xn(t.enabled,e)!==!1&&e.isStaleByTime(Xn(t.staleTime,e))}var Wr=class extends Rr{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Mr(t,n.data),hasPreviousPage:Nr(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Gr=class extends Or{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Kr(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=Dr({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Sr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Kr(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var qr=class extends vr{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Gr({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Jr(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Jr(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Jr(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Jr(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Sr.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Qn(t,e))}findAll(e={}){return this.getAll().filter(t=>Qn(e,t))}notify(e){Sr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Sr.batch(()=>Promise.all(e.map(e=>e.continue().catch(Kn))))}};function Jr(e){return e.options.scope?.id}var Yr=class extends vr{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??$n(r,t),a=this.get(i);return a||(a=new Pr({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Sr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Zn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Zn(e,t)):t}notify(e){Sr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Sr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Sr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Xr=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Yr,this.#t=e.mutationCache||new qr,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=yr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Cr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Xn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=qn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Sr.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Sr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Sr.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=Sr.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Kn).catch(Kn)}invalidateQueries(e,t={}){return Sr.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Sr.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Kn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Kn)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Xn(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Xn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Kn).catch(Kn)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Kn).catch(Kn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Cr.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(er(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{tr(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(er(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{tr(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=$n(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===fr&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};const Zr=X.createContext(!1),Qr=()=>X.useContext(Zr);Zr.Provider;function $r(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}const ei=X.createContext($r()),ti=()=>X.useContext(ei),ni=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?mr(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},ri=e=>{X.useEffect(()=>{e.clearReset()},[e])},ii=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||mr(n,[e.error,r])),ai=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))}},oi=(e,t)=>e?.suspense&&t.isPending,si=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ci(e,t,n){let r=Qr(),i=ti(),a=Bn(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,ai(o),ni(o,i,s),ri(i);let[l]=X.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(X.useSyncExternalStore(X.useCallback(e=>{let t=d?l.subscribe(Sr.batchCalls(e)):Kn;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),X.useEffect(()=>{l.setOptions(o)},[o,l]),oi(o,u))throw si(o,l,i);if(ii({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function li(e,t){return ci(e,Rr,t)}function ui(e,t){let n=Bn(t),r=n.getQueryCache();return X.useSyncExternalStore(X.useCallback(e=>r.subscribe(Sr.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}function di(e,t){return ci(e,Wr,t)}var fi=J();function pi(e,t){let n={options:e,onIdentityChange:t,abortController:new AbortController,auth:ke({apiUrl:e.apiUrl,fetchAstralBeamToken:e.fetchAstralBeamToken})};return Ft(n.auth,()=>{let e=Qe(n.auth);e.status===`error`&&mi(n,e.error)}),n}function mi(e,t){try{e.options.onError?.(t instanceof Error?t:Error(String(t)))}catch{}}function hi(e){e.abortController.abort(),gt(e.auth)}function gi(e,t){return yi(e,t,async t=>{let{tenantId:n,tenantExternalId:r}=e.options;return n===void 0?(await ae({page_size:1,...r===void 0?{}:{"filter[external_id]":r}},t)).items[0]??null:Ht(n,t)})}function _i(e,t,n){return yi(e,n,e=>ae(t,e))}function vi(e,t,n){return yi(e,n,async e=>{let{kind:n,tenantId:r,q:i,admin:a,size:o,cursor:s}=t,l={q:i,page_size:o,...s};if(n===`users`){if(!r)throw Error(`Select a tenant before listing its users.`);return c(r,{...l,...a===`all`?{}:{"filter[admin]":a}},e)}if(r){let t=await Ht(r,e);return{items:!i||[t.name??``,t.external_id].some(e=>e.toLocaleLowerCase().includes(i.toLocaleLowerCase()))?[t]:[],page_after:null,page_before:null}}return ae(l,e)})}function yi(e,t,n){let r=bi(e,t,n);return r.catch(n=>{let r=Qe(e.auth);!(r.status===`error`&&r.error===n)&&!e.abortController.signal.aborted&&!t.aborted&&!e.auth.session.abortController.signal.aborted&&!(n instanceof Error&&n.name===`AbortError`)&&mi(e,n)}),r}async function bi(e,t,n){let r=AbortSignal.any([t,e.abortController.signal,e.auth.session.abortController.signal]);for(let t=0;t<2;t++){r.throwIfAborted(),Re(e.auth,{apiUrl:e.options.apiUrl,fetchAstralBeamToken:e.options.fetchAstralBeamToken});let i=await Pe({...e.auth,retryUnauthorized:t===0});r.throwIfAborted();let a=Qe(e.auth);if(a.status!==`ready`)throw Error(`Authentication is not ready`);let o=a.currentUser.scope===`organization`,s=Tt(a.currentUser,e.auth.session.cached.tenantAdmin);if(e.identity!==void 0&&e.identity!==s)throw e.onIdentityChange(),new DOMException(`Identity changed`,`AbortError`);if(e.identity=s,e.options.scope===`organization`&&!o)throw Error(`Organization mode requires an organization-management token.`);if((e.options.scope??`tenant`)===`tenant`&&o&&!e.options.tenantId&&e.options.tenantExternalId===void 0)throw Error(`tenantId or tenantExternalId is required for a tenant view using an organization token.`);try{let t=await n({apiUrl:e.auth.apiUrl,astralBeamToken:i,signal:r});return r.throwIfAborted(),t}catch(n){if(t||!se(n)||n.status!==401)throw n;await ot(e.auth,i)}}throw Error(`Authentication failed`)}const xi=(0,X.createContext)(null);function Si(){return(0,X.useContext)(xi)?.defaultOptions??{}}function Ci(e){return typeof e==`function`}function wi(e,...t){return Ci(e)?e(...t):e}function Ti({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Ei(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)}}const Di=[];let Oi=0;const{link:ki,unlink:Ai,propagate:ji,checkDirty:Mi,shallowPropagate:Ni}=Ti({update(e){return e._update()},notify(e){Di[Fi++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,zi(e))}});let Pi=0,Fi=0,Ii,Li=0;function Ri(e){try{++Li,e()}finally{--Li||Bi()}}function zi(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Ai(n,e)}function Bi(){if(!(Li>0)){for(;Pi<Fi;){let e=Di[Pi];Di[Pi++]=void 0,e.notify()}Pi=0,Fi=0}}function Vi(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return Ii!==void 0&&ki(i,Ii,Oi),i._snapshot},subscribe(e){let t=Ei(e),n={current:!1},r=Hi(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Ii,o=t?.compare??Object.is;if(n)Ii=i,++Oi,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Ii=a,n&&(i.flags&=-5),zi(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Mi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Ni(e)}}else e&32&&(i.flags=e&-33);return Ii!==void 0&&ki(i,Ii,Oi),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(ji(e),Ni(e),Bi())}},i}function Hi(e){let t=()=>{let t=Ii;Ii=n,++Oi,n.depsTail=void 0,n.flags=6;try{return e()}finally{Ii=t,n.flags&=-5,zi(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&Mi(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,zi(this)}};return t(),n}var Ui=class{constructor(e,t){this.atom=Vi(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(Ei(e))}};function Wi(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=Gi(e);if(n.length!==Gi(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Gi(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var Ki=class{#e;constructor({pluginId:e}){this.#e=e}getPluginId(){return this.#e}createEventPayload(e,t){return{type:`${this.#e}:${e}`,payload:t,pluginId:this.#e}}emit(e,t){}on(e,t,n){return()=>{}}onAll(e){return()=>{}}onAllPluginEvents(e){return()=>{}}};const qi=new Map;function Ji(e,t){qi.set(e,t)}function Yi(e){if(e!==void 0)try{return JSON.parse(JSON.stringify(e))}catch{return null}}function Xi(e){return typeof e.get==`function`?e.get():e.state}function Zi(e){return{key:e.key,store:{state:Yi(Xi(e.store))},options:Yi(e.options)}}var Qi=class extends Ki{constructor(e){super({pluginId:`pacer`,debug:e?.debug,reconnectEveryMs:1e3})}};const $i=(e,t)=>{let n=t.key;n&&(Ji(n,t),ea.emit(e,Zi({...t,key:n})))},ea=new Qi;
|
|
12
12
|
/**
|
|
13
13
|
* @license React
|
|
14
14
|
* use-sync-external-store-shim/with-selector.production.js
|
package/dist/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as TenantUserRecordEncoded, b as TenantRecordEncoded } from "./api-DUe8JSVU.js";
|
|
2
|
-
import { C as AstralBeamChatState, I as AstralBeamChatColorScheme$1, L as AstralBeamChatTheme$1, R as AstralBeamTokenSource$1, S as AstralBeamChatCoreOptions, x as AstralBeamChatCore } from "./index-
|
|
2
|
+
import { C as AstralBeamChatState, I as AstralBeamChatColorScheme$1, L as AstralBeamChatTheme$1, R as AstralBeamTokenSource$1, S as AstralBeamChatCoreOptions, x as AstralBeamChatCore } from "./index-DUznpmNz.js";
|
|
3
3
|
import { CSSProperties, ReactNode } from "react";
|
|
4
4
|
import { AstralBeamChatAttachmentOptions, AstralBeamChatColorScheme, AstralBeamChatTheme, AstralBeamTenantListHandle as AstralBeamTenantListHandle$1, AstralBeamTenantUserListHandle as AstralBeamTenantUserListHandle$1, AstralBeamTokenRequest, AstralBeamTokenSource, InferParameters, JsonSchemaObject, MountAstralBeamChatOptions, MountAstralBeamTenantListOptions, MountAstralBeamTenantUserListOptions, ParametersSchema, ToolDefinition, WidgetDefinition as WidgetDefinition$1, defineTool } from "@astralbeam/sdk/client";
|
|
5
5
|
|
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as CORE_OPTION_KEYS, r as createAstralBeamChat } from "./core-
|
|
2
|
-
import { M as DEFAULT_COLOR_SCHEME } from "./api-
|
|
1
|
+
import { n as CORE_OPTION_KEYS, r as createAstralBeamChat } from "./core-BGDo_tQ4.js";
|
|
2
|
+
import { M as DEFAULT_COLOR_SCHEME } from "./api-r11gRy91.js";
|
|
3
3
|
import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { defineTool, mountAstralBeamChat, mountAstralBeamTenantList, mountAstralBeamTenantUserList } from "@astralbeam/sdk/client";
|