"use client";
'use strict';

var React = require('react');
var utils = require('@hanzo/ui/lib/utils');
var jsxRuntime = require('react/jsx-runtime');

function _interopNamespace(e) {
  if (e && e.__esModule) return e;
  var n = Object.create(null);
  if (e) {
    Object.keys(e).forEach(function (k) {
      if (k !== 'default') {
        var d = Object.getOwnPropertyDescriptor(e, k);
        Object.defineProperty(n, k, d.get ? d : {
          enumerable: true,
          get: function () { return e[k]; }
        });
      }
    });
  }
  n.default = e;
  return Object.freeze(n);
}

var React__namespace = /*#__PURE__*/_interopNamespace(React);

var CodeTabs = React__namespace.forwardRef(
  ({ className, tabs = [], defaultTab = 0, ...props }, ref) => {
    const [activeTab, setActiveTab] = React__namespace.useState(defaultTab);
    if (tabs.length === 0) {
      return /* @__PURE__ */ jsxRuntime.jsx(
        "div",
        {
          ref,
          className: utils.cn(
            "rounded-lg border bg-card p-6 text-card-foreground shadow-sm",
            className
          ),
          ...props,
          children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "No code tabs available. Add tabs to display code snippets." })
        }
      );
    }
    return /* @__PURE__ */ jsxRuntime.jsxs(
      "div",
      {
        ref,
        className: utils.cn(
          "rounded-lg border bg-card text-card-foreground shadow-sm",
          className
        ),
        ...props,
        children: [
          /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1 p-2", children: tabs.map((tab, index) => /* @__PURE__ */ jsxRuntime.jsx(
            "button",
            {
              onClick: () => setActiveTab(index),
              className: utils.cn(
                "rounded-md px-4 py-2 text-sm font-medium transition-colors",
                activeTab === index ? "bg-primary text-primary-foreground" : "hover:bg-muted"
              ),
              children: tab.label
            },
            index
          )) }) }),
          /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "overflow-x-auto rounded-md bg-muted p-4", children: /* @__PURE__ */ jsxRuntime.jsx("code", { className: "text-sm", children: tabs[activeTab]?.code }) }) })
        ]
      }
    );
  }
);
CodeTabs.displayName = "CodeTabs";

exports.CodeTabs = CodeTabs;
