{"version":3,"sources":["/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-EHF7XGJO.cjs","../src/components/unified-pagination.tsx","../src/components/empty-state.tsx"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACpBA,IAAA,2BAAA,EAAA,CAAA,CAAA;AAAA,wCAAA,0BAAA,EAAA;AAAA,EAAA,iBAAA,EAAA,CAAA,EAAA,GAAA;AAAA,CAAA,CAAA;AAqDM,+CAAA;AAzCC,SAAS,iBAAA,CAAkB;AAAA,EAChC,WAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAA;AAAA,EACA,UAAA,EAAY;AACd,CAAA,EAA2B;AACzB,EAAA,MAAM,OAAA,EAAS,yCAAA,CAAU;AACzB,EAAA,MAAM,aAAA,EAAe,+CAAA,CAAgB;AACrC,EAAA,MAAM,SAAA,EAAW,2CAAA,CAAY;AAE7B,EAAA,MAAM,iBAAA,EAAmB,CAAC,IAAA,EAAA,GAAiB;AAEzC,IAAA,MAAM,eAAA,EAAiB,MAAA,CAAO,OAAA;AAG9B,IAAA,GAAA,CAAI,YAAA,EAAc;AAChB,MAAA,YAAA,CAAa,IAAI,CAAA;AAAA,IACnB;AAGA,IAAA,MAAM,OAAA,EAAS,IAAI,eAAA,CAAgB,YAAA,CAAa,QAAA,CAAS,CAAC,CAAA;AAC1D,IAAA,MAAA,CAAO,GAAA,CAAI,MAAA,EAAQ,IAAA,CAAK,QAAA,CAAS,CAAC,CAAA;AAGlC,IAAA,MAAM,OAAA,EAAS,CAAA,EAAA;AACA,IAAA;AAGJ,IAAA;AACF,MAAA;AACA,QAAA;AACK,QAAA;AAAA;AACX,MAAA;AACC,IAAA;AACN,EAAA;AAGkB,EAAA;AAGhB,EAAA;AACG,IAAA;AAAA,IAA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F,QAAA;AACO,QAAA;AACC,UAAA;AACE,UAAA;AACV,QAAA;AACF,MAAA;AACS,QAAA;AACC,UAAA;AACE,UAAA;AACV,QAAA;AACJ,IAAA;AACF,EAAA;AAEM,EAAA;AACA,EAAA;AACA,EAAA;AAKW,EAAA;AACX,EAAA;AAKJ,EAAA;AAEE,oBAAA;AASA,oBAAA;AAKA,oBAAA;AAKY,IAAA;AASC,IAAA;AASZ,IAAA;AAEI,MAAA;AAAA,MAAA;AACU,QAAA;AACD,QAAA;AACE,QAAA;AAET,QAAA;AAAA,MAAA;AAEL,IAAA;AAEJ,EAAA;AAEJ;AFdoB;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-EHF7XGJO.cjs","sourcesContent":[null,"\"use client\"\n\nimport { useRouter, useSearchParams, usePathname } from \"../embed-shims/next-navigation\"\nimport { Pagination } from \"./pagination\"\n\ninterface UnifiedPaginationProps {\n  currentPage: number\n  totalPages: number\n  onPageChange?: (page: number) => void\n  className?: string\n}\n\nexport function UnifiedPagination({ \n  currentPage, \n  totalPages, \n  onPageChange,\n  className = \"mt-8 flex justify-center w-full\"\n}: UnifiedPaginationProps) {\n  const router = useRouter()\n  const searchParams = useSearchParams()\n  const pathname = usePathname()\n\n  const handlePageChange = (page: number) => {\n    // Preserve current scroll position\n    const currentScrollY = window.scrollY\n    \n    // Call the callback to update local state (prevents reload)\n    if (onPageChange) {\n      onPageChange(page)\n    }\n    \n    // Update URL for bookmarking without navigation\n    const params = new URLSearchParams(searchParams.toString())\n    params.set(\"page\", page.toString())\n    \n    // Update URL without navigation (for bookmarking support)\n    const newUrl = `${pathname}?${params.toString()}`\n    window.history.replaceState(null, '', newUrl)\n    \n    // Restore scroll position after a brief delay to allow content to render\n    setTimeout(() => {\n      window.scrollTo({\n        top: currentScrollY,\n        behavior: 'instant' // Instant to prevent any scroll animation\n      })\n    }, 0)\n  }\n\n  // Don't render pagination if there's only one page\n  if (totalPages <= 1) return null\n\n  return (\n    <div className={className}>\n      <Pagination\n        currentPage={currentPage}\n        totalPages={totalPages}\n        onPageChange={handlePageChange}\n      />\n    </div>\n  )\n} ","\"use client\";\n\nimport { Search, FileText, Package } from \"lucide-react\"\nimport { Button } from \"./ui/button\"\nimport { useRouter } from \"../embed-shims/next-navigation\"\n\nexport interface EmptyStateProps {\n  type: 'vendors' | 'posts' | 'search' | 'generic'\n  title?: string\n  description?: string\n  showBackButton?: boolean\n  onGoBack?: () => void\n  backButtonText?: string\n  // New CTA properties\n  showCTA?: boolean\n  ctaText?: string\n  onCtaClick?: () => void\n  /**\n   * Link-CTA mode: render the CTA as a navigation link (`href` — plain or\n   * `mailto:`). Wins over `onCtaClick`, and SHORT-CIRCUITS the smart-CTA\n   * path-sniffing below (which reads `window.location.pathname` — an\n   * SSR/client divergence server-rendered pages must never enter).\n   */\n  ctaHref?: string\n  ctaVariant?: 'primary' | 'secondary'\n}\n\nexport function EmptyState({\n  type,\n  title,\n  description,\n  showBackButton = false,\n  onGoBack,\n  backButtonText = \"Go Back\",\n  showCTA = true,\n  ctaText,\n  onCtaClick,\n  ctaHref,\n  ctaVariant = 'primary'\n}: EmptyStateProps) {\n  const router = useRouter()\n\n  // Default content based on type\n  const getDefaultContent = () => {\n    switch (type) {\n      case 'vendors':\n        return {\n          icon: <Package className=\"w-full h-full\" />,\n          title: \"No vendors found\",\n          description: \"We couldn't find any vendors matching your criteria. Try adjusting your filters or search terms.\"\n        }\n      case 'posts':\n        return {\n          icon: <FileText className=\"w-full h-full\" />,\n          title: \"No articles found\",\n          description: \"We couldn't find any articles matching your criteria. Try different categories, tags, or search terms.\"\n        }\n      case 'search':\n        return {\n          icon: <Search className=\"w-full h-full\" />,\n          title: \"No results found\",\n          description: \"Your search didn't return any results. Try different keywords or browse our categories.\"\n        }\n      default:\n        return {\n          icon: <Search className=\"w-full h-full\" />,\n          title: \"Nothing found\",\n          description: \"We couldn't find what you're looking for. Try adjusting your search or filters.\"\n        }\n    }\n  }\n\n  // Smart CTA logic based on context\n  const getSmartCTA = () => {\n    // If custom CTA is provided, use it\n    if (ctaText && onCtaClick) {\n      return {\n        text: ctaText,\n        action: onCtaClick\n      }\n    }\n\n    // Check if we're on the client side\n    const isClient = typeof window !== 'undefined'\n    const currentPath = isClient ? window.location.pathname : ''\n\n    // Surgical filter reset (promoted from the hub's diverged clone during\n    // the EmptyState convergence): delete ONLY the filter params the surface\n    // owns — nuking the whole query string threw away unrelated state — and\n    // use `replace` with `scroll: false` so resetting filters neither adds a\n    // history entry nor jumps the page.\n    const resetParams = (paramsToDelete: string[]) => {\n      if (!isClient) return\n      const params = new URLSearchParams(window.location.search)\n      for (const p of paramsToDelete) params.delete(p)\n      const queryString = params.toString()\n      // Keep the hash — a filter reset must not clear an unrelated\n      // deep-link anchor (e.g. #delivery-123).\n      const hash = window.location.hash\n      router.replace(\n        `${window.location.pathname}${queryString ? `?${queryString}` : ''}${hash}`,\n        { scroll: false },\n      )\n    }\n\n    // Smart defaults based on type and context\n    switch (type) {\n      case 'search':\n        return {\n          text: \"Reset Filters\",\n          action: () => resetParams(['search', 'page'])\n        }\n      case 'posts':\n        // Blog-style listing pages (blog, case studies) reset their filters\n        if (currentPath.includes('/blog') || currentPath.includes('/case-studies')) {\n          return {\n            text: \"Reset Filters\",\n            action: () => resetParams(['search', 'page', 'category', 'tags'])\n          }\n        } else if (currentPath.includes('/profile')) {\n          return {\n            text: \"Browse Vendors\",\n            action: () => router.push('/vendors')\n          }\n        }\n        return {\n          text: \"View All Posts\",\n          action: () => router.push('/blog')\n        }\n      case 'vendors':\n        // If we're in profile or other pages, direct to main content\n        if (currentPath.includes('/profile')) {\n          return {\n            text: \"Browse Vendors\",\n            action: () => router.push('/vendors')\n          }\n        } else if (currentPath.includes('/vendors') || currentPath.includes('/margin-increase/compare')) {\n          return {\n            text: \"Reset Filters\",\n            action: () => resetParams(['search', 'page', 'category', 'subcategory'])\n          }\n        }\n        return {\n          text: \"Browse Vendors\",\n          action: () => router.push('/vendors')\n        }\n      default:\n        return {\n          text: \"Browse Vendors\",\n          action: () => router.push('/vendors')\n        }\n    }\n  }\n\n  const defaultContent = getDefaultContent()\n  const displayTitle = title || defaultContent.title\n  const displayDescription = description || defaultContent.description\n  // ctaHref short-circuits BEFORE getSmartCTA(): the smart defaults read\n  // window.location.pathname (SSR-empty, client-real), so a server-rendered\n  // page with a link CTA must never enter that branch. Existing callers\n  // without ctaHref keep today's smart-default behavior unchanged.\n  const smartCTA = ctaHref ? null : getSmartCTA()\n  const ctaClassName = ctaVariant === 'primary'\n    ? \"w-full bg-ods-accent text-ods-text-on-accent hover:bg-ods-accent-hover transition-all duration-150 font-body font-medium\"\n    : \"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-body font-medium\"\n\n  return (\n    <div className=\"flex flex-col items-center justify-center py-6 md:py-16 px-6 text-center\">\n      {/* Icon */}\n      <div className=\"mb-3 md:mb-6 flex items-center justify-center\">\n        <div className=\"rounded-full bg-ods-card p-3 md:p-6 border border-ods-border\">\n          <div className=\"w-8 h-8 md:w-16 md:h-16 text-ods-text-secondary flex items-center justify-center\">\n            {defaultContent.icon}\n          </div>\n        </div>\n      </div>\n\n      {/* Title */}\n      <h2 className=\"mb-2 md:mb-3 text-h3 text-ods-text-primary\">\n        {displayTitle}\n      </h2>\n\n      {/* Description */}\n      <p className=\"mb-4 md:mb-8 max-w-md text-h6 text-ods-text-secondary\">\n        {displayDescription}\n      </p>\n\n      {/* Link CTA (ctaHref) — SSR-safe, no path sniffing */}\n      {showCTA && ctaHref && (\n        <div className=\"w-full max-w-xs mb-3\">\n          <Button href={ctaHref} className={ctaClassName}>\n            {ctaText || 'Contact us'}\n          </Button>\n        </div>\n      )}\n\n      {/* Smart CTA Button */}\n      {showCTA && !ctaHref && smartCTA && (\n        <div className=\"w-full max-w-xs mb-3\">\n          <Button onClick={smartCTA.action} className={ctaClassName}>\n            {smartCTA.text}\n          </Button>\n        </div>\n      )}\n\n      {/* Optional Back Button */}\n      {showBackButton && onGoBack && (\n        <div className=\"w-full max-w-xs\">\n          <Button\n            onClick={onGoBack}\n            variant=\"outline\"\n            className=\"w-full transition-all duration-150 font-body font-medium\"\n          >\n            {backButtonText}\n          </Button>\n        </div>\n      )}\n    </div>\n  )\n} "]}