mcp-use 1.3.3-canary.3 → 1.3.3-canary.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.
@@ -31,6 +31,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  // src/react/index.ts
32
32
  var react_exports = {};
33
33
  __export(react_exports, {
34
+ WidgetDebugger: () => WidgetDebugger,
35
+ WidgetFullscreenWrapper: () => WidgetFullscreenWrapper,
34
36
  onMcpAuthorization: () => onMcpAuthorization,
35
37
  useMcp: () => useMcp,
36
38
  useWidget: () => useWidget,
@@ -2351,11 +2353,43 @@ function useOpenAiGlobal(key) {
2351
2353
  }
2352
2354
  __name(useOpenAiGlobal, "useOpenAiGlobal");
2353
2355
  function useWidget(defaultProps) {
2354
- console.log(window?.location?.search, window.openai);
2355
- const isOpenAiAvailable = (0, import_react2.useMemo)(
2356
- () => typeof window !== "undefined" && !!window.openai,
2357
- []
2356
+ const [isOpenAiAvailable, setIsOpenAiAvailable] = (0, import_react2.useState)(
2357
+ () => typeof window !== "undefined" && !!window.openai
2358
2358
  );
2359
+ (0, import_react2.useEffect)(() => {
2360
+ if (typeof window !== "undefined" && window.openai) {
2361
+ setIsOpenAiAvailable(true);
2362
+ return;
2363
+ }
2364
+ const checkInterval = setInterval(() => {
2365
+ if (typeof window !== "undefined" && window.openai) {
2366
+ setIsOpenAiAvailable(true);
2367
+ clearInterval(checkInterval);
2368
+ }
2369
+ }, 100);
2370
+ const handleSetGlobals = /* @__PURE__ */ __name(() => {
2371
+ if (typeof window !== "undefined" && window.openai) {
2372
+ setIsOpenAiAvailable(true);
2373
+ clearInterval(checkInterval);
2374
+ }
2375
+ }, "handleSetGlobals");
2376
+ if (typeof window !== "undefined") {
2377
+ window.addEventListener(SET_GLOBALS_EVENT_TYPE, handleSetGlobals);
2378
+ }
2379
+ const timeout = setTimeout(() => {
2380
+ clearInterval(checkInterval);
2381
+ if (typeof window !== "undefined") {
2382
+ window.removeEventListener(SET_GLOBALS_EVENT_TYPE, handleSetGlobals);
2383
+ }
2384
+ }, 5e3);
2385
+ return () => {
2386
+ clearInterval(checkInterval);
2387
+ clearTimeout(timeout);
2388
+ if (typeof window !== "undefined") {
2389
+ window.removeEventListener(SET_GLOBALS_EVENT_TYPE, handleSetGlobals);
2390
+ }
2391
+ };
2392
+ }, []);
2359
2393
  const provider = (0, import_react2.useMemo)(() => {
2360
2394
  return isOpenAiAvailable ? "openai" : "mcp-ui";
2361
2395
  }, [isOpenAiAvailable]);
@@ -2370,7 +2404,6 @@ function useWidget(defaultProps) {
2370
2404
  toolId: ""
2371
2405
  };
2372
2406
  }, [window?.location?.search]);
2373
- console.log(urlParams);
2374
2407
  const toolInput = provider === "openai" ? useOpenAiGlobal("toolInput") : urlParams.toolInput;
2375
2408
  const toolOutput = provider === "openai" ? useOpenAiGlobal("toolOutput") : urlParams.toolOutput;
2376
2409
  const toolResponseMetadata = useOpenAiGlobal("toolResponseMetadata");
@@ -2478,3 +2511,1213 @@ function useWidgetState(defaultState) {
2478
2511
  return [state, setState];
2479
2512
  }
2480
2513
  __name(useWidgetState, "useWidgetState");
2514
+
2515
+ // src/react/WidgetFullscreenWrapper.tsx
2516
+ var import_react3 = __toESM(require("react"), 1);
2517
+ function WidgetFullscreenWrapper({
2518
+ children,
2519
+ className = "",
2520
+ position = "top-right",
2521
+ attachTo,
2522
+ showLabels = true
2523
+ }) {
2524
+ const { displayMode, requestDisplayMode, theme, safeArea, isAvailable } = useWidget();
2525
+ const [isHovered, setIsHovered] = (0, import_react3.useState)(false);
2526
+ const containerRef = (0, import_react3.useRef)(null);
2527
+ const isFullscreen = displayMode === "fullscreen" && isAvailable;
2528
+ const isPip = displayMode === "pip" && isAvailable;
2529
+ const isDark = theme === "dark";
2530
+ const buttonBg = isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.7)";
2531
+ const buttonBgHover = isDark ? "rgba(255, 255, 255, 0.2)" : "rgba(0, 0, 0, 0.9)";
2532
+ const buttonColor = "white";
2533
+ const getPositionStyles = /* @__PURE__ */ __name(() => {
2534
+ const baseOffset = 16;
2535
+ const topOffset = safeArea?.insets?.top ? `${Math.max(baseOffset, safeArea.insets.top + 8)}px` : `${baseOffset}px`;
2536
+ const rightOffset = safeArea?.insets?.right ? `${Math.max(baseOffset, safeArea.insets.right + 8)}px` : `${baseOffset}px`;
2537
+ const bottomOffset = safeArea?.insets?.bottom ? `${Math.max(baseOffset, safeArea.insets.bottom + 8)}px` : `${baseOffset}px`;
2538
+ const leftOffset = safeArea?.insets?.left ? `${Math.max(baseOffset, safeArea.insets.left + 8)}px` : `${baseOffset}px`;
2539
+ const styles = {
2540
+ position: "absolute",
2541
+ zIndex: 1e3,
2542
+ display: "flex",
2543
+ gap: "8px",
2544
+ opacity: isHovered ? 1 : 0,
2545
+ transition: "opacity 0.2s ease-in-out",
2546
+ pointerEvents: isHovered ? "auto" : "none"
2547
+ };
2548
+ switch (position) {
2549
+ case "top-left":
2550
+ styles.top = topOffset;
2551
+ styles.left = leftOffset;
2552
+ break;
2553
+ case "top-center":
2554
+ styles.top = topOffset;
2555
+ styles.left = "50%";
2556
+ styles.transform = "translateX(-50%)";
2557
+ break;
2558
+ case "top-right":
2559
+ styles.top = topOffset;
2560
+ styles.right = rightOffset;
2561
+ break;
2562
+ case "center-left":
2563
+ styles.top = "50%";
2564
+ styles.left = leftOffset;
2565
+ styles.transform = "translateY(-50%)";
2566
+ break;
2567
+ case "center-right":
2568
+ styles.top = "50%";
2569
+ styles.right = rightOffset;
2570
+ styles.transform = "translateY(-50%)";
2571
+ break;
2572
+ case "bottom-left":
2573
+ styles.bottom = bottomOffset;
2574
+ styles.left = leftOffset;
2575
+ break;
2576
+ case "bottom-center":
2577
+ styles.bottom = bottomOffset;
2578
+ styles.left = "50%";
2579
+ styles.transform = "translateX(-50%)";
2580
+ break;
2581
+ case "bottom-right":
2582
+ styles.bottom = bottomOffset;
2583
+ styles.right = rightOffset;
2584
+ break;
2585
+ default:
2586
+ styles.top = topOffset;
2587
+ styles.right = rightOffset;
2588
+ break;
2589
+ }
2590
+ return styles;
2591
+ }, "getPositionStyles");
2592
+ (0, import_react3.useEffect)(() => {
2593
+ if (!attachTo) return;
2594
+ const handleMouseEnter = /* @__PURE__ */ __name(() => setIsHovered(true), "handleMouseEnter");
2595
+ const handleMouseLeave = /* @__PURE__ */ __name(() => setIsHovered(false), "handleMouseLeave");
2596
+ attachTo.addEventListener("mouseenter", handleMouseEnter);
2597
+ attachTo.addEventListener("mouseleave", handleMouseLeave);
2598
+ return () => {
2599
+ attachTo.removeEventListener("mouseenter", handleMouseEnter);
2600
+ attachTo.removeEventListener("mouseleave", handleMouseLeave);
2601
+ };
2602
+ }, [attachTo]);
2603
+ const handleFullscreen = /* @__PURE__ */ __name(async () => {
2604
+ try {
2605
+ await requestDisplayMode("fullscreen");
2606
+ } catch (error) {
2607
+ console.error("Failed to go fullscreen:", error);
2608
+ }
2609
+ }, "handleFullscreen");
2610
+ const handlePip = /* @__PURE__ */ __name(async () => {
2611
+ try {
2612
+ await requestDisplayMode("pip");
2613
+ } catch (error) {
2614
+ console.error("Failed to go pip:", error);
2615
+ }
2616
+ }, "handlePip");
2617
+ const getTooltipStyles = /* @__PURE__ */ __name(() => {
2618
+ const baseStyles = {
2619
+ position: "absolute",
2620
+ padding: "4px 8px",
2621
+ backgroundColor: isDark ? "rgba(0, 0, 0, 0.9)" : "rgba(0, 0, 0, 0.9)",
2622
+ color: "white",
2623
+ borderRadius: "4px",
2624
+ fontSize: "12px",
2625
+ whiteSpace: "nowrap",
2626
+ pointerEvents: "none",
2627
+ transition: "opacity 0.2s ease-in-out"
2628
+ };
2629
+ switch (position) {
2630
+ case "top-right":
2631
+ return {
2632
+ ...baseStyles,
2633
+ top: "100%",
2634
+ right: "0",
2635
+ marginTop: "8px"
2636
+ };
2637
+ case "top-left":
2638
+ return {
2639
+ ...baseStyles,
2640
+ top: "100%",
2641
+ left: "0",
2642
+ marginTop: "8px"
2643
+ };
2644
+ case "top-center":
2645
+ return {
2646
+ ...baseStyles,
2647
+ top: "100%",
2648
+ left: "50%",
2649
+ transform: "translateX(-50%)",
2650
+ marginTop: "8px"
2651
+ };
2652
+ case "bottom-right":
2653
+ return {
2654
+ ...baseStyles,
2655
+ bottom: "100%",
2656
+ right: "0",
2657
+ marginBottom: "8px"
2658
+ };
2659
+ case "bottom-left":
2660
+ return {
2661
+ ...baseStyles,
2662
+ bottom: "100%",
2663
+ left: "0",
2664
+ marginBottom: "8px"
2665
+ };
2666
+ case "bottom-center":
2667
+ return {
2668
+ ...baseStyles,
2669
+ bottom: "100%",
2670
+ left: "50%",
2671
+ transform: "translateX(-50%)",
2672
+ marginBottom: "8px"
2673
+ };
2674
+ case "center-left":
2675
+ return {
2676
+ ...baseStyles,
2677
+ left: "100%",
2678
+ top: "50%",
2679
+ transform: "translateY(-50%)",
2680
+ marginLeft: "8px"
2681
+ };
2682
+ case "center-right":
2683
+ return {
2684
+ ...baseStyles,
2685
+ right: "100%",
2686
+ top: "50%",
2687
+ transform: "translateY(-50%)",
2688
+ marginRight: "8px"
2689
+ };
2690
+ default:
2691
+ return {
2692
+ ...baseStyles,
2693
+ top: "100%",
2694
+ right: "0",
2695
+ marginTop: "8px"
2696
+ };
2697
+ }
2698
+ }, "getTooltipStyles");
2699
+ const IconButton = /* @__PURE__ */ __name(({
2700
+ onClick,
2701
+ label,
2702
+ children: icon
2703
+ }) => {
2704
+ const [isButtonHovered, setIsButtonHovered] = (0, import_react3.useState)(false);
2705
+ const tooltipStyles = getTooltipStyles();
2706
+ return /* @__PURE__ */ import_react3.default.createElement(
2707
+ "button",
2708
+ {
2709
+ style: {
2710
+ padding: "8px",
2711
+ backgroundColor: buttonBg,
2712
+ color: buttonColor,
2713
+ border: "none",
2714
+ borderRadius: "8px",
2715
+ cursor: "pointer",
2716
+ display: "flex",
2717
+ alignItems: "center",
2718
+ justifyContent: "center",
2719
+ width: "32px",
2720
+ height: "32px",
2721
+ transition: "background-color 0.2s",
2722
+ backdropFilter: "blur(8px)",
2723
+ WebkitBackdropFilter: "blur(8px)",
2724
+ boxShadow: isDark ? "0 2px 8px rgba(0, 0, 0, 0.3)" : "0 2px 8px rgba(0, 0, 0, 0.2)",
2725
+ position: "relative"
2726
+ },
2727
+ onMouseEnter: (e) => {
2728
+ e.currentTarget.style.backgroundColor = buttonBgHover;
2729
+ setIsButtonHovered(true);
2730
+ },
2731
+ onMouseLeave: (e) => {
2732
+ e.currentTarget.style.backgroundColor = buttonBg;
2733
+ setIsButtonHovered(false);
2734
+ },
2735
+ onClick,
2736
+ "aria-label": label
2737
+ },
2738
+ /* @__PURE__ */ import_react3.default.createElement(
2739
+ "svg",
2740
+ {
2741
+ xmlns: "http://www.w3.org/2000/svg",
2742
+ width: "16",
2743
+ height: "16",
2744
+ viewBox: "0 0 24 24",
2745
+ fill: "none",
2746
+ stroke: "currentColor",
2747
+ strokeWidth: "2",
2748
+ strokeLinecap: "round",
2749
+ strokeLinejoin: "round",
2750
+ style: { display: "block" }
2751
+ },
2752
+ icon
2753
+ ),
2754
+ showLabels && /* @__PURE__ */ import_react3.default.createElement(
2755
+ "span",
2756
+ {
2757
+ style: {
2758
+ ...tooltipStyles,
2759
+ opacity: isButtonHovered ? 1 : 0
2760
+ }
2761
+ },
2762
+ label
2763
+ )
2764
+ );
2765
+ }, "IconButton");
2766
+ return /* @__PURE__ */ import_react3.default.createElement(
2767
+ "div",
2768
+ {
2769
+ ref: containerRef,
2770
+ className,
2771
+ style: {
2772
+ position: "relative",
2773
+ height: "fit-content"
2774
+ },
2775
+ onMouseEnter: () => !attachTo && setIsHovered(true),
2776
+ onMouseLeave: () => !attachTo && setIsHovered(false)
2777
+ },
2778
+ !isFullscreen && !isPip && /* @__PURE__ */ import_react3.default.createElement("div", { style: getPositionStyles() }, /* @__PURE__ */ import_react3.default.createElement(IconButton, { onClick: handleFullscreen, label: "Fullscreen" }, /* @__PURE__ */ import_react3.default.createElement("path", { d: "M15 3h6v6" }), /* @__PURE__ */ import_react3.default.createElement("path", { d: "m21 3-7 7" }), /* @__PURE__ */ import_react3.default.createElement("path", { d: "m3 21 7-7" }), /* @__PURE__ */ import_react3.default.createElement("path", { d: "M9 21H3v-6" })), /* @__PURE__ */ import_react3.default.createElement(IconButton, { onClick: handlePip, label: "Picture in Picture" }, /* @__PURE__ */ import_react3.default.createElement("path", { d: "M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4" }), /* @__PURE__ */ import_react3.default.createElement("rect", { width: "10", height: "7", x: "12", y: "13", rx: "2" }))),
2779
+ children
2780
+ );
2781
+ }
2782
+ __name(WidgetFullscreenWrapper, "WidgetFullscreenWrapper");
2783
+
2784
+ // src/react/WidgetDebugger.tsx
2785
+ var import_react4 = __toESM(require("react"), 1);
2786
+ function WidgetDebugger({
2787
+ children,
2788
+ className = "",
2789
+ position = "top-right",
2790
+ attachTo,
2791
+ showLabels = true
2792
+ }) {
2793
+ const {
2794
+ props,
2795
+ output,
2796
+ metadata,
2797
+ state,
2798
+ theme,
2799
+ displayMode,
2800
+ safeArea,
2801
+ maxHeight,
2802
+ userAgent,
2803
+ locale,
2804
+ isAvailable,
2805
+ callTool,
2806
+ sendFollowUpMessage,
2807
+ openExternal,
2808
+ requestDisplayMode,
2809
+ setState
2810
+ } = useWidget();
2811
+ const [isHovered, setIsHovered] = (0, import_react4.useState)(false);
2812
+ const [isOverlayOpen, setIsOverlayOpen] = (0, import_react4.useState)(false);
2813
+ const containerRef = (0, import_react4.useRef)(null);
2814
+ const overlayRef = (0, import_react4.useRef)(null);
2815
+ const [windowOpenAiKeys, setWindowOpenAiKeys] = (0, import_react4.useState)([]);
2816
+ const [actionResult, setActionResult] = (0, import_react4.useState)("");
2817
+ const [toolName, setToolName] = (0, import_react4.useState)("get-my-city");
2818
+ const [toolArgs, setToolArgs] = (0, import_react4.useState)("{}");
2819
+ const [followUpMessage, setFollowUpMessage] = (0, import_react4.useState)(
2820
+ "Test follow-up message"
2821
+ );
2822
+ const [externalUrl, setExternalUrl] = (0, import_react4.useState)(
2823
+ "https://docs.mcp-use.com"
2824
+ );
2825
+ const isFullscreen = displayMode === "fullscreen" && isAvailable;
2826
+ const isPip = displayMode === "pip" && isAvailable;
2827
+ (0, import_react4.useEffect)(() => {
2828
+ const timeoutId = setTimeout(() => {
2829
+ if (typeof window !== "undefined" && window.openai) {
2830
+ try {
2831
+ const keys = Object.keys(window.openai);
2832
+ setWindowOpenAiKeys(keys);
2833
+ } catch (e) {
2834
+ setWindowOpenAiKeys([]);
2835
+ }
2836
+ } else {
2837
+ setWindowOpenAiKeys([]);
2838
+ }
2839
+ }, 100);
2840
+ return () => clearTimeout(timeoutId);
2841
+ }, []);
2842
+ const isDark = theme === "dark";
2843
+ const buttonBg = isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.7)";
2844
+ const buttonBgHover = isDark ? "rgba(255, 255, 255, 0.2)" : "rgba(0, 0, 0, 0.9)";
2845
+ const buttonColor = "white";
2846
+ const getPositionStyles = /* @__PURE__ */ __name(() => {
2847
+ const baseOffset = 16;
2848
+ const topOffset = safeArea?.insets?.top ? `${Math.max(baseOffset, safeArea.insets.top + 8)}px` : `${baseOffset}px`;
2849
+ const rightOffset = safeArea?.insets?.right ? `${Math.max(baseOffset, safeArea.insets.right + 8)}px` : `${baseOffset}px`;
2850
+ const bottomOffset = safeArea?.insets?.bottom ? `${Math.max(baseOffset, safeArea.insets.bottom + 8)}px` : `${baseOffset}px`;
2851
+ const leftOffset = safeArea?.insets?.left ? `${Math.max(baseOffset, safeArea.insets.left + 8)}px` : `${baseOffset}px`;
2852
+ const styles = {
2853
+ position: "absolute",
2854
+ zIndex: 1e3,
2855
+ display: "flex",
2856
+ gap: "8px",
2857
+ opacity: isHovered ? 1 : 0,
2858
+ transition: "opacity 0.2s ease-in-out",
2859
+ pointerEvents: isHovered ? "auto" : "none"
2860
+ };
2861
+ switch (position) {
2862
+ case "top-left":
2863
+ styles.top = topOffset;
2864
+ styles.left = leftOffset;
2865
+ break;
2866
+ case "top-center":
2867
+ styles.top = topOffset;
2868
+ styles.left = "50%";
2869
+ styles.transform = "translateX(-50%)";
2870
+ break;
2871
+ case "top-right":
2872
+ styles.top = topOffset;
2873
+ styles.right = rightOffset;
2874
+ if (!isFullscreen && !isPip) {
2875
+ styles.right = `calc(${rightOffset} + 80px)`;
2876
+ }
2877
+ break;
2878
+ case "center-left":
2879
+ styles.top = "50%";
2880
+ styles.left = leftOffset;
2881
+ styles.transform = "translateY(-50%)";
2882
+ break;
2883
+ case "center-right":
2884
+ styles.top = "50%";
2885
+ styles.right = rightOffset;
2886
+ styles.transform = "translateY(-50%)";
2887
+ break;
2888
+ case "bottom-left":
2889
+ styles.bottom = bottomOffset;
2890
+ styles.left = leftOffset;
2891
+ break;
2892
+ case "bottom-center":
2893
+ styles.bottom = bottomOffset;
2894
+ styles.left = "50%";
2895
+ styles.transform = "translateX(-50%)";
2896
+ break;
2897
+ case "bottom-right":
2898
+ styles.bottom = bottomOffset;
2899
+ styles.right = rightOffset;
2900
+ break;
2901
+ default:
2902
+ styles.top = topOffset;
2903
+ styles.right = rightOffset;
2904
+ break;
2905
+ }
2906
+ return styles;
2907
+ }, "getPositionStyles");
2908
+ (0, import_react4.useEffect)(() => {
2909
+ if (!attachTo) return;
2910
+ const handleMouseEnter = /* @__PURE__ */ __name(() => setIsHovered(true), "handleMouseEnter");
2911
+ const handleMouseLeave = /* @__PURE__ */ __name(() => setIsHovered(false), "handleMouseLeave");
2912
+ attachTo.addEventListener("mouseenter", handleMouseEnter);
2913
+ attachTo.addEventListener("mouseleave", handleMouseLeave);
2914
+ return () => {
2915
+ attachTo.removeEventListener("mouseenter", handleMouseEnter);
2916
+ attachTo.removeEventListener("mouseleave", handleMouseLeave);
2917
+ };
2918
+ }, [attachTo]);
2919
+ (0, import_react4.useEffect)(() => {
2920
+ if (!isOverlayOpen) return;
2921
+ const handleClickOutside = /* @__PURE__ */ __name((event) => {
2922
+ if (overlayRef.current && !overlayRef.current.contains(event.target)) {
2923
+ setIsOverlayOpen(false);
2924
+ }
2925
+ }, "handleClickOutside");
2926
+ document.addEventListener("mousedown", handleClickOutside);
2927
+ return () => {
2928
+ document.removeEventListener("mousedown", handleClickOutside);
2929
+ };
2930
+ }, [isOverlayOpen]);
2931
+ (0, import_react4.useEffect)(() => {
2932
+ if (isOverlayOpen) {
2933
+ document.body.style.overflow = "hidden";
2934
+ } else {
2935
+ document.body.style.overflow = "";
2936
+ }
2937
+ return () => {
2938
+ document.body.style.overflow = "";
2939
+ };
2940
+ }, [isOverlayOpen]);
2941
+ const handleToggleOverlay = /* @__PURE__ */ __name(() => {
2942
+ setIsOverlayOpen(!isOverlayOpen);
2943
+ }, "handleToggleOverlay");
2944
+ const handleCallTool = /* @__PURE__ */ __name(async () => {
2945
+ try {
2946
+ setActionResult("Calling tool...");
2947
+ const args = toolArgs.trim() ? JSON.parse(toolArgs) : {};
2948
+ const result = await callTool(toolName, args);
2949
+ setActionResult(`Success: ${JSON.stringify(result, null, 2)}`);
2950
+ } catch (error) {
2951
+ setActionResult(`Error: ${error.message}`);
2952
+ }
2953
+ }, "handleCallTool");
2954
+ const handleSendFollowUpMessage = /* @__PURE__ */ __name(async () => {
2955
+ try {
2956
+ setActionResult("Sending follow-up message...");
2957
+ await sendFollowUpMessage(followUpMessage);
2958
+ setActionResult("Follow-up message sent successfully");
2959
+ } catch (error) {
2960
+ setActionResult(`Error: ${error.message}`);
2961
+ }
2962
+ }, "handleSendFollowUpMessage");
2963
+ const handleOpenExternal = /* @__PURE__ */ __name(() => {
2964
+ try {
2965
+ openExternal(externalUrl);
2966
+ setActionResult(`Opened external link: ${externalUrl}`);
2967
+ } catch (error) {
2968
+ setActionResult(`Error: ${error.message}`);
2969
+ }
2970
+ }, "handleOpenExternal");
2971
+ const handleRequestDisplayMode = /* @__PURE__ */ __name(async (mode) => {
2972
+ try {
2973
+ setActionResult(`Requesting display mode: ${mode}...`);
2974
+ const result = await requestDisplayMode(mode);
2975
+ setActionResult(`Display mode granted: ${result.mode}`);
2976
+ } catch (error) {
2977
+ setActionResult(`Error: ${error.message}`);
2978
+ }
2979
+ }, "handleRequestDisplayMode");
2980
+ const handleSetState = /* @__PURE__ */ __name(async () => {
2981
+ try {
2982
+ const newState = state ? { ...state, debugTimestamp: (/* @__PURE__ */ new Date()).toISOString() } : { debugTimestamp: (/* @__PURE__ */ new Date()).toISOString() };
2983
+ setActionResult("Setting state...");
2984
+ await setState(newState);
2985
+ setActionResult(`State updated: ${JSON.stringify(newState, null, 2)}`);
2986
+ } catch (error) {
2987
+ setActionResult(`Error: ${error.message}`);
2988
+ }
2989
+ }, "handleSetState");
2990
+ const getTooltipStyles = /* @__PURE__ */ __name(() => {
2991
+ const baseStyles = {
2992
+ position: "absolute",
2993
+ padding: "4px 8px",
2994
+ backgroundColor: "rgba(0, 0, 0, 0.9)",
2995
+ color: "white",
2996
+ borderRadius: "4px",
2997
+ fontSize: "12px",
2998
+ whiteSpace: "nowrap",
2999
+ pointerEvents: "none",
3000
+ transition: "opacity 0.2s ease-in-out"
3001
+ };
3002
+ switch (position) {
3003
+ case "top-right":
3004
+ return {
3005
+ ...baseStyles,
3006
+ top: "100%",
3007
+ right: "0",
3008
+ marginTop: "8px"
3009
+ };
3010
+ case "top-left":
3011
+ return {
3012
+ ...baseStyles,
3013
+ top: "100%",
3014
+ left: "0",
3015
+ marginTop: "8px"
3016
+ };
3017
+ case "top-center":
3018
+ return {
3019
+ ...baseStyles,
3020
+ top: "100%",
3021
+ left: "50%",
3022
+ transform: "translateX(-50%)",
3023
+ marginTop: "8px"
3024
+ };
3025
+ case "bottom-right":
3026
+ return {
3027
+ ...baseStyles,
3028
+ bottom: "100%",
3029
+ right: "0",
3030
+ marginBottom: "8px"
3031
+ };
3032
+ case "bottom-left":
3033
+ return {
3034
+ ...baseStyles,
3035
+ bottom: "100%",
3036
+ left: "0",
3037
+ marginBottom: "8px"
3038
+ };
3039
+ case "bottom-center":
3040
+ return {
3041
+ ...baseStyles,
3042
+ bottom: "100%",
3043
+ left: "50%",
3044
+ transform: "translateX(-50%)",
3045
+ marginBottom: "8px"
3046
+ };
3047
+ case "center-left":
3048
+ return {
3049
+ ...baseStyles,
3050
+ left: "100%",
3051
+ top: "50%",
3052
+ transform: "translateY(-50%)",
3053
+ marginLeft: "8px"
3054
+ };
3055
+ case "center-right":
3056
+ return {
3057
+ ...baseStyles,
3058
+ right: "100%",
3059
+ top: "50%",
3060
+ transform: "translateY(-50%)",
3061
+ marginRight: "8px"
3062
+ };
3063
+ default:
3064
+ return {
3065
+ ...baseStyles,
3066
+ top: "100%",
3067
+ right: "0",
3068
+ marginTop: "8px"
3069
+ };
3070
+ }
3071
+ }, "getTooltipStyles");
3072
+ const IconButton = /* @__PURE__ */ __name(({
3073
+ onClick,
3074
+ label,
3075
+ children: icon
3076
+ }) => {
3077
+ const [isButtonHovered, setIsButtonHovered] = (0, import_react4.useState)(false);
3078
+ const tooltipStyles = getTooltipStyles();
3079
+ return /* @__PURE__ */ import_react4.default.createElement(
3080
+ "button",
3081
+ {
3082
+ style: {
3083
+ padding: "8px",
3084
+ backgroundColor: buttonBg,
3085
+ color: buttonColor,
3086
+ border: "none",
3087
+ borderRadius: "8px",
3088
+ cursor: "pointer",
3089
+ display: "flex",
3090
+ alignItems: "center",
3091
+ justifyContent: "center",
3092
+ width: "32px",
3093
+ height: "32px",
3094
+ transition: "background-color 0.2s",
3095
+ backdropFilter: "blur(8px)",
3096
+ WebkitBackdropFilter: "blur(8px)",
3097
+ boxShadow: isDark ? "0 2px 8px rgba(0, 0, 0, 0.3)" : "0 2px 8px rgba(0, 0, 0, 0.2)",
3098
+ position: "relative"
3099
+ },
3100
+ onMouseEnter: (e) => {
3101
+ e.currentTarget.style.backgroundColor = buttonBgHover;
3102
+ setIsButtonHovered(true);
3103
+ },
3104
+ onMouseLeave: (e) => {
3105
+ e.currentTarget.style.backgroundColor = buttonBg;
3106
+ setIsButtonHovered(false);
3107
+ },
3108
+ onClick,
3109
+ "aria-label": label
3110
+ },
3111
+ /* @__PURE__ */ import_react4.default.createElement(
3112
+ "svg",
3113
+ {
3114
+ xmlns: "http://www.w3.org/2000/svg",
3115
+ width: "16",
3116
+ height: "16",
3117
+ viewBox: "0 0 24 24",
3118
+ fill: "none",
3119
+ stroke: "currentColor",
3120
+ strokeWidth: "2",
3121
+ strokeLinecap: "round",
3122
+ strokeLinejoin: "round",
3123
+ style: { display: "block" }
3124
+ },
3125
+ icon
3126
+ ),
3127
+ showLabels && /* @__PURE__ */ import_react4.default.createElement(
3128
+ "span",
3129
+ {
3130
+ style: {
3131
+ ...tooltipStyles,
3132
+ opacity: isButtonHovered ? 1 : 0
3133
+ }
3134
+ },
3135
+ label
3136
+ )
3137
+ );
3138
+ }, "IconButton");
3139
+ const formatValue = /* @__PURE__ */ __name((value) => {
3140
+ if (value === null) return "null";
3141
+ if (value === void 0) return "undefined";
3142
+ if (typeof value === "object") {
3143
+ try {
3144
+ return JSON.stringify(value, null, 2);
3145
+ } catch {
3146
+ return String(value);
3147
+ }
3148
+ }
3149
+ return String(value);
3150
+ }, "formatValue");
3151
+ const formatUserAgent = /* @__PURE__ */ __name((ua) => {
3152
+ if (!ua) return "N/A";
3153
+ return `${ua.device?.type || "unknown"}`;
3154
+ }, "formatUserAgent");
3155
+ const formatSafeArea = /* @__PURE__ */ __name((sa) => {
3156
+ if (!sa?.insets) return "N/A";
3157
+ const { top, bottom, left, right } = sa.insets;
3158
+ return `T:${top} B:${bottom} L:${left} R:${right}`;
3159
+ }, "formatSafeArea");
3160
+ return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(
3161
+ "div",
3162
+ {
3163
+ ref: containerRef,
3164
+ className,
3165
+ style: {
3166
+ position: "relative",
3167
+ height: "fit-content"
3168
+ },
3169
+ onMouseEnter: () => !attachTo && setIsHovered(true),
3170
+ onMouseLeave: () => !attachTo && setIsHovered(false)
3171
+ },
3172
+ /* @__PURE__ */ import_react4.default.createElement("div", { style: getPositionStyles() }, /* @__PURE__ */ import_react4.default.createElement(IconButton, { onClick: handleToggleOverlay, label: "Debug Info" }, /* @__PURE__ */ import_react4.default.createElement("path", { d: "M12 20v-9" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M14.12 3.88 16 2" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M21 21a4 4 0 0 0-3.81-4" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M21 5a4 4 0 0 1-3.55 3.97" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M22 13h-4" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M3 21a4 4 0 0 1 3.81-4" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M3 5a4 4 0 0 0 3.55 3.97" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M6 13H2" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "m8 2 1.88 1.88" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M9 7.13V6a3 3 0 1 1 6 0v1.13" }))),
3173
+ children
3174
+ ), isOverlayOpen && /* @__PURE__ */ import_react4.default.createElement(
3175
+ "div",
3176
+ {
3177
+ ref: overlayRef,
3178
+ style: {
3179
+ position: "fixed",
3180
+ top: 0,
3181
+ left: 0,
3182
+ right: 0,
3183
+ bottom: 0,
3184
+ backgroundColor: "#000000",
3185
+ color: "#ffffff",
3186
+ fontFamily: "monospace",
3187
+ fontSize: "12px",
3188
+ zIndex: 1e4,
3189
+ overflow: "auto",
3190
+ padding: "16px"
3191
+ },
3192
+ onClick: (e) => {
3193
+ if (e.target === overlayRef.current) {
3194
+ setIsOverlayOpen(false);
3195
+ }
3196
+ }
3197
+ },
3198
+ /* @__PURE__ */ import_react4.default.createElement(
3199
+ "button",
3200
+ {
3201
+ onClick: () => setIsOverlayOpen(false),
3202
+ style: {
3203
+ position: "absolute",
3204
+ top: "16px",
3205
+ right: "16px",
3206
+ backgroundColor: "rgba(255, 255, 255, 0.1)",
3207
+ color: "#ffffff",
3208
+ border: "none",
3209
+ borderRadius: "4px",
3210
+ width: "32px",
3211
+ height: "32px",
3212
+ cursor: "pointer",
3213
+ display: "flex",
3214
+ alignItems: "center",
3215
+ justifyContent: "center",
3216
+ fontSize: "18px",
3217
+ lineHeight: 1
3218
+ },
3219
+ "aria-label": "Close"
3220
+ },
3221
+ "\xD7"
3222
+ ),
3223
+ /* @__PURE__ */ import_react4.default.createElement(
3224
+ "div",
3225
+ {
3226
+ style: { maxWidth: "1200px", margin: "0 auto", paddingTop: "40px" }
3227
+ },
3228
+ /* @__PURE__ */ import_react4.default.createElement(
3229
+ "h1",
3230
+ {
3231
+ style: {
3232
+ fontSize: "18px",
3233
+ fontWeight: "bold",
3234
+ marginBottom: "16px",
3235
+ borderBottom: "1px solid #333",
3236
+ paddingBottom: "8px"
3237
+ }
3238
+ },
3239
+ "Debug Info"
3240
+ ),
3241
+ /* @__PURE__ */ import_react4.default.createElement(
3242
+ "table",
3243
+ {
3244
+ style: {
3245
+ width: "100%",
3246
+ borderCollapse: "collapse",
3247
+ borderSpacing: 0
3248
+ }
3249
+ },
3250
+ /* @__PURE__ */ import_react4.default.createElement("tbody", null, /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
3251
+ "td",
3252
+ {
3253
+ style: {
3254
+ padding: "8px",
3255
+ fontWeight: "bold",
3256
+ width: "200px",
3257
+ verticalAlign: "top"
3258
+ }
3259
+ },
3260
+ "Props"
3261
+ ), /* @__PURE__ */ import_react4.default.createElement(
3262
+ "td",
3263
+ {
3264
+ style: {
3265
+ padding: "8px",
3266
+ whiteSpace: "pre-wrap",
3267
+ wordBreak: "break-all"
3268
+ }
3269
+ },
3270
+ formatValue(props)
3271
+ )), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
3272
+ "td",
3273
+ {
3274
+ style: {
3275
+ padding: "8px",
3276
+ fontWeight: "bold",
3277
+ width: "200px",
3278
+ verticalAlign: "top"
3279
+ }
3280
+ },
3281
+ "Output"
3282
+ ), /* @__PURE__ */ import_react4.default.createElement(
3283
+ "td",
3284
+ {
3285
+ style: {
3286
+ padding: "8px",
3287
+ whiteSpace: "pre-wrap",
3288
+ wordBreak: "break-all"
3289
+ }
3290
+ },
3291
+ formatValue(output)
3292
+ )), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
3293
+ "td",
3294
+ {
3295
+ style: {
3296
+ padding: "8px",
3297
+ fontWeight: "bold",
3298
+ width: "200px",
3299
+ verticalAlign: "top"
3300
+ }
3301
+ },
3302
+ "Metadata"
3303
+ ), /* @__PURE__ */ import_react4.default.createElement(
3304
+ "td",
3305
+ {
3306
+ style: {
3307
+ padding: "8px",
3308
+ whiteSpace: "pre-wrap",
3309
+ wordBreak: "break-all"
3310
+ }
3311
+ },
3312
+ formatValue(metadata)
3313
+ )), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
3314
+ "td",
3315
+ {
3316
+ style: {
3317
+ padding: "8px",
3318
+ fontWeight: "bold",
3319
+ width: "200px",
3320
+ verticalAlign: "top"
3321
+ }
3322
+ },
3323
+ "State"
3324
+ ), /* @__PURE__ */ import_react4.default.createElement(
3325
+ "td",
3326
+ {
3327
+ style: {
3328
+ padding: "8px",
3329
+ whiteSpace: "pre-wrap",
3330
+ wordBreak: "break-all"
3331
+ }
3332
+ },
3333
+ formatValue(state)
3334
+ )), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
3335
+ "td",
3336
+ {
3337
+ style: {
3338
+ padding: "8px",
3339
+ fontWeight: "bold",
3340
+ width: "200px",
3341
+ verticalAlign: "top"
3342
+ }
3343
+ },
3344
+ "Theme"
3345
+ ), /* @__PURE__ */ import_react4.default.createElement("td", { style: { padding: "8px" } }, theme)), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
3346
+ "td",
3347
+ {
3348
+ style: {
3349
+ padding: "8px",
3350
+ fontWeight: "bold",
3351
+ width: "200px",
3352
+ verticalAlign: "top"
3353
+ }
3354
+ },
3355
+ "Display Mode"
3356
+ ), /* @__PURE__ */ import_react4.default.createElement("td", { style: { padding: "8px" } }, displayMode)), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
3357
+ "td",
3358
+ {
3359
+ style: {
3360
+ padding: "8px",
3361
+ fontWeight: "bold",
3362
+ width: "200px",
3363
+ verticalAlign: "top"
3364
+ }
3365
+ },
3366
+ "Locale"
3367
+ ), /* @__PURE__ */ import_react4.default.createElement("td", { style: { padding: "8px" } }, locale)), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
3368
+ "td",
3369
+ {
3370
+ style: {
3371
+ padding: "8px",
3372
+ fontWeight: "bold",
3373
+ width: "200px",
3374
+ verticalAlign: "top"
3375
+ }
3376
+ },
3377
+ "Max Height"
3378
+ ), /* @__PURE__ */ import_react4.default.createElement("td", { style: { padding: "8px" } }, maxHeight, "px")), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
3379
+ "td",
3380
+ {
3381
+ style: {
3382
+ padding: "8px",
3383
+ fontWeight: "bold",
3384
+ width: "200px",
3385
+ verticalAlign: "top"
3386
+ }
3387
+ },
3388
+ "User Agent"
3389
+ ), /* @__PURE__ */ import_react4.default.createElement("td", { style: { padding: "8px" } }, formatUserAgent(userAgent))), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
3390
+ "td",
3391
+ {
3392
+ style: {
3393
+ padding: "8px",
3394
+ fontWeight: "bold",
3395
+ width: "200px",
3396
+ verticalAlign: "top"
3397
+ }
3398
+ },
3399
+ "Safe Area"
3400
+ ), /* @__PURE__ */ import_react4.default.createElement("td", { style: { padding: "8px" } }, formatSafeArea(safeArea))), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
3401
+ "td",
3402
+ {
3403
+ style: {
3404
+ padding: "8px",
3405
+ fontWeight: "bold",
3406
+ width: "200px",
3407
+ verticalAlign: "top"
3408
+ }
3409
+ },
3410
+ "API Available"
3411
+ ), /* @__PURE__ */ import_react4.default.createElement("td", { style: { padding: "8px" } }, isAvailable ? "Yes" : "No")), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
3412
+ "td",
3413
+ {
3414
+ style: {
3415
+ padding: "8px",
3416
+ fontWeight: "bold",
3417
+ width: "200px",
3418
+ verticalAlign: "top"
3419
+ }
3420
+ },
3421
+ "window.openai Keys"
3422
+ ), /* @__PURE__ */ import_react4.default.createElement("td", { style: { padding: "8px" } }, windowOpenAiKeys.length > 0 ? windowOpenAiKeys.join(", ") : "N/A")))
3423
+ ),
3424
+ /* @__PURE__ */ import_react4.default.createElement(
3425
+ "h2",
3426
+ {
3427
+ style: {
3428
+ fontSize: "16px",
3429
+ fontWeight: "bold",
3430
+ marginTop: "32px",
3431
+ marginBottom: "16px",
3432
+ borderBottom: "1px solid #333",
3433
+ paddingBottom: "8px"
3434
+ }
3435
+ },
3436
+ "Actions"
3437
+ ),
3438
+ /* @__PURE__ */ import_react4.default.createElement(
3439
+ "div",
3440
+ {
3441
+ style: { display: "flex", flexDirection: "column", gap: "12px" }
3442
+ },
3443
+ /* @__PURE__ */ import_react4.default.createElement(
3444
+ "div",
3445
+ {
3446
+ style: { display: "flex", gap: "8px", alignItems: "center" }
3447
+ },
3448
+ /* @__PURE__ */ import_react4.default.createElement(
3449
+ "input",
3450
+ {
3451
+ type: "text",
3452
+ value: toolName,
3453
+ onChange: (e) => setToolName(e.target.value),
3454
+ placeholder: "Tool name",
3455
+ style: {
3456
+ padding: "6px 8px",
3457
+ backgroundColor: "#1a1a1a",
3458
+ color: "#ffffff",
3459
+ border: "1px solid #333",
3460
+ borderRadius: "4px",
3461
+ fontFamily: "monospace",
3462
+ fontSize: "12px",
3463
+ width: "150px"
3464
+ }
3465
+ }
3466
+ ),
3467
+ /* @__PURE__ */ import_react4.default.createElement(
3468
+ "input",
3469
+ {
3470
+ type: "text",
3471
+ value: toolArgs,
3472
+ onChange: (e) => setToolArgs(e.target.value),
3473
+ placeholder: '{"key": "value"}',
3474
+ style: {
3475
+ padding: "6px 8px",
3476
+ backgroundColor: "#1a1a1a",
3477
+ color: "#ffffff",
3478
+ border: "1px solid #333",
3479
+ borderRadius: "4px",
3480
+ fontFamily: "monospace",
3481
+ fontSize: "12px",
3482
+ flex: 1
3483
+ }
3484
+ }
3485
+ ),
3486
+ /* @__PURE__ */ import_react4.default.createElement(
3487
+ "button",
3488
+ {
3489
+ onClick: handleCallTool,
3490
+ style: {
3491
+ padding: "6px 12px",
3492
+ backgroundColor: "#333",
3493
+ color: "#ffffff",
3494
+ border: "1px solid #555",
3495
+ borderRadius: "4px",
3496
+ cursor: "pointer",
3497
+ fontFamily: "monospace",
3498
+ fontSize: "12px"
3499
+ }
3500
+ },
3501
+ "Call Tool"
3502
+ )
3503
+ ),
3504
+ /* @__PURE__ */ import_react4.default.createElement(
3505
+ "div",
3506
+ {
3507
+ style: { display: "flex", gap: "8px", alignItems: "center" }
3508
+ },
3509
+ /* @__PURE__ */ import_react4.default.createElement(
3510
+ "input",
3511
+ {
3512
+ type: "text",
3513
+ value: followUpMessage,
3514
+ onChange: (e) => setFollowUpMessage(e.target.value),
3515
+ placeholder: "Follow-up message",
3516
+ style: {
3517
+ padding: "6px 8px",
3518
+ backgroundColor: "#1a1a1a",
3519
+ color: "#ffffff",
3520
+ border: "1px solid #333",
3521
+ borderRadius: "4px",
3522
+ fontFamily: "monospace",
3523
+ fontSize: "12px",
3524
+ flex: 1
3525
+ }
3526
+ }
3527
+ ),
3528
+ /* @__PURE__ */ import_react4.default.createElement(
3529
+ "button",
3530
+ {
3531
+ onClick: handleSendFollowUpMessage,
3532
+ style: {
3533
+ padding: "6px 12px",
3534
+ backgroundColor: "#333",
3535
+ color: "#ffffff",
3536
+ border: "1px solid #555",
3537
+ borderRadius: "4px",
3538
+ cursor: "pointer",
3539
+ fontFamily: "monospace",
3540
+ fontSize: "12px"
3541
+ }
3542
+ },
3543
+ "Send Follow-Up"
3544
+ )
3545
+ ),
3546
+ /* @__PURE__ */ import_react4.default.createElement(
3547
+ "div",
3548
+ {
3549
+ style: { display: "flex", gap: "8px", alignItems: "center" }
3550
+ },
3551
+ /* @__PURE__ */ import_react4.default.createElement(
3552
+ "input",
3553
+ {
3554
+ type: "text",
3555
+ value: externalUrl,
3556
+ onChange: (e) => setExternalUrl(e.target.value),
3557
+ placeholder: "External URL",
3558
+ style: {
3559
+ padding: "6px 8px",
3560
+ backgroundColor: "#1a1a1a",
3561
+ color: "#ffffff",
3562
+ border: "1px solid #333",
3563
+ borderRadius: "4px",
3564
+ fontFamily: "monospace",
3565
+ fontSize: "12px",
3566
+ flex: 1
3567
+ }
3568
+ }
3569
+ ),
3570
+ /* @__PURE__ */ import_react4.default.createElement(
3571
+ "button",
3572
+ {
3573
+ onClick: handleOpenExternal,
3574
+ style: {
3575
+ padding: "6px 12px",
3576
+ backgroundColor: "#333",
3577
+ color: "#ffffff",
3578
+ border: "1px solid #555",
3579
+ borderRadius: "4px",
3580
+ cursor: "pointer",
3581
+ fontFamily: "monospace",
3582
+ fontSize: "12px"
3583
+ }
3584
+ },
3585
+ "Open Link"
3586
+ )
3587
+ ),
3588
+ /* @__PURE__ */ import_react4.default.createElement(
3589
+ "div",
3590
+ {
3591
+ style: { display: "flex", gap: "8px", alignItems: "center" }
3592
+ },
3593
+ /* @__PURE__ */ import_react4.default.createElement("span", { style: { width: "150px", fontSize: "12px" } }, "Display Mode:"),
3594
+ /* @__PURE__ */ import_react4.default.createElement(
3595
+ "button",
3596
+ {
3597
+ onClick: () => handleRequestDisplayMode("inline"),
3598
+ style: {
3599
+ padding: "6px 12px",
3600
+ backgroundColor: "#333",
3601
+ color: "#ffffff",
3602
+ border: "1px solid #555",
3603
+ borderRadius: "4px",
3604
+ cursor: "pointer",
3605
+ fontFamily: "monospace",
3606
+ fontSize: "12px",
3607
+ flex: 1
3608
+ }
3609
+ },
3610
+ "Inline"
3611
+ ),
3612
+ /* @__PURE__ */ import_react4.default.createElement(
3613
+ "button",
3614
+ {
3615
+ onClick: () => handleRequestDisplayMode("pip"),
3616
+ style: {
3617
+ padding: "6px 12px",
3618
+ backgroundColor: "#333",
3619
+ color: "#ffffff",
3620
+ border: "1px solid #555",
3621
+ borderRadius: "4px",
3622
+ cursor: "pointer",
3623
+ fontFamily: "monospace",
3624
+ fontSize: "12px",
3625
+ flex: 1
3626
+ }
3627
+ },
3628
+ "PiP"
3629
+ ),
3630
+ /* @__PURE__ */ import_react4.default.createElement(
3631
+ "button",
3632
+ {
3633
+ onClick: () => handleRequestDisplayMode("fullscreen"),
3634
+ style: {
3635
+ padding: "6px 12px",
3636
+ backgroundColor: "#333",
3637
+ color: "#ffffff",
3638
+ border: "1px solid #555",
3639
+ borderRadius: "4px",
3640
+ cursor: "pointer",
3641
+ fontFamily: "monospace",
3642
+ fontSize: "12px",
3643
+ flex: 1
3644
+ }
3645
+ },
3646
+ "Fullscreen"
3647
+ )
3648
+ ),
3649
+ /* @__PURE__ */ import_react4.default.createElement(
3650
+ "div",
3651
+ {
3652
+ style: { display: "flex", gap: "8px", alignItems: "center" }
3653
+ },
3654
+ /* @__PURE__ */ import_react4.default.createElement(
3655
+ "button",
3656
+ {
3657
+ onClick: handleSetState,
3658
+ style: {
3659
+ padding: "6px 12px",
3660
+ backgroundColor: "#333",
3661
+ color: "#ffffff",
3662
+ border: "1px solid #555",
3663
+ borderRadius: "4px",
3664
+ cursor: "pointer",
3665
+ fontFamily: "monospace",
3666
+ fontSize: "12px"
3667
+ }
3668
+ },
3669
+ "Set State (Add Timestamp)"
3670
+ )
3671
+ ),
3672
+ actionResult && /* @__PURE__ */ import_react4.default.createElement(
3673
+ "div",
3674
+ {
3675
+ style: {
3676
+ marginTop: "8px",
3677
+ padding: "8px",
3678
+ backgroundColor: "#1a1a1a",
3679
+ border: "1px solid #333",
3680
+ borderRadius: "4px",
3681
+ whiteSpace: "pre-wrap",
3682
+ wordBreak: "break-all",
3683
+ fontSize: "11px",
3684
+ maxHeight: "200px",
3685
+ overflow: "auto"
3686
+ }
3687
+ },
3688
+ /* @__PURE__ */ import_react4.default.createElement(
3689
+ "div",
3690
+ {
3691
+ style: {
3692
+ fontWeight: "bold",
3693
+ marginBottom: "4px",
3694
+ color: "#aaa"
3695
+ }
3696
+ },
3697
+ "Result:"
3698
+ ),
3699
+ actionResult,
3700
+ /* @__PURE__ */ import_react4.default.createElement(
3701
+ "button",
3702
+ {
3703
+ onClick: () => setActionResult(""),
3704
+ style: {
3705
+ marginTop: "8px",
3706
+ padding: "4px 8px",
3707
+ backgroundColor: "#333",
3708
+ color: "#ffffff",
3709
+ border: "1px solid #555",
3710
+ borderRadius: "4px",
3711
+ cursor: "pointer",
3712
+ fontFamily: "monospace",
3713
+ fontSize: "11px"
3714
+ }
3715
+ },
3716
+ "Clear"
3717
+ )
3718
+ )
3719
+ )
3720
+ )
3721
+ ));
3722
+ }
3723
+ __name(WidgetDebugger, "WidgetDebugger");