// @bun
import {
  PromptInputHelpMenu,
  init_PromptInputHelpMenu
} from "./chunk-wbz2avfn.js";
import {
  init_modalContext,
  useIsInsideModal
} from "./chunk-n6ary9xs.js";
import {
  INTERNAL_ONLY_COMMANDS,
  Select,
  builtInCommandNames,
  formatDescriptionWithSource,
  init_commands1 as init_commands,
  init_select,
  init_useShortcutDisplay,
  init_useTerminalSize,
  useShortcutDisplay
} from "./chunk-4vz571bb.js";
import"./chunk-14p6wvsq.js";
import"./chunk-8hseq8b1.js";
import"./chunk-ddtxq6k5.js";
import"./chunk-28jd8qjx.js";
import"./chunk-djt39ze3.js";
import"./chunk-ptxteaeh.js";
import"./chunk-wd53a7m4.js";
import"./chunk-hms8ge0k.js";
import"./chunk-whpphypt.js";
import"./chunk-pht800m5.js";
import"./chunk-pjkqh1kq.js";
import"./chunk-9a9g5hbj.js";
import"./chunk-9hn8e6h1.js";
import"./chunk-rgyzsbs3.js";
import"./chunk-qn6me9n1.js";
import"./chunk-qd3r2s2n.js";
import"./chunk-djzd7tef.js";
import"./chunk-gyhnpbkx.js";
import"./chunk-71sdcaq6.js";
import"./chunk-60gf7p5s.js";
import"./chunk-sj3d0nqx.js";
import"./chunk-9pk9rk2w.js";
import"./chunk-javpza6a.js";
import"./chunk-6v7bre98.js";
import"./chunk-24kv69g3.js";
import {
  init_useExitOnCtrlCDWithKeybindings,
  useExitOnCtrlCDWithKeybindings
} from "./chunk-fcqebw9m.js";
import"./chunk-dnfd3c9s.js";
import"./chunk-15ezj4ww.js";
import"./chunk-1h284c6e.js";
import"./chunk-582g9yce.js";
import {
  init_useKeybinding
} from "./chunk-y3ztgztb.js";
import"./chunk-4spgkgr3.js";
import"./chunk-n8kbhswc.js";
import"./chunk-60fkafk2.js";
import"./chunk-fgbkrbk3.js";
import"./chunk-ssw61jfd.js";
import"./chunk-093ej2sf.js";
import"./chunk-7tfdhkpy.js";
import"./chunk-nde5ym6a.js";
import"./chunk-k8wq4qsj.js";
import"./chunk-g7d3xx1p.js";
import"./chunk-3wrx2943.js";
import"./chunk-7p9kkh0f.js";
import"./chunk-qp8cgz66.js";
import"./chunk-1mg610h2.js";
import"./chunk-93hc149s.js";
import"./chunk-935nrvdb.js";
import"./chunk-8zz4z1q3.js";
import"./chunk-nnat9jw5.js";
import"./chunk-hqxp6b72.js";
import"./chunk-4jzkqgf1.js";
import"./chunk-33rd41ng.js";
import"./chunk-f257kqw9.js";
import"./chunk-w5hnghah.js";
import"./chunk-36twraxy.js";
import"./chunk-1bkvnj0y.js";
import"./chunk-akdpcc5p.js";
import"./chunk-7rrkrej7.js";
import"./chunk-6r0bxrh6.js";
import"./chunk-d6500tvx.js";
import"./chunk-jg4bw4hp.js";
import"./chunk-epvbnq43.js";
import"./chunk-tn2sx7j6.js";
import"./chunk-6tzyv21c.js";
import"./chunk-8kf8h7xf.js";
import"./chunk-bgan4cpf.js";
import"./chunk-jmv7k0jn.js";
import"./chunk-ch4pgvwq.js";
import"./chunk-99jc4tcw.js";
import"./chunk-fghczfqt.js";
import"./chunk-vwenx8ke.js";
import"./chunk-f86mwfyd.js";
import"./chunk-v4ypszbb.js";
import"./chunk-bk6ck5c2.js";
import"./chunk-ym6j0wv1.js";
import"./chunk-hjmatcgt.js";
import"./chunk-6mdh70q0.js";
import"./chunk-ch92ycde.js";
import"./chunk-e4dsy4g1.js";
import"./chunk-326zehp8.js";
import"./chunk-kc67kt75.js";
import"./chunk-40t1d75v.js";
import"./chunk-nt5dmk8q.js";
import"./chunk-e3abfxpy.js";
import"./chunk-q44zc68f.js";
import"./chunk-fejeqe61.js";
import {
  init_truncate,
  truncate
} from "./chunk-0gp4q8aq.js";
import"./chunk-hn4w9pkj.js";
import {
  Link,
  Pane,
  Tab,
  Tabs,
  ThemedBox_default,
  ThemedText,
  init_src,
  require_react,
  useKeybinding,
  useTabHeaderFocus,
  useTerminalSize
} from "./chunk-0r6npc3t.js";
import {
  require_jsx_runtime
} from "./chunk-gxyx8b8w.js";
import"./chunk-j1mep9ck.js";
import"./chunk-6x35ffpx.js";
import"./chunk-1zbwhcbt.js";
import"./chunk-t0450ma3.js";
import"./chunk-0cqw3y8h.js";
import"./chunk-k1sw7km0.js";
import"./chunk-e3j7m7k2.js";
import"./chunk-sc9ycxra.js";
import"./chunk-hhta0nge.js";
import"./chunk-8wsj9fff.js";
import"./chunk-m28vg9w4.js";
import"./chunk-f8prtxs3.js";
import"./chunk-41a6f2kv.js";
import"./chunk-c1yc761e.js";
import"./chunk-c5g9shkw.js";
import"./chunk-byd20vdq.js";
import"./chunk-kb3758f7.js";
import"./chunk-3j8w0rq8.js";
import"./chunk-tj0dzck2.js";
import"./chunk-aeysytks.js";
import"./chunk-ns1htxgd.js";
import"./chunk-ztqzmfx1.js";
import"./chunk-6k1rsk85.js";
import"./chunk-nxzx0ey9.js";
import"./chunk-yes1my80.js";
import"./chunk-pecy49yr.js";
import"./chunk-azbab59e.js";
import"./chunk-3nk9q8dr.js";
import {
  __esm,
  __toESM
} from "./chunk-hhsxm2yr.js";

// src/components/HelpV2/Commands.tsx
function Commands({ commands, maxHeight, columns, title, onCancel, emptyMessage }) {
  const { headerFocused, focusHeader } = useTabHeaderFocus();
  const maxWidth = Math.max(1, columns - 10);
  const visibleCount = Math.max(1, Math.floor((maxHeight - 10) / 2));
  const options = import_react.useMemo(() => {
    const seen = new Set;
    return commands.filter((cmd) => {
      if (seen.has(cmd.name))
        return false;
      seen.add(cmd.name);
      return true;
    }).sort((a, b) => a.name.localeCompare(b.name)).map((cmd) => ({
      label: `/${cmd.name}`,
      value: cmd.name,
      description: truncate(formatDescriptionWithSource(cmd), maxWidth, true)
    }));
  }, [commands, maxWidth]);
  return /* @__PURE__ */ jsx_runtime.jsx(ThemedBox_default, {
    flexDirection: "column",
    paddingY: 1,
    children: commands.length === 0 && emptyMessage ? /* @__PURE__ */ jsx_runtime.jsx(ThemedText, {
      dimColor: true,
      children: emptyMessage
    }) : /* @__PURE__ */ jsx_runtime.jsxs(jsx_runtime.Fragment, {
      children: [
        /* @__PURE__ */ jsx_runtime.jsx(ThemedText, {
          children: title
        }),
        /* @__PURE__ */ jsx_runtime.jsx(ThemedBox_default, {
          marginTop: 1,
          children: /* @__PURE__ */ jsx_runtime.jsx(Select, {
            options,
            visibleOptionCount: visibleCount,
            onCancel,
            disableSelection: true,
            hideIndexes: true,
            layout: "compact-vertical",
            onUpFromFirstItem: focusHeader,
            isDisabled: headerFocused
          })
        })
      ]
    })
  });
}
var import_react, jsx_runtime;
var init_Commands = __esm(() => {
  init_commands();
  init_truncate();
  init_src();
  init_select();
  import_react = __toESM(require_react(), 1);
  jsx_runtime = __toESM(require_jsx_runtime(), 1);
});

// src/components/HelpV2/General.tsx
function General() {
  return /* @__PURE__ */ jsx_runtime2.jsxs(ThemedBox_default, {
    flexDirection: "column",
    paddingY: 1,
    gap: 1,
    children: [
      /* @__PURE__ */ jsx_runtime2.jsxs(ThemedBox_default, {
        flexDirection: "column",
        gap: 1,
        children: [
          /* @__PURE__ */ jsx_runtime2.jsx(ThemedText, {
            bold: true,
            children: "Getting started"
          }),
          /* @__PURE__ */ jsx_runtime2.jsxs(ThemedBox_default, {
            flexDirection: "column",
            children: [
              /* @__PURE__ */ jsx_runtime2.jsxs(ThemedText, {
                children: [
                  /* @__PURE__ */ jsx_runtime2.jsx(ThemedText, {
                    bold: true,
                    children: "1. "
                  }),
                  /* @__PURE__ */ jsx_runtime2.jsx(ThemedText, {
                    children: "Ask a question or describe a task \u2014 Claude will explore your code and respond."
                  })
                ]
              }),
              /* @__PURE__ */ jsx_runtime2.jsxs(ThemedText, {
                children: [
                  /* @__PURE__ */ jsx_runtime2.jsx(ThemedText, {
                    bold: true,
                    children: "2. "
                  }),
                  /* @__PURE__ */ jsx_runtime2.jsx(ThemedText, {
                    children: "When Claude wants to edit files or run commands, you review and approve each action."
                  })
                ]
              }),
              /* @__PURE__ */ jsx_runtime2.jsxs(ThemedText, {
                children: [
                  /* @__PURE__ */ jsx_runtime2.jsx(ThemedText, {
                    bold: true,
                    children: "3. "
                  }),
                  /* @__PURE__ */ jsx_runtime2.jsx(ThemedText, {
                    children: "Type "
                  }),
                  /* @__PURE__ */ jsx_runtime2.jsx(ThemedText, {
                    bold: true,
                    children: "/commit"
                  }),
                  /* @__PURE__ */ jsx_runtime2.jsx(ThemedText, {
                    children: " to commit changes, "
                  }),
                  /* @__PURE__ */ jsx_runtime2.jsx(ThemedText, {
                    bold: true,
                    children: "/help"
                  }),
                  /* @__PURE__ */ jsx_runtime2.jsx(ThemedText, {
                    children: " for commands, or "
                  }),
                  /* @__PURE__ */ jsx_runtime2.jsx(ThemedText, {
                    bold: true,
                    children: "?"
                  }),
                  /* @__PURE__ */ jsx_runtime2.jsx(ThemedText, {
                    children: " for shortcuts."
                  })
                ]
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsx_runtime2.jsxs(ThemedBox_default, {
        flexDirection: "column",
        children: [
          /* @__PURE__ */ jsx_runtime2.jsx(ThemedBox_default, {
            children: /* @__PURE__ */ jsx_runtime2.jsx(ThemedText, {
              bold: true,
              children: "Shortcuts"
            })
          }),
          /* @__PURE__ */ jsx_runtime2.jsx(PromptInputHelpMenu, {
            gap: 2,
            fixedWidth: true
          })
        ]
      })
    ]
  });
}
var jsx_runtime2;
var init_General = __esm(() => {
  init_src();
  init_PromptInputHelpMenu();
  jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
});

// src/components/HelpV2/HelpV2.tsx
function HelpV2({ onClose, commands }) {
  const { rows, columns } = useTerminalSize();
  const maxHeight = Math.floor(rows / 2);
  const insideModal = useIsInsideModal();
  const close = () => onClose("Help dialog dismissed", { display: "system" });
  useKeybinding("help:dismiss", close, { context: "Help" });
  const exitState = useExitOnCtrlCDWithKeybindings(close);
  const dismissShortcut = useShortcutDisplay("help:dismiss", "Help", "esc");
  const builtinNames = builtInCommandNames();
  let builtinCommands = commands.filter((cmd) => builtinNames.has(cmd.name) && !cmd.isHidden);
  let antOnlyCommands = [];
  if (process.env.USER_TYPE === "ant") {
    const internalOnlyNames = new Set(INTERNAL_ONLY_COMMANDS.map((_) => _.name));
    builtinCommands = builtinCommands.filter((cmd) => !internalOnlyNames.has(cmd.name));
    antOnlyCommands = commands.filter((cmd) => internalOnlyNames.has(cmd.name) && !cmd.isHidden);
  }
  const customCommands = commands.filter((cmd) => !builtinNames.has(cmd.name) && !cmd.isHidden);
  const tabs = [
    /* @__PURE__ */ jsx_runtime3.jsx(Tab, {
      title: "general",
      children: /* @__PURE__ */ jsx_runtime3.jsx(General, {})
    }, "general")
  ];
  tabs.push(/* @__PURE__ */ jsx_runtime3.jsx(Tab, {
    title: "commands",
    children: /* @__PURE__ */ jsx_runtime3.jsx(Commands, {
      commands: builtinCommands,
      maxHeight,
      columns,
      title: "Browse default commands:",
      onCancel: close
    })
  }, "commands"));
  tabs.push(/* @__PURE__ */ jsx_runtime3.jsx(Tab, {
    title: "custom-commands",
    children: /* @__PURE__ */ jsx_runtime3.jsx(Commands, {
      commands: customCommands,
      maxHeight,
      columns,
      title: "Browse custom commands:",
      emptyMessage: "No custom commands found",
      onCancel: close
    })
  }, "custom"));
  if (process.env.USER_TYPE === "ant" && antOnlyCommands.length > 0) {
    tabs.push(/* @__PURE__ */ jsx_runtime3.jsx(Tab, {
      title: "[ant-only]",
      children: /* @__PURE__ */ jsx_runtime3.jsx(Commands, {
        commands: antOnlyCommands,
        maxHeight,
        columns,
        title: "Browse ant-only commands:",
        onCancel: close
      })
    }, "ant-only"));
  }
  return /* @__PURE__ */ jsx_runtime3.jsx(ThemedBox_default, {
    flexDirection: "column",
    height: insideModal ? undefined : maxHeight,
    children: /* @__PURE__ */ jsx_runtime3.jsxs(Pane, {
      color: "professionalBlue",
      children: [
        /* @__PURE__ */ jsx_runtime3.jsx(Tabs, {
          title: process.env.USER_TYPE === "ant" ? "/help" : `Chris Code v${"1.1.4"}`,
          color: "professionalBlue",
          defaultTab: "general",
          children: tabs
        }),
        /* @__PURE__ */ jsx_runtime3.jsx(ThemedBox_default, {
          marginTop: 1,
          children: /* @__PURE__ */ jsx_runtime3.jsxs(ThemedText, {
            children: [
              "For more help: ",
              /* @__PURE__ */ jsx_runtime3.jsx(Link, {
                url: "https://code.claude.com/docs/en/overview"
              })
            ]
          })
        }),
        /* @__PURE__ */ jsx_runtime3.jsx(ThemedBox_default, {
          marginTop: 1,
          children: /* @__PURE__ */ jsx_runtime3.jsx(ThemedText, {
            dimColor: true,
            children: exitState.pending ? /* @__PURE__ */ jsx_runtime3.jsxs(jsx_runtime3.Fragment, {
              children: [
                "Press ",
                exitState.keyName,
                " again to exit"
              ]
            }) : /* @__PURE__ */ jsx_runtime3.jsxs(ThemedText, {
              italic: true,
              children: [
                dismissShortcut,
                " to cancel"
              ]
            })
          })
        })
      ]
    })
  });
}
var jsx_runtime3;
var init_HelpV2 = __esm(() => {
  init_useExitOnCtrlCDWithKeybindings();
  init_useShortcutDisplay();
  init_commands();
  init_modalContext();
  init_useTerminalSize();
  init_src();
  init_useKeybinding();
  init_Commands();
  init_General();
  jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
});

// src/commands/help/help.tsx
var jsx_runtime4, call = async (onDone, { options: { commands } }) => {
  return /* @__PURE__ */ jsx_runtime4.jsx(HelpV2, {
    commands,
    onClose: onDone
  });
};
var init_help = __esm(() => {
  init_HelpV2();
  jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
});
init_help();

export {
  call
};

//# debugId=B0E20F5BAB98D36764756E2164756E21
//# sourceMappingURL=chunk-x4wpp2c5.js.map
