@adonis-agora/agent 0.74.1 → 0.76.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.
Files changed (124) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +16 -0
  3. package/dist/src/channels/handler.d.ts.map +1 -1
  4. package/dist/src/channels/handler.js +10 -0
  5. package/dist/src/channels/handler.js.map +1 -1
  6. package/dist/src/channels/texts.d.ts +2 -0
  7. package/dist/src/channels/texts.d.ts.map +1 -1
  8. package/dist/src/channels/texts.js.map +1 -1
  9. package/dist/src/genui/catalog.d.ts.map +1 -1
  10. package/dist/src/genui/catalog.js +3 -1
  11. package/dist/src/genui/catalog.js.map +1 -1
  12. package/dist/src/genui/channels.d.ts +32 -5
  13. package/dist/src/genui/channels.d.ts.map +1 -1
  14. package/dist/src/genui/channels.js +20 -9
  15. package/dist/src/genui/channels.js.map +1 -1
  16. package/dist/src/genui/index.d.ts.map +1 -1
  17. package/dist/src/genui/index.js +7 -7
  18. package/dist/src/genui/index.js.map +1 -1
  19. package/dist/src/genui/kit/bundle.d.ts +12 -0
  20. package/dist/src/genui/kit/bundle.d.ts.map +1 -1
  21. package/dist/src/genui/kit/bundle.js +124 -133
  22. package/dist/src/genui/kit/bundle.js.map +1 -1
  23. package/dist/src/genui/kit/discover.d.ts +8 -5
  24. package/dist/src/genui/kit/discover.d.ts.map +1 -1
  25. package/dist/src/genui/kit/discover.js +45 -18
  26. package/dist/src/genui/kit/discover.js.map +1 -1
  27. package/dist/src/genui/kit/docs.d.ts +3 -1
  28. package/dist/src/genui/kit/docs.d.ts.map +1 -1
  29. package/dist/src/genui/kit/docs.js +22 -5
  30. package/dist/src/genui/kit/docs.js.map +1 -1
  31. package/dist/src/genui/kit/files.d.ts +22 -10
  32. package/dist/src/genui/kit/files.d.ts.map +1 -1
  33. package/dist/src/genui/kit/files.js +117 -19
  34. package/dist/src/genui/kit/files.js.map +1 -1
  35. package/dist/src/genui/kit/index.d.ts +5 -3
  36. package/dist/src/genui/kit/index.d.ts.map +1 -1
  37. package/dist/src/genui/kit/index.js +4 -2
  38. package/dist/src/genui/kit/index.js.map +1 -1
  39. package/dist/src/genui/kit/plugin.d.ts +17 -9
  40. package/dist/src/genui/kit/plugin.d.ts.map +1 -1
  41. package/dist/src/genui/kit/plugin.js +196 -129
  42. package/dist/src/genui/kit/plugin.js.map +1 -1
  43. package/dist/src/genui/kit/styles.d.ts +83 -0
  44. package/dist/src/genui/kit/styles.d.ts.map +1 -0
  45. package/dist/src/genui/kit/styles.js +406 -0
  46. package/dist/src/genui/kit/styles.js.map +1 -0
  47. package/dist/src/genui/kit/vite-build.d.ts +33 -0
  48. package/dist/src/genui/kit/vite-build.d.ts.map +1 -0
  49. package/dist/src/genui/kit/vite-build.js +195 -0
  50. package/dist/src/genui/kit/vite-build.js.map +1 -0
  51. package/dist/src/genui/kit/write.d.ts +20 -8
  52. package/dist/src/genui/kit/write.d.ts.map +1 -1
  53. package/dist/src/genui/kit/write.js +54 -16
  54. package/dist/src/genui/kit/write.js.map +1 -1
  55. package/dist/src/genui/public.d.ts +5 -4
  56. package/dist/src/genui/public.d.ts.map +1 -1
  57. package/dist/src/genui/public.js +4 -3
  58. package/dist/src/genui/public.js.map +1 -1
  59. package/dist/src/genui/sandbox-jsx-frame-generated.d.ts +2 -0
  60. package/dist/src/genui/sandbox-jsx-frame-generated.d.ts.map +1 -0
  61. package/dist/src/genui/sandbox-jsx-frame-generated.js +4 -0
  62. package/dist/src/genui/sandbox-jsx-frame-generated.js.map +1 -0
  63. package/dist/src/genui/sandbox-kit.d.ts +50 -17
  64. package/dist/src/genui/sandbox-kit.d.ts.map +1 -1
  65. package/dist/src/genui/sandbox-kit.js +20 -10
  66. package/dist/src/genui/sandbox-kit.js.map +1 -1
  67. package/dist/src/genui/sandbox-styles.d.ts +113 -0
  68. package/dist/src/genui/sandbox-styles.d.ts.map +1 -0
  69. package/dist/src/genui/sandbox-styles.js +487 -0
  70. package/dist/src/genui/sandbox-styles.js.map +1 -0
  71. package/dist/src/genui/sandbox-theme.d.ts +13 -9
  72. package/dist/src/genui/sandbox-theme.d.ts.map +1 -1
  73. package/dist/src/genui/sandbox-theme.js +52 -60
  74. package/dist/src/genui/sandbox-theme.js.map +1 -1
  75. package/dist/src/genui/sandbox.d.ts +21 -15
  76. package/dist/src/genui/sandbox.d.ts.map +1 -1
  77. package/dist/src/genui/sandbox.js +66 -17
  78. package/dist/src/genui/sandbox.js.map +1 -1
  79. package/dist/src/genui/tools.d.ts +20 -0
  80. package/dist/src/genui/tools.d.ts.map +1 -1
  81. package/dist/src/genui/tools.js +19 -4
  82. package/dist/src/genui/tools.js.map +1 -1
  83. package/dist/src/hooks/genui_kit.d.ts +6 -2
  84. package/dist/src/hooks/genui_kit.d.ts.map +1 -1
  85. package/dist/src/hooks/genui_kit.js +21 -9
  86. package/dist/src/hooks/genui_kit.js.map +1 -1
  87. package/dist/src/index.d.ts +1 -1
  88. package/dist/src/index.js +1 -1
  89. package/dist/src/negotiated-tool-ui.d.ts.map +1 -1
  90. package/dist/src/negotiated-tool-ui.js +4 -0
  91. package/dist/src/negotiated-tool-ui.js.map +1 -1
  92. package/dist/src/react/core/genui/sandbox-assets.d.ts +4 -1
  93. package/dist/src/react/core/genui/sandbox-assets.d.ts.map +1 -1
  94. package/dist/src/react/core/genui/sandbox-assets.js +17 -5
  95. package/dist/src/react/core/genui/sandbox-assets.js.map +1 -1
  96. package/dist/src/react/core/genui/sandbox.d.ts +1 -1
  97. package/dist/src/react/core/genui/sandbox.d.ts.map +1 -1
  98. package/dist/src/react/core/genui/sandbox.js +20 -4
  99. package/dist/src/react/core/genui/sandbox.js.map +1 -1
  100. package/dist/src/react-native/genui/index.d.ts +20 -0
  101. package/dist/src/react-native/genui/index.d.ts.map +1 -0
  102. package/dist/src/react-native/genui/index.js +18 -0
  103. package/dist/src/react-native/genui/index.js.map +1 -0
  104. package/dist/src/react-native/genui/provider.d.ts +19 -0
  105. package/dist/src/react-native/genui/provider.d.ts.map +1 -0
  106. package/dist/src/react-native/genui/provider.js +23 -0
  107. package/dist/src/react-native/genui/provider.js.map +1 -0
  108. package/dist/src/react-native/genui/sandbox-assets.d.ts +57 -0
  109. package/dist/src/react-native/genui/sandbox-assets.d.ts.map +1 -0
  110. package/dist/src/react-native/genui/sandbox-assets.js +153 -0
  111. package/dist/src/react-native/genui/sandbox-assets.js.map +1 -0
  112. package/dist/src/react-native/genui/sandbox-host.d.ts +119 -0
  113. package/dist/src/react-native/genui/sandbox-host.d.ts.map +1 -0
  114. package/dist/src/react-native/genui/sandbox-host.js +188 -0
  115. package/dist/src/react-native/genui/sandbox-host.js.map +1 -0
  116. package/dist/src/react-native/genui/sandbox.d.ts +86 -0
  117. package/dist/src/react-native/genui/sandbox.d.ts.map +1 -0
  118. package/dist/src/react-native/genui/sandbox.js +376 -0
  119. package/dist/src/react-native/genui/sandbox.js.map +1 -0
  120. package/dist/src/vite/index.d.ts +10 -7
  121. package/dist/src/vite/index.d.ts.map +1 -1
  122. package/dist/src/vite/index.js +10 -7
  123. package/dist/src/vite/index.js.map +1 -1
  124. package/package.json +28 -2
@@ -0,0 +1,86 @@
1
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
2
+ import { type ReactNode } from 'react';
3
+ import { type StyleProp, type ViewStyle } from 'react-native';
4
+ import { type WebViewProps } from 'react-native-webview';
5
+ import type { UiAction } from '../../genui/actions.js';
6
+ import { type SandboxPolicy, type SandboxProps } from '../../genui/sandbox.js';
7
+ import type { JsonSchema } from '../../genui/schema.js';
8
+ import type { SandboxRefusal } from '../../react/core/genui/sandbox.js';
9
+ import type { GenuiRenderer } from '../../react/core/genui/types.js';
10
+ import { type FetchLike, type NativeSandboxConfigSource } from './sandbox-assets.js';
11
+ import { type NativeSandboxTheme } from './sandbox-host.js';
12
+ /** What a drawn component calls to hand an action back to the agent (the next user turn). */
13
+ export type GenuiActionHandler = (action: UiAction) => void;
14
+ export interface NativeSandboxRendererOptions {
15
+ /**
16
+ * The policy the frame runs under. Default: the one the catalog's definition carries (through the
17
+ * enclosing `GenuiProvider`'s catalog), else none — no network, the default limits.
18
+ */
19
+ policy?: SandboxPolicy;
20
+ /** Checks the values of every `agent.send(…)` (a Zod object, any Standard Schema, or a JSON Schema). */
21
+ schema?: StandardSchemaV1 | JsonSchema;
22
+ /** Last word on an action before it is sent — e.g. an `Alert`. Falsy → dropped (`declined`). */
23
+ confirm?: (action: UiAction) => boolean | Promise<boolean>;
24
+ /** Where actions go. Default: the enclosing `GenuiActionProvider` / `GenuiProvider onAction`. */
25
+ onAction?: GenuiActionHandler;
26
+ /** Something the frame sent was refused — the same reasons as the web renderer's. */
27
+ onRefused?: (refusal: SandboxRefusal) => void;
28
+ /** An uncaught error in the generated code, or the view lost (it navigated, its process died). */
29
+ onError?: (message: string) => void;
30
+ /**
31
+ * The app's design tokens, as CSS custom properties on the frame's `:root` (the web renderer reads
32
+ * them off its page). An object, or a hook returning one — called while rendering, so it may use
33
+ * hooks (`() => useAppTheme()`); a change reaches a drawn view without reloading it. `false`: off.
34
+ */
35
+ theme?: NativeSandboxTheme | false | (() => NativeSandboxTheme | null | undefined);
36
+ /**
37
+ * Tailwind and the kit: an object (assets inline or by url), a url answering `GET <agent>/config`,
38
+ * a loader, or `false`. Default: `GET <baseUrl>/config` with a `baseUrl`, else theme only.
39
+ */
40
+ config?: NativeSandboxConfigSource;
41
+ /**
42
+ * The agent's absolute url (`https://api.example.com/agent`): where the config is fetched from by
43
+ * default, and what the relative urls it names resolve against.
44
+ */
45
+ baseUrl?: string;
46
+ /** The `fetch` for the config and assets. Default: the global one. */
47
+ fetch?: FetchLike;
48
+ /** What to draw while nothing is drawable yet. Default: a box of `initialHeight` with the placeholder lines. */
49
+ placeholder?: (state: {
50
+ height: number;
51
+ messages: string[];
52
+ title?: string;
53
+ }) => ReactNode;
54
+ /** Extra style for the WebView (its height is the content's). */
55
+ style?: StyleProp<ViewStyle>;
56
+ }
57
+ /**
58
+ * The WebView props every sandbox gets. JavaScript runs inside it; it stores nothing (no DOM
59
+ * storage, incognito, no cache, no cookies), reads no file, opens no window, loads no mixed content,
60
+ * shows no link preview, does not scroll (the host sizes it to its content) and goes nowhere: every
61
+ * URL reaches `onShouldStartLoadWithRequest` (the whitelist lets them through — a URL it refuses
62
+ * would be handed to `Linking.openURL`), which allows only the inline document.
63
+ */
64
+ export declare const NATIVE_SANDBOX_WEBVIEW_PROPS: Readonly<WebViewProps>;
65
+ /**
66
+ * A React Native renderer for the sandbox component (`Sandbox`): the model's HTML, CSS and JS in a
67
+ * hardened `react-native-webview` ({@link NATIVE_SANDBOX_WEBVIEW_PROPS}) — the same document as the
68
+ * web renderer's iframe (`buildSandboxDocument`, the same CSP: no network unless the policy lists an
69
+ * origin), sized to its content.
70
+ *
71
+ * It streams like the web one: a placeholder of `initialHeight`, a preview of the styled markup (no
72
+ * code runs), then the live view, whose code is posted in as it closes. The only bridge is the one
73
+ * the document carries: `ReactNativeWebView.postMessage` out (ready, resize, error, `agent.send`),
74
+ * `injectJavaScript` dispatching a `message` event in (render, run, theme, jsx). Everything the
75
+ * WebView says is checked as the web host checks it — length capped before parsing, the frame's
76
+ * token, size, interval and count limits, JSON only, `schema`, `confirm` — and an accepted
77
+ * `agent.send` is handed on as a `UiAction`.
78
+ *
79
+ * ```tsx
80
+ * <GenuiProvider registry={{ Sandbox: createNativeSandboxRenderer({ theme: () => useSandboxTheme() }) }} onAction={chat.sendUiAction}>
81
+ * ```
82
+ */
83
+ export declare function createNativeSandboxRenderer(options?: NativeSandboxRendererOptions): GenuiRenderer<SandboxProps>;
84
+ /** The native sandbox renderer with its defaults (theme from nothing, no Tailwind, no kit). */
85
+ export declare const NativeSandboxView: GenuiRenderer<SandboxProps>;
86
+ //# sourceMappingURL=sandbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../../../src/react-native/genui/sandbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EA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ACpC;;;;OAIG;IACH,KAAK,CAAC,EAAE,kBAAkB,GAAG,KAAK,GAAG,CAAC,MAAM,kBAAkB,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IACnF;;;OAGG;IACH,MAAM,CAAC,EAAE,yBAAyB,CAAC;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,gHAAgH;IAChH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,SAAS,CAAC;IAC3F,iEAAiE;IACjE,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,YAAY,CA2CvC,CAAC;AAsE1B;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,GAAE,4BAAiC,GACzC,aAAa,CAAC,YAAY,CAAC,CAyU7B;AAED,+FAA+F;AAC/F,eAAO,MAAM,iBAAiB,EAAE,aAAa,CAAC,YAAY,CAAiC,CAAC"}
@@ -0,0 +1,376 @@
1
+ import { createElement as _createElement } from "react";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
4
+ import { Text, View } from 'react-native';
5
+ import { WebView, } from 'react-native-webview';
6
+ import { buildSandboxDocument, previewHtml, SANDBOX_DEFAULTS, SANDBOX_MESSAGE, sandboxPolicyOf, } from '../../genui/sandbox.js';
7
+ import { GenuiActionContext, useGenuiNode, useGenuiProvider, } from '../../react/core/genui/generative-ui.js';
8
+ import { useNativeSandboxAsset, useNativeSandboxConfig, } from './sandbox-assets.js';
9
+ import { checkSandboxSend, clampSandboxHeight, hostMessageScript, nativeThemeCss, parseFrameMessage, sandboxToken, shouldStartSandboxLoad, } from './sandbox-host.js';
10
+ /**
11
+ * The WebView props every sandbox gets. JavaScript runs inside it; it stores nothing (no DOM
12
+ * storage, incognito, no cache, no cookies), reads no file, opens no window, loads no mixed content,
13
+ * shows no link preview, does not scroll (the host sizes it to its content) and goes nowhere: every
14
+ * URL reaches `onShouldStartLoadWithRequest` (the whitelist lets them through — a URL it refuses
15
+ * would be handed to `Linking.openURL`), which allows only the inline document.
16
+ */
17
+ export const NATIVE_SANDBOX_WEBVIEW_PROPS = Object.freeze({
18
+ // Frozen with the rest: one shared array must not be widened by anyone.
19
+ originWhitelist: Object.freeze(['*']),
20
+ onShouldStartLoadWithRequest: shouldStartSandboxLoad,
21
+ javaScriptEnabled: true,
22
+ javaScriptCanOpenWindowsAutomatically: false,
23
+ setSupportMultipleWindows: false,
24
+ domStorageEnabled: false,
25
+ allowFileAccess: false,
26
+ allowFileAccessFromFileURLs: false,
27
+ allowUniversalAccessFromFileURLs: false,
28
+ allowsLinkPreview: false,
29
+ incognito: true,
30
+ cacheEnabled: false,
31
+ cacheMode: 'LOAD_NO_CACHE',
32
+ mixedContentMode: 'never',
33
+ sharedCookiesEnabled: false,
34
+ thirdPartyCookiesEnabled: false,
35
+ geolocationEnabled: false,
36
+ mediaCapturePermissionGrantType: 'deny',
37
+ mediaPlaybackRequiresUserAction: true,
38
+ allowsFullscreenVideo: false,
39
+ allowsAirPlayForMediaPlayback: false,
40
+ allowsProtectedMedia: false,
41
+ allowsBackForwardNavigationGestures: false,
42
+ pullToRefreshEnabled: false,
43
+ dataDetectorTypes: 'none',
44
+ saveFormDataDisabled: true,
45
+ setBuiltInZoomControls: false,
46
+ setDisplayZoomControls: false,
47
+ textZoom: 100,
48
+ paymentRequestEnabled: false,
49
+ enableApplePay: false,
50
+ webviewDebuggingEnabled: false,
51
+ scrollEnabled: false,
52
+ bounces: false,
53
+ overScrollMode: 'never',
54
+ nestedScrollEnabled: false,
55
+ showsVerticalScrollIndicator: false,
56
+ showsHorizontalScrollIndicator: false,
57
+ automaticallyAdjustContentInsets: false,
58
+ contentInsetAdjustmentBehavior: 'never',
59
+ startInLoadingState: false,
60
+ });
61
+ // The package's class declaration (`Component<WebViewProps & P>`, `P = undefined`) types its props
62
+ // as `never` under strict null checks; this is the component as it is.
63
+ const SandboxWebView = WebView;
64
+ /** A URL that is neither the inline document nor a `data:` one — the WebView left the sandbox. */
65
+ function isForeignUrl(url) {
66
+ return typeof url === 'string' && url !== '' && !/^(about|data):/i.test(url);
67
+ }
68
+ /** How many times a view whose WebView process died is drawn afresh before it gives up. */
69
+ const MAX_RESTARTS = 2;
70
+ const placeholderBox = {
71
+ alignItems: 'center',
72
+ justifyContent: 'center',
73
+ borderWidth: 1,
74
+ borderStyle: 'dashed',
75
+ borderColor: 'rgba(127,127,127,0.35)',
76
+ borderRadius: 8,
77
+ padding: 12,
78
+ };
79
+ function DefaultPlaceholder({ height, messages, title, }) {
80
+ const [index, setIndex] = useState(0);
81
+ useEffect(() => {
82
+ if (messages.length < 2)
83
+ return;
84
+ const timer = setInterval(() => setIndex((value) => (value + 1) % messages.length), 1800);
85
+ return () => clearInterval(timer);
86
+ }, [messages.length]);
87
+ const line = messages[index % Math.max(1, messages.length)] ?? 'Building the view…';
88
+ return (_jsx(View, { testID: "sandbox-placeholder", accessibilityRole: "progressbar", accessibilityState: { busy: true }, style: [placeholderBox, { height }], children: _jsx(Text, { style: { color: 'rgba(90,90,90,0.9)', fontSize: 13 }, children: title !== undefined ? `${title} — ${line}` : line }) }));
89
+ }
90
+ function Note({ testID, title, text }) {
91
+ return (_jsxs(View, { testID: testID, style: [placeholderBox, { alignItems: 'flex-start' }], children: [title !== undefined ? _jsx(Text, { style: { fontWeight: '600' }, children: title }) : null, _jsx(Text, { children: text })] }));
92
+ }
93
+ /**
94
+ * A React Native renderer for the sandbox component (`Sandbox`): the model's HTML, CSS and JS in a
95
+ * hardened `react-native-webview` ({@link NATIVE_SANDBOX_WEBVIEW_PROPS}) — the same document as the
96
+ * web renderer's iframe (`buildSandboxDocument`, the same CSP: no network unless the policy lists an
97
+ * origin), sized to its content.
98
+ *
99
+ * It streams like the web one: a placeholder of `initialHeight`, a preview of the styled markup (no
100
+ * code runs), then the live view, whose code is posted in as it closes. The only bridge is the one
101
+ * the document carries: `ReactNativeWebView.postMessage` out (ready, resize, error, `agent.send`),
102
+ * `injectJavaScript` dispatching a `message` event in (render, run, theme, jsx). Everything the
103
+ * WebView says is checked as the web host checks it — length capped before parsing, the frame's
104
+ * token, size, interval and count limits, JSON only, `schema`, `confirm` — and an accepted
105
+ * `agent.send` is handed on as a `UiAction`.
106
+ *
107
+ * ```tsx
108
+ * <GenuiProvider registry={{ Sandbox: createNativeSandboxRenderer({ theme: () => useSandboxTheme() }) }} onAction={chat.sendUiAction}>
109
+ * ```
110
+ */
111
+ export function createNativeSandboxRenderer(options = {}) {
112
+ const themeOption = options.theme;
113
+ // Fixed per renderer, so the hook below is always (or never) called.
114
+ const useThemeOption = typeof themeOption === 'function'
115
+ ? themeOption
116
+ : () => (themeOption === false ? null : themeOption);
117
+ function NativeSandboxView(props) {
118
+ const node = useGenuiNode();
119
+ const provided = useGenuiProvider();
120
+ const contextAction = useContext(GenuiActionContext);
121
+ const definition = provided?.catalog?.get?.(node?.type ?? 'Sandbox');
122
+ const policy = useMemo(() => options.policy ?? sandboxPolicyOf(definition) ?? {}, [definition]);
123
+ const incomplete = node?.incomplete === true;
124
+ const client = useNativeSandboxConfig(options.config, options.baseUrl, options.fetch);
125
+ const view = definition?.sandboxView;
126
+ const themeOn = themeOption !== false && (client.config?.theme ?? view?.theme ?? true) !== false;
127
+ const themeInput = useThemeOption();
128
+ const themeKey = themeOn && themeInput ? JSON.stringify(themeInput) : '';
129
+ // biome-ignore lint/correctness/useExhaustiveDependencies: keyed on the theme's content
130
+ const theme = useMemo(() => (themeOn && themeInput ? nativeThemeCss(themeInput) : null), [themeKey]);
131
+ const jsxMode = typeof props.jsx === 'string';
132
+ const tailwindConfig = client.config?.tailwind;
133
+ const tailwindText = useNativeSandboxAsset(tailwindConfig !== undefined
134
+ ? { inline: tailwindConfig.runtime, url: tailwindConfig.url }
135
+ : undefined, options.baseUrl, options.fetch);
136
+ const cssConfig = client.config?.css;
137
+ const cssText = useNativeSandboxAsset(cssConfig !== undefined ? { inline: cssConfig.source, url: cssConfig.url } : undefined, options.baseUrl, options.fetch);
138
+ const kitConfig = client.config?.kit;
139
+ const kitText = useNativeSandboxAsset(jsxMode && kitConfig !== undefined
140
+ ? { inline: kitConfig.source, url: kitConfig.url }
141
+ : undefined, options.baseUrl, options.fetch);
142
+ const assetsPending = (tailwindConfig !== undefined && tailwindText === undefined) ||
143
+ (cssConfig !== undefined && cssText === undefined) ||
144
+ (jsxMode && (client.loading || kitText === undefined));
145
+ const themeRef = useRef(theme);
146
+ themeRef.current = theme;
147
+ // The server drops half-written code from what it previews (`sandboxPartialProps`); props
148
+ // from anywhere else may hold it, so their code waits for the whole view.
149
+ const trimmed = incomplete && node?.streamSafe === true;
150
+ const token = useMemo(sandboxToken, []);
151
+ const web = useRef(null);
152
+ const ready = useRef(false);
153
+ const ran = useRef({ functions: false, expressions: 0 });
154
+ const sends = useRef({ count: 0, last: 0 });
155
+ const initial = clampSandboxHeight(props.initialHeight ?? SANDBOX_DEFAULTS.initialHeight, policy);
156
+ const [measured, setMeasured] = useState(null);
157
+ const height = measured ?? initial;
158
+ const streamedIn = useRef(incomplete);
159
+ // The WebView left the inline document (it never should), or its process died too often.
160
+ const [lost, setLost] = useState(null);
161
+ const [generation, setGeneration] = useState(0);
162
+ const hasMarkup = typeof props.html === 'string' && props.html.length > 0;
163
+ const markupDone = !incomplete || props.jsFunctions !== undefined || props.jsExpressions !== undefined;
164
+ const hasJsx = jsxMode && props.jsx.trim().length > 0;
165
+ const phase = assetsPending
166
+ ? 'placeholder'
167
+ : jsxMode
168
+ ? !hasJsx
169
+ ? 'placeholder'
170
+ : incomplete
171
+ ? 'preview'
172
+ : 'live'
173
+ : !incomplete
174
+ ? 'live'
175
+ : markupDone && hasMarkup && trimmed
176
+ ? 'live'
177
+ : props.css !== undefined || hasMarkup
178
+ ? 'preview'
179
+ : 'placeholder';
180
+ const inlineJs = !streamedIn.current;
181
+ const css = props.css;
182
+ const html = props.html;
183
+ const kit = jsxMode && typeof kitText === 'string' ? kitText : undefined;
184
+ const documentPhase = jsxMode && phase !== 'placeholder' ? 'jsx' : phase;
185
+ // Built once per markup, like the web renderer's: code that arrives later is posted in.
186
+ // biome-ignore lint/correctness/useExhaustiveDependencies: rebuilt on the markup only
187
+ const documentHtml = useMemo(() => {
188
+ if (phase === 'placeholder')
189
+ return '';
190
+ const current = themeRef.current;
191
+ const look = {
192
+ ...(current !== null
193
+ ? { theme: { css: current.css, dark: current.dark, attributes: current.attributes } }
194
+ : {}),
195
+ ...(typeof cssText === 'string' ? { styles: cssText } : {}),
196
+ ...(typeof tailwindText === 'string'
197
+ ? {
198
+ tailwind: {
199
+ runtime: tailwindText,
200
+ theme: [current?.tailwind ?? '', tailwindConfig?.css ?? '']
201
+ .filter((part) => part !== '')
202
+ .join('\n'),
203
+ },
204
+ }
205
+ : {}),
206
+ };
207
+ const base = { token, hostOrigin: '', policy, transport: 'react-native', ...look };
208
+ if (jsxMode) {
209
+ return buildSandboxDocument({ css: css ?? '' }, { ...base, mode: 'live', inlineJs: false, ...(kit !== undefined ? { kit } : {}) });
210
+ }
211
+ return phase === 'preview'
212
+ ? buildSandboxDocument({}, { ...base, mode: 'preview' })
213
+ : buildSandboxDocument(props, { ...base, mode: 'live', inlineJs });
214
+ }, [
215
+ documentPhase,
216
+ token,
217
+ jsxMode ? '' : css,
218
+ html,
219
+ inlineJs,
220
+ policy,
221
+ tailwindText,
222
+ cssText,
223
+ kit,
224
+ ]);
225
+ const source = useMemo(() => ({ html: documentHtml, baseUrl: 'about:blank' }), [documentHtml]);
226
+ const post = useCallback((message) => {
227
+ web.current?.injectJavaScript(hostMessageScript({ ...message, token }));
228
+ }, [token]);
229
+ // biome-ignore lint/correctness/useExhaustiveDependencies: jsxMode only gates it off
230
+ const runPending = useCallback(() => {
231
+ if (!ready.current || inlineJs || phase !== 'live' || jsxMode)
232
+ return;
233
+ if (!trimmed && incomplete)
234
+ return;
235
+ const done = ran.current;
236
+ if (!done.functions && typeof props.jsFunctions === 'string') {
237
+ post({ type: SANDBOX_MESSAGE.run, code: props.jsFunctions });
238
+ done.functions = true;
239
+ }
240
+ if (!done.functions && incomplete && props.jsExpressions === undefined)
241
+ return;
242
+ const expressions = props.jsExpressions ?? [];
243
+ while (done.expressions < expressions.length) {
244
+ const code = expressions[done.expressions];
245
+ done.expressions += 1;
246
+ if (typeof code === 'string')
247
+ post({ type: SANDBOX_MESSAGE.run, code });
248
+ }
249
+ }, [inlineJs, phase, trimmed, incomplete, props.jsFunctions, props.jsExpressions, post]);
250
+ const preview = useCallback(() => {
251
+ if (!ready.current)
252
+ return;
253
+ if (jsxMode) {
254
+ if (phase !== 'placeholder')
255
+ post({ type: SANDBOX_MESSAGE.jsx, code: props.jsx ?? '', final: phase === 'live' });
256
+ return;
257
+ }
258
+ if (phase !== 'preview')
259
+ return;
260
+ post({ type: SANDBOX_MESSAGE.render, css: css ?? '', html: previewHtml(html ?? '') });
261
+ }, [jsxMode, phase, props.jsx, css, html, post]);
262
+ // The app's theme changed: the view follows, without reloading.
263
+ useEffect(() => {
264
+ if (theme === null || !ready.current)
265
+ return;
266
+ post({
267
+ type: SANDBOX_MESSAGE.theme,
268
+ css: theme.css,
269
+ dark: theme.dark,
270
+ attributes: theme.attributes,
271
+ });
272
+ }, [theme, post]);
273
+ // biome-ignore lint/correctness/useExhaustiveDependencies: a new document starts from nothing
274
+ useEffect(() => {
275
+ ready.current = false;
276
+ ran.current = { functions: false, expressions: 0 };
277
+ }, [documentHtml, generation]);
278
+ useEffect(() => {
279
+ preview();
280
+ runPending();
281
+ }, [preview, runPending]);
282
+ const onAction = options.onAction ?? contextAction;
283
+ const title = props.title;
284
+ const nodeId = node?.id;
285
+ const send = useCallback(async (payload) => {
286
+ const result = await checkSandboxSend({
287
+ payload,
288
+ state: sends.current,
289
+ policy,
290
+ incomplete,
291
+ ...(options.schema !== undefined ? { schema: options.schema } : {}),
292
+ ...(options.confirm !== undefined ? { confirm: options.confirm } : {}),
293
+ hasHandler: onAction !== null && onAction !== undefined,
294
+ ...(nodeId !== undefined ? { componentId: nodeId } : {}),
295
+ ...(title !== undefined ? { title } : {}),
296
+ });
297
+ if (!result.ok)
298
+ return options.onRefused?.(result.refusal);
299
+ onAction?.(result.action);
300
+ }, [policy, nodeId, title, onAction, incomplete]);
301
+ const limit = policy.maxPayloadBytes ?? SANDBOX_DEFAULTS.maxPayloadBytes;
302
+ const onMessage = useCallback((event) => {
303
+ const native = event.nativeEvent;
304
+ // Only the inline document speaks for the sandbox (it cannot navigate; this is the backstop).
305
+ if (isForeignUrl(native.url))
306
+ return;
307
+ const message = parseFrameMessage(native.data, token, limit);
308
+ if (message.kind === 'too-large') {
309
+ options.onRefused?.({ reason: 'too-large', bytes: message.bytes, limit });
310
+ return;
311
+ }
312
+ if (message.kind === 'drop')
313
+ return;
314
+ const data = message.data;
315
+ switch (data.type) {
316
+ case SANDBOX_MESSAGE.ready:
317
+ ready.current = true;
318
+ if (typeof data.height === 'number' && Number.isFinite(data.height) && data.height > 0)
319
+ setMeasured(clampSandboxHeight(data.height, policy));
320
+ if (themeRef.current !== null)
321
+ post({
322
+ type: SANDBOX_MESSAGE.theme,
323
+ css: themeRef.current.css,
324
+ dark: themeRef.current.dark,
325
+ attributes: themeRef.current.attributes,
326
+ });
327
+ preview();
328
+ runPending();
329
+ return;
330
+ case SANDBOX_MESSAGE.resize:
331
+ if (typeof data.height === 'number' && Number.isFinite(data.height))
332
+ setMeasured(clampSandboxHeight(data.height, policy));
333
+ return;
334
+ case SANDBOX_MESSAGE.send:
335
+ void send(data.payload);
336
+ return;
337
+ case SANDBOX_MESSAGE.error:
338
+ options.onError?.(typeof data.message === 'string' ? data.message.slice(0, 500) : 'error');
339
+ return;
340
+ }
341
+ }, [token, limit, policy, post, preview, runPending, send]);
342
+ const onNavigation = useCallback((navigation) => {
343
+ if (!isForeignUrl(navigation.url))
344
+ return;
345
+ setLost('navigated');
346
+ options.onError?.('The view tried to leave the sandbox.');
347
+ }, []);
348
+ // Handled (Android crashes the app on a render process gone that nobody handles): draw afresh.
349
+ const restarts = useRef(0);
350
+ const onProcessGone = useCallback(() => {
351
+ if (restarts.current >= MAX_RESTARTS) {
352
+ setLost('crashed');
353
+ options.onError?.('The view stopped working.');
354
+ return;
355
+ }
356
+ restarts.current += 1;
357
+ setGeneration((value) => value + 1);
358
+ }, []);
359
+ const messages = (props.placeholderMessages ?? []).filter((line) => typeof line === 'string');
360
+ if (lost !== null) {
361
+ return (_jsx(Note, { testID: "sandbox-lost", ...(title !== undefined ? { title } : {}), text: props.summary ?? 'This interactive view is unavailable.' }));
362
+ }
363
+ if (jsxMode && kitText === null && !assetsPending) {
364
+ return (_jsx(Note, { testID: "sandbox-no-kit", ...(title !== undefined ? { title } : {}), text: props.summary ?? "An interactive view that needs the app's components." }));
365
+ }
366
+ if (phase === 'placeholder') {
367
+ const state = { height: initial, messages, ...(title !== undefined ? { title } : {}) };
368
+ return (_jsx(_Fragment, { children: options.placeholder ? options.placeholder(state) : _jsx(DefaultPlaceholder, { ...state }) }));
369
+ }
370
+ return (_createElement(SandboxWebView, { ...NATIVE_SANDBOX_WEBVIEW_PROPS, ref: web, key: `${documentPhase}:${generation}`, testID: "sandbox-frame", accessibilityLabel: title ?? 'Interactive view', source: source, onMessage: onMessage, onNavigationStateChange: onNavigation, onRenderProcessGone: onProcessGone, onContentProcessDidTerminate: onProcessGone, style: [{ width: '100%', height, backgroundColor: 'transparent' }, options.style] }));
371
+ }
372
+ return NativeSandboxView;
373
+ }
374
+ /** The native sandbox renderer with its defaults (theme from nothing, no Tailwind, no kit). */
375
+ export const NativeSandboxView = createNativeSandboxRenderer();
376
+ //# sourceMappingURL=sandbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../../../../src/react-native/genui/sandbox.tsx"],"names":[],"mappings":";;AACA,OAAO,EAIL,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAkB,IAAI,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;AAC1E,OAAO,EACL,OAAO,GAIR,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,gBAAgB,EAChB,eAAe,EAGf,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,GACjB,MAAM,yCAAyC,CAAC;AAGjD,OAAO,EAGL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EAEjB,cAAc,EACd,iBAAiB,EAEjB,YAAY,EACZ,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AA6C3B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAA2B,MAAM,CAAC,MAAM,CAAC;IAChF,wEAAwE;IACxE,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAwB;IAC5D,4BAA4B,EAAE,sBAAsB;IACpD,iBAAiB,EAAE,IAAI;IACvB,qCAAqC,EAAE,KAAK;IAC5C,yBAAyB,EAAE,KAAK;IAChC,iBAAiB,EAAE,KAAK;IACxB,eAAe,EAAE,KAAK;IACtB,2BAA2B,EAAE,KAAK;IAClC,gCAAgC,EAAE,KAAK;IACvC,iBAAiB,EAAE,KAAK;IACxB,SAAS,EAAE,IAAI;IACf,YAAY,EAAE,KAAK;IACnB,SAAS,EAAE,eAAe;IAC1B,gBAA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AC,EAAE,CAAC;YACvF,OAAO,CACL,4BAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAC,kBAAkB,OAAK,KAAK,GAAI,GAAI,CAC5F,CAAC;QACJ,CAAC;QACD,OAAO,CACL,eAAC,cAAc,OACT,4BAA4B,EAChC,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,aAAa,IAAI,UAAU,EAAE,EACrC,MAAM,EAAC,eAAe,EACtB,kBAAkB,EAAE,KAAK,IAAI,kBAAkB,EAC/C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,uBAAuB,EAAE,YAAY,EACrC,mBAAmB,EAAE,aAAa,EAClC,4BAA4B,EAAE,aAAa,EAC3C,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,GACjF,CACH,CAAC;IACJ,CAAC;IACD,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED,+FAA+F;AAC/F,MAAM,CAAC,MAAM,iBAAiB,GAAgC,2BAA2B,EAAE,CAAC"}
@@ -1,23 +1,26 @@
1
1
  /**
2
2
  * `@adonis-agora/agent/vite` — `genuiSandboxKit()`, the Vite plugin that puts the app's design
3
- * system (its components, its theme, Tailwind) inside the sandbox:
3
+ * system (its styles, its components, its providers) inside the sandbox, whatever the stack:
4
4
  *
5
5
  * ```ts
6
6
  * // vite.config.ts
7
7
  * import { genuiSandboxKit } from '@adonis-agora/agent/vite'
8
- * export default defineConfig({ plugins: [react(), adonisjs({ … }), genuiSandboxKit({ include: 'inertia/components/ui/*.tsx' })] })
8
+ * export default defineConfig({
9
+ * plugins: [react(), adonisjs({ … }), genuiSandboxKit({ styles: 'resources/css/app.css', components: 'inertia/components/ui' })],
10
+ * })
9
11
  * ```
10
12
  *
11
- * Then `genui({ sandbox: { kit: true, tailwind: true } })` in `config/agent.ts` finds the bundle and
12
- * the docs through Vite (the dev server in dev, the manifest in production).
13
+ * Then `genui({ sandbox: { kit: true } })` in `config/agent.ts` finds what it built through Vite
14
+ * (the dev server in dev, the manifest in production).
13
15
  */
14
16
  import { type GenuiSandboxKitApi, type GenuiSandboxKitOptions, type GenuiSandboxKitPlugin, SANDBOX_KIT_DEV_PREFIX, SANDBOX_KIT_MANIFEST_KEYS, SANDBOX_KIT_UPDATE_EVENT } from '../genui/kit/plugin.js';
15
17
  /** Where the dev descriptor is written in an Adonis app (`.adonisjs` is ignored by git already). */
16
18
  export declare const ADONIS_SANDBOX_KIT_DESCRIPTOR = ".adonisjs/agent/genui_sandbox_kit.json";
17
19
  /**
18
- * The sandbox kit plugin. `entry` (a module exporting the kit) or `include` (a glob of component
19
- * files); neither → the first `components/ui` folder (`inertia/components/ui`…). See
20
- * {@link GenuiSandboxKitOptions}.
20
+ * The sandbox kit plugin: `styles` (the app's style entries — default, the stylesheets among its
21
+ * Vite entrypoints), `components` (modules or globs exporting React components — default, the
22
+ * first `components/ui` folder), `wrapper` (a module whose default export wraps the model's App).
23
+ * See {@link GenuiSandboxKitOptions}.
21
24
  */
22
25
  export declare function genuiSandboxKit(options?: GenuiSandboxKitOptions): GenuiSandboxKitPlugin;
23
26
  export { type GenuiSandboxKitApi, type GenuiSandboxKitOptions, type GenuiSandboxKitPlugin, SANDBOX_KIT_DEV_PREFIX, SANDBOX_KIT_MANIFEST_KEYS, SANDBOX_KIT_UPDATE_EVENT, };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vite/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAEhC,oGAAoG;AACpG,eAAO,MAAM,6BAA6B,2CAA2C,CAAC;AAEtF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,qBAAqB,CAK3F;AAED,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,GACzB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vite/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAEhC,oGAAoG;AACpG,eAAO,MAAM,6BAA6B,2CAA2C,CAAC;AAEtF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,qBAAqB,CAK3F;AAED,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,GACzB,CAAC"}
@@ -1,23 +1,26 @@
1
1
  /**
2
2
  * `@adonis-agora/agent/vite` — `genuiSandboxKit()`, the Vite plugin that puts the app's design
3
- * system (its components, its theme, Tailwind) inside the sandbox:
3
+ * system (its styles, its components, its providers) inside the sandbox, whatever the stack:
4
4
  *
5
5
  * ```ts
6
6
  * // vite.config.ts
7
7
  * import { genuiSandboxKit } from '@adonis-agora/agent/vite'
8
- * export default defineConfig({ plugins: [react(), adonisjs({ … }), genuiSandboxKit({ include: 'inertia/components/ui/*.tsx' })] })
8
+ * export default defineConfig({
9
+ * plugins: [react(), adonisjs({ … }), genuiSandboxKit({ styles: 'resources/css/app.css', components: 'inertia/components/ui' })],
10
+ * })
9
11
  * ```
10
12
  *
11
- * Then `genui({ sandbox: { kit: true, tailwind: true } })` in `config/agent.ts` finds the bundle and
12
- * the docs through Vite (the dev server in dev, the manifest in production).
13
+ * Then `genui({ sandbox: { kit: true } })` in `config/agent.ts` finds what it built through Vite
14
+ * (the dev server in dev, the manifest in production).
13
15
  */
14
16
  import { createGenuiSandboxKitPlugin, SANDBOX_KIT_DEV_PREFIX, SANDBOX_KIT_MANIFEST_KEYS, SANDBOX_KIT_UPDATE_EVENT, } from '../genui/kit/plugin.js';
15
17
  /** Where the dev descriptor is written in an Adonis app (`.adonisjs` is ignored by git already). */
16
18
  export const ADONIS_SANDBOX_KIT_DESCRIPTOR = '.adonisjs/agent/genui_sandbox_kit.json';
17
19
  /**
18
- * The sandbox kit plugin. `entry` (a module exporting the kit) or `include` (a glob of component
19
- * files); neither → the first `components/ui` folder (`inertia/components/ui`…). See
20
- * {@link GenuiSandboxKitOptions}.
20
+ * The sandbox kit plugin: `styles` (the app's style entries — default, the stylesheets among its
21
+ * Vite entrypoints), `components` (modules or globs exporting React components — default, the
22
+ * first `components/ui` folder), `wrapper` (a module whose default export wraps the model's App).
23
+ * See {@link GenuiSandboxKitOptions}.
21
24
  */
22
25
  export function genuiSandboxKit(options = {}) {
23
26
  return createGenuiSandboxKitPlugin(options, {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/vite/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,2BAA2B,EAI3B,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAEhC,oGAAoG;AACpG,MAAM,CAAC,MAAM,6BAA6B,GAAG,wCAAwC,CAAC;AAEtF;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,OAAO,GAA2B,EAAE;IAClE,OAAO,2BAA2B,CAAC,OAAO,EAAE;QAC1C,UAAU,EAAE,6BAA6B;QACzC,cAAc,EAAE,6BAA6B;KAC9C,CAAC,CAAC;AACL,CAAC;AAED,OAAO,EAIL,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,GACzB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/vite/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,2BAA2B,EAI3B,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAEhC,oGAAoG;AACpG,MAAM,CAAC,MAAM,6BAA6B,GAAG,wCAAwC,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,OAAO,GAA2B,EAAE;IAClE,OAAO,2BAA2B,CAAC,OAAO,EAAE;QAC1C,UAAU,EAAE,6BAA6B;QACzC,cAAc,EAAE,6BAA6B;KAC9C,CAAC,CAAC;AACL,CAAC;AAED,OAAO,EAIL,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,GACzB,CAAC"}