"use client";
import {
  cn,
  init_cn
} from "./chunk-XTCBRQN2.js";

// src/utils/common.ts
import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";
function cn2(...inputs) {
  return twMerge(clsx(inputs));
}
function delay(ms) {
  return new Promise((resolve) => setTimeout(resolve, ms));
}
function generateRandomString(length = 8) {
  const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  let result = "";
  for (let i = 0; i < length; i++) {
    result += chars.charAt(Math.floor(Math.random() * chars.length));
  }
  return result;
}
function truncateString(str, maxLength, suffix = "...") {
  if (str.length <= maxLength) return str;
  return str.substring(0, maxLength - suffix.length) + suffix;
}
function serializeJsonLd(schema) {
  return JSON.stringify(schema).replace(/</g, "\\u003c");
}
function deepClone(obj) {
  return JSON.parse(JSON.stringify(obj));
}
function getSlackCommunityJoinUrl() {
  const url = process.env.NEXT_PUBLIC_SLACK_COMMUNITY_JOIN_URL;
  if (!url) {
    console.warn("NEXT_PUBLIC_SLACK_COMMUNITY_JOIN_URL is not defined in environment variables");
    return "https://join.slack.com/t/openmsp/shared_invite/zt-36bl7mx0h-3~U2nFH6nqHqoTPXMaHEHA";
  }
  return url;
}

// src/utils/suggestion-url.ts
function buildSuggestionUrl(path, opts = {}) {
  const qs = new URLSearchParams();
  const { entityType, entityId } = opts;
  if (entityType && entityId !== void 0 && entityId !== null && entityId !== "") {
    qs.set("entityType", entityType);
    qs.set("entityId", String(entityId));
  }
  if (opts.count !== void 0) qs.set("count", String(opts.count));
  for (const [key, value] of Object.entries(opts.extraParams ?? {})) {
    if (value !== void 0 && value !== "") qs.set(key, value);
  }
  const query = qs.toString();
  return `${opts.apiBaseUrl ?? ""}${path}${query ? `?${query}` : ""}`;
}

// src/components/ui/chevron-button.tsx
init_cn();
import * as React from "react";
import { ChevronUp, ChevronDown } from "lucide-react";
import { jsx } from "react/jsx-runtime";
var ChevronButton = React.forwardRef(
  ({ className, direction = "down", size = "md", isExpanded, backgroundColor, borderColor, ...props }, ref) => {
    const Icon = (isExpanded ? ChevronUp : ChevronDown) || (direction === "up" ? ChevronUp : ChevronDown);
    const sizeClasses = {
      sm: "h-4 w-4",
      md: "h-5 w-5",
      lg: "h-6 w-6"
    };
    return /* @__PURE__ */ jsx(
      "button",
      {
        className: cn(
          "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
          "h-10 px-4 py-2",
          className
        ),
        style: {
          backgroundColor,
          borderColor
        },
        ref,
        ...props,
        children: /* @__PURE__ */ jsx(Icon, { className: sizeClasses[size] })
      }
    );
  }
);
ChevronButton.displayName = "ChevronButton";

export {
  cn2 as cn,
  delay,
  generateRandomString,
  truncateString,
  serializeJsonLd,
  deepClone,
  getSlackCommunityJoinUrl,
  buildSuggestionUrl,
  ChevronButton
};
//# sourceMappingURL=chunk-NR535XIY.js.map