"use client";
import {
  OPENFRAME_DEV_SECTIONS,
  PageLayout,
  Pagination,
  StatusFilterComponent,
  TASK_TYPE_LABELS,
  TASK_TYPE_TEXT_COLORS,
  getStatusColorScheme,
  init_pagination
} from "./chunk-J6O57C7S.js";
import {
  PageShell,
  SearchInput,
  StatusBadge
} from "./chunk-ICOMPUMX.js";
import {
  init_next_navigation,
  usePathname,
  useRouter,
  useSearchParams
} from "./chunk-PLJLE4A4.js";
import {
  Button,
  init_button2 as init_button
} from "./chunk-LDEXTWMK.js";
import {
  init_next_link,
  next_link_default
} from "./chunk-OHPI2HRK.js";
import {
  cn,
  init_cn
} from "./chunk-XTCBRQN2.js";
import {
  __esm,
  __export
} from "./chunk-GGWZFCYS.js";

// src/components/unified-pagination.tsx
var unified_pagination_exports = {};
__export(unified_pagination_exports, {
  UnifiedPagination: () => UnifiedPagination
});
import { jsx as jsx2 } from "react/jsx-runtime";
function UnifiedPagination({
  currentPage,
  totalPages,
  onPageChange,
  className = "mt-8 flex justify-center w-full"
}) {
  const router = useRouter();
  const searchParams = useSearchParams();
  const pathname = usePathname();
  const handlePageChange = (page) => {
    const currentScrollY = window.scrollY;
    if (onPageChange) {
      onPageChange(page);
    }
    const params = new URLSearchParams(searchParams.toString());
    params.set("page", page.toString());
    const newUrl = `${pathname}?${params.toString()}`;
    window.history.replaceState(null, "", newUrl);
    setTimeout(() => {
      window.scrollTo({
        top: currentScrollY,
        behavior: "instant"
        // Instant to prevent any scroll animation
      });
    }, 0);
  };
  if (totalPages <= 1) return null;
  return /* @__PURE__ */ jsx2("div", { className, children: /* @__PURE__ */ jsx2(
    Pagination,
    {
      currentPage,
      totalPages,
      onPageChange: handlePageChange
    }
  ) });
}
var init_unified_pagination = __esm({
  "src/components/unified-pagination.tsx"() {
    "use strict";
    "use client";
    init_next_navigation();
    init_pagination();
  }
});

// src/components/empty-state.tsx
init_button();
init_next_navigation();
import { Search, FileText, Package } from "lucide-react";
import { jsx, jsxs } from "react/jsx-runtime";
function EmptyState({
  type,
  title,
  description,
  showBackButton = false,
  onGoBack,
  backButtonText = "Go Back",
  showCTA = true,
  ctaText,
  onCtaClick,
  ctaVariant = "primary"
}) {
  const router = useRouter();
  const getDefaultContent = () => {
    switch (type) {
      case "vendors":
        return {
          icon: /* @__PURE__ */ jsx(Package, { className: "w-full h-full" }),
          title: "No vendors found",
          description: "We couldn't find any vendors matching your criteria. Try adjusting your filters or search terms."
        };
      case "posts":
        return {
          icon: /* @__PURE__ */ jsx(FileText, { className: "w-full h-full" }),
          title: "No articles found",
          description: "We couldn't find any articles matching your criteria. Try different categories, tags, or search terms."
        };
      case "search":
        return {
          icon: /* @__PURE__ */ jsx(Search, { className: "w-full h-full" }),
          title: "No results found",
          description: "Your search didn't return any results. Try different keywords or browse our categories."
        };
      default:
        return {
          icon: /* @__PURE__ */ jsx(Search, { className: "w-full h-full" }),
          title: "Nothing found",
          description: "We couldn't find what you're looking for. Try adjusting your search or filters."
        };
    }
  };
  const getSmartCTA = () => {
    if (ctaText && onCtaClick) {
      return {
        text: ctaText,
        action: onCtaClick
      };
    }
    const isClient = typeof window !== "undefined";
    const currentPath = isClient ? window.location.pathname : "";
    switch (type) {
      case "search":
        return {
          text: "Reset Filters",
          action: () => {
            if (isClient) {
              const url = new URL(window.location.href);
              url.search = "";
              router.push(url.pathname);
            }
          }
        };
      case "posts":
        if (currentPath.includes("/blog")) {
          return {
            text: "Reset Filters",
            action: () => {
              if (isClient) {
                const url = new URL(window.location.href);
                url.search = "";
                router.push(url.pathname);
              }
            }
          };
        } else if (currentPath.includes("/profile")) {
          return {
            text: "Browse Vendors",
            action: () => router.push("/vendors")
          };
        }
        return {
          text: "View All Posts",
          action: () => router.push("/blog")
        };
      case "vendors":
        if (currentPath.includes("/profile")) {
          return {
            text: "Browse Vendors",
            action: () => router.push("/vendors")
          };
        } else if (currentPath.includes("/vendors") || currentPath.includes("/margin-increase/compare")) {
          return {
            text: "Reset Filters",
            action: () => {
              if (isClient) {
                const url = new URL(window.location.href);
                url.search = "";
                router.push(url.pathname);
              }
            }
          };
        }
        return {
          text: "Browse Vendors",
          action: () => router.push("/vendors")
        };
      default:
        return {
          text: "Browse Vendors",
          action: () => router.push("/vendors")
        };
    }
  };
  const defaultContent = getDefaultContent();
  const displayTitle = title || defaultContent.title;
  const displayDescription = description || defaultContent.description;
  const smartCTA = getSmartCTA();
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-6 md:py-16 px-6 text-center", children: [
    /* @__PURE__ */ jsx("div", { className: "mb-3 md:mb-6 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "rounded-full bg-ods-card p-3 md:p-6 border border-ods-border", children: /* @__PURE__ */ jsx("div", { className: "w-8 h-8 md:w-16 md:h-16 text-ods-text-secondary flex items-center justify-center", children: defaultContent.icon }) }) }),
    /* @__PURE__ */ jsx("h2", { className: "mb-2 md:mb-3 text-lg md:text-xl font-semibold font-['DM_Sans'] text-ods-text-primary tracking-[-0.02em]", children: displayTitle }),
    /* @__PURE__ */ jsx("p", { className: "mb-4 md:mb-8 max-w-md text-sm font-medium font-['DM_Sans'] text-ods-text-secondary leading-[1.43em]", children: displayDescription }),
    showCTA && smartCTA && /* @__PURE__ */ jsx("div", { className: "w-full max-w-xs mb-3", children: /* @__PURE__ */ jsx(
      Button,
      {
        onClick: smartCTA.action,
        className: ctaVariant === "primary" ? "w-full bg-ods-accent text-ods-text-on-accent hover:bg-ods-accent-hover transition-all duration-150 font-['DM_Sans'] font-medium" : "w-full bg-transparent border border-ods-border text-ods-text-primary hover:border-ods-accent hover:text-ods-accent transition-all duration-150 font-['DM_Sans'] font-medium",
        children: smartCTA.text
      }
    ) }),
    showBackButton && onGoBack && /* @__PURE__ */ jsx("div", { className: "w-full max-w-xs", children: /* @__PURE__ */ jsx(
      Button,
      {
        onClick: onGoBack,
        variant: "outline",
        className: "w-full transition-all duration-150 font-['DM_Sans'] font-medium",
        children: backButtonText
      }
    ) })
  ] });
}

// src/components/shared/dev-section/dev-section-view.tsx
import { useState, useEffect } from "react";
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
function DevSectionView({ sectionKey, hero, preControls, children }) {
  const section = OPENFRAME_DEV_SECTIONS[sectionKey];
  const router = useRouter();
  const pathname = usePathname();
  const searchParams = useSearchParams();
  const search = section.search;
  const filter = section.filter;
  const currentSearch = search ? searchParams.get(search.paramKey) || "" : "";
  const currentFilterValue = filter ? searchParams.get(filter.paramKey) || filter.defaultValue : "";
  const [searchValue, setSearchValue] = useState(() => currentSearch);
  useEffect(() => {
    setSearchValue(currentSearch);
  }, [currentSearch]);
  const handleSearchSubmit = (value) => {
    if (!search) return;
    const params = new URLSearchParams(searchParams.toString());
    if (value.trim()) params.set(search.paramKey, value.trim());
    else params.delete(search.paramKey);
    router.replace(`${pathname}?${params.toString()}`, { scroll: false });
  };
  const handleFilterChange = (value) => {
    if (!filter) return;
    const params = new URLSearchParams(searchParams.toString());
    if (value === filter.defaultValue) params.delete(filter.paramKey);
    else params.set(filter.paramKey, value);
    router.replace(`${pathname}?${params.toString()}`, { scroll: false });
  };
  return /* @__PURE__ */ jsxs2("div", { className: "w-full flex flex-col gap-10", children: [
    hero ? /* @__PURE__ */ jsxs2("div", { className: "space-y-4", children: [
      /* @__PURE__ */ jsxs2("h1", { className: "text-h1 tracking-[-1.12px] text-ods-text-primary flex items-center gap-3", children: [
        hero.icon,
        hero.title ?? section.hero.title
      ] }),
      /* @__PURE__ */ jsx3("p", { className: "font-['DM_Sans'] font-medium text-[18px] leading-[28px] text-ods-text-secondary max-w-3xl", children: hero.description })
    ] }) : /* @__PURE__ */ jsx3("div", { className: "flex items-center justify-between w-full", children: /* @__PURE__ */ jsxs2("h2", { className: "font-['Azeret_Mono'] font-semibold text-[32px] md:text-[40px] lg:text-[48px] leading-[40px] md:leading-[48px] lg:leading-[56px] text-ods-text-primary tracking-[-0.64px] md:tracking-[-0.8px] lg:tracking-[-0.96px]", children: [
      section.hero.title,
      /* @__PURE__ */ jsx3("span", { className: "text-ods-accent", children: ":" })
    ] }) }),
    preControls,
    (search || filter) && /* @__PURE__ */ jsxs2("div", { className: "space-y-4", children: [
      search && /* @__PURE__ */ jsx3(
        SearchInput,
        {
          showDropdown: false,
          placeholder: search.placeholder,
          value: searchValue,
          onChange: setSearchValue,
          onSubmit: handleSearchSubmit
        }
      ),
      filter && /* @__PURE__ */ jsx3(
        StatusFilterComponent,
        {
          selectedStatus: currentFilterValue,
          onStatusChange: handleFilterChange,
          statusOptions: [...filter.options]
        }
      )
    ] }),
    children
  ] });
}

// src/components/shared/dev-section/dev-section-page.tsx
init_next_navigation();
import { jsx as jsx4 } from "react/jsx-runtime";
var SECTION_HERO_ICON_CLASS = "h-10 w-10 text-ods-accent";
function DevSectionPage({
  sectionKey,
  children,
  preControls,
  backButton,
  title,
  subtitle
}) {
  const router = useRouter();
  const section = OPENFRAME_DEV_SECTIONS[sectionKey];
  const Icon = section.icon;
  const backCfg = backButton === false ? void 0 : {
    label: (backButton ? backButton.label : void 0) ?? "Back to home",
    onClick: () => router.push((backButton ? backButton.href : void 0) ?? "/")
  };
  return /* @__PURE__ */ jsx4(PageShell, { children: /* @__PURE__ */ jsx4(PageLayout, { backButton: backCfg, children: /* @__PURE__ */ jsx4(
    DevSectionView,
    {
      sectionKey,
      hero: {
        icon: /* @__PURE__ */ jsx4(Icon, { className: SECTION_HERO_ICON_CLASS }),
        title,
        description: subtitle ?? section.hero.description
      },
      preControls,
      children
    }
  ) }) });
}

// src/components/shared/dev-section/dev-card-row.tsx
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
function DevCardRowContent({
  title,
  subtitle,
  description,
  emptyDescription = "No description provided",
  rightBadges
}) {
  return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col md:flex-row items-start justify-between gap-[12px] md:gap-[16px] w-full", children: [
    /* @__PURE__ */ jsxs3("div", { className: "flex-1 min-w-0 w-full md:w-auto flex flex-col gap-[12px] md:gap-[16px]", children: [
      /* @__PURE__ */ jsx5("div", { className: "min-h-[24px] flex items-center", children: /* @__PURE__ */ jsx5("h3", { className: "text-h3 text-ods-text-primary tracking-[-0.36px] flex-1 line-clamp-2 md:truncate break-words", children: title }) }),
      /* @__PURE__ */ jsx5("div", { className: "min-h-[20px] flex items-center", children: /* @__PURE__ */ jsx5("p", { className: "text-h5 text-ods-text-secondary uppercase tracking-[-0.28px] truncate", children: subtitle }) }),
      /* @__PURE__ */ jsx5("div", { className: "min-h-[72px] flex items-center", children: /* @__PURE__ */ jsx5("p", { className: "text-h4 text-ods-text-secondary line-clamp-3 break-words", children: description || emptyDescription }) })
    ] }),
    /* @__PURE__ */ jsx5("div", { className: "flex-shrink-0 self-start flex flex-col gap-2", children: rightBadges })
  ] });
}
function DevCardRowSkeleton() {
  return /* @__PURE__ */ jsx5("div", { className: "border-b border-ods-border last:border-b-0 p-[12px] md:p-[16px]", children: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col md:flex-row items-start justify-between gap-[12px] md:gap-[16px] w-full", children: [
    /* @__PURE__ */ jsxs3("div", { className: "flex-1 min-w-0 w-full md:w-auto flex flex-col gap-[12px] md:gap-[16px]", children: [
      /* @__PURE__ */ jsx5("div", { className: "min-h-[24px] flex items-center", children: /* @__PURE__ */ jsx5("div", { className: "h-[20px] bg-ods-border rounded animate-pulse w-full" }) }),
      /* @__PURE__ */ jsx5("div", { className: "min-h-[20px] flex items-center", children: /* @__PURE__ */ jsx5("div", { className: "h-[20px] bg-ods-border rounded animate-pulse w-1/2" }) }),
      /* @__PURE__ */ jsx5("div", { className: "min-h-[72px] flex items-center", children: /* @__PURE__ */ jsxs3("div", { className: "flex-1 space-y-1", children: [
        /* @__PURE__ */ jsx5("div", { className: "h-[20px] bg-ods-border rounded animate-pulse w-full" }),
        /* @__PURE__ */ jsx5("div", { className: "h-[20px] bg-ods-border rounded animate-pulse w-full" }),
        /* @__PURE__ */ jsx5("div", { className: "h-[20px] bg-ods-border rounded animate-pulse w-2/3" })
      ] }) })
    ] }),
    /* @__PURE__ */ jsxs3("div", { className: "flex-shrink-0 self-start flex flex-col gap-2", children: [
      /* @__PURE__ */ jsx5("div", { className: "h-[32px] w-[100px] bg-ods-border rounded animate-pulse" }),
      /* @__PURE__ */ jsx5("div", { className: "h-[32px] w-[120px] bg-ods-border rounded animate-pulse" })
    ] })
  ] }) });
}
function DevCardRowSkeletonList({ rows = 5 }) {
  return /* @__PURE__ */ jsx5("div", { className: "bg-ods-card border border-ods-border rounded-[6px] overflow-hidden w-full", children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ jsx5(DevCardRowSkeleton, {}, i)) });
}

// src/components/shared/delivery/delivery-row.tsx
init_next_link();
init_cn();
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
function getRelativeTime(timestamp) {
  const now = Date.now();
  const diff = now - timestamp;
  const days = Math.floor(diff / (1e3 * 60 * 60 * 24));
  const weeks = Math.floor(days / 7);
  const months = Math.floor(days / 30);
  if (months > 0) return months === 1 ? "last month" : `${months} months ago`;
  if (weeks > 0) return weeks === 1 ? "last week" : `${weeks} weeks ago`;
  if (days > 0) return days === 1 ? "yesterday" : `${days} days ago`;
  return "today";
}
function DeliveryRow({
  item,
  href,
  caption,
  className
}) {
  const taskType = item.taskType;
  const typeBadgeLabel = TASK_TYPE_LABELS[taskType] || "TASK";
  const typeBadgeTextColor = TASK_TYPE_TEXT_COLORS[taskType] || "";
  const statusBadgeScheme = getStatusColorScheme(item.status);
  const relativeTime = getRelativeTime(item.dateUpdated);
  const subtitle = `ACTIVE ${relativeTime}${item.listNames.length > 0 ? `, ${item.listNames.join(", ")}` : ""}, ${item.id}`;
  const inner = /* @__PURE__ */ jsxs4("div", { className: "flex flex-col md:flex-row items-start justify-between gap-[12px] md:gap-[16px] w-full", children: [
    /* @__PURE__ */ jsxs4("div", { className: "flex-1 min-w-0 w-full md:w-auto flex flex-col gap-[12px] md:gap-[16px]", children: [
      caption && /* @__PURE__ */ jsx6("p", { className: "text-xs font-medium uppercase tracking-wider text-ods-text-secondary", children: caption }),
      /* @__PURE__ */ jsx6("div", { className: "min-h-[24px] md:min-h-[24px] flex items-center", children: /* @__PURE__ */ jsx6("h3", { className: "text-h3 text-ods-text-primary tracking-[-0.36px] flex-1 line-clamp-2 md:truncate break-words", children: item.title }) }),
      /* @__PURE__ */ jsx6("div", { className: "min-h-[20px] flex items-center", children: /* @__PURE__ */ jsx6("p", { className: "text-h5 text-ods-text-secondary uppercase tracking-[-0.28px] truncate", children: subtitle }) }),
      /* @__PURE__ */ jsx6("div", { className: "min-h-[72px] flex items-center", children: /* @__PURE__ */ jsx6("p", { className: "text-h4 text-ods-text-secondary line-clamp-3 break-words", children: item.description || "No description provided" }) })
    ] }),
    /* @__PURE__ */ jsxs4("div", { className: "flex-shrink-0 self-start flex flex-col gap-2", children: [
      /* @__PURE__ */ jsx6(
        StatusBadge,
        {
          text: item.status.toUpperCase(),
          colorScheme: statusBadgeScheme,
          variant: "card",
          className: "border border-ods-border"
        }
      ),
      /* @__PURE__ */ jsx6(
        StatusBadge,
        {
          text: typeBadgeLabel,
          variant: "card",
          className: `border border-ods-border ${typeBadgeTextColor}`
        }
      )
    ] })
  ] });
  const baseClass = cn(
    "block p-[12px] md:p-[16px] no-underline text-inherit transition-colors duration-150",
    href && "hover:bg-ods-bg-hover cursor-pointer",
    className
  );
  if (href) {
    return /* @__PURE__ */ jsx6(next_link_default, { href, className: baseClass, prefetch: false, children: inner });
  }
  return /* @__PURE__ */ jsx6("div", { className: baseClass, children: inner });
}

export {
  EmptyState,
  UnifiedPagination,
  unified_pagination_exports,
  init_unified_pagination,
  DevSectionView,
  DevSectionPage,
  DevCardRowContent,
  DevCardRowSkeleton,
  DevCardRowSkeletonList,
  DeliveryRow
};
//# sourceMappingURL=chunk-GJVSLS2R.js.map