@copilotkit/react-core 2.0.0-rc.43 → 2.0.0-rc.44

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 (65) hide show
  1. package/dist/{MarkdownRendererContext-C2J_lgqF.d.cts → MarkdownRendererContext-QFCldfW_.d.cts} +1 -1
  2. package/dist/{MarkdownRendererContext-C2J_lgqF.d.cts.map → MarkdownRendererContext-QFCldfW_.d.cts.map} +1 -1
  3. package/dist/{MarkdownRendererContext-CytkPOAJ.d.mts → MarkdownRendererContext-aK63ZFd-.d.mts} +1 -1
  4. package/dist/{MarkdownRendererContext-CytkPOAJ.d.mts.map → MarkdownRendererContext-aK63ZFd-.d.mts.map} +1 -1
  5. package/dist/{MarkdownSurfaces-DytbRzj2.cjs → MarkdownSurfaces-Do948N1P.cjs} +2 -2
  6. package/dist/{MarkdownSurfaces-DytbRzj2.cjs.map → MarkdownSurfaces-Do948N1P.cjs.map} +1 -1
  7. package/dist/{MarkdownSurfaces-DlYqJkAE.mjs → MarkdownSurfaces-rtE9wRUP.mjs} +2 -2
  8. package/dist/{MarkdownSurfaces-DlYqJkAE.mjs.map → MarkdownSurfaces-rtE9wRUP.mjs.map} +1 -1
  9. package/dist/{ProviderMarkdown-i_i2osOH.cjs → ProviderMarkdown-D0eI0aPo.cjs} +23 -1
  10. package/dist/ProviderMarkdown-D0eI0aPo.cjs.map +1 -0
  11. package/dist/{ProviderMarkdown-BZaPDROY.mjs → ProviderMarkdown-epL7F3Vt.mjs} +19 -3
  12. package/dist/ProviderMarkdown-epL7F3Vt.mjs.map +1 -0
  13. package/dist/accessibility-BLK-gE0R.mjs.map +1 -1
  14. package/dist/accessibility-GnodqxkH.cjs.map +1 -1
  15. package/dist/chat-BZ_bvAkg.d.mts +38 -0
  16. package/dist/chat-BZ_bvAkg.d.mts.map +1 -0
  17. package/dist/chat-CpZVyF_t.d.cts +38 -0
  18. package/dist/chat-CpZVyF_t.d.cts.map +1 -0
  19. package/dist/generative-ui/map.cjs +26 -0
  20. package/dist/generative-ui/map.cjs.map +1 -0
  21. package/dist/generative-ui/map.d.cts +23 -0
  22. package/dist/generative-ui/map.d.cts.map +1 -0
  23. package/dist/generative-ui/map.d.mts +23 -0
  24. package/dist/generative-ui/map.d.mts.map +1 -0
  25. package/dist/generative-ui/map.mjs +24 -0
  26. package/dist/generative-ui/map.mjs.map +1 -0
  27. package/dist/generative-ui/native.d.cts +3 -2
  28. package/dist/generative-ui/native.d.cts.map +1 -1
  29. package/dist/generative-ui/native.d.mts +3 -2
  30. package/dist/generative-ui/native.d.mts.map +1 -1
  31. package/dist/generative-ui.cjs +2 -2
  32. package/dist/generative-ui.d.cts +5 -4
  33. package/dist/generative-ui.d.cts.map +1 -1
  34. package/dist/generative-ui.d.mts +5 -4
  35. package/dist/generative-ui.d.mts.map +1 -1
  36. package/dist/generative-ui.mjs +2 -2
  37. package/dist/{hooks-DqsOIh8A.d.mts → hooks-D2H3iL0N.d.mts} +2 -2
  38. package/dist/{hooks-DqsOIh8A.d.mts.map → hooks-D2H3iL0N.d.mts.map} +1 -1
  39. package/dist/{hooks-2Ur8NQhj.d.cts → hooks-Dy8HeEdr.d.cts} +2 -2
  40. package/dist/{hooks-2Ur8NQhj.d.cts.map → hooks-Dy8HeEdr.d.cts.map} +1 -1
  41. package/dist/index.cjs +12 -26
  42. package/dist/index.cjs.map +1 -1
  43. package/dist/index.d.cts +4 -3
  44. package/dist/index.d.cts.map +1 -1
  45. package/dist/index.d.mts +4 -3
  46. package/dist/index.d.mts.map +1 -1
  47. package/dist/index.mjs +11 -25
  48. package/dist/index.mjs.map +1 -1
  49. package/dist/index.umd.js +44 -21
  50. package/dist/index.umd.js.map +1 -1
  51. package/dist/{chat-C5XWeO1M.d.mts → runtime-context-B7f4M85q.d.mts} +21 -39
  52. package/dist/runtime-context-B7f4M85q.d.mts.map +1 -0
  53. package/dist/{chat-DtHs4alO.d.cts → runtime-context-CIkZS0ap.d.cts} +21 -39
  54. package/dist/runtime-context-CIkZS0ap.d.cts.map +1 -0
  55. package/dist/{standard-s8jByRiE.mjs → standard-CSBR4FhM.mjs} +31 -15
  56. package/dist/standard-CSBR4FhM.mjs.map +1 -0
  57. package/dist/{standard-CqGTZUZy.cjs → standard-DBjcBGyd.cjs} +31 -15
  58. package/dist/standard-DBjcBGyd.cjs.map +1 -0
  59. package/package.json +14 -7
  60. package/dist/ProviderMarkdown-BZaPDROY.mjs.map +0 -1
  61. package/dist/ProviderMarkdown-i_i2osOH.cjs.map +0 -1
  62. package/dist/chat-C5XWeO1M.d.mts.map +0 -1
  63. package/dist/chat-DtHs4alO.d.cts.map +0 -1
  64. package/dist/standard-CqGTZUZy.cjs.map +0 -1
  65. package/dist/standard-s8jByRiE.mjs.map +0 -1
@@ -1,8 +1,6 @@
1
- import { ActivityMessageRenderProps, ActivityMessageRendererDef } from "@copilotkit/core";
2
1
  import * as react from "react";
3
- import React, { ComponentType, ReactNode } from "react";
4
- import * as react_jsx_runtime0 from "react/jsx-runtime";
5
- import { GenerativeUIRejectedOperation, GenerativeUISurfaceContent, GenerativeUIUserEvent } from "@copilotkit/shared";
2
+ import { ComponentType, ReactNode } from "react";
3
+ import { GenerativeUIUserEvent } from "@copilotkit/shared";
6
4
  import { GenerativeUIAccessibility, GenerativeUIAriaAttributes, GenerativeUIAriaAttributes as GenerativeUIAriaAttributes$1, GenerativeUIDispatcher, GenerativeUISurfaceManager } from "@copilotkit/core/generative-ui";
7
5
  import { AnyGenerativeUI, CreateGenerativeUIConfig, GenerativeUI, GenerativeUIBasesDefinitions, GenerativeUIComponentDefinition, GenerativeUIComponentName, GenerativeUIComponentProps, GenerativeUIDefinitions, GenerativeUIDefinitionsOf, GenerativeUIErrorInfo, GenerativeUIEventDefinition, GenerativeUIFunctionArgs, GenerativeUIFunctionDefinition, GenerativeUIFunctionDefinition as GenerativeUIFunctionDefinition$1, GenerativeUIFunctionInput, GenerativeUIFunctionName, GenerativeUIInvokeResult, GenerativeUIResultDefinitions, GenerativeUISchema, GenerativeUISlotKind, GenerativeUIStateOf, GenerativeUITheme } from "@copilotkit/shared/generative-ui";
8
6
 
@@ -119,9 +117,11 @@ interface GenerativeUIErrorBoundaryConfig {
119
117
  interface GenerativeUIBaseConfig {
120
118
  /**
121
119
  * The result of `createGenerativeUI`: the components the model can render,
122
- * the app state they read and the functions they call.
120
+ * the app state they read and the functions they call. Leave it out to
121
+ * use `standardUI` when the runtime turns generative UI on; the other
122
+ * options (such as `map` or `theme`) still apply.
123
123
  */
124
- ui: GenerativeUI$1;
124
+ ui?: GenerativeUI$1;
125
125
  /**
126
126
  * The agents that get the generative UI. When omitted, every agent gets
127
127
  * it. Other agents get no envelope.
@@ -134,9 +134,22 @@ interface GenerativeUIBaseConfig {
134
134
  * Native ignores it.
135
135
  */
136
136
  theme?: GenerativeUITheme;
137
+ /**
138
+ * Web only. Loads `maplibre-gl` for the standard `Map` component. Pass
139
+ * `loadMapLibre` from `@copilotkit/react-core/generative-ui/map` and
140
+ * install `maplibre-gl`. Without it, Map shows its markers as a list, and
141
+ * the app builds without `maplibre-gl`. React Native ignores it.
142
+ */
143
+ map?: GenerativeUILibraryLoader;
137
144
  /** Fallback UI and error reporting for generated UI. */
138
145
  errorBoundary?: GenerativeUIErrorBoundaryConfig;
139
146
  }
147
+ /**
148
+ * Loads an optional library for a standard component, such as
149
+ * `loadMapLibre` from `@copilotkit/react-core/generative-ui/map`. The
150
+ * library stays out of apps that do not pass a loader.
151
+ */
152
+ type GenerativeUILibraryLoader = () => Promise<unknown>;
140
153
  /**
141
154
  * The tool transport: the model calls the `render_ui` tool, and the runtime
142
155
  * validates each operation before it streams it to the client.
@@ -198,36 +211,5 @@ declare const GenerativeUIRuntimeContext: react.Context<GenerativeUIRuntime | nu
198
211
  declare function useGenerativeUIRuntime(): GenerativeUIRuntime | null;
199
212
  declare function useRequiredGenerativeUIRuntime(): GenerativeUIRuntime;
200
213
  //#endregion
201
- //#region src/types/react-activity-message-renderer.d.ts
202
- /**
203
- * An activity message renderer for React: a React component that draws
204
- * activity messages of one `activityType` (or `"*"` for any type). The
205
- * component receives {@link ActivityMessageRenderProps}.
206
- *
207
- * @typeParam TActivityContent - The shape of the activity content.
208
- */
209
- type ReactActivityMessageRenderer<TActivityContent> = ActivityMessageRendererDef<TActivityContent, React.ComponentType<ActivityMessageRenderProps<TActivityContent>>>;
210
- //#endregion
211
- //#region src/generative-ui/chat.d.ts
212
- interface GenerativeUIChatSurfaceProps {
213
- surfaceId: string;
214
- isStreaming: boolean;
215
- /**
216
- * Set when operations from the latest render_ui call were rejected. The
217
- * message is user-facing; `error.cause` holds the same list as `rejected`.
218
- */
219
- error?: Error;
220
- /** Rejected operations from the latest render_ui call, with validator reasons. */
221
- rejected: GenerativeUIRejectedOperation[];
222
- children: ReactNode;
223
- }
224
- declare function DefaultGenerativeUIChatCard({
225
- surfaceId,
226
- error,
227
- children
228
- }: GenerativeUIChatSurfaceProps): react_jsx_runtime0.JSX.Element;
229
- /** Hides the raw `render_ui` tool call; the surface activity owns the UX. */
230
- declare function GenerativeUIToolCallRenderer(): null;
231
- //#endregion
232
- export { createGenerativeUI$1 as A, GenerativeUIEventDefinition as C, GenerativeUIFunctionName as D, GenerativeUIFunctionInput as E, GenerativeUISlotKind as O, GenerativeUIDefinitionsOf as S, GenerativeUIFunctionDefinition$1 as T, CreateGenerativeUIConfig$1 as _, GenerativeUIConfig as a, GenerativeUIComponentName as b, GenerativeUIRuntime as c, GenerativeUIToolConfig as d, useGenerativeUIRuntime as f, useGenerativeUIAccessibility as g, GenerativeUIAriaAttributes$1 as h, ReactActivityMessageRenderer as i, GenerativeUIStateOf as k, GenerativeUIRuntimeContext as l, GenerativeUIAccessibility as m, GenerativeUIChatSurfaceProps as n, GenerativeUIErrorBoundaryConfig as o, useRequiredGenerativeUIRuntime as p, GenerativeUIToolCallRenderer as r, GenerativeUIMarkdownConfig as s, DefaultGenerativeUIChatCard as t, GenerativeUITheme as u, GenerativeUI$1 as v, GenerativeUIFunctionArgs as w, GenerativeUIComponentProps$1 as x, GenerativeUIComponentDefinition$1 as y };
233
- //# sourceMappingURL=chat-C5XWeO1M.d.mts.map
214
+ export { GenerativeUIFunctionInput as C, createGenerativeUI$1 as D, GenerativeUIStateOf as E, GenerativeUIFunctionDefinition$1 as S, GenerativeUISlotKind as T, GenerativeUIComponentName as _, GenerativeUIRuntime as a, GenerativeUIEventDefinition as b, GenerativeUIToolConfig as c, GenerativeUIAccessibility as d, GenerativeUIAriaAttributes$1 as f, GenerativeUIComponentDefinition$1 as g, GenerativeUI$1 as h, GenerativeUIMarkdownConfig as i, useGenerativeUIRuntime as l, CreateGenerativeUIConfig$1 as m, GenerativeUIErrorBoundaryConfig as n, GenerativeUIRuntimeContext as o, useGenerativeUIAccessibility as p, GenerativeUILibraryLoader as r, GenerativeUITheme as s, GenerativeUIConfig as t, useRequiredGenerativeUIRuntime as u, GenerativeUIComponentProps$1 as v, GenerativeUIFunctionName as w, GenerativeUIFunctionArgs as x, GenerativeUIDefinitionsOf as y };
215
+ //# sourceMappingURL=runtime-context-B7f4M85q.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-context-B7f4M85q.d.mts","names":[],"sources":["../src/generative-ui/catalog.ts","../src/generative-ui/accessibility.ts","../src/generative-ui/runtime-context.ts"],"mappings":";;;;;;;;KA2CY,iCAAA,GACV,+BAAA,CAAsC,aAAA;;;;;AAYxC;KAAY,cAAA,qBACU,uBAAA,GAA0B,uBAAA,IAC5C,YAAA,CAAmB,WAAA,EAAa,aAAA;;;;;;;;KASxB,4BAAA,YACC,eAAA,qBACQ,WAAA,CAAY,EAAA,2CAC7B,0BAAA,CAAiC,EAAA,EAAI,IAAA,EAAM,SAAA;;KAG1C,eAAA,wBAAuC,eAAA,uBAC3B,4BAAA,CAA6B,KAAA;EAC1C,SAAA,EAAW,aAAA,CACT,4BAAA,CAA6B,KAAA,oCAC3B,uBAAA,GACE,4BAAA,CAA2B,cAAA,CAAa,WAAA,GAAc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A;EACA,cAAA;AAAA;;;;;UAOe,0BAAA,SAAmC,sBAAA;EAClD,SAAA;EFlBkE;AAOpE;;;;EEiBE,WAAA;EFfc;;;;EEoBd,cAAA;AAAA;;;;;;;;;;;KAaU,kBAAA,GACR,sBAAA,GACA,0BAAA;AAAA,UAEa,mBAAA;EACf,OAAA,EAAS,0BAAA;EACT,UAAA,EAAY,sBAAA;EFxCW;EE0CvB,EAAA,EAAI,cAAA;EFzCU;EE2Cd,SAAA;EF1CA;EAAA,SE4CS,MAAA,EAAQ,kBAAA;EF5CgB;;;;EEiDjC,KAAA,GAAQ,iBAAA;EACR,YAAA,GACE,KAAA,EAAO,qBAAA,EACP,OAAA,yBACG,OAAA,CAAQ,wBAAA;EACb,WAAA,GAAc,IAAA,EAAM,qBAAA;EAAA,SACX,aAAA,GAAgB,+BAAA;AAAA;AAAA,cAGd,0BAAA,EAA0B,KAAA,CAAA,OAAA,CAAA,mBAAA;AAAA,iBAGvB,sBAAA,CAAA,GAA0B,mBAAA;AAAA,iBAI1B,8BAAA,CAAA,GAAkC,mBAAA"}
@@ -1,10 +1,8 @@
1
1
  import * as react from "react";
2
- import React, { ComponentType, ReactNode } from "react";
2
+ import { ComponentType, ReactNode } from "react";
3
3
  import { AnyGenerativeUI, CreateGenerativeUIConfig, GenerativeUI, GenerativeUIBasesDefinitions, GenerativeUIComponentDefinition, GenerativeUIComponentName, GenerativeUIComponentProps, GenerativeUIDefinitions, GenerativeUIDefinitionsOf, GenerativeUIErrorInfo, GenerativeUIEventDefinition, GenerativeUIFunctionArgs, GenerativeUIFunctionDefinition, GenerativeUIFunctionDefinition as GenerativeUIFunctionDefinition$1, GenerativeUIFunctionInput, GenerativeUIFunctionName, GenerativeUIInvokeResult, GenerativeUIResultDefinitions, GenerativeUISchema, GenerativeUISlotKind, GenerativeUIStateOf, GenerativeUITheme } from "@copilotkit/shared/generative-ui";
4
4
  import { GenerativeUIAccessibility, GenerativeUIAriaAttributes, GenerativeUIAriaAttributes as GenerativeUIAriaAttributes$1, GenerativeUIDispatcher, GenerativeUISurfaceManager } from "@copilotkit/core/generative-ui";
5
- import { GenerativeUIRejectedOperation, GenerativeUISurfaceContent, GenerativeUIUserEvent } from "@copilotkit/shared";
6
- import * as react_jsx_runtime0 from "react/jsx-runtime";
7
- import { ActivityMessageRenderProps, ActivityMessageRendererDef } from "@copilotkit/core";
5
+ import { GenerativeUIUserEvent } from "@copilotkit/shared";
8
6
 
9
7
  //#region src/generative-ui/catalog.d.ts
10
8
  /** One component of a generative UI, as the renderer reads it. */
@@ -119,9 +117,11 @@ interface GenerativeUIErrorBoundaryConfig {
119
117
  interface GenerativeUIBaseConfig {
120
118
  /**
121
119
  * The result of `createGenerativeUI`: the components the model can render,
122
- * the app state they read and the functions they call.
120
+ * the app state they read and the functions they call. Leave it out to
121
+ * use `standardUI` when the runtime turns generative UI on; the other
122
+ * options (such as `map` or `theme`) still apply.
123
123
  */
124
- ui: GenerativeUI$1;
124
+ ui?: GenerativeUI$1;
125
125
  /**
126
126
  * The agents that get the generative UI. When omitted, every agent gets
127
127
  * it. Other agents get no envelope.
@@ -134,9 +134,22 @@ interface GenerativeUIBaseConfig {
134
134
  * Native ignores it.
135
135
  */
136
136
  theme?: GenerativeUITheme;
137
+ /**
138
+ * Web only. Loads `maplibre-gl` for the standard `Map` component. Pass
139
+ * `loadMapLibre` from `@copilotkit/react-core/generative-ui/map` and
140
+ * install `maplibre-gl`. Without it, Map shows its markers as a list, and
141
+ * the app builds without `maplibre-gl`. React Native ignores it.
142
+ */
143
+ map?: GenerativeUILibraryLoader;
137
144
  /** Fallback UI and error reporting for generated UI. */
138
145
  errorBoundary?: GenerativeUIErrorBoundaryConfig;
139
146
  }
147
+ /**
148
+ * Loads an optional library for a standard component, such as
149
+ * `loadMapLibre` from `@copilotkit/react-core/generative-ui/map`. The
150
+ * library stays out of apps that do not pass a loader.
151
+ */
152
+ type GenerativeUILibraryLoader = () => Promise<unknown>;
140
153
  /**
141
154
  * The tool transport: the model calls the `render_ui` tool, and the runtime
142
155
  * validates each operation before it streams it to the client.
@@ -198,36 +211,5 @@ declare const GenerativeUIRuntimeContext: react.Context<GenerativeUIRuntime | nu
198
211
  declare function useGenerativeUIRuntime(): GenerativeUIRuntime | null;
199
212
  declare function useRequiredGenerativeUIRuntime(): GenerativeUIRuntime;
200
213
  //#endregion
201
- //#region src/types/react-activity-message-renderer.d.ts
202
- /**
203
- * An activity message renderer for React: a React component that draws
204
- * activity messages of one `activityType` (or `"*"` for any type). The
205
- * component receives {@link ActivityMessageRenderProps}.
206
- *
207
- * @typeParam TActivityContent - The shape of the activity content.
208
- */
209
- type ReactActivityMessageRenderer<TActivityContent> = ActivityMessageRendererDef<TActivityContent, React.ComponentType<ActivityMessageRenderProps<TActivityContent>>>;
210
- //#endregion
211
- //#region src/generative-ui/chat.d.ts
212
- interface GenerativeUIChatSurfaceProps {
213
- surfaceId: string;
214
- isStreaming: boolean;
215
- /**
216
- * Set when operations from the latest render_ui call were rejected. The
217
- * message is user-facing; `error.cause` holds the same list as `rejected`.
218
- */
219
- error?: Error;
220
- /** Rejected operations from the latest render_ui call, with validator reasons. */
221
- rejected: GenerativeUIRejectedOperation[];
222
- children: ReactNode;
223
- }
224
- declare function DefaultGenerativeUIChatCard({
225
- surfaceId,
226
- error,
227
- children
228
- }: GenerativeUIChatSurfaceProps): react_jsx_runtime0.JSX.Element;
229
- /** Hides the raw `render_ui` tool call; the surface activity owns the UX. */
230
- declare function GenerativeUIToolCallRenderer(): null;
231
- //#endregion
232
- export { createGenerativeUI as A, GenerativeUIEventDefinition as C, GenerativeUIFunctionName as D, GenerativeUIFunctionInput as E, GenerativeUISlotKind as O, GenerativeUIDefinitionsOf as S, GenerativeUIFunctionDefinition$1 as T, CreateGenerativeUIConfig$1 as _, GenerativeUIConfig as a, GenerativeUIComponentName as b, GenerativeUIRuntime as c, GenerativeUIToolConfig as d, useGenerativeUIRuntime as f, useGenerativeUIAccessibility as g, GenerativeUIAriaAttributes$1 as h, ReactActivityMessageRenderer as i, GenerativeUIStateOf as k, GenerativeUIRuntimeContext as l, GenerativeUIAccessibility as m, GenerativeUIChatSurfaceProps as n, GenerativeUIErrorBoundaryConfig as o, useRequiredGenerativeUIRuntime as p, GenerativeUIToolCallRenderer as r, GenerativeUIMarkdownConfig as s, DefaultGenerativeUIChatCard as t, GenerativeUITheme as u, GenerativeUI$1 as v, GenerativeUIFunctionArgs as w, GenerativeUIComponentProps$1 as x, GenerativeUIComponentDefinition$1 as y };
233
- //# sourceMappingURL=chat-DtHs4alO.d.cts.map
214
+ export { GenerativeUIFunctionInput as C, createGenerativeUI as D, GenerativeUIStateOf as E, GenerativeUIFunctionDefinition$1 as S, GenerativeUISlotKind as T, GenerativeUIComponentName as _, GenerativeUIRuntime as a, GenerativeUIEventDefinition as b, GenerativeUIToolConfig as c, GenerativeUIAccessibility as d, GenerativeUIAriaAttributes$1 as f, GenerativeUIComponentDefinition$1 as g, GenerativeUI$1 as h, GenerativeUIMarkdownConfig as i, useGenerativeUIRuntime as l, CreateGenerativeUIConfig$1 as m, GenerativeUIErrorBoundaryConfig as n, GenerativeUIRuntimeContext as o, useGenerativeUIAccessibility as p, GenerativeUILibraryLoader as r, GenerativeUITheme as s, GenerativeUIConfig as t, useRequiredGenerativeUIRuntime as u, GenerativeUIComponentProps$1 as v, GenerativeUIFunctionName as w, GenerativeUIFunctionArgs as x, GenerativeUIDefinitionsOf as y };
215
+ //# sourceMappingURL=runtime-context-CIkZS0ap.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-context-CIkZS0ap.d.cts","names":[],"sources":["../src/generative-ui/catalog.ts","../src/generative-ui/accessibility.ts","../src/generative-ui/runtime-context.ts"],"mappings":";;;;;;;;KA2CY,iCAAA,GACV,+BAAA,CAAsC,aAAA;;;;;AAYxC;KAAY,cAAA,qBACU,uBAAA,GAA0B,uBAAA,IAC5C,YAAA,CAAmB,WAAA,EAAa,aAAA;;;;;;;;KASxB,4BAAA,YACC,eAAA,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,cAAA;EFuB6B;;;;EElBlC,QAAA;EFiB+B;;;;;;EEV/B,KAAA,GAAQ,iBAAA;EFcL;;;;;;EEPH,GAAA,GAAM,yBAAA;EFUF;EERJ,aAAA,GAAgB,+BAAA;AAAA;;;;;;KAQN,yBAAA,SAAkC,OAAA;;;;;UAM7B,sBAAA,SAA+B,sBAAA;EFP5C;EESF,SAAA;EAGA,WAAA;EACA,cAAA;AAAA;;;;;UAOe,0BAAA,SAAmC,sBAAA;EAClD,SAAA;EFlBkE;AAOpE;;;;EEiBE,WAAA;EFfc;;;;EEoBd,cAAA;AAAA;;;;;;;;;;;KAaU,kBAAA,GACR,sBAAA,GACA,0BAAA;AAAA,UAEa,mBAAA;EACf,OAAA,EAAS,0BAAA;EACT,UAAA,EAAY,sBAAA;EFxCW;EE0CvB,EAAA,EAAI,cAAA;EFzCU;EE2Cd,SAAA;EF1CA;EAAA,SE4CS,MAAA,EAAQ,kBAAA;EF5CgB;;;;EEiDjC,KAAA,GAAQ,iBAAA;EACR,YAAA,GACE,KAAA,EAAO,qBAAA,EACP,OAAA,yBACG,OAAA,CAAQ,wBAAA;EACb,WAAA,GAAc,IAAA,EAAM,qBAAA;EAAA,SACX,aAAA,GAAgB,+BAAA;AAAA;AAAA,cAGd,0BAAA,EAA0B,KAAA,CAAA,OAAA,CAAA,mBAAA;AAAA,iBAGvB,sBAAA,CAAA,GAA0B,mBAAA;AAAA,iBAI1B,8BAAA,CAAA,GAAkC,mBAAA"}
@@ -1,4 +1,4 @@
1
- import { s as IconSvg, t as ProviderMarkdown } from "./ProviderMarkdown-BZaPDROY.mjs";
1
+ import { l as useLatestRef, s as IconSvg, t as ProviderMarkdown } from "./ProviderMarkdown-epL7F3Vt.mjs";
2
2
  import { a as useGenerativeUIAccessibility, c as createGenerativeUI$1, m as useRequiredGenerativeUIRuntime, n as controlAria, o as wrapperAria, p as useGenerativeUIRuntime, r as namedRole, u as GenerativeUINodeContext } from "./accessibility-BLK-gE0R.mjs";
3
3
  import React, { Suspense, createContext, isValidElement, memo, useCallback, useContext, useEffect, useId, useInsertionEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
4
4
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -2911,13 +2911,18 @@ function isMapLibre(value) {
2911
2911
  return typeof value === "object" && value !== null && "Map" in value && typeof value.Map === "function";
2912
2912
  }
2913
2913
  /**
2914
- * Imports maplibre-gl on the client. The package is an optional peer
2915
- * dependency. The import rejects when it is not installed.
2914
+ * Loads maplibre-gl on the client with the `map` loader of the
2915
+ * `generativeUI` config. This module never imports the package itself: a
2916
+ * bundler resolves each dynamic import at build time, so an app without the
2917
+ * optional peer would fail to build. Rejects when the module is not
2918
+ * maplibre-gl.
2916
2919
  */
2917
- async function loadMapLibre() {
2918
- const module = await import("maplibre-gl");
2919
- const fromDefault = "default" in module ? module.default : void 0;
2920
- return isMapLibre(fromDefault) ? fromDefault : module;
2920
+ async function loadMapLibre(loader) {
2921
+ const loaded = await loader();
2922
+ const fromDefault = typeof loaded === "object" && loaded !== null && "default" in loaded ? loaded.default : void 0;
2923
+ if (isMapLibre(fromDefault)) return fromDefault;
2924
+ if (isMapLibre(loaded)) return loaded;
2925
+ throw new Error("The map loader did not give maplibre-gl.");
2921
2926
  }
2922
2927
  const isValidMarker = (marker) => Number.isFinite(marker.lat) && Number.isFinite(marker.lng);
2923
2928
  /**
@@ -2940,8 +2945,9 @@ function useIsDark(ref) {
2940
2945
  return isDark;
2941
2946
  }
2942
2947
  /**
2943
- * A MapLibre map with markers. maplibre-gl loads only in the browser. When
2944
- * it is not installed, or WebGL is not there, the component shows a list of
2948
+ * A MapLibre map with markers. maplibre-gl loads only in the browser, with
2949
+ * the `map` loader of the `generativeUI` config. Without the loader, when
2950
+ * the load fails, or when WebGL is not there, the component shows a list of
2945
2951
  * the places. A click on a place or a marker sets `selected`.
2946
2952
  */
2947
2953
  function MapView(props) {
@@ -2952,16 +2958,24 @@ function MapView(props) {
2952
2958
  const { zoom, route } = props;
2953
2959
  const height = props.height ?? 240;
2954
2960
  const containerRef = useRef(null);
2955
- const [status, setStatus] = useState("loading");
2961
+ const runtime = useRequiredGenerativeUIRuntime();
2962
+ const { theme } = runtime;
2963
+ const loaderRef = useLatestRef(runtime.config.map);
2964
+ const hasLoader = runtime.config.map !== void 0;
2965
+ const [status, setStatus] = useState(hasLoader ? "loading" : "fallback");
2956
2966
  const setSelectedRef = useRef(props.setSelected);
2957
2967
  setSelectedRef.current = props.setSelected;
2958
- const { theme } = useRequiredGenerativeUIRuntime();
2959
2968
  const styleUrl = useIsDark(containerRef) ? theme?.dark?.mapStyle || theme?.mapStyle || DEFAULT_DARK_MAP_STYLE : theme?.mapStyle || DEFAULT_MAP_STYLE;
2960
2969
  useEffect(() => {
2961
2970
  let isCancelled = false;
2962
2971
  let map;
2963
- async function mount() {
2964
- const maplibregl = await loadMapLibre();
2972
+ const loader = loaderRef.current;
2973
+ if (!loader) {
2974
+ setStatus("fallback");
2975
+ return;
2976
+ }
2977
+ async function mount(load) {
2978
+ const maplibregl = await loadMapLibre(load);
2965
2979
  const container = containerRef.current;
2966
2980
  if (isCancelled || !container) return;
2967
2981
  const first = markers[0];
@@ -3022,7 +3036,7 @@ function MapView(props) {
3022
3036
  });
3023
3037
  setStatus("ready");
3024
3038
  }
3025
- mount().catch(() => {
3039
+ mount(loader).catch(() => {
3026
3040
  map?.remove();
3027
3041
  map = void 0;
3028
3042
  if (!isCancelled) setStatus("fallback");
@@ -3034,6 +3048,8 @@ function MapView(props) {
3034
3048
  } catch {}
3035
3049
  };
3036
3050
  }, [
3051
+ hasLoader,
3052
+ loaderRef,
3037
3053
  markers,
3038
3054
  center,
3039
3055
  zoom,
@@ -5781,4 +5797,4 @@ const standardUI = createGenerativeUI$1({
5781
5797
 
5782
5798
  //#endregion
5783
5799
  export { standard_exports as n, standardUI as t };
5784
- //# sourceMappingURL=standard-s8jByRiE.mjs.map
5800
+ //# sourceMappingURL=standard-CSBR4FhM.mjs.map