randmarcomps 1.372.0 → 1.374.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -638,6 +638,15 @@ declare interface OpportunitiesTableProps {
638
638
  loading?: boolean;
639
639
  }
640
640
 
641
+ export declare function OrdersCard({ applicationId, orders, loading, title }: OrdersCardProps): JSX.Element;
642
+
643
+ declare interface OrdersCardProps {
644
+ applicationId: string;
645
+ orders?: OrderDetail[] | null;
646
+ loading?: boolean;
647
+ title?: string;
648
+ }
649
+
641
650
  export declare function PageHeader({ title, children, className }: PageHeaderProps): JSX.Element;
642
651
 
643
652
  export declare interface PageHeaderProps {
@@ -63802,10 +63802,7 @@ function ManufacturerProducts({
63802
63802
  }, V = () => {
63803
63803
  var ae, ge;
63804
63804
  return ((ge = (ae = e.Categories) == null ? void 0 : ae.find((se) => se.CategoryCode === l)) == null ? void 0 : ge.CategoryName) || l;
63805
- }, q = useMemo(() => R != null && R.Products ? [...R.Products].sort((ae, ge) => {
63806
- var se, Ae, Ve, Ne;
63807
- return _ === "price-asc" ? (((se = ae.Distribution) == null ? void 0 : se.Price) ?? 0) - (((Ae = ge.Distribution) == null ? void 0 : Ae.Price) ?? 0) : _ === "price-desc" ? (((Ve = ge.Distribution) == null ? void 0 : Ve.Price) ?? 0) - (((Ne = ae.Distribution) == null ? void 0 : Ne.Price) ?? 0) : _ === "name" ? (ae.Title ?? "").localeCompare(ge.Title ?? "") : _ === "percentile" ? (ge.OverallPercentileRank ?? 0) - (ae.OverallPercentileRank ?? 0) : 0;
63808
- }) : [], [R == null ? void 0 : R.Products, _]);
63805
+ }, q = useMemo(() => R != null && R.Products ? [...R.Products].sort((ae, ge) => _ === "price-asc" ? (ae.MAP ?? 0) - (ge.MAP ?? 0) : _ === "price-desc" ? (ge.MAP ?? 0) - (ae.MAP ?? 0) : _ === "name" ? (ae.Title ?? "").localeCompare(ge.Title ?? "") : _ === "percentile" ? (ge.OverallPercentileRank ?? 0) - (ae.OverallPercentileRank ?? 0) : 0) : [], [R == null ? void 0 : R.Products, _]);
63809
63806
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
63810
63807
  /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
63811
63808
  /* @__PURE__ */ jsx(
@@ -63871,8 +63868,8 @@ function ManufacturerProducts({
63871
63868
  /* @__PURE__ */ jsxs(Select, { value: _, onValueChange: C, children: [
63872
63869
  /* @__PURE__ */ jsx(SelectTrigger, { className: "w-[220px]", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
63873
63870
  /* @__PURE__ */ jsxs(SelectContent, { children: [
63874
- /* @__PURE__ */ jsx(SelectItem, { value: "price-asc", children: "Price: Low to High" }),
63875
- /* @__PURE__ */ jsx(SelectItem, { value: "price-desc", children: "Price: High to Low" }),
63871
+ /* @__PURE__ */ jsx(SelectItem, { value: "price-asc", children: "MAP: Low to High" }),
63872
+ /* @__PURE__ */ jsx(SelectItem, { value: "price-desc", children: "MAP: High to Low" }),
63876
63873
  /* @__PURE__ */ jsx(SelectItem, { value: "name", children: "Name" }),
63877
63874
  /* @__PURE__ */ jsx(SelectItem, { value: "percentile", children: "Best Selling" })
63878
63875
  ] })
@@ -93646,6 +93643,7 @@ export {
93646
93643
  MultiSelect,
93647
93644
  Navbar,
93648
93645
  OpportunitiesTable,
93646
+ OrdersCard,
93649
93647
  PageHeader,
93650
93648
  PartnerCard,
93651
93649
  PartnerRelationshipPage,
@@ -1145,7 +1145,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An err
1145
1145
  - less than the value passed to \`max\` (or ${DEFAULT_MAX} if no \`max\` prop is set)
1146
1146
  - \`null\` or \`undefined\` if the progress is indeterminate.
1147
1147
 
1148
- Defaulting to \`null\`.`}var Root$1=Progress$1,Indicator=ProgressIndicator;const Progress=React__namespace.forwardRef(({className:t,value:e,...n},o)=>jsxRuntime.jsx(Root$1,{ref:o,className:cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:jsxRuntime.jsx(Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Progress.displayName=Root$1.displayName;function ManufacturerInventoryFinanceCard({manufacturer:t,isLoading:e}){const{data:n,isLoading:o,isFetching:l}=useGetV4ManufacturerByRouteManufacturerIdInventoryValueQuery({routeManufacturerId:(t==null?void 0:t.ManufacturerId)??""},{skip:!(t!=null&&t.ManufacturerId)}),d=(t==null?void 0:t.DefaultMaxInventoryValue)??0,f=(n||[]).reduce((S,_)=>S+(_.InventoryValue||0),0),g=d-f,b=Math.round(f/d*100);return e||o||l?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/2 mt-2"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-2 w-full"})]})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(DollarSign,{className:"h-5 w-5 text-muted-foreground"}),"Inventory Finance"]}),jsxRuntime.jsx(CardDescription,{children:"Current inventory financial status"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[d!==0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Max Allowance"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(d)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Current value"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(f)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Available"}),jsxRuntime.jsx("span",{className:`font-bold ${g>=0?"text-emerald-600 dark:text-emerald-500":"text-red-600 dark:text-red-500"}`,children:formatMoney(g)})]})]}),d!==0&&jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Budget Usage"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[b,"%"]}),b>80&&jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4 text-amber-500"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:b>80?"High usage alert":"Budget usage"})})]})})]}),jsxRuntime.jsx(Progress,{value:b,className:"h-2"})]})]})]})}function ManufacturerCreditFinanceCard({manufacturer:t,isLoading:e}){const n=(t==null?void 0:t.CreditLimit)??0,o=(t==null?void 0:t.OutstandingBalance)??0,l=n-o,d=Math.round(o/n*100);return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/2 mt-2"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-2 w-full"})]})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(CreditCard,{className:"h-5 w-5 text-muted-foreground"}),"Credit Finance"]}),jsxRuntime.jsx(CardDescription,{children:"Current credit financial status"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Credit Limit"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(n)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Outstanding Balance"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(o)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Available Credit"}),jsxRuntime.jsx("span",{className:`font-bold ${l>=0?"text-emerald-600 dark:text-emerald-500":"text-red-600 dark:text-red-500"}`,children:formatMoney(l)})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Credit Usage"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[d,"%"]}),d>80&&jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4 text-amber-500"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:d>80?"High credit usage alert":"Credit usage"})})]})})]}),jsxRuntime.jsx(Progress,{value:d,className:"h-2"})]})]})]})}function SalesChartCard({statistics:t,loading:e=!1,mode:n="month",chartHeight:o=300,className:l,size:d="default"}){return e?jsxRuntime.jsxs(Card,{className:cn("w-full",l),children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-48 rounded-md"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{style:{height:o},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}),d==="default"&&n==="month"&&jsxRuntime.jsxs("div",{className:"mt-4 flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40 rounded-md"})]})]})]}):jsxRuntime.jsxs(Card,{className:cn("w-full",l),children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:n==="week"?"Weekly Sales Performance":"Monthly Sales Performance"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(SalesChart,{statistics:t,mode:n,chartHeight:o,size:d})})]})}function ManufacturerOverviewPage({applicationId:t,readonly:e,withReports:n,manufacturer:o,userEmail:l}){const{data:d,isLoading:f,isError:g}=useGetV4PartnerByApplicationIdAccountManufacturerQuery({applicationId:t,withSpecification:!0},{skip:!!o}),[b,S]=React.useState({publicInfo:{hasUnsavedChanges:!1},qualifications:{hasUnsavedChanges:!1},billingInfo:{hasUnsavedChanges:!1}}),_=React.useCallback(()=>e?!1:b.publicInfo.hasUnsavedChanges||b.qualifications.hasUnsavedChanges||b.billingInfo.hasUnsavedChanges,[e,b]),R=React.useCallback((A,M)=>{S(I=>{var j;return((j=I[A])==null?void 0:j.hasUnsavedChanges)!==M.hasUnsavedChanges?(console.log(`Updating form state for ${A}:`,M.hasUnsavedChanges),{...I,[A]:M}):I})},[]),{NavigationGuardDialog:C}=useRouterNavigationGuard(_),E=o??d;return jsxRuntime.jsxs("div",{className:"@container",children:[g?jsxRuntime.jsx(Card,{className:"p-6",children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"There was an error loading your manufacturer information. Please try again later."})]})}):jsxRuntime.jsxs("div",{className:"space-y-6 mb-6",children:[jsxRuntime.jsx(SalesSummary,{fiscalYearMonthStart:E==null?void 0:E.FiscalYearMonthStart,salesData:E==null?void 0:E.SalesData,isLoading:f}),jsxRuntime.jsxs("div",{className:"grid @2xl:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChartCard,{statistics:(E==null?void 0:E.SalesStatistics)??[],loading:f}),jsxRuntime.jsx(ManufacturerResellerOrdersSection,{manufacturerId:(E==null?void 0:E.ManufacturerId)??"",activeOrders:(E==null?void 0:E.ActiveOrderDetails)??void 0,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerInventoryFinanceCard,{manufacturer:E,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerCreditFinanceCard,{manufacturer:E,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerReorderingCard,{manufacturer:E??{},onSave:()=>{},loading:f,readonly:e}),n&&jsxRuntime.jsx(ManufacturerPublicInfoSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("publicInfo",{hasUnsavedChanges:A})}),n&&jsxRuntime.jsx(OpenToWorkSection,{manufacturer:E,readonly:e,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerBillingInfoSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("billingInfo",{hasUnsavedChanges:A})}),n&&jsxRuntime.jsx(ManufacturerQualificationsSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("qualifications",{hasUnsavedChanges:A})})]}),n&&jsxRuntime.jsx(ManufacturerReportsSection,{manufacturerId:(E==null?void 0:E.ManufacturerId)??"",userEmail:l,isLoading:f})]}),jsxRuntime.jsx(C,{})]})}function ManufacturerCategories({categories:t,activeCategory:e,onSelectCategory:n}){return jsxRuntime.jsx("div",{className:"grid",children:jsxRuntime.jsx("div",{className:"flex overflow-x-auto small-scrollbar pb-4",children:jsxRuntime.jsx("div",{className:"flex gap-2",children:t.map(o=>jsxRuntime.jsxs(Button,{onClick:()=>n(o.CategoryCode??""),variant:e===o.CategoryCode?"default":"outline",size:"sm",className:"px-3 py-1.5 text-xs whitespace-nowrap rounded-full",children:[o.CategoryName??"Undefined",o.QualificationRequired&&jsxRuntime.jsx(ShieldCheck,{className:`ml-1 w-5 h-5 ${e!==o.CategoryCode?"text-red-500":""}`})]},o.CategoryCode))})})})}function CategoryStats(t){const{data:e,isLoading:n,isFetching:o}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t.appID,manufacturerId:t.manufID,categoryCode:t.categoryCode});return jsxRuntime.jsx(Card,{className:"w-full",children:jsxRuntime.jsx(CardContent,{className:"p-4 space-y-1",children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:t.categoryName}),jsxRuntime.jsx(SalesChart,{statistics:(e==null?void 0:e.SalesStatistics)??[],loading:n||o,chartHeight:300})]})})})}function ManufacturerCategoriesStats(t){return(t.categories??[]).filter(n=>n.CategoryName).map(n=>jsxRuntime.jsx(CategoryStats,{appID:t.appID,manufID:t.manufID,categoryCode:n.CategoryCode,categoryName:n.CategoryName},`${t.manufID}-${n.CategoryCode}`))}const badgeVariants=cva("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground border border-input hover:bg-accent hover:text-accent-foreground",success:"bg-green-600 text-white hover:bg-green-700",warning:"bg-yellow-500 text-white hover:bg-yellow-600",info:"bg-blue-500 text-white hover:bg-blue-600",ghost:"bg-background hover:bg-accent hover:text-accent-foreground",randmarRed:"bg-randmar-red text-white hover:bg-randmar-red/80",randmarBlue:"bg-randmar-blue text-white hover:bg-randmar-blue/80",randmarPurple:"bg-randmar-purple text-white hover:bg-randmar-purple/80",randmarGreen:"bg-randmar-green text-black hover:bg-randmar-green/80",randmarBlack:"bg-randmar-black text-white hover:bg-randmar-black/80",randmarYellow:"bg-randmar-yellow text-black hover:bg-randmar-yellow/80"},size:{default:"h-6",sm:"h-5 text-[10px]",lg:"h-7 px-3"}},defaultVariants:{variant:"default",size:"default"}}),Badge=React__namespace.forwardRef(({className:t,variant:e,size:n,icon:o,children:l,...d},f)=>jsxRuntime.jsxs("div",{ref:f,className:cn(badgeVariants({variant:e,size:n}),t),...d,children:[o&&jsxRuntime.jsx("span",{className:"mr-1",children:o}),l]}));Badge.displayName="Badge";function ManufacturerCategorySummary({name:t="N/A",niche:e="N/A",productsNumber:n=0,autoreorder:o=!1,starred:l=!1,isLoading:d=!1,children:f}){return d?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-4",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between",children:[jsxRuntime.jsx("div",{className:"space-y-1 flex-1",children:jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-28 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-5 w-48 bg-muted rounded-md animate-pulse"})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-12 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-5 w-5 bg-muted rounded-md animate-pulse"})]})]})}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-8 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-4 w-32 bg-muted rounded-md animate-pulse"})]}),jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-16 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-4 w-4 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-4 w-6 bg-muted rounded-md animate-pulse"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-1 flex-1 flex flex-col items-end",children:[jsxRuntime.jsx("div",{className:"h-3 w-20 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-4 w-4 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-6 w-16 bg-muted rounded-md animate-pulse"})]})]})]})]})]}):jsxRuntime.jsx(Card,{children:jsxRuntime.jsxs(CardContent,{className:"grid grid-cols-[1fr_auto] items-start gap-4 pt-6",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-start gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Category Name"}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold leading-none tracking-tight",children:t})]}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Niche"}),jsxRuntime.jsx("p",{className:"text-sm font-medium",children:e})]}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Products"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Package,{className:"h-4 w-4 text-muted-foreground"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:n})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end justify-between gap-4 h-full",children:[f,jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Starred"}),l?jsxRuntime.jsx(Star,{className:"h-5 w-5 fill-yellow-400 text-yellow-400"}):jsxRuntime.jsx(Star,{className:"h-5 w-5 text-muted-foreground"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 flex flex-col items-end",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Auto-reorder"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[o?jsxRuntime.jsx(RefreshCw,{className:"size-4 text-green-600"}):jsxRuntime.jsx(RefreshCwOff,{className:"size-4 text-amber-600"}),jsxRuntime.jsx(Badge,{variant:o?"default":"secondary",className:cn("text-xs",o?"text-green-600 bg-green-100 hover:bg-green-200":"text-amber-600 bg-amber-100 hover:bg-amber-200"),children:o?"Enabled":"Disabled"})]})]})]})]})})}var OPEN_KEYS=[" ","Enter","ArrowUp","ArrowDown"],SELECTION_KEYS=[" ","Enter"],SELECT_NAME="Select",[Collection$1,useCollection$1,createCollectionScope$1]=createCollection(SELECT_NAME),[createSelectContext,createSelectScope]=createContextScope(SELECT_NAME,[createCollectionScope$1,createPopperScope]),usePopperScope$1=createPopperScope(),[SelectProvider,useSelectContext]=createSelectContext(SELECT_NAME),[SelectNativeOptionsProvider,useSelectNativeOptionsContext]=createSelectContext(SELECT_NAME),Select$1=t=>{const{__scopeSelect:e,children:n,open:o,defaultOpen:l,onOpenChange:d,value:f,defaultValue:g,onValueChange:b,dir:S,name:_,autoComplete:R,disabled:C,required:E,form:A}=t,M=usePopperScope$1(e),[I,j]=React__namespace.useState(null),[q,z]=React__namespace.useState(null),[Q,F]=React__namespace.useState(!1),O=useDirection(S),[te,ne]=useControllableState({prop:o,defaultProp:l??!1,onChange:d,caller:SELECT_NAME}),[ae,ge]=useControllableState({prop:f,defaultProp:g,onChange:b,caller:SELECT_NAME}),oe=React__namespace.useRef(null),Ae=I?A||!!I.closest("form"):!0,[je,Ne]=React__namespace.useState(new Set),Ve=Array.from(je).map(Le=>Le.props.value).join(";");return jsxRuntime.jsx(Root2$7,{...M,children:jsxRuntime.jsxs(SelectProvider,{required:E,scope:e,trigger:I,onTriggerChange:j,valueNode:q,onValueNodeChange:z,valueNodeHasChildren:Q,onValueNodeHasChildrenChange:F,contentId:useId(),value:ae,onValueChange:ge,open:te,onOpenChange:ne,dir:O,triggerPointerDownPosRef:oe,disabled:C,children:[jsxRuntime.jsx(Collection$1.Provider,{scope:e,children:jsxRuntime.jsx(SelectNativeOptionsProvider,{scope:t.__scopeSelect,onNativeOptionAdd:React__namespace.useCallback(Le=>{Ne(ze=>new Set(ze).add(Le))},[]),onNativeOptionRemove:React__namespace.useCallback(Le=>{Ne(ze=>{const $e=new Set(ze);return $e.delete(Le),$e})},[]),children:n})}),Ae?jsxRuntime.jsxs(SelectBubbleInput,{"aria-hidden":!0,required:E,tabIndex:-1,name:_,autoComplete:R,value:ae,onChange:Le=>ge(Le.target.value),disabled:C,form:A,children:[ae===void 0?jsxRuntime.jsx("option",{value:""}):null,Array.from(je)]},Ve):null]})})};Select$1.displayName=SELECT_NAME;var TRIGGER_NAME$5="SelectTrigger",SelectTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:o=!1,...l}=t,d=usePopperScope$1(n),f=useSelectContext(TRIGGER_NAME$5,n),g=f.disabled||o,b=useComposedRefs(e,f.onTriggerChange),S=useCollection$1(n),_=React__namespace.useRef("touch"),[R,C,E]=useTypeaheadSearch(M=>{const I=S().filter(z=>!z.disabled),j=I.find(z=>z.value===f.value),q=findNextItem(I,M,j);q!==void 0&&f.onValueChange(q.value)}),A=M=>{g||(f.onOpenChange(!0),E()),M&&(f.triggerPointerDownPosRef.current={x:Math.round(M.pageX),y:Math.round(M.pageY)})};return jsxRuntime.jsx(Anchor,{asChild:!0,...d,children:jsxRuntime.jsx(Primitive.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:g,"data-disabled":g?"":void 0,"data-placeholder":shouldShowPlaceholder(f.value)?"":void 0,...l,ref:b,onClick:composeEventHandlers(l.onClick,M=>{M.currentTarget.focus(),_.current!=="mouse"&&A(M)}),onPointerDown:composeEventHandlers(l.onPointerDown,M=>{_.current=M.pointerType;const I=M.target;I.hasPointerCapture(M.pointerId)&&I.releasePointerCapture(M.pointerId),M.button===0&&M.ctrlKey===!1&&M.pointerType==="mouse"&&(A(M),M.preventDefault())}),onKeyDown:composeEventHandlers(l.onKeyDown,M=>{const I=R.current!=="";!(M.ctrlKey||M.altKey||M.metaKey)&&M.key.length===1&&C(M.key),!(I&&M.key===" ")&&OPEN_KEYS.includes(M.key)&&(A(),M.preventDefault())})})})});SelectTrigger$1.displayName=TRIGGER_NAME$5;var VALUE_NAME="SelectValue",SelectValue$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,className:o,style:l,children:d,placeholder:f="",...g}=t,b=useSelectContext(VALUE_NAME,n),{onValueNodeHasChildrenChange:S}=b,_=d!==void 0,R=useComposedRefs(e,b.onValueNodeChange);return useLayoutEffect2(()=>{S(_)},[S,_]),jsxRuntime.jsx(Primitive.span,{...g,ref:R,style:{pointerEvents:"none"},children:shouldShowPlaceholder(b.value)?jsxRuntime.jsx(jsxRuntime.Fragment,{children:f}):d})});SelectValue$1.displayName=VALUE_NAME;var ICON_NAME="SelectIcon",SelectIcon=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,children:o,...l}=t;return jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...l,ref:e,children:o||"▼"})});SelectIcon.displayName=ICON_NAME;var PORTAL_NAME$2="SelectPortal",SelectPortal=t=>jsxRuntime.jsx(Portal$5,{asChild:!0,...t});SelectPortal.displayName=PORTAL_NAME$2;var CONTENT_NAME$4="SelectContent",SelectContent$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContext(CONTENT_NAME$4,t.__scopeSelect),[o,l]=React__namespace.useState();if(useLayoutEffect2(()=>{l(new DocumentFragment)},[]),!n.open){const d=o;return d?ReactDOM__namespace.createPortal(jsxRuntime.jsx(SelectContentProvider,{scope:t.__scopeSelect,children:jsxRuntime.jsx(Collection$1.Slot,{scope:t.__scopeSelect,children:jsxRuntime.jsx("div",{children:t.children})})}),d):null}return jsxRuntime.jsx(SelectContentImpl,{...t,ref:e})});SelectContent$1.displayName=CONTENT_NAME$4;var CONTENT_MARGIN=10,[SelectContentProvider,useSelectContentContext]=createSelectContext(CONTENT_NAME$4),CONTENT_IMPL_NAME="SelectContentImpl",Slot$1=createSlot("SelectContent.RemoveScroll"),SelectContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:d,onPointerDownOutside:f,side:g,sideOffset:b,align:S,alignOffset:_,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:A,hideWhenDetached:M,avoidCollisions:I,...j}=t,q=useSelectContext(CONTENT_NAME$4,n),[z,Q]=React__namespace.useState(null),[F,O]=React__namespace.useState(null),te=useComposedRefs(e,Xe=>Q(Xe)),[ne,ae]=React__namespace.useState(null),[ge,oe]=React__namespace.useState(null),Ae=useCollection$1(n),[je,Ne]=React__namespace.useState(!1),Ve=React__namespace.useRef(!1);React__namespace.useEffect(()=>{if(z)return hideOthers(z)},[z]),useFocusGuards();const Le=React__namespace.useCallback(Xe=>{const[it,...et]=Ae().map(Ue=>Ue.ref.current),[at]=et.slice(-1),ot=document.activeElement;for(const Ue of Xe)if(Ue===ot||(Ue==null||Ue.scrollIntoView({block:"nearest"}),Ue===it&&F&&(F.scrollTop=0),Ue===at&&F&&(F.scrollTop=F.scrollHeight),Ue==null||Ue.focus(),document.activeElement!==ot))return},[Ae,F]),ze=React__namespace.useCallback(()=>Le([ne,z]),[Le,ne,z]);React__namespace.useEffect(()=>{je&&ze()},[je,ze]);const{onOpenChange:$e,triggerPointerDownPosRef:Oe}=q;React__namespace.useEffect(()=>{if(z){let Xe={x:0,y:0};const it=at=>{var ot,Ue;Xe={x:Math.abs(Math.round(at.pageX)-(((ot=Oe.current)==null?void 0:ot.x)??0)),y:Math.abs(Math.round(at.pageY)-(((Ue=Oe.current)==null?void 0:Ue.y)??0))}},et=at=>{Xe.x<=10&&Xe.y<=10?at.preventDefault():z.contains(at.target)||$e(!1),document.removeEventListener("pointermove",it),Oe.current=null};return Oe.current!==null&&(document.addEventListener("pointermove",it),document.addEventListener("pointerup",et,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",it),document.removeEventListener("pointerup",et,{capture:!0})}}},[z,$e,Oe]),React__namespace.useEffect(()=>{const Xe=()=>$e(!1);return window.addEventListener("blur",Xe),window.addEventListener("resize",Xe),()=>{window.removeEventListener("blur",Xe),window.removeEventListener("resize",Xe)}},[$e]);const[qe,Ge]=useTypeaheadSearch(Xe=>{const it=Ae().filter(ot=>!ot.disabled),et=it.find(ot=>ot.ref.current===document.activeElement),at=findNextItem(it,Xe,et);at&&setTimeout(()=>at.ref.current.focus())}),He=React__namespace.useCallback((Xe,it,et)=>{const at=!Ve.current&&!et;(q.value!==void 0&&q.value===it||at)&&(ae(Xe),at&&(Ve.current=!0))},[q.value]),Je=React__namespace.useCallback(()=>z==null?void 0:z.focus(),[z]),Ze=React__namespace.useCallback((Xe,it,et)=>{const at=!Ve.current&&!et;(q.value!==void 0&&q.value===it||at)&&oe(Xe)},[q.value]),We=o==="popper"?SelectPopperPosition:SelectItemAlignedPosition,tt=We===SelectPopperPosition?{side:g,sideOffset:b,align:S,alignOffset:_,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:A,hideWhenDetached:M,avoidCollisions:I}:{};return jsxRuntime.jsx(SelectContentProvider,{scope:n,content:z,viewport:F,onViewportChange:O,itemRefCallback:He,selectedItem:ne,onItemLeave:Je,itemTextRefCallback:Ze,focusSelectedItem:ze,selectedItemText:ge,position:o,isPositioned:je,searchRef:qe,children:jsxRuntime.jsx(ReactRemoveScroll,{as:Slot$1,allowPinchZoom:!0,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:q.open,onMountAutoFocus:Xe=>{Xe.preventDefault()},onUnmountAutoFocus:composeEventHandlers(l,Xe=>{var it;(it=q.trigger)==null||it.focus({preventScroll:!0}),Xe.preventDefault()}),children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:Xe=>Xe.preventDefault(),onDismiss:()=>q.onOpenChange(!1),children:jsxRuntime.jsx(We,{role:"listbox",id:q.contentId,"data-state":q.open?"open":"closed",dir:q.dir,onContextMenu:Xe=>Xe.preventDefault(),...j,...tt,onPlaced:()=>Ne(!0),ref:te,style:{display:"flex",flexDirection:"column",outline:"none",...j.style},onKeyDown:composeEventHandlers(j.onKeyDown,Xe=>{const it=Xe.ctrlKey||Xe.altKey||Xe.metaKey;if(Xe.key==="Tab"&&Xe.preventDefault(),!it&&Xe.key.length===1&&Ge(Xe.key),["ArrowUp","ArrowDown","Home","End"].includes(Xe.key)){let at=Ae().filter(ot=>!ot.disabled).map(ot=>ot.ref.current);if(["ArrowUp","End"].includes(Xe.key)&&(at=at.slice().reverse()),["ArrowUp","ArrowDown"].includes(Xe.key)){const ot=Xe.target,Ue=at.indexOf(ot);at=at.slice(Ue+1)}setTimeout(()=>Le(at)),Xe.preventDefault()}})})})})})})});SelectContentImpl.displayName=CONTENT_IMPL_NAME;var ITEM_ALIGNED_POSITION_NAME="SelectItemAlignedPosition",SelectItemAlignedPosition=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:o,...l}=t,d=useSelectContext(CONTENT_NAME$4,n),f=useSelectContentContext(CONTENT_NAME$4,n),[g,b]=React__namespace.useState(null),[S,_]=React__namespace.useState(null),R=useComposedRefs(e,te=>_(te)),C=useCollection$1(n),E=React__namespace.useRef(!1),A=React__namespace.useRef(!0),{viewport:M,selectedItem:I,selectedItemText:j,focusSelectedItem:q}=f,z=React__namespace.useCallback(()=>{if(d.trigger&&d.valueNode&&g&&S&&M&&I&&j){const te=d.trigger.getBoundingClientRect(),ne=S.getBoundingClientRect(),ae=d.valueNode.getBoundingClientRect(),ge=j.getBoundingClientRect();if(d.dir!=="rtl"){const ot=ge.left-ne.left,Ue=ae.left-ot,mt=te.left-Ue,Qe=te.width+mt,Rt=Math.max(Qe,ne.width),$t=window.innerWidth-CONTENT_MARGIN,Ft=clamp(Ue,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,$t-Rt)]);g.style.minWidth=Qe+"px",g.style.left=Ft+"px"}else{const ot=ne.right-ge.right,Ue=window.innerWidth-ae.right-ot,mt=window.innerWidth-te.right-Ue,Qe=te.width+mt,Rt=Math.max(Qe,ne.width),$t=window.innerWidth-CONTENT_MARGIN,Ft=clamp(Ue,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,$t-Rt)]);g.style.minWidth=Qe+"px",g.style.right=Ft+"px"}const oe=C(),Ae=window.innerHeight-CONTENT_MARGIN*2,je=M.scrollHeight,Ne=window.getComputedStyle(S),Ve=parseInt(Ne.borderTopWidth,10),Le=parseInt(Ne.paddingTop,10),ze=parseInt(Ne.borderBottomWidth,10),$e=parseInt(Ne.paddingBottom,10),Oe=Ve+Le+je+$e+ze,qe=Math.min(I.offsetHeight*5,Oe),Ge=window.getComputedStyle(M),He=parseInt(Ge.paddingTop,10),Je=parseInt(Ge.paddingBottom,10),Ze=te.top+te.height/2-CONTENT_MARGIN,We=Ae-Ze,tt=I.offsetHeight/2,Xe=I.offsetTop+tt,it=Ve+Le+Xe,et=Oe-it;if(it<=Ze){const ot=oe.length>0&&I===oe[oe.length-1].ref.current;g.style.bottom="0px";const Ue=S.clientHeight-M.offsetTop-M.offsetHeight,mt=Math.max(We,tt+(ot?Je:0)+Ue+ze),Qe=it+mt;g.style.height=Qe+"px"}else{const ot=oe.length>0&&I===oe[0].ref.current;g.style.top="0px";const mt=Math.max(Ze,Ve+M.offsetTop+(ot?He:0)+tt)+et;g.style.height=mt+"px",M.scrollTop=it-Ze+M.offsetTop}g.style.margin=`${CONTENT_MARGIN}px 0`,g.style.minHeight=qe+"px",g.style.maxHeight=Ae+"px",o==null||o(),requestAnimationFrame(()=>E.current=!0)}},[C,d.trigger,d.valueNode,g,S,M,I,j,d.dir,o]);useLayoutEffect2(()=>z(),[z]);const[Q,F]=React__namespace.useState();useLayoutEffect2(()=>{S&&F(window.getComputedStyle(S).zIndex)},[S]);const O=React__namespace.useCallback(te=>{te&&A.current===!0&&(z(),q==null||q(),A.current=!1)},[z,q]);return jsxRuntime.jsx(SelectViewportProvider,{scope:n,contentWrapper:g,shouldExpandOnScrollRef:E,onScrollButtonChange:O,children:jsxRuntime.jsx("div",{ref:b,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:Q},children:jsxRuntime.jsx(Primitive.div,{...l,ref:R,style:{boxSizing:"border-box",maxHeight:"100%",...l.style}})})})});SelectItemAlignedPosition.displayName=ITEM_ALIGNED_POSITION_NAME;var POPPER_POSITION_NAME="SelectPopperPosition",SelectPopperPosition=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,align:o="start",collisionPadding:l=CONTENT_MARGIN,...d}=t,f=usePopperScope$1(n);return jsxRuntime.jsx(Content$2,{...f,...d,ref:e,align:o,collisionPadding:l,style:{boxSizing:"border-box",...d.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});SelectPopperPosition.displayName=POPPER_POSITION_NAME;var[SelectViewportProvider,useSelectViewportContext]=createSelectContext(CONTENT_NAME$4,{}),VIEWPORT_NAME="SelectViewport",SelectViewport=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:o,...l}=t,d=useSelectContentContext(VIEWPORT_NAME,n),f=useSelectViewportContext(VIEWPORT_NAME,n),g=useComposedRefs(e,d.onViewportChange),b=React__namespace.useRef(0);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),jsxRuntime.jsx(Collection$1.Slot,{scope:n,children:jsxRuntime.jsx(Primitive.div,{"data-radix-select-viewport":"",role:"presentation",...l,ref:g,style:{position:"relative",flex:1,overflow:"hidden auto",...l.style},onScroll:composeEventHandlers(l.onScroll,S=>{const _=S.currentTarget,{contentWrapper:R,shouldExpandOnScrollRef:C}=f;if(C!=null&&C.current&&R){const E=Math.abs(b.current-_.scrollTop);if(E>0){const A=window.innerHeight-CONTENT_MARGIN*2,M=parseFloat(R.style.minHeight),I=parseFloat(R.style.height),j=Math.max(M,I);if(j<A){const q=j+E,z=Math.min(A,q),Q=q-z;R.style.height=z+"px",R.style.bottom==="0px"&&(_.scrollTop=Q>0?Q:0,R.style.justifyContent="flex-end")}}}b.current=_.scrollTop})})})]})});SelectViewport.displayName=VIEWPORT_NAME;var GROUP_NAME="SelectGroup",[SelectGroupContextProvider,useSelectGroupContext]=createSelectContext(GROUP_NAME),SelectGroup$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=useId();return jsxRuntime.jsx(SelectGroupContextProvider,{scope:n,id:l,children:jsxRuntime.jsx(Primitive.div,{role:"group","aria-labelledby":l,...o,ref:e})})});SelectGroup$1.displayName=GROUP_NAME;var LABEL_NAME="SelectLabel",SelectLabel$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=useSelectGroupContext(LABEL_NAME,n);return jsxRuntime.jsx(Primitive.div,{id:l.id,...o,ref:e})});SelectLabel$1.displayName=LABEL_NAME;var ITEM_NAME$1="SelectItem",[SelectItemContextProvider,useSelectItemContext]=createSelectContext(ITEM_NAME$1),SelectItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,value:o,disabled:l=!1,textValue:d,...f}=t,g=useSelectContext(ITEM_NAME$1,n),b=useSelectContentContext(ITEM_NAME$1,n),S=g.value===o,[_,R]=React__namespace.useState(d??""),[C,E]=React__namespace.useState(!1),A=useComposedRefs(e,q=>{var z;return(z=b.itemRefCallback)==null?void 0:z.call(b,q,o,l)}),M=useId(),I=React__namespace.useRef("touch"),j=()=>{l||(g.onValueChange(o),g.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return jsxRuntime.jsx(SelectItemContextProvider,{scope:n,value:o,disabled:l,textId:M,isSelected:S,onItemTextChange:React__namespace.useCallback(q=>{R(z=>z||((q==null?void 0:q.textContent)??"").trim())},[]),children:jsxRuntime.jsx(Collection$1.ItemSlot,{scope:n,value:o,disabled:l,textValue:_,children:jsxRuntime.jsx(Primitive.div,{role:"option","aria-labelledby":M,"data-highlighted":C?"":void 0,"aria-selected":S&&C,"data-state":S?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1,...f,ref:A,onFocus:composeEventHandlers(f.onFocus,()=>E(!0)),onBlur:composeEventHandlers(f.onBlur,()=>E(!1)),onClick:composeEventHandlers(f.onClick,()=>{I.current!=="mouse"&&j()}),onPointerUp:composeEventHandlers(f.onPointerUp,()=>{I.current==="mouse"&&j()}),onPointerDown:composeEventHandlers(f.onPointerDown,q=>{I.current=q.pointerType}),onPointerMove:composeEventHandlers(f.onPointerMove,q=>{var z;I.current=q.pointerType,l?(z=b.onItemLeave)==null||z.call(b):I.current==="mouse"&&q.currentTarget.focus({preventScroll:!0})}),onPointerLeave:composeEventHandlers(f.onPointerLeave,q=>{var z;q.currentTarget===document.activeElement&&((z=b.onItemLeave)==null||z.call(b))}),onKeyDown:composeEventHandlers(f.onKeyDown,q=>{var Q;((Q=b.searchRef)==null?void 0:Q.current)!==""&&q.key===" "||(SELECTION_KEYS.includes(q.key)&&j(),q.key===" "&&q.preventDefault())})})})})});SelectItem$1.displayName=ITEM_NAME$1;var ITEM_TEXT_NAME="SelectItemText",SelectItemText=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,className:o,style:l,...d}=t,f=useSelectContext(ITEM_TEXT_NAME,n),g=useSelectContentContext(ITEM_TEXT_NAME,n),b=useSelectItemContext(ITEM_TEXT_NAME,n),S=useSelectNativeOptionsContext(ITEM_TEXT_NAME,n),[_,R]=React__namespace.useState(null),C=useComposedRefs(e,j=>R(j),b.onItemTextChange,j=>{var q;return(q=g.itemTextRefCallback)==null?void 0:q.call(g,j,b.value,b.disabled)}),E=_==null?void 0:_.textContent,A=React__namespace.useMemo(()=>jsxRuntime.jsx("option",{value:b.value,disabled:b.disabled,children:E},b.value),[b.disabled,b.value,E]),{onNativeOptionAdd:M,onNativeOptionRemove:I}=S;return useLayoutEffect2(()=>(M(A),()=>I(A)),[M,I,A]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Primitive.span,{id:b.textId,...d,ref:C}),b.isSelected&&f.valueNode&&!f.valueNodeHasChildren?ReactDOM__namespace.createPortal(d.children,f.valueNode):null]})});SelectItemText.displayName=ITEM_TEXT_NAME;var ITEM_INDICATOR_NAME="SelectItemIndicator",SelectItemIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t;return useSelectItemContext(ITEM_INDICATOR_NAME,n).isSelected?jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...o,ref:e}):null});SelectItemIndicator.displayName=ITEM_INDICATOR_NAME;var SCROLL_UP_BUTTON_NAME="SelectScrollUpButton",SelectScrollUpButton$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContentContext(SCROLL_UP_BUTTON_NAME,t.__scopeSelect),o=useSelectViewportContext(SCROLL_UP_BUTTON_NAME,t.__scopeSelect),[l,d]=React__namespace.useState(!1),f=useComposedRefs(e,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let g=function(){const S=b.scrollTop>0;d(S)};const b=n.viewport;return g(),b.addEventListener("scroll",g),()=>b.removeEventListener("scroll",g)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...t,ref:f,onAutoScroll:()=>{const{viewport:g,selectedItem:b}=n;g&&b&&(g.scrollTop=g.scrollTop-b.offsetHeight)}}):null});SelectScrollUpButton$1.displayName=SCROLL_UP_BUTTON_NAME;var SCROLL_DOWN_BUTTON_NAME="SelectScrollDownButton",SelectScrollDownButton$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContentContext(SCROLL_DOWN_BUTTON_NAME,t.__scopeSelect),o=useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME,t.__scopeSelect),[l,d]=React__namespace.useState(!1),f=useComposedRefs(e,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let g=function(){const S=b.scrollHeight-b.clientHeight,_=Math.ceil(b.scrollTop)<S;d(_)};const b=n.viewport;return g(),b.addEventListener("scroll",g),()=>b.removeEventListener("scroll",g)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...t,ref:f,onAutoScroll:()=>{const{viewport:g,selectedItem:b}=n;g&&b&&(g.scrollTop=g.scrollTop+b.offsetHeight)}}):null});SelectScrollDownButton$1.displayName=SCROLL_DOWN_BUTTON_NAME;var SelectScrollButtonImpl=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:o,...l}=t,d=useSelectContentContext("SelectScrollButton",n),f=React__namespace.useRef(null),g=useCollection$1(n),b=React__namespace.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return React__namespace.useEffect(()=>()=>b(),[b]),useLayoutEffect2(()=>{var _;const S=g().find(R=>R.ref.current===document.activeElement);(_=S==null?void 0:S.ref.current)==null||_.scrollIntoView({block:"nearest"})},[g]),jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...l,ref:e,style:{flexShrink:0,...l.style},onPointerDown:composeEventHandlers(l.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(o,50))}),onPointerMove:composeEventHandlers(l.onPointerMove,()=>{var S;(S=d.onItemLeave)==null||S.call(d),f.current===null&&(f.current=window.setInterval(o,50))}),onPointerLeave:composeEventHandlers(l.onPointerLeave,()=>{b()})})}),SEPARATOR_NAME="SelectSeparator",SelectSeparator$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t;return jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...o,ref:e})});SelectSeparator$1.displayName=SEPARATOR_NAME;var ARROW_NAME$1="SelectArrow",SelectArrow=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=usePopperScope$1(n),d=useSelectContext(ARROW_NAME$1,n),f=useSelectContentContext(ARROW_NAME$1,n);return d.open&&f.position==="popper"?jsxRuntime.jsx(Arrow,{...l,...o,ref:e}):null});SelectArrow.displayName=ARROW_NAME$1;var BUBBLE_INPUT_NAME$1="SelectBubbleInput",SelectBubbleInput=React__namespace.forwardRef(({__scopeSelect:t,value:e,...n},o)=>{const l=React__namespace.useRef(null),d=useComposedRefs(o,l),f=usePrevious(e);return React__namespace.useEffect(()=>{const g=l.current;if(!g)return;const b=window.HTMLSelectElement.prototype,_=Object.getOwnPropertyDescriptor(b,"value").set;if(f!==e&&_){const R=new Event("change",{bubbles:!0});_.call(g,e),g.dispatchEvent(R)}},[f,e]),jsxRuntime.jsx(Primitive.select,{...n,style:{...VISUALLY_HIDDEN_STYLES,...n.style},ref:d,defaultValue:e})});SelectBubbleInput.displayName=BUBBLE_INPUT_NAME$1;function shouldShowPlaceholder(t){return t===""||t===void 0}function useTypeaheadSearch(t){const e=useCallbackRef$1(t),n=React__namespace.useRef(""),o=React__namespace.useRef(0),l=React__namespace.useCallback(f=>{const g=n.current+f;e(g),function b(S){n.current=S,window.clearTimeout(o.current),S!==""&&(o.current=window.setTimeout(()=>b(""),1e3))}(g)},[e]),d=React__namespace.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return React__namespace.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,l,d]}function findNextItem(t,e,n){const l=e.length>1&&Array.from(e).every(S=>S===e[0])?e[0]:e,d=n?t.indexOf(n):-1;let f=wrapArray(t,Math.max(d,0));l.length===1&&(f=f.filter(S=>S!==n));const b=f.find(S=>S.textValue.toLowerCase().startsWith(l.toLowerCase()));return b!==n?b:void 0}function wrapArray(t,e){return t.map((n,o)=>t[(e+o)%t.length])}var Root2$3=Select$1,Trigger$2=SelectTrigger$1,Value=SelectValue$1,Icon=SelectIcon,Portal$1=SelectPortal,Content2$3=SelectContent$1,Viewport=SelectViewport,Group=SelectGroup$1,Label=SelectLabel$1,Item$2=SelectItem$1,ItemText=SelectItemText,ItemIndicator=SelectItemIndicator,ScrollUpButton=SelectScrollUpButton$1,ScrollDownButton=SelectScrollDownButton$1,Separator=SelectSeparator$1;const Select=Root2$3,SelectGroup=Group,SelectValue=Value,SelectTrigger=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsxs(Trigger$2,{ref:o,className:cn("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,jsxRuntime.jsx(Icon,{asChild:!0,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));SelectTrigger.displayName=Trigger$2.displayName;const SelectScrollUpButton=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(ScrollUpButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",t),...e,children:jsxRuntime.jsx(ChevronUp,{className:"h-4 w-4"})}));SelectScrollUpButton.displayName=ScrollUpButton.displayName;const SelectScrollDownButton=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(ScrollDownButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",t),...e,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4"})}));SelectScrollDownButton.displayName=ScrollDownButton.displayName;const SelectContent=React__namespace.forwardRef(({className:t,children:e,position:n="popper",...o},l)=>jsxRuntime.jsx(Portal$1,{children:jsxRuntime.jsxs(Content2$3,{ref:l,className:cn("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...o,children:[jsxRuntime.jsx(SelectScrollUpButton,{}),jsxRuntime.jsx(Viewport,{className:cn("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),jsxRuntime.jsx(SelectScrollDownButton,{})]})}));SelectContent.displayName=Content2$3.displayName;const SelectLabel=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Label,{ref:n,className:cn("px-2 py-1.5 text-sm font-semibold",t),...e}));SelectLabel.displayName=Label.displayName;const SelectItem=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsxs(Item$2,{ref:o,className:cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(ItemIndicator,{children:jsxRuntime.jsx(Check,{className:"h-4 w-4"})})}),jsxRuntime.jsx(ItemText,{children:e})]}));SelectItem.displayName=Item$2.displayName;const SelectSeparator=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Separator,{ref:n,className:cn("-mx-1 my-1 h-px bg-muted",t),...e}));SelectSeparator.displayName=Separator.displayName;function ManufacturerProducts({applicationId:t,manufacturer:e,shopifyHostName:n}){var z,Q,F,O,te,ne;const[o]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeShopifyMutation(),[l,d]=React.useState(((Q=(z=e.Categories)==null?void 0:z[0])==null?void 0:Q.CategoryCode)||""),[f,g]=React.useState(!1),[b,S]=React.useState(!1),[_,R]=React.useState("percentile"),{toast:C}=useToast(),{data:E,isLoading:A,isFetching:M}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t,manufacturerId:e.ManufacturerId,categoryCode:l??""},{skip:!e.ManufacturerId||!l}),I=async()=>{try{g(!0),S(!1),await o({routeResellerId:t,manufacturerId:e.ManufacturerId??"",categoryCode:l,shopifyHostName:n}).unwrap()&&C({title:"Success",description:"Category synced to Shopify successfully",variant:"success"})}catch(ae){console.error("Error syncing to Shopify:",ae),C({title:"Error",description:"Error syncing category to Shopify.",variant:"destructive"})}finally{g(!1)}},j=()=>{var ae,ge;return((ge=(ae=e.Categories)==null?void 0:ae.find(oe=>oe.CategoryCode===l))==null?void 0:ge.CategoryName)||l},q=React.useMemo(()=>E!=null&&E.Products?[...E.Products].sort((ae,ge)=>{var oe,Ae,je,Ne;return _==="price-asc"?(((oe=ae.Distribution)==null?void 0:oe.Price)??0)-(((Ae=ge.Distribution)==null?void 0:Ae.Price)??0):_==="price-desc"?(((je=ge.Distribution)==null?void 0:je.Price)??0)-(((Ne=ae.Distribution)==null?void 0:Ne.Price)??0):_==="name"?(ae.Title??"").localeCompare(ge.Title??""):_==="percentile"?(ge.OverallPercentileRank??0)-(ae.OverallPercentileRank??0):0}):[],[E==null?void 0:E.Products,_]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx(ManufacturerCategories,{categories:e.Categories||[],activeCategory:l,onSelectCategory:d}),jsxRuntime.jsx("div",{className:"mb-4 w-full",children:jsxRuntime.jsx(ManufacturerCategorySummary,{name:j(),niche:(E==null?void 0:E.Niche)||"",productsNumber:((F=E==null?void 0:E.Products)==null?void 0:F.length)||0,autoreorder:(E==null?void 0:E.AutoReorder)||!1,starred:(E==null?void 0:E.Starred)||!1,isLoading:A||M,children:n&&((O=e.Categories)==null?void 0:O.findIndex(ae=>ae.AvailableToBuy))!==-1&&jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",disabled:f,onClick:()=>S(!0),children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Category to Shopify"]})})})}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsx(ManufacturerCategoriesStats,{categories:[(te=e.Categories)==null?void 0:te.find(ae=>ae.CategoryCode===l)].filter(Boolean),manufID:e.ManufacturerId,appID:t}),jsxRuntime.jsx(ActiveOrdersCard,{orders:(ne=E==null?void 0:E.Products)==null?void 0:ne.flatMap(ae=>(ae.ActiveOrderDetails||[]).filter(ge=>ge.Category===l)),loading:A||M})]})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center mt-7 mb-4",children:[jsxRuntime.jsx("h4",{className:"text-xl md:text-2xl text-foreground font-bold",children:"Products"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 ms-auto",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Sort by:"}),jsxRuntime.jsxs(Select,{value:_,onValueChange:R,children:[jsxRuntime.jsx(SelectTrigger,{className:"w-[220px]",children:jsxRuntime.jsx(SelectValue,{})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"price-asc",children:"Price: Low to High"}),jsxRuntime.jsx(SelectItem,{value:"price-desc",children:"Price: High to Low"}),jsxRuntime.jsx(SelectItem,{value:"name",children:"Name"}),jsxRuntime.jsx(SelectItem,{value:"percentile",children:"Best Selling"})]})]})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4 mb-4",children:A||M?Array.from({length:4}).map((ae,ge)=>jsxRuntime.jsx(ProductCard,{},ge)):q.length>0?q.map(ae=>jsxRuntime.jsx(ProductCard,{applicationId:t,product:ae,viewProductLink:`/${t}/Product/${ae.RandmarSKU}`,shopifyHostname:n},ae.RandmarSKU)):jsxRuntime.jsxs(Alert,{variant:"warning",className:"col-span-1 @md:col-span-2",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Warning"}),jsxRuntime.jsx(AlertDescription,{children:"No products found for this manufacturer category."})]})}),jsxRuntime.jsx(Dialog,{open:b,onOpenChange:S,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the category "',j(),'" to Shopify? This will add all products in this category to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:I,disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})})]})}function PartnerRelationshipPage({applicationId:t,partnerId:e,userEmail:n,shopifyHostName:o,isSuperAdmin:l}){var q,z,Q;const{data:d}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t}),{data:f,isLoading:g,isFetching:b}=useGetV4PartnerByRouteApplicationIdPartnerAndPartnerIdQuery({routeApplicationId:t,partnerId:e,withSpecification:!0}),{toast:S}=useToast(),[_]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdShopifyMutation(),[R,C]=React.useState(!1),[E,A]=React.useState(!1),M=async()=>{try{C(!0),A(!1),await _({routeResellerId:t??"",manufacturerId:e??"",shopifyHostName:o}).unwrap()&&S({title:"Success",description:"Manufacturer synced to Shopify successfully",variant:"success"})}catch(F){console.error("Error syncing to Shopify:",F),S({title:"Error",description:"Error syncing manufacturer to Shopify.",variant:"destructive"})}finally{C(!1)}},I=()=>f!=null&&f.Reseller?"reseller-overview":f!=null&&f.Manufacturer?"manufacturer-overview":"",j=React.useMemo(()=>!d||!f?"":`
1148
+ Defaulting to \`null\`.`}var Root$1=Progress$1,Indicator=ProgressIndicator;const Progress=React__namespace.forwardRef(({className:t,value:e,...n},o)=>jsxRuntime.jsx(Root$1,{ref:o,className:cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:jsxRuntime.jsx(Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Progress.displayName=Root$1.displayName;function ManufacturerInventoryFinanceCard({manufacturer:t,isLoading:e}){const{data:n,isLoading:o,isFetching:l}=useGetV4ManufacturerByRouteManufacturerIdInventoryValueQuery({routeManufacturerId:(t==null?void 0:t.ManufacturerId)??""},{skip:!(t!=null&&t.ManufacturerId)}),d=(t==null?void 0:t.DefaultMaxInventoryValue)??0,f=(n||[]).reduce((S,_)=>S+(_.InventoryValue||0),0),g=d-f,b=Math.round(f/d*100);return e||o||l?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/2 mt-2"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-2 w-full"})]})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(DollarSign,{className:"h-5 w-5 text-muted-foreground"}),"Inventory Finance"]}),jsxRuntime.jsx(CardDescription,{children:"Current inventory financial status"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[d!==0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Max Allowance"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(d)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Current value"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(f)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Available"}),jsxRuntime.jsx("span",{className:`font-bold ${g>=0?"text-emerald-600 dark:text-emerald-500":"text-red-600 dark:text-red-500"}`,children:formatMoney(g)})]})]}),d!==0&&jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Budget Usage"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[b,"%"]}),b>80&&jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4 text-amber-500"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:b>80?"High usage alert":"Budget usage"})})]})})]}),jsxRuntime.jsx(Progress,{value:b,className:"h-2"})]})]})]})}function ManufacturerCreditFinanceCard({manufacturer:t,isLoading:e}){const n=(t==null?void 0:t.CreditLimit)??0,o=(t==null?void 0:t.OutstandingBalance)??0,l=n-o,d=Math.round(o/n*100);return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/2 mt-2"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-2 w-full"})]})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(CreditCard,{className:"h-5 w-5 text-muted-foreground"}),"Credit Finance"]}),jsxRuntime.jsx(CardDescription,{children:"Current credit financial status"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Credit Limit"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(n)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Outstanding Balance"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(o)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Available Credit"}),jsxRuntime.jsx("span",{className:`font-bold ${l>=0?"text-emerald-600 dark:text-emerald-500":"text-red-600 dark:text-red-500"}`,children:formatMoney(l)})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Credit Usage"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[d,"%"]}),d>80&&jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4 text-amber-500"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:d>80?"High credit usage alert":"Credit usage"})})]})})]}),jsxRuntime.jsx(Progress,{value:d,className:"h-2"})]})]})]})}function SalesChartCard({statistics:t,loading:e=!1,mode:n="month",chartHeight:o=300,className:l,size:d="default"}){return e?jsxRuntime.jsxs(Card,{className:cn("w-full",l),children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-48 rounded-md"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{style:{height:o},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}),d==="default"&&n==="month"&&jsxRuntime.jsxs("div",{className:"mt-4 flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40 rounded-md"})]})]})]}):jsxRuntime.jsxs(Card,{className:cn("w-full",l),children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:n==="week"?"Weekly Sales Performance":"Monthly Sales Performance"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(SalesChart,{statistics:t,mode:n,chartHeight:o,size:d})})]})}function ManufacturerOverviewPage({applicationId:t,readonly:e,withReports:n,manufacturer:o,userEmail:l}){const{data:d,isLoading:f,isError:g}=useGetV4PartnerByApplicationIdAccountManufacturerQuery({applicationId:t,withSpecification:!0},{skip:!!o}),[b,S]=React.useState({publicInfo:{hasUnsavedChanges:!1},qualifications:{hasUnsavedChanges:!1},billingInfo:{hasUnsavedChanges:!1}}),_=React.useCallback(()=>e?!1:b.publicInfo.hasUnsavedChanges||b.qualifications.hasUnsavedChanges||b.billingInfo.hasUnsavedChanges,[e,b]),R=React.useCallback((A,M)=>{S(I=>{var j;return((j=I[A])==null?void 0:j.hasUnsavedChanges)!==M.hasUnsavedChanges?(console.log(`Updating form state for ${A}:`,M.hasUnsavedChanges),{...I,[A]:M}):I})},[]),{NavigationGuardDialog:C}=useRouterNavigationGuard(_),E=o??d;return jsxRuntime.jsxs("div",{className:"@container",children:[g?jsxRuntime.jsx(Card,{className:"p-6",children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"There was an error loading your manufacturer information. Please try again later."})]})}):jsxRuntime.jsxs("div",{className:"space-y-6 mb-6",children:[jsxRuntime.jsx(SalesSummary,{fiscalYearMonthStart:E==null?void 0:E.FiscalYearMonthStart,salesData:E==null?void 0:E.SalesData,isLoading:f}),jsxRuntime.jsxs("div",{className:"grid @2xl:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChartCard,{statistics:(E==null?void 0:E.SalesStatistics)??[],loading:f}),jsxRuntime.jsx(ManufacturerResellerOrdersSection,{manufacturerId:(E==null?void 0:E.ManufacturerId)??"",activeOrders:(E==null?void 0:E.ActiveOrderDetails)??void 0,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerInventoryFinanceCard,{manufacturer:E,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerCreditFinanceCard,{manufacturer:E,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerReorderingCard,{manufacturer:E??{},onSave:()=>{},loading:f,readonly:e}),n&&jsxRuntime.jsx(ManufacturerPublicInfoSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("publicInfo",{hasUnsavedChanges:A})}),n&&jsxRuntime.jsx(OpenToWorkSection,{manufacturer:E,readonly:e,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerBillingInfoSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("billingInfo",{hasUnsavedChanges:A})}),n&&jsxRuntime.jsx(ManufacturerQualificationsSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("qualifications",{hasUnsavedChanges:A})})]}),n&&jsxRuntime.jsx(ManufacturerReportsSection,{manufacturerId:(E==null?void 0:E.ManufacturerId)??"",userEmail:l,isLoading:f})]}),jsxRuntime.jsx(C,{})]})}function ManufacturerCategories({categories:t,activeCategory:e,onSelectCategory:n}){return jsxRuntime.jsx("div",{className:"grid",children:jsxRuntime.jsx("div",{className:"flex overflow-x-auto small-scrollbar pb-4",children:jsxRuntime.jsx("div",{className:"flex gap-2",children:t.map(o=>jsxRuntime.jsxs(Button,{onClick:()=>n(o.CategoryCode??""),variant:e===o.CategoryCode?"default":"outline",size:"sm",className:"px-3 py-1.5 text-xs whitespace-nowrap rounded-full",children:[o.CategoryName??"Undefined",o.QualificationRequired&&jsxRuntime.jsx(ShieldCheck,{className:`ml-1 w-5 h-5 ${e!==o.CategoryCode?"text-red-500":""}`})]},o.CategoryCode))})})})}function CategoryStats(t){const{data:e,isLoading:n,isFetching:o}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t.appID,manufacturerId:t.manufID,categoryCode:t.categoryCode});return jsxRuntime.jsx(Card,{className:"w-full",children:jsxRuntime.jsx(CardContent,{className:"p-4 space-y-1",children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:t.categoryName}),jsxRuntime.jsx(SalesChart,{statistics:(e==null?void 0:e.SalesStatistics)??[],loading:n||o,chartHeight:300})]})})})}function ManufacturerCategoriesStats(t){return(t.categories??[]).filter(n=>n.CategoryName).map(n=>jsxRuntime.jsx(CategoryStats,{appID:t.appID,manufID:t.manufID,categoryCode:n.CategoryCode,categoryName:n.CategoryName},`${t.manufID}-${n.CategoryCode}`))}const badgeVariants=cva("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground border border-input hover:bg-accent hover:text-accent-foreground",success:"bg-green-600 text-white hover:bg-green-700",warning:"bg-yellow-500 text-white hover:bg-yellow-600",info:"bg-blue-500 text-white hover:bg-blue-600",ghost:"bg-background hover:bg-accent hover:text-accent-foreground",randmarRed:"bg-randmar-red text-white hover:bg-randmar-red/80",randmarBlue:"bg-randmar-blue text-white hover:bg-randmar-blue/80",randmarPurple:"bg-randmar-purple text-white hover:bg-randmar-purple/80",randmarGreen:"bg-randmar-green text-black hover:bg-randmar-green/80",randmarBlack:"bg-randmar-black text-white hover:bg-randmar-black/80",randmarYellow:"bg-randmar-yellow text-black hover:bg-randmar-yellow/80"},size:{default:"h-6",sm:"h-5 text-[10px]",lg:"h-7 px-3"}},defaultVariants:{variant:"default",size:"default"}}),Badge=React__namespace.forwardRef(({className:t,variant:e,size:n,icon:o,children:l,...d},f)=>jsxRuntime.jsxs("div",{ref:f,className:cn(badgeVariants({variant:e,size:n}),t),...d,children:[o&&jsxRuntime.jsx("span",{className:"mr-1",children:o}),l]}));Badge.displayName="Badge";function ManufacturerCategorySummary({name:t="N/A",niche:e="N/A",productsNumber:n=0,autoreorder:o=!1,starred:l=!1,isLoading:d=!1,children:f}){return d?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-4",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between",children:[jsxRuntime.jsx("div",{className:"space-y-1 flex-1",children:jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-28 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-5 w-48 bg-muted rounded-md animate-pulse"})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-12 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-5 w-5 bg-muted rounded-md animate-pulse"})]})]})}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-8 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-4 w-32 bg-muted rounded-md animate-pulse"})]}),jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-16 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-4 w-4 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-4 w-6 bg-muted rounded-md animate-pulse"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-1 flex-1 flex flex-col items-end",children:[jsxRuntime.jsx("div",{className:"h-3 w-20 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-4 w-4 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-6 w-16 bg-muted rounded-md animate-pulse"})]})]})]})]})]}):jsxRuntime.jsx(Card,{children:jsxRuntime.jsxs(CardContent,{className:"grid grid-cols-[1fr_auto] items-start gap-4 pt-6",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-start gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Category Name"}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold leading-none tracking-tight",children:t})]}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Niche"}),jsxRuntime.jsx("p",{className:"text-sm font-medium",children:e})]}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Products"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Package,{className:"h-4 w-4 text-muted-foreground"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:n})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end justify-between gap-4 h-full",children:[f,jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Starred"}),l?jsxRuntime.jsx(Star,{className:"h-5 w-5 fill-yellow-400 text-yellow-400"}):jsxRuntime.jsx(Star,{className:"h-5 w-5 text-muted-foreground"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 flex flex-col items-end",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Auto-reorder"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[o?jsxRuntime.jsx(RefreshCw,{className:"size-4 text-green-600"}):jsxRuntime.jsx(RefreshCwOff,{className:"size-4 text-amber-600"}),jsxRuntime.jsx(Badge,{variant:o?"default":"secondary",className:cn("text-xs",o?"text-green-600 bg-green-100 hover:bg-green-200":"text-amber-600 bg-amber-100 hover:bg-amber-200"),children:o?"Enabled":"Disabled"})]})]})]})]})})}var OPEN_KEYS=[" ","Enter","ArrowUp","ArrowDown"],SELECTION_KEYS=[" ","Enter"],SELECT_NAME="Select",[Collection$1,useCollection$1,createCollectionScope$1]=createCollection(SELECT_NAME),[createSelectContext,createSelectScope]=createContextScope(SELECT_NAME,[createCollectionScope$1,createPopperScope]),usePopperScope$1=createPopperScope(),[SelectProvider,useSelectContext]=createSelectContext(SELECT_NAME),[SelectNativeOptionsProvider,useSelectNativeOptionsContext]=createSelectContext(SELECT_NAME),Select$1=t=>{const{__scopeSelect:e,children:n,open:o,defaultOpen:l,onOpenChange:d,value:f,defaultValue:g,onValueChange:b,dir:S,name:_,autoComplete:R,disabled:C,required:E,form:A}=t,M=usePopperScope$1(e),[I,j]=React__namespace.useState(null),[q,z]=React__namespace.useState(null),[Q,F]=React__namespace.useState(!1),O=useDirection(S),[te,ne]=useControllableState({prop:o,defaultProp:l??!1,onChange:d,caller:SELECT_NAME}),[ae,ge]=useControllableState({prop:f,defaultProp:g,onChange:b,caller:SELECT_NAME}),oe=React__namespace.useRef(null),Ae=I?A||!!I.closest("form"):!0,[je,Ne]=React__namespace.useState(new Set),Ve=Array.from(je).map(Le=>Le.props.value).join(";");return jsxRuntime.jsx(Root2$7,{...M,children:jsxRuntime.jsxs(SelectProvider,{required:E,scope:e,trigger:I,onTriggerChange:j,valueNode:q,onValueNodeChange:z,valueNodeHasChildren:Q,onValueNodeHasChildrenChange:F,contentId:useId(),value:ae,onValueChange:ge,open:te,onOpenChange:ne,dir:O,triggerPointerDownPosRef:oe,disabled:C,children:[jsxRuntime.jsx(Collection$1.Provider,{scope:e,children:jsxRuntime.jsx(SelectNativeOptionsProvider,{scope:t.__scopeSelect,onNativeOptionAdd:React__namespace.useCallback(Le=>{Ne(ze=>new Set(ze).add(Le))},[]),onNativeOptionRemove:React__namespace.useCallback(Le=>{Ne(ze=>{const $e=new Set(ze);return $e.delete(Le),$e})},[]),children:n})}),Ae?jsxRuntime.jsxs(SelectBubbleInput,{"aria-hidden":!0,required:E,tabIndex:-1,name:_,autoComplete:R,value:ae,onChange:Le=>ge(Le.target.value),disabled:C,form:A,children:[ae===void 0?jsxRuntime.jsx("option",{value:""}):null,Array.from(je)]},Ve):null]})})};Select$1.displayName=SELECT_NAME;var TRIGGER_NAME$5="SelectTrigger",SelectTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:o=!1,...l}=t,d=usePopperScope$1(n),f=useSelectContext(TRIGGER_NAME$5,n),g=f.disabled||o,b=useComposedRefs(e,f.onTriggerChange),S=useCollection$1(n),_=React__namespace.useRef("touch"),[R,C,E]=useTypeaheadSearch(M=>{const I=S().filter(z=>!z.disabled),j=I.find(z=>z.value===f.value),q=findNextItem(I,M,j);q!==void 0&&f.onValueChange(q.value)}),A=M=>{g||(f.onOpenChange(!0),E()),M&&(f.triggerPointerDownPosRef.current={x:Math.round(M.pageX),y:Math.round(M.pageY)})};return jsxRuntime.jsx(Anchor,{asChild:!0,...d,children:jsxRuntime.jsx(Primitive.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:g,"data-disabled":g?"":void 0,"data-placeholder":shouldShowPlaceholder(f.value)?"":void 0,...l,ref:b,onClick:composeEventHandlers(l.onClick,M=>{M.currentTarget.focus(),_.current!=="mouse"&&A(M)}),onPointerDown:composeEventHandlers(l.onPointerDown,M=>{_.current=M.pointerType;const I=M.target;I.hasPointerCapture(M.pointerId)&&I.releasePointerCapture(M.pointerId),M.button===0&&M.ctrlKey===!1&&M.pointerType==="mouse"&&(A(M),M.preventDefault())}),onKeyDown:composeEventHandlers(l.onKeyDown,M=>{const I=R.current!=="";!(M.ctrlKey||M.altKey||M.metaKey)&&M.key.length===1&&C(M.key),!(I&&M.key===" ")&&OPEN_KEYS.includes(M.key)&&(A(),M.preventDefault())})})})});SelectTrigger$1.displayName=TRIGGER_NAME$5;var VALUE_NAME="SelectValue",SelectValue$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,className:o,style:l,children:d,placeholder:f="",...g}=t,b=useSelectContext(VALUE_NAME,n),{onValueNodeHasChildrenChange:S}=b,_=d!==void 0,R=useComposedRefs(e,b.onValueNodeChange);return useLayoutEffect2(()=>{S(_)},[S,_]),jsxRuntime.jsx(Primitive.span,{...g,ref:R,style:{pointerEvents:"none"},children:shouldShowPlaceholder(b.value)?jsxRuntime.jsx(jsxRuntime.Fragment,{children:f}):d})});SelectValue$1.displayName=VALUE_NAME;var ICON_NAME="SelectIcon",SelectIcon=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,children:o,...l}=t;return jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...l,ref:e,children:o||"▼"})});SelectIcon.displayName=ICON_NAME;var PORTAL_NAME$2="SelectPortal",SelectPortal=t=>jsxRuntime.jsx(Portal$5,{asChild:!0,...t});SelectPortal.displayName=PORTAL_NAME$2;var CONTENT_NAME$4="SelectContent",SelectContent$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContext(CONTENT_NAME$4,t.__scopeSelect),[o,l]=React__namespace.useState();if(useLayoutEffect2(()=>{l(new DocumentFragment)},[]),!n.open){const d=o;return d?ReactDOM__namespace.createPortal(jsxRuntime.jsx(SelectContentProvider,{scope:t.__scopeSelect,children:jsxRuntime.jsx(Collection$1.Slot,{scope:t.__scopeSelect,children:jsxRuntime.jsx("div",{children:t.children})})}),d):null}return jsxRuntime.jsx(SelectContentImpl,{...t,ref:e})});SelectContent$1.displayName=CONTENT_NAME$4;var CONTENT_MARGIN=10,[SelectContentProvider,useSelectContentContext]=createSelectContext(CONTENT_NAME$4),CONTENT_IMPL_NAME="SelectContentImpl",Slot$1=createSlot("SelectContent.RemoveScroll"),SelectContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:d,onPointerDownOutside:f,side:g,sideOffset:b,align:S,alignOffset:_,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:A,hideWhenDetached:M,avoidCollisions:I,...j}=t,q=useSelectContext(CONTENT_NAME$4,n),[z,Q]=React__namespace.useState(null),[F,O]=React__namespace.useState(null),te=useComposedRefs(e,Xe=>Q(Xe)),[ne,ae]=React__namespace.useState(null),[ge,oe]=React__namespace.useState(null),Ae=useCollection$1(n),[je,Ne]=React__namespace.useState(!1),Ve=React__namespace.useRef(!1);React__namespace.useEffect(()=>{if(z)return hideOthers(z)},[z]),useFocusGuards();const Le=React__namespace.useCallback(Xe=>{const[it,...et]=Ae().map(Ue=>Ue.ref.current),[at]=et.slice(-1),ot=document.activeElement;for(const Ue of Xe)if(Ue===ot||(Ue==null||Ue.scrollIntoView({block:"nearest"}),Ue===it&&F&&(F.scrollTop=0),Ue===at&&F&&(F.scrollTop=F.scrollHeight),Ue==null||Ue.focus(),document.activeElement!==ot))return},[Ae,F]),ze=React__namespace.useCallback(()=>Le([ne,z]),[Le,ne,z]);React__namespace.useEffect(()=>{je&&ze()},[je,ze]);const{onOpenChange:$e,triggerPointerDownPosRef:Oe}=q;React__namespace.useEffect(()=>{if(z){let Xe={x:0,y:0};const it=at=>{var ot,Ue;Xe={x:Math.abs(Math.round(at.pageX)-(((ot=Oe.current)==null?void 0:ot.x)??0)),y:Math.abs(Math.round(at.pageY)-(((Ue=Oe.current)==null?void 0:Ue.y)??0))}},et=at=>{Xe.x<=10&&Xe.y<=10?at.preventDefault():z.contains(at.target)||$e(!1),document.removeEventListener("pointermove",it),Oe.current=null};return Oe.current!==null&&(document.addEventListener("pointermove",it),document.addEventListener("pointerup",et,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",it),document.removeEventListener("pointerup",et,{capture:!0})}}},[z,$e,Oe]),React__namespace.useEffect(()=>{const Xe=()=>$e(!1);return window.addEventListener("blur",Xe),window.addEventListener("resize",Xe),()=>{window.removeEventListener("blur",Xe),window.removeEventListener("resize",Xe)}},[$e]);const[qe,Ge]=useTypeaheadSearch(Xe=>{const it=Ae().filter(ot=>!ot.disabled),et=it.find(ot=>ot.ref.current===document.activeElement),at=findNextItem(it,Xe,et);at&&setTimeout(()=>at.ref.current.focus())}),He=React__namespace.useCallback((Xe,it,et)=>{const at=!Ve.current&&!et;(q.value!==void 0&&q.value===it||at)&&(ae(Xe),at&&(Ve.current=!0))},[q.value]),Je=React__namespace.useCallback(()=>z==null?void 0:z.focus(),[z]),Ze=React__namespace.useCallback((Xe,it,et)=>{const at=!Ve.current&&!et;(q.value!==void 0&&q.value===it||at)&&oe(Xe)},[q.value]),We=o==="popper"?SelectPopperPosition:SelectItemAlignedPosition,tt=We===SelectPopperPosition?{side:g,sideOffset:b,align:S,alignOffset:_,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:A,hideWhenDetached:M,avoidCollisions:I}:{};return jsxRuntime.jsx(SelectContentProvider,{scope:n,content:z,viewport:F,onViewportChange:O,itemRefCallback:He,selectedItem:ne,onItemLeave:Je,itemTextRefCallback:Ze,focusSelectedItem:ze,selectedItemText:ge,position:o,isPositioned:je,searchRef:qe,children:jsxRuntime.jsx(ReactRemoveScroll,{as:Slot$1,allowPinchZoom:!0,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:q.open,onMountAutoFocus:Xe=>{Xe.preventDefault()},onUnmountAutoFocus:composeEventHandlers(l,Xe=>{var it;(it=q.trigger)==null||it.focus({preventScroll:!0}),Xe.preventDefault()}),children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:Xe=>Xe.preventDefault(),onDismiss:()=>q.onOpenChange(!1),children:jsxRuntime.jsx(We,{role:"listbox",id:q.contentId,"data-state":q.open?"open":"closed",dir:q.dir,onContextMenu:Xe=>Xe.preventDefault(),...j,...tt,onPlaced:()=>Ne(!0),ref:te,style:{display:"flex",flexDirection:"column",outline:"none",...j.style},onKeyDown:composeEventHandlers(j.onKeyDown,Xe=>{const it=Xe.ctrlKey||Xe.altKey||Xe.metaKey;if(Xe.key==="Tab"&&Xe.preventDefault(),!it&&Xe.key.length===1&&Ge(Xe.key),["ArrowUp","ArrowDown","Home","End"].includes(Xe.key)){let at=Ae().filter(ot=>!ot.disabled).map(ot=>ot.ref.current);if(["ArrowUp","End"].includes(Xe.key)&&(at=at.slice().reverse()),["ArrowUp","ArrowDown"].includes(Xe.key)){const ot=Xe.target,Ue=at.indexOf(ot);at=at.slice(Ue+1)}setTimeout(()=>Le(at)),Xe.preventDefault()}})})})})})})});SelectContentImpl.displayName=CONTENT_IMPL_NAME;var ITEM_ALIGNED_POSITION_NAME="SelectItemAlignedPosition",SelectItemAlignedPosition=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:o,...l}=t,d=useSelectContext(CONTENT_NAME$4,n),f=useSelectContentContext(CONTENT_NAME$4,n),[g,b]=React__namespace.useState(null),[S,_]=React__namespace.useState(null),R=useComposedRefs(e,te=>_(te)),C=useCollection$1(n),E=React__namespace.useRef(!1),A=React__namespace.useRef(!0),{viewport:M,selectedItem:I,selectedItemText:j,focusSelectedItem:q}=f,z=React__namespace.useCallback(()=>{if(d.trigger&&d.valueNode&&g&&S&&M&&I&&j){const te=d.trigger.getBoundingClientRect(),ne=S.getBoundingClientRect(),ae=d.valueNode.getBoundingClientRect(),ge=j.getBoundingClientRect();if(d.dir!=="rtl"){const ot=ge.left-ne.left,Ue=ae.left-ot,mt=te.left-Ue,Qe=te.width+mt,Rt=Math.max(Qe,ne.width),$t=window.innerWidth-CONTENT_MARGIN,Ft=clamp(Ue,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,$t-Rt)]);g.style.minWidth=Qe+"px",g.style.left=Ft+"px"}else{const ot=ne.right-ge.right,Ue=window.innerWidth-ae.right-ot,mt=window.innerWidth-te.right-Ue,Qe=te.width+mt,Rt=Math.max(Qe,ne.width),$t=window.innerWidth-CONTENT_MARGIN,Ft=clamp(Ue,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,$t-Rt)]);g.style.minWidth=Qe+"px",g.style.right=Ft+"px"}const oe=C(),Ae=window.innerHeight-CONTENT_MARGIN*2,je=M.scrollHeight,Ne=window.getComputedStyle(S),Ve=parseInt(Ne.borderTopWidth,10),Le=parseInt(Ne.paddingTop,10),ze=parseInt(Ne.borderBottomWidth,10),$e=parseInt(Ne.paddingBottom,10),Oe=Ve+Le+je+$e+ze,qe=Math.min(I.offsetHeight*5,Oe),Ge=window.getComputedStyle(M),He=parseInt(Ge.paddingTop,10),Je=parseInt(Ge.paddingBottom,10),Ze=te.top+te.height/2-CONTENT_MARGIN,We=Ae-Ze,tt=I.offsetHeight/2,Xe=I.offsetTop+tt,it=Ve+Le+Xe,et=Oe-it;if(it<=Ze){const ot=oe.length>0&&I===oe[oe.length-1].ref.current;g.style.bottom="0px";const Ue=S.clientHeight-M.offsetTop-M.offsetHeight,mt=Math.max(We,tt+(ot?Je:0)+Ue+ze),Qe=it+mt;g.style.height=Qe+"px"}else{const ot=oe.length>0&&I===oe[0].ref.current;g.style.top="0px";const mt=Math.max(Ze,Ve+M.offsetTop+(ot?He:0)+tt)+et;g.style.height=mt+"px",M.scrollTop=it-Ze+M.offsetTop}g.style.margin=`${CONTENT_MARGIN}px 0`,g.style.minHeight=qe+"px",g.style.maxHeight=Ae+"px",o==null||o(),requestAnimationFrame(()=>E.current=!0)}},[C,d.trigger,d.valueNode,g,S,M,I,j,d.dir,o]);useLayoutEffect2(()=>z(),[z]);const[Q,F]=React__namespace.useState();useLayoutEffect2(()=>{S&&F(window.getComputedStyle(S).zIndex)},[S]);const O=React__namespace.useCallback(te=>{te&&A.current===!0&&(z(),q==null||q(),A.current=!1)},[z,q]);return jsxRuntime.jsx(SelectViewportProvider,{scope:n,contentWrapper:g,shouldExpandOnScrollRef:E,onScrollButtonChange:O,children:jsxRuntime.jsx("div",{ref:b,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:Q},children:jsxRuntime.jsx(Primitive.div,{...l,ref:R,style:{boxSizing:"border-box",maxHeight:"100%",...l.style}})})})});SelectItemAlignedPosition.displayName=ITEM_ALIGNED_POSITION_NAME;var POPPER_POSITION_NAME="SelectPopperPosition",SelectPopperPosition=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,align:o="start",collisionPadding:l=CONTENT_MARGIN,...d}=t,f=usePopperScope$1(n);return jsxRuntime.jsx(Content$2,{...f,...d,ref:e,align:o,collisionPadding:l,style:{boxSizing:"border-box",...d.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});SelectPopperPosition.displayName=POPPER_POSITION_NAME;var[SelectViewportProvider,useSelectViewportContext]=createSelectContext(CONTENT_NAME$4,{}),VIEWPORT_NAME="SelectViewport",SelectViewport=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:o,...l}=t,d=useSelectContentContext(VIEWPORT_NAME,n),f=useSelectViewportContext(VIEWPORT_NAME,n),g=useComposedRefs(e,d.onViewportChange),b=React__namespace.useRef(0);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),jsxRuntime.jsx(Collection$1.Slot,{scope:n,children:jsxRuntime.jsx(Primitive.div,{"data-radix-select-viewport":"",role:"presentation",...l,ref:g,style:{position:"relative",flex:1,overflow:"hidden auto",...l.style},onScroll:composeEventHandlers(l.onScroll,S=>{const _=S.currentTarget,{contentWrapper:R,shouldExpandOnScrollRef:C}=f;if(C!=null&&C.current&&R){const E=Math.abs(b.current-_.scrollTop);if(E>0){const A=window.innerHeight-CONTENT_MARGIN*2,M=parseFloat(R.style.minHeight),I=parseFloat(R.style.height),j=Math.max(M,I);if(j<A){const q=j+E,z=Math.min(A,q),Q=q-z;R.style.height=z+"px",R.style.bottom==="0px"&&(_.scrollTop=Q>0?Q:0,R.style.justifyContent="flex-end")}}}b.current=_.scrollTop})})})]})});SelectViewport.displayName=VIEWPORT_NAME;var GROUP_NAME="SelectGroup",[SelectGroupContextProvider,useSelectGroupContext]=createSelectContext(GROUP_NAME),SelectGroup$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=useId();return jsxRuntime.jsx(SelectGroupContextProvider,{scope:n,id:l,children:jsxRuntime.jsx(Primitive.div,{role:"group","aria-labelledby":l,...o,ref:e})})});SelectGroup$1.displayName=GROUP_NAME;var LABEL_NAME="SelectLabel",SelectLabel$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=useSelectGroupContext(LABEL_NAME,n);return jsxRuntime.jsx(Primitive.div,{id:l.id,...o,ref:e})});SelectLabel$1.displayName=LABEL_NAME;var ITEM_NAME$1="SelectItem",[SelectItemContextProvider,useSelectItemContext]=createSelectContext(ITEM_NAME$1),SelectItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,value:o,disabled:l=!1,textValue:d,...f}=t,g=useSelectContext(ITEM_NAME$1,n),b=useSelectContentContext(ITEM_NAME$1,n),S=g.value===o,[_,R]=React__namespace.useState(d??""),[C,E]=React__namespace.useState(!1),A=useComposedRefs(e,q=>{var z;return(z=b.itemRefCallback)==null?void 0:z.call(b,q,o,l)}),M=useId(),I=React__namespace.useRef("touch"),j=()=>{l||(g.onValueChange(o),g.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return jsxRuntime.jsx(SelectItemContextProvider,{scope:n,value:o,disabled:l,textId:M,isSelected:S,onItemTextChange:React__namespace.useCallback(q=>{R(z=>z||((q==null?void 0:q.textContent)??"").trim())},[]),children:jsxRuntime.jsx(Collection$1.ItemSlot,{scope:n,value:o,disabled:l,textValue:_,children:jsxRuntime.jsx(Primitive.div,{role:"option","aria-labelledby":M,"data-highlighted":C?"":void 0,"aria-selected":S&&C,"data-state":S?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1,...f,ref:A,onFocus:composeEventHandlers(f.onFocus,()=>E(!0)),onBlur:composeEventHandlers(f.onBlur,()=>E(!1)),onClick:composeEventHandlers(f.onClick,()=>{I.current!=="mouse"&&j()}),onPointerUp:composeEventHandlers(f.onPointerUp,()=>{I.current==="mouse"&&j()}),onPointerDown:composeEventHandlers(f.onPointerDown,q=>{I.current=q.pointerType}),onPointerMove:composeEventHandlers(f.onPointerMove,q=>{var z;I.current=q.pointerType,l?(z=b.onItemLeave)==null||z.call(b):I.current==="mouse"&&q.currentTarget.focus({preventScroll:!0})}),onPointerLeave:composeEventHandlers(f.onPointerLeave,q=>{var z;q.currentTarget===document.activeElement&&((z=b.onItemLeave)==null||z.call(b))}),onKeyDown:composeEventHandlers(f.onKeyDown,q=>{var Q;((Q=b.searchRef)==null?void 0:Q.current)!==""&&q.key===" "||(SELECTION_KEYS.includes(q.key)&&j(),q.key===" "&&q.preventDefault())})})})})});SelectItem$1.displayName=ITEM_NAME$1;var ITEM_TEXT_NAME="SelectItemText",SelectItemText=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,className:o,style:l,...d}=t,f=useSelectContext(ITEM_TEXT_NAME,n),g=useSelectContentContext(ITEM_TEXT_NAME,n),b=useSelectItemContext(ITEM_TEXT_NAME,n),S=useSelectNativeOptionsContext(ITEM_TEXT_NAME,n),[_,R]=React__namespace.useState(null),C=useComposedRefs(e,j=>R(j),b.onItemTextChange,j=>{var q;return(q=g.itemTextRefCallback)==null?void 0:q.call(g,j,b.value,b.disabled)}),E=_==null?void 0:_.textContent,A=React__namespace.useMemo(()=>jsxRuntime.jsx("option",{value:b.value,disabled:b.disabled,children:E},b.value),[b.disabled,b.value,E]),{onNativeOptionAdd:M,onNativeOptionRemove:I}=S;return useLayoutEffect2(()=>(M(A),()=>I(A)),[M,I,A]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Primitive.span,{id:b.textId,...d,ref:C}),b.isSelected&&f.valueNode&&!f.valueNodeHasChildren?ReactDOM__namespace.createPortal(d.children,f.valueNode):null]})});SelectItemText.displayName=ITEM_TEXT_NAME;var ITEM_INDICATOR_NAME="SelectItemIndicator",SelectItemIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t;return useSelectItemContext(ITEM_INDICATOR_NAME,n).isSelected?jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...o,ref:e}):null});SelectItemIndicator.displayName=ITEM_INDICATOR_NAME;var SCROLL_UP_BUTTON_NAME="SelectScrollUpButton",SelectScrollUpButton$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContentContext(SCROLL_UP_BUTTON_NAME,t.__scopeSelect),o=useSelectViewportContext(SCROLL_UP_BUTTON_NAME,t.__scopeSelect),[l,d]=React__namespace.useState(!1),f=useComposedRefs(e,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let g=function(){const S=b.scrollTop>0;d(S)};const b=n.viewport;return g(),b.addEventListener("scroll",g),()=>b.removeEventListener("scroll",g)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...t,ref:f,onAutoScroll:()=>{const{viewport:g,selectedItem:b}=n;g&&b&&(g.scrollTop=g.scrollTop-b.offsetHeight)}}):null});SelectScrollUpButton$1.displayName=SCROLL_UP_BUTTON_NAME;var SCROLL_DOWN_BUTTON_NAME="SelectScrollDownButton",SelectScrollDownButton$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContentContext(SCROLL_DOWN_BUTTON_NAME,t.__scopeSelect),o=useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME,t.__scopeSelect),[l,d]=React__namespace.useState(!1),f=useComposedRefs(e,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let g=function(){const S=b.scrollHeight-b.clientHeight,_=Math.ceil(b.scrollTop)<S;d(_)};const b=n.viewport;return g(),b.addEventListener("scroll",g),()=>b.removeEventListener("scroll",g)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...t,ref:f,onAutoScroll:()=>{const{viewport:g,selectedItem:b}=n;g&&b&&(g.scrollTop=g.scrollTop+b.offsetHeight)}}):null});SelectScrollDownButton$1.displayName=SCROLL_DOWN_BUTTON_NAME;var SelectScrollButtonImpl=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:o,...l}=t,d=useSelectContentContext("SelectScrollButton",n),f=React__namespace.useRef(null),g=useCollection$1(n),b=React__namespace.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return React__namespace.useEffect(()=>()=>b(),[b]),useLayoutEffect2(()=>{var _;const S=g().find(R=>R.ref.current===document.activeElement);(_=S==null?void 0:S.ref.current)==null||_.scrollIntoView({block:"nearest"})},[g]),jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...l,ref:e,style:{flexShrink:0,...l.style},onPointerDown:composeEventHandlers(l.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(o,50))}),onPointerMove:composeEventHandlers(l.onPointerMove,()=>{var S;(S=d.onItemLeave)==null||S.call(d),f.current===null&&(f.current=window.setInterval(o,50))}),onPointerLeave:composeEventHandlers(l.onPointerLeave,()=>{b()})})}),SEPARATOR_NAME="SelectSeparator",SelectSeparator$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t;return jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...o,ref:e})});SelectSeparator$1.displayName=SEPARATOR_NAME;var ARROW_NAME$1="SelectArrow",SelectArrow=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=usePopperScope$1(n),d=useSelectContext(ARROW_NAME$1,n),f=useSelectContentContext(ARROW_NAME$1,n);return d.open&&f.position==="popper"?jsxRuntime.jsx(Arrow,{...l,...o,ref:e}):null});SelectArrow.displayName=ARROW_NAME$1;var BUBBLE_INPUT_NAME$1="SelectBubbleInput",SelectBubbleInput=React__namespace.forwardRef(({__scopeSelect:t,value:e,...n},o)=>{const l=React__namespace.useRef(null),d=useComposedRefs(o,l),f=usePrevious(e);return React__namespace.useEffect(()=>{const g=l.current;if(!g)return;const b=window.HTMLSelectElement.prototype,_=Object.getOwnPropertyDescriptor(b,"value").set;if(f!==e&&_){const R=new Event("change",{bubbles:!0});_.call(g,e),g.dispatchEvent(R)}},[f,e]),jsxRuntime.jsx(Primitive.select,{...n,style:{...VISUALLY_HIDDEN_STYLES,...n.style},ref:d,defaultValue:e})});SelectBubbleInput.displayName=BUBBLE_INPUT_NAME$1;function shouldShowPlaceholder(t){return t===""||t===void 0}function useTypeaheadSearch(t){const e=useCallbackRef$1(t),n=React__namespace.useRef(""),o=React__namespace.useRef(0),l=React__namespace.useCallback(f=>{const g=n.current+f;e(g),function b(S){n.current=S,window.clearTimeout(o.current),S!==""&&(o.current=window.setTimeout(()=>b(""),1e3))}(g)},[e]),d=React__namespace.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return React__namespace.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,l,d]}function findNextItem(t,e,n){const l=e.length>1&&Array.from(e).every(S=>S===e[0])?e[0]:e,d=n?t.indexOf(n):-1;let f=wrapArray(t,Math.max(d,0));l.length===1&&(f=f.filter(S=>S!==n));const b=f.find(S=>S.textValue.toLowerCase().startsWith(l.toLowerCase()));return b!==n?b:void 0}function wrapArray(t,e){return t.map((n,o)=>t[(e+o)%t.length])}var Root2$3=Select$1,Trigger$2=SelectTrigger$1,Value=SelectValue$1,Icon=SelectIcon,Portal$1=SelectPortal,Content2$3=SelectContent$1,Viewport=SelectViewport,Group=SelectGroup$1,Label=SelectLabel$1,Item$2=SelectItem$1,ItemText=SelectItemText,ItemIndicator=SelectItemIndicator,ScrollUpButton=SelectScrollUpButton$1,ScrollDownButton=SelectScrollDownButton$1,Separator=SelectSeparator$1;const Select=Root2$3,SelectGroup=Group,SelectValue=Value,SelectTrigger=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsxs(Trigger$2,{ref:o,className:cn("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,jsxRuntime.jsx(Icon,{asChild:!0,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));SelectTrigger.displayName=Trigger$2.displayName;const SelectScrollUpButton=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(ScrollUpButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",t),...e,children:jsxRuntime.jsx(ChevronUp,{className:"h-4 w-4"})}));SelectScrollUpButton.displayName=ScrollUpButton.displayName;const SelectScrollDownButton=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(ScrollDownButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",t),...e,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4"})}));SelectScrollDownButton.displayName=ScrollDownButton.displayName;const SelectContent=React__namespace.forwardRef(({className:t,children:e,position:n="popper",...o},l)=>jsxRuntime.jsx(Portal$1,{children:jsxRuntime.jsxs(Content2$3,{ref:l,className:cn("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...o,children:[jsxRuntime.jsx(SelectScrollUpButton,{}),jsxRuntime.jsx(Viewport,{className:cn("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),jsxRuntime.jsx(SelectScrollDownButton,{})]})}));SelectContent.displayName=Content2$3.displayName;const SelectLabel=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Label,{ref:n,className:cn("px-2 py-1.5 text-sm font-semibold",t),...e}));SelectLabel.displayName=Label.displayName;const SelectItem=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsxs(Item$2,{ref:o,className:cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(ItemIndicator,{children:jsxRuntime.jsx(Check,{className:"h-4 w-4"})})}),jsxRuntime.jsx(ItemText,{children:e})]}));SelectItem.displayName=Item$2.displayName;const SelectSeparator=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Separator,{ref:n,className:cn("-mx-1 my-1 h-px bg-muted",t),...e}));SelectSeparator.displayName=Separator.displayName;function ManufacturerProducts({applicationId:t,manufacturer:e,shopifyHostName:n}){var z,Q,F,O,te,ne;const[o]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeShopifyMutation(),[l,d]=React.useState(((Q=(z=e.Categories)==null?void 0:z[0])==null?void 0:Q.CategoryCode)||""),[f,g]=React.useState(!1),[b,S]=React.useState(!1),[_,R]=React.useState("percentile"),{toast:C}=useToast(),{data:E,isLoading:A,isFetching:M}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t,manufacturerId:e.ManufacturerId,categoryCode:l??""},{skip:!e.ManufacturerId||!l}),I=async()=>{try{g(!0),S(!1),await o({routeResellerId:t,manufacturerId:e.ManufacturerId??"",categoryCode:l,shopifyHostName:n}).unwrap()&&C({title:"Success",description:"Category synced to Shopify successfully",variant:"success"})}catch(ae){console.error("Error syncing to Shopify:",ae),C({title:"Error",description:"Error syncing category to Shopify.",variant:"destructive"})}finally{g(!1)}},j=()=>{var ae,ge;return((ge=(ae=e.Categories)==null?void 0:ae.find(oe=>oe.CategoryCode===l))==null?void 0:ge.CategoryName)||l},q=React.useMemo(()=>E!=null&&E.Products?[...E.Products].sort((ae,ge)=>_==="price-asc"?(ae.MAP??0)-(ge.MAP??0):_==="price-desc"?(ge.MAP??0)-(ae.MAP??0):_==="name"?(ae.Title??"").localeCompare(ge.Title??""):_==="percentile"?(ge.OverallPercentileRank??0)-(ae.OverallPercentileRank??0):0):[],[E==null?void 0:E.Products,_]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx(ManufacturerCategories,{categories:e.Categories||[],activeCategory:l,onSelectCategory:d}),jsxRuntime.jsx("div",{className:"mb-4 w-full",children:jsxRuntime.jsx(ManufacturerCategorySummary,{name:j(),niche:(E==null?void 0:E.Niche)||"",productsNumber:((F=E==null?void 0:E.Products)==null?void 0:F.length)||0,autoreorder:(E==null?void 0:E.AutoReorder)||!1,starred:(E==null?void 0:E.Starred)||!1,isLoading:A||M,children:n&&((O=e.Categories)==null?void 0:O.findIndex(ae=>ae.AvailableToBuy))!==-1&&jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",disabled:f,onClick:()=>S(!0),children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Category to Shopify"]})})})}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsx(ManufacturerCategoriesStats,{categories:[(te=e.Categories)==null?void 0:te.find(ae=>ae.CategoryCode===l)].filter(Boolean),manufID:e.ManufacturerId,appID:t}),jsxRuntime.jsx(ActiveOrdersCard,{orders:(ne=E==null?void 0:E.Products)==null?void 0:ne.flatMap(ae=>(ae.ActiveOrderDetails||[]).filter(ge=>ge.Category===l)),loading:A||M})]})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center mt-7 mb-4",children:[jsxRuntime.jsx("h4",{className:"text-xl md:text-2xl text-foreground font-bold",children:"Products"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 ms-auto",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Sort by:"}),jsxRuntime.jsxs(Select,{value:_,onValueChange:R,children:[jsxRuntime.jsx(SelectTrigger,{className:"w-[220px]",children:jsxRuntime.jsx(SelectValue,{})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"price-asc",children:"MAP: Low to High"}),jsxRuntime.jsx(SelectItem,{value:"price-desc",children:"MAP: High to Low"}),jsxRuntime.jsx(SelectItem,{value:"name",children:"Name"}),jsxRuntime.jsx(SelectItem,{value:"percentile",children:"Best Selling"})]})]})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4 mb-4",children:A||M?Array.from({length:4}).map((ae,ge)=>jsxRuntime.jsx(ProductCard,{},ge)):q.length>0?q.map(ae=>jsxRuntime.jsx(ProductCard,{applicationId:t,product:ae,viewProductLink:`/${t}/Product/${ae.RandmarSKU}`,shopifyHostname:n},ae.RandmarSKU)):jsxRuntime.jsxs(Alert,{variant:"warning",className:"col-span-1 @md:col-span-2",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Warning"}),jsxRuntime.jsx(AlertDescription,{children:"No products found for this manufacturer category."})]})}),jsxRuntime.jsx(Dialog,{open:b,onOpenChange:S,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the category "',j(),'" to Shopify? This will add all products in this category to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:I,disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})})]})}function PartnerRelationshipPage({applicationId:t,partnerId:e,userEmail:n,shopifyHostName:o,isSuperAdmin:l}){var q,z,Q;const{data:d}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t}),{data:f,isLoading:g,isFetching:b}=useGetV4PartnerByRouteApplicationIdPartnerAndPartnerIdQuery({routeApplicationId:t,partnerId:e,withSpecification:!0}),{toast:S}=useToast(),[_]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdShopifyMutation(),[R,C]=React.useState(!1),[E,A]=React.useState(!1),M=async()=>{try{C(!0),A(!1),await _({routeResellerId:t??"",manufacturerId:e??"",shopifyHostName:o}).unwrap()&&S({title:"Success",description:"Manufacturer synced to Shopify successfully",variant:"success"})}catch(F){console.error("Error syncing to Shopify:",F),S({title:"Error",description:"Error syncing manufacturer to Shopify.",variant:"destructive"})}finally{C(!1)}},I=()=>f!=null&&f.Reseller?"reseller-overview":f!=null&&f.Manufacturer?"manufacturer-overview":"",j=React.useMemo(()=>!d||!f?"":`
1149
1149
  Act as a business analyst. Your task is to provide a short, high-level summary
1150
1150
  of the relationship between the two companies described in the JSON data below.
1151
1151
  Suggest how these two entities can best work together.
@@ -1425,4 +1425,4 @@ img.ProseMirror-separator {
1425
1425
  \`\`\`json
1426
1426
  ${JSON.stringify(e,null,2)}
1427
1427
  \`\`\`
1428
- `:"",[t,e]);return n?jsxRuntime.jsx("div",{className:"flex w-full justify-center items-center py-24",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):t&&e.length===0?jsxRuntime.jsx("div",{className:"flex w-full justify-center items-start pt-16",children:jsxRuntime.jsx(Card,{className:"w-full max-w-lg",children:jsxRuntime.jsxs(CardHeader,{className:"text-center items-center",children:[jsxRuntime.jsx("div",{className:"rounded-full border bg-muted p-3 mb-4",children:jsxRuntime.jsx(SearchX,{className:"h-8 w-8 text-muted-foreground"})}),jsxRuntime.jsx(CardTitle,{children:"No Results Found"}),jsxRuntime.jsxs(CardDescription,{children:['Your search for "',t,'" did not return any results. Please try a different search term.']})]})})}):e.length>0?jsxRuntime.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[jsxRuntime.jsx("div",{className:"col-span-3 xl:col-span-2",children:o}),jsxRuntime.jsx("aside",{className:"col-span-1 block bg-white rounded-xl collapse xl:visible",children:jsxRuntime.jsx("div",{className:"sticky top-16",children:jsxRuntime.jsx("div",{className:"p-6",children:jsxRuntime.jsx(AssistantInsight,{prompt:l,thinkingPlaceholderText:"Analyzing search results...",withCard:!1})})})})]}):null},colClasses={base:{1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6"},sm:{1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},md:{1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6"},lg:{1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6"},xl:{1:"xl:grid-cols-1",2:"xl:grid-cols-2",3:"xl:grid-cols-3",4:"xl:grid-cols-4",5:"xl:grid-cols-5",6:"xl:grid-cols-6"}},buildGridClassName=t=>{const e={base:1,md:2,...t};return["grid","gap-4",e.base?colClasses.base[e.base]:"",e.sm?colClasses.sm[e.sm]:"",e.md?colClasses.md[e.md]:"",e.lg?colClasses.lg[e.lg]:"",e.xl?colClasses.xl[e.xl]:""].filter(Boolean).join(" ")},SearchPageGrid=({results:t,groupBy:e,renderItem:n})=>{const o=e(t);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Object.entries(o).map(([l,d])=>{const{items:f,gridCols:g}=d;if(f.length===0)return null;const b=buildGridClassName(g);return jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx("h2",{className:"text-xl font-semibold tracking-tight mb-4",children:l}),jsxRuntime.jsx("div",{className:b,children:f.map((S,_)=>n(S,_))})]},l)})})};var COLLAPSIBLE_NAME="Collapsible",[createCollapsibleContext,createCollapsibleScope]=createContextScope(COLLAPSIBLE_NAME),[CollapsibleProvider,useCollapsibleContext]=createCollapsibleContext(COLLAPSIBLE_NAME),Collapsible=React__namespace.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:o,defaultOpen:l,disabled:d,onOpenChange:f,...g}=t,[b,S]=useControllableState({prop:o,defaultProp:l??!1,onChange:f,caller:COLLAPSIBLE_NAME});return jsxRuntime.jsx(CollapsibleProvider,{scope:n,disabled:d,contentId:useId(),open:b,onOpenToggle:React__namespace.useCallback(()=>S(_=>!_),[S]),children:jsxRuntime.jsx(Primitive.div,{"data-state":getState$1(b),"data-disabled":d?"":void 0,...g,ref:e})})});Collapsible.displayName=COLLAPSIBLE_NAME;var TRIGGER_NAME$1="CollapsibleTrigger",CollapsibleTrigger=React__namespace.forwardRef((t,e)=>{const{__scopeCollapsible:n,...o}=t,l=useCollapsibleContext(TRIGGER_NAME$1,n);return jsxRuntime.jsx(Primitive.button,{type:"button","aria-controls":l.contentId,"aria-expanded":l.open||!1,"data-state":getState$1(l.open),"data-disabled":l.disabled?"":void 0,disabled:l.disabled,...o,ref:e,onClick:composeEventHandlers(t.onClick,l.onOpenToggle)})});CollapsibleTrigger.displayName=TRIGGER_NAME$1;var CONTENT_NAME$1="CollapsibleContent",CollapsibleContent=React__namespace.forwardRef((t,e)=>{const{forceMount:n,...o}=t,l=useCollapsibleContext(CONTENT_NAME$1,t.__scopeCollapsible);return jsxRuntime.jsx(Presence,{present:n||l.open,children:({present:d})=>jsxRuntime.jsx(CollapsibleContentImpl,{...o,ref:e,present:d})})});CollapsibleContent.displayName=CONTENT_NAME$1;var CollapsibleContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:o,children:l,...d}=t,f=useCollapsibleContext(CONTENT_NAME$1,n),[g,b]=React__namespace.useState(o),S=React__namespace.useRef(null),_=useComposedRefs(e,S),R=React__namespace.useRef(0),C=R.current,E=React__namespace.useRef(0),A=E.current,M=f.open||g,I=React__namespace.useRef(M),j=React__namespace.useRef(void 0);return React__namespace.useEffect(()=>{const q=requestAnimationFrame(()=>I.current=!1);return()=>cancelAnimationFrame(q)},[]),useLayoutEffect2(()=>{const q=S.current;if(q){j.current=j.current||{transitionDuration:q.style.transitionDuration,animationName:q.style.animationName},q.style.transitionDuration="0s",q.style.animationName="none";const z=q.getBoundingClientRect();R.current=z.height,E.current=z.width,I.current||(q.style.transitionDuration=j.current.transitionDuration,q.style.animationName=j.current.animationName),b(o)}},[f.open,o]),jsxRuntime.jsx(Primitive.div,{"data-state":getState$1(f.open),"data-disabled":f.disabled?"":void 0,id:f.contentId,hidden:!M,...d,ref:_,style:{"--radix-collapsible-content-height":C?`${C}px`:void 0,"--radix-collapsible-content-width":A?`${A}px`:void 0,...t.style},children:M&&l})});function getState$1(t){return t?"open":"closed"}var Root=Collapsible,Trigger=CollapsibleTrigger,Content=CollapsibleContent,ACCORDION_NAME="Accordion",ACCORDION_KEYS=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Collection,useCollection,createCollectionScope]=createCollection(ACCORDION_NAME),[createAccordionContext,createAccordionScope]=createContextScope(ACCORDION_NAME,[createCollectionScope,createCollapsibleScope]),useCollapsibleScope=createCollapsibleScope(),Accordion$1=React.forwardRef((t,e)=>{const{type:n,...o}=t,l=o,d=o;return jsxRuntime.jsx(Collection.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?jsxRuntime.jsx(AccordionImplMultiple,{...d,ref:e}):jsxRuntime.jsx(AccordionImplSingle,{...l,ref:e})})});Accordion$1.displayName=ACCORDION_NAME;var[AccordionValueProvider,useAccordionValueContext]=createAccordionContext(ACCORDION_NAME),[AccordionCollapsibleProvider,useAccordionCollapsibleContext]=createAccordionContext(ACCORDION_NAME,{collapsible:!1}),AccordionImplSingle=React.forwardRef((t,e)=>{const{value:n,defaultValue:o,onValueChange:l=()=>{},collapsible:d=!1,...f}=t,[g,b]=useControllableState({prop:n,defaultProp:o??"",onChange:l,caller:ACCORDION_NAME});return jsxRuntime.jsx(AccordionValueProvider,{scope:t.__scopeAccordion,value:React.useMemo(()=>g?[g]:[],[g]),onItemOpen:b,onItemClose:React.useCallback(()=>d&&b(""),[d,b]),children:jsxRuntime.jsx(AccordionCollapsibleProvider,{scope:t.__scopeAccordion,collapsible:d,children:jsxRuntime.jsx(AccordionImpl,{...f,ref:e})})})}),AccordionImplMultiple=React.forwardRef((t,e)=>{const{value:n,defaultValue:o,onValueChange:l=()=>{},...d}=t,[f,g]=useControllableState({prop:n,defaultProp:o??[],onChange:l,caller:ACCORDION_NAME}),b=React.useCallback(_=>g((R=[])=>[...R,_]),[g]),S=React.useCallback(_=>g((R=[])=>R.filter(C=>C!==_)),[g]);return jsxRuntime.jsx(AccordionValueProvider,{scope:t.__scopeAccordion,value:f,onItemOpen:b,onItemClose:S,children:jsxRuntime.jsx(AccordionCollapsibleProvider,{scope:t.__scopeAccordion,collapsible:!0,children:jsxRuntime.jsx(AccordionImpl,{...d,ref:e})})})}),[AccordionImplProvider,useAccordionContext]=createAccordionContext(ACCORDION_NAME),AccordionImpl=React.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:o,dir:l,orientation:d="vertical",...f}=t,g=React.useRef(null),b=useComposedRefs(g,e),S=useCollection(n),R=useDirection(l)==="ltr",C=composeEventHandlers(t.onKeyDown,E=>{var ne;if(!ACCORDION_KEYS.includes(E.key))return;const A=E.target,M=S().filter(ae=>{var ge;return!((ge=ae.ref.current)!=null&&ge.disabled)}),I=M.findIndex(ae=>ae.ref.current===A),j=M.length;if(I===-1)return;E.preventDefault();let q=I;const z=0,Q=j-1,F=()=>{q=I+1,q>Q&&(q=z)},O=()=>{q=I-1,q<z&&(q=Q)};switch(E.key){case"Home":q=z;break;case"End":q=Q;break;case"ArrowRight":d==="horizontal"&&(R?F():O());break;case"ArrowDown":d==="vertical"&&F();break;case"ArrowLeft":d==="horizontal"&&(R?O():F());break;case"ArrowUp":d==="vertical"&&O();break}const te=q%j;(ne=M[te].ref.current)==null||ne.focus()});return jsxRuntime.jsx(AccordionImplProvider,{scope:n,disabled:o,direction:l,orientation:d,children:jsxRuntime.jsx(Collection.Slot,{scope:n,children:jsxRuntime.jsx(Primitive.div,{...f,"data-orientation":d,ref:b,onKeyDown:o?void 0:C})})})}),ITEM_NAME="AccordionItem",[AccordionItemProvider,useAccordionItemContext]=createAccordionContext(ITEM_NAME),AccordionItem$1=React.forwardRef((t,e)=>{const{__scopeAccordion:n,value:o,...l}=t,d=useAccordionContext(ITEM_NAME,n),f=useAccordionValueContext(ITEM_NAME,n),g=useCollapsibleScope(n),b=useId(),S=o&&f.value.includes(o)||!1,_=d.disabled||t.disabled;return jsxRuntime.jsx(AccordionItemProvider,{scope:n,open:S,disabled:_,triggerId:b,children:jsxRuntime.jsx(Root,{"data-orientation":d.orientation,"data-state":getState(S),...g,...l,ref:e,disabled:_,open:S,onOpenChange:R=>{R?f.onItemOpen(o):f.onItemClose(o)}})})});AccordionItem$1.displayName=ITEM_NAME;var HEADER_NAME="AccordionHeader",AccordionHeader=React.forwardRef((t,e)=>{const{__scopeAccordion:n,...o}=t,l=useAccordionContext(ACCORDION_NAME,n),d=useAccordionItemContext(HEADER_NAME,n);return jsxRuntime.jsx(Primitive.h3,{"data-orientation":l.orientation,"data-state":getState(d.open),"data-disabled":d.disabled?"":void 0,...o,ref:e})});AccordionHeader.displayName=HEADER_NAME;var TRIGGER_NAME="AccordionTrigger",AccordionTrigger$1=React.forwardRef((t,e)=>{const{__scopeAccordion:n,...o}=t,l=useAccordionContext(ACCORDION_NAME,n),d=useAccordionItemContext(TRIGGER_NAME,n),f=useAccordionCollapsibleContext(TRIGGER_NAME,n),g=useCollapsibleScope(n);return jsxRuntime.jsx(Collection.ItemSlot,{scope:n,children:jsxRuntime.jsx(Trigger,{"aria-disabled":d.open&&!f.collapsible||void 0,"data-orientation":l.orientation,id:d.triggerId,...g,...o,ref:e})})});AccordionTrigger$1.displayName=TRIGGER_NAME;var CONTENT_NAME="AccordionContent",AccordionContent$1=React.forwardRef((t,e)=>{const{__scopeAccordion:n,...o}=t,l=useAccordionContext(ACCORDION_NAME,n),d=useAccordionItemContext(CONTENT_NAME,n),f=useCollapsibleScope(n);return jsxRuntime.jsx(Content,{role:"region","aria-labelledby":d.triggerId,"data-orientation":l.orientation,...f,...o,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});AccordionContent$1.displayName=CONTENT_NAME;function getState(t){return t?"open":"closed"}var Root2=Accordion$1,Item=AccordionItem$1,Header=AccordionHeader,Trigger2=AccordionTrigger$1,Content2=AccordionContent$1;const Accordion=Root2,AccordionItem=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Item,{ref:n,className:cn("border-b",t),...e}));AccordionItem.displayName="AccordionItem";const AccordionTrigger=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsx(Header,{className:"flex",children:jsxRuntime.jsxs(Trigger2,{ref:o,className:cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",t),...n,children:[e,jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));AccordionTrigger.displayName=Trigger2.displayName;const AccordionContent=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsx(Content2,{ref:o,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:jsxRuntime.jsx("div",{className:cn("pb-4 pt-0",t),children:e})}));AccordionContent.displayName=Content2.displayName,exports.Accordion=Accordion,exports.AccordionContent=AccordionContent,exports.AccordionItem=AccordionItem,exports.AccordionTrigger=AccordionTrigger,exports.ActiveOrdersCard=ActiveOrdersCard,exports.AiGeneratedContent=AiGeneratedContent,exports.Alert=Alert,exports.AlertDescription=AlertDescription,exports.AlertDialog=AlertDialog,exports.AlertDialogAction=AlertDialogAction,exports.AlertDialogCancel=AlertDialogCancel,exports.AlertDialogContent=AlertDialogContent,exports.AlertDialogDescription=AlertDialogDescription,exports.AlertDialogFooter=AlertDialogFooter,exports.AlertDialogHeader=AlertDialogHeader,exports.AlertDialogTitle=AlertDialogTitle,exports.AlertDialogTrigger=AlertDialogTrigger,exports.AlertTitle=AlertTitle,exports.AreaChart=AreaChart,exports.AssistantChat=AssistantChat,exports.AssistantInsight=AssistantInsight,exports.Avatar=Avatar,exports.AvatarFallback=AvatarFallback,exports.AvatarFooter=AvatarFooter,exports.AvatarImage=AvatarImage,exports.Badge=Badge,exports.Button=Button,exports.Card=Card,exports.CardContent=CardContent,exports.CardDescription=CardDescription,exports.CardFooter=CardFooter,exports.CardHeader=CardHeader,exports.CardTitle=CardTitle,exports.ChatLayout=ChatLayout,exports.ChatProvider=ChatProvider,exports.Checkbox=Checkbox,exports.Command=Command,exports.CommandDialog=CommandDialog,exports.CommandEmpty=CommandEmpty,exports.CommandGroup=CommandGroup,exports.CommandInput=CommandInput,exports.CommandItem=CommandItem,exports.CommandList=CommandList,exports.CommandSeparator=CommandSeparator,exports.CommandShortcut=CommandShortcut,exports.CountryFlag=CountryFlag,exports.DataTable=DataTable,exports.Dialog=Dialog,exports.DialogClose=DialogClose,exports.DialogContent=DialogContent,exports.DialogDescription=DialogDescription,exports.DialogFooter=DialogFooter,exports.DialogHeader=DialogHeader,exports.DialogOverlay=DialogOverlay,exports.DialogPortal=DialogPortal,exports.DialogTitle=DialogTitle,exports.DialogTrigger=DialogTrigger,exports.DropdownMenu=DropdownMenu,exports.DropdownMenuCheckboxItem=DropdownMenuCheckboxItem,exports.DropdownMenuContent=DropdownMenuContent,exports.DropdownMenuGroup=DropdownMenuGroup,exports.DropdownMenuItem=DropdownMenuItem,exports.DropdownMenuLabel=DropdownMenuLabel,exports.DropdownMenuPortal=DropdownMenuPortal,exports.DropdownMenuRadioGroup=DropdownMenuRadioGroup,exports.DropdownMenuRadioItem=DropdownMenuRadioItem,exports.DropdownMenuSeparator=DropdownMenuSeparator,exports.DropdownMenuShortcut=DropdownMenuShortcut,exports.DropdownMenuSub=DropdownMenuSub,exports.DropdownMenuSubContent=DropdownMenuSubContent,exports.DropdownMenuSubTrigger=DropdownMenuSubTrigger,exports.DropdownMenuTrigger=DropdownMenuTrigger,exports.ExploreManufacturers=ExploreManufacturers,exports.ExternalProductCard=ExternalProductCard,exports.GeminiApiKeyProvider=GeminiApiKeyProvider,exports.GeneralDocumentCard=GeneralDocumentCard,exports.Input=Input,exports.InputOTP=InputOTP,exports.InputOTPGroup=InputOTPGroup,exports.InputOTPSeparator=InputOTPSeparator,exports.InputOTPSlot=InputOTPSlot,exports.Label=Label$2,exports.Layout=Layout,exports.ManufacturerCard=ManufacturerCard,exports.ManufacturerGetStartedButton=ManufacturerGetStartedButton,exports.ManufacturerOverviewPage=ManufacturerOverviewPage,exports.ManufacturerReorderingCard=ManufacturerReorderingCard,exports.MultiSelect=MultiSelect,exports.Navbar=Navbar,exports.OpportunitiesTable=OpportunitiesTable,exports.PageHeader=PageHeader,exports.PartnerCard=PartnerCard,exports.PartnerRelationshipPage=PartnerRelationshipPage,exports.Popover=Popover,exports.PopoverAnchor=PopoverAnchor,exports.PopoverContent=PopoverContent,exports.PopoverTrigger=PopoverTrigger,exports.Preloader=Preloader,exports.ProductCard=ProductCard,exports.ProductImage=ProductImage,exports.ProductInventoryGrid=ProductInventoryGrid,exports.ProductOverviewPage=ProductOverviewPage,exports.Progress=Progress,exports.RadioGroup=RadioGroup$1,exports.RadioGroupItem=RadioGroupItem,exports.ResellerBillingOverviewCard=ResellerBillingOverviewCard,exports.ResellerCard=ResellerCard,exports.ResellerOverview=ResellerOverview,exports.ResellerQualificationsCard=ResellerQualificationsCard,exports.ReturnsTable=ReturnsTable,exports.RichTextEditor=RichTextEditor,exports.SalesChart=SalesChart,exports.SalesOverviewCard=SalesOverviewCard,exports.ScrollArea=ScrollArea,exports.ScrollBar=ScrollBar,exports.SearchPage=SearchPage,exports.SearchPageGrid=SearchPageGrid,exports.Select=Select,exports.SelectContent=SelectContent,exports.SelectGroup=SelectGroup,exports.SelectItem=SelectItem,exports.SelectLabel=SelectLabel,exports.SelectScrollDownButton=SelectScrollDownButton,exports.SelectScrollUpButton=SelectScrollUpButton,exports.SelectTrigger=SelectTrigger,exports.SelectValue=SelectValue,exports.Separator=Separator$1,exports.Sheet=Sheet,exports.SheetClose=SheetClose,exports.SheetContent=SheetContent,exports.SheetDescription=SheetDescription,exports.SheetFooter=SheetFooter,exports.SheetHeader=SheetHeader,exports.SheetOverlay=SheetOverlay,exports.SheetPortal=SheetPortal,exports.SheetTitle=SheetTitle,exports.SheetTrigger=SheetTrigger,exports.Sidebar=Sidebar,exports.SidebarContent=SidebarContent,exports.SidebarFooter=SidebarFooter,exports.SidebarGroup=SidebarGroup,exports.SidebarGroupAction=SidebarGroupAction,exports.SidebarGroupContent=SidebarGroupContent,exports.SidebarGroupLabel=SidebarGroupLabel,exports.SidebarHeader=SidebarHeader,exports.SidebarInput=SidebarInput,exports.SidebarInset=SidebarInset,exports.SidebarMenu=SidebarMenu,exports.SidebarMenuAction=SidebarMenuAction,exports.SidebarMenuBadge=SidebarMenuBadge,exports.SidebarMenuButton=SidebarMenuButton,exports.SidebarMenuItem=SidebarMenuItem,exports.SidebarMenuSkeleton=SidebarMenuSkeleton,exports.SidebarMenuSub=SidebarMenuSub,exports.SidebarMenuSubButton=SidebarMenuSubButton,exports.SidebarMenuSubItem=SidebarMenuSubItem,exports.SidebarProvider=SidebarProvider,exports.SidebarRail=SidebarRail,exports.SidebarSeparator=SidebarSeparator,exports.SidebarTrigger=SidebarTrigger,exports.Skeleton=Skeleton,exports.Switch=Switch,exports.Table=Table,exports.TableBody=TableBody,exports.TableCaption=TableCaption,exports.TableCell=TableCell,exports.TableFooter=TableFooter,exports.TableHead=TableHead,exports.TableHeader=TableHeader,exports.TableRow=TableRow,exports.Tabs=Tabs,exports.TabsContent=TabsContent,exports.TabsList=TabsList,exports.TabsTrigger=TabsTrigger,exports.Textarea=Textarea,exports.Toast=Toast,exports.ToastAction=ToastAction,exports.ToastClose=ToastClose,exports.ToastDescription=ToastDescription,exports.ToastProvider=ToastProvider,exports.ToastTitle=ToastTitle,exports.ToastViewport=ToastViewport,exports.Toaster=Toaster,exports.Tooltip=Tooltip$1,exports.TooltipContent=TooltipContent,exports.TooltipProvider=TooltipProvider,exports.TooltipTrigger=TooltipTrigger,exports.TopPercentTreemap=TopPercentTreemap,exports.Topbar=Topbar,exports.Treemap=Treemap,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.formatMoney=formatMoney,exports.formatNumber=formatNumber,exports.formatYYYYMMDDIntToDateString=formatYYYYMMDDIntToDateString,exports.toast=toast,exports.useChat=useChat,exports.useGeminiApiKey=useGeminiApiKey,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
1428
+ `:"",[t,e]);return n?jsxRuntime.jsx("div",{className:"flex w-full justify-center items-center py-24",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):t&&e.length===0?jsxRuntime.jsx("div",{className:"flex w-full justify-center items-start pt-16",children:jsxRuntime.jsx(Card,{className:"w-full max-w-lg",children:jsxRuntime.jsxs(CardHeader,{className:"text-center items-center",children:[jsxRuntime.jsx("div",{className:"rounded-full border bg-muted p-3 mb-4",children:jsxRuntime.jsx(SearchX,{className:"h-8 w-8 text-muted-foreground"})}),jsxRuntime.jsx(CardTitle,{children:"No Results Found"}),jsxRuntime.jsxs(CardDescription,{children:['Your search for "',t,'" did not return any results. Please try a different search term.']})]})})}):e.length>0?jsxRuntime.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[jsxRuntime.jsx("div",{className:"col-span-3 xl:col-span-2",children:o}),jsxRuntime.jsx("aside",{className:"col-span-1 block bg-white rounded-xl collapse xl:visible",children:jsxRuntime.jsx("div",{className:"sticky top-16",children:jsxRuntime.jsx("div",{className:"p-6",children:jsxRuntime.jsx(AssistantInsight,{prompt:l,thinkingPlaceholderText:"Analyzing search results...",withCard:!1})})})})]}):null},colClasses={base:{1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6"},sm:{1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},md:{1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6"},lg:{1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6"},xl:{1:"xl:grid-cols-1",2:"xl:grid-cols-2",3:"xl:grid-cols-3",4:"xl:grid-cols-4",5:"xl:grid-cols-5",6:"xl:grid-cols-6"}},buildGridClassName=t=>{const e={base:1,md:2,...t};return["grid","gap-4",e.base?colClasses.base[e.base]:"",e.sm?colClasses.sm[e.sm]:"",e.md?colClasses.md[e.md]:"",e.lg?colClasses.lg[e.lg]:"",e.xl?colClasses.xl[e.xl]:""].filter(Boolean).join(" ")},SearchPageGrid=({results:t,groupBy:e,renderItem:n})=>{const o=e(t);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Object.entries(o).map(([l,d])=>{const{items:f,gridCols:g}=d;if(f.length===0)return null;const b=buildGridClassName(g);return jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx("h2",{className:"text-xl font-semibold tracking-tight mb-4",children:l}),jsxRuntime.jsx("div",{className:b,children:f.map((S,_)=>n(S,_))})]},l)})})};var COLLAPSIBLE_NAME="Collapsible",[createCollapsibleContext,createCollapsibleScope]=createContextScope(COLLAPSIBLE_NAME),[CollapsibleProvider,useCollapsibleContext]=createCollapsibleContext(COLLAPSIBLE_NAME),Collapsible=React__namespace.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:o,defaultOpen:l,disabled:d,onOpenChange:f,...g}=t,[b,S]=useControllableState({prop:o,defaultProp:l??!1,onChange:f,caller:COLLAPSIBLE_NAME});return jsxRuntime.jsx(CollapsibleProvider,{scope:n,disabled:d,contentId:useId(),open:b,onOpenToggle:React__namespace.useCallback(()=>S(_=>!_),[S]),children:jsxRuntime.jsx(Primitive.div,{"data-state":getState$1(b),"data-disabled":d?"":void 0,...g,ref:e})})});Collapsible.displayName=COLLAPSIBLE_NAME;var TRIGGER_NAME$1="CollapsibleTrigger",CollapsibleTrigger=React__namespace.forwardRef((t,e)=>{const{__scopeCollapsible:n,...o}=t,l=useCollapsibleContext(TRIGGER_NAME$1,n);return jsxRuntime.jsx(Primitive.button,{type:"button","aria-controls":l.contentId,"aria-expanded":l.open||!1,"data-state":getState$1(l.open),"data-disabled":l.disabled?"":void 0,disabled:l.disabled,...o,ref:e,onClick:composeEventHandlers(t.onClick,l.onOpenToggle)})});CollapsibleTrigger.displayName=TRIGGER_NAME$1;var CONTENT_NAME$1="CollapsibleContent",CollapsibleContent=React__namespace.forwardRef((t,e)=>{const{forceMount:n,...o}=t,l=useCollapsibleContext(CONTENT_NAME$1,t.__scopeCollapsible);return jsxRuntime.jsx(Presence,{present:n||l.open,children:({present:d})=>jsxRuntime.jsx(CollapsibleContentImpl,{...o,ref:e,present:d})})});CollapsibleContent.displayName=CONTENT_NAME$1;var CollapsibleContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:o,children:l,...d}=t,f=useCollapsibleContext(CONTENT_NAME$1,n),[g,b]=React__namespace.useState(o),S=React__namespace.useRef(null),_=useComposedRefs(e,S),R=React__namespace.useRef(0),C=R.current,E=React__namespace.useRef(0),A=E.current,M=f.open||g,I=React__namespace.useRef(M),j=React__namespace.useRef(void 0);return React__namespace.useEffect(()=>{const q=requestAnimationFrame(()=>I.current=!1);return()=>cancelAnimationFrame(q)},[]),useLayoutEffect2(()=>{const q=S.current;if(q){j.current=j.current||{transitionDuration:q.style.transitionDuration,animationName:q.style.animationName},q.style.transitionDuration="0s",q.style.animationName="none";const z=q.getBoundingClientRect();R.current=z.height,E.current=z.width,I.current||(q.style.transitionDuration=j.current.transitionDuration,q.style.animationName=j.current.animationName),b(o)}},[f.open,o]),jsxRuntime.jsx(Primitive.div,{"data-state":getState$1(f.open),"data-disabled":f.disabled?"":void 0,id:f.contentId,hidden:!M,...d,ref:_,style:{"--radix-collapsible-content-height":C?`${C}px`:void 0,"--radix-collapsible-content-width":A?`${A}px`:void 0,...t.style},children:M&&l})});function getState$1(t){return t?"open":"closed"}var Root=Collapsible,Trigger=CollapsibleTrigger,Content=CollapsibleContent,ACCORDION_NAME="Accordion",ACCORDION_KEYS=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Collection,useCollection,createCollectionScope]=createCollection(ACCORDION_NAME),[createAccordionContext,createAccordionScope]=createContextScope(ACCORDION_NAME,[createCollectionScope,createCollapsibleScope]),useCollapsibleScope=createCollapsibleScope(),Accordion$1=React.forwardRef((t,e)=>{const{type:n,...o}=t,l=o,d=o;return jsxRuntime.jsx(Collection.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?jsxRuntime.jsx(AccordionImplMultiple,{...d,ref:e}):jsxRuntime.jsx(AccordionImplSingle,{...l,ref:e})})});Accordion$1.displayName=ACCORDION_NAME;var[AccordionValueProvider,useAccordionValueContext]=createAccordionContext(ACCORDION_NAME),[AccordionCollapsibleProvider,useAccordionCollapsibleContext]=createAccordionContext(ACCORDION_NAME,{collapsible:!1}),AccordionImplSingle=React.forwardRef((t,e)=>{const{value:n,defaultValue:o,onValueChange:l=()=>{},collapsible:d=!1,...f}=t,[g,b]=useControllableState({prop:n,defaultProp:o??"",onChange:l,caller:ACCORDION_NAME});return jsxRuntime.jsx(AccordionValueProvider,{scope:t.__scopeAccordion,value:React.useMemo(()=>g?[g]:[],[g]),onItemOpen:b,onItemClose:React.useCallback(()=>d&&b(""),[d,b]),children:jsxRuntime.jsx(AccordionCollapsibleProvider,{scope:t.__scopeAccordion,collapsible:d,children:jsxRuntime.jsx(AccordionImpl,{...f,ref:e})})})}),AccordionImplMultiple=React.forwardRef((t,e)=>{const{value:n,defaultValue:o,onValueChange:l=()=>{},...d}=t,[f,g]=useControllableState({prop:n,defaultProp:o??[],onChange:l,caller:ACCORDION_NAME}),b=React.useCallback(_=>g((R=[])=>[...R,_]),[g]),S=React.useCallback(_=>g((R=[])=>R.filter(C=>C!==_)),[g]);return jsxRuntime.jsx(AccordionValueProvider,{scope:t.__scopeAccordion,value:f,onItemOpen:b,onItemClose:S,children:jsxRuntime.jsx(AccordionCollapsibleProvider,{scope:t.__scopeAccordion,collapsible:!0,children:jsxRuntime.jsx(AccordionImpl,{...d,ref:e})})})}),[AccordionImplProvider,useAccordionContext]=createAccordionContext(ACCORDION_NAME),AccordionImpl=React.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:o,dir:l,orientation:d="vertical",...f}=t,g=React.useRef(null),b=useComposedRefs(g,e),S=useCollection(n),R=useDirection(l)==="ltr",C=composeEventHandlers(t.onKeyDown,E=>{var ne;if(!ACCORDION_KEYS.includes(E.key))return;const A=E.target,M=S().filter(ae=>{var ge;return!((ge=ae.ref.current)!=null&&ge.disabled)}),I=M.findIndex(ae=>ae.ref.current===A),j=M.length;if(I===-1)return;E.preventDefault();let q=I;const z=0,Q=j-1,F=()=>{q=I+1,q>Q&&(q=z)},O=()=>{q=I-1,q<z&&(q=Q)};switch(E.key){case"Home":q=z;break;case"End":q=Q;break;case"ArrowRight":d==="horizontal"&&(R?F():O());break;case"ArrowDown":d==="vertical"&&F();break;case"ArrowLeft":d==="horizontal"&&(R?O():F());break;case"ArrowUp":d==="vertical"&&O();break}const te=q%j;(ne=M[te].ref.current)==null||ne.focus()});return jsxRuntime.jsx(AccordionImplProvider,{scope:n,disabled:o,direction:l,orientation:d,children:jsxRuntime.jsx(Collection.Slot,{scope:n,children:jsxRuntime.jsx(Primitive.div,{...f,"data-orientation":d,ref:b,onKeyDown:o?void 0:C})})})}),ITEM_NAME="AccordionItem",[AccordionItemProvider,useAccordionItemContext]=createAccordionContext(ITEM_NAME),AccordionItem$1=React.forwardRef((t,e)=>{const{__scopeAccordion:n,value:o,...l}=t,d=useAccordionContext(ITEM_NAME,n),f=useAccordionValueContext(ITEM_NAME,n),g=useCollapsibleScope(n),b=useId(),S=o&&f.value.includes(o)||!1,_=d.disabled||t.disabled;return jsxRuntime.jsx(AccordionItemProvider,{scope:n,open:S,disabled:_,triggerId:b,children:jsxRuntime.jsx(Root,{"data-orientation":d.orientation,"data-state":getState(S),...g,...l,ref:e,disabled:_,open:S,onOpenChange:R=>{R?f.onItemOpen(o):f.onItemClose(o)}})})});AccordionItem$1.displayName=ITEM_NAME;var HEADER_NAME="AccordionHeader",AccordionHeader=React.forwardRef((t,e)=>{const{__scopeAccordion:n,...o}=t,l=useAccordionContext(ACCORDION_NAME,n),d=useAccordionItemContext(HEADER_NAME,n);return jsxRuntime.jsx(Primitive.h3,{"data-orientation":l.orientation,"data-state":getState(d.open),"data-disabled":d.disabled?"":void 0,...o,ref:e})});AccordionHeader.displayName=HEADER_NAME;var TRIGGER_NAME="AccordionTrigger",AccordionTrigger$1=React.forwardRef((t,e)=>{const{__scopeAccordion:n,...o}=t,l=useAccordionContext(ACCORDION_NAME,n),d=useAccordionItemContext(TRIGGER_NAME,n),f=useAccordionCollapsibleContext(TRIGGER_NAME,n),g=useCollapsibleScope(n);return jsxRuntime.jsx(Collection.ItemSlot,{scope:n,children:jsxRuntime.jsx(Trigger,{"aria-disabled":d.open&&!f.collapsible||void 0,"data-orientation":l.orientation,id:d.triggerId,...g,...o,ref:e})})});AccordionTrigger$1.displayName=TRIGGER_NAME;var CONTENT_NAME="AccordionContent",AccordionContent$1=React.forwardRef((t,e)=>{const{__scopeAccordion:n,...o}=t,l=useAccordionContext(ACCORDION_NAME,n),d=useAccordionItemContext(CONTENT_NAME,n),f=useCollapsibleScope(n);return jsxRuntime.jsx(Content,{role:"region","aria-labelledby":d.triggerId,"data-orientation":l.orientation,...f,...o,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});AccordionContent$1.displayName=CONTENT_NAME;function getState(t){return t?"open":"closed"}var Root2=Accordion$1,Item=AccordionItem$1,Header=AccordionHeader,Trigger2=AccordionTrigger$1,Content2=AccordionContent$1;const Accordion=Root2,AccordionItem=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Item,{ref:n,className:cn("border-b",t),...e}));AccordionItem.displayName="AccordionItem";const AccordionTrigger=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsx(Header,{className:"flex",children:jsxRuntime.jsxs(Trigger2,{ref:o,className:cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",t),...n,children:[e,jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));AccordionTrigger.displayName=Trigger2.displayName;const AccordionContent=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsx(Content2,{ref:o,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:jsxRuntime.jsx("div",{className:cn("pb-4 pt-0",t),children:e})}));AccordionContent.displayName=Content2.displayName,exports.Accordion=Accordion,exports.AccordionContent=AccordionContent,exports.AccordionItem=AccordionItem,exports.AccordionTrigger=AccordionTrigger,exports.ActiveOrdersCard=ActiveOrdersCard,exports.AiGeneratedContent=AiGeneratedContent,exports.Alert=Alert,exports.AlertDescription=AlertDescription,exports.AlertDialog=AlertDialog,exports.AlertDialogAction=AlertDialogAction,exports.AlertDialogCancel=AlertDialogCancel,exports.AlertDialogContent=AlertDialogContent,exports.AlertDialogDescription=AlertDialogDescription,exports.AlertDialogFooter=AlertDialogFooter,exports.AlertDialogHeader=AlertDialogHeader,exports.AlertDialogTitle=AlertDialogTitle,exports.AlertDialogTrigger=AlertDialogTrigger,exports.AlertTitle=AlertTitle,exports.AreaChart=AreaChart,exports.AssistantChat=AssistantChat,exports.AssistantInsight=AssistantInsight,exports.Avatar=Avatar,exports.AvatarFallback=AvatarFallback,exports.AvatarFooter=AvatarFooter,exports.AvatarImage=AvatarImage,exports.Badge=Badge,exports.Button=Button,exports.Card=Card,exports.CardContent=CardContent,exports.CardDescription=CardDescription,exports.CardFooter=CardFooter,exports.CardHeader=CardHeader,exports.CardTitle=CardTitle,exports.ChatLayout=ChatLayout,exports.ChatProvider=ChatProvider,exports.Checkbox=Checkbox,exports.Command=Command,exports.CommandDialog=CommandDialog,exports.CommandEmpty=CommandEmpty,exports.CommandGroup=CommandGroup,exports.CommandInput=CommandInput,exports.CommandItem=CommandItem,exports.CommandList=CommandList,exports.CommandSeparator=CommandSeparator,exports.CommandShortcut=CommandShortcut,exports.CountryFlag=CountryFlag,exports.DataTable=DataTable,exports.Dialog=Dialog,exports.DialogClose=DialogClose,exports.DialogContent=DialogContent,exports.DialogDescription=DialogDescription,exports.DialogFooter=DialogFooter,exports.DialogHeader=DialogHeader,exports.DialogOverlay=DialogOverlay,exports.DialogPortal=DialogPortal,exports.DialogTitle=DialogTitle,exports.DialogTrigger=DialogTrigger,exports.DropdownMenu=DropdownMenu,exports.DropdownMenuCheckboxItem=DropdownMenuCheckboxItem,exports.DropdownMenuContent=DropdownMenuContent,exports.DropdownMenuGroup=DropdownMenuGroup,exports.DropdownMenuItem=DropdownMenuItem,exports.DropdownMenuLabel=DropdownMenuLabel,exports.DropdownMenuPortal=DropdownMenuPortal,exports.DropdownMenuRadioGroup=DropdownMenuRadioGroup,exports.DropdownMenuRadioItem=DropdownMenuRadioItem,exports.DropdownMenuSeparator=DropdownMenuSeparator,exports.DropdownMenuShortcut=DropdownMenuShortcut,exports.DropdownMenuSub=DropdownMenuSub,exports.DropdownMenuSubContent=DropdownMenuSubContent,exports.DropdownMenuSubTrigger=DropdownMenuSubTrigger,exports.DropdownMenuTrigger=DropdownMenuTrigger,exports.ExploreManufacturers=ExploreManufacturers,exports.ExternalProductCard=ExternalProductCard,exports.GeminiApiKeyProvider=GeminiApiKeyProvider,exports.GeneralDocumentCard=GeneralDocumentCard,exports.Input=Input,exports.InputOTP=InputOTP,exports.InputOTPGroup=InputOTPGroup,exports.InputOTPSeparator=InputOTPSeparator,exports.InputOTPSlot=InputOTPSlot,exports.Label=Label$2,exports.Layout=Layout,exports.ManufacturerCard=ManufacturerCard,exports.ManufacturerGetStartedButton=ManufacturerGetStartedButton,exports.ManufacturerOverviewPage=ManufacturerOverviewPage,exports.ManufacturerReorderingCard=ManufacturerReorderingCard,exports.MultiSelect=MultiSelect,exports.Navbar=Navbar,exports.OpportunitiesTable=OpportunitiesTable,exports.OrdersCard=OrdersCard,exports.PageHeader=PageHeader,exports.PartnerCard=PartnerCard,exports.PartnerRelationshipPage=PartnerRelationshipPage,exports.Popover=Popover,exports.PopoverAnchor=PopoverAnchor,exports.PopoverContent=PopoverContent,exports.PopoverTrigger=PopoverTrigger,exports.Preloader=Preloader,exports.ProductCard=ProductCard,exports.ProductImage=ProductImage,exports.ProductInventoryGrid=ProductInventoryGrid,exports.ProductOverviewPage=ProductOverviewPage,exports.Progress=Progress,exports.RadioGroup=RadioGroup$1,exports.RadioGroupItem=RadioGroupItem,exports.ResellerBillingOverviewCard=ResellerBillingOverviewCard,exports.ResellerCard=ResellerCard,exports.ResellerOverview=ResellerOverview,exports.ResellerQualificationsCard=ResellerQualificationsCard,exports.ReturnsTable=ReturnsTable,exports.RichTextEditor=RichTextEditor,exports.SalesChart=SalesChart,exports.SalesOverviewCard=SalesOverviewCard,exports.ScrollArea=ScrollArea,exports.ScrollBar=ScrollBar,exports.SearchPage=SearchPage,exports.SearchPageGrid=SearchPageGrid,exports.Select=Select,exports.SelectContent=SelectContent,exports.SelectGroup=SelectGroup,exports.SelectItem=SelectItem,exports.SelectLabel=SelectLabel,exports.SelectScrollDownButton=SelectScrollDownButton,exports.SelectScrollUpButton=SelectScrollUpButton,exports.SelectTrigger=SelectTrigger,exports.SelectValue=SelectValue,exports.Separator=Separator$1,exports.Sheet=Sheet,exports.SheetClose=SheetClose,exports.SheetContent=SheetContent,exports.SheetDescription=SheetDescription,exports.SheetFooter=SheetFooter,exports.SheetHeader=SheetHeader,exports.SheetOverlay=SheetOverlay,exports.SheetPortal=SheetPortal,exports.SheetTitle=SheetTitle,exports.SheetTrigger=SheetTrigger,exports.Sidebar=Sidebar,exports.SidebarContent=SidebarContent,exports.SidebarFooter=SidebarFooter,exports.SidebarGroup=SidebarGroup,exports.SidebarGroupAction=SidebarGroupAction,exports.SidebarGroupContent=SidebarGroupContent,exports.SidebarGroupLabel=SidebarGroupLabel,exports.SidebarHeader=SidebarHeader,exports.SidebarInput=SidebarInput,exports.SidebarInset=SidebarInset,exports.SidebarMenu=SidebarMenu,exports.SidebarMenuAction=SidebarMenuAction,exports.SidebarMenuBadge=SidebarMenuBadge,exports.SidebarMenuButton=SidebarMenuButton,exports.SidebarMenuItem=SidebarMenuItem,exports.SidebarMenuSkeleton=SidebarMenuSkeleton,exports.SidebarMenuSub=SidebarMenuSub,exports.SidebarMenuSubButton=SidebarMenuSubButton,exports.SidebarMenuSubItem=SidebarMenuSubItem,exports.SidebarProvider=SidebarProvider,exports.SidebarRail=SidebarRail,exports.SidebarSeparator=SidebarSeparator,exports.SidebarTrigger=SidebarTrigger,exports.Skeleton=Skeleton,exports.Switch=Switch,exports.Table=Table,exports.TableBody=TableBody,exports.TableCaption=TableCaption,exports.TableCell=TableCell,exports.TableFooter=TableFooter,exports.TableHead=TableHead,exports.TableHeader=TableHeader,exports.TableRow=TableRow,exports.Tabs=Tabs,exports.TabsContent=TabsContent,exports.TabsList=TabsList,exports.TabsTrigger=TabsTrigger,exports.Textarea=Textarea,exports.Toast=Toast,exports.ToastAction=ToastAction,exports.ToastClose=ToastClose,exports.ToastDescription=ToastDescription,exports.ToastProvider=ToastProvider,exports.ToastTitle=ToastTitle,exports.ToastViewport=ToastViewport,exports.Toaster=Toaster,exports.Tooltip=Tooltip$1,exports.TooltipContent=TooltipContent,exports.TooltipProvider=TooltipProvider,exports.TooltipTrigger=TooltipTrigger,exports.TopPercentTreemap=TopPercentTreemap,exports.Topbar=Topbar,exports.Treemap=Treemap,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.formatMoney=formatMoney,exports.formatNumber=formatNumber,exports.formatYYYYMMDDIntToDateString=formatYYYYMMDDIntToDateString,exports.toast=toast,exports.useChat=useChat,exports.useGeminiApiKey=useGeminiApiKey,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "randmarcomps",
3
3
  "private": false,
4
- "version": "1.372.0",
4
+ "version": "1.374.0",
5
5
  "description": "The UI library enabling speed and consistency in Randmar frontends.",
6
6
  "type": "module",
7
7
  "files": [