@athenaintel/react 0.10.28 → 0.10.31

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/dist/index.cjs CHANGED
@@ -169,6 +169,10 @@ function isTrustedOrigin({
169
169
  }
170
170
  }
171
171
  const BRIDGE_TIMEOUT_MS = 2e3;
172
+ const TOKEN_REFRESH_BUFFER_MS = 5 * 60 * 1e3;
173
+ const TOKEN_REFRESH_RETRY_BASE_MS = 60 * 1e3;
174
+ const TOKEN_REFRESH_RETRY_MAX_MS = 5 * 60 * 1e3;
175
+ const DEFAULT_TOKEN_REFRESH_MS = 55 * 60 * 1e3;
172
176
  const EMPTY_TRUSTED_ORIGINS = [];
173
177
  const normalizeOrigin = (value) => {
174
178
  try {
@@ -177,6 +181,20 @@ const normalizeOrigin = (value) => {
177
181
  return null;
178
182
  }
179
183
  };
184
+ const getTokenRefreshDelay = (expiresAt, nowMs) => {
185
+ if (typeof expiresAt !== "string") {
186
+ return DEFAULT_TOKEN_REFRESH_MS;
187
+ }
188
+ const expiresAtMs = Date.parse(expiresAt);
189
+ if (!Number.isFinite(expiresAtMs)) {
190
+ return DEFAULT_TOKEN_REFRESH_MS;
191
+ }
192
+ return Math.max(TOKEN_REFRESH_RETRY_BASE_MS, expiresAtMs - nowMs - TOKEN_REFRESH_BUFFER_MS);
193
+ };
194
+ const getAuthRetryDelay = (retryAttempt) => {
195
+ const safeAttempt = Number.isFinite(retryAttempt) ? Math.max(0, Math.floor(retryAttempt)) : 0;
196
+ return Math.min(TOKEN_REFRESH_RETRY_MAX_MS, TOKEN_REFRESH_RETRY_BASE_MS * 2 ** safeAttempt);
197
+ };
180
198
  function useParentBridge({
181
199
  trustedOrigins = EMPTY_TRUSTED_ORIGINS
182
200
  } = {}) {
@@ -199,8 +217,7 @@ function useParentBridge({
199
217
  apiUrl: null,
200
218
  backendUrl: null,
201
219
  appUrl: null,
202
- // If not in an iframe, we're ready immediately (standalone mode)
203
- ready: !isInIframe
220
+ ready: false
204
221
  });
205
222
  const readySignalSent = React.useRef(false);
206
223
  const configReceived = React.useRef(false);
@@ -227,7 +244,6 @@ function useParentBridge({
227
244
  setState((prev) => ({
228
245
  ...prev,
229
246
  token: event.data.token,
230
- // If we got a token, we're ready even without config
231
247
  ready: true
232
248
  }));
233
249
  }
@@ -245,6 +261,105 @@ function useParentBridge({
245
261
  clearTimeout(timer);
246
262
  };
247
263
  }, [isInIframe, runtimeTrustedOrigins]);
264
+ React.useEffect(() => {
265
+ if (isInIframe) return;
266
+ if (typeof window === "undefined") return;
267
+ let cancelled = false;
268
+ let requestTimer = null;
269
+ let refreshTimer = null;
270
+ let controller = null;
271
+ let retryAttempt = 0;
272
+ const clearRequestTimer = () => {
273
+ if (requestTimer) {
274
+ clearTimeout(requestTimer);
275
+ requestTimer = null;
276
+ }
277
+ };
278
+ const clearRefreshTimer = () => {
279
+ if (refreshTimer) {
280
+ clearTimeout(refreshTimer);
281
+ refreshTimer = null;
282
+ }
283
+ };
284
+ const markReady = () => {
285
+ if (cancelled) return;
286
+ setState((prev) => prev.ready ? prev : { ...prev, ready: true });
287
+ };
288
+ const scheduleRefresh = (expiresAt) => {
289
+ clearRefreshTimer();
290
+ retryAttempt = 0;
291
+ const delay = getTokenRefreshDelay(expiresAt, Date.now());
292
+ refreshTimer = setTimeout(() => {
293
+ void fetchAuth({ markReadyOnFailure: false });
294
+ }, delay);
295
+ };
296
+ const scheduleRetry = () => {
297
+ clearRefreshTimer();
298
+ const delay = getAuthRetryDelay(retryAttempt);
299
+ retryAttempt += 1;
300
+ refreshTimer = setTimeout(() => {
301
+ void fetchAuth({ markReadyOnFailure: false });
302
+ }, delay);
303
+ };
304
+ const fetchAuth = async ({
305
+ markReadyOnFailure
306
+ }) => {
307
+ controller == null ? void 0 : controller.abort();
308
+ controller = new AbortController();
309
+ clearRequestTimer();
310
+ requestTimer = setTimeout(() => {
311
+ controller == null ? void 0 : controller.abort();
312
+ if (markReadyOnFailure) {
313
+ markReady();
314
+ }
315
+ }, BRIDGE_TIMEOUT_MS);
316
+ try {
317
+ const resp = await fetch("/_athena/auth", {
318
+ credentials: "include",
319
+ headers: { Accept: "application/json" },
320
+ signal: controller.signal
321
+ });
322
+ if (cancelled) return;
323
+ if (!resp.ok) {
324
+ if (resp.status === 404) {
325
+ markReady();
326
+ } else if (markReadyOnFailure) {
327
+ markReady();
328
+ scheduleRetry();
329
+ } else {
330
+ scheduleRetry();
331
+ }
332
+ return;
333
+ }
334
+ const data = await resp.json();
335
+ if (cancelled) return;
336
+ setState({
337
+ token: typeof data.token === "string" ? data.token : null,
338
+ apiUrl: typeof data.apiUrl === "string" ? data.apiUrl : null,
339
+ backendUrl: typeof data.backendUrl === "string" ? data.backendUrl : null,
340
+ appUrl: typeof data.appUrl === "string" ? data.appUrl : null,
341
+ ready: true
342
+ });
343
+ scheduleRefresh(data.expires_at);
344
+ } catch {
345
+ if (markReadyOnFailure) {
346
+ markReady();
347
+ }
348
+ if (!cancelled) {
349
+ scheduleRetry();
350
+ }
351
+ } finally {
352
+ clearRequestTimer();
353
+ }
354
+ };
355
+ void fetchAuth({ markReadyOnFailure: true });
356
+ return () => {
357
+ cancelled = true;
358
+ controller == null ? void 0 : controller.abort();
359
+ clearRequestTimer();
360
+ clearRefreshTimer();
361
+ };
362
+ }, [isInIframe]);
248
363
  return state;
249
364
  }
250
365
  function useParentAuth() {
@@ -3933,7 +4048,7 @@ const twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
3933
4048
  function cn(...inputs) {
3934
4049
  return twMerge(clsx(inputs));
3935
4050
  }
3936
- function isRecord(value) {
4051
+ function isRecord$1(value) {
3937
4052
  return typeof value === "object" && value !== null && !Array.isArray(value);
3938
4053
  }
3939
4054
  function $constructor(name, initializer2, params) {
@@ -8317,10 +8432,10 @@ const autoCloseInFlightSubgraphMessages = (msgs) => {
8317
8432
  const beginIds = /* @__PURE__ */ new Set();
8318
8433
  const endIds = /* @__PURE__ */ new Set();
8319
8434
  for (const message of msgs) {
8320
- if (!isRecord(message)) continue;
8435
+ if (!isRecord$1(message)) continue;
8321
8436
  if (message.type === "ai" && Array.isArray(message.tool_calls)) {
8322
8437
  for (const toolCall of message.tool_calls) {
8323
- if (!isRecord(toolCall)) continue;
8438
+ if (!isRecord$1(toolCall)) continue;
8324
8439
  const id = toolCall.id;
8325
8440
  if (typeof id === "string") beginIds.add(id);
8326
8441
  }
@@ -8386,7 +8501,7 @@ const contentToParts = (content) => {
8386
8501
  const getNumberAtPath = (value, path) => {
8387
8502
  let current = value;
8388
8503
  for (const segment of path) {
8389
- if (!isRecord(current)) {
8504
+ if (!isRecord$1(current)) {
8390
8505
  return void 0;
8391
8506
  }
8392
8507
  current = current[segment];
@@ -8407,7 +8522,7 @@ const buildCustomMetadata = ({
8407
8522
  }) => {
8408
8523
  const customMetadata = additionalKwargs ? { ...additionalKwargs } : {};
8409
8524
  const reasoningTokens = extractReasoningTokens({ usageMetadata, responseMetadata });
8410
- const existingAthenaMetadata = isRecord(customMetadata._athena) ? customMetadata._athena : void 0;
8525
+ const existingAthenaMetadata = isRecord$1(customMetadata._athena) ? customMetadata._athena : void 0;
8411
8526
  const athenaMetadata = {
8412
8527
  ...existingAthenaMetadata ?? {}
8413
8528
  };
@@ -8426,9 +8541,9 @@ const buildCustomMetadata = ({
8426
8541
  return Object.keys(customMetadata).length > 0 ? customMetadata : void 0;
8427
8542
  };
8428
8543
  const getSubgraphMessages = (artifact) => {
8429
- if (!isRecord(artifact)) return void 0;
8544
+ if (!isRecord$1(artifact)) return void 0;
8430
8545
  const subgraphState = artifact.subgraph_state;
8431
- if (!isRecord(subgraphState)) return void 0;
8546
+ if (!isRecord$1(subgraphState)) return void 0;
8432
8547
  const messages = subgraphState.messages;
8433
8548
  return Array.isArray(messages) && messages.length > 0 ? messages : void 0;
8434
8549
  };
@@ -9084,7 +9199,7 @@ const useAthenaRuntime = (config2) => {
9084
9199
  if (status.isRunning) {
9085
9200
  try {
9086
9201
  const lastMessageId = ((_b = runtime.thread.getState().messages.at(-1)) == null ? void 0 : _b.id) ?? null;
9087
- runtime.thread.unstable_resumeRun({ parentId: lastMessageId });
9202
+ runtime.thread.resumeRun({ parentId: lastMessageId });
9088
9203
  } catch (resumeErr) {
9089
9204
  if (IS_DEV) {
9090
9205
  console.error("[AthenaSDK] Failed to resume running thread:", resumeErr);
@@ -9137,12 +9252,12 @@ function useComposedRefs(...refs) {
9137
9252
  return React__namespace.useCallback(composeRefs(...refs), refs);
9138
9253
  }
9139
9254
  // @__NO_SIDE_EFFECTS__
9140
- function createSlot$7(ownerName) {
9141
- const SlotClone = /* @__PURE__ */ createSlotClone$7(ownerName);
9255
+ function createSlot(ownerName) {
9256
+ const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
9142
9257
  const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
9143
9258
  const { children, ...slotProps } = props;
9144
9259
  const childrenArray = React__namespace.Children.toArray(children);
9145
- const slottable = childrenArray.find(isSlottable$7);
9260
+ const slottable = childrenArray.find(isSlottable);
9146
9261
  if (slottable) {
9147
9262
  const newElement = slottable.props.children;
9148
9263
  const newChildren = childrenArray.map((child) => {
@@ -9160,13 +9275,14 @@ function createSlot$7(ownerName) {
9160
9275
  Slot2.displayName = `${ownerName}.Slot`;
9161
9276
  return Slot2;
9162
9277
  }
9278
+ var Slot = /* @__PURE__ */ createSlot("Slot");
9163
9279
  // @__NO_SIDE_EFFECTS__
9164
- function createSlotClone$7(ownerName) {
9280
+ function createSlotClone(ownerName) {
9165
9281
  const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
9166
9282
  const { children, ...slotProps } = props;
9167
9283
  if (React__namespace.isValidElement(children)) {
9168
- const childrenRef = getElementRef$8(children);
9169
- const props2 = mergeProps$7(slotProps, children.props);
9284
+ const childrenRef = getElementRef$1(children);
9285
+ const props2 = mergeProps(slotProps, children.props);
9170
9286
  if (children.type !== React__namespace.Fragment) {
9171
9287
  props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
9172
9288
  }
@@ -9177,11 +9293,21 @@ function createSlotClone$7(ownerName) {
9177
9293
  SlotClone.displayName = `${ownerName}.SlotClone`;
9178
9294
  return SlotClone;
9179
9295
  }
9180
- var SLOTTABLE_IDENTIFIER$7 = Symbol("radix.slottable");
9181
- function isSlottable$7(child) {
9182
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$7;
9296
+ var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
9297
+ // @__NO_SIDE_EFFECTS__
9298
+ function createSlottable(ownerName) {
9299
+ const Slottable2 = ({ children }) => {
9300
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
9301
+ };
9302
+ Slottable2.displayName = `${ownerName}.Slottable`;
9303
+ Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
9304
+ return Slottable2;
9305
+ }
9306
+ var Slottable$1 = /* @__PURE__ */ createSlottable("Slottable");
9307
+ function isSlottable(child) {
9308
+ return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
9183
9309
  }
9184
- function mergeProps$7(slotProps, childProps) {
9310
+ function mergeProps(slotProps, childProps) {
9185
9311
  const overrideProps = { ...childProps };
9186
9312
  for (const propName in childProps) {
9187
9313
  const slotPropValue = slotProps[propName];
@@ -9205,7 +9331,7 @@ function mergeProps$7(slotProps, childProps) {
9205
9331
  }
9206
9332
  return { ...slotProps, ...overrideProps };
9207
9333
  }
9208
- function getElementRef$8(element) {
9334
+ function getElementRef$1(element) {
9209
9335
  var _a2, _b;
9210
9336
  let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
9211
9337
  let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
@@ -9239,7 +9365,7 @@ var NODES$6 = [
9239
9365
  "ul"
9240
9366
  ];
9241
9367
  var Primitive$6 = NODES$6.reduce((primitive, node) => {
9242
- const Slot2 = /* @__PURE__ */ createSlot$7(`Primitive.${node}`);
9368
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
9243
9369
  const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
9244
9370
  const { asChild, ...primitiveProps } = props;
9245
9371
  const Comp = asChild ? Slot2 : node;
@@ -9414,89 +9540,6 @@ function composeContextScopes$2(...scopes) {
9414
9540
  createScope.scopeName = baseScope.scopeName;
9415
9541
  return createScope;
9416
9542
  }
9417
- // @__NO_SIDE_EFFECTS__
9418
- function createSlot$6(ownerName) {
9419
- const SlotClone = /* @__PURE__ */ createSlotClone$6(ownerName);
9420
- const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
9421
- const { children, ...slotProps } = props;
9422
- const childrenArray = React__namespace.Children.toArray(children);
9423
- const slottable = childrenArray.find(isSlottable$6);
9424
- if (slottable) {
9425
- const newElement = slottable.props.children;
9426
- const newChildren = childrenArray.map((child) => {
9427
- if (child === slottable) {
9428
- if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
9429
- return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
9430
- } else {
9431
- return child;
9432
- }
9433
- });
9434
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
9435
- }
9436
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
9437
- });
9438
- Slot2.displayName = `${ownerName}.Slot`;
9439
- return Slot2;
9440
- }
9441
- // @__NO_SIDE_EFFECTS__
9442
- function createSlotClone$6(ownerName) {
9443
- const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
9444
- const { children, ...slotProps } = props;
9445
- if (React__namespace.isValidElement(children)) {
9446
- const childrenRef = getElementRef$7(children);
9447
- const props2 = mergeProps$6(slotProps, children.props);
9448
- if (children.type !== React__namespace.Fragment) {
9449
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
9450
- }
9451
- return React__namespace.cloneElement(children, props2);
9452
- }
9453
- return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
9454
- });
9455
- SlotClone.displayName = `${ownerName}.SlotClone`;
9456
- return SlotClone;
9457
- }
9458
- var SLOTTABLE_IDENTIFIER$6 = Symbol("radix.slottable");
9459
- function isSlottable$6(child) {
9460
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$6;
9461
- }
9462
- function mergeProps$6(slotProps, childProps) {
9463
- const overrideProps = { ...childProps };
9464
- for (const propName in childProps) {
9465
- const slotPropValue = slotProps[propName];
9466
- const childPropValue = childProps[propName];
9467
- const isHandler = /^on[A-Z]/.test(propName);
9468
- if (isHandler) {
9469
- if (slotPropValue && childPropValue) {
9470
- overrideProps[propName] = (...args) => {
9471
- const result = childPropValue(...args);
9472
- slotPropValue(...args);
9473
- return result;
9474
- };
9475
- } else if (slotPropValue) {
9476
- overrideProps[propName] = slotPropValue;
9477
- }
9478
- } else if (propName === "style") {
9479
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
9480
- } else if (propName === "className") {
9481
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
9482
- }
9483
- }
9484
- return { ...slotProps, ...overrideProps };
9485
- }
9486
- function getElementRef$7(element) {
9487
- var _a2, _b;
9488
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
9489
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
9490
- if (mayWarn) {
9491
- return element.ref;
9492
- }
9493
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
9494
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
9495
- if (mayWarn) {
9496
- return element.props.ref;
9497
- }
9498
- return element.props.ref || element.ref;
9499
- }
9500
9543
  var NODES$5 = [
9501
9544
  "a",
9502
9545
  "button",
@@ -9517,7 +9560,7 @@ var NODES$5 = [
9517
9560
  "ul"
9518
9561
  ];
9519
9562
  var Primitive$5 = NODES$5.reduce((primitive, node) => {
9520
- const Slot2 = /* @__PURE__ */ createSlot$6(`Primitive.${node}`);
9563
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
9521
9564
  const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
9522
9565
  const { asChild, ...primitiveProps } = props;
9523
9566
  const Comp = asChild ? Slot2 : node;
@@ -9539,7 +9582,7 @@ var Presence = (props) => {
9539
9582
  const { present, children } = props;
9540
9583
  const presence = usePresence(present);
9541
9584
  const child = typeof children === "function" ? children({ present: presence.isPresent }) : React__namespace.Children.only(children);
9542
- const ref = useComposedRefs(presence.ref, getElementRef$6(child));
9585
+ const ref = useComposedRefs(presence.ref, getElementRef(child));
9543
9586
  const forceMount = typeof children === "function";
9544
9587
  return forceMount || presence.isPresent ? React__namespace.cloneElement(child, { ref }) : null;
9545
9588
  };
@@ -9638,7 +9681,7 @@ function usePresence(present) {
9638
9681
  function getAnimationName(styles) {
9639
9682
  return (styles == null ? void 0 : styles.animationName) || "none";
9640
9683
  }
9641
- function getElementRef$6(element) {
9684
+ function getElementRef(element) {
9642
9685
  var _a2, _b;
9643
9686
  let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
9644
9687
  let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
@@ -9791,89 +9834,6 @@ function getState(open) {
9791
9834
  return open ? "open" : "closed";
9792
9835
  }
9793
9836
  var Root$1 = Collapsible$1;
9794
- // @__NO_SIDE_EFFECTS__
9795
- function createSlot$5(ownerName) {
9796
- const SlotClone = /* @__PURE__ */ createSlotClone$5(ownerName);
9797
- const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
9798
- const { children, ...slotProps } = props;
9799
- const childrenArray = React__namespace.Children.toArray(children);
9800
- const slottable = childrenArray.find(isSlottable$5);
9801
- if (slottable) {
9802
- const newElement = slottable.props.children;
9803
- const newChildren = childrenArray.map((child) => {
9804
- if (child === slottable) {
9805
- if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
9806
- return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
9807
- } else {
9808
- return child;
9809
- }
9810
- });
9811
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
9812
- }
9813
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
9814
- });
9815
- Slot2.displayName = `${ownerName}.Slot`;
9816
- return Slot2;
9817
- }
9818
- // @__NO_SIDE_EFFECTS__
9819
- function createSlotClone$5(ownerName) {
9820
- const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
9821
- const { children, ...slotProps } = props;
9822
- if (React__namespace.isValidElement(children)) {
9823
- const childrenRef = getElementRef$5(children);
9824
- const props2 = mergeProps$5(slotProps, children.props);
9825
- if (children.type !== React__namespace.Fragment) {
9826
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
9827
- }
9828
- return React__namespace.cloneElement(children, props2);
9829
- }
9830
- return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
9831
- });
9832
- SlotClone.displayName = `${ownerName}.SlotClone`;
9833
- return SlotClone;
9834
- }
9835
- var SLOTTABLE_IDENTIFIER$5 = Symbol("radix.slottable");
9836
- function isSlottable$5(child) {
9837
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$5;
9838
- }
9839
- function mergeProps$5(slotProps, childProps) {
9840
- const overrideProps = { ...childProps };
9841
- for (const propName in childProps) {
9842
- const slotPropValue = slotProps[propName];
9843
- const childPropValue = childProps[propName];
9844
- const isHandler = /^on[A-Z]/.test(propName);
9845
- if (isHandler) {
9846
- if (slotPropValue && childPropValue) {
9847
- overrideProps[propName] = (...args) => {
9848
- const result = childPropValue(...args);
9849
- slotPropValue(...args);
9850
- return result;
9851
- };
9852
- } else if (slotPropValue) {
9853
- overrideProps[propName] = slotPropValue;
9854
- }
9855
- } else if (propName === "style") {
9856
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
9857
- } else if (propName === "className") {
9858
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
9859
- }
9860
- }
9861
- return { ...slotProps, ...overrideProps };
9862
- }
9863
- function getElementRef$5(element) {
9864
- var _a2, _b;
9865
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
9866
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
9867
- if (mayWarn) {
9868
- return element.ref;
9869
- }
9870
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
9871
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
9872
- if (mayWarn) {
9873
- return element.props.ref;
9874
- }
9875
- return element.props.ref || element.ref;
9876
- }
9877
9837
  var NODES$4 = [
9878
9838
  "a",
9879
9839
  "button",
@@ -9894,7 +9854,7 @@ var NODES$4 = [
9894
9854
  "ul"
9895
9855
  ];
9896
9856
  var Primitive$4 = NODES$4.reduce((primitive, node) => {
9897
- const Slot2 = /* @__PURE__ */ createSlot$5(`Primitive.${node}`);
9857
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
9898
9858
  const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
9899
9859
  const { asChild, ...primitiveProps } = props;
9900
9860
  const Comp = asChild ? Slot2 : node;
@@ -10132,89 +10092,6 @@ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
10132
10092
  target.dispatchEvent(event);
10133
10093
  }
10134
10094
  }
10135
- // @__NO_SIDE_EFFECTS__
10136
- function createSlot$4(ownerName) {
10137
- const SlotClone = /* @__PURE__ */ createSlotClone$4(ownerName);
10138
- const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
10139
- const { children, ...slotProps } = props;
10140
- const childrenArray = React__namespace.Children.toArray(children);
10141
- const slottable = childrenArray.find(isSlottable$4);
10142
- if (slottable) {
10143
- const newElement = slottable.props.children;
10144
- const newChildren = childrenArray.map((child) => {
10145
- if (child === slottable) {
10146
- if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
10147
- return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
10148
- } else {
10149
- return child;
10150
- }
10151
- });
10152
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
10153
- }
10154
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
10155
- });
10156
- Slot2.displayName = `${ownerName}.Slot`;
10157
- return Slot2;
10158
- }
10159
- // @__NO_SIDE_EFFECTS__
10160
- function createSlotClone$4(ownerName) {
10161
- const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
10162
- const { children, ...slotProps } = props;
10163
- if (React__namespace.isValidElement(children)) {
10164
- const childrenRef = getElementRef$4(children);
10165
- const props2 = mergeProps$4(slotProps, children.props);
10166
- if (children.type !== React__namespace.Fragment) {
10167
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
10168
- }
10169
- return React__namespace.cloneElement(children, props2);
10170
- }
10171
- return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
10172
- });
10173
- SlotClone.displayName = `${ownerName}.SlotClone`;
10174
- return SlotClone;
10175
- }
10176
- var SLOTTABLE_IDENTIFIER$4 = Symbol("radix.slottable");
10177
- function isSlottable$4(child) {
10178
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$4;
10179
- }
10180
- function mergeProps$4(slotProps, childProps) {
10181
- const overrideProps = { ...childProps };
10182
- for (const propName in childProps) {
10183
- const slotPropValue = slotProps[propName];
10184
- const childPropValue = childProps[propName];
10185
- const isHandler = /^on[A-Z]/.test(propName);
10186
- if (isHandler) {
10187
- if (slotPropValue && childPropValue) {
10188
- overrideProps[propName] = (...args) => {
10189
- const result = childPropValue(...args);
10190
- slotPropValue(...args);
10191
- return result;
10192
- };
10193
- } else if (slotPropValue) {
10194
- overrideProps[propName] = slotPropValue;
10195
- }
10196
- } else if (propName === "style") {
10197
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
10198
- } else if (propName === "className") {
10199
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
10200
- }
10201
- }
10202
- return { ...slotProps, ...overrideProps };
10203
- }
10204
- function getElementRef$4(element) {
10205
- var _a2, _b;
10206
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
10207
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
10208
- if (mayWarn) {
10209
- return element.ref;
10210
- }
10211
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
10212
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
10213
- if (mayWarn) {
10214
- return element.props.ref;
10215
- }
10216
- return element.props.ref || element.ref;
10217
- }
10218
10095
  var NODES$3 = [
10219
10096
  "a",
10220
10097
  "button",
@@ -10235,7 +10112,7 @@ var NODES$3 = [
10235
10112
  "ul"
10236
10113
  ];
10237
10114
  var Primitive$3 = NODES$3.reduce((primitive, node) => {
10238
- const Slot2 = /* @__PURE__ */ createSlot$4(`Primitive.${node}`);
10115
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
10239
10116
  const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
10240
10117
  const { asChild, ...primitiveProps } = props;
10241
10118
  const Comp = asChild ? Slot2 : node;
@@ -10257,100 +10134,6 @@ var Portal$1 = React__namespace.forwardRef((props, forwardedRef) => {
10257
10134
  return container ? ReactDOM.createPortal(/* @__PURE__ */ jsxRuntime.jsx(Primitive$3.div, { ...portalProps, ref: forwardedRef }), container) : null;
10258
10135
  });
10259
10136
  Portal$1.displayName = PORTAL_NAME$1;
10260
- // @__NO_SIDE_EFFECTS__
10261
- function createSlot$3(ownerName) {
10262
- const SlotClone = /* @__PURE__ */ createSlotClone$3(ownerName);
10263
- const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
10264
- const { children, ...slotProps } = props;
10265
- const childrenArray = React__namespace.Children.toArray(children);
10266
- const slottable = childrenArray.find(isSlottable$3);
10267
- if (slottable) {
10268
- const newElement = slottable.props.children;
10269
- const newChildren = childrenArray.map((child) => {
10270
- if (child === slottable) {
10271
- if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
10272
- return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
10273
- } else {
10274
- return child;
10275
- }
10276
- });
10277
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
10278
- }
10279
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
10280
- });
10281
- Slot2.displayName = `${ownerName}.Slot`;
10282
- return Slot2;
10283
- }
10284
- var Slot = /* @__PURE__ */ createSlot$3("Slot");
10285
- // @__NO_SIDE_EFFECTS__
10286
- function createSlotClone$3(ownerName) {
10287
- const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
10288
- const { children, ...slotProps } = props;
10289
- if (React__namespace.isValidElement(children)) {
10290
- const childrenRef = getElementRef$3(children);
10291
- const props2 = mergeProps$3(slotProps, children.props);
10292
- if (children.type !== React__namespace.Fragment) {
10293
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
10294
- }
10295
- return React__namespace.cloneElement(children, props2);
10296
- }
10297
- return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
10298
- });
10299
- SlotClone.displayName = `${ownerName}.SlotClone`;
10300
- return SlotClone;
10301
- }
10302
- var SLOTTABLE_IDENTIFIER$3 = Symbol("radix.slottable");
10303
- // @__NO_SIDE_EFFECTS__
10304
- function createSlottable$1(ownerName) {
10305
- const Slottable2 = ({ children }) => {
10306
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
10307
- };
10308
- Slottable2.displayName = `${ownerName}.Slottable`;
10309
- Slottable2.__radixId = SLOTTABLE_IDENTIFIER$3;
10310
- return Slottable2;
10311
- }
10312
- var Slottable$1 = /* @__PURE__ */ createSlottable$1("Slottable");
10313
- function isSlottable$3(child) {
10314
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$3;
10315
- }
10316
- function mergeProps$3(slotProps, childProps) {
10317
- const overrideProps = { ...childProps };
10318
- for (const propName in childProps) {
10319
- const slotPropValue = slotProps[propName];
10320
- const childPropValue = childProps[propName];
10321
- const isHandler = /^on[A-Z]/.test(propName);
10322
- if (isHandler) {
10323
- if (slotPropValue && childPropValue) {
10324
- overrideProps[propName] = (...args) => {
10325
- const result = childPropValue(...args);
10326
- slotPropValue(...args);
10327
- return result;
10328
- };
10329
- } else if (slotPropValue) {
10330
- overrideProps[propName] = slotPropValue;
10331
- }
10332
- } else if (propName === "style") {
10333
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
10334
- } else if (propName === "className") {
10335
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
10336
- }
10337
- }
10338
- return { ...slotProps, ...overrideProps };
10339
- }
10340
- function getElementRef$3(element) {
10341
- var _a2, _b;
10342
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
10343
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
10344
- if (mayWarn) {
10345
- return element.ref;
10346
- }
10347
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
10348
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
10349
- if (mayWarn) {
10350
- return element.props.ref;
10351
- }
10352
- return element.props.ref || element.ref;
10353
- }
10354
10137
  var shim$1 = { exports: {} };
10355
10138
  var useSyncExternalStoreShim_production = {};
10356
10139
  /**
@@ -12443,89 +12226,6 @@ const arrow$2 = (options, deps) => {
12443
12226
  options: [options, deps]
12444
12227
  };
12445
12228
  };
12446
- // @__NO_SIDE_EFFECTS__
12447
- function createSlot$2(ownerName) {
12448
- const SlotClone = /* @__PURE__ */ createSlotClone$2(ownerName);
12449
- const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
12450
- const { children, ...slotProps } = props;
12451
- const childrenArray = React__namespace.Children.toArray(children);
12452
- const slottable = childrenArray.find(isSlottable$2);
12453
- if (slottable) {
12454
- const newElement = slottable.props.children;
12455
- const newChildren = childrenArray.map((child) => {
12456
- if (child === slottable) {
12457
- if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
12458
- return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
12459
- } else {
12460
- return child;
12461
- }
12462
- });
12463
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
12464
- }
12465
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
12466
- });
12467
- Slot2.displayName = `${ownerName}.Slot`;
12468
- return Slot2;
12469
- }
12470
- // @__NO_SIDE_EFFECTS__
12471
- function createSlotClone$2(ownerName) {
12472
- const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
12473
- const { children, ...slotProps } = props;
12474
- if (React__namespace.isValidElement(children)) {
12475
- const childrenRef = getElementRef$2(children);
12476
- const props2 = mergeProps$2(slotProps, children.props);
12477
- if (children.type !== React__namespace.Fragment) {
12478
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
12479
- }
12480
- return React__namespace.cloneElement(children, props2);
12481
- }
12482
- return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
12483
- });
12484
- SlotClone.displayName = `${ownerName}.SlotClone`;
12485
- return SlotClone;
12486
- }
12487
- var SLOTTABLE_IDENTIFIER$2 = Symbol("radix.slottable");
12488
- function isSlottable$2(child) {
12489
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$2;
12490
- }
12491
- function mergeProps$2(slotProps, childProps) {
12492
- const overrideProps = { ...childProps };
12493
- for (const propName in childProps) {
12494
- const slotPropValue = slotProps[propName];
12495
- const childPropValue = childProps[propName];
12496
- const isHandler = /^on[A-Z]/.test(propName);
12497
- if (isHandler) {
12498
- if (slotPropValue && childPropValue) {
12499
- overrideProps[propName] = (...args) => {
12500
- const result = childPropValue(...args);
12501
- slotPropValue(...args);
12502
- return result;
12503
- };
12504
- } else if (slotPropValue) {
12505
- overrideProps[propName] = slotPropValue;
12506
- }
12507
- } else if (propName === "style") {
12508
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
12509
- } else if (propName === "className") {
12510
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
12511
- }
12512
- }
12513
- return { ...slotProps, ...overrideProps };
12514
- }
12515
- function getElementRef$2(element) {
12516
- var _a2, _b;
12517
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
12518
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
12519
- if (mayWarn) {
12520
- return element.ref;
12521
- }
12522
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
12523
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
12524
- if (mayWarn) {
12525
- return element.props.ref;
12526
- }
12527
- return element.props.ref || element.ref;
12528
- }
12529
12229
  var NODES$2 = [
12530
12230
  "a",
12531
12231
  "button",
@@ -12546,7 +12246,7 @@ var NODES$2 = [
12546
12246
  "ul"
12547
12247
  ];
12548
12248
  var Primitive$2 = NODES$2.reduce((primitive, node) => {
12549
- const Slot2 = /* @__PURE__ */ createSlot$2(`Primitive.${node}`);
12249
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
12550
12250
  const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
12551
12251
  const { asChild, ...primitiveProps } = props;
12552
12252
  const Comp = asChild ? Slot2 : node;
@@ -12635,89 +12335,6 @@ function composeContextScopes$1(...scopes) {
12635
12335
  createScope.scopeName = baseScope.scopeName;
12636
12336
  return createScope;
12637
12337
  }
12638
- // @__NO_SIDE_EFFECTS__
12639
- function createSlot$1(ownerName) {
12640
- const SlotClone = /* @__PURE__ */ createSlotClone$1(ownerName);
12641
- const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
12642
- const { children, ...slotProps } = props;
12643
- const childrenArray = React__namespace.Children.toArray(children);
12644
- const slottable = childrenArray.find(isSlottable$1);
12645
- if (slottable) {
12646
- const newElement = slottable.props.children;
12647
- const newChildren = childrenArray.map((child) => {
12648
- if (child === slottable) {
12649
- if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
12650
- return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
12651
- } else {
12652
- return child;
12653
- }
12654
- });
12655
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
12656
- }
12657
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
12658
- });
12659
- Slot2.displayName = `${ownerName}.Slot`;
12660
- return Slot2;
12661
- }
12662
- // @__NO_SIDE_EFFECTS__
12663
- function createSlotClone$1(ownerName) {
12664
- const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
12665
- const { children, ...slotProps } = props;
12666
- if (React__namespace.isValidElement(children)) {
12667
- const childrenRef = getElementRef$1(children);
12668
- const props2 = mergeProps$1(slotProps, children.props);
12669
- if (children.type !== React__namespace.Fragment) {
12670
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
12671
- }
12672
- return React__namespace.cloneElement(children, props2);
12673
- }
12674
- return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
12675
- });
12676
- SlotClone.displayName = `${ownerName}.SlotClone`;
12677
- return SlotClone;
12678
- }
12679
- var SLOTTABLE_IDENTIFIER$1 = Symbol("radix.slottable");
12680
- function isSlottable$1(child) {
12681
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$1;
12682
- }
12683
- function mergeProps$1(slotProps, childProps) {
12684
- const overrideProps = { ...childProps };
12685
- for (const propName in childProps) {
12686
- const slotPropValue = slotProps[propName];
12687
- const childPropValue = childProps[propName];
12688
- const isHandler = /^on[A-Z]/.test(propName);
12689
- if (isHandler) {
12690
- if (slotPropValue && childPropValue) {
12691
- overrideProps[propName] = (...args) => {
12692
- const result = childPropValue(...args);
12693
- slotPropValue(...args);
12694
- return result;
12695
- };
12696
- } else if (slotPropValue) {
12697
- overrideProps[propName] = slotPropValue;
12698
- }
12699
- } else if (propName === "style") {
12700
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
12701
- } else if (propName === "className") {
12702
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
12703
- }
12704
- }
12705
- return { ...slotProps, ...overrideProps };
12706
- }
12707
- function getElementRef$1(element) {
12708
- var _a2, _b;
12709
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
12710
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
12711
- if (mayWarn) {
12712
- return element.ref;
12713
- }
12714
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
12715
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
12716
- if (mayWarn) {
12717
- return element.props.ref;
12718
- }
12719
- return element.props.ref || element.ref;
12720
- }
12721
12338
  var NODES$1 = [
12722
12339
  "a",
12723
12340
  "button",
@@ -12738,7 +12355,7 @@ var NODES$1 = [
12738
12355
  "ul"
12739
12356
  ];
12740
12357
  var Primitive$1 = NODES$1.reduce((primitive, node) => {
12741
- const Slot2 = /* @__PURE__ */ createSlot$1(`Primitive.${node}`);
12358
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
12742
12359
  const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
12743
12360
  const { asChild, ...primitiveProps } = props;
12744
12361
  const Comp = asChild ? Slot2 : node;
@@ -13080,98 +12697,6 @@ function composeContextScopes(...scopes) {
13080
12697
  createScope.scopeName = baseScope.scopeName;
13081
12698
  return createScope;
13082
12699
  }
13083
- // @__NO_SIDE_EFFECTS__
13084
- function createSlot(ownerName) {
13085
- const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
13086
- const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
13087
- const { children, ...slotProps } = props;
13088
- const childrenArray = React__namespace.Children.toArray(children);
13089
- const slottable = childrenArray.find(isSlottable);
13090
- if (slottable) {
13091
- const newElement = slottable.props.children;
13092
- const newChildren = childrenArray.map((child) => {
13093
- if (child === slottable) {
13094
- if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
13095
- return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
13096
- } else {
13097
- return child;
13098
- }
13099
- });
13100
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
13101
- }
13102
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
13103
- });
13104
- Slot2.displayName = `${ownerName}.Slot`;
13105
- return Slot2;
13106
- }
13107
- // @__NO_SIDE_EFFECTS__
13108
- function createSlotClone(ownerName) {
13109
- const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
13110
- const { children, ...slotProps } = props;
13111
- if (React__namespace.isValidElement(children)) {
13112
- const childrenRef = getElementRef(children);
13113
- const props2 = mergeProps(slotProps, children.props);
13114
- if (children.type !== React__namespace.Fragment) {
13115
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
13116
- }
13117
- return React__namespace.cloneElement(children, props2);
13118
- }
13119
- return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
13120
- });
13121
- SlotClone.displayName = `${ownerName}.SlotClone`;
13122
- return SlotClone;
13123
- }
13124
- var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
13125
- // @__NO_SIDE_EFFECTS__
13126
- function createSlottable(ownerName) {
13127
- const Slottable2 = ({ children }) => {
13128
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
13129
- };
13130
- Slottable2.displayName = `${ownerName}.Slottable`;
13131
- Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
13132
- return Slottable2;
13133
- }
13134
- function isSlottable(child) {
13135
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
13136
- }
13137
- function mergeProps(slotProps, childProps) {
13138
- const overrideProps = { ...childProps };
13139
- for (const propName in childProps) {
13140
- const slotPropValue = slotProps[propName];
13141
- const childPropValue = childProps[propName];
13142
- const isHandler = /^on[A-Z]/.test(propName);
13143
- if (isHandler) {
13144
- if (slotPropValue && childPropValue) {
13145
- overrideProps[propName] = (...args) => {
13146
- const result = childPropValue(...args);
13147
- slotPropValue(...args);
13148
- return result;
13149
- };
13150
- } else if (slotPropValue) {
13151
- overrideProps[propName] = slotPropValue;
13152
- }
13153
- } else if (propName === "style") {
13154
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
13155
- } else if (propName === "className") {
13156
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
13157
- }
13158
- }
13159
- return { ...slotProps, ...overrideProps };
13160
- }
13161
- function getElementRef(element) {
13162
- var _a2, _b;
13163
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
13164
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
13165
- if (mayWarn) {
13166
- return element.ref;
13167
- }
13168
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
13169
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
13170
- if (mayWarn) {
13171
- return element.props.ref;
13172
- }
13173
- return element.props.ref || element.ref;
13174
- }
13175
12700
  var NODES = [
13176
12701
  "a",
13177
12702
  "button",
@@ -13713,190 +13238,6 @@ function TooltipContent({
13713
13238
  }
13714
13239
  ) });
13715
13240
  }
13716
- const AthenaContext = React.createContext(null);
13717
- function useAthenaConfig() {
13718
- const ctx = React.useContext(AthenaContext);
13719
- if (!ctx) {
13720
- throw new Error("[AthenaSDK] useAthenaConfig must be used within <AthenaProvider>");
13721
- }
13722
- return ctx;
13723
- }
13724
- const AthenaThreadIdContext = React.createContext(void 0);
13725
- function useAthenaThreadId() {
13726
- return React.useContext(AthenaThreadIdContext);
13727
- }
13728
- function useAthenaThreadListAdapter(config2) {
13729
- const configRef = React.useRef(config2);
13730
- configRef.current = config2;
13731
- const auth = React.useMemo(
13732
- () => ({ apiKey: config2.apiKey, token: config2.token }),
13733
- [config2.apiKey, config2.token]
13734
- );
13735
- const unstable_Provider = React.useCallback(
13736
- function AthenaThreadProvider({ children }) {
13737
- const remoteId = react$1.useAuiState(
13738
- (s) => {
13739
- var _a2;
13740
- return (_a2 = s.threadListItem) == null ? void 0 : _a2.remoteId;
13741
- }
13742
- );
13743
- return /* @__PURE__ */ jsxRuntime.jsx(AthenaThreadIdContext.Provider, { value: remoteId, children });
13744
- },
13745
- []
13746
- );
13747
- return React.useMemo(() => ({
13748
- async list() {
13749
- if (!auth.token && !auth.apiKey) {
13750
- return { threads: [] };
13751
- }
13752
- try {
13753
- const { threads } = await listThreads(configRef.current.backendUrl, auth, {
13754
- ...configRef.current.appId ? { app_id: configRef.current.appId } : {}
13755
- });
13756
- return {
13757
- threads: threads.map((t) => ({
13758
- status: "regular",
13759
- remoteId: t.thread_id,
13760
- title: t.title || void 0
13761
- }))
13762
- };
13763
- } catch (err) {
13764
- console.error("[AthenaSDK] adapter.list() failed:", err);
13765
- return { threads: [] };
13766
- }
13767
- },
13768
- async initialize(_threadId) {
13769
- const remoteId = typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `thread_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
13770
- return { remoteId, externalId: void 0 };
13771
- },
13772
- async rename(_remoteId, _newTitle) {
13773
- },
13774
- async archive(remoteId) {
13775
- await archiveThread(configRef.current.backendUrl, auth, remoteId);
13776
- },
13777
- async unarchive(_remoteId) {
13778
- },
13779
- async delete(remoteId) {
13780
- await archiveThread(configRef.current.backendUrl, auth, remoteId);
13781
- },
13782
- async generateTitle(_remoteId, _messages) {
13783
- return new ReadableStream({ start(c) {
13784
- c.close();
13785
- } });
13786
- },
13787
- async fetch(remoteId) {
13788
- return {
13789
- status: "regular",
13790
- remoteId
13791
- };
13792
- },
13793
- unstable_Provider
13794
- }), [auth, unstable_Provider]);
13795
- }
13796
- const ThreadListRefreshContext = React.createContext(null);
13797
- function useRefreshThreadList() {
13798
- return React.useContext(ThreadListRefreshContext);
13799
- }
13800
- const LOCAL_ID_PREFIX = "__LOCALID_";
13801
- const isLocalPlaceholder = (id) => !!id && id.startsWith(LOCAL_ID_PREFIX);
13802
- function useAthenaThreadManager() {
13803
- const runtime = react$1.useAssistantRuntime({ optional: true });
13804
- const remoteId = react$1.useThread({
13805
- optional: true,
13806
- selector: (s) => {
13807
- var _a2;
13808
- const id = (_a2 = s.metadata) == null ? void 0 : _a2.remoteId;
13809
- return isLocalPlaceholder(id) ? void 0 : id;
13810
- }
13811
- });
13812
- const isThreadLoading = react$1.useThread({ optional: true, selector: (s) => s.isLoading }) ?? false;
13813
- const isListLoading = react$1.useThreadList({ optional: true, selector: (s) => s.isLoading });
13814
- const runtimeRef = React.useRef(runtime);
13815
- runtimeRef.current = runtime;
13816
- const switchToThread = React.useCallback(
13817
- (id) => runtimeRef.current.threads.switchToThread(id),
13818
- []
13819
- );
13820
- const switchToNewThread = React.useCallback(
13821
- () => runtimeRef.current.threads.switchToNewThread(),
13822
- []
13823
- );
13824
- const activeThreadId = remoteId ?? null;
13825
- return React.useMemo(() => {
13826
- if (!runtime || isListLoading == null) {
13827
- return null;
13828
- }
13829
- return {
13830
- activeThreadId,
13831
- isListLoading,
13832
- isThreadLoading,
13833
- switchToThread,
13834
- switchToNewThread
13835
- };
13836
- }, [runtime, activeThreadId, isListLoading, isThreadLoading, switchToThread, switchToNewThread]);
13837
- }
13838
- const POLL_DELAY_MS = 5e3;
13839
- const POLL_INTERVAL_MS = 1e3;
13840
- const POLL_MAX_DURATION_MS = 6e4;
13841
- function useThreadTitlePolling(refresh) {
13842
- const threadKey = react$1.useThread({
13843
- optional: true,
13844
- selector: (s) => {
13845
- var _a2, _b;
13846
- return ((_a2 = s.metadata) == null ? void 0 : _a2.remoteId) ?? ((_b = s.metadata) == null ? void 0 : _b.id) ?? s.threadId;
13847
- }
13848
- }) ?? null;
13849
- const hasMessages = react$1.useThread({
13850
- optional: true,
13851
- selector: (s) => s.messages.length > 0
13852
- }) ?? false;
13853
- const currentTitle = react$1.useThreadList({
13854
- optional: true,
13855
- selector: (s) => {
13856
- const main = s.threadItems[s.mainThreadId];
13857
- return (main == null ? void 0 : main.title) ?? "";
13858
- }
13859
- }) ?? "";
13860
- const hasTitle = currentTitle.trim().length > 0;
13861
- const polledThreadsRef = React.useRef(/* @__PURE__ */ new Set());
13862
- const refreshRef = React.useRef(refresh);
13863
- refreshRef.current = refresh;
13864
- React.useEffect(() => {
13865
- if (!threadKey || hasTitle || !hasMessages) {
13866
- return;
13867
- }
13868
- if (polledThreadsRef.current.has(threadKey)) {
13869
- return;
13870
- }
13871
- polledThreadsRef.current.add(threadKey);
13872
- let stopped = false;
13873
- let intervalId = null;
13874
- let maxTimeoutId = null;
13875
- const stop = () => {
13876
- stopped = true;
13877
- if (intervalId !== null) {
13878
- clearInterval(intervalId);
13879
- intervalId = null;
13880
- }
13881
- if (maxTimeoutId !== null) {
13882
- clearTimeout(maxTimeoutId);
13883
- maxTimeoutId = null;
13884
- }
13885
- };
13886
- const startTimeoutId = setTimeout(() => {
13887
- if (stopped) return;
13888
- refreshRef.current();
13889
- intervalId = setInterval(() => {
13890
- refreshRef.current();
13891
- }, POLL_INTERVAL_MS);
13892
- maxTimeoutId = setTimeout(stop, POLL_MAX_DURATION_MS - POLL_DELAY_MS);
13893
- }, POLL_DELAY_MS);
13894
- return () => {
13895
- clearTimeout(startTimeoutId);
13896
- stop();
13897
- };
13898
- }, [threadKey, hasTitle, hasMessages]);
13899
- }
13900
13241
  const createStoreImpl = (createState) => {
13901
13242
  let state;
13902
13243
  const listeners = /* @__PURE__ */ new Set();
@@ -14239,6 +13580,398 @@ const useAssetPanelStore = create()(
14239
13580
  }
14240
13581
  )
14241
13582
  );
13583
+ function getAssetInfo(assetId) {
13584
+ return { name: assetId || "Document", icon: "doc" };
13585
+ }
13586
+ function tryParseJson$2(text2) {
13587
+ try {
13588
+ const p = JSON.parse(text2);
13589
+ return typeof p === "object" && p !== null ? p : null;
13590
+ } catch {
13591
+ return null;
13592
+ }
13593
+ }
13594
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
13595
+ const normalizeResult$2 = (result) => {
13596
+ if (!result) return null;
13597
+ if (typeof result === "string") {
13598
+ const parsed = tryParseJson$2(result);
13599
+ if (isRecord(parsed)) return parsed;
13600
+ return null;
13601
+ }
13602
+ if (isRecord(result)) {
13603
+ const inner = result.result;
13604
+ if (typeof inner === "string") {
13605
+ const parsed = tryParseJson$2(inner);
13606
+ if (isRecord(parsed)) return parsed;
13607
+ } else if (isRecord(inner)) {
13608
+ return inner;
13609
+ }
13610
+ return result;
13611
+ }
13612
+ return null;
13613
+ };
13614
+ const pickAssetId = (...candidates) => {
13615
+ for (const candidate of candidates) {
13616
+ if (typeof candidate === "string" && candidate.startsWith("asset_")) {
13617
+ return candidate;
13618
+ }
13619
+ }
13620
+ return null;
13621
+ };
13622
+ const pickNumber = (...candidates) => {
13623
+ for (const candidate of candidates) {
13624
+ if (typeof candidate === "number" && Number.isFinite(candidate)) {
13625
+ return candidate;
13626
+ }
13627
+ }
13628
+ return void 0;
13629
+ };
13630
+ const autoOpen = (assetId, options = {}) => {
13631
+ const store = useAssetPanelStore.getState();
13632
+ if (!store.markAutoOpened(assetId)) return;
13633
+ const existing = store.tabs.find((tab) => tab.id === assetId);
13634
+ const keepCurrentSlide = options.preserveExistingSlide && existing;
13635
+ store.openAsset(assetId, {
13636
+ type: options.type ?? "unknown",
13637
+ ...keepCurrentSlide || options.slideNumber === void 0 ? {} : { slideNumber: options.slideNumber }
13638
+ });
13639
+ };
13640
+ const openOnResult = (type, extra) => ({
13641
+ streamCall: async (reader) => {
13642
+ const { result } = await reader.response.get();
13643
+ const data = normalizeResult$2(result);
13644
+ const assetId = pickAssetId(
13645
+ data == null ? void 0 : data.asset_id,
13646
+ data == null ? void 0 : data.assetId,
13647
+ data == null ? void 0 : data.id
13648
+ );
13649
+ if (!assetId) return;
13650
+ let slideNumber;
13651
+ if ((extra == null ? void 0 : extra.slideNumberFrom) !== "args") {
13652
+ slideNumber = pickNumber(
13653
+ data == null ? void 0 : data.slide_number,
13654
+ data == null ? void 0 : data.slideNumber,
13655
+ data == null ? void 0 : data.targetSlideNumber,
13656
+ data == null ? void 0 : data.target_slide_number
13657
+ );
13658
+ }
13659
+ if (slideNumber === void 0 && (extra == null ? void 0 : extra.slideNumberFrom) !== "result") {
13660
+ const args = await reader.args.get().catch(() => null);
13661
+ slideNumber = pickNumber(
13662
+ args == null ? void 0 : args.slide_number,
13663
+ args == null ? void 0 : args.slideNumber,
13664
+ args == null ? void 0 : args.targetSlideNumber,
13665
+ args == null ? void 0 : args.target_slide_number
13666
+ );
13667
+ }
13668
+ autoOpen(assetId, {
13669
+ type,
13670
+ slideNumber,
13671
+ preserveExistingSlide: extra == null ? void 0 : extra.preserveExistingSlide
13672
+ });
13673
+ }
13674
+ });
13675
+ const openFromArgs = (type) => ({
13676
+ streamCall: async (reader) => {
13677
+ await reader.response.get();
13678
+ const args = await reader.args.get().catch(() => null);
13679
+ const assetId = pickAssetId(args == null ? void 0 : args.asset_id, args == null ? void 0 : args.assetId);
13680
+ if (!assetId) return;
13681
+ autoOpen(assetId, { type });
13682
+ }
13683
+ });
13684
+ const DEFAULT_AUTO_OPEN_TOOLS = {
13685
+ // Top-level asset creators
13686
+ create_new_document: openOnResult("document"),
13687
+ create_document_from_markdown: openOnResult("document"),
13688
+ create_new_sheet: openOnResult("spreadsheet"),
13689
+ create_powerpoint_deck: openOnResult("presentation"),
13690
+ create_new_notebook: openOnResult("notebook"),
13691
+ // Open / read existing assets
13692
+ open_asset_in_workspace: openFromArgs("unknown"),
13693
+ // Code execution that lands on a deck/slide
13694
+ execute_presentation_code: openOnResult("presentation"),
13695
+ // Media capture
13696
+ capture_moment: openOnResult("unknown"),
13697
+ // Studio PTC sub-calls (nested SDK commands)
13698
+ CreateWorkbook: openOnResult("spreadsheet"),
13699
+ AddSheet: openOnResult("spreadsheet"),
13700
+ OpenWorkbook: openOnResult("spreadsheet"),
13701
+ CreatePresentation: openOnResult("presentation"),
13702
+ OpenPresentation: openOnResult("presentation", { preserveExistingSlide: true }),
13703
+ AddSlide: openOnResult("presentation"),
13704
+ CreateDocument: openOnResult("document"),
13705
+ CreateParagraph: openOnResult("document"),
13706
+ OpenDocument: openOnResult("document")
13707
+ };
13708
+ const AthenaContext = React.createContext(null);
13709
+ function useAthenaConfig() {
13710
+ const ctx = React.useContext(AthenaContext);
13711
+ if (!ctx) {
13712
+ throw new Error("[AthenaSDK] useAthenaConfig must be used within <AthenaProvider>");
13713
+ }
13714
+ return ctx;
13715
+ }
13716
+ const AthenaThreadIdContext = React.createContext(void 0);
13717
+ function selectThreadListItemRemoteId(state) {
13718
+ var _a2;
13719
+ return (_a2 = state.threadListItem) == null ? void 0 : _a2.remoteId;
13720
+ }
13721
+ function useAthenaAuiThreadRemoteId() {
13722
+ return react$1.useAuiState(selectThreadListItemRemoteId);
13723
+ }
13724
+ function useAthenaThreadId() {
13725
+ return React.useContext(AthenaThreadIdContext);
13726
+ }
13727
+ function useAthenaThreadListAdapter(config2) {
13728
+ const configRef = React.useRef(config2);
13729
+ configRef.current = config2;
13730
+ const auth = React.useMemo(
13731
+ () => ({ apiKey: config2.apiKey, token: config2.token }),
13732
+ [config2.apiKey, config2.token]
13733
+ );
13734
+ const unstable_Provider = React.useCallback(
13735
+ function AthenaThreadProvider({ children }) {
13736
+ const remoteId = useAthenaAuiThreadRemoteId();
13737
+ return /* @__PURE__ */ jsxRuntime.jsx(AthenaThreadIdContext.Provider, { value: remoteId, children });
13738
+ },
13739
+ []
13740
+ );
13741
+ return React.useMemo(() => ({
13742
+ async list() {
13743
+ if (!auth.token && !auth.apiKey) {
13744
+ return { threads: [] };
13745
+ }
13746
+ try {
13747
+ const { threads } = await listThreads(configRef.current.backendUrl, auth, {
13748
+ ...configRef.current.appId ? { app_id: configRef.current.appId } : {}
13749
+ });
13750
+ return {
13751
+ threads: threads.map((t) => ({
13752
+ status: "regular",
13753
+ remoteId: t.thread_id,
13754
+ title: t.title || void 0
13755
+ }))
13756
+ };
13757
+ } catch (err) {
13758
+ console.error("[AthenaSDK] adapter.list() failed:", err);
13759
+ return { threads: [] };
13760
+ }
13761
+ },
13762
+ async initialize(_threadId) {
13763
+ const remoteId = typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `thread_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
13764
+ return { remoteId, externalId: void 0 };
13765
+ },
13766
+ async rename(_remoteId, _newTitle) {
13767
+ },
13768
+ async archive(remoteId) {
13769
+ await archiveThread(configRef.current.backendUrl, auth, remoteId);
13770
+ },
13771
+ async unarchive(_remoteId) {
13772
+ },
13773
+ async delete(remoteId) {
13774
+ await archiveThread(configRef.current.backendUrl, auth, remoteId);
13775
+ },
13776
+ async generateTitle(_remoteId, _messages) {
13777
+ return new ReadableStream({ start(c) {
13778
+ c.close();
13779
+ } });
13780
+ },
13781
+ async fetch(remoteId) {
13782
+ return {
13783
+ status: "regular",
13784
+ remoteId
13785
+ };
13786
+ },
13787
+ unstable_Provider
13788
+ }), [auth, unstable_Provider]);
13789
+ }
13790
+ const ThreadListRefreshContext = React.createContext(null);
13791
+ function useRefreshThreadList() {
13792
+ return React.useContext(ThreadListRefreshContext);
13793
+ }
13794
+ const LOCAL_ID_PREFIX$1 = "__LOCALID_";
13795
+ const isLocalPlaceholder$1 = (id) => !!id && id.startsWith(LOCAL_ID_PREFIX$1);
13796
+ const selectHydratableThreadId = (state) => {
13797
+ var _a2;
13798
+ const remoteId = ((_a2 = state.metadata) == null ? void 0 : _a2.remoteId) ?? state.threadId;
13799
+ return isLocalPlaceholder$1(remoteId) ? null : remoteId;
13800
+ };
13801
+ const createHydrationKey = ({
13802
+ backendUrl,
13803
+ threadId,
13804
+ apiKey,
13805
+ token
13806
+ }) => {
13807
+ const authMode = token ? "bearer" : apiKey ? "api-key" : "none";
13808
+ return `${backendUrl}::${authMode}::${threadId}`;
13809
+ };
13810
+ function useActiveThreadStateHydration({
13811
+ backendUrl,
13812
+ apiKey,
13813
+ token
13814
+ }) {
13815
+ const runtime = react$1.useAssistantRuntime({ optional: true });
13816
+ const threadId = react$1.useThread({
13817
+ optional: true,
13818
+ selector: selectHydratableThreadId
13819
+ }) ?? null;
13820
+ const messageCount = react$1.useThread({
13821
+ optional: true,
13822
+ selector: (state) => state.messages.length
13823
+ }) ?? 0;
13824
+ const isRunning = react$1.useThread({
13825
+ optional: true,
13826
+ selector: (state) => state.isRunning
13827
+ }) ?? false;
13828
+ const activeThreadIdRef = React.useRef(threadId);
13829
+ activeThreadIdRef.current = threadId;
13830
+ const hydratedKeysRef = React.useRef(/* @__PURE__ */ new Set());
13831
+ React.useEffect(() => {
13832
+ if (!runtime || !threadId || isRunning || messageCount > 0) {
13833
+ return;
13834
+ }
13835
+ if (!token && !apiKey) {
13836
+ return;
13837
+ }
13838
+ const hydrationKey = createHydrationKey({
13839
+ backendUrl,
13840
+ threadId,
13841
+ apiKey,
13842
+ token
13843
+ });
13844
+ if (hydratedKeysRef.current.has(hydrationKey)) {
13845
+ return;
13846
+ }
13847
+ let cancelled = false;
13848
+ (async () => {
13849
+ try {
13850
+ const state = await getThreadState(backendUrl, { apiKey, token }, threadId);
13851
+ if (cancelled || activeThreadIdRef.current !== threadId) {
13852
+ return;
13853
+ }
13854
+ if (runtime.thread.getState().messages.length > 0) {
13855
+ return;
13856
+ }
13857
+ runtime.thread.importExternalState(state);
13858
+ hydratedKeysRef.current.add(hydrationKey);
13859
+ } catch (error2) {
13860
+ console.warn("[AthenaSDK] Failed to hydrate active thread state:", error2);
13861
+ }
13862
+ })();
13863
+ return () => {
13864
+ cancelled = true;
13865
+ };
13866
+ }, [apiKey, backendUrl, isRunning, messageCount, runtime, threadId, token]);
13867
+ }
13868
+ const LOCAL_ID_PREFIX = "__LOCALID_";
13869
+ const isLocalPlaceholder = (id) => !!id && id.startsWith(LOCAL_ID_PREFIX);
13870
+ const selectActiveThreadRemoteId = (state) => {
13871
+ const { mainThreadId, threadItems } = state;
13872
+ if (!mainThreadId) {
13873
+ return null;
13874
+ }
13875
+ const item = threadItems[mainThreadId];
13876
+ const remoteId = item ? item.remoteId ?? null : mainThreadId;
13877
+ return isLocalPlaceholder(remoteId) ? null : remoteId;
13878
+ };
13879
+ function useAthenaThreadManager() {
13880
+ const runtime = react$1.useAssistantRuntime({ optional: true });
13881
+ const activeThreadId = react$1.useThreadList({
13882
+ optional: true,
13883
+ selector: selectActiveThreadRemoteId
13884
+ }) ?? null;
13885
+ const isThreadLoading = react$1.useThread({ optional: true, selector: (s) => s.isLoading }) ?? false;
13886
+ const isListLoading = react$1.useThreadList({
13887
+ optional: true,
13888
+ selector: (s) => s.isLoading
13889
+ });
13890
+ const runtimeRef = React.useRef(runtime);
13891
+ runtimeRef.current = runtime;
13892
+ const switchToThread = React.useCallback(
13893
+ (id) => runtimeRef.current.threads.switchToThread(id),
13894
+ []
13895
+ );
13896
+ const switchToNewThread = React.useCallback(
13897
+ () => runtimeRef.current.threads.switchToNewThread(),
13898
+ []
13899
+ );
13900
+ return React.useMemo(() => {
13901
+ if (!runtime || isListLoading == null) {
13902
+ return null;
13903
+ }
13904
+ return {
13905
+ activeThreadId,
13906
+ isListLoading,
13907
+ isThreadLoading,
13908
+ switchToThread,
13909
+ switchToNewThread
13910
+ };
13911
+ }, [runtime, activeThreadId, isListLoading, isThreadLoading, switchToThread, switchToNewThread]);
13912
+ }
13913
+ const POLL_DELAY_MS = 5e3;
13914
+ const POLL_INTERVAL_MS = 1e3;
13915
+ const POLL_MAX_DURATION_MS = 6e4;
13916
+ function useThreadTitlePolling(refresh) {
13917
+ const threadKey = react$1.useThread({
13918
+ optional: true,
13919
+ selector: (s) => {
13920
+ var _a2, _b;
13921
+ return ((_a2 = s.metadata) == null ? void 0 : _a2.remoteId) ?? ((_b = s.metadata) == null ? void 0 : _b.id) ?? s.threadId;
13922
+ }
13923
+ }) ?? null;
13924
+ const hasMessages = react$1.useThread({
13925
+ optional: true,
13926
+ selector: (s) => s.messages.length > 0
13927
+ }) ?? false;
13928
+ const currentTitle = react$1.useThreadList({
13929
+ optional: true,
13930
+ selector: (s) => {
13931
+ const main = s.threadItems[s.mainThreadId];
13932
+ return (main == null ? void 0 : main.title) ?? "";
13933
+ }
13934
+ }) ?? "";
13935
+ const hasTitle = currentTitle.trim().length > 0;
13936
+ const polledThreadsRef = React.useRef(/* @__PURE__ */ new Set());
13937
+ const refreshRef = React.useRef(refresh);
13938
+ refreshRef.current = refresh;
13939
+ React.useEffect(() => {
13940
+ if (!threadKey || hasTitle || !hasMessages) {
13941
+ return;
13942
+ }
13943
+ if (polledThreadsRef.current.has(threadKey)) {
13944
+ return;
13945
+ }
13946
+ polledThreadsRef.current.add(threadKey);
13947
+ let stopped = false;
13948
+ let intervalId = null;
13949
+ let maxTimeoutId = null;
13950
+ const stop = () => {
13951
+ stopped = true;
13952
+ if (intervalId !== null) {
13953
+ clearInterval(intervalId);
13954
+ intervalId = null;
13955
+ }
13956
+ if (maxTimeoutId !== null) {
13957
+ clearTimeout(maxTimeoutId);
13958
+ maxTimeoutId = null;
13959
+ }
13960
+ };
13961
+ const startTimeoutId = setTimeout(() => {
13962
+ if (stopped) return;
13963
+ refreshRef.current();
13964
+ intervalId = setInterval(() => {
13965
+ refreshRef.current();
13966
+ }, POLL_INTERVAL_MS);
13967
+ maxTimeoutId = setTimeout(stop, POLL_MAX_DURATION_MS - POLL_DELAY_MS);
13968
+ }, POLL_DELAY_MS);
13969
+ return () => {
13970
+ clearTimeout(startTimeoutId);
13971
+ stop();
13972
+ };
13973
+ }, [threadKey, hasTitle, hasMessages]);
13974
+ }
14242
13975
  const THEME_TO_CSS = {
14243
13976
  primary: "--primary",
14244
13977
  primaryForeground: "--primary-foreground",
@@ -14557,7 +14290,7 @@ function AthenaStandalone({
14557
14290
  return /* @__PURE__ */ jsxRuntime.jsx(react$1.AssistantRuntimeProvider, { aui, runtime, children: /* @__PURE__ */ jsxRuntime.jsx(AthenaContext.Provider, { value: athenaConfig, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children }) }) });
14558
14291
  }
14559
14292
  function useAthenaRuntimeHook(config2) {
14560
- const remoteId = useAthenaThreadId();
14293
+ const remoteId = useAthenaAuiThreadRemoteId();
14561
14294
  return useAthenaRuntime({
14562
14295
  apiUrl: config2.apiUrl,
14563
14296
  backendUrl: config2.backendUrl,
@@ -14636,7 +14369,7 @@ function AthenaWithThreadList({
14636
14369
  () => useAthenaRuntimeHook(runtimeConfigRef.current),
14637
14370
  []
14638
14371
  );
14639
- const runtime = react$1.unstable_useRemoteThreadListRuntime({
14372
+ const runtime = react$1.useRemoteThreadListRuntime({
14640
14373
  runtimeHook,
14641
14374
  adapter
14642
14375
  });
@@ -14672,11 +14405,27 @@ function AthenaWithThreadList({
14672
14405
  citationLinks
14673
14406
  });
14674
14407
  return /* @__PURE__ */ jsxRuntime.jsx(react$1.AssistantRuntimeProvider, { aui, runtime, children: /* @__PURE__ */ jsxRuntime.jsx(AthenaContext.Provider, { value: athenaConfig, children: /* @__PURE__ */ jsxRuntime.jsx(ThreadListRefreshContext.Provider, { value: handleRefresh, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipProvider, { children: [
14408
+ /* @__PURE__ */ jsxRuntime.jsx(
14409
+ ActiveThreadStateHydrator,
14410
+ {
14411
+ backendUrl,
14412
+ apiKey,
14413
+ token
14414
+ }
14415
+ ),
14675
14416
  /* @__PURE__ */ jsxRuntime.jsx(AssetPanelThreadSync, {}),
14676
14417
  /* @__PURE__ */ jsxRuntime.jsx(ThreadTitlePoller, { refresh: handleRefresh }),
14677
14418
  children
14678
14419
  ] }) }) }) });
14679
14420
  }
14421
+ function ActiveThreadStateHydrator({
14422
+ backendUrl,
14423
+ apiKey,
14424
+ token
14425
+ }) {
14426
+ useActiveThreadStateHydration({ backendUrl, apiKey, token });
14427
+ return null;
14428
+ }
14680
14429
  function AssetPanelThreadSync() {
14681
14430
  const threads = useAthenaThreadManager();
14682
14431
  const setCurrentThread = useAssetPanelStore((s) => s.setCurrentThread);
@@ -14699,6 +14448,7 @@ function AthenaProvider({
14699
14448
  model,
14700
14449
  tools = [],
14701
14450
  frontendTools = {},
14451
+ disableAutoOpen = false,
14702
14452
  apiUrl,
14703
14453
  backendUrl,
14704
14454
  appUrl,
@@ -14716,6 +14466,10 @@ function AthenaProvider({
14716
14466
  posthog: posthogProp
14717
14467
  }) {
14718
14468
  const frontendToolNames = React.useMemo(() => Object.keys(frontendTools), [frontendTools]);
14469
+ const effectiveFrontendTools = React.useMemo(
14470
+ () => disableAutoOpen ? frontendTools : { ...DEFAULT_AUTO_OPEN_TOOLS, ...frontendTools },
14471
+ [disableAutoOpen, frontendTools]
14472
+ );
14719
14473
  const themeStyleVars = React.useMemo(() => theme ? themeToStyleVars(theme) : void 0, [theme]);
14720
14474
  const configuredEnvironment = (config2 == null ? void 0 : config2.environment) ?? environment;
14721
14475
  const environmentUrls = React.useMemo(
@@ -14755,7 +14509,7 @@ function AthenaProvider({
14755
14509
  agent: agent2,
14756
14510
  tools,
14757
14511
  frontendToolIds: frontendToolNames,
14758
- frontendTools,
14512
+ frontendTools: effectiveFrontendTools,
14759
14513
  workbench,
14760
14514
  knowledgeBase,
14761
14515
  systemPrompt,
@@ -14779,7 +14533,7 @@ function AthenaProvider({
14779
14533
  agent: agent2,
14780
14534
  tools,
14781
14535
  frontendToolIds: frontendToolNames,
14782
- frontendTools,
14536
+ frontendTools: effectiveFrontendTools,
14783
14537
  workbench,
14784
14538
  knowledgeBase,
14785
14539
  systemPrompt,
@@ -45302,51 +45056,51 @@ const createLucideIcon = (iconName, iconNode) => {
45302
45056
  * This source code is licensed under the ISC license.
45303
45057
  * See the LICENSE file in the root directory of this source tree.
45304
45058
  */
45305
- const __iconNode$18 = [
45059
+ const __iconNode$19 = [
45306
45060
  ["path", { d: "M12 5v14", key: "s699le" }],
45307
45061
  ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
45308
45062
  ];
45309
- const ArrowDown = createLucideIcon("arrow-down", __iconNode$18);
45063
+ const ArrowDown = createLucideIcon("arrow-down", __iconNode$19);
45310
45064
  /**
45311
45065
  * @license lucide-react v0.575.0 - ISC
45312
45066
  *
45313
45067
  * This source code is licensed under the ISC license.
45314
45068
  * See the LICENSE file in the root directory of this source tree.
45315
45069
  */
45316
- const __iconNode$17 = [
45070
+ const __iconNode$18 = [
45317
45071
  ["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
45318
45072
  ["path", { d: "M19 12H5", key: "x3x0zl" }]
45319
45073
  ];
45320
- const ArrowLeft = createLucideIcon("arrow-left", __iconNode$17);
45074
+ const ArrowLeft = createLucideIcon("arrow-left", __iconNode$18);
45321
45075
  /**
45322
45076
  * @license lucide-react v0.575.0 - ISC
45323
45077
  *
45324
45078
  * This source code is licensed under the ISC license.
45325
45079
  * See the LICENSE file in the root directory of this source tree.
45326
45080
  */
45327
- const __iconNode$16 = [
45081
+ const __iconNode$17 = [
45328
45082
  ["path", { d: "M5 12h14", key: "1ays0h" }],
45329
45083
  ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
45330
45084
  ];
45331
- const ArrowRight = createLucideIcon("arrow-right", __iconNode$16);
45085
+ const ArrowRight = createLucideIcon("arrow-right", __iconNode$17);
45332
45086
  /**
45333
45087
  * @license lucide-react v0.575.0 - ISC
45334
45088
  *
45335
45089
  * This source code is licensed under the ISC license.
45336
45090
  * See the LICENSE file in the root directory of this source tree.
45337
45091
  */
45338
- const __iconNode$15 = [
45092
+ const __iconNode$16 = [
45339
45093
  ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
45340
45094
  ["path", { d: "M12 19V5", key: "x0mq9r" }]
45341
45095
  ];
45342
- const ArrowUp = createLucideIcon("arrow-up", __iconNode$15);
45096
+ const ArrowUp = createLucideIcon("arrow-up", __iconNode$16);
45343
45097
  /**
45344
45098
  * @license lucide-react v0.575.0 - ISC
45345
45099
  *
45346
45100
  * This source code is licensed under the ISC license.
45347
45101
  * See the LICENSE file in the root directory of this source tree.
45348
45102
  */
45349
- const __iconNode$14 = [
45103
+ const __iconNode$15 = [
45350
45104
  ["path", { d: "M12 7v14", key: "1akyts" }],
45351
45105
  [
45352
45106
  "path",
@@ -45356,14 +45110,14 @@ const __iconNode$14 = [
45356
45110
  }
45357
45111
  ]
45358
45112
  ];
45359
- const BookOpen = createLucideIcon("book-open", __iconNode$14);
45113
+ const BookOpen = createLucideIcon("book-open", __iconNode$15);
45360
45114
  /**
45361
45115
  * @license lucide-react v0.575.0 - ISC
45362
45116
  *
45363
45117
  * This source code is licensed under the ISC license.
45364
45118
  * See the LICENSE file in the root directory of this source tree.
45365
45119
  */
45366
- const __iconNode$13 = [
45120
+ const __iconNode$14 = [
45367
45121
  [
45368
45122
  "path",
45369
45123
  {
@@ -45395,14 +45149,14 @@ const __iconNode$13 = [
45395
45149
  ["path", { d: "m12 8 4.74-2.85", key: "3rx089" }],
45396
45150
  ["path", { d: "M12 13.5V8", key: "1io7kd" }]
45397
45151
  ];
45398
- const Boxes = createLucideIcon("boxes", __iconNode$13);
45152
+ const Boxes = createLucideIcon("boxes", __iconNode$14);
45399
45153
  /**
45400
45154
  * @license lucide-react v0.575.0 - ISC
45401
45155
  *
45402
45156
  * This source code is licensed under the ISC license.
45403
45157
  * See the LICENSE file in the root directory of this source tree.
45404
45158
  */
45405
- const __iconNode$12 = [
45159
+ const __iconNode$13 = [
45406
45160
  ["path", { d: "M12 18V5", key: "adv99a" }],
45407
45161
  ["path", { d: "M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4", key: "1e3is1" }],
45408
45162
  ["path", { d: "M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5", key: "1gqd8o" }],
@@ -45412,27 +45166,27 @@ const __iconNode$12 = [
45412
45166
  ["path", { d: "M6 18a4 4 0 0 1-2-7.464", key: "k1g0md" }],
45413
45167
  ["path", { d: "M6.003 5.125a4 4 0 0 0-2.526 5.77", key: "q97ue3" }]
45414
45168
  ];
45415
- const Brain = createLucideIcon("brain", __iconNode$12);
45169
+ const Brain = createLucideIcon("brain", __iconNode$13);
45416
45170
  /**
45417
45171
  * @license lucide-react v0.575.0 - ISC
45418
45172
  *
45419
45173
  * This source code is licensed under the ISC license.
45420
45174
  * See the LICENSE file in the root directory of this source tree.
45421
45175
  */
45422
- const __iconNode$11 = [
45176
+ const __iconNode$12 = [
45423
45177
  ["path", { d: "M12 12h.01", key: "1mp3jc" }],
45424
45178
  ["path", { d: "M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2", key: "1ksdt3" }],
45425
45179
  ["path", { d: "M22 13a18.15 18.15 0 0 1-20 0", key: "12hx5q" }],
45426
45180
  ["rect", { width: "20", height: "14", x: "2", y: "6", rx: "2", key: "i6l2r4" }]
45427
45181
  ];
45428
- const BriefcaseBusiness = createLucideIcon("briefcase-business", __iconNode$11);
45182
+ const BriefcaseBusiness = createLucideIcon("briefcase-business", __iconNode$12);
45429
45183
  /**
45430
45184
  * @license lucide-react v0.575.0 - ISC
45431
45185
  *
45432
45186
  * This source code is licensed under the ISC license.
45433
45187
  * See the LICENSE file in the root directory of this source tree.
45434
45188
  */
45435
- const __iconNode$10 = [
45189
+ const __iconNode$11 = [
45436
45190
  [
45437
45191
  "path",
45438
45192
  { d: "M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z", key: "trhst0" }
@@ -45447,27 +45201,27 @@ const __iconNode$10 = [
45447
45201
  ],
45448
45202
  ["path", { d: "M7 5V3", key: "1t1388" }]
45449
45203
  ];
45450
- const Cable = createLucideIcon("cable", __iconNode$10);
45204
+ const Cable = createLucideIcon("cable", __iconNode$11);
45451
45205
  /**
45452
45206
  * @license lucide-react v0.575.0 - ISC
45453
45207
  *
45454
45208
  * This source code is licensed under the ISC license.
45455
45209
  * See the LICENSE file in the root directory of this source tree.
45456
45210
  */
45457
- const __iconNode$$ = [
45211
+ const __iconNode$10 = [
45458
45212
  ["path", { d: "M8 2v4", key: "1cmpym" }],
45459
45213
  ["path", { d: "M16 2v4", key: "4m81vk" }],
45460
45214
  ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
45461
45215
  ["path", { d: "M3 10h18", key: "8toen8" }]
45462
45216
  ];
45463
- const Calendar = createLucideIcon("calendar", __iconNode$$);
45217
+ const Calendar = createLucideIcon("calendar", __iconNode$10);
45464
45218
  /**
45465
45219
  * @license lucide-react v0.575.0 - ISC
45466
45220
  *
45467
45221
  * This source code is licensed under the ISC license.
45468
45222
  * See the LICENSE file in the root directory of this source tree.
45469
45223
  */
45470
- const __iconNode$_ = [
45224
+ const __iconNode$$ = [
45471
45225
  [
45472
45226
  "path",
45473
45227
  {
@@ -45477,57 +45231,65 @@ const __iconNode$_ = [
45477
45231
  ],
45478
45232
  ["circle", { cx: "12", cy: "13", r: "3", key: "1vg3eu" }]
45479
45233
  ];
45480
- const Camera = createLucideIcon("camera", __iconNode$_);
45234
+ const Camera = createLucideIcon("camera", __iconNode$$);
45481
45235
  /**
45482
45236
  * @license lucide-react v0.575.0 - ISC
45483
45237
  *
45484
45238
  * This source code is licensed under the ISC license.
45485
45239
  * See the LICENSE file in the root directory of this source tree.
45486
45240
  */
45487
- const __iconNode$Z = [
45241
+ const __iconNode$_ = [
45488
45242
  ["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
45489
45243
  ["path", { d: "M7 16h8", key: "srdodz" }],
45490
45244
  ["path", { d: "M7 11h12", key: "127s9w" }],
45491
45245
  ["path", { d: "M7 6h3", key: "w9rmul" }]
45492
45246
  ];
45493
- const ChartBar = createLucideIcon("chart-bar", __iconNode$Z);
45247
+ const ChartBar = createLucideIcon("chart-bar", __iconNode$_);
45494
45248
  /**
45495
45249
  * @license lucide-react v0.575.0 - ISC
45496
45250
  *
45497
45251
  * This source code is licensed under the ISC license.
45498
45252
  * See the LICENSE file in the root directory of this source tree.
45499
45253
  */
45500
- const __iconNode$Y = [
45254
+ const __iconNode$Z = [
45501
45255
  ["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
45502
45256
  ["path", { d: "M18 17V9", key: "2bz60n" }],
45503
45257
  ["path", { d: "M13 17V5", key: "1frdt8" }],
45504
45258
  ["path", { d: "M8 17v-3", key: "17ska0" }]
45505
45259
  ];
45506
- const ChartColumn = createLucideIcon("chart-column", __iconNode$Y);
45260
+ const ChartColumn = createLucideIcon("chart-column", __iconNode$Z);
45261
+ /**
45262
+ * @license lucide-react v0.575.0 - ISC
45263
+ *
45264
+ * This source code is licensed under the ISC license.
45265
+ * See the LICENSE file in the root directory of this source tree.
45266
+ */
45267
+ const __iconNode$Y = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
45268
+ const Check = createLucideIcon("check", __iconNode$Y);
45507
45269
  /**
45508
45270
  * @license lucide-react v0.575.0 - ISC
45509
45271
  *
45510
45272
  * This source code is licensed under the ISC license.
45511
45273
  * See the LICENSE file in the root directory of this source tree.
45512
45274
  */
45513
- const __iconNode$X = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
45514
- const Check = createLucideIcon("check", __iconNode$X);
45275
+ const __iconNode$X = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
45276
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$X);
45515
45277
  /**
45516
45278
  * @license lucide-react v0.575.0 - ISC
45517
45279
  *
45518
45280
  * This source code is licensed under the ISC license.
45519
45281
  * See the LICENSE file in the root directory of this source tree.
45520
45282
  */
45521
- const __iconNode$W = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
45522
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$W);
45283
+ const __iconNode$W = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
45284
+ const ChevronRight = createLucideIcon("chevron-right", __iconNode$W);
45523
45285
  /**
45524
45286
  * @license lucide-react v0.575.0 - ISC
45525
45287
  *
45526
45288
  * This source code is licensed under the ISC license.
45527
45289
  * See the LICENSE file in the root directory of this source tree.
45528
45290
  */
45529
- const __iconNode$V = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
45530
- const ChevronRight = createLucideIcon("chevron-right", __iconNode$V);
45291
+ const __iconNode$V = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
45292
+ const ChevronUp = createLucideIcon("chevron-up", __iconNode$V);
45531
45293
  /**
45532
45294
  * @license lucide-react v0.575.0 - ISC
45533
45295
  *
@@ -46402,7 +46164,7 @@ const DEFAULT_PILL_STYLE = "border-gray-300 bg-gray-50 text-gray-800 dark:border
46402
46164
  function MentionNodeView({ node }) {
46403
46165
  const { type, name, params } = node.attrs;
46404
46166
  const config2 = getMentionConfig(type);
46405
- const icon = isRecord(params) && typeof params.icon === "string" ? params.icon : (config2 == null ? void 0 : config2.style.icon) ?? "📎";
46167
+ const icon = isRecord$1(params) && typeof params.icon === "string" ? params.icon : (config2 == null ? void 0 : config2.style.icon) ?? "📎";
46406
46168
  const pillStyle = PILL_STYLES[type] ?? DEFAULT_PILL_STYLE;
46407
46169
  return /* @__PURE__ */ jsxRuntime.jsx(NodeViewWrapper, { as: "span", children: /* @__PURE__ */ jsxRuntime.jsxs(
46408
46170
  "span",
@@ -49668,7 +49430,7 @@ function getToolMeta(toolName) {
49668
49430
  const displayName = toolName.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
49669
49431
  return { displayName, icon: Wrench };
49670
49432
  }
49671
- function tryParseJson$2(text2) {
49433
+ function tryParseJson$1(text2) {
49672
49434
  try {
49673
49435
  const parsed = JSON.parse(text2);
49674
49436
  if (typeof parsed === "object" && parsed !== null) return parsed;
@@ -49678,7 +49440,7 @@ function tryParseJson$2(text2) {
49678
49440
  }
49679
49441
  function extractResultMessage(result) {
49680
49442
  if (typeof result === "string") {
49681
- const parsed = tryParseJson$2(result);
49443
+ const parsed = tryParseJson$1(result);
49682
49444
  if (parsed && typeof parsed.message === "string") return parsed.message;
49683
49445
  return null;
49684
49446
  }
@@ -49690,7 +49452,7 @@ function extractResultMessage(result) {
49690
49452
  }
49691
49453
  function isResultSuccess(result) {
49692
49454
  if (typeof result === "string") {
49693
- const parsed = tryParseJson$2(result);
49455
+ const parsed = tryParseJson$1(result);
49694
49456
  if (parsed) return parsed.success === true;
49695
49457
  }
49696
49458
  if (typeof result === "object" && result !== null) {
@@ -49712,7 +49474,7 @@ function extractAssetId$1(result) {
49712
49474
  }
49713
49475
  function extractAssetIdFromArgs(argsText) {
49714
49476
  if (!argsText) return null;
49715
- const parsed = tryParseJson$2(argsText);
49477
+ const parsed = tryParseJson$1(argsText);
49716
49478
  if (!parsed) return null;
49717
49479
  const id = parsed.asset_id ?? parsed.assetId;
49718
49480
  if (typeof id === "string" && id.startsWith("asset_")) return id;
@@ -49742,7 +49504,7 @@ function isAssetTool(toolName, result) {
49742
49504
  }
49743
49505
  function extractTitle(argsText, result) {
49744
49506
  if (argsText) {
49745
- const args = tryParseJson$2(argsText);
49507
+ const args = tryParseJson$1(argsText);
49746
49508
  if (args) {
49747
49509
  const t = args.title ?? args.name ?? args.filename ?? args.sheet_name;
49748
49510
  if (t) return t;
@@ -49823,7 +49585,7 @@ function ToolFallbackTrigger({
49823
49585
  const success = isComplete && isResultSuccess(result);
49824
49586
  const summary = React.useMemo(() => {
49825
49587
  if (isRunning || !meta.describer || !argsText) return null;
49826
- const parsed = tryParseJson$2(argsText);
49588
+ const parsed = tryParseJson$1(argsText);
49827
49589
  if (!parsed) return null;
49828
49590
  const desc = meta.describer(parsed);
49829
49591
  return desc || null;
@@ -49932,7 +49694,7 @@ function ToolFallbackArgs({
49932
49694
  ...props
49933
49695
  }) {
49934
49696
  if (!argsText) return null;
49935
- const parsed = tryParseJson$2(argsText);
49697
+ const parsed = tryParseJson$1(argsText);
49936
49698
  if (!parsed) {
49937
49699
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-3", className), ...props, children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap text-xs text-muted-foreground", children: argsText }) });
49938
49700
  }
@@ -49956,7 +49718,7 @@ function ToolFallbackResult({
49956
49718
  const displayValue = React.useMemo(() => {
49957
49719
  if (result === void 0) return "";
49958
49720
  if (typeof result === "string") {
49959
- const parsed = tryParseJson$2(result);
49721
+ const parsed = tryParseJson$1(result);
49960
49722
  return parsed ? JSON.stringify(parsed, null, 2) : result;
49961
49723
  }
49962
49724
  return JSON.stringify(result, null, 2);
@@ -50000,12 +49762,12 @@ function CopyToolSpec({
50000
49762
  const handleCopy = React.useCallback(() => {
50001
49763
  const spec = { tool_name: toolName };
50002
49764
  if (argsText) {
50003
- const parsed = tryParseJson$2(argsText);
49765
+ const parsed = tryParseJson$1(argsText);
50004
49766
  spec.arguments = parsed ?? argsText;
50005
49767
  }
50006
49768
  if (result !== void 0) {
50007
49769
  if (typeof result === "string") {
50008
- const parsed = tryParseJson$2(result);
49770
+ const parsed = tryParseJson$1(result);
50009
49771
  spec.result = parsed ?? result;
50010
49772
  } else {
50011
49773
  spec.result = result;
@@ -50194,17 +49956,6 @@ ToolFallback.Content = ToolFallbackContent;
50194
49956
  ToolFallback.Args = ToolFallbackArgs;
50195
49957
  ToolFallback.Result = ToolFallbackResult;
50196
49958
  ToolFallback.Error = ToolFallbackError;
50197
- function getAssetInfo(assetId) {
50198
- return { name: assetId || "Document", icon: "doc" };
50199
- }
50200
- function tryParseJson$1(text2) {
50201
- try {
50202
- const p = JSON.parse(text2);
50203
- return typeof p === "object" && p !== null ? p : null;
50204
- } catch {
50205
- return null;
50206
- }
50207
- }
50208
49959
  const markdownPreviewExtensions = [
50209
49960
  StarterKit.configure({
50210
49961
  codeBlock: {
@@ -50253,10 +50004,10 @@ const AppendDocumentToolUIImpl = ({
50253
50004
  const typedArgs = args;
50254
50005
  const resultData = React.useMemo(() => {
50255
50006
  if (!result) return null;
50256
- if (typeof result === "string") return tryParseJson$1(result);
50007
+ if (typeof result === "string") return tryParseJson$2(result);
50257
50008
  if (typeof result === "object") {
50258
50009
  const obj = result;
50259
- if (typeof obj.result === "string") return tryParseJson$1(obj.result) ?? obj;
50010
+ if (typeof obj.result === "string") return tryParseJson$2(obj.result) ?? obj;
50260
50011
  return obj;
50261
50012
  }
50262
50013
  return null;
@@ -50338,11 +50089,11 @@ const AppendDocumentToolUI = React.memo(
50338
50089
  );
50339
50090
  AppendDocumentToolUI.displayName = "AppendDocumentToolUI";
50340
50091
  function normalizeResult$1(result) {
50341
- if (typeof result === "string") return tryParseJson$1(result) ?? result;
50092
+ if (typeof result === "string") return tryParseJson$2(result) ?? result;
50342
50093
  if (typeof result === "object" && result !== null) {
50343
50094
  const obj = result;
50344
50095
  if (typeof obj.result === "string")
50345
- return tryParseJson$1(obj.result) ?? obj.result;
50096
+ return tryParseJson$2(obj.result) ?? obj.result;
50346
50097
  return obj;
50347
50098
  }
50348
50099
  return result;
@@ -52979,6 +52730,480 @@ const TOOL_UI_REGISTRY = {
52979
52730
  run_database_sql: RunSqlToolUI,
52980
52731
  run_sql_query_tool: RunSqlToolUI
52981
52732
  };
52733
+ const TOOLKIT_THEMES = {
52734
+ Web: { color: "#7BCCFA" },
52735
+ Document: { color: "#4586F9" },
52736
+ "Document (Word)": { color: "#4586F9" },
52737
+ Notebook: { color: "#FFAB00" },
52738
+ Python: { color: "#00A76F" },
52739
+ Spreadsheet: { color: "#00A76F" },
52740
+ Email: { color: "#B584FF" },
52741
+ AOP: { color: "#336DFF" },
52742
+ App: { color: "#7336F5" },
52743
+ "Presentation (PowerPoint)": { color: "#F56B36" },
52744
+ Presentation: { color: "#F56B36" },
52745
+ "User Interface": { color: "#7336F5" },
52746
+ Canvas: { color: "#002542" },
52747
+ Computer: { color: "#3E0042" },
52748
+ Database: { color: "#7336F5" }
52749
+ };
52750
+ const DEFAULT_THEME = { color: "#919EAB" };
52751
+ const CollapsibleGroup = ({ groupKey, indices, children }) => {
52752
+ const isMessageRunning = react$1.useAuiState((s) => {
52753
+ var _a2;
52754
+ return ((_a2 = s.message.status) == null ? void 0 : _a2.type) === "running";
52755
+ });
52756
+ const [userOpened, setOpen] = React.useState();
52757
+ const open = userOpened ?? isMessageRunning;
52758
+ const toolCallCount = react$1.useAuiState((s) => {
52759
+ if (s.message.role !== "assistant") return 0;
52760
+ const parts = s.message.content;
52761
+ if (!parts) return 0;
52762
+ return indices.reduce((acc, idx) => {
52763
+ const part = parts[idx];
52764
+ return (part == null ? void 0 : part.type) === "tool-call" ? acc + 1 : acc;
52765
+ }, 0);
52766
+ });
52767
+ const theme = React.useMemo(
52768
+ () => groupKey ? TOOLKIT_THEMES[groupKey] ?? DEFAULT_THEME : DEFAULT_THEME,
52769
+ [groupKey]
52770
+ );
52771
+ if (!groupKey || indices.length <= 1) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
52772
+ return /* @__PURE__ */ jsxRuntime.jsxs(
52773
+ "div",
52774
+ {
52775
+ className: "my-4 rounded-2xl border shadow-sm",
52776
+ style: {
52777
+ borderColor: `${theme.color}33`,
52778
+ background: `linear-gradient(to right, ${theme.color}0d, transparent, ${theme.color}0d)`
52779
+ },
52780
+ children: [
52781
+ /* @__PURE__ */ jsxRuntime.jsxs(
52782
+ "button",
52783
+ {
52784
+ type: "button",
52785
+ onClick: () => setOpen(!open),
52786
+ className: "flex w-full items-center justify-between gap-3 rounded-2xl px-5 py-3 transition-colors hover:bg-black/5 dark:hover:bg-white/5",
52787
+ "aria-expanded": open,
52788
+ children: [
52789
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 text-foreground/90", children: [
52790
+ /* @__PURE__ */ jsxRuntime.jsx(
52791
+ "span",
52792
+ {
52793
+ className: "inline-block size-2 rounded-full",
52794
+ style: { backgroundColor: theme.color },
52795
+ "aria-hidden": "true"
52796
+ }
52797
+ ),
52798
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-semibold", children: [
52799
+ isMessageRunning ? "Using " : "Used ",
52800
+ groupKey,
52801
+ " Toolkit"
52802
+ ] })
52803
+ ] }),
52804
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
52805
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs font-medium text-muted-foreground", children: [
52806
+ toolCallCount,
52807
+ " tool ",
52808
+ toolCallCount === 1 ? "call" : "calls"
52809
+ ] }),
52810
+ open ? /* @__PURE__ */ jsxRuntime.jsx(ChevronUp, { size: 16 }) : /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, { size: 16 })
52811
+ ] })
52812
+ ]
52813
+ }
52814
+ ),
52815
+ /* @__PURE__ */ jsxRuntime.jsx(
52816
+ "div",
52817
+ {
52818
+ className: cn(
52819
+ "grid overflow-hidden border-t transition-[grid-template-rows] duration-200 ease-in-out",
52820
+ open ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
52821
+ ),
52822
+ style: { borderColor: `${theme.color}33` },
52823
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2 px-5 py-4", children }) })
52824
+ }
52825
+ )
52826
+ ]
52827
+ }
52828
+ );
52829
+ };
52830
+ const createToolBasedGroupingFunction = (getToolGroupKey) => (parts) => {
52831
+ const groups = [];
52832
+ let currentGroup = null;
52833
+ for (let idx = 0; idx < parts.length; idx++) {
52834
+ const part = parts[idx];
52835
+ if ((part == null ? void 0 : part.type) === "reasoning") {
52836
+ if (currentGroup) {
52837
+ currentGroup.indices.push(idx);
52838
+ } else {
52839
+ groups.push({ groupKey: void 0, indices: [idx] });
52840
+ }
52841
+ continue;
52842
+ }
52843
+ let key;
52844
+ if ((part == null ? void 0 : part.type) === "tool-call" && part.toolName) {
52845
+ key = getToolGroupKey(part.toolName);
52846
+ } else if ((part == null ? void 0 : part.type) === "text") {
52847
+ const prevKey = currentGroup == null ? void 0 : currentGroup.groupKey;
52848
+ let nextKey;
52849
+ for (let lookIdx = idx + 1; lookIdx < parts.length; lookIdx++) {
52850
+ const lookPart = parts[lookIdx];
52851
+ if ((lookPart == null ? void 0 : lookPart.type) === "reasoning" || (lookPart == null ? void 0 : lookPart.type) === "text") continue;
52852
+ if ((lookPart == null ? void 0 : lookPart.type) === "tool-call" && lookPart.toolName) {
52853
+ nextKey = getToolGroupKey(lookPart.toolName);
52854
+ }
52855
+ break;
52856
+ }
52857
+ if (prevKey && nextKey && prevKey === nextKey) {
52858
+ key = prevKey;
52859
+ }
52860
+ }
52861
+ if (currentGroup && currentGroup.groupKey === key) {
52862
+ currentGroup.indices.push(idx);
52863
+ } else {
52864
+ if (currentGroup) groups.push(currentGroup);
52865
+ currentGroup = { groupKey: key, indices: [idx] };
52866
+ }
52867
+ }
52868
+ if (currentGroup) groups.push(currentGroup);
52869
+ return groups;
52870
+ };
52871
+ const TOOL_STATUS_LABELS = {
52872
+ // Document tools
52873
+ read_asset: { running: "Reviewing asset content", complete: "Asset content reviewed" },
52874
+ read_full_asset: { running: "Reviewing asset content", complete: "Asset content reviewed" },
52875
+ create_new_document: { running: "Creating document", complete: "Created document" },
52876
+ create_document_from_markdown: { running: "Creating document", complete: "Created document" },
52877
+ append_markdown_to_athena_document: { running: "Updating document", complete: "Updated document" },
52878
+ replace_markdown_in_athena_document: { running: "Updating document", complete: "Updated document" },
52879
+ convert_athena_doc_to_pdf: { running: "Converting to PDF", complete: "Converted to PDF" },
52880
+ convert_to_pdf: { running: "Converting to PDF", complete: "Converted to PDF" },
52881
+ // Spreadsheet tools
52882
+ create_new_sheet: { running: "Creating spreadsheet", complete: "Created spreadsheet" },
52883
+ update_sheet_range: { running: "Updating spreadsheet", complete: "Updated spreadsheet" },
52884
+ format_sheet_range: { running: "Formatting spreadsheet", complete: "Formatted spreadsheet" },
52885
+ bulk_format_sheet_range: { running: "Formatting spreadsheet ranges", complete: "Formatted spreadsheet ranges" },
52886
+ create_table: { running: "Creating table", complete: "Created table" },
52887
+ update_table: { running: "Updating table", complete: "Updated table" },
52888
+ create_chart: { running: "Creating chart", complete: "Created chart" },
52889
+ update_chart: { running: "Updating chart", complete: "Updated chart" },
52890
+ // Web / search
52891
+ search: { running: "Searching the web", complete: "Web search complete" },
52892
+ browse: { running: "Reading webpage", complete: "Read webpage" },
52893
+ web_search: { running: "Searching the web", complete: "Web search complete" },
52894
+ search_web: { running: "Searching the web", complete: "Web search complete" },
52895
+ web_scrape: { running: "Reading webpage", complete: "Read webpage" },
52896
+ scrape_web: { running: "Reading webpage", complete: "Read webpage" },
52897
+ open_asset_in_workspace: { running: "Opening in workspace", complete: "Opened in workspace" },
52898
+ // Email / calendar
52899
+ create_email_draft: { running: "Drafting email", complete: "Email drafted" },
52900
+ send_email: { running: "Sending email", complete: "Email sent" },
52901
+ unified_email_create_draft: { running: "Drafting email", complete: "Email drafted" },
52902
+ unified_email_send: { running: "Sending email", complete: "Email sent" },
52903
+ unified_email_edit_draft: { running: "Editing email draft", complete: "Draft updated" },
52904
+ search_email: { running: "Searching email", complete: "Email search complete" },
52905
+ unified_email_search: { running: "Searching email", complete: "Email search complete" },
52906
+ // Python / code execution
52907
+ run_python: { running: "Running Python code", complete: "Python execution complete" },
52908
+ run_python_code: { running: "Running Python code", complete: "Python execution complete" },
52909
+ run_sql: { running: "Running database query", complete: "Query complete" },
52910
+ execute_sql: { running: "Running database query", complete: "Query complete" },
52911
+ run_database_sql: { running: "Running database query", complete: "Query complete" },
52912
+ run_sql_query_tool: { running: "Running database query", complete: "Query complete" },
52913
+ // Presentation
52914
+ create_powerpoint_deck: { running: "Creating presentation", complete: "Created presentation" },
52915
+ execute_presentation_code: { running: "Updating presentation", complete: "Updated presentation" },
52916
+ capture_slide_screenshot: { running: "Capturing slide", complete: "Slide captured" },
52917
+ // Notebook
52918
+ create_new_notebook: { running: "Creating notebook", complete: "Created notebook" },
52919
+ run_notebook_cell: { running: "Running notebook cell", complete: "Cell execution complete" },
52920
+ // Media capture
52921
+ capture_moment: { running: "Capturing moment", complete: "Moment captured" }
52922
+ };
52923
+ function getToolStatusLabel(toolName, status) {
52924
+ const entry = TOOL_STATUS_LABELS[toolName];
52925
+ if (entry) return status === "complete" ? entry.complete : entry.running;
52926
+ const formatted = formatToolName(toolName);
52927
+ return status === "complete" ? formatted : `Running ${formatted.toLowerCase()}`;
52928
+ }
52929
+ const DEFAULT_TOOL_TO_TOOLKIT = {
52930
+ // Web
52931
+ search: "Web",
52932
+ browse: "Web",
52933
+ web_search: "Web",
52934
+ search_web: "Web",
52935
+ web_scrape: "Web",
52936
+ scrape_web: "Web",
52937
+ // Document
52938
+ create_new_document: "Document",
52939
+ create_document_from_markdown: "Document",
52940
+ append_markdown_to_athena_document: "Document",
52941
+ replace_markdown_in_athena_document: "Document",
52942
+ delete_blocks_from_athena_document: "Document",
52943
+ convert_athena_doc_to_pdf: "Document",
52944
+ convert_to_pdf: "Document",
52945
+ // Word document (Studio)
52946
+ CreateDocument: "Document (Word)",
52947
+ CreateParagraph: "Document (Word)",
52948
+ OpenDocument: "Document (Word)",
52949
+ execute_word_commands: "Document (Word)",
52950
+ create_new_word_document: "Document (Word)",
52951
+ // Spreadsheet
52952
+ create_new_sheet: "Spreadsheet",
52953
+ update_sheet_range: "Spreadsheet",
52954
+ format_sheet_range: "Spreadsheet",
52955
+ bulk_format_sheet_range: "Spreadsheet",
52956
+ create_table: "Spreadsheet",
52957
+ update_table: "Spreadsheet",
52958
+ create_chart: "Spreadsheet",
52959
+ update_chart: "Spreadsheet",
52960
+ // Studio sheet PTC
52961
+ CreateWorkbook: "Spreadsheet",
52962
+ AddSheet: "Spreadsheet",
52963
+ OpenWorkbook: "Spreadsheet",
52964
+ // Presentation
52965
+ create_powerpoint_deck: "Presentation (PowerPoint)",
52966
+ execute_presentation_code: "Presentation (PowerPoint)",
52967
+ capture_slide_screenshot: "Presentation (PowerPoint)",
52968
+ // Studio presentation PTC
52969
+ CreatePresentation: "Presentation (PowerPoint)",
52970
+ OpenPresentation: "Presentation (PowerPoint)",
52971
+ AddSlide: "Presentation (PowerPoint)",
52972
+ // Notebook
52973
+ create_new_notebook: "Notebook",
52974
+ run_notebook_cell: "Notebook",
52975
+ // Python / code execution
52976
+ run_python_code: "Python",
52977
+ run_python: "Python",
52978
+ // Database
52979
+ run_sql: "Database",
52980
+ run_database_sql: "Database",
52981
+ run_sql_query_tool: "Database",
52982
+ execute_sql: "Database",
52983
+ describe_database: "Database",
52984
+ list_database_tables: "Database",
52985
+ get_database_table_schema: "Database",
52986
+ // Email / calendar
52987
+ search_email: "Email",
52988
+ unified_email_search: "Email",
52989
+ // Media
52990
+ capture_moment: "Computer"
52991
+ };
52992
+ const UNGROUPED_TOOLS = [
52993
+ "read_asset",
52994
+ "read_full_asset",
52995
+ "open_asset_in_workspace",
52996
+ "create_email_draft",
52997
+ "unified_email_create_draft",
52998
+ "unified_email_send",
52999
+ "unified_email_edit_draft"
53000
+ ];
53001
+ const defaultGetToolGroupKey = (toolName) => {
53002
+ if (UNGROUPED_TOOLS.includes(toolName)) return void 0;
53003
+ return DEFAULT_TOOL_TO_TOOLKIT[toolName];
53004
+ };
53005
+ const MAX_VISIBLE_STATUSES = 5;
53006
+ const EMPTY_STATUSES = [];
53007
+ function PulsingDots() {
53008
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-[3px]", "aria-hidden": "true", children: [
53009
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "h-[5px] w-[5px] rounded-full bg-gray-800 animate-[aui-sg-pulse-dot_1.4s_ease-in-out_infinite]" }),
53010
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "h-[5px] w-[5px] rounded-full bg-gray-800 animate-[aui-sg-pulse-dot_1.4s_ease-in-out_0.2s_infinite]" }),
53011
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "h-[5px] w-[5px] rounded-full bg-gray-800 animate-[aui-sg-pulse-dot_1.4s_ease-in-out_0.4s_infinite]" }),
53012
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
53013
+ @keyframes aui-sg-pulse-dot {
53014
+ 0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
53015
+ 40% { opacity: 1; transform: scale(1); }
53016
+ }
53017
+ @keyframes aui-sg-shimmer-bar {
53018
+ 0% { transform: translateX(-100%); }
53019
+ 100% { transform: translateX(400%); }
53020
+ }
53021
+ ` })
53022
+ ] });
53023
+ }
53024
+ const SuperGroupingFinalText = React.memo(function SuperGroupingFinalText2({
53025
+ TextComponent
53026
+ }) {
53027
+ const messageContent = react$1.useAuiState((s) => s.message.content);
53028
+ const isRunning = react$1.useAuiState((s) => {
53029
+ var _a2;
53030
+ return ((_a2 = s.message.status) == null ? void 0 : _a2.type) === "running";
53031
+ });
53032
+ const finalText = React.useMemo(() => {
53033
+ if (!(messageContent == null ? void 0 : messageContent.length)) return null;
53034
+ let lastToolIdx = -1;
53035
+ for (let i = messageContent.length - 1; i >= 0; i--) {
53036
+ if (messageContent[i].type === "tool-call") {
53037
+ lastToolIdx = i;
53038
+ break;
53039
+ }
53040
+ }
53041
+ if (lastToolIdx === -1) return null;
53042
+ const texts = [];
53043
+ for (let i = lastToolIdx + 1; i < messageContent.length; i++) {
53044
+ const part = messageContent[i];
53045
+ if (part.type === "text" && part.text) texts.push(part.text);
53046
+ }
53047
+ return texts.length > 0 ? texts.join("\n\n") : null;
53048
+ }, [messageContent]);
53049
+ if (isRunning || !finalText) return null;
53050
+ return /* @__PURE__ */ jsxRuntime.jsx(TextComponent, { type: "text", text: finalText, status: { type: "complete" } });
53051
+ });
53052
+ const SuperGroupingCard = React.memo(function SuperGroupingCard2({
53053
+ toolUIs,
53054
+ TextComponent,
53055
+ ReasoningComponent,
53056
+ getToolGroupKey = defaultGetToolGroupKey
53057
+ }) {
53058
+ const [showDetails, setShowDetails] = React.useState(false);
53059
+ const handleToggleDetails = React.useCallback(() => setShowDetails((p) => !p), []);
53060
+ const handleHideDetails = React.useCallback(() => setShowDetails(false), []);
53061
+ const messageStatus = react$1.useAuiState((s) => {
53062
+ var _a2;
53063
+ return (_a2 = s.message.status) == null ? void 0 : _a2.type;
53064
+ });
53065
+ const isRunning = messageStatus === "running";
53066
+ const isError = messageStatus === "incomplete";
53067
+ const isComplete = !isRunning && !isError;
53068
+ const groupingFunction = React.useMemo(() => {
53069
+ const inner = createToolBasedGroupingFunction(getToolGroupKey);
53070
+ return (parts) => {
53071
+ const lastToolIdx = parts.findLastIndex((p) => (p == null ? void 0 : p.type) === "tool-call");
53072
+ return inner(parts).map((g) => ({
53073
+ ...g,
53074
+ indices: g.indices.filter((i) => {
53075
+ var _a2;
53076
+ return ((_a2 = parts[i]) == null ? void 0 : _a2.type) !== "text" || i <= lastToolIdx;
53077
+ })
53078
+ })).filter((g) => g.indices.length > 0);
53079
+ };
53080
+ }, [getToolGroupKey]);
53081
+ const messageContent = react$1.useAuiState((s) => s.message.content);
53082
+ const toolStatuses = React.useMemo(() => {
53083
+ if (!messageContent) return EMPTY_STATUSES;
53084
+ const statuses = [];
53085
+ for (const part of messageContent) {
53086
+ if (part.type === "tool-call") {
53087
+ const isToolComplete = part.result !== void 0;
53088
+ statuses.push({
53089
+ toolName: part.toolName,
53090
+ label: getToolStatusLabel(part.toolName, isToolComplete ? "complete" : "running"),
53091
+ isComplete: isToolComplete
53092
+ });
53093
+ }
53094
+ }
53095
+ return statuses.length > 0 ? statuses : EMPTY_STATUSES;
53096
+ }, [messageContent]);
53097
+ const hasToolCalls = toolStatuses.length > 0;
53098
+ const visibleStatuses = React.useMemo(
53099
+ () => toolStatuses.length <= MAX_VISIBLE_STATUSES ? toolStatuses : toolStatuses.slice(-MAX_VISIBLE_STATUSES),
53100
+ [toolStatuses]
53101
+ );
53102
+ const hiddenCount = toolStatuses.length - visibleStatuses.length;
53103
+ const latestStatusLine = React.useMemo(() => {
53104
+ var _a2;
53105
+ if (!hasToolCalls) return "Planning approach";
53106
+ return ((_a2 = toolStatuses[toolStatuses.length - 1]) == null ? void 0 : _a2.label) ?? "Working";
53107
+ }, [toolStatuses, hasToolCalls]);
53108
+ const detailsPanel = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 border-t border-border/60 bg-background/80 px-4 py-4", children: [
53109
+ /* @__PURE__ */ jsxRuntime.jsx(
53110
+ react$1.MessagePrimitive.Unstable_PartsGrouped,
53111
+ {
53112
+ groupingFunction,
53113
+ components: {
53114
+ tools: { by_name: toolUIs, Fallback: ToolFallback },
53115
+ Text: TextComponent,
53116
+ ...ReasoningComponent ? { Reasoning: ReasoningComponent } : {},
53117
+ Group: CollapsibleGroup
53118
+ }
53119
+ }
53120
+ ),
53121
+ /* @__PURE__ */ jsxRuntime.jsxs(
53122
+ "button",
53123
+ {
53124
+ type: "button",
53125
+ onClick: handleHideDetails,
53126
+ className: "mx-auto mt-3 flex items-center gap-1 rounded-md px-3 py-1.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted/40 hover:text-foreground",
53127
+ children: [
53128
+ /* @__PURE__ */ jsxRuntime.jsx(ChevronUp, { className: "size-3" }),
53129
+ "Hide details"
53130
+ ]
53131
+ }
53132
+ )
53133
+ ] });
53134
+ if (isComplete && hasToolCalls) {
53135
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "my-3 overflow-hidden rounded-2xl border border-border/60 bg-muted/10", children: [
53136
+ /* @__PURE__ */ jsxRuntime.jsxs(
53137
+ "button",
53138
+ {
53139
+ type: "button",
53140
+ onClick: handleToggleDetails,
53141
+ "aria-expanded": showDetails,
53142
+ className: "flex w-full items-center justify-between px-4 py-3 text-left transition-colors hover:bg-muted/30",
53143
+ children: [
53144
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
53145
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex size-4 items-center justify-center text-emerald-500", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "10", height: "10", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 3L4.5 8.5L2 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
53146
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[12px] text-muted-foreground", children: [
53147
+ "Used ",
53148
+ toolStatuses.length,
53149
+ " ",
53150
+ toolStatuses.length === 1 ? "tool" : "tools"
53151
+ ] })
53152
+ ] }),
53153
+ showDetails ? /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, { className: "size-3.5 text-muted-foreground/70" }) : /* @__PURE__ */ jsxRuntime.jsx(ChevronRight, { className: "size-3.5 text-muted-foreground/70" })
53154
+ ]
53155
+ }
53156
+ ),
53157
+ showDetails && detailsPanel
53158
+ ] });
53159
+ }
53160
+ if (isComplete) return null;
53161
+ return /* @__PURE__ */ jsxRuntime.jsxs(
53162
+ "section",
53163
+ {
53164
+ "aria-busy": isRunning ? "true" : "false",
53165
+ "aria-describedby": "aui-sg-status",
53166
+ className: cn(
53167
+ "my-3 overflow-hidden rounded-2xl border transition-colors duration-200",
53168
+ isError ? "border-destructive/30 bg-destructive/5" : "border-border/70 bg-muted/10"
53169
+ ),
53170
+ children: [
53171
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 pt-4 pb-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
53172
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-[13px] font-semibold text-foreground", children: isError ? "Something went wrong" : "Athena is working" }),
53173
+ isRunning && !isError && /* @__PURE__ */ jsxRuntime.jsx(PulsingDots, {})
53174
+ ] }) }) }),
53175
+ isRunning && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 pb-1", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-[2px] w-full overflow-hidden rounded-full bg-muted/40", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-1/3 rounded-full bg-gradient-to-r from-blue-400 to-indigo-400 animate-[aui-sg-shimmer-bar_1.5s_ease-in-out_infinite]" }) }) }),
53176
+ /* @__PURE__ */ jsxRuntime.jsx("output", { id: "aui-sg-status", "aria-live": "polite", "aria-atomic": "true", className: "sr-only", children: latestStatusLine }),
53177
+ hasToolCalls && /* @__PURE__ */ jsxRuntime.jsxs("ul", { className: "space-y-1 px-4 pt-1.5 pb-1", "aria-label": "Work status updates", children: [
53178
+ hiddenCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "pl-[22px] text-[11px] text-muted-foreground/70", children: [
53179
+ hiddenCount,
53180
+ " earlier ",
53181
+ hiddenCount === 1 ? "step" : "steps"
53182
+ ] }),
53183
+ visibleStatuses.map((s, i) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "flex items-center gap-2 text-[12px]", children: [
53184
+ s.isComplete ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex size-3.5 items-center justify-center text-emerald-500", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "10", height: "10", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 3L4.5 8.5L2 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex size-3.5 items-center justify-center", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-1.5 animate-pulse rounded-full bg-blue-500" }) }),
53185
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("leading-relaxed", s.isComplete ? "text-muted-foreground/70" : "text-foreground/80"), children: s.label })
53186
+ ] }, `${s.toolName}-${i}`))
53187
+ ] }),
53188
+ !hasToolCalls && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 pt-1 pb-2", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shimmer text-[12px] text-muted-foreground", children: "Planning approach..." }) }),
53189
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 pb-3 pt-0.5", children: /* @__PURE__ */ jsxRuntime.jsxs(
53190
+ "button",
53191
+ {
53192
+ type: "button",
53193
+ onClick: handleToggleDetails,
53194
+ "aria-expanded": showDetails,
53195
+ className: "flex items-center gap-1 text-[11px] font-medium text-muted-foreground transition-colors hover:text-foreground",
53196
+ children: [
53197
+ showDetails ? /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, { className: "size-3" }) : /* @__PURE__ */ jsxRuntime.jsx(ChevronRight, { className: "size-3" }),
53198
+ showDetails ? "Hide details" : "Show details"
53199
+ ]
53200
+ }
53201
+ ) }),
53202
+ showDetails && detailsPanel
53203
+ ]
53204
+ }
53205
+ );
53206
+ });
52982
53207
  const falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
52983
53208
  const cx = clsx;
52984
53209
  const cva = (base2, config2) => (props) => {
@@ -53584,7 +53809,7 @@ const useAthenaChatDefaultComponents = () => {
53584
53809
  return value;
53585
53810
  };
53586
53811
  const AthenaDefaultAssistantMessage = () => {
53587
- const { toolUIs, TextComponent, ReasoningComponent, EmptyComponent: EmptyComponent2, ActionBarComponent } = useAthenaChatDefaultComponents();
53812
+ const { toolUIs, TextComponent, ReasoningComponent, EmptyComponent: EmptyComponent2, ActionBarComponent, groupToolCalls } = useAthenaChatDefaultComponents();
53588
53813
  return /* @__PURE__ */ jsxRuntime.jsx(
53589
53814
  AthenaAssistantMessage,
53590
53815
  {
@@ -53592,7 +53817,8 @@ const AthenaDefaultAssistantMessage = () => {
53592
53817
  TextComponent,
53593
53818
  ReasoningComponent,
53594
53819
  EmptyComponent: EmptyComponent2,
53595
- ActionBarComponent
53820
+ ActionBarComponent,
53821
+ groupToolCalls
53596
53822
  }
53597
53823
  );
53598
53824
  };
@@ -53601,15 +53827,15 @@ const AthenaDefaultUserMessage = () => {
53601
53827
  return /* @__PURE__ */ jsxRuntime.jsx(AthenaUserMessage, { TextComponent });
53602
53828
  };
53603
53829
  const getReasoningTokensFromMetadata = (metadata) => {
53604
- if (!isRecord(metadata)) {
53830
+ if (!isRecord$1(metadata)) {
53605
53831
  return void 0;
53606
53832
  }
53607
53833
  const customMetadata = metadata.custom;
53608
- if (!isRecord(customMetadata)) {
53834
+ if (!isRecord$1(customMetadata)) {
53609
53835
  return void 0;
53610
53836
  }
53611
53837
  const athenaMetadata = customMetadata._athena;
53612
- if (!isRecord(athenaMetadata)) {
53838
+ if (!isRecord$1(athenaMetadata)) {
53613
53839
  return void 0;
53614
53840
  }
53615
53841
  const reasoningTokens = athenaMetadata.reasoningTokens;
@@ -53658,7 +53884,8 @@ const AthenaChat = ({
53658
53884
  toolUIs,
53659
53885
  mentionTools,
53660
53886
  welcomeSuggestions = DEFAULT_SUGGESTIONS,
53661
- components
53887
+ components,
53888
+ groupToolCalls = false
53662
53889
  }) => {
53663
53890
  var _a2, _b, _c;
53664
53891
  const athenaConfig = useAthenaConfig();
@@ -53696,9 +53923,10 @@ const AthenaChat = ({
53696
53923
  TextComponent: textComponent,
53697
53924
  ReasoningComponent: reasoningComponent,
53698
53925
  EmptyComponent: emptyComponent,
53699
- ActionBarComponent: actionBarComponent
53926
+ ActionBarComponent: actionBarComponent,
53927
+ groupToolCalls
53700
53928
  }),
53701
- [actionBarComponent, emptyComponent, mergedToolUIs, reasoningComponent, textComponent]
53929
+ [actionBarComponent, emptyComponent, groupToolCalls, mergedToolUIs, reasoningComponent, textComponent]
53702
53930
  );
53703
53931
  const AssistantMessageComponent = (components == null ? void 0 : components.AssistantMessage) ?? AthenaDefaultAssistantMessage;
53704
53932
  const UserMessageComponent = (components == null ? void 0 : components.UserMessage) ?? AthenaDefaultUserMessage;
@@ -53902,6 +54130,17 @@ const AthenaAssistantMessageEmpty = ({ status }) => {
53902
54130
  if ((status == null ? void 0 : status.type) !== "running") return null;
53903
54131
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shimmer text-[13px] text-muted-foreground", children: "Thinking..." });
53904
54132
  };
54133
+ const AthenaMessageEmptyIndicator = ({
54134
+ EmptyComponent: EmptyComponent2
54135
+ }) => {
54136
+ const hasParts = react$1.useAuiState((s) => s.message.parts.length > 0);
54137
+ const isRunning = react$1.useAuiState((s) => {
54138
+ var _a2;
54139
+ return ((_a2 = s.message.status) == null ? void 0 : _a2.type) === "running";
54140
+ });
54141
+ if (hasParts || !isRunning) return null;
54142
+ return /* @__PURE__ */ jsxRuntime.jsx(EmptyComponent2, { status: { type: "running" } });
54143
+ };
53905
54144
  const AthenaReasoningPart = ({
53906
54145
  text: text2,
53907
54146
  status,
@@ -53972,17 +54211,19 @@ const AthenaReasoningPart = ({
53972
54211
  ]
53973
54212
  }
53974
54213
  ) }),
53975
- /* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent, { className: "pt-3", children: isRunning && !hasText ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shimmer text-[13px] text-muted-foreground", children: "Analyzing..." }) : isRunning ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "whitespace-pre-wrap break-words text-[13px] leading-relaxed text-foreground", children: text2 }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-assistant-reasoning-body text-[13px] leading-relaxed", children: /* @__PURE__ */ jsxRuntime.jsx(EffectiveTextComponent, { ...reasoningTextProps }) }) })
54214
+ /* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent, { className: "pt-3", children: isRunning && !hasText ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shimmer text-[13px] text-muted-foreground", children: "Analyzing..." }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-assistant-reasoning-body text-[13px] leading-relaxed", children: /* @__PURE__ */ jsxRuntime.jsx(EffectiveTextComponent, { ...reasoningTextProps }) }) })
53976
54215
  ]
53977
54216
  }
53978
54217
  );
53979
54218
  };
54219
+ const noToolGrouping = () => null;
53980
54220
  const AthenaAssistantMessage = ({
53981
54221
  toolUIs,
53982
54222
  TextComponent = TiptapText,
53983
54223
  ReasoningComponent,
53984
54224
  EmptyComponent: EmptyComponent2 = AthenaAssistantMessageEmpty,
53985
- ActionBarComponent = AthenaAssistantActionBar
54225
+ ActionBarComponent = AthenaAssistantActionBar,
54226
+ groupToolCalls = false
53986
54227
  }) => {
53987
54228
  const effectiveReasoningComponent = ReasoningComponent ?? AthenaReasoningPart;
53988
54229
  const toolUIsWithNestedMessages = React.useMemo(() => {
@@ -53992,7 +54233,7 @@ const AthenaAssistantMessage = ({
53992
54233
  }
53993
54234
  return wrappedToolUIs;
53994
54235
  }, [toolUIs]);
53995
- const partsComponents = React.useMemo(
54236
+ const nestedPtcComponents = React.useMemo(
53996
54237
  () => ({
53997
54238
  Text: TextComponent,
53998
54239
  Reasoning: effectiveReasoningComponent,
@@ -54011,7 +54252,42 @@ const AthenaAssistantMessage = ({
54011
54252
  "data-role": "assistant",
54012
54253
  children: [
54013
54254
  /* @__PURE__ */ jsxRuntime.jsx(AthenaReasoningTextComponentContext.Provider, { value: TextComponent, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "aui-assistant-message-content wrap-break-word px-2 text-foreground leading-relaxed", children: [
54014
- /* @__PURE__ */ jsxRuntime.jsx(NestedPtcComponentsProvider, { components: partsComponents, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.MessagePrimitive.Parts, { components: partsComponents }) }),
54255
+ /* @__PURE__ */ jsxRuntime.jsx(NestedPtcComponentsProvider, { components: nestedPtcComponents, children: groupToolCalls ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col space-y-2", children: [
54256
+ /* @__PURE__ */ jsxRuntime.jsx(
54257
+ SuperGroupingCard,
54258
+ {
54259
+ toolUIs: toolUIsWithNestedMessages,
54260
+ TextComponent,
54261
+ ReasoningComponent: effectiveReasoningComponent
54262
+ }
54263
+ ),
54264
+ /* @__PURE__ */ jsxRuntime.jsx(SuperGroupingFinalText, { TextComponent })
54265
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
54266
+ /* @__PURE__ */ jsxRuntime.jsx(AthenaMessageEmptyIndicator, { EmptyComponent: EmptyComponent2 }),
54267
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.MessagePrimitive.GroupedParts, { groupBy: noToolGrouping, children: ({ part }) => {
54268
+ var _a2;
54269
+ switch (part.type) {
54270
+ case "tool-call": {
54271
+ const ToolUI = toolUIsWithNestedMessages[part.toolName];
54272
+ const toolProps = part;
54273
+ return ToolUI ? /* @__PURE__ */ jsxRuntime.jsx(ToolUI, { ...toolProps }) : /* @__PURE__ */ jsxRuntime.jsx(ToolFallback, { ...toolProps });
54274
+ }
54275
+ case "reasoning": {
54276
+ const ReasoningRenderer = effectiveReasoningComponent;
54277
+ return /* @__PURE__ */ jsxRuntime.jsx(ReasoningRenderer, { ...part });
54278
+ }
54279
+ case "text": {
54280
+ const textPart = part;
54281
+ if (textPart.text === "" && ((_a2 = textPart.status) == null ? void 0 : _a2.type) === "running") {
54282
+ return /* @__PURE__ */ jsxRuntime.jsx(EmptyComponent2, { status: textPart.status });
54283
+ }
54284
+ return /* @__PURE__ */ jsxRuntime.jsx(TextComponent, { ...textPart });
54285
+ }
54286
+ default:
54287
+ return null;
54288
+ }
54289
+ } })
54290
+ ] }) }),
54015
54291
  /* @__PURE__ */ jsxRuntime.jsx(MessageError, {})
54016
54292
  ] }) }),
54017
54293
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-assistant-message-footer mt-1 ml-2 flex", children: /* @__PURE__ */ jsxRuntime.jsx(ActionBarComponent, {}) })
@@ -54204,7 +54480,7 @@ function buildPresentationNavigationMessage({
54204
54480
  assetType,
54205
54481
  slideNumber
54206
54482
  }) {
54207
- if (assetType !== "presentation" || typeof slideNumber !== "number" || !Number.isInteger(slideNumber) || slideNumber < 1) {
54483
+ if (!assetId.trim() || assetType !== "presentation" || typeof slideNumber !== "number" || !Number.isInteger(slideNumber) || slideNumber < 1) {
54208
54484
  return null;
54209
54485
  }
54210
54486
  return {
@@ -54231,13 +54507,24 @@ const AssetIframe = React.memo(
54231
54507
  apiKey,
54232
54508
  token
54233
54509
  });
54510
+ const initialSlideRef = React.useRef({
54511
+ assetId: tab.id,
54512
+ slideNumber: tab.slideNumber
54513
+ });
54514
+ if (initialSlideRef.current.assetId !== tab.id) {
54515
+ initialSlideRef.current = {
54516
+ assetId: tab.id,
54517
+ slideNumber: tab.slideNumber
54518
+ };
54519
+ }
54520
+ const initialSlideNumber = initialSlideRef.current.slideNumber;
54234
54521
  const iframeSrc = React.useMemo(
54235
54522
  () => embedUrl ? buildAssetIframeSrc({
54236
54523
  embedUrl,
54237
54524
  assetType: tab.type,
54238
- slideNumber: tab.slideNumber
54525
+ slideNumber: initialSlideNumber
54239
54526
  }) : null,
54240
- [embedUrl, tab.slideNumber, tab.type]
54527
+ [embedUrl, initialSlideNumber, tab.type]
54241
54528
  );
54242
54529
  const navigationMessage = React.useMemo(
54243
54530
  () => buildPresentationNavigationMessage({
@@ -54247,11 +54534,22 @@ const AssetIframe = React.memo(
54247
54534
  }),
54248
54535
  [tab.id, tab.slideNumber, tab.type]
54249
54536
  );
54537
+ const navigationTargetOrigin = React.useMemo(() => {
54538
+ if (!iframeSrc) return null;
54539
+ try {
54540
+ return new URL(iframeSrc, window.location.href).origin;
54541
+ } catch {
54542
+ return null;
54543
+ }
54544
+ }, [iframeSrc]);
54250
54545
  const postNavigationMessage = React.useCallback(() => {
54251
54546
  var _a2, _b;
54252
- if (!navigationMessage) return;
54253
- (_b = (_a2 = iframeRef.current) == null ? void 0 : _a2.contentWindow) == null ? void 0 : _b.postMessage(navigationMessage, "*");
54254
- }, [navigationMessage]);
54547
+ if (!navigationMessage || !navigationTargetOrigin) return;
54548
+ (_b = (_a2 = iframeRef.current) == null ? void 0 : _a2.contentWindow) == null ? void 0 : _b.postMessage(
54549
+ navigationMessage,
54550
+ navigationTargetOrigin
54551
+ );
54552
+ }, [navigationMessage, navigationTargetOrigin]);
54255
54553
  React.useEffect(() => {
54256
54554
  postNavigationMessage();
54257
54555
  }, [postNavigationMessage]);
@@ -54606,6 +54904,7 @@ exports.CreatePresentationToolUI = CreatePresentationToolUI;
54606
54904
  exports.CreateSheetToolUI = CreateSheetToolUI;
54607
54905
  exports.DEFAULT_API_URL = DEFAULT_API_URL;
54608
54906
  exports.DEFAULT_APP_URL = DEFAULT_APP_URL;
54907
+ exports.DEFAULT_AUTO_OPEN_TOOLS = DEFAULT_AUTO_OPEN_TOOLS;
54609
54908
  exports.DEFAULT_BACKEND_URL = DEFAULT_BACKEND_URL;
54610
54909
  exports.DescribeDatabaseToolUI = DescribeDatabaseToolUI;
54611
54910
  exports.EmailSearchToolUI = EmailSearchToolUI;
@@ -54659,7 +54958,7 @@ exports.resetAssetAutoOpen = resetAssetAutoOpen;
54659
54958
  exports.themeToStyleVars = themeToStyleVars;
54660
54959
  exports.themes = themes;
54661
54960
  exports.truncate = truncate;
54662
- exports.tryParseJson = tryParseJson$1;
54961
+ exports.tryParseJson = tryParseJson$2;
54663
54962
  exports.useAppendToComposer = useAppendToComposer;
54664
54963
  exports.useAssetEmbed = useAssetEmbed;
54665
54964
  exports.useAssetPanelStore = useAssetPanelStore;