sunpeak 0.10.3 → 0.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/chatgpt/index.cjs +1 -1
  2. package/dist/chatgpt/index.js +1 -1
  3. package/dist/index.cjs +3 -3
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.js +4 -4
  6. package/dist/index.js.map +1 -1
  7. package/dist/mcp/entry.cjs +1 -1
  8. package/dist/mcp/entry.js +1 -1
  9. package/dist/mcp/index.cjs +1 -1
  10. package/dist/mcp/index.js +1 -1
  11. package/dist/{server-CSybLAYo.cjs → server-B-T6Y3-J.cjs} +35 -47
  12. package/dist/{server-CSybLAYo.cjs.map → server-B-T6Y3-J.cjs.map} +1 -1
  13. package/dist/{server-310A1k9o.js → server-CnRhUNGQ.js} +35 -47
  14. package/dist/{server-310A1k9o.js.map → server-CnRhUNGQ.js.map} +1 -1
  15. package/dist/{simulator-url-BZBcq5tc.js → simulator-url-BUKX-wRa.js} +344 -270
  16. package/dist/{simulator-url-BZBcq5tc.js.map → simulator-url-BUKX-wRa.js.map} +1 -1
  17. package/dist/{simulator-url-D4tFBjeu.cjs → simulator-url-pSDp_VWO.cjs} +345 -271
  18. package/dist/{simulator-url-D4tFBjeu.cjs.map → simulator-url-pSDp_VWO.cjs.map} +1 -1
  19. package/package.json +12 -12
  20. package/template/dist/albums/albums.js +7 -47
  21. package/template/dist/albums/albums.json +1 -1
  22. package/template/dist/carousel/carousel.js +7 -47
  23. package/template/dist/carousel/carousel.json +1 -1
  24. package/template/dist/map/map.js +140 -187
  25. package/template/dist/map/map.json +1 -1
  26. package/template/dist/review/review.js +7 -47
  27. package/template/dist/review/review.json +1 -1
  28. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Avatar.js +1 -2
  29. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Avatar.js.map +1 -1
  30. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Button.js +618 -13
  31. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Button.js.map +4 -4
  32. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Checkbox.js +3 -3
  33. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Checkbox.js.map +1 -1
  34. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Input.js +2 -2
  35. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_SegmentedControl.js +7 -7
  36. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_SegmentedControl.js.map +1 -1
  37. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Select.js +2812 -151
  38. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Select.js.map +4 -4
  39. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Textarea.js +6 -6
  40. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Textarea.js.map +1 -1
  41. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_theme.js +1 -1
  42. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_theme.js.map +1 -1
  43. package/template/node_modules/.vite/deps/_metadata.json +43 -43
  44. package/template/node_modules/.vite/deps/{chunk-TSEQUROC.js → chunk-2UDYPUBJ.js} +99 -99
  45. package/template/node_modules/.vite/deps/{chunk-TSEQUROC.js.map → chunk-2UDYPUBJ.js.map} +1 -1
  46. package/template/node_modules/.vite/deps/chunk-6QVG4F2X.js +93 -0
  47. package/template/node_modules/.vite/deps/chunk-6QVG4F2X.js.map +7 -0
  48. package/template/node_modules/.vite/deps/{chunk-2DZGWGIP.js → chunk-P5LK4A7U.js} +3 -3
  49. package/template/node_modules/.vite/deps/{chunk-2DZGWGIP.js.map → chunk-P5LK4A7U.js.map} +1 -1
  50. package/template/node_modules/.vite/deps/{chunk-DYQDWJMS.js → chunk-RYYR2YMB.js} +2 -6
  51. package/template/node_modules/.vite/deps/{chunk-DYQDWJMS.js.map → chunk-RYYR2YMB.js.map} +1 -1
  52. package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
  53. package/template/node_modules/.vite/deps/chunk-LVZJNEGE.js +0 -628
  54. package/template/node_modules/.vite/deps/chunk-LVZJNEGE.js.map +0 -7
@@ -1,7 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- var _a, _b;
5
1
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
6
2
  import * as React from "react";
7
3
  import React__default, { useSyncExternalStore, useState, useRef, useEffect, useCallback, useLayoutEffect, useId as useId$1, Children, isValidElement, cloneElement, createContext, useReducer, useMemo, use } from "react";
@@ -12,9 +8,7 @@ function isOpenAiAvailable() {
12
8
  return typeof window !== "undefined" && window.openai != null;
13
9
  }
14
10
  class OpenAiProvider {
15
- constructor() {
16
- __publicField(this, "id", "openai");
17
- }
11
+ id = "openai";
18
12
  getGlobal(key) {
19
13
  if (typeof window === "undefined" || !window.openai) {
20
14
  return null;
@@ -43,34 +37,13 @@ class OpenAiProvider {
43
37
  return null;
44
38
  }
45
39
  return {
46
- callTool: (...args) => {
47
- var _a2, _b2;
48
- return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.callTool) == null ? void 0 : _b2.call(_a2, ...args);
49
- },
50
- sendFollowUpMessage: (...args) => {
51
- var _a2, _b2;
52
- return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.sendFollowUpMessage) == null ? void 0 : _b2.call(_a2, ...args);
53
- },
54
- openExternal: (...args) => {
55
- var _a2, _b2;
56
- return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.openExternal) == null ? void 0 : _b2.call(_a2, ...args);
57
- },
58
- requestDisplayMode: (...args) => {
59
- var _a2, _b2;
60
- return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.requestDisplayMode) == null ? void 0 : _b2.call(_a2, ...args);
61
- },
62
- requestModal: (...args) => {
63
- var _a2, _b2;
64
- return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.requestModal) == null ? void 0 : _b2.call(_a2, ...args);
65
- },
66
- notifyIntrinsicHeight: (...args) => {
67
- var _a2, _b2;
68
- return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.notifyIntrinsicHeight) == null ? void 0 : _b2.call(_a2, ...args);
69
- },
70
- setWidgetState: (...args) => {
71
- var _a2, _b2;
72
- return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.setWidgetState) == null ? void 0 : _b2.call(_a2, ...args);
73
- }
40
+ callTool: (...args) => window.openai?.callTool?.(...args),
41
+ sendFollowUpMessage: (...args) => window.openai?.sendFollowUpMessage?.(...args),
42
+ openExternal: (...args) => window.openai?.openExternal?.(...args),
43
+ requestDisplayMode: (...args) => window.openai?.requestDisplayMode?.(...args),
44
+ requestModal: (...args) => window.openai?.requestModal?.(...args),
45
+ notifyIntrinsicHeight: (...args) => window.openai?.notifyIntrinsicHeight?.(...args),
46
+ setWidgetState: (...args) => window.openai?.setWidgetState?.(...args)
74
47
  };
75
48
  }
76
49
  }
@@ -108,16 +81,16 @@ function isProviderAvailable() {
108
81
  }
109
82
  function getGlobal(key) {
110
83
  const provider = getProvider();
111
- return (provider == null ? void 0 : provider.getGlobal(key)) ?? null;
84
+ return provider?.getGlobal(key) ?? null;
112
85
  }
113
86
  function subscribeToGlobal(key, onChange) {
114
87
  const provider = getProvider();
115
- return (provider == null ? void 0 : provider.subscribe(key, onChange)) ?? (() => {
88
+ return provider?.subscribe(key, onChange) ?? (() => {
116
89
  });
117
90
  }
118
91
  function getAPI() {
119
92
  const provider = getProvider();
120
- return (provider == null ? void 0 : provider.getAPI()) ?? null;
93
+ return provider?.getAPI() ?? null;
121
94
  }
122
95
  function resetProviderCache() {
123
96
  resetProviderCache$1();
@@ -175,7 +148,7 @@ function useWidgetState(defaultState) {
175
148
  });
176
149
  const hasSentInitialState = useRef(false);
177
150
  useEffect(() => {
178
- if (!hasSentInitialState.current && widgetStateFromProvider == null && widgetState != null && (api == null ? void 0 : api.setWidgetState)) {
151
+ if (!hasSentInitialState.current && widgetStateFromProvider == null && widgetState != null && api?.setWidgetState) {
179
152
  hasSentInitialState.current = true;
180
153
  api.setWidgetState(widgetState);
181
154
  }
@@ -189,7 +162,7 @@ function useWidgetState(defaultState) {
189
162
  (state) => {
190
163
  _setWidgetState((prevState) => {
191
164
  const newState = typeof state === "function" ? state(prevState) : state;
192
- if (newState != null && (api == null ? void 0 : api.setWidgetState)) {
165
+ if (newState != null && api?.setWidgetState) {
193
166
  api.setWidgetState(newState);
194
167
  }
195
168
  return newState;
@@ -288,7 +261,7 @@ function createSlotClone(ownerName) {
288
261
  SlotClone.displayName = `${ownerName}.SlotClone`;
289
262
  return SlotClone;
290
263
  }
291
- var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
264
+ var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
292
265
  // @__NO_SIDE_EFFECTS__
293
266
  function createSlottable(ownerName) {
294
267
  const Slottable2 = ({ children }) => {
@@ -326,13 +299,12 @@ function mergeProps(slotProps, childProps) {
326
299
  return { ...slotProps, ...overrideProps };
327
300
  }
328
301
  function getElementRef$1(element) {
329
- var _a2, _b2;
330
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
302
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
331
303
  let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
332
304
  if (mayWarn) {
333
305
  return element.ref;
334
306
  }
335
- getter = (_b2 = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b2.get;
307
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
336
308
  mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
337
309
  if (mayWarn) {
338
310
  return element.props.ref;
@@ -364,7 +336,7 @@ var Primitive = NODES.reduce((primitive, node) => {
364
336
  const { asChild, ...primitiveProps } = props;
365
337
  const Comp = asChild ? Slot2 : node;
366
338
  if (typeof window !== "undefined") {
367
- window[Symbol.for("radix-ui")] = true;
339
+ window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
368
340
  }
369
341
  return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
370
342
  });
@@ -409,16 +381,14 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
409
381
  const index2 = defaultContexts.length;
410
382
  defaultContexts = [...defaultContexts, defaultContext];
411
383
  const Provider2 = (props) => {
412
- var _a2;
413
384
  const { scope, children, ...context } = props;
414
- const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
385
+ const Context = scope?.[scopeName]?.[index2] || BaseContext;
415
386
  const value = React.useMemo(() => context, Object.values(context));
416
387
  return /* @__PURE__ */ jsx(Context.Provider, { value, children });
417
388
  };
418
389
  Provider2.displayName = rootComponentName + "Provider";
419
390
  function useContext2(consumerName, scope) {
420
- var _a2;
421
- const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
391
+ const Context = scope?.[scopeName]?.[index2] || BaseContext;
422
392
  const context = React.useContext(Context);
423
393
  if (context) return context;
424
394
  if (defaultContext !== void 0) return defaultContext;
@@ -431,7 +401,7 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
431
401
  return React.createContext(defaultContext);
432
402
  });
433
403
  return function useScope(scope) {
434
- const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
404
+ const contexts = scope?.[scopeName] || scopeContexts;
435
405
  return React.useMemo(
436
406
  () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
437
407
  [scope, contexts]
@@ -525,13 +495,13 @@ function createCollection(name) {
525
495
  }
526
496
  function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
527
497
  return function handleEvent(event) {
528
- originalEventHandler == null ? void 0 : originalEventHandler(event);
498
+ originalEventHandler?.(event);
529
499
  if (checkForDefaultPrevented === false || !event.defaultPrevented) {
530
- return ourEventHandler == null ? void 0 : ourEventHandler(event);
500
+ return ourEventHandler?.(event);
531
501
  }
532
502
  };
533
503
  }
534
- var useLayoutEffect2 = (globalThis == null ? void 0 : globalThis.document) ? React.useLayoutEffect : () => {
504
+ var useLayoutEffect2 = globalThis?.document ? React.useLayoutEffect : () => {
535
505
  };
536
506
  var useInsertionEffect = React[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
537
507
  function useControllableState({
@@ -563,11 +533,10 @@ function useControllableState({
563
533
  }
564
534
  const setValue = React.useCallback(
565
535
  (nextValue) => {
566
- var _a2;
567
536
  if (isControlled) {
568
537
  const value2 = isFunction$1(nextValue) ? nextValue(prop) : nextValue;
569
538
  if (value2 !== prop) {
570
- (_a2 = onChangeRef.current) == null ? void 0 : _a2.call(onChangeRef, value2);
539
+ onChangeRef.current?.(value2);
571
540
  }
572
541
  } else {
573
542
  setUncontrolledProp(nextValue);
@@ -588,9 +557,8 @@ function useUncontrolledState({
588
557
  onChangeRef.current = onChange;
589
558
  }, [onChange]);
590
559
  React.useEffect(() => {
591
- var _a2;
592
560
  if (prevValueRef.current !== value) {
593
- (_a2 = onChangeRef.current) == null ? void 0 : _a2.call(onChangeRef, value);
561
+ onChangeRef.current?.(value);
594
562
  prevValueRef.current = value;
595
563
  }
596
564
  }, [value, prevValueRef]);
@@ -646,7 +614,7 @@ function usePresence(present) {
646
614
  const currentAnimationName = getAnimationName(styles);
647
615
  if (present) {
648
616
  send("MOUNT");
649
- } else if (currentAnimationName === "none" || (styles == null ? void 0 : styles.display) === "none") {
617
+ } else if (currentAnimationName === "none" || styles?.display === "none") {
650
618
  send("UNMOUNT");
651
619
  } else {
652
620
  const isAnimating = prevAnimationName !== currentAnimationName;
@@ -706,16 +674,15 @@ function usePresence(present) {
706
674
  };
707
675
  }
708
676
  function getAnimationName(styles) {
709
- return (styles == null ? void 0 : styles.animationName) || "none";
677
+ return styles?.animationName || "none";
710
678
  }
711
679
  function getElementRef(element) {
712
- var _a2, _b2;
713
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
680
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
714
681
  let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
715
682
  if (mayWarn) {
716
683
  return element.ref;
717
684
  }
718
- getter = (_b2 = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b2.get;
685
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
719
686
  mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
720
687
  if (mayWarn) {
721
688
  return element.props.ref;
@@ -741,12 +708,9 @@ function useCallbackRef$1(callback) {
741
708
  React.useEffect(() => {
742
709
  callbackRef.current = callback;
743
710
  });
744
- return React.useMemo(() => (...args) => {
745
- var _a2;
746
- return (_a2 = callbackRef.current) == null ? void 0 : _a2.call(callbackRef, ...args);
747
- }, []);
711
+ return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
748
712
  }
749
- function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
713
+ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
750
714
  const onEscapeKeyDown = useCallbackRef$1(onEscapeKeyDownProp);
751
715
  React.useEffect(() => {
752
716
  const handleKeyDown2 = (event) => {
@@ -781,7 +745,7 @@ var DismissableLayer = React.forwardRef(
781
745
  } = props;
782
746
  const context = React.useContext(DismissableLayerContext);
783
747
  const [node, setNode] = React.useState(null);
784
- const ownerDocument = (node == null ? void 0 : node.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document);
748
+ const ownerDocument = node?.ownerDocument ?? globalThis?.document;
785
749
  const [, force] = React.useState({});
786
750
  const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
787
751
  const layers = Array.from(context.layers);
@@ -794,22 +758,22 @@ var DismissableLayer = React.forwardRef(
794
758
  const target = event.target;
795
759
  const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
796
760
  if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
797
- onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
798
- onInteractOutside == null ? void 0 : onInteractOutside(event);
799
- if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
761
+ onPointerDownOutside?.(event);
762
+ onInteractOutside?.(event);
763
+ if (!event.defaultPrevented) onDismiss?.();
800
764
  }, ownerDocument);
801
765
  const focusOutside = useFocusOutside((event) => {
802
766
  const target = event.target;
803
767
  const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
804
768
  if (isFocusInBranch) return;
805
- onFocusOutside == null ? void 0 : onFocusOutside(event);
806
- onInteractOutside == null ? void 0 : onInteractOutside(event);
807
- if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
769
+ onFocusOutside?.(event);
770
+ onInteractOutside?.(event);
771
+ if (!event.defaultPrevented) onDismiss?.();
808
772
  }, ownerDocument);
809
773
  useEscapeKeydown((event) => {
810
774
  const isHighestLayer = index2 === context.layers.size - 1;
811
775
  if (!isHighestLayer) return;
812
- onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(event);
776
+ onEscapeKeyDown?.(event);
813
777
  if (!event.defaultPrevented && onDismiss) {
814
778
  event.preventDefault();
815
779
  onDismiss();
@@ -882,7 +846,7 @@ var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
882
846
  return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
883
847
  });
884
848
  DismissableLayerBranch.displayName = BRANCH_NAME;
885
- function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
849
+ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
886
850
  const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
887
851
  const isPointerInsideReactTreeRef = React.useRef(false);
888
852
  const handleClickRef = React.useRef(() => {
@@ -925,7 +889,7 @@ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis
925
889
  onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
926
890
  };
927
891
  }
928
- function useFocusOutside(onFocusOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
892
+ function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
929
893
  const handleFocusOutside = useCallbackRef$1(onFocusOutside);
930
894
  const isFocusInsideReactTreeRef = React.useRef(false);
931
895
  React.useEffect(() => {
@@ -1136,15 +1100,14 @@ function createFocusScopesStack() {
1136
1100
  add(focusScope) {
1137
1101
  const activeFocusScope = stack[0];
1138
1102
  if (focusScope !== activeFocusScope) {
1139
- activeFocusScope == null ? void 0 : activeFocusScope.pause();
1103
+ activeFocusScope?.pause();
1140
1104
  }
1141
1105
  stack = arrayRemove(stack, focusScope);
1142
1106
  stack.unshift(focusScope);
1143
1107
  },
1144
1108
  remove(focusScope) {
1145
- var _a2;
1146
1109
  stack = arrayRemove(stack, focusScope);
1147
- (_a2 = stack[0]) == null ? void 0 : _a2.resume();
1110
+ stack[0]?.resume();
1148
1111
  }
1149
1112
  };
1150
1113
  }
@@ -1161,11 +1124,10 @@ function removeLinks(items) {
1161
1124
  }
1162
1125
  var PORTAL_NAME$2 = "Portal";
1163
1126
  var Portal$2 = React.forwardRef((props, forwardedRef) => {
1164
- var _a2;
1165
1127
  const { container: containerProp, ...portalProps } = props;
1166
1128
  const [mounted, setMounted] = React.useState(false);
1167
1129
  useLayoutEffect2(() => setMounted(true), []);
1168
- const container = containerProp || mounted && ((_a2 = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a2.body);
1130
+ const container = containerProp || mounted && globalThis?.document?.body;
1169
1131
  return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
1170
1132
  });
1171
1133
  Portal$2.displayName = PORTAL_NAME$2;
@@ -1378,8 +1340,8 @@ function createSidecarMedium(options) {
1378
1340
  medium.options = __assign({ async: true, ssr: false }, options);
1379
1341
  return medium;
1380
1342
  }
1381
- var SideCar$1 = function(_a2) {
1382
- var sideCar = _a2.sideCar, rest = __rest(_a2, ["sideCar"]);
1343
+ var SideCar$1 = function(_a) {
1344
+ var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
1383
1345
  if (!sideCar) {
1384
1346
  throw new Error("Sidecar: please provide `sideCar` property to import the right car");
1385
1347
  }
@@ -1400,12 +1362,12 @@ var nothing = function() {
1400
1362
  };
1401
1363
  var RemoveScroll = React.forwardRef(function(props, parentRef) {
1402
1364
  var ref = React.useRef(null);
1403
- var _a2 = React.useState({
1365
+ var _a = React.useState({
1404
1366
  onScrollCapture: nothing,
1405
1367
  onWheelCapture: nothing,
1406
1368
  onTouchMoveCapture: nothing
1407
- }), callbacks = _a2[0], setCallbacks = _a2[1];
1408
- var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noRelative = props.noRelative, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b2 = props.as, Container2 = _b2 === void 0 ? "div" : _b2, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
1369
+ }), callbacks = _a[0], setCallbacks = _a[1];
1370
+ var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noRelative = props.noRelative, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container2 = _b === void 0 ? "div" : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
1409
1371
  var SideCar2 = sideCar;
1410
1372
  var containerRef = useMergeRefs([ref, parentRef]);
1411
1373
  var containerProps = __assign(__assign({}, rest), callbacks);
@@ -1488,8 +1450,8 @@ var styleHookSingleton = function() {
1488
1450
  };
1489
1451
  var styleSingleton = function() {
1490
1452
  var useStyle = styleHookSingleton();
1491
- var Sheet = function(_a2) {
1492
- var styles = _a2.styles, dynamic = _a2.dynamic;
1453
+ var Sheet = function(_a) {
1454
+ var styles = _a.styles, dynamic = _a.dynamic;
1493
1455
  useStyle(styles, dynamic);
1494
1456
  return null;
1495
1457
  };
@@ -1530,8 +1492,8 @@ var getGapWidth = function(gapMode) {
1530
1492
  };
1531
1493
  var Style = styleSingleton();
1532
1494
  var lockAttribute = "data-scroll-locked";
1533
- var getStyles = function(_a2, allowRelative, gapMode, important) {
1534
- var left = _a2.left, top = _a2.top, right = _a2.right, gap = _a2.gap;
1495
+ var getStyles = function(_a, allowRelative, gapMode, important) {
1496
+ var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
1535
1497
  if (gapMode === void 0) {
1536
1498
  gapMode = "margin";
1537
1499
  }
@@ -1558,8 +1520,8 @@ var useLockAttribute = function() {
1558
1520
  };
1559
1521
  }, []);
1560
1522
  };
1561
- var RemoveScrollBar = function(_a2) {
1562
- var noRelative = _a2.noRelative, noImportant = _a2.noImportant, _b2 = _a2.gapMode, gapMode = _b2 === void 0 ? "margin" : _b2;
1523
+ var RemoveScrollBar = function(_a) {
1524
+ var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
1563
1525
  useLockAttribute();
1564
1526
  var gap = React.useMemo(function() {
1565
1527
  return getGapWidth(gapMode);
@@ -1611,7 +1573,7 @@ var locationCouldBeScrolled = function(axis, node) {
1611
1573
  }
1612
1574
  var isScrollable = elementCouldBeScrolled(axis, current);
1613
1575
  if (isScrollable) {
1614
- var _a2 = getScrollVariables(axis, current), scrollHeight = _a2[1], clientHeight = _a2[2];
1576
+ var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
1615
1577
  if (scrollHeight > clientHeight) {
1616
1578
  return true;
1617
1579
  }
@@ -1620,16 +1582,16 @@ var locationCouldBeScrolled = function(axis, node) {
1620
1582
  } while (current && current !== ownerDocument.body);
1621
1583
  return false;
1622
1584
  };
1623
- var getVScrollVariables = function(_a2) {
1624
- var scrollTop = _a2.scrollTop, scrollHeight = _a2.scrollHeight, clientHeight = _a2.clientHeight;
1585
+ var getVScrollVariables = function(_a) {
1586
+ var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
1625
1587
  return [
1626
1588
  scrollTop,
1627
1589
  scrollHeight,
1628
1590
  clientHeight
1629
1591
  ];
1630
1592
  };
1631
- var getHScrollVariables = function(_a2) {
1632
- var scrollLeft = _a2.scrollLeft, scrollWidth = _a2.scrollWidth, clientWidth = _a2.clientWidth;
1593
+ var getHScrollVariables = function(_a) {
1594
+ var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
1633
1595
  return [
1634
1596
  scrollLeft,
1635
1597
  scrollWidth,
@@ -1658,7 +1620,7 @@ var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
1658
1620
  if (!target) {
1659
1621
  break;
1660
1622
  }
1661
- var _a2 = getScrollVariables(axis, target), position = _a2[0], scroll_1 = _a2[1], capacity = _a2[2];
1623
+ var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
1662
1624
  var elementScroll = scroll_1 - capacity - directionFactor * position;
1663
1625
  if (position || elementScroll) {
1664
1626
  if (elementCouldBeScrolled(axis, target)) {
@@ -2092,7 +2054,7 @@ var CheckboxTrigger = React.forwardRef(
2092
2054
  const composedRefs = useComposedRefs(forwardedRef, setControl);
2093
2055
  const initialCheckedStateRef = React.useRef(checked);
2094
2056
  React.useEffect(() => {
2095
- const form = control == null ? void 0 : control.form;
2057
+ const form = control?.form;
2096
2058
  if (form) {
2097
2059
  const reset = () => setChecked(initialCheckedStateRef.current);
2098
2060
  form.addEventListener("reset", reset);
@@ -4189,7 +4151,7 @@ var PopperAnchor = React.forwardRef(
4189
4151
  const anchorRef = React.useRef(null);
4190
4152
  React.useEffect(() => {
4191
4153
  const previousAnchor = anchorRef.current;
4192
- anchorRef.current = (virtualRef == null ? void 0 : virtualRef.current) || ref.current;
4154
+ anchorRef.current = virtualRef?.current || ref.current;
4193
4155
  if (previousAnchor !== anchorRef.current) {
4194
4156
  context.onAnchorChange(anchorRef.current);
4195
4157
  }
@@ -4202,7 +4164,6 @@ var CONTENT_NAME$2 = "PopperContent";
4202
4164
  var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$2);
4203
4165
  var PopperContent = React.forwardRef(
4204
4166
  (props, forwardedRef) => {
4205
- var _a2, _b2, _c, _d, _e, _f;
4206
4167
  const {
4207
4168
  __scopePopper,
4208
4169
  side = "bottom",
@@ -4224,8 +4185,8 @@ var PopperContent = React.forwardRef(
4224
4185
  const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
4225
4186
  const [arrow$12, setArrow] = React.useState(null);
4226
4187
  const arrowSize = useSize(arrow$12);
4227
- const arrowWidth = (arrowSize == null ? void 0 : arrowSize.width) ?? 0;
4228
- const arrowHeight = (arrowSize == null ? void 0 : arrowSize.height) ?? 0;
4188
+ const arrowWidth = arrowSize?.width ?? 0;
4189
+ const arrowHeight = arrowSize?.height ?? 0;
4229
4190
  const desiredPlacement = side + (align !== "center" ? "-" + align : "");
4230
4191
  const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
4231
4192
  const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
@@ -4278,12 +4239,12 @@ var PopperContent = React.forwardRef(
4278
4239
  const handlePlaced = useCallbackRef$1(onPlaced);
4279
4240
  useLayoutEffect2(() => {
4280
4241
  if (isPositioned) {
4281
- handlePlaced == null ? void 0 : handlePlaced();
4242
+ handlePlaced?.();
4282
4243
  }
4283
4244
  }, [isPositioned, handlePlaced]);
4284
- const arrowX = (_a2 = middlewareData.arrow) == null ? void 0 : _a2.x;
4285
- const arrowY = (_b2 = middlewareData.arrow) == null ? void 0 : _b2.y;
4286
- const cannotCenterArrow = ((_c = middlewareData.arrow) == null ? void 0 : _c.centerOffset) !== 0;
4245
+ const arrowX = middlewareData.arrow?.x;
4246
+ const arrowY = middlewareData.arrow?.y;
4247
+ const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
4287
4248
  const [contentZIndex, setContentZIndex] = React.useState();
4288
4249
  useLayoutEffect2(() => {
4289
4250
  if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
@@ -4300,13 +4261,13 @@ var PopperContent = React.forwardRef(
4300
4261
  minWidth: "max-content",
4301
4262
  zIndex: contentZIndex,
4302
4263
  ["--radix-popper-transform-origin"]: [
4303
- (_d = middlewareData.transformOrigin) == null ? void 0 : _d.x,
4304
- (_e = middlewareData.transformOrigin) == null ? void 0 : _e.y
4264
+ middlewareData.transformOrigin?.x,
4265
+ middlewareData.transformOrigin?.y
4305
4266
  ].join(" "),
4306
4267
  // hide the content if using the hide middleware and should be hidden
4307
4268
  // set visibility to hidden and disable pointer events so the UI behaves
4308
4269
  // as if the PopperContent isn't there at all
4309
- ...((_f = middlewareData.hide) == null ? void 0 : _f.referenceHidden) && {
4270
+ ...middlewareData.hide?.referenceHidden && {
4310
4271
  visibility: "hidden",
4311
4272
  pointerEvents: "none"
4312
4273
  }
@@ -4405,16 +4366,15 @@ var transformOrigin = (options) => ({
4405
4366
  name: "transformOrigin",
4406
4367
  options,
4407
4368
  fn(data) {
4408
- var _a2, _b2, _c;
4409
4369
  const { placement, rects, middlewareData } = data;
4410
- const cannotCenterArrow = ((_a2 = middlewareData.arrow) == null ? void 0 : _a2.centerOffset) !== 0;
4370
+ const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
4411
4371
  const isArrowHidden = cannotCenterArrow;
4412
4372
  const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
4413
4373
  const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
4414
4374
  const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
4415
4375
  const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
4416
- const arrowXCenter = (((_b2 = middlewareData.arrow) == null ? void 0 : _b2.x) ?? 0) + arrowWidth / 2;
4417
- const arrowYCenter = (((_c = middlewareData.arrow) == null ? void 0 : _c.y) ?? 0) + arrowHeight / 2;
4376
+ const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;
4377
+ const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;
4418
4378
  let x = "";
4419
4379
  let y = "";
4420
4380
  if (placedSide === "bottom") {
@@ -4770,9 +4730,8 @@ var PopoverContentModal = React.forwardRef(
4770
4730
  trapFocus: context.open,
4771
4731
  disableOutsidePointerEvents: true,
4772
4732
  onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
4773
- var _a2;
4774
4733
  event.preventDefault();
4775
- if (!isRightClickOutsideRef.current) (_a2 = context.triggerRef.current) == null ? void 0 : _a2.focus();
4734
+ if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();
4776
4735
  }),
4777
4736
  onPointerDownOutside: composeEventHandlers(
4778
4737
  props.onPointerDownOutside,
@@ -4806,18 +4765,16 @@ var PopoverContentNonModal = React.forwardRef(
4806
4765
  trapFocus: false,
4807
4766
  disableOutsidePointerEvents: false,
4808
4767
  onCloseAutoFocus: (event) => {
4809
- var _a2, _b2;
4810
- (_a2 = props.onCloseAutoFocus) == null ? void 0 : _a2.call(props, event);
4768
+ props.onCloseAutoFocus?.(event);
4811
4769
  if (!event.defaultPrevented) {
4812
- if (!hasInteractedOutsideRef.current) (_b2 = context.triggerRef.current) == null ? void 0 : _b2.focus();
4770
+ if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
4813
4771
  event.preventDefault();
4814
4772
  }
4815
4773
  hasInteractedOutsideRef.current = false;
4816
4774
  hasPointerDownOutsideRef.current = false;
4817
4775
  },
4818
4776
  onInteractOutside: (event) => {
4819
- var _a2, _b2;
4820
- (_a2 = props.onInteractOutside) == null ? void 0 : _a2.call(props, event);
4777
+ props.onInteractOutside?.(event);
4821
4778
  if (!event.defaultPrevented) {
4822
4779
  hasInteractedOutsideRef.current = true;
4823
4780
  if (event.detail.originalEvent.type === "pointerdown") {
@@ -4825,7 +4782,7 @@ var PopoverContentNonModal = React.forwardRef(
4825
4782
  }
4826
4783
  }
4827
4784
  const target = event.target;
4828
- const targetIsTrigger = (_b2 = context.triggerRef.current) == null ? void 0 : _b2.contains(target);
4785
+ const targetIsTrigger = context.triggerRef.current?.contains(target);
4829
4786
  if (targetIsTrigger) event.preventDefault();
4830
4787
  if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
4831
4788
  event.preventDefault();
@@ -5195,7 +5152,7 @@ var Tooltip$2 = (props) => {
5195
5152
  } else {
5196
5153
  providerContext.onClose();
5197
5154
  }
5198
- onOpenChange == null ? void 0 : onOpenChange(open2);
5155
+ onOpenChange?.(open2);
5199
5156
  },
5200
5157
  caller: TOOLTIP_NAME
5201
5158
  });
@@ -5373,7 +5330,7 @@ var TooltipContentHoverable = React.forwardRef((props, forwardedRef) => {
5373
5330
  const handleTrackPointerGrace = (event) => {
5374
5331
  const target = event.target;
5375
5332
  const pointerPosition = { x: event.clientX, y: event.clientY };
5376
- const hasEnteredTarget = (trigger == null ? void 0 : trigger.contains(target)) || (content == null ? void 0 : content.contains(target));
5333
+ const hasEnteredTarget = trigger?.contains(target) || content?.contains(target);
5377
5334
  const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
5378
5335
  if (hasEnteredTarget) {
5379
5336
  handleRemoveGraceArea();
@@ -5411,7 +5368,7 @@ var TooltipContentImpl = React.forwardRef(
5411
5368
  if (context.trigger) {
5412
5369
  const handleScroll2 = (event) => {
5413
5370
  const target = event.target;
5414
- if (target == null ? void 0 : target.contains(context.trigger)) onClose();
5371
+ if (target?.contains(context.trigger)) onClose();
5415
5372
  };
5416
5373
  window.addEventListener("scroll", handleScroll2, { capture: true });
5417
5374
  return () => window.removeEventListener("scroll", handleScroll2, { capture: true });
@@ -5596,12 +5553,11 @@ function useLatestValue(value) {
5596
5553
  let handlers = [];
5597
5554
  let listenerBound = false;
5598
5555
  const handleKeyDown = (evt) => {
5599
- var _a2, _b2;
5600
5556
  if (evt.key === "Escape") {
5601
5557
  const [firstHandler] = handlers;
5602
5558
  if (firstHandler) {
5603
5559
  evt.preventDefault();
5604
- (_b2 = (_a2 = firstHandler.callback).current) == null ? void 0 : _b2.call(_a2);
5560
+ firstHandler.callback.current?.();
5605
5561
  }
5606
5562
  }
5607
5563
  };
@@ -5636,10 +5592,10 @@ const useEscCloseStack = (listening, cb) => {
5636
5592
  };
5637
5593
  const __vite_import_meta_env__ = { "DEV": false, "MODE": "production" };
5638
5594
  const META_ENV = typeof import.meta !== "undefined" ? __vite_import_meta_env__ : void 0;
5639
- const NODE_ENV = typeof process !== "undefined" && ((_a = process.env) == null ? void 0 : _a.NODE_ENV) ? (_b = process.env) == null ? void 0 : _b.NODE_ENV : "production";
5640
- const isDev = NODE_ENV === "development" || !!(META_ENV == null ? void 0 : META_ENV.DEV);
5595
+ const NODE_ENV = typeof process !== "undefined" && process.env?.NODE_ENV ? process.env?.NODE_ENV : "production";
5596
+ const isDev = NODE_ENV === "development" || !!META_ENV?.DEV;
5641
5597
  const isJSDomLike = typeof navigator !== "undefined" && /(jsdom|happy-dom)/i.test(navigator.userAgent) || typeof globalThis.happyDOM === "object";
5642
- const isTest = NODE_ENV === "test" || (META_ENV == null ? void 0 : META_ENV.MODE) === "test" || isJSDomLike;
5598
+ const isTest = NODE_ENV === "test" || META_ENV?.MODE === "test" || isJSDomLike;
5643
5599
  const hasWindow = typeof window !== "undefined";
5644
5600
  const hasDocument = typeof document !== "undefined";
5645
5601
  const canUseDOM = hasWindow && hasDocument;
@@ -5794,23 +5750,22 @@ const Input = (props) => {
5794
5750
  };
5795
5751
  const [focused, setFocused] = useState(false);
5796
5752
  useEffect(() => {
5797
- var _a2;
5798
5753
  if (autoSelect) {
5799
- (_a2 = inputRef.current) == null ? void 0 : _a2.select();
5754
+ inputRef.current?.select();
5800
5755
  }
5801
5756
  }, [autoSelect]);
5802
5757
  const handleAnimationStart = (evt) => {
5803
- onAnimationStart == null ? void 0 : onAnimationStart(evt);
5758
+ onAnimationStart?.(evt);
5804
5759
  if (evt.animationName === "native-autofill-in") {
5805
- onAutofill == null ? void 0 : onAutofill();
5760
+ onAutofill?.();
5806
5761
  }
5807
5762
  };
5808
5763
  return jsxs("div", { className: clsx(s$9.Container, className), "data-variant": variant, "data-size": size2, "data-gutter-size": gutterSize, "data-focused": focused, "data-disabled": disabled ? "" : void 0, "data-readonly": readOnly ? "" : void 0, "data-invalid": invalid ? "" : void 0, "data-pill": pill ? "" : void 0, "data-optically-align": opticallyAlign, "data-has-start-adornment": StartAdornment ? "" : void 0, "data-has-end-adornment": EndAdornment ? "" : void 0, onMouseDown: handleMouseDown, children: [StartAdornment, jsx("input", { ...restProps, ref: o([ref, inputRef]), id: id || (allowAutofillExtensions ? void 0 : onePasswordPreventionId), className: s$9.Input, type, name, readOnly, disabled, onFocus: (evt) => {
5809
5764
  setFocused(true);
5810
- onFocus == null ? void 0 : onFocus(evt);
5765
+ onFocus?.(evt);
5811
5766
  }, onBlur: (evt) => {
5812
5767
  setFocused(false);
5813
- onBlur == null ? void 0 : onBlur(evt);
5768
+ onBlur?.(evt);
5814
5769
  }, onAnimationStart: handleAnimationStart, "data-lpignore": allowAutofillExtensions ? void 0 : true, "data-1p-ignore": allowAutofillExtensions ? void 0 : true }), EndAdornment] });
5815
5770
  };
5816
5771
  const flattenTextNodes = (children) => {
@@ -5859,9 +5814,140 @@ const wrapTextNodeSiblings = (children) => {
5859
5814
  });
5860
5815
  };
5861
5816
  createContext(null);
5862
- var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
5863
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
5864
- freeGlobal || freeSelf || Function("return this")();
5817
+ var lodash_debounce;
5818
+ var hasRequiredLodash_debounce;
5819
+ function requireLodash_debounce() {
5820
+ if (hasRequiredLodash_debounce) return lodash_debounce;
5821
+ hasRequiredLodash_debounce = 1;
5822
+ var FUNC_ERROR_TEXT = "Expected a function";
5823
+ var NAN = 0 / 0;
5824
+ var symbolTag = "[object Symbol]";
5825
+ var reTrim = /^\s+|\s+$/g;
5826
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
5827
+ var reIsBinary = /^0b[01]+$/i;
5828
+ var reIsOctal = /^0o[0-7]+$/i;
5829
+ var freeParseInt = parseInt;
5830
+ var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
5831
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
5832
+ var root = freeGlobal || freeSelf || Function("return this")();
5833
+ var objectProto = Object.prototype;
5834
+ var objectToString = objectProto.toString;
5835
+ var nativeMax = Math.max, nativeMin = Math.min;
5836
+ var now = function() {
5837
+ return root.Date.now();
5838
+ };
5839
+ function debounce(func, wait, options) {
5840
+ var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
5841
+ if (typeof func != "function") {
5842
+ throw new TypeError(FUNC_ERROR_TEXT);
5843
+ }
5844
+ wait = toNumber(wait) || 0;
5845
+ if (isObject(options)) {
5846
+ leading = !!options.leading;
5847
+ maxing = "maxWait" in options;
5848
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
5849
+ trailing = "trailing" in options ? !!options.trailing : trailing;
5850
+ }
5851
+ function invokeFunc(time) {
5852
+ var args = lastArgs, thisArg = lastThis;
5853
+ lastArgs = lastThis = void 0;
5854
+ lastInvokeTime = time;
5855
+ result = func.apply(thisArg, args);
5856
+ return result;
5857
+ }
5858
+ function leadingEdge(time) {
5859
+ lastInvokeTime = time;
5860
+ timerId = setTimeout(timerExpired, wait);
5861
+ return leading ? invokeFunc(time) : result;
5862
+ }
5863
+ function remainingWait(time) {
5864
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, result2 = wait - timeSinceLastCall;
5865
+ return maxing ? nativeMin(result2, maxWait - timeSinceLastInvoke) : result2;
5866
+ }
5867
+ function shouldInvoke(time) {
5868
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
5869
+ return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
5870
+ }
5871
+ function timerExpired() {
5872
+ var time = now();
5873
+ if (shouldInvoke(time)) {
5874
+ return trailingEdge(time);
5875
+ }
5876
+ timerId = setTimeout(timerExpired, remainingWait(time));
5877
+ }
5878
+ function trailingEdge(time) {
5879
+ timerId = void 0;
5880
+ if (trailing && lastArgs) {
5881
+ return invokeFunc(time);
5882
+ }
5883
+ lastArgs = lastThis = void 0;
5884
+ return result;
5885
+ }
5886
+ function cancel() {
5887
+ if (timerId !== void 0) {
5888
+ clearTimeout(timerId);
5889
+ }
5890
+ lastInvokeTime = 0;
5891
+ lastArgs = lastCallTime = lastThis = timerId = void 0;
5892
+ }
5893
+ function flush() {
5894
+ return timerId === void 0 ? result : trailingEdge(now());
5895
+ }
5896
+ function debounced() {
5897
+ var time = now(), isInvoking = shouldInvoke(time);
5898
+ lastArgs = arguments;
5899
+ lastThis = this;
5900
+ lastCallTime = time;
5901
+ if (isInvoking) {
5902
+ if (timerId === void 0) {
5903
+ return leadingEdge(lastCallTime);
5904
+ }
5905
+ if (maxing) {
5906
+ timerId = setTimeout(timerExpired, wait);
5907
+ return invokeFunc(lastCallTime);
5908
+ }
5909
+ }
5910
+ if (timerId === void 0) {
5911
+ timerId = setTimeout(timerExpired, wait);
5912
+ }
5913
+ return result;
5914
+ }
5915
+ debounced.cancel = cancel;
5916
+ debounced.flush = flush;
5917
+ return debounced;
5918
+ }
5919
+ function isObject(value) {
5920
+ var type = typeof value;
5921
+ return !!value && (type == "object" || type == "function");
5922
+ }
5923
+ function isObjectLike(value) {
5924
+ return !!value && typeof value == "object";
5925
+ }
5926
+ function isSymbol(value) {
5927
+ return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
5928
+ }
5929
+ function toNumber(value) {
5930
+ if (typeof value == "number") {
5931
+ return value;
5932
+ }
5933
+ if (isSymbol(value)) {
5934
+ return NAN;
5935
+ }
5936
+ if (isObject(value)) {
5937
+ var other = typeof value.valueOf == "function" ? value.valueOf() : value;
5938
+ value = isObject(other) ? other + "" : other;
5939
+ }
5940
+ if (typeof value != "string") {
5941
+ return value === 0 ? value : +value;
5942
+ }
5943
+ value = value.replace(reTrim, "");
5944
+ var isBinary = reIsBinary.test(value);
5945
+ return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
5946
+ }
5947
+ lodash_debounce = debounce;
5948
+ return lodash_debounce;
5949
+ }
5950
+ requireLodash_debounce();
5865
5951
  var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
5866
5952
  function useIsMounted() {
5867
5953
  const isMounted = useRef(false);
@@ -6230,7 +6316,7 @@ const Button = (props) => {
6230
6316
  if (disabled) {
6231
6317
  return;
6232
6318
  }
6233
- onClick == null ? void 0 : onClick(e);
6319
+ onClick?.(e);
6234
6320
  }, [onClick, disabled]);
6235
6321
  return jsxs("button", {
6236
6322
  type,
@@ -6285,8 +6371,8 @@ const SelectControl = ({ ref, onPointerDown, onKeyDown, onPointerEnter, onIntera
6285
6371
  const hasAnyTertiaryIndicator = showClearAction || loading || hasDropdownIcon;
6286
6372
  const isInteractive = !loading && !disabled;
6287
6373
  const handleKeyDown2 = (evt) => {
6288
- var _a2;
6289
6374
  switch (evt.key) {
6375
+ // NOTE: "Enter" does not open selects, as it may be an attempt to submit a form
6290
6376
  case "ArrowDown":
6291
6377
  case "ArrowUp":
6292
6378
  case " ":
@@ -6295,7 +6381,7 @@ const SelectControl = ({ ref, onPointerDown, onKeyDown, onPointerEnter, onIntera
6295
6381
  if (onInteract) {
6296
6382
  onInteract();
6297
6383
  } else {
6298
- (_a2 = controlRef.current) == null ? void 0 : _a2.dispatchEvent(new PointerEvent("pointerdown", {
6384
+ controlRef.current?.dispatchEvent(new PointerEvent("pointerdown", {
6299
6385
  bubbles: true,
6300
6386
  cancelable: true,
6301
6387
  pointerType: "mouse"
@@ -6306,11 +6392,10 @@ const SelectControl = ({ ref, onPointerDown, onKeyDown, onPointerEnter, onIntera
6306
6392
  case "Enter":
6307
6393
  break;
6308
6394
  default:
6309
- onKeyDown == null ? void 0 : onKeyDown(evt);
6395
+ onKeyDown?.(evt);
6310
6396
  }
6311
6397
  };
6312
6398
  const handlePointerDown = (evt) => {
6313
- var _a2;
6314
6399
  if (evt.button === 2) {
6315
6400
  return;
6316
6401
  }
@@ -6319,8 +6404,8 @@ const SelectControl = ({ ref, onPointerDown, onKeyDown, onPointerEnter, onIntera
6319
6404
  evt.preventDefault();
6320
6405
  onInteract();
6321
6406
  } else {
6322
- onPointerDown == null ? void 0 : onPointerDown(evt);
6323
- (_a2 = restProps.onClick) == null ? void 0 : _a2.call(restProps, evt);
6407
+ onPointerDown?.(evt);
6408
+ restProps.onClick?.(evt);
6324
6409
  }
6325
6410
  };
6326
6411
  return (
@@ -6333,7 +6418,7 @@ const SelectControl = ({ ref, onPointerDown, onKeyDown, onPointerEnter, onIntera
6333
6418
  tabIndex: disabled ? -1 : 0,
6334
6419
  onPointerEnter: (evt) => {
6335
6420
  handlePressableMouseEnter(evt);
6336
- onPointerEnter == null ? void 0 : onPointerEnter(evt);
6421
+ onPointerEnter?.(evt);
6337
6422
  },
6338
6423
  onPointerDown: isInteractive ? handlePointerDown : void 0,
6339
6424
  onKeyDown: isInteractive ? handleKeyDown2 : void 0,
@@ -6405,10 +6490,10 @@ const Tooltip = (props) => {
6405
6490
  };
6406
6491
  return jsxs(Root, { open, delayDuration: openDelay, onOpenChange: handleOpenChange, disableHoverableContent: !interactive, children: [jsx(Trigger$1, { asChild: true, children: jsx(Slot$1, { ...restProps, ref: forwardedRef, onPointerDown: (evt) => {
6407
6492
  maybePreventClickClose(evt);
6408
- onPointerDown == null ? void 0 : onPointerDown(evt);
6493
+ onPointerDown?.(evt);
6409
6494
  }, onClick: (evt) => {
6410
6495
  maybePreventClickClose(evt);
6411
- onClick == null ? void 0 : onClick(evt);
6496
+ onClick?.(evt);
6412
6497
  }, children }) }), jsx(Content, { maxWidth, compact, align, alignOffset, side, sideOffset, gutterSize, className: contentClassName, children: content })] });
6413
6498
  };
6414
6499
  const Root = ({ children, open, onOpenChange, ...restProps }) => {
@@ -6518,8 +6603,7 @@ const Select = (props) => {
6518
6603
  const propActionsRef = useRef(propActions);
6519
6604
  propActionsRef.current = propActions;
6520
6605
  const onActionSelect = useCallback((actionId) => {
6521
- var _a2;
6522
- (_a2 = propActionsRef.current.find((a) => a.id === actionId)) == null ? void 0 : _a2.onSelect(actionId);
6606
+ propActionsRef.current.find((a) => a.id === actionId)?.onSelect(actionId);
6523
6607
  }, []);
6524
6608
  const optionsCount = useMemo(() => isOptionGroupArray(options) ? options.reduce((acc, group) => {
6525
6609
  return acc + group.options.length;
@@ -6667,7 +6751,7 @@ const SelectTrigger = (props) => {
6667
6751
  };
6668
6752
  const handleClearClick = () => {
6669
6753
  onSelectRef.current({ value: "", label: "" });
6670
- onOpenChange == null ? void 0 : onOpenChange(false);
6754
+ onOpenChange?.(false);
6671
6755
  };
6672
6756
  return jsxs(SelectControl, { id: triggerId, className: triggerClassName, selected: !isPlaceholder, variant, pill, block, size: size2, disabled, loading, StartIcon: TriggerStartIcon, opticallyAlign, dropdownIconType, onClearClick: clearable ? handleClearClick : void 0, onInteract: onOpenChange, onKeyDown: handleKeyDown2, ...restProps, children: [multiple ? jsx(TriggerView, { ...multipleTriggerViewProps }) : jsx(TriggerView, { ...selectedItem }), (name || id) && jsx("input", {
6673
6757
  id,
@@ -6675,8 +6759,7 @@ const SelectTrigger = (props) => {
6675
6759
  value: firstValue,
6676
6760
  tabIndex: -1,
6677
6761
  onFocus: () => {
6678
- var _a2;
6679
- (_a2 = document.getElementById(triggerId)) == null ? void 0 : _a2.focus();
6762
+ document.getElementById(triggerId)?.focus();
6680
6763
  },
6681
6764
  // keep react from complaining - don't make this readOnly because that
6682
6765
  // prevents the value from being required
@@ -6696,7 +6779,6 @@ const CustomSelect = () => {
6696
6779
  setOpen(nextState);
6697
6780
  if (!nextState) {
6698
6781
  setTimeout(() => {
6699
- var _a2;
6700
6782
  if (!selectContentRef.current) {
6701
6783
  return;
6702
6784
  }
@@ -6704,7 +6786,7 @@ const CustomSelect = () => {
6704
6786
  if (activeElement && !selectContentRef.current.contains(activeElement)) {
6705
6787
  return;
6706
6788
  }
6707
- (_a2 = document.getElementById(triggerId)) == null ? void 0 : _a2.focus();
6789
+ document.getElementById(triggerId)?.focus();
6708
6790
  });
6709
6791
  }
6710
6792
  };
@@ -6755,9 +6837,8 @@ const CustomSelectMenu = ({ onOpenChange }) => {
6755
6837
  const searchInputRef = useRef(null);
6756
6838
  const [searchTerm, setSearchTerm] = useState("");
6757
6839
  const [highlightedValue, setHighlightedValue] = useState(() => {
6758
- var _a2;
6759
6840
  const selectedValue = multiple ? value[0] : value;
6760
- return (selectedValue || ((_a2 = getFirstValidOption(options)) == null ? void 0 : _a2.value)) ?? "";
6841
+ return (selectedValue || getFirstValidOption(options)?.value) ?? "";
6761
6842
  });
6762
6843
  const typeahead = useMemo(() => createTypeahead(), []);
6763
6844
  const internalListId = useId$1();
@@ -6770,7 +6851,7 @@ const CustomSelectMenu = ({ onOpenChange }) => {
6770
6851
  const handleKeyDown2 = (evt) => {
6771
6852
  const key = evt.key;
6772
6853
  const firstValue = multiple ? value[0] : value;
6773
- const targetValue = highlightedValue || (firstOption == null ? void 0 : firstOption.value) || firstValue;
6854
+ const targetValue = highlightedValue || firstOption?.value || firstValue;
6774
6855
  const isFocusedInSearch = document.activeElement === searchInputRef.current;
6775
6856
  const menuElement = menuRef.current;
6776
6857
  if (!menuElement) {
@@ -6783,7 +6864,7 @@ const CustomSelectMenu = ({ onOpenChange }) => {
6783
6864
  pointerType: "mouse"
6784
6865
  });
6785
6866
  const selectedOption = findOptionByValue(highlightedValue, menuElement);
6786
- selectedOption == null ? void 0 : selectedOption.dispatchEvent(pointerUpEvent);
6867
+ selectedOption?.dispatchEvent(pointerUpEvent);
6787
6868
  };
6788
6869
  const highlightOption = (val, element) => {
6789
6870
  setHighlightedValue(val);
@@ -6814,7 +6895,7 @@ const CustomSelectMenu = ({ onOpenChange }) => {
6814
6895
  return;
6815
6896
  }
6816
6897
  const nextElement = findNextOption(highlightedValue, menuElement);
6817
- const nextValue = nextElement == null ? void 0 : nextElement.getAttribute("data-option-id");
6898
+ const nextValue = nextElement?.getAttribute("data-option-id");
6818
6899
  if (nextElement && nextValue) {
6819
6900
  highlightOption(nextValue, nextElement);
6820
6901
  }
@@ -6827,7 +6908,7 @@ const CustomSelectMenu = ({ onOpenChange }) => {
6827
6908
  return;
6828
6909
  }
6829
6910
  const previousElement = findPreviousOption(targetValue, menuElement);
6830
- const previousValue = previousElement == null ? void 0 : previousElement.getAttribute("data-option-id");
6911
+ const previousValue = previousElement?.getAttribute("data-option-id");
6831
6912
  if (previousElement && previousValue) {
6832
6913
  highlightOption(previousValue, previousElement);
6833
6914
  }
@@ -6878,10 +6959,10 @@ const CustomSelectMenu = ({ onOpenChange }) => {
6878
6959
  return;
6879
6960
  }
6880
6961
  const currentOption = findOptionByValue(highlightedValue, menuRef.current);
6881
- currentOption == null ? void 0 : currentOption.scrollIntoView({ block: "center" });
6962
+ currentOption?.scrollIntoView({ block: "center" });
6882
6963
  });
6883
6964
  const autoFocusTarget = searchInputRef.current || menuRef.current;
6884
- autoFocusTarget == null ? void 0 : autoFocusTarget.focus({ preventScroll: true });
6965
+ autoFocusTarget?.focus({ preventScroll: true });
6885
6966
  return () => {
6886
6967
  isMountStableRef.current = false;
6887
6968
  };
@@ -6980,12 +7061,11 @@ const CustomSelectOption = (option) => {
6980
7061
  const isSelected = multiple ? propsValue.includes(value) : value === currentValue;
6981
7062
  const isHighlighted = value === highlightedValue;
6982
7063
  const handlePointerUp = () => {
6983
- var _a2;
6984
7064
  if (multiple) {
6985
7065
  onSelectRef.current(option, isSelected);
6986
7066
  } else {
6987
7067
  onSelectRef.current(option);
6988
- (_a2 = requestCloseRef.current) == null ? void 0 : _a2.call(requestCloseRef);
7068
+ requestCloseRef.current?.();
6989
7069
  }
6990
7070
  };
6991
7071
  const handlePointerMove = () => {
@@ -7042,9 +7122,8 @@ const CustomSelectAction = ({ id, label, Icon, className }) => {
7042
7122
  }
7043
7123
  };
7044
7124
  const handlePointerUp = () => {
7045
- var _a2;
7046
7125
  onActionSelect(id);
7047
- (_a2 = requestCloseRef.current) == null ? void 0 : _a2.call(requestCloseRef);
7126
+ requestCloseRef.current?.();
7048
7127
  };
7049
7128
  return jsx("div", { className: s$3.Action, onPointerUp: handlePointerUp, onKeyDown: handleKeyDown2, tabIndex: 0, children: jsxs("div", { className: clsx(s$3.ActionInner, className), children: [Icon && jsx(Icon, { role: "presentation" }), label] }) });
7050
7129
  };
@@ -7133,7 +7212,7 @@ const findOptionByValue = (currentValue, container) => container.querySelector(`
7133
7212
  const isValidOptionNode = (node) => node.matches("[data-option-id]:not([data-disabled])");
7134
7213
  const findNextOption = (currentValue, container) => {
7135
7214
  const currentOption = findOptionByValue(currentValue, container);
7136
- let nextNode = currentOption == null ? void 0 : currentOption.nextElementSibling;
7215
+ let nextNode = currentOption?.nextElementSibling;
7137
7216
  let maxSteps = 0;
7138
7217
  while (nextNode && maxSteps < MAX_DOM_CRAWLS) {
7139
7218
  if (isValidOptionNode(nextNode)) {
@@ -7145,7 +7224,7 @@ const findNextOption = (currentValue, container) => {
7145
7224
  };
7146
7225
  const findPreviousOption = (currentValue, container) => {
7147
7226
  const currentOption = findOptionByValue(currentValue, container);
7148
- let nextNode = currentOption == null ? void 0 : currentOption.previousElementSibling;
7227
+ let nextNode = currentOption?.previousElementSibling;
7149
7228
  let maxSteps = 0;
7150
7229
  while (nextNode && maxSteps < MAX_DOM_CRAWLS) {
7151
7230
  if (isValidOptionNode(nextNode)) {
@@ -7266,15 +7345,14 @@ const Textarea = (props) => {
7266
7345
  const [focused, setFocused] = useState(false);
7267
7346
  const computedMaxRows = autoResize ? Math.max(maxRows ?? 10, rows) : rows;
7268
7347
  useEffect(() => {
7269
- var _a2;
7270
7348
  if (autoSelect) {
7271
- (_a2 = textAreaRef.current) == null ? void 0 : _a2.select();
7349
+ textAreaRef.current?.select();
7272
7350
  }
7273
7351
  }, [autoSelect]);
7274
7352
  const handleAnimationStart = (evt) => {
7275
- onAnimationStart == null ? void 0 : onAnimationStart(evt);
7353
+ onAnimationStart?.(evt);
7276
7354
  if (evt.animationName === "native-autofill-in") {
7277
- onAutofill == null ? void 0 : onAutofill();
7355
+ onAutofill?.();
7278
7356
  }
7279
7357
  };
7280
7358
  const autosizeTextarea = useCallback(() => {
@@ -7291,14 +7369,14 @@ const Textarea = (props) => {
7291
7369
  "textarea-min-rows": `${rows}`,
7292
7370
  "textarea-max-rows": `${computedMaxRows}`
7293
7371
  }), children: jsx("textarea", { ...restProps, onChange: (evt) => {
7294
- onChange == null ? void 0 : onChange(evt);
7372
+ onChange?.(evt);
7295
7373
  autosizeTextarea();
7296
7374
  }, ref: o([textAreaRef, ref]), id: id || (allowAutofillExtensions ? void 0 : onePasswordPreventionId), className: s$1.Textarea, name, readOnly, disabled, rows, onFocus: (evt) => {
7297
7375
  setFocused(true);
7298
- onFocus == null ? void 0 : onFocus(evt);
7376
+ onFocus?.(evt);
7299
7377
  }, onBlur: (evt) => {
7300
7378
  setFocused(false);
7301
- onBlur == null ? void 0 : onBlur(evt);
7379
+ onBlur?.(evt);
7302
7380
  }, onAnimationStart: handleAnimationStart, "data-lpignore": allowAutofillExtensions ? void 0 : true, "data-1p-ignore": allowAutofillExtensions ? void 0 : true }) });
7303
7381
  };
7304
7382
  const SegmentedControl$1 = "_SegmentedControl_1sl7d_1";
@@ -7318,7 +7396,7 @@ const SegmentedControl = ({ value, onChange, children, block, pill = true, size:
7318
7396
  if (!root || !thumb) {
7319
7397
  return;
7320
7398
  }
7321
- const activeNode = root == null ? void 0 : root.querySelector('[data-state="on"]');
7399
+ const activeNode = root?.querySelector('[data-state="on"]');
7322
7400
  if (!activeNode) {
7323
7401
  return;
7324
7402
  }
@@ -7568,7 +7646,7 @@ function SidebarTextarea({
7568
7646
  maxRows = 8,
7569
7647
  error
7570
7648
  }) {
7571
- const contentRows = (value == null ? void 0 : value.split("\n").length) ?? 1;
7649
+ const contentRows = value?.split("\n").length ?? 1;
7572
7650
  const rows = Math.min(contentRows, maxRows);
7573
7651
  return /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
7574
7652
  /* @__PURE__ */ jsx(
@@ -7688,7 +7766,7 @@ function generateCSP(csp, scriptSrc) {
7688
7766
  if (scriptOrigin) {
7689
7767
  connectSources.add(scriptOrigin);
7690
7768
  }
7691
- if (csp == null ? void 0 : csp.connect_domains) {
7769
+ if (csp?.connect_domains) {
7692
7770
  for (const domain of csp.connect_domains) {
7693
7771
  connectSources.add(domain);
7694
7772
  }
@@ -7698,7 +7776,7 @@ function generateCSP(csp, scriptSrc) {
7698
7776
  if (scriptOrigin) {
7699
7777
  resourceSources.add(scriptOrigin);
7700
7778
  }
7701
- if (csp == null ? void 0 : csp.resource_domains) {
7779
+ if (csp?.resource_domains) {
7702
7780
  for (const domain of csp.resource_domains) {
7703
7781
  resourceSources.add(domain);
7704
7782
  }
@@ -8039,7 +8117,6 @@ function IframeResource({ scriptSrc, className, style, csp }) {
8039
8117
  }, [sendUpdate]);
8040
8118
  const handlePortMessage = useCallback(
8041
8119
  (event) => {
8042
- var _a2, _b2;
8043
8120
  if (!event.data || typeof event.data !== "object" || typeof event.data.type !== "string") {
8044
8121
  return;
8045
8122
  }
@@ -8060,7 +8137,7 @@ function IframeResource({ scriptSrc, className, style, csp }) {
8060
8137
  console.warn("[IframeResource] Invalid display mode:", mode);
8061
8138
  return;
8062
8139
  }
8063
- if (typeof window !== "undefined" && ((_a2 = window.openai) == null ? void 0 : _a2.requestDisplayMode)) {
8140
+ if (typeof window !== "undefined" && window.openai?.requestDisplayMode) {
8064
8141
  window.openai.requestDisplayMode({ mode });
8065
8142
  }
8066
8143
  break;
@@ -8071,7 +8148,7 @@ function IframeResource({ scriptSrc, className, style, csp }) {
8071
8148
  console.warn("[IframeResource] Invalid widgetState payload");
8072
8149
  return;
8073
8150
  }
8074
- if (typeof window !== "undefined" && ((_b2 = window.openai) == null ? void 0 : _b2.setWidgetState)) {
8151
+ if (typeof window !== "undefined" && window.openai?.setWidgetState) {
8075
8152
  window.openai.setWidgetState(payload);
8076
8153
  }
8077
8154
  break;
@@ -8118,7 +8195,7 @@ function IframeResource({ scriptSrc, className, style, csp }) {
8118
8195
  channel.port1.onmessage = handlePortMessage;
8119
8196
  channel.port1.start();
8120
8197
  const iframe = iframeRef.current;
8121
- if (iframe == null ? void 0 : iframe.contentWindow) {
8198
+ if (iframe?.contentWindow) {
8122
8199
  iframe.contentWindow.postMessage({ type: "openai:handshake" }, "*", [channel.port2]);
8123
8200
  }
8124
8201
  }
@@ -8195,13 +8272,13 @@ function Conversation({
8195
8272
  const displayMode = useDisplayMode() ?? "inline";
8196
8273
  const api = useWidgetAPI();
8197
8274
  const userAgent = useUserAgent();
8198
- const isDesktop = (userAgent == null ? void 0 : userAgent.device.type) === "desktop";
8275
+ const isDesktop = userAgent?.device.type === "desktop";
8199
8276
  const containerWidth = screenWidth === "full" ? "100%" : `${SCREEN_WIDTHS[screenWidth]}px`;
8200
- const widgetCSP = resourceMeta == null ? void 0 : resourceMeta["openai/widgetCSP"];
8277
+ const widgetCSP = resourceMeta?.["openai/widgetCSP"];
8201
8278
  const content = iframeScriptSrc ? /* @__PURE__ */ jsx(IframeResource, { scriptSrc: iframeScriptSrc, className: "h-full w-full", csp: widgetCSP }) : children;
8202
8279
  if (displayMode === "fullscreen") {
8203
8280
  const handleClose = () => {
8204
- if (api == null ? void 0 : api.requestDisplayMode) {
8281
+ if (api?.requestDisplayMode) {
8205
8282
  api.requestDisplayMode({ mode: "inline" });
8206
8283
  }
8207
8284
  };
@@ -8235,8 +8312,8 @@ function Conversation({
8235
8312
  color: "primary",
8236
8313
  className: "bg-token-bg-primary",
8237
8314
  onClick: () => {
8238
- const widgetDomain = resourceMeta == null ? void 0 : resourceMeta["openai/widgetDomain"];
8239
- if ((api == null ? void 0 : api.openExternal) && widgetDomain) {
8315
+ const widgetDomain = resourceMeta?.["openai/widgetDomain"];
8316
+ if (api?.openExternal && widgetDomain) {
8240
8317
  api.openExternal({ href: widgetDomain });
8241
8318
  }
8242
8319
  },
@@ -8328,7 +8405,7 @@ function Conversation({
8328
8405
  "button",
8329
8406
  {
8330
8407
  onClick: () => {
8331
- if (api == null ? void 0 : api.requestDisplayMode) {
8408
+ if (api?.requestDisplayMode) {
8332
8409
  api.requestDisplayMode({ mode: "inline" });
8333
8410
  }
8334
8411
  },
@@ -8367,32 +8444,30 @@ function Conversation({
8367
8444
  );
8368
8445
  }
8369
8446
  class MockOpenAI {
8370
- constructor() {
8371
- __publicField(this, "theme", "light");
8372
- __publicField(this, "userAgent", {
8373
- device: { type: "desktop" },
8374
- capabilities: {
8375
- hover: true,
8376
- touch: false
8377
- }
8378
- });
8379
- __publicField(this, "locale", "en-US");
8380
- __publicField(this, "maxHeight");
8381
- __publicField(this, "displayMode", "inline");
8382
- __publicField(this, "safeArea", {
8383
- insets: {
8384
- top: 0,
8385
- bottom: 0,
8386
- left: 0,
8387
- right: 0
8388
- }
8389
- });
8390
- __publicField(this, "view", null);
8391
- __publicField(this, "toolInput", {});
8392
- __publicField(this, "toolOutput", null);
8393
- __publicField(this, "toolResponseMetadata", null);
8394
- __publicField(this, "widgetState", null);
8395
- }
8447
+ theme = "light";
8448
+ userAgent = {
8449
+ device: { type: "desktop" },
8450
+ capabilities: {
8451
+ hover: true,
8452
+ touch: false
8453
+ }
8454
+ };
8455
+ locale = "en-US";
8456
+ maxHeight = void 0;
8457
+ displayMode = "inline";
8458
+ safeArea = {
8459
+ insets: {
8460
+ top: 0,
8461
+ bottom: 0,
8462
+ left: 0,
8463
+ right: 0
8464
+ }
8465
+ };
8466
+ view = null;
8467
+ toolInput = {};
8468
+ toolOutput = null;
8469
+ toolResponseMetadata = null;
8470
+ widgetState = null;
8396
8471
  async callTool(name, args) {
8397
8472
  console.log("Mock callTool:", name, args);
8398
8473
  return { result: JSON.stringify({ success: true }) };
@@ -8479,37 +8554,37 @@ class MockOpenAI {
8479
8554
  function initMockOpenAI(initialData) {
8480
8555
  if (typeof window !== "undefined") {
8481
8556
  const mock = new MockOpenAI();
8482
- if ((initialData == null ? void 0 : initialData.theme) !== void 0) {
8557
+ if (initialData?.theme !== void 0) {
8483
8558
  mock.theme = initialData.theme;
8484
8559
  }
8485
- if ((initialData == null ? void 0 : initialData.userAgent) !== void 0) {
8560
+ if (initialData?.userAgent !== void 0) {
8486
8561
  mock.userAgent = initialData.userAgent;
8487
8562
  }
8488
- if ((initialData == null ? void 0 : initialData.locale) !== void 0) {
8563
+ if (initialData?.locale !== void 0) {
8489
8564
  mock.locale = initialData.locale;
8490
8565
  }
8491
- if ((initialData == null ? void 0 : initialData.maxHeight) !== void 0) {
8566
+ if (initialData?.maxHeight !== void 0) {
8492
8567
  mock.maxHeight = initialData.maxHeight;
8493
8568
  }
8494
- if ((initialData == null ? void 0 : initialData.displayMode) !== void 0) {
8569
+ if (initialData?.displayMode !== void 0) {
8495
8570
  mock.displayMode = initialData.displayMode;
8496
8571
  }
8497
- if ((initialData == null ? void 0 : initialData.safeArea) !== void 0) {
8572
+ if (initialData?.safeArea !== void 0) {
8498
8573
  mock.safeArea = initialData.safeArea;
8499
8574
  }
8500
- if ((initialData == null ? void 0 : initialData.view) !== void 0) {
8575
+ if (initialData?.view !== void 0) {
8501
8576
  mock.view = initialData.view;
8502
8577
  }
8503
- if ((initialData == null ? void 0 : initialData.toolInput) !== void 0) {
8578
+ if (initialData?.toolInput !== void 0) {
8504
8579
  mock.toolInput = initialData.toolInput;
8505
8580
  }
8506
- if ((initialData == null ? void 0 : initialData.toolOutput) !== void 0) {
8581
+ if (initialData?.toolOutput !== void 0) {
8507
8582
  mock.toolOutput = initialData.toolOutput;
8508
8583
  }
8509
- if ((initialData == null ? void 0 : initialData.toolResponseMetadata) !== void 0) {
8584
+ if (initialData?.toolResponseMetadata !== void 0) {
8510
8585
  mock.toolResponseMetadata = initialData.toolResponseMetadata;
8511
8586
  }
8512
- if ((initialData == null ? void 0 : initialData.widgetState) !== void 0) {
8587
+ if (initialData?.widgetState !== void 0) {
8513
8588
  mock.widgetState = initialData.widgetState;
8514
8589
  }
8515
8590
  window.openai = mock;
@@ -8615,7 +8690,7 @@ function ChatGPTSimulator({
8615
8690
  }, [urlParams.simulation, simulations, simulationNames]);
8616
8691
  const [selectedSimulationName, setSelectedSimulationName] = React.useState(initialSimulationName);
8617
8692
  const selectedSim = simulations[selectedSimulationName];
8618
- const userMessage = selectedSim == null ? void 0 : selectedSim.userMessage;
8693
+ const userMessage = selectedSim?.userMessage;
8619
8694
  const mock = useMemo(
8620
8695
  () => initMockOpenAI({
8621
8696
  theme: urlParams.theme ?? DEFAULT_THEME,
@@ -8634,13 +8709,12 @@ function ChatGPTSimulator({
8634
8709
  resetProviderCache();
8635
8710
  }
8636
8711
  useEffect(() => {
8637
- var _a2, _b2;
8638
8712
  if (selectedSim) {
8639
- mock.toolInput = ((_a2 = selectedSim.callToolRequestParams) == null ? void 0 : _a2.arguments) ?? {};
8713
+ mock.toolInput = selectedSim.callToolRequestParams?.arguments ?? {};
8640
8714
  if (selectedSim.widgetState !== void 0) {
8641
8715
  mock.setWidgetStateExternal(selectedSim.widgetState);
8642
8716
  }
8643
- mock.toolOutput = ((_b2 = selectedSim.callToolResult) == null ? void 0 : _b2.structuredContent) ?? null;
8717
+ mock.toolOutput = selectedSim.callToolResult?.structuredContent ?? null;
8644
8718
  }
8645
8719
  }, [selectedSimulationName, selectedSim, mock]);
8646
8720
  const theme = useTheme() ?? DEFAULT_THEME;
@@ -8667,7 +8741,7 @@ function ChatGPTSimulator({
8667
8741
  () => JSON.stringify(widgetState ?? null, null, 2)
8668
8742
  );
8669
8743
  const [viewParamsJson, setViewParamsJson] = useState(
8670
- () => JSON.stringify((view == null ? void 0 : view.params) ?? {}, null, 2)
8744
+ () => JSON.stringify(view?.params ?? {}, null, 2)
8671
8745
  );
8672
8746
  const [editingField, setEditingField] = useState(null);
8673
8747
  const [toolInputError, setToolInputError] = useState("");
@@ -8722,7 +8796,7 @@ function ChatGPTSimulator({
8722
8796
  setWidgetStateError("");
8723
8797
  }
8724
8798
  if (editingField !== "viewParams") {
8725
- setViewParamsJson(JSON.stringify((view == null ? void 0 : view.params) ?? {}, null, 2));
8799
+ setViewParamsJson(JSON.stringify(view?.params ?? {}, null, 2));
8726
8800
  setViewParamsError("");
8727
8801
  }
8728
8802
  }, [
@@ -8731,7 +8805,7 @@ function ChatGPTSimulator({
8731
8805
  toolOutput,
8732
8806
  toolResponseMetadata,
8733
8807
  widgetState,
8734
- view == null ? void 0 : view.params,
8808
+ view?.params,
8735
8809
  editingField
8736
8810
  ]);
8737
8811
  const validateJSON = (json, setJson, setError) => {
@@ -8756,8 +8830,8 @@ function ChatGPTSimulator({
8756
8830
  setEditingField(null);
8757
8831
  }
8758
8832
  };
8759
- const SelectedComponent = selectedSim == null ? void 0 : selectedSim.resourceComponent;
8760
- const iframeScriptSrc = !SelectedComponent ? selectedSim == null ? void 0 : selectedSim.resourceScript : void 0;
8833
+ const SelectedComponent = selectedSim?.resourceComponent;
8834
+ const iframeScriptSrc = !SelectedComponent ? selectedSim?.resourceScript : void 0;
8761
8835
  const content = SelectedComponent ? /* @__PURE__ */ jsx(SelectedComponent, {}) : children;
8762
8836
  return /* @__PURE__ */ jsx(ThemeProvider, { theme, children: /* @__PURE__ */ jsx(
8763
8837
  SimpleSidebar,
@@ -8769,7 +8843,7 @@ function ChatGPTSimulator({
8769
8843
  value: selectedSimulationName,
8770
8844
  onChange: (value) => {
8771
8845
  const newSim = simulations[value];
8772
- mock.setWidgetStateExternal((newSim == null ? void 0 : newSim.widgetState) ?? null);
8846
+ mock.setWidgetStateExternal(newSim?.widgetState ?? null);
8773
8847
  setSelectedSimulationName(value);
8774
8848
  },
8775
8849
  options: simulationNames.map((name) => {
@@ -8854,7 +8928,7 @@ function ChatGPTSimulator({
8854
8928
  /* @__PURE__ */ jsx(SidebarControl, { label: "User Agent - Device", children: /* @__PURE__ */ jsx(
8855
8929
  SidebarSelect,
8856
8930
  {
8857
- value: (userAgent == null ? void 0 : userAgent.device.type) ?? "desktop",
8931
+ value: userAgent?.device.type ?? "desktop",
8858
8932
  onChange: (value) => {
8859
8933
  const deviceType = value;
8860
8934
  let capabilities;
@@ -8891,13 +8965,13 @@ function ChatGPTSimulator({
8891
8965
  /* @__PURE__ */ jsx(
8892
8966
  SidebarCheckbox,
8893
8967
  {
8894
- checked: (userAgent == null ? void 0 : userAgent.capabilities.hover) ?? true,
8968
+ checked: userAgent?.capabilities.hover ?? true,
8895
8969
  onChange: (checked) => mock.setUserAgent({
8896
8970
  ...userAgent,
8897
- device: (userAgent == null ? void 0 : userAgent.device) ?? { type: "desktop" },
8971
+ device: userAgent?.device ?? { type: "desktop" },
8898
8972
  capabilities: {
8899
8973
  hover: checked,
8900
- touch: (userAgent == null ? void 0 : userAgent.capabilities.touch) ?? false
8974
+ touch: userAgent?.capabilities.touch ?? false
8901
8975
  }
8902
8976
  }),
8903
8977
  label: "Hover"
@@ -8906,12 +8980,12 @@ function ChatGPTSimulator({
8906
8980
  /* @__PURE__ */ jsx(
8907
8981
  SidebarCheckbox,
8908
8982
  {
8909
- checked: (userAgent == null ? void 0 : userAgent.capabilities.touch) ?? false,
8983
+ checked: userAgent?.capabilities.touch ?? false,
8910
8984
  onChange: (checked) => mock.setUserAgent({
8911
8985
  ...userAgent,
8912
- device: (userAgent == null ? void 0 : userAgent.device) ?? { type: "desktop" },
8986
+ device: userAgent?.device ?? { type: "desktop" },
8913
8987
  capabilities: {
8914
- hover: (userAgent == null ? void 0 : userAgent.capabilities.hover) ?? true,
8988
+ hover: userAgent?.capabilities.hover ?? true,
8915
8989
  touch: checked
8916
8990
  }
8917
8991
  }),
@@ -8926,14 +9000,14 @@ function ChatGPTSimulator({
8926
9000
  SidebarInput,
8927
9001
  {
8928
9002
  type: "number",
8929
- value: String((safeArea == null ? void 0 : safeArea.insets.top) ?? 0),
9003
+ value: String(safeArea?.insets.top ?? 0),
8930
9004
  onChange: (value) => mock.setSafeArea({
8931
9005
  insets: {
8932
- ...safeArea == null ? void 0 : safeArea.insets,
9006
+ ...safeArea?.insets,
8933
9007
  top: Number(value),
8934
- bottom: (safeArea == null ? void 0 : safeArea.insets.bottom) ?? 0,
8935
- left: (safeArea == null ? void 0 : safeArea.insets.left) ?? 0,
8936
- right: (safeArea == null ? void 0 : safeArea.insets.right) ?? 0
9008
+ bottom: safeArea?.insets.bottom ?? 0,
9009
+ left: safeArea?.insets.left ?? 0,
9010
+ right: safeArea?.insets.right ?? 0
8937
9011
  }
8938
9012
  })
8939
9013
  }
@@ -8945,14 +9019,14 @@ function ChatGPTSimulator({
8945
9019
  SidebarInput,
8946
9020
  {
8947
9021
  type: "number",
8948
- value: String((safeArea == null ? void 0 : safeArea.insets.bottom) ?? 0),
9022
+ value: String(safeArea?.insets.bottom ?? 0),
8949
9023
  onChange: (value) => mock.setSafeArea({
8950
9024
  insets: {
8951
- ...safeArea == null ? void 0 : safeArea.insets,
8952
- top: (safeArea == null ? void 0 : safeArea.insets.top) ?? 0,
9025
+ ...safeArea?.insets,
9026
+ top: safeArea?.insets.top ?? 0,
8953
9027
  bottom: Number(value),
8954
- left: (safeArea == null ? void 0 : safeArea.insets.left) ?? 0,
8955
- right: (safeArea == null ? void 0 : safeArea.insets.right) ?? 0
9028
+ left: safeArea?.insets.left ?? 0,
9029
+ right: safeArea?.insets.right ?? 0
8956
9030
  }
8957
9031
  })
8958
9032
  }
@@ -8964,14 +9038,14 @@ function ChatGPTSimulator({
8964
9038
  SidebarInput,
8965
9039
  {
8966
9040
  type: "number",
8967
- value: String((safeArea == null ? void 0 : safeArea.insets.left) ?? 0),
9041
+ value: String(safeArea?.insets.left ?? 0),
8968
9042
  onChange: (value) => mock.setSafeArea({
8969
9043
  insets: {
8970
- ...safeArea == null ? void 0 : safeArea.insets,
8971
- top: (safeArea == null ? void 0 : safeArea.insets.top) ?? 0,
8972
- bottom: (safeArea == null ? void 0 : safeArea.insets.bottom) ?? 0,
9044
+ ...safeArea?.insets,
9045
+ top: safeArea?.insets.top ?? 0,
9046
+ bottom: safeArea?.insets.bottom ?? 0,
8973
9047
  left: Number(value),
8974
- right: (safeArea == null ? void 0 : safeArea.insets.right) ?? 0
9048
+ right: safeArea?.insets.right ?? 0
8975
9049
  }
8976
9050
  })
8977
9051
  }
@@ -8983,13 +9057,13 @@ function ChatGPTSimulator({
8983
9057
  SidebarInput,
8984
9058
  {
8985
9059
  type: "number",
8986
- value: String((safeArea == null ? void 0 : safeArea.insets.right) ?? 0),
9060
+ value: String(safeArea?.insets.right ?? 0),
8987
9061
  onChange: (value) => mock.setSafeArea({
8988
9062
  insets: {
8989
- ...safeArea == null ? void 0 : safeArea.insets,
8990
- top: (safeArea == null ? void 0 : safeArea.insets.top) ?? 0,
8991
- bottom: (safeArea == null ? void 0 : safeArea.insets.bottom) ?? 0,
8992
- left: (safeArea == null ? void 0 : safeArea.insets.left) ?? 0,
9063
+ ...safeArea?.insets,
9064
+ top: safeArea?.insets.top ?? 0,
9065
+ bottom: safeArea?.insets.bottom ?? 0,
9066
+ left: safeArea?.insets.left ?? 0,
8993
9067
  right: Number(value)
8994
9068
  }
8995
9069
  })
@@ -9000,11 +9074,11 @@ function ChatGPTSimulator({
9000
9074
  /* @__PURE__ */ jsx(SidebarControl, { label: "View Mode", children: /* @__PURE__ */ jsx(
9001
9075
  SidebarSelect,
9002
9076
  {
9003
- value: (view == null ? void 0 : view.mode) ?? "default",
9077
+ value: view?.mode ?? "default",
9004
9078
  onChange: (value) => mock.setView(
9005
9079
  value === "default" ? null : {
9006
9080
  mode: value,
9007
- params: view == null ? void 0 : view.params
9081
+ params: view?.params
9008
9082
  }
9009
9083
  ),
9010
9084
  options: [
@@ -9097,7 +9171,7 @@ function ChatGPTSimulator({
9097
9171
  appName,
9098
9172
  appIcon,
9099
9173
  userMessage,
9100
- resourceMeta: selectedSim == null ? void 0 : selectedSim.resource._meta,
9174
+ resourceMeta: selectedSim?.resource._meta,
9101
9175
  iframeScriptSrc,
9102
9176
  children: content
9103
9177
  },
@@ -9179,4 +9253,4 @@ export {
9179
9253
  getAPI as v,
9180
9254
  resetProviderCache as w
9181
9255
  };
9182
- //# sourceMappingURL=simulator-url-BZBcq5tc.js.map
9256
+ //# sourceMappingURL=simulator-url-BUKX-wRa.js.map