@agentruntime-labs/apps-react 0.0.0-stage → 0.1.0
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/LICENSE +55 -0
- package/NOTICE +2 -0
- package/README.md +36 -2
- package/dist/host/AgentRuntimeApp.d.ts +37 -0
- package/dist/host/EmbeddedApp.d.ts +49 -0
- package/dist/host/provider.d.ts +41 -0
- package/dist/host/theme.d.ts +50 -0
- package/dist/host/useAgentRuntimeApp.d.ts +70 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +1816 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cn.d.ts +2 -0
- package/dist/lib/displayValue.d.ts +3 -0
- package/dist/lib/document.d.ts +13 -0
- package/dist/lib/eventSteps.d.ts +11 -0
- package/dist/lib/layout.d.ts +23 -0
- package/dist/lib/nodeNames.d.ts +6 -0
- package/dist/lib/rowSelection.d.ts +44 -0
- package/dist/lib/runSteps.d.ts +61 -0
- package/dist/lib/safeUrl.d.ts +8 -0
- package/dist/lib/surfaceFileValues.d.ts +29 -0
- package/dist/renderer/SurfaceFiles.d.ts +14 -0
- package/dist/renderer/SurfaceRenderer.d.ts +22 -0
- package/dist/renderer/registry.d.ts +35 -0
- package/dist/styles.css +1 -0
- package/dist/ui/button.d.ts +12 -0
- package/dist/ui/fields.d.ts +15 -0
- package/dist/ui/hostStyled.d.ts +12 -0
- package/dist/ui/icons.d.ts +11 -0
- package/dist/ui/portal.d.ts +6 -0
- package/dist/ui/select.d.ts +11 -0
- package/dist/ui/table.d.ts +8 -0
- package/package.json +84 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
|
|
5
|
+
http://www.apache.org/licenses/
|
|
6
|
+
|
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
|
+
|
|
9
|
+
1. Definitions.
|
|
10
|
+
|
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
16
|
+
|
|
17
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
18
|
+
|
|
19
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
20
|
+
|
|
21
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
22
|
+
|
|
23
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
24
|
+
|
|
25
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
26
|
+
|
|
27
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
28
|
+
|
|
29
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
30
|
+
|
|
31
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
32
|
+
|
|
33
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
34
|
+
|
|
35
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
36
|
+
|
|
37
|
+
You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
38
|
+
|
|
39
|
+
You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
40
|
+
|
|
41
|
+
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
42
|
+
|
|
43
|
+
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
44
|
+
|
|
45
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
46
|
+
|
|
47
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
48
|
+
|
|
49
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
50
|
+
|
|
51
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
52
|
+
|
|
53
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
54
|
+
|
|
55
|
+
END OF TERMS AND CONDITIONS
|
package/NOTICE
ADDED
package/README.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @agentruntime-labs/apps-react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React components for embedding [AgentRuntime](https://agentruntime.io) Apps on your own pages.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @agentruntime-labs/apps-react react react-dom
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Show an App to signed-out visitors (read-only)
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { AgentRuntimeApp } from "@agentruntime-labs/apps-react";
|
|
13
|
+
import "@agentruntime-labs/apps-react/styles.css";
|
|
14
|
+
|
|
15
|
+
export function Menu({ search }: { search: string }) {
|
|
16
|
+
return <AgentRuntimeApp publishableKey="ar_pk_..." appId="app_..." inputs={{ q: search }} />;
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
| Prop | Notes |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| `publishableKey` | Required, `ar_pk_...`. Safe in a page. A secret key (`pat_...`) is refused. |
|
|
23
|
+
| `appId` | Required. |
|
|
24
|
+
| `view` | Screen to show; default: the App's default screen, else its first. |
|
|
25
|
+
| `inputs` | Values for the screen's input parameters; changes reload the screen (debounced). |
|
|
26
|
+
| `baseUrl` | Default `https://api.agentruntime.io`. |
|
|
27
|
+
|
|
28
|
+
Visitors get a read-only screen: buttons, fields and rows are switched off, and nothing can start a workflow. The site
|
|
29
|
+
must be on the App's allowed-sites list, or the built-in state says "This site isn't allowed to show this app". Other
|
|
30
|
+
built-in states: invalid key, not found, too many requests (with a retry hint), temporarily unavailable.
|
|
31
|
+
|
|
32
|
+
Styles are scoped under `.ar-app` and don't touch your page. The package also has the signed-in host
|
|
33
|
+
(`AgentRuntimeProvider` + `<AgentRuntimeApp app="...">`), a headless hook and the renderer.
|
|
34
|
+
|
|
35
|
+
Docs: https://docs.agentruntime.io/platform/embed-apps
|
|
36
|
+
|
|
37
|
+
Licence: Apache-2.0.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from "react";
|
|
2
|
+
import type { ComponentRegistry } from "../renderer/registry";
|
|
3
|
+
import { type EmbeddedAppProps } from "./EmbeddedApp";
|
|
4
|
+
import { type AppTheme, type ColorScheme } from "./theme";
|
|
5
|
+
import { type UseAgentRuntimeAppOptions } from "./useAgentRuntimeApp";
|
|
6
|
+
export type AgentRuntimeConsoleAppProps = UseAgentRuntimeAppOptions & {
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
/** Overrides the provider's theme. */
|
|
10
|
+
theme?: AppTheme;
|
|
11
|
+
colorScheme?: ColorScheme;
|
|
12
|
+
/** Custom primitives by kind, on top of the provider's. */
|
|
13
|
+
components?: ComponentRegistry;
|
|
14
|
+
/** Show step messages above the screen. Default true; `onMessage` is called either way. */
|
|
15
|
+
showMessages?: boolean;
|
|
16
|
+
/** How long a success or info message stays, in ms. Default 6000; 0 keeps it until dismissed. Warnings and errors always stay. */
|
|
17
|
+
messageDurationMs?: number;
|
|
18
|
+
/** Show the attached run (id, status, Start over). Default true. */
|
|
19
|
+
showRunStatus?: boolean;
|
|
20
|
+
/** Draw the screen in a bordered card. Default true. */
|
|
21
|
+
frame?: boolean;
|
|
22
|
+
/** Shown while the screen loads. */
|
|
23
|
+
loadingFallback?: ReactNode;
|
|
24
|
+
/** Shown when the screen can't load. */
|
|
25
|
+
errorFallback?: (error: unknown, retry: () => void) => ReactNode;
|
|
26
|
+
};
|
|
27
|
+
/** Plain-language reason a screen didn't load. */
|
|
28
|
+
export declare function loadErrorMessage(error: unknown): string;
|
|
29
|
+
/**
|
|
30
|
+
* An App on a page.
|
|
31
|
+
*
|
|
32
|
+
* - With `publishableKey` and `appId`: a read-only screen for signed-out visitors through the public embed API
|
|
33
|
+
* (see `EmbeddedAppProps`).
|
|
34
|
+
* - With `app` (inside `<AgentRuntimeProvider>`): the full, signed-in host.
|
|
35
|
+
*/
|
|
36
|
+
export type AgentRuntimeAppProps = EmbeddedAppProps | AgentRuntimeConsoleAppProps;
|
|
37
|
+
export declare function AgentRuntimeApp(props: AgentRuntimeAppProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from "react";
|
|
2
|
+
import { type SurfaceComponentNode, type Transport } from "@agentruntime-labs/apps-js";
|
|
3
|
+
import type { ComponentRegistry } from "../renderer/registry";
|
|
4
|
+
import { type AppTheme, type ColorScheme } from "./theme";
|
|
5
|
+
export type EmbeddedAppProps = {
|
|
6
|
+
/** The app's publishable key, `ar_pk_…`. Safe in a page; a secret key (`pat_…`) is refused. */
|
|
7
|
+
publishableKey: string;
|
|
8
|
+
/** App id. */
|
|
9
|
+
appId: string;
|
|
10
|
+
/** Screen (view id). Without it: the app's default screen, else its first screen. */
|
|
11
|
+
view?: string;
|
|
12
|
+
/** Values for the screen's input parameters. A change loads the screen again, after `inputsDebounceMs`. */
|
|
13
|
+
inputs?: Record<string, string | number | boolean>;
|
|
14
|
+
/** The AgentRuntime API. Default https://api.agentruntime.io. */
|
|
15
|
+
baseUrl?: string;
|
|
16
|
+
/** How long to wait after the last `inputs` change before loading again. Default 300 ms; 0 loads at once. */
|
|
17
|
+
inputsDebounceMs?: number;
|
|
18
|
+
className?: string;
|
|
19
|
+
style?: CSSProperties;
|
|
20
|
+
theme?: AppTheme;
|
|
21
|
+
colorScheme?: ColorScheme;
|
|
22
|
+
/** Custom primitives by kind. */
|
|
23
|
+
components?: ComponentRegistry;
|
|
24
|
+
/** Draw the screen in a bordered card. Default true. */
|
|
25
|
+
frame?: boolean;
|
|
26
|
+
/** Shown while the screen loads for the first time. */
|
|
27
|
+
loadingFallback?: ReactNode;
|
|
28
|
+
/** Replaces the built-in error state. */
|
|
29
|
+
errorFallback?: (error: unknown, retry: () => void) => ReactNode;
|
|
30
|
+
/** Called with every load error (typed errors from @agentruntime-labs/apps-js). */
|
|
31
|
+
onError?: (error: unknown) => void;
|
|
32
|
+
/** Test seam / custom transport. Default: the embed transport for `publishableKey`. */
|
|
33
|
+
transport?: Transport;
|
|
34
|
+
};
|
|
35
|
+
/** Plain words for each reason a visitor screen didn't load. */
|
|
36
|
+
export declare function embedErrorMessage(error: unknown): {
|
|
37
|
+
title: string;
|
|
38
|
+
detail: string;
|
|
39
|
+
};
|
|
40
|
+
/** Visitors can't act, so nothing the server sent may carry an event; a tree that does (a bug) is cleaned here too. */
|
|
41
|
+
export declare function withoutEvents(node: SurfaceComponentNode): SurfaceComponentNode;
|
|
42
|
+
/**
|
|
43
|
+
* A read-only screen for signed-out visitors, loaded through the public `/v1/embed/*` API.
|
|
44
|
+
*
|
|
45
|
+
* ```tsx
|
|
46
|
+
* <AgentRuntimeApp publishableKey="ar_pk_…" appId="app_…" inputs={{ q: search }} />
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function EmbeddedApp({ publishableKey, appId, view, inputs, baseUrl, inputsDebounceMs, className, style, theme, colorScheme, components, frame, loadingFallback, errorFallback, onError, transport: givenTransport, }: EmbeddedAppProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type AgentRuntimeClient, type ClientOptions, type TokenProvider } from "@agentruntime-labs/apps-js";
|
|
3
|
+
import type { ComponentRegistry } from "../renderer/registry";
|
|
4
|
+
import type { AppTheme, ColorScheme } from "./theme";
|
|
5
|
+
type AgentRuntimeContextValue = {
|
|
6
|
+
client: AgentRuntimeClient;
|
|
7
|
+
components?: ComponentRegistry;
|
|
8
|
+
theme?: AppTheme;
|
|
9
|
+
colorScheme?: ColorScheme;
|
|
10
|
+
};
|
|
11
|
+
export type AgentRuntimeProviderProps = {
|
|
12
|
+
/** The AgentRuntime API, e.g. https://api.agentruntime.io. */
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the bearer token (or `{ token, expiresAt }`). With a backend: fetch it from your token endpoint.
|
|
16
|
+
* Without: return your login provider's JWT. May change identity between renders; the latest one is used.
|
|
17
|
+
*/
|
|
18
|
+
getToken?: TokenProvider;
|
|
19
|
+
/** `ar_pk_…`, for the future `/v1/embed/*` API. Today's Console API ignores it. */
|
|
20
|
+
publishableKey?: string;
|
|
21
|
+
tenantId?: string;
|
|
22
|
+
projectId?: string;
|
|
23
|
+
/** "console" (default), "embed" (not built yet), or a custom Transport such as `createMockTransport(…)`. */
|
|
24
|
+
transport?: ClientOptions["transport"];
|
|
25
|
+
/** Retries, timeout, render host, fetch… passed to `createClient`. */
|
|
26
|
+
clientOptions?: Omit<ClientOptions, "baseUrl" | "getToken" | "publishableKey" | "tenantId" | "projectId" | "transport">;
|
|
27
|
+
/** A ready client; the connection props above are ignored when it's given. */
|
|
28
|
+
client?: AgentRuntimeClient;
|
|
29
|
+
/** Custom primitives by kind for every app inside. */
|
|
30
|
+
components?: ComponentRegistry;
|
|
31
|
+
theme?: AppTheme;
|
|
32
|
+
colorScheme?: ColorScheme;
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
};
|
|
35
|
+
/** Connects the AgentRuntime apps inside it to your workspace. */
|
|
36
|
+
export declare function AgentRuntimeProvider({ baseUrl, getToken, publishableKey, tenantId, projectId, transport, clientOptions, client: givenClient, components, theme, colorScheme, children, }: AgentRuntimeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
/** The provider's client and defaults. Throws outside `<AgentRuntimeProvider>`. */
|
|
38
|
+
export declare function useAgentRuntime(): AgentRuntimeContextValue;
|
|
39
|
+
/** Like useAgentRuntime, but null outside a provider. */
|
|
40
|
+
export declare function useOptionalAgentRuntime(): AgentRuntimeContextValue | null;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type CSSProperties, type HTMLAttributes } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Theme tokens. Colours are HSL triplets without `hsl()`, as in the Console ("222.2 47.4% 11.2%"); `radius` is a
|
|
4
|
+
* length; `fontFamily` a font stack (the app inherits the host page's font by default).
|
|
5
|
+
*/
|
|
6
|
+
export type AppTheme = Partial<{
|
|
7
|
+
background: string;
|
|
8
|
+
foreground: string;
|
|
9
|
+
card: string;
|
|
10
|
+
cardForeground: string;
|
|
11
|
+
popover: string;
|
|
12
|
+
popoverForeground: string;
|
|
13
|
+
primary: string;
|
|
14
|
+
primaryForeground: string;
|
|
15
|
+
secondary: string;
|
|
16
|
+
secondaryForeground: string;
|
|
17
|
+
muted: string;
|
|
18
|
+
mutedForeground: string;
|
|
19
|
+
accent: string;
|
|
20
|
+
accentForeground: string;
|
|
21
|
+
destructive: string;
|
|
22
|
+
destructiveForeground: string;
|
|
23
|
+
success: string;
|
|
24
|
+
successForeground: string;
|
|
25
|
+
warning: string;
|
|
26
|
+
warningForeground: string;
|
|
27
|
+
info: string;
|
|
28
|
+
infoForeground: string;
|
|
29
|
+
border: string;
|
|
30
|
+
input: string;
|
|
31
|
+
ring: string;
|
|
32
|
+
radius: string;
|
|
33
|
+
fontFamily: string;
|
|
34
|
+
}>;
|
|
35
|
+
/** "system" follows the visitor's OS setting. */
|
|
36
|
+
export type ColorScheme = "light" | "dark" | "system";
|
|
37
|
+
/**
|
|
38
|
+
* The CSS variables for `theme`, for the app root's inline style. They are namespaced (`--ar-primary`, not
|
|
39
|
+
* `--primary`), so a host page's shadcn tokens and the app's never override each other.
|
|
40
|
+
*/
|
|
41
|
+
export declare function themeStyle(theme: AppTheme | undefined): CSSProperties;
|
|
42
|
+
export type AppRootProps = HTMLAttributes<HTMLDivElement> & {
|
|
43
|
+
theme?: AppTheme;
|
|
44
|
+
colorScheme?: ColorScheme;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The `.ar-app` element every rule of the package's CSS is scoped to. It carries the theme variables and holds the
|
|
48
|
+
* container menus portal into. Use it to wrap a custom host built on `useAgentRuntimeApp` + `SurfaceRenderer`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function AppRoot({ theme, colorScheme, className, style, children, ...rest }: AppRootProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { AgentRuntimeClient, AppInfo, RenderResponse, RunContext, SurfaceComponentNode, SurfaceNavItem } from "@agentruntime-labs/apps-js";
|
|
2
|
+
import type { SurfaceRendererProps } from "../renderer/SurfaceRenderer";
|
|
3
|
+
export type AppMessage = {
|
|
4
|
+
text: string;
|
|
5
|
+
tone: "success" | "info" | "warning" | "error";
|
|
6
|
+
};
|
|
7
|
+
export type UseAgentRuntimeAppOptions = {
|
|
8
|
+
/** App id. */
|
|
9
|
+
app: string;
|
|
10
|
+
/** Screen (view id) to open. Without it, the app's default screen (needs a transport that can load app details). */
|
|
11
|
+
view?: string;
|
|
12
|
+
/** Show this run's data (and act on it). */
|
|
13
|
+
runId?: string;
|
|
14
|
+
/** The waiting step (human task) this screen completes. */
|
|
15
|
+
taskId?: string;
|
|
16
|
+
workflowRef?: string;
|
|
17
|
+
/** Screen tabs: a list, or "app" to use the app's own navigation. None by default. */
|
|
18
|
+
navigation?: SurfaceNavItem[] | "app";
|
|
19
|
+
/** While a run is in progress, reload the screen this often (ms). Default 5000; 0 turns it off. */
|
|
20
|
+
refreshIntervalMs?: number;
|
|
21
|
+
/** A `ui.navigate` step or a screen tab moved to another screen. */
|
|
22
|
+
onNavigate?: (viewId: string) => void;
|
|
23
|
+
/** A step started a run, or Start over left it. */
|
|
24
|
+
onRunChange?: (context: RunContext) => void;
|
|
25
|
+
/** Every message a step shows (and every step failure). */
|
|
26
|
+
onMessage?: (message: AppMessage) => void;
|
|
27
|
+
/** Loading or action errors (typed errors from @agentruntime-labs/apps-js). */
|
|
28
|
+
onError?: (error: unknown) => void;
|
|
29
|
+
/** Opens links from `ui.open_url` (already checked to be http/https). Default: a new tab, no opener. */
|
|
30
|
+
openUrl?: (url: string) => void;
|
|
31
|
+
/** Asks the event's confirm question. Default: the app's own dialog. */
|
|
32
|
+
confirm?: (question: string) => boolean | Promise<boolean>;
|
|
33
|
+
/** Defaults to the provider's client. */
|
|
34
|
+
client?: AgentRuntimeClient;
|
|
35
|
+
};
|
|
36
|
+
export type AppStatus = "loading" | "ready" | "error" | "no-view";
|
|
37
|
+
/**
|
|
38
|
+
* Headless host: loads a screen, keeps field and picked-row values, runs event steps (server steps through the
|
|
39
|
+
* client), shows messages, asks confirm questions and moves between screens. `<AgentRuntimeApp>` is this hook plus
|
|
40
|
+
* default chrome; build your own chrome on it with `<AppRoot>` and `<SurfaceRenderer {...app.rendererProps} />`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function useAgentRuntimeApp(options: UseAgentRuntimeAppOptions): {
|
|
43
|
+
status: AppStatus;
|
|
44
|
+
/** The latest render (screen tree, interaction mode, run). Kept while a refresh is in flight. */
|
|
45
|
+
render: RenderResponse | null;
|
|
46
|
+
error: {} | null;
|
|
47
|
+
isFetching: boolean;
|
|
48
|
+
appInfo: AppInfo | null;
|
|
49
|
+
viewId: string;
|
|
50
|
+
navigation: SurfaceNavItem[];
|
|
51
|
+
context: RunContext;
|
|
52
|
+
runStatus: string;
|
|
53
|
+
values: Record<string, unknown>;
|
|
54
|
+
fieldErrors: Record<string, string>;
|
|
55
|
+
busyIds: ReadonlySet<string>;
|
|
56
|
+
message: AppMessage | null;
|
|
57
|
+
pendingConfirm: {
|
|
58
|
+
question: string;
|
|
59
|
+
} | null;
|
|
60
|
+
/** Props for `<SurfaceRenderer>`; null until the screen has loaded. */
|
|
61
|
+
rendererProps: SurfaceRendererProps | null;
|
|
62
|
+
setValue: (componentId: string, value: unknown) => void;
|
|
63
|
+
handleEvent: (node: SurfaceComponentNode, event: string, extra?: Record<string, unknown>) => void;
|
|
64
|
+
answerConfirm: (ok: boolean) => void;
|
|
65
|
+
dismissMessage: () => void;
|
|
66
|
+
navigate: (target: string) => void;
|
|
67
|
+
startOver: () => void;
|
|
68
|
+
refresh: () => void;
|
|
69
|
+
};
|
|
70
|
+
export type AgentRuntimeAppState = ReturnType<typeof useAgentRuntimeApp>;
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),l=require("react"),B=require("@agentruntime-labs/apps-js"),cr=require("clsx"),dr=require("tailwind-merge"),Ct=require("class-variance-authority"),ur=require("@radix-ui/react-checkbox"),fr=require("@radix-ui/react-switch"),mr=require("@radix-ui/react-select");function Be(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const V=Be(l),Ue=Be(ur),Ke=Be(fr),O=Be(mr),We=l.createContext(null);function hr({baseUrl:e,getToken:t,publishableKey:n,tenantId:s,projectId:i,transport:c,clientOptions:f,client:w,components:h,theme:g,colorScheme:a,children:p}){const v=l.useRef(t);v.current=t;const o=!!t,d=JSON.stringify(f??{}),b=l.useMemo(()=>w||B.createClient({...f,baseUrl:e,publishableKey:n,tenantId:s,projectId:i,transport:c,getToken:o?()=>v.current?.():void 0}),[w,e,n,s,i,c,o,d]),x=l.useMemo(()=>({client:b,components:h,theme:g,colorScheme:a}),[b,h,g,a]);return r.jsx(We.Provider,{value:x,children:p})}function pr(){const e=l.useContext(We);if(!e)throw new Error("useAgentRuntime: wrap your app in <AgentRuntimeProvider>.");return e}function Je(){return l.useContext(We)}function y(...e){return dr.twMerge(cr.clsx(e))}const Tt=Ct.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),U=V.forwardRef(({className:e,variant:t,size:n,...s},i)=>r.jsx("button",{className:y(Tt({variant:t,size:n}),e),ref:i,...s}));U.displayName="Button";function Rt({style:e,children:t,...n}){return r.jsx("div",{"data-ar-custom":"",...n,style:{display:"contents",...e},children:t})}function Z({children:e,...t}){return r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:e})}const _t=e=>r.jsx(Z,{...e,children:r.jsx("path",{d:"M20 6 9 17l-5-5"})}),It=e=>r.jsx(Z,{...e,children:r.jsx("path",{d:"m6 9 6 6 6-6"})}),xr=e=>r.jsx(Z,{...e,children:r.jsx("path",{d:"m18 15-6-6-6 6"})}),ye=e=>r.jsxs(Z,{...e,children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("path",{d:"M12 8v4M12 16h.01"})]}),gr=e=>r.jsxs(Z,{...e,children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("path",{d:"m9 12 2 2 4-4"})]}),br=e=>r.jsxs(Z,{...e,children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("path",{d:"M12 16v-4M12 8h.01"})]}),Ye=e=>r.jsx(Z,{...e,children:r.jsx("path",{d:"M18 6 6 18M6 6l12 12"})}),yr=e=>r.jsxs(Z,{...e,children:[r.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),r.jsx("path",{d:"m3 3 18 18M21 15l-5-5-3 3"})]}),Et=e=>r.jsxs(Z,{...e,children:[r.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),r.jsx("path",{d:"M14 2v6h6"})]}),wr=e=>r.jsx(Z,{...e,children:r.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),Xe=V.forwardRef(({className:e,type:t,...n},s)=>r.jsx("input",{type:t,className:y("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:s,...n}));Xe.displayName="Input";const Ze=V.forwardRef(({className:e,...t},n)=>r.jsx("textarea",{className:y("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));Ze.displayName="Textarea";const vr=Ct.cva("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",success:"border-transparent bg-success text-success-foreground hover:bg-success/80",warning:"border-transparent bg-warning text-warning-foreground hover:bg-warning/80",info:"border-transparent bg-info text-info-foreground hover:bg-info/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function At({className:e,variant:t,...n}){return r.jsx("div",{className:y(vr({variant:t}),e),...n})}const Qe=V.forwardRef(({className:e,...t},n)=>r.jsx(Ue.Root,{ref:n,className:y("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:r.jsx(Ue.Indicator,{className:"flex items-center justify-center text-current",children:r.jsx(_t,{className:"h-4 w-4"})})}));Qe.displayName=Ue.Root.displayName;const et=V.forwardRef(({className:e,...t},n)=>r.jsx(Ke.Root,{className:y("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:r.jsx(Ke.Thumb,{className:"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"})}));et.displayName=Ke.Root.displayName;const tt=l.createContext(null);function Mt(){return l.useContext(tt)}const Ot=O.Root,Bt=O.Value,rt=V.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(O.Trigger,{ref:s,className:y("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,r.jsx(O.Icon,{asChild:!0,children:r.jsx(It,{className:"h-4 w-4 opacity-50"})})]}));rt.displayName=O.Trigger.displayName;const nt=V.forwardRef(({className:e,children:t,position:n="popper",...s},i)=>{const c=Mt();return r.jsx(O.Portal,{container:c??void 0,children:r.jsxs(O.Content,{ref:i,className:y("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...s,children:[r.jsx(O.ScrollUpButton,{className:"flex cursor-default items-center justify-center py-1",children:r.jsx(xr,{className:"h-4 w-4"})}),r.jsx(O.Viewport,{className:y("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(O.ScrollDownButton,{className:"flex cursor-default items-center justify-center py-1",children:r.jsx(It,{className:"h-4 w-4"})})]})})});nt.displayName=O.Content.displayName;const st=V.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(O.Item,{ref:s,className:y("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(O.ItemIndicator,{children:r.jsx(_t,{className:"h-4 w-4"})})}),r.jsx(O.ItemText,{children:t})]}));st.displayName=O.Item.displayName;const at=V.forwardRef(({className:e,...t},n)=>r.jsx("div",{className:"relative w-full overflow-auto",children:r.jsx("table",{ref:n,className:y("w-full caption-bottom text-sm",e),...t})}));at.displayName="Table";const it=V.forwardRef(({className:e,...t},n)=>r.jsx("thead",{ref:n,className:y("[&_tr]:border-b",e),...t}));it.displayName="TableHeader";const ot=V.forwardRef(({className:e,...t},n)=>r.jsx("tbody",{ref:n,className:y("[&_tr:last-child]:border-0",e),...t}));ot.displayName="TableBody";const be=V.forwardRef(({className:e,...t},n)=>r.jsx("tr",{ref:n,className:y("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));be.displayName="TableRow";const lt=V.forwardRef(({className:e,...t},n)=>r.jsx("th",{ref:n,className:y("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));lt.displayName="TableHead";const Te=V.forwardRef(({className:e,...t},n)=>r.jsx("td",{ref:n,className:y("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Te.displayName="TableCell";function Pt(e,t=new Set){return e&&(t.add(e.id),e.children?.forEach(n=>Pt(n,t))),t}function Re(e,t){if(e.id===t)return e;for(const n of e.children??[]){const s=Re(n,t);if(s)return s}return null}function Ft(e,t,n=null){if(e.id===t)return n;for(const s of e.children??[]){const i=Ft(s,t,e);if(i)return i}return null}function je(e,t,n="root"){t(e,n),e.children?.forEach((s,i)=>je(s,t,`${n}.children[${i}]`))}function he(e){return!!(e&&typeof e=="object"&&"bind"in e)}function jr(e){if(!e||typeof e!="object")return null;const t=e;return!t.root||typeof t.root!="object"?null:t}function Vt(e){switch(String(e.source??"")){case"workflow.run":return"Start a run to see status";case"workflow.node.output":return e.node_id?"Waiting for step output — start a run or open with ?run_id=…":"Pick a workflow step, then start a run";case"workflow.node.state":return e.node_id?"No step status yet — start a run to see gate state":"Pick a gate step, then start a run";case"database.query":return"No rows — check the query or browse view params";case"connection.read":return"No connection data — verify connection id and tool";case"tenant.config":return"Set this key in App Studio → Config";case"static":return"—";default:return"—"}}function _e(e){if(e==null)return"";if(he(e)){const t=e.bind;return Vt(t)}if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(typeof e=="object")try{return JSON.stringify(e,null,2)}catch{return String(e)}return String(e)}function kr(e,t){if(!he(e))return!1;const n=e.bind;return t===Vt(n)}function Pe(e){return e.type.startsWith("workflow.")}function bt(e){return!!(e&&typeof e=="object"&&typeof e.type=="string")}function ct(e,t="onClick"){const n=e?.events?.[t];return n&&typeof n=="object"?n:{}}function ue(e,t="onClick"){const n=ct(e,t);return Array.isArray(n.steps)?n.steps.filter(bt):bt(n.action)?[n.action]:[]}function Ce(e,t="onClick"){const n=ct(e,t).options??{};return{...n,require_valid:n.require_valid??!0,disable_while_running:n.disable_while_running??!0}}const Nr=48;function Lt(e){const t=e.filter(a=>a.layout),n=e.filter(a=>!a.layout);if(t.length===0)return n.map(a=>({gapAbove:0,items:[{node:a,offsetPct:0,widthPct:100,minHeight:0}]}));const s=[...t].sort((a,p)=>a.layout.y-p.layout.y||a.layout.x-p.layout.x),i=Math.min(...s.map(a=>a.layout.x)),c=Math.max(...s.map(a=>a.layout.x+a.layout.w)),f=Math.max(1,c-i),w=[];for(const a of s){const p=a.layout,v=w[w.length-1];v&&p.y<Math.max(...v.map(d=>d.layout.y+d.layout.h))-8&&v.every(d=>p.x>=d.layout.x+d.layout.w||p.x+p.w<=d.layout.x)?v.push(a):w.push([a])}let h=null;const g=w.map(a=>{const p=Math.min(...a.map(x=>x.layout.y)),v=Math.max(...a.map(x=>x.layout.y+x.layout.h)),o=h===null?0:Math.max(0,Math.min(Nr,p-h));h=v;let d=i;const b=[...a].sort((x,m)=>x.layout.x-m.layout.x).map(x=>{const m=x.layout,j={node:x,offsetPct:Math.max(0,m.x-d)/f*100,widthPct:m.w/f*100,minHeight:m.h};return d=m.x+m.w,j});return{gapAbove:o,items:b}});for(const a of n)g.push({gapAbove:12,items:[{node:a,offsetPct:0,widthPct:100,minHeight:0}]});return g}const Sr={Stack:"Group",Section:"Group box",Grid:"Columns",Text:"Text",Label:"Label",Badge:"Status tag",Link:"Link",Video:"Video",Table:"Table",TextField:"Text field",TextArea:"Text area",Select:"Dropdown",Checkbox:"Checkbox",Switch:"Switch",Button:"Button"};function Dt(e){return e?e.kind==="Text"&&e.props?.variant==="heading"?"Heading":e.kind==="TextField"&&e.props?.inputType==="date"?"Date":Sr[e.kind]??e.kind:""}function Cr(e){return typeof e=="string"?e.trim():typeof e=="number"?String(e):""}function ke(e){if(!e)return"";const t=e.props??{};for(const n of["label","text","title","content"]){const s=t[n];if(he(s))continue;const i=Cr(s);if(i)return i.length>40?`${i.slice(0,39)}…`:i}return Dt(e)}const Tr=new Set(["TextField","TextArea","Select","Checkbox","Switch"]);function qt(e){return Tr.has(e)}function Ie(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e.file_id;return typeof t=="string"&&t!==""?e:null}function $t(e){return Array.isArray(e)?e.map(Ie).filter(t=>t!==null):[]}function dt(e){return!e.missing&&(e.mime_type??"").toLowerCase().startsWith("image/")}function ut(e){return e.filename||"File"}function Ut(e){const t=typeof e=="string"?e.trim():"";if(t)try{const n=typeof window<"u"?window.location.origin:"http://localhost",s=new URL(t,n);return s.protocol==="https:"||s.protocol==="http:"||s.protocol==="blob:"?s.href:void 0}catch{return}}function He(e){return typeof e!="number"||!Number.isFinite(e)||e<0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function Fe(e){return Ut(e.url)}function ze({label:e,className:t}){return r.jsxs("div",{role:"img","aria-label":e,"data-ar-part":"file-placeholder",className:y("flex min-h-12 items-center justify-center gap-1.5 rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground",t),children:[r.jsx(yr,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{children:e})]})}function Rr({file:e,alt:t}){const n=Fe(e),[s,i]=l.useState(!1);return e.missing?r.jsx(ze,{label:"File not available"}):!n||s?r.jsx(ze,{label:"Image not available"}):r.jsx("img",{className:"max-w-full rounded-md border",src:n,alt:t||e.filename||"",onError:()=>i(!0)})}function Kt({file:e}){const t=Fe(e),[n,s]=l.useState(!1);if(e.missing)return r.jsx(ze,{label:"File not available"});const i=ut(e);return dt(e)&&t&&!n?r.jsxs("figure",{className:"flex flex-col gap-1",children:[r.jsx("img",{className:"max-h-96 max-w-full rounded-md border object-contain",src:t,alt:i,onError:()=>s(!0)}),r.jsxs("figcaption",{className:"text-xs text-muted-foreground",children:[i,e.size_bytes?` · ${He(e.size_bytes)}`:""]})]}):r.jsxs("div",{className:"flex items-center gap-3 rounded-md border p-3 text-sm",children:[r.jsx(Et,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"truncate font-medium",title:i,children:i}),e.size_bytes?r.jsx("span",{className:"text-xs text-muted-foreground",children:He(e.size_bytes)}):null]}),t?r.jsxs("a",{href:t,download:e.filename||void 0,target:"_blank",rel:"noopener noreferrer","data-ar-part":"file-open",className:"inline-flex h-8 items-center rounded-md border px-3 text-xs font-medium hover:bg-accent",children:[r.jsx(wr,{className:"mr-1.5 h-3.5 w-3.5"}),"Download"]}):null]})}function _r({file:e,onOpen:t}){const n=Fe(e),s=ut(e);return r.jsx(U,{type:"button",variant:"ghost",className:"relative aspect-square h-auto w-full overflow-hidden rounded-md border p-0","aria-label":`Open ${s}`,title:s,onClick:t,children:dt(e)&&n?r.jsx("img",{src:n,alt:s,loading:"lazy",className:"h-full w-full object-cover"}):r.jsxs("span",{className:"flex h-full w-full flex-col items-center justify-center gap-1 bg-muted/30 p-2 text-xs",children:[r.jsx(Et,{className:"h-5 w-5 text-muted-foreground"}),r.jsx("span",{className:"max-w-full truncate",children:s})]})})}function Ir({files:e,index:t,onIndexChange:n,onClose:s}){const i=e[t],c=Fe(i),f=ut(i),w=e.length-1,h=l.useRef(null);return l.useEffect(()=>h.current?.focus(),[]),r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4","data-ar-part":"gallery-viewer",onClick:s,children:r.jsxs("div",{ref:h,role:"dialog","aria-modal":"true","aria-label":f,tabIndex:-1,className:"w-full max-w-3xl space-y-3 rounded-lg border bg-background p-4 shadow-lg outline-none",onClick:g=>g.stopPropagation(),onKeyDown:g=>{g.key==="Escape"&&s(),g.key==="ArrowLeft"&&t>0&&n(t-1),g.key==="ArrowRight"&&t<w&&n(t+1)},children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("h2",{className:"truncate text-sm font-semibold",children:f}),r.jsx("button",{type:"button","aria-label":"Close",onClick:s,children:r.jsx(Ye,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(U,{type:"button",variant:"outline",size:"sm","aria-label":"Previous",disabled:t<=0,onClick:()=>n(t-1),children:"‹"}),r.jsx("div",{className:"flex min-h-48 min-w-0 flex-1 items-center justify-center",children:dt(i)&&c?r.jsx("img",{src:c,alt:f,className:"max-h-[70vh] max-w-full rounded-md object-contain"}):r.jsx(Kt,{file:i})}),r.jsx(U,{type:"button",variant:"outline",size:"sm","aria-label":"Next",disabled:t>=w,onClick:()=>n(t+1),children:"›"})]}),r.jsxs("p",{className:"text-center text-xs text-muted-foreground",children:[t+1," / ",e.length]})]})})}function Er({files:e}){const[t,n]=l.useState(null),s=e.filter(i=>!i.missing);return s.length===0?null:r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-4","data-ar-part":"gallery",children:s.map((i,c)=>r.jsx(_r,{file:i,onOpen:()=>n(c)},`${i.file_id}-${c}`))}),t!==null&&s[t]?r.jsx(Ir,{files:s,index:t,onIndexChange:n,onClose:()=>n(null)}):null]})}const we="onRowClick",Ee="__row_handle";function Ht(e){const t=e.props?.columns;return Array.isArray(t)?t.flatMap(n=>{const s=n,i=typeof s.key=="string"?s.key.trim():"";if(!i)return[];const c=typeof s.label=="string"&&s.label.trim()?s.label.trim():i;return[{key:i,label:c}]}):[]}function ft(e){return e.kind==="Table"&&(e.props?.selectable===!0||ue(e,we).length>0)}function Ar(e,t){const n=[];return je(e,s=>{s.kind!=="Table"||!ft(s)&&s.id!==t||n.push({id:s.id,name:ke(s),columns:Ht(s)})}),n}function Mr(e,t){return`{{selected.${e}.${t}}}`}const zt=/\{\{\s*selected\.([^.\s{}]+)\.([^{}]+?)\s*\}\}/g,Or=/^\{\{\s*selected\.([^.\s{}]+)\.([^{}]+?)\s*\}\}$/;function mt(e){if(typeof e!="string")return null;const t=Or.exec(e.trim());return t?{tableId:t[1],column:t[2].trim()}:null}function Ae(e,t){const n=e?.[t];return n&&typeof n=="object"&&!Array.isArray(n)?n:null}function Gt(e,t){if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=e,s=t;return n.id!=null&&s.id!=null?String(n.id)===String(s.id):JSON.stringify(yt(n))===JSON.stringify(yt(s))}function yt(e){if(!(Ee in e))return e;const{[Ee]:t,...n}=e;return n}function ve(e,t=new Set){if(typeof e=="string")for(const n of e.matchAll(zt))t.add(n[1]);else if(Array.isArray(e))for(const n of e)ve(n,t);else if(e&&typeof e=="object")for(const n of Object.values(e))ve(n,t);return t}function Br(e){return e==null?"":typeof e=="object"?JSON.stringify(e):String(e)}function Me(e,t){if(typeof e=="string"){const n=mt(e);if(n){const s=Ae(t,n.tableId)?.[n.column];return s??""}return e.replace(zt,(s,i,c)=>Br(Ae(t,i)?.[c.trim()]))}return Array.isArray(e)?e.map(n=>Me(n,t)):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,Me(s,t)])):e}function Pr(e,t){const n=mt(e);if(!n)return null;const s=t.find(c=>c.id===n.tableId),i=s?.columns.find(c=>c.key===n.column);return`${s?.name??n.tableId} · ${i?.label??n.column}`}function Wt(e){if(typeof e!="string"||!e.trim())return!1;try{const t=new URL(e.trim());return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}const Fr=new Set(["http:","https:","mailto:","tel:"]);function Jt(e){if(typeof e!="string"||!e.trim())return"#";try{const t=new URL(e,"https://relative.invalid/");return Fr.has(t.protocol)?e:"#"}catch{return"#"}}function Le(e,t,n){if(!t)return"";const s="rounded-md border border-dashed";return e==="Grid"?y(s,"border-violet-400/50 bg-violet-500/5 p-2"):e==="Section"?y(s,"border-sky-400/50 bg-sky-500/5 p-2"):y(s,"border-muted-foreground/35 bg-muted/20 p-2",n&&"min-h-[3rem]")}function re(e,t){return e??t}function X(e,t,n){return e==null?t:he(e)&&!n?"—":_e(e)}function Se(e){return typeof e=="string"&&e.trim()?e:void 0}function wt(e,t){if(t)return!1;const n=ue(e,"onClick");return n.length>0&&!n.some(Pe)}function vt(e){const t=Number(e);return Number.isInteger(t)&&t>0?t:2}function Vr(e){return e==="secondary"||e==="outline"||e==="destructive"||e==="ghost"?e:"default"}function ge(e,t){return e.children?.map(n=>r.jsx(de,{...t,node:n},n.id))}function Lr(e){return Array.isArray(e)?e.filter(t=>typeof t=="object"&&t!==null):[]}function de(e){return e.designMode?r.jsx("div",{"data-surface-id":e.node.id,className:"contents",children:r.jsx(kt,{...e})}):r.jsx(kt,{...e})}function De({node:e,htmlFor:t}){const n=e.props??{};return n.label?r.jsxs("label",{className:"text-sm font-medium",htmlFor:t,"data-ar-part":"label",children:[String(n.label),n.required?r.jsxs("span",{className:"text-destructive","aria-hidden":!0,children:[" ","*"]}):null]}):null}function jt({required:e,error:t}){return r.jsxs(r.Fragment,{children:[e?r.jsx("span",{className:"-ml-1.5 text-destructive","aria-hidden":!0,children:"*"}):null,t?r.jsx("span",{className:"w-full text-sm font-medium text-destructive","data-ar-part":"error",children:t}):null]})}function qe({message:e}){return e?r.jsx("p",{className:"text-sm font-medium text-destructive","data-ar-part":"error",children:e}):null}function kt(e){const t=e.components?.[e.node.kind];if(!t)return r.jsx(Nt,{...e});const{node:n,interactionMode:s="editable",designMode:i=!1,draft:c,onDraftChange:f,onAction:w,onEvent:h,busyIds:g,fieldErrors:a}=e,p=o=>r.jsx("div",{"data-ar-builtin":"",style:{display:"contents"},children:o}),v={node:n,props:n.props??{},value:c?.[n.id],setValue:o=>f?.(n.id,o),emit:(o,d)=>{h?h(n,o,d):n.events?.[o]?.action&&w?.(n.id,o,n.events[o].action)},disabled:s!=="editable",busy:!!g?.has(n.id),error:a?.[n.id],interactionMode:s,designMode:i,children:n.children?.length?p(ge(n,e)):null,renderNode:o=>r.jsx(l.Fragment,{children:p(r.jsx(de,{...e,node:o}))},o.id),renderDefault:()=>p(r.jsx(Nt,{...e}))};return r.jsx(Rt,{"data-ar-custom":n.kind,"data-ar-id":n.id,children:r.jsx(t,{...v})})}function Nt(e){const t=Dr(e);return l.isValidElement(t)?l.cloneElement(t,{"data-ar-kind":e.node.kind,"data-ar-id":e.node.id}):t}function Dr(e){const{node:t,interactionMode:n="editable",designMode:s=!1,draft:i,onDraftChange:c,onAction:f,onEvent:w,busyIds:h,fieldErrors:g}=e,a=t.props??{},p=g?.[t.id],v=`surface-field-${t.id}`,o=n!=="editable";switch(t.kind){case"Stack":{const d=re(a.direction,"vertical"),b=Number(re(a.gap,12)),x=Number(re(a.padding,0));return a.layoutMode==="absolute"&&!s?r.jsx("div",{className:"flex w-full flex-col",style:{padding:x},"data-surface-kind":"Canvas",children:Lt(t.children??[]).map((m,j)=>r.jsx("div",{className:"flex w-full flex-wrap items-start",style:{marginTop:j===0?0:Math.max(m.gapAbove,8)},children:m.items.map(C=>r.jsx("div",{className:"min-w-0",style:{marginLeft:`${C.offsetPct}%`,width:`${C.widthPct}%`,minWidth:"min(100%, 160px)",minHeight:C.minHeight},children:r.jsx(de,{...e,node:C.node})},C.node.id))},m.items[0]?.node.id??j))}):a.layoutMode==="absolute"?r.jsx("div",{className:"relative w-full",style:{padding:x,minHeight:s?120:void 0},children:t.children?.map(m=>{const j=m.layout,C=j?{position:"absolute",left:j.x,top:j.y,width:j.w,minHeight:j.h,height:j.h}:void 0;return r.jsx("div",{className:"overflow-hidden",style:C,children:r.jsx(de,{...e,node:m})},m.id)})}):r.jsxs("div",{className:y("flex w-full",d==="horizontal"?"flex-row flex-wrap items-center":"flex-col",a.justify==="end"&&"justify-end",Le("Stack",s,!t.children?.length)),style:{gap:b,padding:x},"data-surface-kind":"Stack",children:[s?r.jsx("div",{className:"pointer-events-none text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Stack"}):null,t.children?.map(m=>r.jsx(de,{...e,node:m},m.id))]})}case"Section":return r.jsxs("section",{className:y("space-y-3",Le("Section",s,!t.children?.length)),"data-surface-kind":"Section",children:[a.title?r.jsx("h2",{className:"text-lg font-semibold",children:String(a.title)}):s?r.jsx("h2",{className:"text-sm font-medium text-muted-foreground",children:"Section"}):null,t.children?.map(d=>r.jsx(de,{...e,node:d},d.id))]});case"Text":return r.jsx("p",{className:y("whitespace-pre-wrap",a.variant==="heading"?"text-lg font-semibold":"text-sm",a.variant==="muted"&&"text-muted-foreground"),children:X(a.content,"",s)});case"Label":return r.jsx("div",{className:"text-sm font-medium whitespace-pre-wrap",children:X(a.text,"",s)});case"Badge":return r.jsx(At,{variant:"secondary",children:X(a.label,"",s)});case"Button":{const d=t.events?.onClick?.action;return r.jsx(U,{type:"button",variant:Vr(a.variant),disabled:o&&!wt(t,s)||a.disabled===!0||!!h?.has(t.id),onClick:()=>{w?w(t,"onClick"):d&&f?.(t.id,"onClick",d)},children:X(a.label,"Action",s)})}case"TextArea":{const d=i?.[t.id]??re(a.value,"");return r.jsxs("div",{className:"space-y-2",children:[r.jsx(De,{node:t,htmlFor:v}),r.jsx(Ze,{id:v,rows:Number(re(a.rows,3)),disabled:o||!a.editable,placeholder:a.placeholder?String(a.placeholder):void 0,"aria-invalid":p?!0:void 0,value:String(d??""),onChange:b=>c?.(t.id,b.target.value)}),r.jsx(qe,{message:p})]})}case"Video":return Se(a.src)?r.jsx("video",{className:"w-full max-w-xl rounded-md border",controls:!!a.controls,src:Se(a.src)}):s?r.jsx("div",{className:"flex h-full min-h-12 items-center justify-center rounded-md border border-dashed text-xs text-muted-foreground",children:"Video — set or bind a source URL"}):null;case"Link":return r.jsx("a",{className:"text-primary underline text-sm",href:Jt(re(a.href,"#")),target:"_blank",rel:"noreferrer",children:X(a.label,"Open",s)});case"Grid":return r.jsxs("div",{className:s?"space-y-1":void 0,"data-surface-kind":"Grid",children:[s?r.jsxs("div",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:["Grid (",vt(a.columns)," cols)"]}):null,r.jsx("div",{className:y("grid gap-3",Le("Grid",s,!t.children?.length)),style:{gridTemplateColumns:`repeat(${vt(a.columns)}, minmax(0, 1fr))`},children:ge(t,e)})]});case"Card":return r.jsxs("div",{className:"rounded-lg border bg-card p-4 shadow-sm space-y-3",children:[a.title?r.jsx("h3",{className:"font-medium",children:String(a.title)}):null,ge(t,e)]});case"List":return r.jsx("ul",{className:"space-y-2 text-sm",children:ge(t,e)});case"Divider":return r.jsx("hr",{className:"border-border"});case"Metric":return r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:X(a.label,"",s)}),r.jsx("div",{className:"text-2xl font-semibold",children:X(a.value,"",s)})]});case"Image":{const d=Ie(a.file),b=typeof a.alt=="string"?a.alt:"";if(d)return r.jsx(Rr,{file:d,alt:b});if(Se(a.src))return r.jsx("img",{className:"max-w-full rounded-md border",src:Se(a.src),alt:b});const x=a.file!==void 0&&a.file!==null&&a.file!=="";return x||s?r.jsx("div",{className:"flex h-full min-h-12 items-center justify-center rounded-md border border-dashed text-xs text-muted-foreground",children:x?"Image not available":"Image — set or bind a file or a link"}):null}case"Gallery":{const d=$t(a.files);return d.length===0?s?r.jsx("div",{className:"flex h-full min-h-12 items-center justify-center rounded-md border border-dashed text-xs text-muted-foreground",children:"Gallery — bind a list of files"}):null:r.jsx(Er,{files:d})}case"TextField":{const d=i?.[t.id]??re(a.value,"");return r.jsxs("div",{className:"space-y-2",children:[r.jsx(De,{node:t,htmlFor:v}),r.jsx(Xe,{id:v,type:a.inputType==="date"?"date":a.inputType==="number"?"number":"text",disabled:o||!a.editable,placeholder:a.placeholder?String(a.placeholder):void 0,"aria-invalid":p?!0:void 0,value:String(d??""),onChange:b=>c?.(t.id,b.target.value)}),r.jsx(qe,{message:p})]})}case"Select":{const d=String(i?.[t.id]??re(a.value,"")),b=Array.isArray(a.options)?a.options:[];return r.jsxs("div",{className:"space-y-2",children:[r.jsx(De,{node:t,htmlFor:v}),r.jsxs(Ot,{disabled:o||!a.editable,value:d,onValueChange:x=>c?.(t.id,x),children:[r.jsx(rt,{id:v,"aria-invalid":p?!0:void 0,children:r.jsx(Bt,{placeholder:String(re(a.placeholder,"Choose…"))})}),r.jsx(nt,{"data-ar-part":"menu",children:b.map(x=>{const m=x;return r.jsx(st,{value:String(m.value??m.label),"data-ar-part":"option",children:String(m.label??m.value)},m.value??m.label)})})]}),r.jsx(qe,{message:p})]})}case"Checkbox":{const d=!!(i?.[t.id]??a.checked);return r.jsxs("label",{className:"flex flex-wrap items-center gap-2 text-sm",children:[r.jsx(Qe,{checked:d,disabled:o||!a.editable,"aria-invalid":p?!0:void 0,onCheckedChange:b=>c?.(t.id,!!b)}),a.label?r.jsx("span",{children:String(a.label)}):null,r.jsx(jt,{required:a.required===!0,error:p})]})}case"Switch":{const d=!!(i?.[t.id]??a.checked);return r.jsxs("label",{className:"flex flex-wrap items-center gap-2 text-sm",children:[r.jsx(et,{checked:d,disabled:o||!a.editable,"aria-invalid":p?!0:void 0,onCheckedChange:b=>c?.(t.id,b)}),a.label?r.jsx("span",{children:String(a.label)}):null,r.jsx(jt,{required:a.required===!0,error:p})]})}case"Table":{const d=(Array.isArray(a.columns)?a.columns:[]).filter(E=>E?.key!==Ee),b=Lr(a.rows),x=s&&he(a.rows)?_e(a.rows):"No rows yet",m=!s&&ft(t),j=o||!!h?.has(t.id),C=i?.[t.id],R=E=>{j||(c?.(t.id,E),ue(t,we).length>0&&w?.(t,we,{[t.id]:E}))},D=typeof a.title=="string"?a.title.trim():"";return r.jsxs("div",{className:"space-y-2",children:[D?r.jsx("h3",{className:"text-sm font-medium",children:D}):null,r.jsxs(at,{role:m?"grid":void 0,"aria-label":m||D?ke(t):void 0,children:[r.jsx(it,{children:r.jsx(be,{children:d.map(E=>{const q=E;return r.jsx(lt,{"data-ar-part":"header-cell",children:String(q.label??q.key)},q.key??q.label)})})}),r.jsxs(ot,{children:[b.map((E,q)=>{const _=m&&Gt(E,C);return r.jsx(be,{"data-ar-part":"row",...m?{"aria-selected":_,"aria-disabled":j||void 0,"data-state":_?"selected":void 0,tabIndex:j?-1:0,onClick:()=>R(E),onKeyDown:A=>{A.key!=="Enter"&&A.key!==" "||(A.preventDefault(),R(E))}}:{},className:y(m&&"cursor-pointer data-[state=selected]:bg-primary/10 data-[state=selected]:font-medium data-[state=selected]:shadow-[inset_3px_0_0_0_hsl(var(--ar-primary))] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",m&&j&&"cursor-not-allowed opacity-60"),children:d.map(A=>{const T=A;return r.jsx(Te,{"data-ar-part":"cell",children:_e(E[T.key??""])},T.key)})},q)}),b.length===0?r.jsx(be,{children:r.jsx(Te,{colSpan:Math.max(1,d.length),className:"py-6 text-center text-xs text-muted-foreground",children:x||"No rows yet"})}):null]})]})]})}case"Tabs":return r.jsx("div",{className:"space-y-3",children:ge(t,e)});case"IconButton":{const d=t.events?.onClick?.action;return r.jsx(U,{type:"button",size:"icon",variant:"ghost",disabled:o&&!wt(t,s)||a.disabled===!0||!!h?.has(t.id),onClick:()=>{w?w(t,"onClick"):d&&f?.(t.id,"onClick",d)},"aria-label":X(a.label,"Action",s),children:X(a.icon,"•",s)})}case"FilePreview":{const d=Ie(a.file);return d?r.jsx(Kt,{file:d}):r.jsx("div",{className:"rounded border p-3 text-sm text-muted-foreground",children:X(a.filename??a.label,"File",s)})}default:return r.jsxs("div",{className:"rounded border border-dashed p-3 text-xs text-muted-foreground",children:["Unsupported component: ",t.kind]})}}function ht(e){return r.jsx(de,{...e})}function Yt(e){const t={};for(const[n,s]of Object.entries(e??{})){if(typeof s!="string"||!s.trim())continue;const i=`--ar-${n.replace(/[A-Z]/g,c=>`-${c.toLowerCase()}`)}`;t[i]=s}return t}function pt({theme:e,colorScheme:t="light",className:n,style:s,children:i,...c}){const[f,w]=l.useState(null);return r.jsxs("div",{...c,className:y("ar-app",n),"data-ar-theme":t,style:{...Yt(e),...s},children:[r.jsx(tt.Provider,{value:f,children:i}),r.jsx("div",{ref:w,className:"ar-portal","data-ar-portal":""})]})}function Oe(e){if(e instanceof B.EmbedError)switch(e.code){case"invalid_key":return{title:"This app can't be shown",detail:"Its access key isn't valid."};case"origin_not_allowed":return{title:"This site isn't allowed to show this app",detail:"The app's owner needs to add this site to the app's allowed sites."};case"not_found":return{title:"App not found",detail:"This app or screen isn't available to visitors."};case"rate_limited":return{title:"Too many requests",detail:e.retryAfterSeconds?`Please try again in ${e.retryAfterSeconds} ${e.retryAfterSeconds===1?"second":"seconds"}.`:"Please try again in a moment."};case"unavailable":return{title:"Temporarily unavailable",detail:"This app can't be loaded right now. Please try again shortly."};case"bad_input":return{title:"Those values can't be used",detail:e.message||"One of the values given to this app isn't valid."};default:return{title:"Unable to load this app",detail:"Something went wrong. Please try again."}}return e instanceof B.SecretKeyError?{title:"This app isn't set up correctly",detail:"A secret key was given. Use the app's publishable key (it starts with ar_pk_)."}:e instanceof B.ValidationError?{title:"This app isn't set up correctly",detail:e.message}:e instanceof B.NetworkError?{title:"Couldn't reach AgentRuntime",detail:"Check your connection and try again."}:{title:"Unable to load this app",detail:"Something went wrong. Please try again."}}function xt(e){const{events:t,...n}=e;return{...n,children:e.children?.map(xt)}}function qr(e){return JSON.stringify(Object.entries(e??{}).sort(([t],[n])=>t<n?-1:t>n?1:0))}function $e({className:e}){return r.jsx("div",{className:y("animate-pulse rounded-md bg-muted",e)})}function $r({error:e,onRetry:t}){const{title:n,detail:s}=Oe(e),i=e instanceof B.EmbedError?e.code:"error",c=!(e instanceof B.EmbedError)||["rate_limited","unavailable","unknown","bad_input"].includes(e.code);return r.jsxs("div",{className:"flex flex-col items-center gap-2 rounded-lg border bg-card px-4 py-8 text-center",role:"alert","data-ar-part":"embed-error","data-ar-error":i,children:[r.jsx(ye,{className:"h-5 w-5 text-destructive"}),r.jsx("p",{className:"text-sm font-medium",children:n}),r.jsx("p",{className:"text-sm text-muted-foreground",children:s}),c?r.jsx(U,{type:"button",size:"sm",variant:"outline",onClick:t,children:"Try again"}):null]})}function Xt({publishableKey:e,appId:t,view:n,inputs:s,baseUrl:i,inputsDebounceMs:c=300,className:f,style:w,theme:h,colorScheme:g,components:a,frame:p=!0,loadingFallback:v,errorFallback:o,onError:d,transport:b}){const x=l.useRef(d);x.current=d;const m=l.useMemo(()=>{if(b)return{transport:b,error:null};try{return{transport:B.createEmbedTransport({publishableKey:e,baseUrl:i}),error:null}}catch(S){return{transport:null,error:S}}},[b,e,i]),j=m.transport,[C,R]=l.useState(null),[D,E]=l.useState(0),[q,_]=l.useState(0);l.useEffect(()=>{if(!j||n||!t)return;let S=!1;const W=new AbortController;return(async()=>{try{const F=await j.getApp({appId:t,signal:W.signal});S||R({appId:t,viewId:F.defaultViewId||F.navigation[0]?.view_id||"",error:null})}catch(F){if(S)return;R({appId:t,viewId:"",error:F}),x.current?.(F)}})(),()=>{S=!0,W.abort()}},[j,t,n,D]);const A=C?.appId===t?C:null,T=n||A?.viewId||"",K=n?null:A?.error??null,ae=qr(s),ne=l.useRef(s);ne.current=s;const[$,P]=l.useState(ae);l.useEffect(()=>{if(ae===$)return;if(c<=0){P(ae);return}const S=setTimeout(()=>P(ae),c);return()=>clearTimeout(S)},[ae,$,c]);const[H,ie]=l.useState({key:"",screen:"",data:null,error:null,fetching:!1}),se=JSON.stringify([t,T,$]);l.useEffect(()=>{if(!j||!t||!T)return;let S=!1;const W=new AbortController,F=JSON.stringify([t,T]);ie(ee=>({key:se,screen:F,data:ee.screen===F?ee.data:null,error:null,fetching:!0}));const Ve=Object.fromEntries(JSON.parse($));return j.render({appId:t,viewId:T,inputs:Ve,signal:W.signal}).then(ee=>!S&&ie({key:se,screen:F,data:ee,error:null,fetching:!1})).catch(ee=>{S||(ie(Ne=>({...Ne,key:se,error:ee,fetching:!1})),x.current?.(ee))}),()=>{S=!0,W.abort()}},[j,t,T,se,q]);const oe=K!==null||!n&&!A,Q=l.useCallback(()=>oe?E(S=>S+1):_(S=>S+1),[oe]),z=l.useMemo(()=>H.data?.tree?xt(H.data.tree):null,[H.data]),G=m.error??K??H.error;let Y;if(G&&!z)Y=o?o(G,Q):r.jsx($r,{error:G,onRetry:Q});else if(!z)j&&t&&!T&&A&&!A.error?Y=r.jsx("p",{className:"py-10 text-center text-sm text-muted-foreground",children:"This app has nothing to show yet."}):Y=v??r.jsxs("div",{className:"flex w-full flex-col gap-4 rounded-lg border bg-card p-6","aria-busy":"true","aria-label":"Loading app","data-ar-part":"loading",children:[r.jsx($e,{className:"h-4 w-24"}),r.jsx($e,{className:"h-9 w-full"}),r.jsx($e,{className:"h-20 w-full"})]});else{const S=Array.isArray(z.children)&&z.children.length===0;Y=r.jsxs(r.Fragment,{children:[G?r.jsxs("div",{role:"alert",className:"mb-3 flex items-start gap-2 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-sm","data-ar-part":"refresh-error","data-ar-error":G instanceof B.EmbedError?G.code:"error",children:[r.jsx(ye,{className:"mt-0.5 h-4 w-4 shrink-0"}),r.jsxs("span",{className:"flex-1",children:["Couldn't refresh this screen. ",Oe(G).title,". ",Oe(G).detail]}),r.jsx("button",{type:"button",className:"font-medium underline-offset-4 hover:underline",onClick:Q,children:"Try again"})]}):null,r.jsx("section",{"data-ar-part":"screen",className:y("relative transition-opacity",p&&"rounded-lg border bg-card p-4 shadow-sm sm:p-6",H.fetching&&"opacity-80"),"aria-busy":H.fetching||void 0,children:S?r.jsx("div",{className:"py-10 text-center text-sm text-muted-foreground",children:"This screen is empty."}):r.jsx(ht,{node:z,interactionMode:"read_only",components:a})})]})}return r.jsx(pt,{theme:h,colorScheme:g,className:f,style:w,"data-ar-app":t,"data-ar-view":T,"data-ar-embed":"",children:Y})}function Zt(e,t){const n=[];return je(e,s=>{if(!qt(s.kind)||!s.props?.required)return;const i=s.id in t?t[s.id]:s.kind==="Checkbox"||s.kind==="Switch"?s.props?.checked:s.props?.value;(i==null||typeof i=="string"&&i.trim()===""||i===!1)&&n.push({id:s.id,name:ke(s)})}),n}function Qt(e,t,n){const s=[...ve(e)].filter(i=>!Ae(t,i));return s.length===0?null:`Pick a row in ${s.map(i=>n?.(i)??i).join(" and ")} first.`}const er="This link can't be opened: only web addresses (http or https) are allowed.";function Ur(e,t=60){return e.length>t?`${e.slice(0,t-1)}…`:e}async function tr(e,t,n,s,i={}){const c=[],f=Qt(e,i,n.tableName);if(f)return n.showMessage(f,"warning"),{ok:!1,log:c,error:f};for(const w of e){const h=Me(w,i);try{if(Pe(h)){if(s==="test"){if(!n.testServerStep){c.push({step:h,status:"skipped",detail:"Skipped in test mode"});continue}const a=await n.testServerStep(h);if(c.push({step:h,status:a.ok?"tested":"failed",detail:a.detail,result:a.result}),!a.ok)return{ok:!1,log:c,error:a.detail};continue}const g=await n.runServerStep(h);c.push({step:h,status:"done",result:g});continue}switch(h.type){case"ui.message":n.showMessage(h.text,h.tone??"success");break;case"ui.navigate":n.navigate(h.view_id);break;case"ui.open_url":if(!Wt(h.url)){const g=`Only http and https links can be opened, not “${Ur(String(h.url??""))}”.`;return c.push({step:h,status:"failed",detail:g}),n.showMessage(er,"warning"),{ok:!1,log:c,error:g}}n.openUrl(h.url.trim());break;case"ui.set_value":n.setValue(h.component_id,h.value);break;case"ui.refresh":n.refresh();break}c.push({step:h,status:"done"})}catch(g){const a=g instanceof Error?g.message:String(g);c.push({step:h,status:"failed",detail:a});const p=nr(g);if(p){for(const d of ve(e))n.setValue(d,null);p==="row_changed"&&n.refresh();const o=p==="row_changed"?"That row has changed or is no longer there. The table is up to date now; pick the row again.":"Pick the row again.";return n.showMessage(o,"warning"),{ok:!1,log:c,error:a}}const v=t.error_message?.trim()||rr(g);return n.showMessage(v,"error"),{ok:!1,log:c,error:a}}}return{ok:!0,log:c}}function rr(e){const t=e?.status;return t===401?"Your session has ended. Sign in again, then try once more.":t===403?"You don't have permission to do that here.":t===404?"That workflow or run wasn't found. It may have been deleted.":t===409?"This was already handled, or it changed. Refresh to see where it stands.":"That didn't go through. Try again in a moment."}function nr(e){const t=e,n=t?.code??t?.data?.error;return n==="row_changed"||n==="row_not_picked"?n:null}function Kr(e,t){const n={};return je(e,s=>{const i=s.props?.workflow_input,c=i&&typeof i.param=="string"?i.param:"";if(!c)return;const f=s.id in t?t[s.id]:s.kind==="Checkbox"||s.kind==="Switch"?s.props?.checked:s.props?.value;(f!=null&&typeof f!="object"||f!=null&&!("bind"in f))&&(n[c]=f)}),n}const Hr=new Set(["completed","succeeded","success","failed","failure","error","stopped","cancelled","canceled"]);function zr(e){typeof window<"u"&&window.open(e,"_blank","noopener,noreferrer")}function sr(e){const t=Je(),n=e.client??t?.client;if(!n)throw new Error("useAgentRuntimeApp: wrap your app in <AgentRuntimeProvider> or pass `client`.");const s=e.app,[i,c]=l.useState(e.view??""),[f,w]=l.useState({runId:e.runId,taskId:e.taskId,workflowRef:e.workflowRef}),[h,g]=l.useState({}),[a,p]=l.useState({}),[v,o]=l.useState(new Set),[d,b]=l.useState(null),[x,m]=l.useState(null),[j,C]=l.useState(null),[R,D]=l.useState(0),[E,q]=l.useState({key:"",data:null,error:null,fetching:!1}),_=l.useRef(e);_.current=e,l.useEffect(()=>{e.view!==void 0&&(c(e.view),g({}),p({}))},[e.view]),l.useEffect(()=>{w({runId:e.runId,taskId:e.taskId,workflowRef:e.workflowRef})},[e.runId,e.taskId,e.workflowRef]);const A=e.navigation==="app"||!i;l.useEffect(()=>{if(!A||!s)return;let u=!1;const N=new AbortController;return n.getApp({appId:s,signal:N.signal}).then(k=>!u&&C({appId:s,info:k,error:null})).catch(k=>{u||(C({appId:s,info:null,error:k}),_.current.onError?.(k))}),()=>{u=!0,N.abort()}},[n,s,A]);const T=j?.appId===s?j:null,K=i||T?.info?.defaultViewId||T?.info?.navigation[0]?.view_id||"",ae=l.useMemo(()=>Array.isArray(e.navigation)?e.navigation.filter(u=>u?.view_id):e.navigation==="app"?T?.info?.navigation??[]:[],[e.navigation,T]),ne=JSON.stringify([s,K,f.runId??"",f.taskId??"",f.workflowRef??""]),$=l.useCallback(()=>D(u=>u+1),[]);l.useEffect(()=>{if(!s||!K)return;let u=!1;const N=new AbortController;return q(k=>k.key===ne?{...k,fetching:!0}:{key:ne,data:null,error:null,fetching:!0}),n.render({appId:s,viewId:K,context:f,signal:N.signal}).then(k=>!u&&q({key:ne,data:k,error:null,fetching:!1})).catch(k=>{u||(q(I=>({...I,key:ne,error:k,fetching:!1})),_.current.onError?.(k))}),()=>{u=!0,N.abort()}},[n,s,K,ne,R]);const P=E.key===ne?E:null,H=P?.data?.tree??null,ie=P?.data?.run?.status!=null?String(P.data.run.status):"",se=e.refreshIntervalMs??5e3;l.useEffect(()=>{if(!f.runId)return;if(n.transport.subscribeRun)return n.transport.subscribeRun({appId:s,runId:f.runId,onEvent:$,onError:N=>_.current.onError?.(N)});if(!se||Hr.has(ie.toLowerCase()))return;const u=setInterval($,se);return()=>clearInterval(u)},[n,s,f.runId,ie,se,$]);const oe=l.useCallback(u=>{b(u),_.current.onMessage?.(u)},[]),Q=l.useRef(h);Q.current=h;const z=l.useRef(H);z.current=H;const G=l.useRef(f);G.current=f;const Y=l.useCallback(u=>{const N=z.current;return N&&ke(Re(N,u))||"the table"},[]),S=l.useCallback((u,N,k)=>{const I=ue(u,N);if(I.length===0)return!1;const J=z.current,le=I.some(Pe);if((N==="onClick"||N===we)&&le&&Ce(u,N).require_valid&&J){const me=Zt(J,k);if(me.length>0)return p(Object.fromEntries(me.map(ce=>[ce.id,"Fill this in"]))),!1}const te=Qt(I,k,Y);return te?(p({}),oe({text:te,tone:"warning"}),!1):!0},[oe,Y]),W=l.useCallback(async(u,N,k)=>{const I=ue(u,N),J=Ce(u,N),le=k?{...Q.current,...k}:Q.current;if(!S(u,N,le))return;p({}),b(null),J.disable_while_running&&o(M=>new Set(M).add(u.id));let te=G.current,me=!1,ce="";await tr(I,J,{runServerStep:async M=>{try{const L=await n.action({appId:s,viewId:K,componentId:u.id,event:N,step:M,values:le,context:te}),pe=L?.run_id!=null?String(L.run_id):"",lr="workflow_ref"in M?M.workflow_ref:"";return pe&&pe!==te.runId&&(te={runId:pe,taskId:void 0,workflowRef:lr||te.workflowRef},me=!0),L}catch(L){throw _.current.onError?.(L),L}},showMessage:(M,L)=>oe({text:M,tone:L}),navigate:M=>{ce=M},openUrl:M=>(_.current.openUrl??zr)(M),setValue:(M,L)=>g(pe=>({...pe,[M]:L})),refresh:$,tableName:Y},"live",le),o(M=>{const L=new Set(M);return L.delete(u.id),L}),(ce||me)&&g({}),me&&(w(te),_.current.onRunChange?.(te)),ce&&(c(ce),_.current.onNavigate?.(ce)),$()},[K,s,n,S,$,oe,Y]),F=l.useCallback((u,N,k)=>{if(!S(u,N,k?{...Q.current,...k}:Q.current))return;const I=Ce(u,N).confirm?.trim();if(I){const J=_.current.confirm;J?Promise.resolve(J(I)).then(le=>{le&&W(u,N,k)}):m({node:u,event:N,question:I,values:k});return}W(u,N,k)},[S,W]),Ve=l.useCallback(u=>{m(null),u&&x&&W(x.node,x.event,x.values)},[x,W]),ee=l.useCallback(()=>b(null),[]),Ne=l.useCallback((u,N)=>{g(I=>({...I,[u]:N})),p(I=>{if(!I[u])return I;const J={...I};return delete J[u],J});const k=z.current?Re(z.current,u):null;k&&k.kind!=="TextField"&&k.kind!=="TextArea"&&ue(k,"onChange").length>0&&F(k,"onChange",{[u]:N})},[F]),ar=l.useCallback(u=>{g({}),p({}),b(null),c(u),_.current.onNavigate?.(u)},[]),ir=l.useCallback(()=>{const u={};g({}),w(u),_.current.onRunChange?.(u)},[]),gt=T?.error&&!i?T.error:null;let fe;gt?fe="error":K?!P||!P.data&&!P.error?fe="loading":P.data?fe="ready":fe="error":fe=A&&!T?"loading":"no-view";const or=H?{node:H,interactionMode:P?.data?.interaction?.mode??"editable",draft:h,fieldErrors:a,busyIds:v,onDraftChange:Ne,onEvent:F}:null;return{status:fe,render:P?.data??null,error:gt??P?.error??null,isFetching:!!P?.fetching,appInfo:T?.info??null,viewId:K,navigation:ae,context:f,runStatus:ie,values:h,fieldErrors:a,busyIds:v,message:d,pendingConfirm:x?{question:x.question}:null,rendererProps:or,setValue:Ne,handleEvent:F,answerConfirm:Ve,dismissMessage:ee,navigate:ar,startOver:ir,refresh:$}}const St={embed_browse:"This screen is view-only here.",run_in_progress:"The workflow is still working on this. The screen updates when it's your turn.",completed:"This run has finished. There's nothing left to do here.",failed:"This run stopped with an error, so there's nothing to do here.",cancelled:"This run was cancelled.",canceled:"This run was cancelled."};function Gr(e,t){return e==="editable"?null:t&&St[t]?St[t]:t&&!/^[a-z0-9_]+$/.test(t)?t:e==="closed"?"This step is closed — nothing left to do here.":"This screen is read-only right now."}function Ge(e){return e instanceof B.NotFoundError?"This app or screen wasn't found. It may have been deleted, or it belongs to another workspace.":e instanceof B.AuthenticationError?"Your session has ended. Sign in again to use this app.":e instanceof B.PermissionError?"You don't have access to this app.":e instanceof B.NetworkError?"Couldn't reach AgentRuntime. Check your connection and try again.":e instanceof Error&&e.message?e.message:"The server didn't respond. Try again in a moment."}function xe({className:e}){return r.jsx("div",{className:y("animate-pulse rounded-md bg-muted",e)})}function Wr(){return r.jsxs("div",{className:"flex w-full flex-col gap-4 rounded-lg border bg-card p-6","aria-busy":"true","aria-label":"Loading app","data-ar-part":"loading",children:[r.jsx(xe,{className:"h-4 w-24"}),r.jsx(xe,{className:"h-9 w-full"}),r.jsx(xe,{className:"h-4 w-24"}),r.jsx(xe,{className:"h-20 w-full"}),r.jsx(xe,{className:"h-9 w-28"})]})}function Jr({message:e,onDismiss:t}){return r.jsxs("div",{role:"status","data-ar-part":"message","data-ar-tone":e.tone,className:y("flex items-start gap-2 rounded-md border px-3 py-2 text-sm",e.tone==="success"&&"border-success/40 bg-success/10",e.tone==="info"&&"border-info/40 bg-info/10",e.tone==="warning"&&"border-warning/40 bg-warning/10",e.tone==="error"&&"border-destructive/40 bg-destructive/10"),children:[e.tone==="error"||e.tone==="warning"?r.jsx(ye,{className:y("mt-0.5 h-4 w-4 shrink-0",e.tone==="error"&&"text-destructive")}):r.jsx(gr,{className:"mt-0.5 h-4 w-4 shrink-0"}),r.jsx("span",{className:"flex-1",children:e.text}),r.jsx("button",{type:"button","aria-label":"Dismiss",onClick:t,children:r.jsx(Ye,{className:"h-4 w-4"})})]})}function Yr({question:e,onAnswer:t}){const n=l.useId(),s=l.useRef(null);return l.useEffect(()=>{s.current?.focus()},[]),r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4","data-ar-part":"confirm",onClick:()=>t(!1),children:r.jsxs("div",{role:"alertdialog","aria-modal":"true","aria-labelledby":n,className:"w-full max-w-md space-y-4 rounded-lg border bg-background p-6 shadow-lg",onClick:i=>i.stopPropagation(),onKeyDown:i=>{i.key==="Escape"&&t(!1)},children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h2",{id:n,className:"text-lg font-semibold",children:e}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose Continue to go ahead."})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(U,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Not yet"}),r.jsx(U,{ref:s,type:"button",onClick:()=>t(!0),children:"Continue"})]})]})})}function Xr({className:e,style:t,theme:n,colorScheme:s,components:i,showMessages:c=!0,messageDurationMs:f=6e3,showRunStatus:w=!0,frame:h=!0,loadingFallback:g,errorFallback:a,...p}){const v=Je(),o=sr(p),{message:d,dismissMessage:b}=o;l.useEffect(()=>{if(!d||f<=0||d.tone==="warning"||d.tone==="error")return;const R=setTimeout(b,f);return()=>clearTimeout(R)},[d,f,b]);const x=v?.components||i?{...v?.components,...i}:void 0,m=o.render,j=m?.interaction?Gr(m.interaction.mode,m.interaction.reason):null;let C;if(o.status==="loading")C=g??r.jsx(Wr,{});else if(o.status==="no-view")C=r.jsx("p",{className:"py-10 text-center text-sm text-muted-foreground",children:"This app has no screens yet."});else if(o.status==="error"||!m)C=a?a(o.error,o.refresh):r.jsxs("div",{className:"flex flex-col items-center gap-3 px-4 py-10 text-center",role:"alert","data-ar-part":"load-error",children:[r.jsx(ye,{className:"h-6 w-6 text-destructive"}),r.jsx("p",{className:"font-medium",children:"Unable to load this screen"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:Ge(o.error)}),r.jsx(U,{type:"button",size:"sm",onClick:o.refresh,children:"Retry"})]});else{const R=Array.isArray(m.tree?.children)&&m.tree.children.length===0;C=r.jsx("section",{"data-ar-part":"screen",className:y("relative transition-opacity",h&&"rounded-lg border bg-card p-4 shadow-sm sm:p-6",o.isFetching&&"opacity-80"),"aria-busy":o.isFetching||void 0,"aria-label":o.navigation.find(D=>D.view_id===o.viewId)?.label||o.viewId,children:m.tree&&!R&&o.rendererProps?r.jsx(ht,{...o.rendererProps,components:x}):r.jsx("div",{className:"py-10 text-center text-sm text-muted-foreground",children:"This screen is empty."})})}return r.jsxs(pt,{theme:n??v?.theme,colorScheme:s??v?.colorScheme,className:e,style:t,"data-ar-app":p.app,"data-ar-view":o.viewId,children:[r.jsxs("div",{className:"flex w-full flex-col gap-4",children:[o.navigation.length>1?r.jsx("nav",{className:"-mb-px flex gap-1 overflow-x-auto border-b","aria-label":"App screens","data-ar-part":"nav",children:o.navigation.map(R=>{const D=R.view_id===o.viewId;return r.jsx("button",{type:"button","aria-current":D?"page":void 0,"data-ar-part":"tab",className:y("whitespace-nowrap border-b-2 px-3 py-2 text-sm transition-colors",D?"border-primary font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),onClick:()=>o.navigate(R.view_id),children:R.label??R.view_id},R.view_id)})}):null,w&&o.context.runId?r.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 rounded-md border bg-muted/40 px-3 py-2 text-sm","data-ar-part":"run",children:[r.jsx("span",{className:"text-muted-foreground",children:"Run"}),r.jsx("span",{className:"font-mono text-xs",children:o.context.runId.slice(0,8)}),r.jsx("span",{className:"rounded-full bg-secondary px-2 py-0.5 text-xs font-medium",children:o.runStatus||"running"}),r.jsxs(U,{type:"button",size:"sm",variant:"ghost",className:"ml-auto h-7 text-xs",onClick:o.startOver,children:[r.jsx(Ye,{className:"mr-1 h-3 w-3"}),"Start over"]})]}):null,c&&o.message?r.jsx("div",{className:"pointer-events-none sticky top-2 z-10 -my-2 h-0","data-ar-part":"message-bar",children:r.jsx("div",{className:"pointer-events-auto rounded-md bg-background shadow-md",children:r.jsx(Jr,{message:o.message,onDismiss:o.dismissMessage})})}):null,j?r.jsxs("div",{className:"flex items-start gap-2 rounded-md border bg-muted/40 px-3 py-2 text-sm text-muted-foreground","data-ar-part":"notice",children:[r.jsx(br,{className:"mt-0.5 h-4 w-4 shrink-0"}),r.jsx("span",{children:j})]}):null,o.status==="ready"&&o.error?r.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-sm","data-ar-part":"refresh-error",children:[r.jsx(ye,{className:"mt-0.5 h-4 w-4 shrink-0"}),r.jsxs("span",{className:"flex-1",children:["Couldn't refresh this screen. ",Ge(o.error)]}),r.jsx("button",{type:"button",className:"font-medium underline-offset-4 hover:underline",onClick:o.refresh,children:"Retry"})]}):null,C]}),o.pendingConfirm?r.jsx(Yr,{question:o.pendingConfirm.question,onAnswer:o.answerConfirm}):null]})}function Zr(e){return"publishableKey"in e&&e.publishableKey!==void 0?r.jsx(Xt,{...e}):r.jsx(Xr,{...e})}const Qr=["Stack","Section","Text","Label","Badge","Button","TextArea","Video","Link","Grid","Card","List","Divider","Metric","Image","TextField","Select","Checkbox","Switch","Table","Tabs","IconButton","FilePreview"];exports.AgentRuntimeApp=Zr;exports.AgentRuntimeProvider=hr;exports.AppRoot=pt;exports.BUILT_IN_KINDS=Qr;exports.Badge=At;exports.Button=U;exports.Checkbox=Qe;exports.EmbeddedApp=Xt;exports.HostStyled=Rt;exports.Input=Xe;exports.PortalContainerContext=tt;exports.ROW_CLICK_EVENT=we;exports.ROW_HANDLE_KEY=Ee;exports.Select=Ot;exports.SelectContent=nt;exports.SelectItem=st;exports.SelectTrigger=rt;exports.SelectValue=Bt;exports.SurfaceRenderer=ht;exports.Switch=et;exports.Table=at;exports.TableBody=ot;exports.TableCell=Te;exports.TableHead=lt;exports.TableHeader=it;exports.TableRow=be;exports.Textarea=Ze;exports.UNSAFE_LINK_MESSAGE=er;exports.absoluteChildrenToFlowRows=Lt;exports.asSurfaceFile=Ie;exports.asSurfaceFiles=$t;exports.buttonVariants=Tt;exports.collectNodeIds=Pt;exports.collectWorkflowInputValues=Kr;exports.describeSelectedToken=Pr;exports.embedErrorMessage=Oe;exports.emptyRequiredFields=Zt;exports.failedStepMessage=rr;exports.findNode=Re;exports.findParent=Ft;exports.formatBytes=He;exports.formatSurfaceDisplayValue=_e;exports.getEventConfig=ct;exports.getEventOptions=Ce;exports.getEventSteps=ue;exports.isBindValue=he;exports.isInputKind=qt;exports.isSafeOpenUrl=Wt;exports.isServerStep=Pe;exports.isUnresolvedBindingDisplay=kr;exports.kindLabel=Dt;exports.loadErrorMessage=Ge;exports.nodeDisplayName=ke;exports.parseSelectedToken=mt;exports.parseViewDocument=jr;exports.pickableTables=Ar;exports.pickedRowProblem=nr;exports.resolveSelectedTokens=Me;exports.rowsArePickable=ft;exports.runEventSteps=tr;exports.safeLinkHref=Jt;exports.safeLinkUrl=Ut;exports.sameRow=Gt;exports.selectedRow=Ae;exports.selectedRowToken=Mr;exports.tableColumns=Ht;exports.tablesReferencedIn=ve;exports.themeStyle=Yt;exports.useAgentRuntime=pr;exports.useAgentRuntimeApp=sr;exports.useOptionalAgentRuntime=Je;exports.usePortalContainer=Mt;exports.walkNodes=je;exports.withoutEvents=xt;Object.keys(B).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>B[e]})});
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|