import '../../chunk-I2KLQ2HA.js';
import { createContext, useContext, useRef, useCallback, useState, useMemo, useEffect } from 'react';
import { useStore, create } from 'zustand';
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
import { useMediaQuery } from '@mantine/hooks';
import { useComputedColorScheme, Tooltip } from '@mantine/core';

// src/features/right-panel-host/constants.ts
var RIGHT_PANEL_Z_INDEX = { PANEL: 300, TRIGGER: 400 };
var RIGHT_PANEL_DEFAULTS = {
  WIDTH: 600,
  MIN_WIDTH: 600,
  MAX_WIDTH: 1200,
  WIDTH_STEP: 5
};
var ASSISTANT_PANEL_WIDTH_KEY = "elevasis-assistant-panel-width";
var RIGHT_PANEL_TRIGGER = {
  WIDTH: 20,
  HEIGHT: 80,
  LIGHT_BAR_WIDTH: 2,
  LIGHT_BAR_HEIGHT: 52,
  ARM_WIDTH: 50
};
var RIGHT_PANEL_HISTORY_WIDTH = 260;
var RIGHT_PANEL_HISTORY_COLLAPSED_WIDTH = 48;
var RIGHT_PANEL_MOBILE_BREAKPOINT = 768;
var RIGHT_PANEL_DEFAULT_VIEW_ID = "overview";

// src/features/right-panel-host/store.ts
function loadSavedWidth() {
  try {
    const saved = localStorage.getItem(ASSISTANT_PANEL_WIDTH_KEY);
    if (saved) {
      const n = Number(saved);
      if (n >= RIGHT_PANEL_DEFAULTS.MIN_WIDTH && n <= RIGHT_PANEL_DEFAULTS.MAX_WIDTH) return n;
    }
  } catch {
  }
  return RIGHT_PANEL_DEFAULTS.WIDTH;
}
function buildInitialState(overrides) {
  return {
    isOpen: false,
    isMinimized: false,
    hasBeenOpened: false,
    width: loadSavedWidth(),
    activeViewId: RIGHT_PANEL_DEFAULT_VIEW_ID,
    ...overrides
  };
}
function createRightPanelStore(initialState) {
  return create((set, get) => ({
    ...buildInitialState(initialState),
    open: (viewId) => set((state) => ({
      isOpen: true,
      isMinimized: false,
      hasBeenOpened: true,
      activeViewId: viewId ?? state.activeViewId
    })),
    close: () => set({ isOpen: false, isMinimized: false }),
    minimize: () => set({ isMinimized: true }),
    restore: () => set({ isMinimized: false }),
    setActiveView: (viewId) => set({ activeViewId: viewId }),
    setWidth: (width) => set({ width }),
    toggle: () => {
      const { isOpen, isMinimized, open, close, restore } = get();
      if (isOpen && isMinimized) {
        restore();
      } else if (isOpen) {
        close();
      } else {
        open();
      }
    }
  }));
}
var RightPanelStoreContext = createContext(null);
function useRightPanelStore() {
  const store = useContext(RightPanelStoreContext);
  if (!store) {
    throw new Error("useRightPanel must be used within a <RightPanelProvider>");
  }
  return store;
}
function useRightPanel() {
  const store = useRightPanelStore();
  return useStore(store);
}
var RightPanelContextValue = createContext({});
function useRightPanelContext() {
  return useContext(RightPanelContextValue);
}
function RightPanelProvider({ children, initialState, contextValue = {} }) {
  const storeRef = useRef(null);
  if (!storeRef.current) {
    storeRef.current = createRightPanelStore(initialState);
  }
  return /* @__PURE__ */ jsx(RightPanelStoreContext.Provider, { value: storeRef.current, children: /* @__PURE__ */ jsx(RightPanelContextValue.Provider, { value: contextValue, children }) });
}
function useMobileRightPanel() {
  const matches = useMediaQuery(`(max-width: ${RIGHT_PANEL_MOBILE_BREAKPOINT}px)`);
  return { isMobile: !!matches };
}
var isMac = typeof navigator !== "undefined" && /Mac|iPod|iPhone|iPad/.test(navigator.userAgent);
var shortcutLabel = isMac ? "\u2318Space" : "Ctrl+Space";
var DRAG_THRESHOLD = 4;
function TriggerSVG({
  width,
  height,
  isOpen,
  isProcessing,
  isLight
}) {
  const cx = width / 2;
  const barTop = 8;
  const barBottom = height - 8;
  const barH = barBottom - barTop;
  let lightOpacity = 0.5;
  let glowStd = 1.5;
  if (isOpen && isProcessing) {
    lightOpacity = 1;
    glowStd = 4;
  } else if (isOpen) {
    lightOpacity = 1;
    glowStd = 3.5;
  }
  const metal = isLight ? "color-mix(in srgb, var(--color-primary) 20%, #aaa)" : "color-mix(in srgb, var(--color-primary) 15%, var(--color-border))";
  const metalBright = isLight ? "color-mix(in srgb, var(--color-primary) 30%, #aaa)" : "color-mix(in srgb, var(--color-primary) 25%, var(--color-border))";
  const primary = "var(--color-text-subtle)";
  return /* @__PURE__ */ jsxs(
    "svg",
    {
      width,
      height,
      viewBox: `0 0 ${width} ${height}`,
      fill: "none",
      xmlns: "http://www.w3.org/2000/svg",
      style: { display: "block" },
      children: [
        /* @__PURE__ */ jsxs("defs", { children: [
          /* @__PURE__ */ jsxs("linearGradient", { id: "rp-triggerMetal", x1: "0", y1: "0", x2: "1", y2: "0", children: [
            /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: metal, stopOpacity: "0.6" }),
            /* @__PURE__ */ jsx("stop", { offset: "50%", stopColor: metalBright, stopOpacity: "0.8" }),
            /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: metal, stopOpacity: "0.6" })
          ] }),
          /* @__PURE__ */ jsxs("linearGradient", { id: "rp-triggerLight", x1: "0", y1: "0", x2: "0", y2: "1", children: [
            /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: primary, stopOpacity: "0.15" }),
            /* @__PURE__ */ jsx("stop", { offset: "15%", stopColor: primary, stopOpacity: "0.9" }),
            /* @__PURE__ */ jsx("stop", { offset: "85%", stopColor: primary, stopOpacity: "0.9" }),
            /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: primary, stopOpacity: "0.15" })
          ] }),
          /* @__PURE__ */ jsxs("filter", { id: "rp-triggerGlow", children: [
            /* @__PURE__ */ jsx("feGaussianBlur", { stdDeviation: glowStd, result: "blur" }),
            /* @__PURE__ */ jsxs("feMerge", { children: [
              /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
              /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
            ] })
          ] })
        ] }),
        /* @__PURE__ */ jsx("rect", { x: cx - 2.5, y: barTop, width: "5", height: barH, rx: "2.5", fill: "url(#rp-triggerMetal)", opacity: "0.7" }),
        /* @__PURE__ */ jsx("rect", { x: cx - 1.5, y: barTop + 1.5, width: "3", height: barH - 3, rx: "1.5", fill: "rgba(0,0,0,0.3)" }),
        /* @__PURE__ */ jsx(
          "rect",
          {
            x: cx - 1,
            y: barTop + 3,
            width: "2",
            height: barH - 6,
            rx: "1",
            fill: "url(#rp-triggerLight)",
            opacity: lightOpacity,
            filter: "url(#rp-triggerGlow)",
            style: isOpen && isProcessing ? {
              animation: "rp-streakPulse 1.5s ease-in-out infinite"
            } : void 0
          }
        ),
        /* @__PURE__ */ jsx("circle", { cx, cy: barTop - 2, r: "1.2", fill: metalBright, opacity: "0.4" }),
        /* @__PURE__ */ jsx("circle", { cx, cy: barBottom + 2, r: "1.2", fill: metalBright, opacity: "0.4" })
      ]
    }
  );
}
function RightPanelTrigger({ onResizeDrag, onResizeEnd, isProcessing = false }) {
  const { isOpen, isMinimized, width, open, close, restore } = useRightPanel();
  const computedColorScheme = useComputedColorScheme("dark");
  const isLight = computedColorScheme === "light";
  const isDraggingRef = useRef(false);
  const handleClick = useCallback(() => {
    if (isOpen && isMinimized) {
      restore();
    } else if (isOpen) {
      close();
    } else {
      open();
    }
  }, [isOpen, isMinimized, restore, close, open]);
  const handlePointerDown = useCallback(
    (e) => {
      if (e.button !== 0) return;
      const canResize = isOpen && !isMinimized && !!onResizeDrag;
      const startX = e.clientX;
      const startW = width;
      isDraggingRef.current = false;
      const target = e.currentTarget;
      target.setPointerCapture(e.pointerId);
      const onMove = (ev) => {
        if (!canResize) return;
        const dx = ev.clientX - startX;
        if (!isDraggingRef.current && Math.abs(dx) >= DRAG_THRESHOLD) {
          isDraggingRef.current = true;
          document.body.style.cursor = "col-resize";
          document.body.style.userSelect = "none";
        }
        if (isDraggingRef.current) {
          onResizeDrag(dx, startW);
        }
      };
      const onUp = () => {
        target.removeEventListener("pointermove", onMove);
        target.removeEventListener("pointerup", onUp);
        target.removeEventListener("pointercancel", onUp);
        document.body.style.cursor = "";
        document.body.style.userSelect = "";
        if (isDraggingRef.current) {
          onResizeEnd?.();
        } else {
          handleClick();
        }
        isDraggingRef.current = false;
      };
      target.addEventListener("pointermove", onMove);
      target.addEventListener("pointerup", onUp);
      target.addEventListener("pointercancel", onUp);
    },
    [isOpen, isMinimized, width, onResizeDrag, onResizeEnd, handleClick]
  );
  return /* @__PURE__ */ jsx(Tooltip, { label: `Right panel (${shortcutLabel})`, position: "left", withArrow: true, children: /* @__PURE__ */ jsx(
    "div",
    {
      role: "button",
      tabIndex: 0,
      onPointerDown: handlePointerDown,
      onKeyDown: (e) => {
        if (e.key === "Enter" || e.key === " ") {
          e.preventDefault();
          handleClick();
        }
      },
      "aria-label": isOpen ? "Close right panel" : "Open right panel",
      style: {
        width: RIGHT_PANEL_TRIGGER.WIDTH,
        height: RIGHT_PANEL_TRIGGER.HEIGHT,
        borderRadius: "var(--mantine-radius-default)",
        background: "var(--glass-background)",
        backdropFilter: "var(--glass-blur)",
        WebkitBackdropFilter: "var(--glass-blur)",
        border: "1px solid var(--color-border)",
        boxShadow: "light-dark(0 0 20px rgba(0,0,0,0.1), 0 0 24px rgba(0,0,0,0.75)), light-dark(0 0 60px rgba(0,0,0,0.05), 0 0 80px rgba(0,0,0,0.65))",
        display: "flex",
        alignItems: "center",
        justifyContent: "center",
        cursor: "pointer",
        padding: 0
      },
      children: /* @__PURE__ */ jsx(
        TriggerSVG,
        {
          width: RIGHT_PANEL_TRIGGER.WIDTH,
          height: RIGHT_PANEL_TRIGGER.HEIGHT,
          isOpen,
          isProcessing,
          isLight
        }
      )
    }
  ) });
}
var { MIN_WIDTH, MAX_WIDTH, WIDTH_STEP } = RIGHT_PANEL_DEFAULTS;
function snapToStep(value) {
  return Math.round(value / WIDTH_STEP) * WIDTH_STEP;
}
function clampWidth(raw) {
  const clamped = Math.max(MIN_WIDTH, Math.min(MAX_WIDTH, raw));
  return snapToStep(clamped);
}
var SLIDE_TRANSITION = "transform 0.3s cubic-bezier(0.16, 1, 0.3, 1)";
var PANEL_SHADOW_STYLE = {
  boxShadow: [
    "light-dark(0 0 20px rgba(0,0,0,0.1), 0 0 24px rgba(0,0,0,0.75))",
    "light-dark(0 0 60px rgba(0,0,0,0.05), 0 0 80px rgba(0,0,0,0.65))",
    "light-dark(0 0 120px rgba(0,0,0,0.04), 0 0 160px rgba(0,0,0,0.46))",
    "light-dark(-4px 0 16px rgba(0,0,0,0.01), -8px 0 40px rgba(0,0,0,0.5))"
  ].join(", ")
};
function RightPanelLayer({ views, isProcessing = false, sidebar, sidebarWidth = 0 }) {
  const { isOpen, isMinimized, hasBeenOpened, width, activeViewId, setActiveView, setWidth } = useRightPanel();
  const ctx = useRightPanelContext();
  const { isMobile } = useMobileRightPanel();
  const [isResizing, setIsResizing] = useState(false);
  const availableViews = useMemo(
    () => views.filter((v) => !v.isAvailable || v.isAvailable(ctx)),
    // ctx changes identity often; stringify to detect real changes
    [views, JSON.stringify(ctx)]
  );
  const activeView = useMemo(
    () => availableViews.find((v) => v.id === activeViewId) ?? availableViews[0],
    [activeViewId, availableViews]
  );
  useEffect(() => {
    if (activeView && activeView.id !== activeViewId) {
      setActiveView(activeView.id);
    }
  }, [activeView, activeViewId, setActiveView]);
  const saveTimerRef = useRef(null);
  const persistWidth = useCallback((w) => {
    if (saveTimerRef.current) clearTimeout(saveTimerRef.current);
    saveTimerRef.current = setTimeout(() => {
      try {
        localStorage.setItem(ASSISTANT_PANEL_WIDTH_KEY, String(w));
      } catch {
      }
    }, 300);
  }, []);
  const handleResizeDrag = useCallback(
    (deltaX, startWidth) => {
      setIsResizing(true);
      const newWidth = clampWidth(startWidth - deltaX);
      setWidth(newWidth);
      persistWidth(newWidth);
    },
    [setWidth, persistWidth]
  );
  const handleResizeEnd = useCallback(() => {
    setIsResizing(false);
  }, []);
  if (isMobile) {
    const ActiveComponent = activeView?.component;
    return /* @__PURE__ */ jsxs(Fragment, { children: [
      /* @__PURE__ */ jsx(RightPanelTrigger, { isProcessing }),
      isOpen && !isMinimized && ActiveComponent && /* @__PURE__ */ jsx(ActiveComponent, {})
    ] });
  }
  const panelVisible = isOpen && !isMinimized;
  const armWidth = RIGHT_PANEL_TRIGGER.ARM_WIDTH;
  const totalPanelWidth = width + (sidebar ? sidebarWidth : 0);
  const transition = isResizing ? "none" : SLIDE_TRANSITION;
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    /* @__PURE__ */ jsx(
      "div",
      {
        style: {
          position: "fixed",
          top: "10vh",
          right: 10,
          height: "80vh",
          zIndex: RIGHT_PANEL_Z_INDEX.TRIGGER,
          display: "flex",
          alignItems: "center",
          transform: panelVisible ? `translateX(-${totalPanelWidth + armWidth}px)` : "translateX(0)",
          transition
        },
        children: /* @__PURE__ */ jsx(RightPanelTrigger, { onResizeDrag: handleResizeDrag, onResizeEnd: handleResizeEnd, isProcessing })
      }
    ),
    /* @__PURE__ */ jsxs(
      "div",
      {
        style: {
          position: "fixed",
          top: "10vh",
          right: 0,
          height: "80vh",
          zIndex: RIGHT_PANEL_Z_INDEX.PANEL,
          display: "flex",
          flexDirection: "row",
          alignItems: "stretch",
          transform: panelVisible ? "translateX(0)" : `translateX(${totalPanelWidth + armWidth}px)`,
          transition,
          pointerEvents: panelVisible ? "auto" : "none"
        },
        children: [
          /* @__PURE__ */ jsxs(
            "div",
            {
              style: {
                ...PANEL_SHADOW_STYLE,
                display: "flex",
                height: "100%",
                borderRadius: "var(--mantine-radius-default)"
              },
              children: [
                sidebar && /* @__PURE__ */ jsx(
                  "div",
                  {
                    style: {
                      width: sidebarWidth,
                      height: "100%",
                      flexShrink: 0,
                      overflow: "hidden",
                      transition: "width 0.25s cubic-bezier(0.16, 1, 0.3, 1)"
                    },
                    children: sidebar({
                      views: availableViews,
                      activeViewId: activeView?.id ?? activeViewId,
                      onSelectView: setActiveView
                    })
                  }
                ),
                /* @__PURE__ */ jsx("div", { style: { width, height: "100%", flexShrink: 0 }, children: hasBeenOpened && availableViews.map((view) => {
                  const Component = view.component;
                  const isActive = view.id === activeView?.id;
                  if (!view.alwaysMount && !isActive) return null;
                  return /* @__PURE__ */ jsx("div", { style: { width: "100%", height: "100%", display: isActive ? "block" : "none" }, children: /* @__PURE__ */ jsx(Component, {}) }, view.id);
                }) })
              ]
            }
          ),
          /* @__PURE__ */ jsx(MountingArm, { width: armWidth, isProcessing: panelVisible && isProcessing })
        ]
      }
    )
  ] });
}
function MountingArm({ width, isProcessing }) {
  return /* @__PURE__ */ jsxs(
    "div",
    {
      style: {
        display: "flex",
        flexDirection: "column",
        justifyContent: "center",
        width,
        flexShrink: 0,
        pointerEvents: "none",
        gap: 12
      },
      children: [
        /* @__PURE__ */ jsx(MountingRail, { width, isProcessing, railId: "top" }),
        /* @__PURE__ */ jsx(MountingRail, { width, isProcessing, railId: "bottom" })
      ]
    }
  );
}
function MountingRail({ width, isProcessing, railId }) {
  const h = 16;
  return /* @__PURE__ */ jsxs(
    "svg",
    {
      width,
      height: h,
      viewBox: `0 0 ${width} ${h}`,
      fill: "none",
      xmlns: "http://www.w3.org/2000/svg",
      style: { display: "block", overflow: "visible" },
      children: [
        /* @__PURE__ */ jsxs("defs", { children: [
          /* @__PURE__ */ jsxs("linearGradient", { id: "rp-metalPipe", x1: "0", y1: "0", x2: "0", y2: "1", children: [
            /* @__PURE__ */ jsx(
              "stop",
              {
                offset: "0%",
                stopColor: "light-dark(color-mix(in srgb, var(--color-primary) 25%, #aaa), color-mix(in srgb, var(--color-primary) 20%, var(--color-border)))"
              }
            ),
            /* @__PURE__ */ jsx(
              "stop",
              {
                offset: "40%",
                stopColor: "light-dark(color-mix(in srgb, var(--color-primary) 15%, #aaa), color-mix(in srgb, var(--color-primary) 10%, var(--color-border)))"
              }
            ),
            /* @__PURE__ */ jsx(
              "stop",
              {
                offset: "60%",
                stopColor: "light-dark(color-mix(in srgb, var(--color-primary) 12%, #aaa), color-mix(in srgb, var(--color-primary) 6%, var(--color-border)))"
              }
            ),
            /* @__PURE__ */ jsx(
              "stop",
              {
                offset: "100%",
                stopColor: "light-dark(color-mix(in srgb, var(--color-primary) 20%, #aaa), color-mix(in srgb, var(--color-primary) 14%, var(--color-border)))"
              }
            )
          ] }),
          /* @__PURE__ */ jsxs("linearGradient", { id: "rp-lightBar", x1: "0", y1: "0", x2: "1", y2: "0", children: [
            /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "var(--color-primary)", stopOpacity: "0.3" }),
            /* @__PURE__ */ jsx("stop", { offset: "30%", stopColor: "var(--color-primary)", stopOpacity: "0.7" }),
            /* @__PURE__ */ jsx("stop", { offset: "70%", stopColor: "var(--color-primary)", stopOpacity: "0.7" }),
            /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "var(--color-primary)", stopOpacity: "0.2" })
          ] }),
          /* @__PURE__ */ jsxs("filter", { id: "rp-lightGlow", children: [
            /* @__PURE__ */ jsx("feGaussianBlur", { stdDeviation: "1.2", result: "blur" }),
            /* @__PURE__ */ jsxs("feMerge", { children: [
              /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
              /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
            ] })
          ] })
        ] }),
        /* @__PURE__ */ jsx("rect", { x: "0", y: "2", width: "3", height: "12", rx: "0.5", fill: "url(#rp-metalPipe)", opacity: "0.8" }),
        /* @__PURE__ */ jsx("rect", { x: "2", y: "4", width: "2", height: "8", rx: "0.5", fill: "url(#rp-metalPipe)", opacity: "0.65" }),
        /* @__PURE__ */ jsx(
          "circle",
          {
            cx: "1.5",
            cy: "5",
            r: "0.7",
            fill: "color-mix(in srgb, var(--color-primary) 25%, var(--color-border))",
            opacity: "0.6"
          }
        ),
        /* @__PURE__ */ jsx(
          "circle",
          {
            cx: "1.5",
            cy: "11",
            r: "0.7",
            fill: "color-mix(in srgb, var(--color-primary) 25%, var(--color-border))",
            opacity: "0.6"
          }
        ),
        /* @__PURE__ */ jsx("rect", { x: "4", y: "4", width: width - 9, height: "8", rx: "3", fill: "url(#rp-metalPipe)", opacity: "0.7" }),
        /* @__PURE__ */ jsx("rect", { x: "5", y: "5.5", width: width - 11, height: "5", rx: "2", fill: "rgba(0,0,0,0.3)" }),
        /* @__PURE__ */ jsx("rect", { x: "6", y: "6.5", width: width - 13, height: "3", rx: "1.5", fill: "url(#rp-lightBar)", filter: "url(#rp-lightGlow)" }),
        isProcessing && /* @__PURE__ */ jsxs("g", { children: [
          /* @__PURE__ */ jsxs("radialGradient", { id: `rp-energyGlow-${railId}`, cx: "50%", cy: "50%", rx: "50%", ry: "50%", children: [
            /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "var(--color-primary)", stopOpacity: "1" }),
            /* @__PURE__ */ jsx("stop", { offset: "40%", stopColor: "var(--color-primary)", stopOpacity: "0.7" }),
            /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "var(--color-primary)", stopOpacity: "0" })
          ] }),
          /* @__PURE__ */ jsxs("filter", { id: `rp-energyBlur-${railId}`, children: [
            /* @__PURE__ */ jsx("feGaussianBlur", { stdDeviation: "1", result: "blur" }),
            /* @__PURE__ */ jsxs("feMerge", { children: [
              /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
              /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
            ] })
          ] }),
          /* @__PURE__ */ jsx("clipPath", { id: `rp-pipeClip-${railId}`, children: /* @__PURE__ */ jsx("rect", { x: "5", y: "4", width: width - 11, height: "8", rx: "3" }) }),
          /* @__PURE__ */ jsx("g", { clipPath: `url(#rp-pipeClip-${railId})`, children: /* @__PURE__ */ jsx(
            "ellipse",
            {
              cx: width + 10,
              cy: h / 2,
              rx: "10",
              ry: "2",
              fill: `url(#rp-energyGlow-${railId})`,
              filter: `url(#rp-energyBlur-${railId})`,
              style: {
                animation: "rp-energySweep 1.5s ease-in-out infinite",
                "--sweep-distance": `${-(width + 20)}px`
              }
            }
          ) })
        ] }),
        /* @__PURE__ */ jsxs("g", { opacity: "0.75", children: [
          /* @__PURE__ */ jsx(
            "circle",
            {
              cx: width / 2,
              cy: h / 2,
              r: "3.5",
              fill: "color-mix(in srgb, var(--color-primary) 12%, var(--color-border))"
            }
          ),
          /* @__PURE__ */ jsx("circle", { cx: width / 2, cy: h / 2, r: "2.5", fill: "rgba(0,0,0,0.25)" }),
          /* @__PURE__ */ jsx(
            "circle",
            {
              cx: width / 2,
              cy: h / 2,
              r: "1.2",
              fill: "color-mix(in srgb, var(--color-primary) 30%, var(--color-border))"
            }
          ),
          /* @__PURE__ */ jsx(
            "circle",
            {
              cx: width / 2 - 0.3,
              cy: h / 2 - 0.3,
              r: "0.5",
              fill: "color-mix(in srgb, var(--color-primary) 50%, white)",
              opacity: "0.4"
            }
          )
        ] }),
        /* @__PURE__ */ jsx("rect", { x: width - 5, y: "1", width: "5", height: "14", rx: "1", fill: "url(#rp-metalPipe)", opacity: "0.8" }),
        /* @__PURE__ */ jsx("line", { x1: width - 4, y1: "3", x2: width - 4, y2: "13", stroke: "rgba(0,0,0,0.15)", strokeWidth: "0.5" }),
        /* @__PURE__ */ jsx("line", { x1: width - 2, y1: "3", x2: width - 2, y2: "13", stroke: "rgba(0,0,0,0.15)", strokeWidth: "0.5" }),
        /* @__PURE__ */ jsx(
          "circle",
          {
            cx: width - 2.5,
            cy: "4",
            r: "0.8",
            fill: "color-mix(in srgb, var(--color-primary) 20%, var(--color-border))",
            opacity: "0.5"
          }
        ),
        /* @__PURE__ */ jsx(
          "circle",
          {
            cx: width - 2.5,
            cy: "12",
            r: "0.8",
            fill: "color-mix(in srgb, var(--color-primary) 20%, var(--color-border))",
            opacity: "0.5"
          }
        )
      ]
    }
  );
}
function useRightPanelKeyboardShortcut(enabled = true) {
  const { isOpen, isMinimized, open, close, restore } = useRightPanel();
  useEffect(() => {
    if (!enabled) return;
    const handler = (e) => {
      if (!((e.metaKey || e.ctrlKey) && e.key === " ")) return;
      const target = e.target;
      if (target && (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable)) {
        return;
      }
      e.preventDefault();
      if (isOpen && isMinimized) {
        restore();
      } else if (isOpen) {
        close();
      } else {
        open();
      }
    };
    window.addEventListener("keydown", handler);
    return () => window.removeEventListener("keydown", handler);
  }, [enabled, isOpen, isMinimized, open, close, restore]);
}

export { ASSISTANT_PANEL_WIDTH_KEY, RIGHT_PANEL_DEFAULTS, RIGHT_PANEL_DEFAULT_VIEW_ID, RIGHT_PANEL_HISTORY_COLLAPSED_WIDTH, RIGHT_PANEL_HISTORY_WIDTH, RIGHT_PANEL_MOBILE_BREAKPOINT, RIGHT_PANEL_TRIGGER, RIGHT_PANEL_Z_INDEX, RightPanelLayer, RightPanelProvider, RightPanelTrigger, useMobileRightPanel, useRightPanel, useRightPanelContext, useRightPanelKeyboardShortcut };
