randmarcomps 1.363.0 → 1.364.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.
@@ -59839,7 +59839,7 @@ const fetchGeminiResponse = async (t, e, n, o, l = 3) => {
59839
59839
  ] })
59840
59840
  ] })
59841
59841
  ] }) : /* @__PURE__ */ jsx("div", { className: "flex-1 flex items-center justify-center text-muted-foreground", children: Ve ? "Select a chat to start messaging" : Vr }) }),
59842
- /* @__PURE__ */ jsx("div", { "data-thin": lt(), className: "w-[480px] flex flex-col border-l flex-4 data-[thin=true]:flex-2", children: lt() ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col border-r bg-slate-50 text-slate-800", children: [
59842
+ /* @__PURE__ */ jsx("div", { "data-thin": lt(), className: "w-[480px] flex flex-col border-l flex-5 data-[thin=true]:flex-3", children: lt() ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col border-r bg-slate-50 text-slate-800", children: [
59843
59843
  /* @__PURE__ */ jsxs("div", { className: "p-4 space-y-4 border-b border-slate-200/80", children: [
59844
59844
  /* @__PURE__ */ jsxs("h4", { className: "flex items-center text-xs font-semibold tracking-wider text-slate-500 uppercase", children: [
59845
59845
  /* @__PURE__ */ jsx(Settings, { className: "w-4 h-4 mr-2" }),
@@ -63736,7 +63736,7 @@ function OrderCategories({ openOrders: t = [], isLoading: e = !1 }) {
63736
63736
  amount: S
63737
63737
  }
63738
63738
  ];
63739
- return e ? /* @__PURE__ */ jsxs(Card, { className: "w-full @md:col-span-2 @xl:col-span-1", children: [
63739
+ return e ? /* @__PURE__ */ jsxs(Card, { className: "w-full", children: [
63740
63740
  /* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-40" }) }),
63741
63741
  /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 @sm:grid-cols-2 gap-3.5", children: [1, 2, 3, 4].map((M) => /* @__PURE__ */ jsx(Card, { className: "overflow-hidden rounded-md rounded-b-lg border-0 shadow-md", children: /* @__PURE__ */ jsxs(CardContent, { className: "p-0", children: [
63742
63742
  /* @__PURE__ */ jsx("div", { className: "bg-gray-200 h-[3px]" }),
@@ -63757,7 +63757,7 @@ function OrderCategories({ openOrders: t = [], isLoading: e = !1 }) {
63757
63757
  ] })
63758
63758
  ] })
63759
63759
  ] }) }, M)) }) })
63760
- ] }) : /* @__PURE__ */ jsxs(Card, { className: "w-full @md:col-span-2 @xl:col-span-1", children: [
63760
+ ] }) : /* @__PURE__ */ jsxs(Card, { className: "w-full", children: [
63761
63761
  /* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-1xl font-bold", children: "Order Categories" }) }),
63762
63762
  /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 @sm:grid-cols-2 gap-3.5", children: A.map((M) => /* @__PURE__ */ jsx(Card, { className: "overflow-hidden rounded-md rounded-b-lg border-0 shadow-md", children: /* @__PURE__ */ jsxs(CardContent, { className: "p-0", children: [
63763
63763
  /* @__PURE__ */ jsx("div", { className: `${M.color} bg-opacity-60 h-[3px]` }),
@@ -64371,6 +64371,7 @@ function ResellerOverview({
64371
64371
  isSuperAdmin: l,
64372
64372
  withoutReports: d = !1
64373
64373
  }) {
64374
+ var q, z, Q, j;
64374
64375
  const {
64375
64376
  data: f,
64376
64377
  isLoading: g,
@@ -64381,13 +64382,13 @@ function ResellerOverview({
64381
64382
  // This should ideally make Qualifications include full Manufacturer details
64382
64383
  }, { skip: !!e }), [S, _] = useState({
64383
64384
  publicInfo: { hasUnsavedChanges: !1 }
64384
- }), C = useCallback(() => n ? !1 : S.publicInfo.hasUnsavedChanges, [n, S]), E = useCallback((q, z) => {
64385
- _((Q) => {
64386
- var j;
64387
- return ((j = Q[q]) == null ? void 0 : j.hasUnsavedChanges) !== z.hasUnsavedChanges ? {
64388
- ...Q,
64389
- [q]: z
64390
- } : Q;
64385
+ }), C = useCallback(() => n ? !1 : S.publicInfo.hasUnsavedChanges, [n, S]), E = useCallback((F, te) => {
64386
+ _((ne) => {
64387
+ var oe;
64388
+ return ((oe = ne[F]) == null ? void 0 : oe.hasUnsavedChanges) !== te.hasUnsavedChanges ? {
64389
+ ...ne,
64390
+ [F]: te
64391
+ } : ne;
64391
64392
  });
64392
64393
  }, []), { NavigationGuardDialog: R } = useRouterNavigationGuard(C), A = e ?? f, M = !n || !!(A != null && A.Statement) && (A.Statement.Total ?? 0) > 0, I = (A == null ? void 0 : A.QualifiedManufacturers) ?? [], V = (A == null ? void 0 : A.Qualifications) ?? [];
64393
64394
  return /* @__PURE__ */ jsxs("div", { className: "@container", children: [
@@ -64404,7 +64405,7 @@ function ResellerOverview({
64404
64405
  isLoading: g
64405
64406
  }
64406
64407
  ),
64407
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 @2xl:grid-cols-2 gap-6", children: [
64408
+ /* @__PURE__ */ jsxs("div", { className: "grid @lg:grid-cols-2 gap-6", children: [
64408
64409
  /* @__PURE__ */ jsx(
64409
64410
  SalesChartCard,
64410
64411
  {
@@ -64430,7 +64431,7 @@ function ResellerOverview({
64430
64431
  appID: t ?? "",
64431
64432
  isLoading: g,
64432
64433
  readonly: n,
64433
- onUnsavedChanges: (q) => E("publicInfo", { hasUnsavedChanges: q })
64434
+ onUnsavedChanges: (F) => E("publicInfo", { hasUnsavedChanges: F })
64434
64435
  }
64435
64436
  ),
64436
64437
  /* @__PURE__ */ jsx(
@@ -64446,21 +64447,21 @@ function ResellerOverview({
64446
64447
  ] }),
64447
64448
  g || I.length > 0 ? /* @__PURE__ */ jsxs(Card, { className: "w-full", children: [
64448
64449
  /* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { children: "Manufacturers you are qualified for" }) }),
64449
- /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", { className: "grid @2xl:grid-cols-2 gap-4", children: g ? Array.from({ length: 2 }).map((q, z) => /* @__PURE__ */ jsx(ManufacturerCard, { loading: !0 }, z)) : I.map((q) => /* @__PURE__ */ jsx(
64450
+ /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", { className: "grid @lg:grid-cols-2 gap-4", children: g ? Array.from({ length: 2 }).map((F, te) => /* @__PURE__ */ jsx(ManufacturerCard, { loading: !0 }, te)) : I.map((F) => /* @__PURE__ */ jsx(
64450
64451
  ManufacturerCard,
64451
64452
  {
64452
- manufacturer: q,
64453
- link: `https://dashboard.randmar.io/${t}/Partner/${q.ManufacturerId}`
64453
+ manufacturer: F,
64454
+ link: `https://dashboard.randmar.io/${t}/Partner/${F.ManufacturerId}`
64454
64455
  },
64455
- q.ManufacturerId
64456
+ F.ManufacturerId
64456
64457
  )) }) })
64457
- ] }) : /* @__PURE__ */ jsx(
64458
+ ] }) : V.length > 0 && /* @__PURE__ */ jsx(
64458
64459
  ResellerQualificationsCard,
64459
64460
  {
64460
64461
  qualifications: V
64461
64462
  }
64462
64463
  ),
64463
- /* @__PURE__ */ jsx(
64464
+ (((q = A == null ? void 0 : A.Opportunities) == null ? void 0 : q.length) ?? 0) > 0 && /* @__PURE__ */ jsx(
64464
64465
  OpportunitiesTable,
64465
64466
  {
64466
64467
  applicationId: t,
@@ -64468,7 +64469,7 @@ function ResellerOverview({
64468
64469
  loading: g
64469
64470
  }
64470
64471
  ),
64471
- /* @__PURE__ */ jsx(
64472
+ (((z = A == null ? void 0 : A.ActiveOrderDetails) == null ? void 0 : z.length) ?? 0) > 0 && /* @__PURE__ */ jsx(
64472
64473
  OrdersCard,
64473
64474
  {
64474
64475
  applicationId: t,
@@ -64477,7 +64478,7 @@ function ResellerOverview({
64477
64478
  loading: g
64478
64479
  }
64479
64480
  ),
64480
- /* @__PURE__ */ jsx(
64481
+ (((Q = A == null ? void 0 : A.CompletedOrderDetails) == null ? void 0 : Q.length) ?? 0) > 0 && /* @__PURE__ */ jsx(
64481
64482
  OrdersCard,
64482
64483
  {
64483
64484
  applicationId: t,
@@ -64486,7 +64487,7 @@ function ResellerOverview({
64486
64487
  loading: g
64487
64488
  }
64488
64489
  ),
64489
- /* @__PURE__ */ jsx(
64490
+ (((j = A == null ? void 0 : A.Returns) == null ? void 0 : j.length) ?? 0) > 0 && /* @__PURE__ */ jsx(
64490
64491
  ReturnsTable,
64491
64492
  {
64492
64493
  applicationId: t,
@@ -66479,12 +66480,12 @@ function DataTable({
66479
66480
  }), A = (I, V) => {
66480
66481
  I.toggleSorting(V), E(null);
66481
66482
  };
66482
- return l ? /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
66483
+ return l ? /* @__PURE__ */ jsxs("div", { className: "@container space-y-4", children: [
66483
66484
  /* @__PURE__ */ jsx("div", { className: `rounded-md border ${o ?? ""}`, children: /* @__PURE__ */ jsxs(Table, { children: [
66484
66485
  /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsx(TableRow, { children: t.map((I, V) => /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-full" }) }, `skeleton-header-${V}`)) }) }),
66485
66486
  /* @__PURE__ */ jsx(TableBody, { children: Array.from({ length: S.pageSize }).map((I, V) => /* @__PURE__ */ jsx(TableRow, { children: t.map((q, z) => /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-full" }) }, `skeleton-cell-${V}-${z}`)) }, `skeleton-row-${V}`)) })
66486
66487
  ] }) }),
66487
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
66488
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-4 @[35rem]:flex-row @[35rem]:justify-between", children: [
66488
66489
  /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
66489
66490
  /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-[110px]" }),
66490
66491
  /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-[70px]" })
@@ -66501,7 +66502,7 @@ function DataTable({
66501
66502
  /* @__PURE__ */ jsx(Skeleton, { className: "hidden h-8 w-8 lg:flex" })
66502
66503
  ] })
66503
66504
  ] })
66504
- ] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
66505
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "@container space-y-4", children: [
66505
66506
  /* @__PURE__ */ jsxs(ScrollArea, { className: `rounded-md border ${o ?? ""}`, children: [
66506
66507
  /* @__PURE__ */ jsxs(Table, { children: [
66507
66508
  /* @__PURE__ */ jsx(TableHeader, { children: R.getHeaderGroups().map((I) => /* @__PURE__ */ jsx(TableRow, { children: I.headers.map((V) => {
@@ -66578,7 +66579,7 @@ function DataTable({
66578
66579
  ] }),
66579
66580
  /* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" })
66580
66581
  ] }),
66581
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
66582
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-4 @[35rem]:flex-row @[35rem]:justify-between", children: [
66582
66583
  /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
66583
66584
  /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "Rows per page" }),
66584
66585
  /* @__PURE__ */ jsxs(
@@ -1126,7 +1126,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An err
1126
1126
  - **Crucially, do not use any placeholders, brackets, or instructions for the user to fill in.** Use the context provided to craft the final text.
1127
1127
  - Keep it to 1-2 concise, engaging sentences.
1128
1128
  - Output only the plain text of the message itself.
1129
- `,An=await Q(mn);if(An){const qn=(nn=(await te({routeApplicationId:t,partnerId:"2"})).data)==null?void 0:nn.ConversationId;if(qn)await _(),Yt(qn,An);else throw new Error("Failed to retrieve conversation ID after creation.")}}catch(pn){console.error("Error during 'Chat with Randmar' initiation:",pn),rt({title:"Error",description:"Could not initiate chat. Please try again later.",variant:"destructive"})}finally{j.current&&(j.current.disabled=!1),O(!1)}},En=()=>{tt(ct=>ct.map(Jt=>Jt.partner1!==ASSISTANT_ID&&Jt.partner2!==ASSISTANT_ID?Jt:{...Jt,messages:[]})),$t([]),Le()},Ln=()=>{Oe&&E({routeApplicationId:t,partnerId:Oe[0]==t?Oe[1]:Oe[0]}).then(()=>{$e("approved")})},Xt=st(),kn=We.filter(ct=>ct.pending).length,bn=(ct,Ut)=>{I(Jt=>({...Jt,[ct]:Ut})),En()},Cn=React.useRef(null);React.useEffect(()=>{var ct;(ct=Cn.current)==null||ct.scrollIntoView({behavior:"smooth"})},[Ne]);const an=({className:ct="h-4 w-4"})=>jsxRuntime.jsxs("svg",{style:{flex:"none",lineHeight:1},viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",className:ct,children:[jsxRuntime.jsx("title",{children:"Gemini"}),jsxRuntime.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"#3186FF"}),jsxRuntime.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#lobe-icons-gemini-fill-0)"}),jsxRuntime.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#lobe-icons-gemini-fill-1)"}),jsxRuntime.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#lobe-icons-gemini-fill-2)"}),jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"lobe-icons-gemini-fill-0",x1:"7",x2:"11",y1:"15.5",y2:"12",children:[jsxRuntime.jsx("stop",{stopColor:"#08B962"}),jsxRuntime.jsx("stop",{offset:"1",stopColor:"#08B962",stopOpacity:"0"})]}),jsxRuntime.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"lobe-icons-gemini-fill-1",x1:"8",x2:"11.5",y1:"5.5",y2:"11",children:[jsxRuntime.jsx("stop",{stopColor:"#F94543"}),jsxRuntime.jsx("stop",{offset:"1",stopColor:"#F94543",stopOpacity:"0"})]}),jsxRuntime.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"lobe-icons-gemini-fill-2",x1:"3.5",x2:"17.5",y1:"13.5",y2:"12",children:[jsxRuntime.jsx("stop",{stopColor:"#FABC12"}),jsxRuntime.jsx("stop",{offset:".46",stopColor:"#FABC12",stopOpacity:"0"})]})]})]}),Vn=jsxRuntime.jsx("div",{className:"flex h-full items-center justify-center",children:jsxRuntime.jsxs("div",{className:"text-center text-muted-foreground",children:[jsxRuntime.jsx(LoaderCircle,{className:"h-12 w-12 animate-spin mx-auto mb-4"}),jsxRuntime.jsx("p",{children:"Loading API functions..."})]})});return jsxRuntime.jsxs("div",{className:cn("flex overflow-hidden",l),children:[o!==!0&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"w-[260px] p-4 pt-3 flex flex-col border-r",children:[jsxRuntime.jsx("div",{className:"p-4 font-semibold border-b",children:"Communications"}),We.length>1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"p-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(Search,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),jsxRuntime.jsx(Input,{placeholder:"Search chats...",className:"pl-8 h-9",value:Xe,onChange:ct=>it(ct.target.value)})]})}),jsxRuntime.jsx(Tabs,{value:ze,onValueChange:$e,className:"w-full mb-1",children:jsxRuntime.jsxs(TabsList,{className:"grid grid-cols-6 h-9 mx-2",children:[jsxRuntime.jsx(TabsTrigger,{value:"approved",className:"text-xs col-span-3",children:"Approved"}),jsxRuntime.jsxs(TabsTrigger,{value:"pending",className:"text-xs col-span-3",children:["Pending ",kn>0&&`(${kn})`]})]})})]}),jsxRuntime.jsx("div",{className:"mt-1 mb-1",children:We.findIndex(ct=>ct.partner1==="2"||ct.partner2==="2")<0?jsxRuntime.jsx(Button,{className:"w-full",ref:j,disabled:F,onClick:Rn,children:F?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Starting Chat..."]}):"Chat with Randmar"},"b1"):ze==="approved"&&We.length>=5?null:jsxRuntime.jsx(reactRouterDom.Link,{to:`${window.location.hostname==="dashboard.randmar.io"?"":"https://dashboard.randmar.io"}/${t}/ExploreManufacturers`,target:window.location.hostname==="dashboard.randmar.io"?"_self":"_blank",children:jsxRuntime.jsx(Button,{className:"w-full",children:"Explore Manufacturers"},"b2")})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1",children:We.length>0&&jsxRuntime.jsx(ChatList,{userId:t,chats:pt.filter(ct=>ct.partner1!==ASSISTANT_ID&&ct.partner2!==ASSISTANT_ID),activeChat:Xt??null,onSelectChat:qe})}),jsxRuntime.jsx(Separator$1,{className:"mt-auto"}),jsxRuntime.jsx("div",{className:"pt-1",children:We.find(ct=>ct.partner1===ASSISTANT_ID||ct.partner2===ASSISTANT_ID)&&jsxRuntime.jsx(ChatList,{userId:t,chats:pt.filter(ct=>ct.partner1===ASSISTANT_ID||ct.partner2===ASSISTANT_ID),activeChat:Xt??null,onSelectChat:qe,assistantStickyMode:!0})})]})}),jsxRuntime.jsx("div",{className:"flex-5 flex flex-col",children:Oe?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:Oe[0]==ASSISTANT_ID||Oe[1]==ASSISTANT_ID?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:jsxRuntime.jsx(Bot,{className:"text-primary fill-white min-h-full"})}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:"Randmar Assistant"}),jsxRuntime.jsx(Button,{variant:"ghost",size:"sm",className:"ml-auto",confirmationDialog:{title:"Report Issue",content:"This action will send a copy of your chat to Randmar. Send it?",onConfirm:()=>xn()},disabled:S,children:S?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-5 w-5 mr-2 animate-spin"}),"Sending Feedback..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(MessageSquareShare,{className:"h-5 w-5 mr-2"}),"Report Issue"]})}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",onClick:()=>En(),children:jsxRuntime.jsx(MessageCircleX,{className:"h-5 w-5"})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Reset Chat"})})]})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:jsxRuntime.jsx(PartnerLogo,{id:Oe[0]===t?Oe[1]:Oe[0],width:72,height:72})}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:Xt==null?void 0:Xt.name}),jsxRuntime.jsx("div",{className:"flex items-center space-x-2 ml-auto",children:jsxRuntime.jsx(reactRouterDom.Link,{to:`${window.location.hostname==="dashboard.randmar.io"?"":"https://dashboard.randmar.io"}/${t}/Partner/${Oe[0]===t?Oe[1]:Oe[0]}`,target:window.location.hostname==="dashboard.randmar.io"?"_self":"_blank",children:jsxRuntime.jsx(Button,{children:"View Partner"})})})]})}),Xt!=null&&Xt.pending&&Xt.partner1==t?jsxRuntime.jsx("p",{className:"mt-8 p-2 mx-auto",children:"This conversation is awaiting approval by the other party — please check back later."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:je?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ChatMessages,{messages:(Xt==null?void 0:Xt.messages)??[],currentUserId:t,isAssistantChat:lt(),botStatus:lt()?Ve:""}),jsxRuntime.jsx("div",{ref:ot})]}):Vn}),jsxRuntime.jsxs("div",{className:"p-4 border-t border-r flex",children:[(Xt==null?void 0:Xt.pending)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{disabled:A,onClick:()=>Ln(),children:[jsxRuntime.jsx(Handshake,{}),"Accept Conversation Request"]}),jsxRuntime.jsxs(Button,{disabled:!0,className:"ml-2",children:[jsxRuntime.jsx(ThumbsDown,{}),"Block Partner"]})]}),jsxRuntime.jsx(Textarea,{ref:Mt,placeholder:"Type a message...",value:Ge,onPaste:dn,onChange:ct=>Ue(ct.target.value),onKeyDown:ct=>{ct.key!=="Enter"||ct.shiftKey||(ct.preventDefault(),gn())},className:Xt!=null&&Xt.pending?"collapse":"flex-1 resize-none",disabled:!je||(Xt==null?void 0:Xt.pending)}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Button,{size:"icon",variant:"default",className:Xt!=null&&Xt.pending?"collapse":"ml-2 h-8 w-8",disabled:!je||!!Ve||(Xt==null?void 0:Xt.pending),onClick:gn,children:jsxRuntime.jsx(Send,{className:"h-6 w-6"})}),lt()&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Input,{type:"file",onChange:qt,className:"hidden",ref:Ye}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:wn,className:Xt!=null&&Xt.pending?"collapse":"ml-2 h-8 w-8",disabled:!je||Ve!==""||(Xt==null?void 0:Xt.pending)||!!mt,children:jsxRuntime.jsx(Paperclip,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:_n,className:Xt!=null&&Xt.pending?"collapse":"ml-2 h-8 w-8",disabled:!je||Ve!==""||(Xt==null?void 0:Xt.pending)||!mt,children:jsxRuntime.jsx(Trash,{className:"h-5 w-5"})})]})]})]})]})]}):jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:je?"Select a chat to start messaging":Vn})}),jsxRuntime.jsx("div",{"data-thin":lt(),className:"w-[480px] flex flex-col border-l flex-4 data-[thin=true]:flex-2",children:lt()?jsxRuntime.jsxs("div",{className:"flex h-full flex-col border-r bg-slate-50 text-slate-800",children:[jsxRuntime.jsxs("div",{className:"p-4 space-y-4 border-b border-slate-200/80",children:[jsxRuntime.jsxs("h4",{className:"flex items-center text-xs font-semibold tracking-wider text-slate-500 uppercase",children:[jsxRuntime.jsx(Settings,{className:"w-4 h-4 mr-2"}),"Assistant Settings"]}),jsxRuntime.jsxs("div",{className:"space-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"space-y-1.5 pr-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"think-harder-switch",children:"Think Harder"}),jsxRuntime.jsx("p",{className:"text-xs text-slate-600",children:"Uses a more advanced model for complex queries."})]}),jsxRuntime.jsx(Switch,{id:"think-harder-switch",checked:M.assistantThinkHarder,onCheckedChange:ct=>bn("assistantThinkHarder",ct)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"space-y-1.5 pr-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"preload-bestsellers-switch",children:"Preload Best-Sellers"}),jsxRuntime.jsx("p",{className:"text-xs text-slate-600",children:"Adds top products to the AI's context for faster answers."})]}),jsxRuntime.jsx(Switch,{id:"preload-bestsellers-switch",checked:M.assistantCachedPreloading,onCheckedChange:ct=>bn("assistantCachedPreloading",ct)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"space-y-1.5 pr-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"proactive-context-switch",children:"Proactive Context Fetch"}),jsxRuntime.jsx("p",{className:"text-xs text-slate-600",children:"Loads your initial data at the start of a new conversation."})]}),jsxRuntime.jsx(Switch,{id:"proactive-context-switch",checked:M.assistantDynamicPreloading,onCheckedChange:ct=>bn("assistantDynamicPreloading",ct)})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col border-b border-slate-200/80 h-32",children:[jsxRuntime.jsxs("h4",{className:"flex-shrink-0 flex items-center p-4 pb-2 text-xs font-semibold tracking-wider text-slate-500 uppercase",children:[jsxRuntime.jsx(File,{className:"w-4 h-4 mr-2"}),"Attached Files"]}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 px-4",children:jsxRuntime.jsx("div",{className:"py-2 text-sm",children:mt||Rt.length>0?jsxRuntime.jsxs("div",{className:"space-y-2",children:[mt&&jsxRuntime.jsxs("div",{className:"flex items-center text-blue-600",children:[jsxRuntime.jsx(File,{className:"w-4 h-4 mr-2 flex-shrink-0"}),jsxRuntime.jsxs("span",{className:"truncate",children:[mt.name," (pending)"]})]}),Rt.slice().reverse().map((ct,Ut)=>jsxRuntime.jsxs("div",{className:"flex items-center text-slate-700 hover:text-slate-900 transition-colors duration-150",children:[jsxRuntime.jsx(File,{className:"w-4 h-4 mr-2 flex-shrink-0"}),jsxRuntime.jsx("span",{className:"truncate",children:ct})]},Ut))]}):jsxRuntime.jsx("p",{className:"text-slate-500 text-xs italic",children:"No files attached yet."})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[jsxRuntime.jsxs("h4",{className:"flex-shrink-0 flex items-center p-4 pb-2 text-xs font-semibold tracking-wider text-slate-500 uppercase",children:[jsxRuntime.jsx(CodeXml,{className:"w-4 h-4 mr-2"}),"Developer Log"]}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 px-4",children:jsxRuntime.jsxs("div",{className:"py-2 text-xs font-mono",children:[jsxRuntime.jsx(DebugMessageDisplay,{debugMessages:Ne}),jsxRuntime.jsx("div",{ref:Cn})]})})]}),jsxRuntime.jsx("div",{className:"mt-auto p-3 border-t border-slate-200/80",children:jsxRuntime.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[jsxRuntime.jsx("p",{className:"text-xs text-slate-500",children:"Powered by Gemini"}),jsxRuntime.jsx(an,{})]})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Partner Overview"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"mt-1",children:jsxRuntime.jsx(PartnerRelationshipPage,{applicationId:t,partnerId:((Oe==null?void 0:Oe[0])===t?Oe[1]:Oe==null?void 0:Oe[0])??t,userEmail:e,shopifyHostName:void 0,isSuperAdmin:!1})})})]})})]})});function UnsavedChangesDialog({isOpen:t,onClose:e,onConfirm:n,title:o,description:l,confirmText:d="Confirm",cancelText:f="Cancel"}){return jsxRuntime.jsx(Dialog,{open:t,onOpenChange:e,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:o}),jsxRuntime.jsx(DialogDescription,{children:l})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:e,children:f}),jsxRuntime.jsx(Button,{onClick:n,children:d})]})]})})}function useRouterNavigationGuard(t){const[e,n]=React.useState(!1),o=reactRouterDom.useBlocker(React.useCallback(({currentLocation:g,nextLocation:b})=>{const _=g.pathname!==b.pathname||g.search!==b.search||g.hash!==b.hash;return t()&&_},[t]));React.useEffect(()=>{o.state==="blocked"&&n(!0)},[o]),React.useEffect(()=>{const g=b=>{if(t())return b.preventDefault(),"You have unsaved changes. Are you sure you want to leave?"};return window.addEventListener("beforeunload",g),()=>{window.removeEventListener("beforeunload",g)}},[t]);const l=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.proceed()},[o]),d=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.reset()},[o]),f=React.useCallback(()=>jsxRuntime.jsx(UnsavedChangesDialog,{isOpen:e,onClose:d,onConfirm:l,title:"Unsaved Changes",description:"You have unsaved changes. Are you sure you want to leave? Your changes will be lost.",confirmText:"Discard Changes",cancelText:"Stay on Page"}),[e,d,l]);return{showDialog:e,handleConfirm:l,handleCancel:d,NavigationGuardDialog:f}}var isCheckBoxInput=t=>t.type==="checkbox",isDateObject=t=>t instanceof Date,isNullOrUndefined=t=>t==null;const isObjectType=t=>typeof t=="object";var isObject=t=>!isNullOrUndefined(t)&&!Array.isArray(t)&&isObjectType(t)&&!isDateObject(t),getEventValue=t=>isObject(t)&&t.target?isCheckBoxInput(t.target)?t.target.checked:t.target.value:t,getNodeParentName=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,isNameInFieldArray=(t,e)=>t.has(getNodeParentName(e)),isPlainObject$1=t=>{const e=t.constructor&&t.constructor.prototype;return isObject(e)&&e.hasOwnProperty("isPrototypeOf")},isWeb=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function cloneObject(t){let e;const n=Array.isArray(t),o=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(!(isWeb&&(t instanceof Blob||o))&&(n||isObject(t)))if(e=n?[]:{},!n&&!isPlainObject$1(t))e=t;else for(const l in t)t.hasOwnProperty(l)&&(e[l]=cloneObject(t[l]));else return t;return e}var isKey=t=>/^\w*$/.test(t),isUndefined=t=>t===void 0,compact=t=>Array.isArray(t)?t.filter(Boolean):[],stringToPath=t=>compact(t.replace(/["|']|\]/g,"").split(/\.|\[/)),get=(t,e,n)=>{if(!e||!isObject(t))return n;const o=(isKey(e)?[e]:stringToPath(e)).reduce((l,d)=>isNullOrUndefined(l)?l:l[d],t);return isUndefined(o)||o===t?isUndefined(t[e])?n:t[e]:o},isBoolean=t=>typeof t=="boolean",set=(t,e,n)=>{let o=-1;const l=isKey(e)?[e]:stringToPath(e),d=l.length,f=d-1;for(;++o<d;){const g=l[o];let b=n;if(o!==f){const _=t[g];b=isObject(_)||Array.isArray(_)?_:isNaN(+l[o+1])?{}:[]}if(g==="__proto__"||g==="constructor"||g==="prototype")return;t[g]=b,t=t[g]}};const EVENTS={BLUR:"blur",FOCUS_OUT:"focusout"},VALIDATION_MODE={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},INPUT_VALIDATION_RULES={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},HookFormContext=React.createContext(null);HookFormContext.displayName="HookFormContext";var getProxyFormState=(t,e,n,o=!0)=>{const l={defaultValues:e._defaultValues};for(const d in t)Object.defineProperty(l,d,{get:()=>{const f=d;return e._proxyFormState[f]!==VALIDATION_MODE.all&&(e._proxyFormState[f]=!o||VALIDATION_MODE.all),t[f]}});return l};const useIsomorphicLayoutEffect$1=typeof window<"u"?React__namespace.useLayoutEffect:React__namespace.useEffect;var isString=t=>typeof t=="string",generateWatchOutput=(t,e,n,o,l)=>isString(t)?(o&&e.watch.add(t),get(n,t,l)):Array.isArray(t)?t.map(d=>(o&&e.watch.add(d),get(n,d))):(o&&(e.watchAll=!0),n),appendErrors=(t,e,n,o,l)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[o]:l||!0}}:{},convertToArrayPayload=t=>Array.isArray(t)?t:[t],createSubject=()=>{let t=[];return{get observers(){return t},next:l=>{for(const d of t)d.next&&d.next(l)},subscribe:l=>(t.push(l),{unsubscribe:()=>{t=t.filter(d=>d!==l)}}),unsubscribe:()=>{t=[]}}},isPrimitive=t=>isNullOrUndefined(t)||!isObjectType(t);function deepEqual$1(t,e,n=new WeakSet){if(isPrimitive(t)||isPrimitive(e))return t===e;if(isDateObject(t)&&isDateObject(e))return t.getTime()===e.getTime();const o=Object.keys(t),l=Object.keys(e);if(o.length!==l.length)return!1;if(n.has(t)||n.has(e))return!0;n.add(t),n.add(e);for(const d of o){const f=t[d];if(!l.includes(d))return!1;if(d!=="ref"){const g=e[d];if(isDateObject(f)&&isDateObject(g)||isObject(f)&&isObject(g)||Array.isArray(f)&&Array.isArray(g)?!deepEqual$1(f,g,n):f!==g)return!1}}return!0}var isEmptyObject$1=t=>isObject(t)&&!Object.keys(t).length,isFileInput=t=>t.type==="file",isFunction$3=t=>typeof t=="function",isHTMLElement=t=>{if(!isWeb)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},isMultipleSelect=t=>t.type==="select-multiple",isRadioInput=t=>t.type==="radio",isRadioOrCheckbox=t=>isRadioInput(t)||isCheckBoxInput(t),live=t=>isHTMLElement(t)&&t.isConnected;function baseGet(t,e){const n=e.slice(0,-1).length;let o=0;for(;o<n;)t=isUndefined(t)?o++:t[e[o++]];return t}function isEmptyArray(t){for(const e in t)if(t.hasOwnProperty(e)&&!isUndefined(t[e]))return!1;return!0}function unset(t,e){const n=Array.isArray(e)?e:isKey(e)?[e]:stringToPath(e),o=n.length===1?t:baseGet(t,n),l=n.length-1,d=n[l];return o&&delete o[d],l!==0&&(isObject(o)&&isEmptyObject$1(o)||Array.isArray(o)&&isEmptyArray(o))&&unset(t,n.slice(0,-1)),t}var objectHasFunction=t=>{for(const e in t)if(isFunction$3(t[e]))return!0;return!1};function markFieldsDirty(t,e={}){const n=Array.isArray(t);if(isObject(t)||n)for(const o in t)Array.isArray(t[o])||isObject(t[o])&&!objectHasFunction(t[o])?(e[o]=Array.isArray(t[o])?[]:{},markFieldsDirty(t[o],e[o])):isNullOrUndefined(t[o])||(e[o]=!0);return e}function getDirtyFieldsFromDefaultValues(t,e,n){const o=Array.isArray(t);if(isObject(t)||o)for(const l in t)Array.isArray(t[l])||isObject(t[l])&&!objectHasFunction(t[l])?isUndefined(e)||isPrimitive(n[l])?n[l]=Array.isArray(t[l])?markFieldsDirty(t[l],[]):{...markFieldsDirty(t[l])}:getDirtyFieldsFromDefaultValues(t[l],isNullOrUndefined(e)?{}:e[l],n[l]):n[l]=!deepEqual$1(t[l],e[l]);return n}var getDirtyFields=(t,e)=>getDirtyFieldsFromDefaultValues(t,e,markFieldsDirty(e));const defaultResult={value:!1,isValid:!1},validResult={value:!0,isValid:!0};var getCheckboxValue=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!isUndefined(t[0].attributes.value)?isUndefined(t[0].value)||t[0].value===""?validResult:{value:t[0].value,isValid:!0}:validResult:defaultResult}return defaultResult},getFieldValueAs=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:o})=>isUndefined(t)?t:e?t===""?NaN:t&&+t:n&&isString(t)?new Date(t):o?o(t):t;const defaultReturn={isValid:!1,value:null};var getRadioValue=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,defaultReturn):defaultReturn;function getFieldValue(t){const e=t.ref;return isFileInput(e)?e.files:isRadioInput(e)?getRadioValue(t.refs).value:isMultipleSelect(e)?[...e.selectedOptions].map(({value:n})=>n):isCheckBoxInput(e)?getCheckboxValue(t.refs).value:getFieldValueAs(isUndefined(e.value)?t.ref.value:e.value,t)}var getResolverOptions=(t,e,n,o)=>{const l={};for(const d of t){const f=get(e,d);f&&set(l,d,f._f)}return{criteriaMode:n,names:[...t],fields:l,shouldUseNativeValidation:o}},isRegex=t=>t instanceof RegExp,getRuleValue=t=>isUndefined(t)?t:isRegex(t)?t.source:isObject(t)?isRegex(t.value)?t.value.source:t.value:t,getValidationModes=t=>({isOnSubmit:!t||t===VALIDATION_MODE.onSubmit,isOnBlur:t===VALIDATION_MODE.onBlur,isOnChange:t===VALIDATION_MODE.onChange,isOnAll:t===VALIDATION_MODE.all,isOnTouch:t===VALIDATION_MODE.onTouched});const ASYNC_FUNCTION="AsyncFunction";var hasPromiseValidation=t=>!!t&&!!t.validate&&!!(isFunction$3(t.validate)&&t.validate.constructor.name===ASYNC_FUNCTION||isObject(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===ASYNC_FUNCTION)),hasValidation=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),isWatched=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(o=>t.startsWith(o)&&/^\.\w+/.test(t.slice(o.length))));const iterateFieldsByAction=(t,e,n,o)=>{for(const l of n||Object.keys(t)){const d=get(t,l);if(d){const{_f:f,...g}=d;if(f){if(f.refs&&f.refs[0]&&e(f.refs[0],l)&&!o)return!0;if(f.ref&&e(f.ref,f.name)&&!o)return!0;if(iterateFieldsByAction(g,e))break}else if(isObject(g)&&iterateFieldsByAction(g,e))break}}};function schemaErrorLookup(t,e,n){const o=get(t,n);if(o||isKey(n))return{error:o,name:n};const l=n.split(".");for(;l.length;){const d=l.join("."),f=get(e,d),g=get(t,d);if(f&&!Array.isArray(f)&&n!==d)return{name:n};if(g&&g.type)return{name:d,error:g};if(g&&g.root&&g.root.type)return{name:`${d}.root`,error:g.root};l.pop()}return{name:n}}var shouldRenderFormState=(t,e,n,o)=>{n(t);const{name:l,...d}=t;return isEmptyObject$1(d)||Object.keys(d).length>=Object.keys(e).length||Object.keys(d).find(f=>e[f]===(!o||VALIDATION_MODE.all))},shouldSubscribeByName=(t,e,n)=>!t||!e||t===e||convertToArrayPayload(t).some(o=>o&&(n?o===e:o.startsWith(e)||e.startsWith(o))),skipValidation=(t,e,n,o,l)=>l.isOnAll?!1:!n&&l.isOnTouch?!(e||t):(n?o.isOnBlur:l.isOnBlur)?!t:(n?o.isOnChange:l.isOnChange)?t:!0,unsetEmptyArray=(t,e)=>!compact(get(t,e)).length&&unset(t,e),updateFieldArrayRootError=(t,e,n)=>{const o=convertToArrayPayload(get(t,n));return set(o,"root",e[n]),set(t,n,o),t},isMessage=t=>isString(t);function getValidateError(t,e,n="validate"){if(isMessage(t)||Array.isArray(t)&&t.every(isMessage)||isBoolean(t)&&!t)return{type:n,message:isMessage(t)?t:"",ref:e}}var getValueAndMessage=t=>isObject(t)&&!isRegex(t)?t:{value:t,message:""},validateField=async(t,e,n,o,l,d)=>{const{ref:f,refs:g,required:b,maxLength:_,minLength:S,min:R,max:C,pattern:E,validate:A,name:M,valueAsNumber:I,mount:j}=t._f,q=get(n,M);if(!j||e.has(M))return{};const z=g?g[0]:f,Q=Ae=>{l&&z.reportValidity&&(z.setCustomValidity(isBoolean(Ae)?"":Ae||""),z.reportValidity())},F={},O=isRadioInput(f),te=isCheckBoxInput(f),ne=O||te,se=(I||isFileInput(f))&&isUndefined(f.value)&&isUndefined(q)||isHTMLElement(f)&&f.value===""||q===""||Array.isArray(q)&&!q.length,ge=appendErrors.bind(null,M,o,F),oe=(Ae,je,Ne,Ve=INPUT_VALIDATION_RULES.maxLength,Le=INPUT_VALIDATION_RULES.minLength)=>{const ze=Ae?je:Ne;F[M]={type:Ae?Ve:Le,message:ze,ref:f,...ge(Ae?Ve:Le,ze)}};if(d?!Array.isArray(q)||!q.length:b&&(!ne&&(se||isNullOrUndefined(q))||isBoolean(q)&&!q||te&&!getCheckboxValue(g).isValid||O&&!getRadioValue(g).isValid)){const{value:Ae,message:je}=isMessage(b)?{value:!!b,message:b}:getValueAndMessage(b);if(Ae&&(F[M]={type:INPUT_VALIDATION_RULES.required,message:je,ref:z,...ge(INPUT_VALIDATION_RULES.required,je)},!o))return Q(je),F}if(!se&&(!isNullOrUndefined(R)||!isNullOrUndefined(C))){let Ae,je;const Ne=getValueAndMessage(C),Ve=getValueAndMessage(R);if(!isNullOrUndefined(q)&&!isNaN(q)){const Le=f.valueAsNumber||q&&+q;isNullOrUndefined(Ne.value)||(Ae=Le>Ne.value),isNullOrUndefined(Ve.value)||(je=Le<Ve.value)}else{const Le=f.valueAsDate||new Date(q),ze=qe=>new Date(new Date().toDateString()+" "+qe),$e=f.type=="time",Oe=f.type=="week";isString(Ne.value)&&q&&(Ae=$e?ze(q)>ze(Ne.value):Oe?q>Ne.value:Le>new Date(Ne.value)),isString(Ve.value)&&q&&(je=$e?ze(q)<ze(Ve.value):Oe?q<Ve.value:Le<new Date(Ve.value))}if((Ae||je)&&(oe(!!Ae,Ne.message,Ve.message,INPUT_VALIDATION_RULES.max,INPUT_VALIDATION_RULES.min),!o))return Q(F[M].message),F}if((_||S)&&!se&&(isString(q)||d&&Array.isArray(q))){const Ae=getValueAndMessage(_),je=getValueAndMessage(S),Ne=!isNullOrUndefined(Ae.value)&&q.length>+Ae.value,Ve=!isNullOrUndefined(je.value)&&q.length<+je.value;if((Ne||Ve)&&(oe(Ne,Ae.message,je.message),!o))return Q(F[M].message),F}if(E&&!se&&isString(q)){const{value:Ae,message:je}=getValueAndMessage(E);if(isRegex(Ae)&&!q.match(Ae)&&(F[M]={type:INPUT_VALIDATION_RULES.pattern,message:je,ref:f,...ge(INPUT_VALIDATION_RULES.pattern,je)},!o))return Q(je),F}if(A){if(isFunction$3(A)){const Ae=await A(q,n),je=getValidateError(Ae,z);if(je&&(F[M]={...je,...ge(INPUT_VALIDATION_RULES.validate,je.message)},!o))return Q(je.message),F}else if(isObject(A)){let Ae={};for(const je in A){if(!isEmptyObject$1(Ae)&&!o)break;const Ne=getValidateError(await A[je](q,n),z,je);Ne&&(Ae={...Ne,...ge(je,Ne.message)},Q(Ne.message),o&&(F[M]=Ae))}if(!isEmptyObject$1(Ae)&&(F[M]={ref:z,...Ae},!o))return F}}return Q(!0),F};const defaultOptions$1={mode:VALIDATION_MODE.onSubmit,reValidateMode:VALIDATION_MODE.onChange,shouldFocusError:!0};function createFormControl(t={}){let e={...defaultOptions$1,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:isFunction$3(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},o={},l=isObject(e.defaultValues)||isObject(e.values)?cloneObject(e.defaultValues||e.values)||{}:{},d=e.shouldUnregister?{}:cloneObject(l),f={action:!1,mount:!1,watch:!1},g={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},b,_=0;const S={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let R={...S};const C={array:createSubject(),state:createSubject()},E=e.criteriaMode===VALIDATION_MODE.all,A=Ye=>rt=>{clearTimeout(_),_=setTimeout(Ye,rt)},M=async Ye=>{if(!e.disabled&&(S.isValid||R.isValid||Ye)){const rt=e.resolver?isEmptyObject$1((await te()).errors):await se(o,!0);rt!==n.isValid&&C.state.next({isValid:rt})}},I=(Ye,rt)=>{!e.disabled&&(S.isValidating||S.validatingFields||R.isValidating||R.validatingFields)&&((Ye||Array.from(g.mount)).forEach(st=>{st&&(rt?set(n.validatingFields,st,rt):unset(n.validatingFields,st))}),C.state.next({validatingFields:n.validatingFields,isValidating:!isEmptyObject$1(n.validatingFields)}))},j=(Ye,rt=[],st,lt,ft=!0,pt=!0)=>{if(lt&&st&&!e.disabled){if(f.action=!0,pt&&Array.isArray(get(o,Ye))){const yt=st(get(o,Ye),lt.argA,lt.argB);ft&&set(o,Ye,yt)}if(pt&&Array.isArray(get(n.errors,Ye))){const yt=st(get(n.errors,Ye),lt.argA,lt.argB);ft&&set(n.errors,Ye,yt),unsetEmptyArray(n.errors,Ye)}if((S.touchedFields||R.touchedFields)&&pt&&Array.isArray(get(n.touchedFields,Ye))){const yt=st(get(n.touchedFields,Ye),lt.argA,lt.argB);ft&&set(n.touchedFields,Ye,yt)}(S.dirtyFields||R.dirtyFields)&&(n.dirtyFields=getDirtyFields(l,d)),C.state.next({name:Ye,isDirty:oe(Ye,rt),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else set(d,Ye,rt)},q=(Ye,rt)=>{set(n.errors,Ye,rt),C.state.next({errors:n.errors})},z=Ye=>{n.errors=Ye,C.state.next({errors:n.errors,isValid:!1})},Q=(Ye,rt,st,lt)=>{const ft=get(o,Ye);if(ft){const pt=get(d,Ye,isUndefined(st)?get(l,Ye):st);isUndefined(pt)||lt&&lt.defaultChecked||rt?set(d,Ye,rt?pt:getFieldValue(ft._f)):Ne(Ye,pt),f.mount&&M()}},F=(Ye,rt,st,lt,ft)=>{let pt=!1,yt=!1;const zt={name:Ye};if(!e.disabled){if(!st||lt){(S.isDirty||R.isDirty)&&(yt=n.isDirty,n.isDirty=zt.isDirty=oe(),pt=yt!==zt.isDirty);const Yt=deepEqual$1(get(l,Ye),rt);yt=!!get(n.dirtyFields,Ye),Yt?unset(n.dirtyFields,Ye):set(n.dirtyFields,Ye,!0),zt.dirtyFields=n.dirtyFields,pt=pt||(S.dirtyFields||R.dirtyFields)&&yt!==!Yt}if(st){const Yt=get(n.touchedFields,Ye);Yt||(set(n.touchedFields,Ye,st),zt.touchedFields=n.touchedFields,pt=pt||(S.touchedFields||R.touchedFields)&&Yt!==st)}pt&&ft&&C.state.next(zt)}return pt?zt:{}},O=(Ye,rt,st,lt)=>{const ft=get(n.errors,Ye),pt=(S.isValid||R.isValid)&&isBoolean(rt)&&n.isValid!==rt;if(e.delayError&&st?(b=A(()=>q(Ye,st)),b(e.delayError)):(clearTimeout(_),b=null,st?set(n.errors,Ye,st):unset(n.errors,Ye)),(st?!deepEqual$1(ft,st):ft)||!isEmptyObject$1(lt)||pt){const yt={...lt,...pt&&isBoolean(rt)?{isValid:rt}:{},errors:n.errors,name:Ye};n={...n,...yt},C.state.next(yt)}},te=async Ye=>{I(Ye,!0);const rt=await e.resolver(d,e.context,getResolverOptions(Ye||g.mount,o,e.criteriaMode,e.shouldUseNativeValidation));return I(Ye),rt},ne=async Ye=>{const{errors:rt}=await te(Ye);if(Ye)for(const st of Ye){const lt=get(rt,st);lt?set(n.errors,st,lt):unset(n.errors,st)}else n.errors=rt;return rt},se=async(Ye,rt,st={valid:!0})=>{for(const lt in Ye){const ft=Ye[lt];if(ft){const{_f:pt,...yt}=ft;if(pt){const zt=g.array.has(pt.name),Yt=ft._f&&hasPromiseValidation(ft._f);Yt&&S.validatingFields&&I([lt],!0);const dn=await validateField(ft,g.disabled,d,E,e.shouldUseNativeValidation&&!rt,zt);if(Yt&&S.validatingFields&&I([lt]),dn[pt.name]&&(st.valid=!1,rt))break;!rt&&(get(dn,pt.name)?zt?updateFieldArrayRootError(n.errors,dn,pt.name):set(n.errors,pt.name,dn[pt.name]):unset(n.errors,pt.name))}!isEmptyObject$1(yt)&&await se(yt,rt,st)}}return st.valid},ge=()=>{for(const Ye of g.unMount){const rt=get(o,Ye);rt&&(rt._f.refs?rt._f.refs.every(st=>!live(st)):!live(rt._f.ref))&&Xe(Ye)}g.unMount=new Set},oe=(Ye,rt)=>!e.disabled&&(Ye&&rt&&set(d,Ye,rt),!deepEqual$1(qe(),l)),Ae=(Ye,rt,st)=>generateWatchOutput(Ye,g,{...f.mount?d:isUndefined(rt)?l:isString(Ye)?{[Ye]:rt}:rt},st,rt),je=Ye=>compact(get(f.mount?d:l,Ye,e.shouldUnregister?get(l,Ye,[]):[])),Ne=(Ye,rt,st={})=>{const lt=get(o,Ye);let ft=rt;if(lt){const pt=lt._f;pt&&(!pt.disabled&&set(d,Ye,getFieldValueAs(rt,pt)),ft=isHTMLElement(pt.ref)&&isNullOrUndefined(rt)?"":rt,isMultipleSelect(pt.ref)?[...pt.ref.options].forEach(yt=>yt.selected=ft.includes(yt.value)):pt.refs?isCheckBoxInput(pt.ref)?pt.refs.forEach(yt=>{(!yt.defaultChecked||!yt.disabled)&&(Array.isArray(ft)?yt.checked=!!ft.find(zt=>zt===yt.value):yt.checked=ft===yt.value||!!ft)}):pt.refs.forEach(yt=>yt.checked=yt.value===ft):isFileInput(pt.ref)?pt.ref.value="":(pt.ref.value=ft,pt.ref.type||C.state.next({name:Ye,values:cloneObject(d)})))}(st.shouldDirty||st.shouldTouch)&&F(Ye,ft,st.shouldTouch,st.shouldDirty,!0),st.shouldValidate&&Oe(Ye)},Ve=(Ye,rt,st)=>{for(const lt in rt){if(!rt.hasOwnProperty(lt))return;const ft=rt[lt],pt=Ye+"."+lt,yt=get(o,pt);(g.array.has(Ye)||isObject(ft)||yt&&!yt._f)&&!isDateObject(ft)?Ve(pt,ft,st):Ne(pt,ft,st)}},Le=(Ye,rt,st={})=>{const lt=get(o,Ye),ft=g.array.has(Ye),pt=cloneObject(rt);set(d,Ye,pt),ft?(C.array.next({name:Ye,values:cloneObject(d)}),(S.isDirty||S.dirtyFields||R.isDirty||R.dirtyFields)&&st.shouldDirty&&C.state.next({name:Ye,dirtyFields:getDirtyFields(l,d),isDirty:oe(Ye,pt)})):lt&&!lt._f&&!isNullOrUndefined(pt)?Ve(Ye,pt,st):Ne(Ye,pt,st),isWatched(Ye,g)&&C.state.next({...n}),C.state.next({name:f.mount?Ye:void 0,values:cloneObject(d)})},ze=async Ye=>{f.mount=!0;const rt=Ye.target;let st=rt.name,lt=!0;const ft=get(o,st),pt=Yt=>{lt=Number.isNaN(Yt)||isDateObject(Yt)&&isNaN(Yt.getTime())||deepEqual$1(Yt,get(d,st,Yt))},yt=getValidationModes(e.mode),zt=getValidationModes(e.reValidateMode);if(ft){let Yt,dn;const gn=rt.type?getFieldValue(ft._f):getEventValue(Ye),qt=Ye.type===EVENTS.BLUR||Ye.type===EVENTS.FOCUS_OUT,wn=!hasValidation(ft._f)&&!e.resolver&&!get(n.errors,st)&&!ft._f.deps||skipValidation(qt,get(n.touchedFields,st),n.isSubmitted,zt,yt),_n=isWatched(st,g,qt);set(d,st,gn),qt?(ft._f.onBlur&&ft._f.onBlur(Ye),b&&b(0)):ft._f.onChange&&ft._f.onChange(Ye);const xn=F(st,gn,qt),Rn=!isEmptyObject$1(xn)||_n;if(!qt&&C.state.next({name:st,type:Ye.type,values:cloneObject(d)}),wn)return(S.isValid||R.isValid)&&(e.mode==="onBlur"?qt&&M():qt||M()),Rn&&C.state.next({name:st,..._n?{}:xn});if(!qt&&_n&&C.state.next({...n}),e.resolver){const{errors:En}=await te([st]);if(pt(gn),lt){const Ln=schemaErrorLookup(n.errors,o,st),Xt=schemaErrorLookup(En,o,Ln.name||st);Yt=Xt.error,st=Xt.name,dn=isEmptyObject$1(En)}}else I([st],!0),Yt=(await validateField(ft,g.disabled,d,E,e.shouldUseNativeValidation))[st],I([st]),pt(gn),lt&&(Yt?dn=!1:(S.isValid||R.isValid)&&(dn=await se(o,!0)));lt&&(ft._f.deps&&Oe(ft._f.deps),O(st,dn,Yt,xn))}},$e=(Ye,rt)=>{if(get(n.errors,rt)&&Ye.focus)return Ye.focus(),1},Oe=async(Ye,rt={})=>{let st,lt;const ft=convertToArrayPayload(Ye);if(e.resolver){const pt=await ne(isUndefined(Ye)?Ye:ft);st=isEmptyObject$1(pt),lt=Ye?!ft.some(yt=>get(pt,yt)):st}else Ye?(lt=(await Promise.all(ft.map(async pt=>{const yt=get(o,pt);return await se(yt&&yt._f?{[pt]:yt}:yt)}))).every(Boolean),!(!lt&&!n.isValid)&&M()):lt=st=await se(o);return C.state.next({...!isString(Ye)||(S.isValid||R.isValid)&&st!==n.isValid?{}:{name:Ye},...e.resolver||!Ye?{isValid:st}:{},errors:n.errors}),rt.shouldFocus&&!lt&&iterateFieldsByAction(o,$e,Ye?ft:g.mount),lt},qe=Ye=>{const rt={...f.mount?d:l};return isUndefined(Ye)?rt:isString(Ye)?get(rt,Ye):Ye.map(st=>get(rt,st))},Ge=(Ye,rt)=>({invalid:!!get((rt||n).errors,Ye),isDirty:!!get((rt||n).dirtyFields,Ye),error:get((rt||n).errors,Ye),isValidating:!!get(n.validatingFields,Ye),isTouched:!!get((rt||n).touchedFields,Ye)}),Ue=Ye=>{Ye&&convertToArrayPayload(Ye).forEach(rt=>unset(n.errors,rt)),C.state.next({errors:Ye?n.errors:{}})},Je=(Ye,rt,st)=>{const lt=(get(o,Ye,{_f:{}})._f||{}).ref,ft=get(n.errors,Ye)||{},{ref:pt,message:yt,type:zt,...Yt}=ft;set(n.errors,Ye,{...Yt,...rt,ref:lt}),C.state.next({name:Ye,errors:n.errors,isValid:!1}),st&&st.shouldFocus&&lt&&lt.focus&&lt.focus()},Ze=(Ye,rt)=>isFunction$3(Ye)?C.state.subscribe({next:st=>Ye(Ae(void 0,rt),st)}):Ae(Ye,rt,!0),We=Ye=>C.state.subscribe({next:rt=>{shouldSubscribeByName(Ye.name,rt.name,Ye.exact)&&shouldRenderFormState(rt,Ye.formState||S,Ft,Ye.reRenderRoot)&&Ye.callback({values:{...d},...n,...rt})}}).unsubscribe,tt=Ye=>(f.mount=!0,R={...R,...Ye.formState},We({...Ye,formState:R})),Xe=(Ye,rt={})=>{for(const st of Ye?convertToArrayPayload(Ye):g.mount)g.mount.delete(st),g.array.delete(st),rt.keepValue||(unset(o,st),unset(d,st)),!rt.keepError&&unset(n.errors,st),!rt.keepDirty&&unset(n.dirtyFields,st),!rt.keepTouched&&unset(n.touchedFields,st),!rt.keepIsValidating&&unset(n.validatingFields,st),!e.shouldUnregister&&!rt.keepDefaultValue&&unset(l,st);C.state.next({values:cloneObject(d)}),C.state.next({...n,...rt.keepDirty?{isDirty:oe()}:{}}),!rt.keepIsValid&&M()},it=({disabled:Ye,name:rt})=>{(isBoolean(Ye)&&f.mount||Ye||g.disabled.has(rt))&&(Ye?g.disabled.add(rt):g.disabled.delete(rt))},et=(Ye,rt={})=>{let st=get(o,Ye);const lt=isBoolean(rt.disabled)||isBoolean(e.disabled);return set(o,Ye,{...st||{},_f:{...st&&st._f?st._f:{ref:{name:Ye}},name:Ye,mount:!0,...rt}}),g.mount.add(Ye),st?it({disabled:isBoolean(rt.disabled)?rt.disabled:e.disabled,name:Ye}):Q(Ye,!0,rt.value),{...lt?{disabled:rt.disabled||e.disabled}:{},...e.progressive?{required:!!rt.required,min:getRuleValue(rt.min),max:getRuleValue(rt.max),minLength:getRuleValue(rt.minLength),maxLength:getRuleValue(rt.maxLength),pattern:getRuleValue(rt.pattern)}:{},name:Ye,onChange:ze,onBlur:ze,ref:ft=>{if(ft){et(Ye,rt),st=get(o,Ye);const pt=isUndefined(ft.value)&&ft.querySelectorAll&&ft.querySelectorAll("input,select,textarea")[0]||ft,yt=isRadioOrCheckbox(pt),zt=st._f.refs||[];if(yt?zt.find(Yt=>Yt===pt):pt===st._f.ref)return;set(o,Ye,{_f:{...st._f,...yt?{refs:[...zt.filter(live),pt,...Array.isArray(get(l,Ye))?[{}]:[]],ref:{type:pt.type,name:Ye}}:{ref:pt}}}),Q(Ye,!1,void 0,pt)}else st=get(o,Ye,{}),st._f&&(st._f.mount=!1),(e.shouldUnregister||rt.shouldUnregister)&&!(isNameInFieldArray(g.array,Ye)&&f.action)&&g.unMount.add(Ye)}}},at=()=>e.shouldFocusError&&iterateFieldsByAction(o,$e,g.mount),ot=Ye=>{isBoolean(Ye)&&(C.state.next({disabled:Ye}),iterateFieldsByAction(o,(rt,st)=>{const lt=get(o,st);lt&&(rt.disabled=lt._f.disabled||Ye,Array.isArray(lt._f.refs)&&lt._f.refs.forEach(ft=>{ft.disabled=lt._f.disabled||Ye}))},0,!1))},He=(Ye,rt)=>async st=>{let lt;st&&(st.preventDefault&&st.preventDefault(),st.persist&&st.persist());let ft=cloneObject(d);if(C.state.next({isSubmitting:!0}),e.resolver){const{errors:pt,values:yt}=await te();n.errors=pt,ft=cloneObject(yt)}else await se(o);if(g.disabled.size)for(const pt of g.disabled)unset(ft,pt);if(unset(n.errors,"root"),isEmptyObject$1(n.errors)){C.state.next({errors:{}});try{await Ye(ft,st)}catch(pt){lt=pt}}else rt&&await rt({...n.errors},st),at(),setTimeout(at);if(C.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:isEmptyObject$1(n.errors)&&!lt,submitCount:n.submitCount+1,errors:n.errors}),lt)throw lt},mt=(Ye,rt={})=>{get(o,Ye)&&(isUndefined(rt.defaultValue)?Le(Ye,cloneObject(get(l,Ye))):(Le(Ye,rt.defaultValue),set(l,Ye,cloneObject(rt.defaultValue))),rt.keepTouched||unset(n.touchedFields,Ye),rt.keepDirty||(unset(n.dirtyFields,Ye),n.isDirty=rt.defaultValue?oe(Ye,cloneObject(get(l,Ye))):oe()),rt.keepError||(unset(n.errors,Ye),S.isValid&&M()),C.state.next({...n}))},Qe=(Ye,rt={})=>{const st=Ye?cloneObject(Ye):l,lt=cloneObject(st),ft=isEmptyObject$1(Ye),pt=ft?l:lt;if(rt.keepDefaultValues||(l=st),!rt.keepValues){if(rt.keepDirtyValues){const yt=new Set([...g.mount,...Object.keys(getDirtyFields(l,d))]);for(const zt of Array.from(yt))get(n.dirtyFields,zt)?set(pt,zt,get(d,zt)):Le(zt,get(pt,zt))}else{if(isWeb&&isUndefined(Ye))for(const yt of g.mount){const zt=get(o,yt);if(zt&&zt._f){const Yt=Array.isArray(zt._f.refs)?zt._f.refs[0]:zt._f.ref;if(isHTMLElement(Yt)){const dn=Yt.closest("form");if(dn){dn.reset();break}}}}if(rt.keepFieldsRef)for(const yt of g.mount)Le(yt,get(pt,yt));else o={}}d=e.shouldUnregister?rt.keepDefaultValues?cloneObject(l):{}:cloneObject(pt),C.array.next({values:{...pt}}),C.state.next({values:{...pt}})}g={mount:rt.keepDirtyValues?g.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},f.mount=!S.isValid||!!rt.keepIsValid||!!rt.keepDirtyValues,f.watch=!!e.shouldUnregister,C.state.next({submitCount:rt.keepSubmitCount?n.submitCount:0,isDirty:ft?!1:rt.keepDirty?n.isDirty:!!(rt.keepDefaultValues&&!deepEqual$1(Ye,l)),isSubmitted:rt.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ft?{}:rt.keepDirtyValues?rt.keepDefaultValues&&d?getDirtyFields(l,d):n.dirtyFields:rt.keepDefaultValues&&Ye?getDirtyFields(l,Ye):rt.keepDirty?n.dirtyFields:{},touchedFields:rt.keepTouched?n.touchedFields:{},errors:rt.keepErrors?n.errors:{},isSubmitSuccessful:rt.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Rt=(Ye,rt)=>Qe(isFunction$3(Ye)?Ye(d):Ye,rt),$t=(Ye,rt={})=>{const st=get(o,Ye),lt=st&&st._f;if(lt){const ft=lt.refs?lt.refs[0]:lt.ref;ft.focus&&(ft.focus(),rt.shouldSelect&&isFunction$3(ft.select)&&ft.select())}},Ft=Ye=>{n={...n,...Ye}},Mt={control:{register:et,unregister:Xe,getFieldState:Ge,handleSubmit:He,setError:Je,_subscribe:We,_runSchema:te,_focusError:at,_getWatch:Ae,_getDirty:oe,_setValid:M,_setFieldArray:j,_setDisabledField:it,_setErrors:z,_getFieldArray:je,_reset:Qe,_resetDefaultValues:()=>isFunction$3(e.defaultValues)&&e.defaultValues().then(Ye=>{Rt(Ye,e.resetOptions),C.state.next({isLoading:!1})}),_removeUnmounted:ge,_disableForm:ot,_subjects:C,_proxyFormState:S,get _fields(){return o},get _formValues(){return d},get _state(){return f},set _state(Ye){f=Ye},get _defaultValues(){return l},get _names(){return g},set _names(Ye){g=Ye},get _formState(){return n},get _options(){return e},set _options(Ye){e={...e,...Ye}}},subscribe:tt,trigger:Oe,register:et,handleSubmit:He,watch:Ze,setValue:Le,getValues:qe,reset:Rt,resetField:mt,clearErrors:Ue,unregister:Xe,setError:Je,setFocus:$t,getFieldState:Ge};return{...Mt,formControl:Mt}}function useForm(t={}){const e=React.useRef(void 0),n=React.useRef(void 0),[o,l]=React.useState({isDirty:!1,isValidating:!1,isLoading:isFunction$3(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:isFunction$3(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:o},t.defaultValues&&!isFunction$3(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:f,...g}=createFormControl(t);e.current={...g,formState:o}}const d=e.current.control;return d._options=t,useIsomorphicLayoutEffect$1(()=>{const f=d._subscribe({formState:d._proxyFormState,callback:()=>l({...d._formState}),reRenderRoot:!0});return l(g=>({...g,isReady:!0})),d._formState.isReady=!0,f},[d]),React.useEffect(()=>d._disableForm(t.disabled),[d,t.disabled]),React.useEffect(()=>{t.mode&&(d._options.mode=t.mode),t.reValidateMode&&(d._options.reValidateMode=t.reValidateMode)},[d,t.mode,t.reValidateMode]),React.useEffect(()=>{t.errors&&(d._setErrors(t.errors),d._focusError())},[d,t.errors]),React.useEffect(()=>{t.shouldUnregister&&d._subjects.state.next({values:d._getWatch()})},[d,t.shouldUnregister]),React.useEffect(()=>{if(d._proxyFormState.isDirty){const f=d._getDirty();f!==o.isDirty&&d._subjects.state.next({isDirty:f})}},[d,o.isDirty]),React.useEffect(()=>{t.values&&!deepEqual$1(t.values,n.current)?(d._reset(t.values,{keepFieldsRef:!0,...d._options.resetOptions}),n.current=t.values,l(f=>({...f}))):d._resetDefaultValues()},[d,t.values]),React.useEffect(()=>{d._state.mount||(d._setValid(),d._state.mount=!0),d._state.watch&&(d._state.watch=!1,d._subjects.state.next({...d._formState})),d._removeUnmounted()}),e.current.formState=getProxyFormState(o,d),e.current}var defaultErrorHandler=function(t){process.env.NODE_ENV!=="production"&&console.error(t)},defaultWarnHandler=function(t){process.env.NODE_ENV!=="production"&&console.warn(t)},DEFAULT_INTL_CONFIG={formats:{},messages:{},timeZone:void 0,defaultLocale:"en",defaultFormats:{},fallbackOnEmptyString:!0,onError:defaultErrorHandler,onWarn:defaultWarnHandler};function invariant(t,e,n){if(n===void 0&&(n=Error),!t)throw new n(e)}function invariantIntlContext(t){invariant(t,"[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.")}__assign$1(__assign$1({},DEFAULT_INTL_CONFIG),{textComponent:React__namespace.Fragment});var reactIs={exports:{}},reactIs_production_min={};/** @license React v16.13.1
1129
+ `,An=await Q(mn);if(An){const qn=(nn=(await te({routeApplicationId:t,partnerId:"2"})).data)==null?void 0:nn.ConversationId;if(qn)await _(),Yt(qn,An);else throw new Error("Failed to retrieve conversation ID after creation.")}}catch(pn){console.error("Error during 'Chat with Randmar' initiation:",pn),rt({title:"Error",description:"Could not initiate chat. Please try again later.",variant:"destructive"})}finally{j.current&&(j.current.disabled=!1),O(!1)}},En=()=>{tt(ct=>ct.map(Jt=>Jt.partner1!==ASSISTANT_ID&&Jt.partner2!==ASSISTANT_ID?Jt:{...Jt,messages:[]})),$t([]),Le()},Ln=()=>{Oe&&E({routeApplicationId:t,partnerId:Oe[0]==t?Oe[1]:Oe[0]}).then(()=>{$e("approved")})},Xt=st(),kn=We.filter(ct=>ct.pending).length,bn=(ct,Ut)=>{I(Jt=>({...Jt,[ct]:Ut})),En()},Cn=React.useRef(null);React.useEffect(()=>{var ct;(ct=Cn.current)==null||ct.scrollIntoView({behavior:"smooth"})},[Ne]);const an=({className:ct="h-4 w-4"})=>jsxRuntime.jsxs("svg",{style:{flex:"none",lineHeight:1},viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",className:ct,children:[jsxRuntime.jsx("title",{children:"Gemini"}),jsxRuntime.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"#3186FF"}),jsxRuntime.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#lobe-icons-gemini-fill-0)"}),jsxRuntime.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#lobe-icons-gemini-fill-1)"}),jsxRuntime.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#lobe-icons-gemini-fill-2)"}),jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"lobe-icons-gemini-fill-0",x1:"7",x2:"11",y1:"15.5",y2:"12",children:[jsxRuntime.jsx("stop",{stopColor:"#08B962"}),jsxRuntime.jsx("stop",{offset:"1",stopColor:"#08B962",stopOpacity:"0"})]}),jsxRuntime.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"lobe-icons-gemini-fill-1",x1:"8",x2:"11.5",y1:"5.5",y2:"11",children:[jsxRuntime.jsx("stop",{stopColor:"#F94543"}),jsxRuntime.jsx("stop",{offset:"1",stopColor:"#F94543",stopOpacity:"0"})]}),jsxRuntime.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"lobe-icons-gemini-fill-2",x1:"3.5",x2:"17.5",y1:"13.5",y2:"12",children:[jsxRuntime.jsx("stop",{stopColor:"#FABC12"}),jsxRuntime.jsx("stop",{offset:".46",stopColor:"#FABC12",stopOpacity:"0"})]})]})]}),Vn=jsxRuntime.jsx("div",{className:"flex h-full items-center justify-center",children:jsxRuntime.jsxs("div",{className:"text-center text-muted-foreground",children:[jsxRuntime.jsx(LoaderCircle,{className:"h-12 w-12 animate-spin mx-auto mb-4"}),jsxRuntime.jsx("p",{children:"Loading API functions..."})]})});return jsxRuntime.jsxs("div",{className:cn("flex overflow-hidden",l),children:[o!==!0&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"w-[260px] p-4 pt-3 flex flex-col border-r",children:[jsxRuntime.jsx("div",{className:"p-4 font-semibold border-b",children:"Communications"}),We.length>1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"p-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(Search,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),jsxRuntime.jsx(Input,{placeholder:"Search chats...",className:"pl-8 h-9",value:Xe,onChange:ct=>it(ct.target.value)})]})}),jsxRuntime.jsx(Tabs,{value:ze,onValueChange:$e,className:"w-full mb-1",children:jsxRuntime.jsxs(TabsList,{className:"grid grid-cols-6 h-9 mx-2",children:[jsxRuntime.jsx(TabsTrigger,{value:"approved",className:"text-xs col-span-3",children:"Approved"}),jsxRuntime.jsxs(TabsTrigger,{value:"pending",className:"text-xs col-span-3",children:["Pending ",kn>0&&`(${kn})`]})]})})]}),jsxRuntime.jsx("div",{className:"mt-1 mb-1",children:We.findIndex(ct=>ct.partner1==="2"||ct.partner2==="2")<0?jsxRuntime.jsx(Button,{className:"w-full",ref:j,disabled:F,onClick:Rn,children:F?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Starting Chat..."]}):"Chat with Randmar"},"b1"):ze==="approved"&&We.length>=5?null:jsxRuntime.jsx(reactRouterDom.Link,{to:`${window.location.hostname==="dashboard.randmar.io"?"":"https://dashboard.randmar.io"}/${t}/ExploreManufacturers`,target:window.location.hostname==="dashboard.randmar.io"?"_self":"_blank",children:jsxRuntime.jsx(Button,{className:"w-full",children:"Explore Manufacturers"},"b2")})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1",children:We.length>0&&jsxRuntime.jsx(ChatList,{userId:t,chats:pt.filter(ct=>ct.partner1!==ASSISTANT_ID&&ct.partner2!==ASSISTANT_ID),activeChat:Xt??null,onSelectChat:qe})}),jsxRuntime.jsx(Separator$1,{className:"mt-auto"}),jsxRuntime.jsx("div",{className:"pt-1",children:We.find(ct=>ct.partner1===ASSISTANT_ID||ct.partner2===ASSISTANT_ID)&&jsxRuntime.jsx(ChatList,{userId:t,chats:pt.filter(ct=>ct.partner1===ASSISTANT_ID||ct.partner2===ASSISTANT_ID),activeChat:Xt??null,onSelectChat:qe,assistantStickyMode:!0})})]})}),jsxRuntime.jsx("div",{className:"flex-5 flex flex-col",children:Oe?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:Oe[0]==ASSISTANT_ID||Oe[1]==ASSISTANT_ID?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:jsxRuntime.jsx(Bot,{className:"text-primary fill-white min-h-full"})}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:"Randmar Assistant"}),jsxRuntime.jsx(Button,{variant:"ghost",size:"sm",className:"ml-auto",confirmationDialog:{title:"Report Issue",content:"This action will send a copy of your chat to Randmar. Send it?",onConfirm:()=>xn()},disabled:S,children:S?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-5 w-5 mr-2 animate-spin"}),"Sending Feedback..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(MessageSquareShare,{className:"h-5 w-5 mr-2"}),"Report Issue"]})}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",onClick:()=>En(),children:jsxRuntime.jsx(MessageCircleX,{className:"h-5 w-5"})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Reset Chat"})})]})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:jsxRuntime.jsx(PartnerLogo,{id:Oe[0]===t?Oe[1]:Oe[0],width:72,height:72})}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:Xt==null?void 0:Xt.name}),jsxRuntime.jsx("div",{className:"flex items-center space-x-2 ml-auto",children:jsxRuntime.jsx(reactRouterDom.Link,{to:`${window.location.hostname==="dashboard.randmar.io"?"":"https://dashboard.randmar.io"}/${t}/Partner/${Oe[0]===t?Oe[1]:Oe[0]}`,target:window.location.hostname==="dashboard.randmar.io"?"_self":"_blank",children:jsxRuntime.jsx(Button,{children:"View Partner"})})})]})}),Xt!=null&&Xt.pending&&Xt.partner1==t?jsxRuntime.jsx("p",{className:"mt-8 p-2 mx-auto",children:"This conversation is awaiting approval by the other party — please check back later."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:je?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ChatMessages,{messages:(Xt==null?void 0:Xt.messages)??[],currentUserId:t,isAssistantChat:lt(),botStatus:lt()?Ve:""}),jsxRuntime.jsx("div",{ref:ot})]}):Vn}),jsxRuntime.jsxs("div",{className:"p-4 border-t border-r flex",children:[(Xt==null?void 0:Xt.pending)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{disabled:A,onClick:()=>Ln(),children:[jsxRuntime.jsx(Handshake,{}),"Accept Conversation Request"]}),jsxRuntime.jsxs(Button,{disabled:!0,className:"ml-2",children:[jsxRuntime.jsx(ThumbsDown,{}),"Block Partner"]})]}),jsxRuntime.jsx(Textarea,{ref:Mt,placeholder:"Type a message...",value:Ge,onPaste:dn,onChange:ct=>Ue(ct.target.value),onKeyDown:ct=>{ct.key!=="Enter"||ct.shiftKey||(ct.preventDefault(),gn())},className:Xt!=null&&Xt.pending?"collapse":"flex-1 resize-none",disabled:!je||(Xt==null?void 0:Xt.pending)}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Button,{size:"icon",variant:"default",className:Xt!=null&&Xt.pending?"collapse":"ml-2 h-8 w-8",disabled:!je||!!Ve||(Xt==null?void 0:Xt.pending),onClick:gn,children:jsxRuntime.jsx(Send,{className:"h-6 w-6"})}),lt()&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Input,{type:"file",onChange:qt,className:"hidden",ref:Ye}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:wn,className:Xt!=null&&Xt.pending?"collapse":"ml-2 h-8 w-8",disabled:!je||Ve!==""||(Xt==null?void 0:Xt.pending)||!!mt,children:jsxRuntime.jsx(Paperclip,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:_n,className:Xt!=null&&Xt.pending?"collapse":"ml-2 h-8 w-8",disabled:!je||Ve!==""||(Xt==null?void 0:Xt.pending)||!mt,children:jsxRuntime.jsx(Trash,{className:"h-5 w-5"})})]})]})]})]})]}):jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:je?"Select a chat to start messaging":Vn})}),jsxRuntime.jsx("div",{"data-thin":lt(),className:"w-[480px] flex flex-col border-l flex-5 data-[thin=true]:flex-3",children:lt()?jsxRuntime.jsxs("div",{className:"flex h-full flex-col border-r bg-slate-50 text-slate-800",children:[jsxRuntime.jsxs("div",{className:"p-4 space-y-4 border-b border-slate-200/80",children:[jsxRuntime.jsxs("h4",{className:"flex items-center text-xs font-semibold tracking-wider text-slate-500 uppercase",children:[jsxRuntime.jsx(Settings,{className:"w-4 h-4 mr-2"}),"Assistant Settings"]}),jsxRuntime.jsxs("div",{className:"space-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"space-y-1.5 pr-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"think-harder-switch",children:"Think Harder"}),jsxRuntime.jsx("p",{className:"text-xs text-slate-600",children:"Uses a more advanced model for complex queries."})]}),jsxRuntime.jsx(Switch,{id:"think-harder-switch",checked:M.assistantThinkHarder,onCheckedChange:ct=>bn("assistantThinkHarder",ct)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"space-y-1.5 pr-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"preload-bestsellers-switch",children:"Preload Best-Sellers"}),jsxRuntime.jsx("p",{className:"text-xs text-slate-600",children:"Adds top products to the AI's context for faster answers."})]}),jsxRuntime.jsx(Switch,{id:"preload-bestsellers-switch",checked:M.assistantCachedPreloading,onCheckedChange:ct=>bn("assistantCachedPreloading",ct)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"space-y-1.5 pr-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"proactive-context-switch",children:"Proactive Context Fetch"}),jsxRuntime.jsx("p",{className:"text-xs text-slate-600",children:"Loads your initial data at the start of a new conversation."})]}),jsxRuntime.jsx(Switch,{id:"proactive-context-switch",checked:M.assistantDynamicPreloading,onCheckedChange:ct=>bn("assistantDynamicPreloading",ct)})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col border-b border-slate-200/80 h-32",children:[jsxRuntime.jsxs("h4",{className:"flex-shrink-0 flex items-center p-4 pb-2 text-xs font-semibold tracking-wider text-slate-500 uppercase",children:[jsxRuntime.jsx(File,{className:"w-4 h-4 mr-2"}),"Attached Files"]}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 px-4",children:jsxRuntime.jsx("div",{className:"py-2 text-sm",children:mt||Rt.length>0?jsxRuntime.jsxs("div",{className:"space-y-2",children:[mt&&jsxRuntime.jsxs("div",{className:"flex items-center text-blue-600",children:[jsxRuntime.jsx(File,{className:"w-4 h-4 mr-2 flex-shrink-0"}),jsxRuntime.jsxs("span",{className:"truncate",children:[mt.name," (pending)"]})]}),Rt.slice().reverse().map((ct,Ut)=>jsxRuntime.jsxs("div",{className:"flex items-center text-slate-700 hover:text-slate-900 transition-colors duration-150",children:[jsxRuntime.jsx(File,{className:"w-4 h-4 mr-2 flex-shrink-0"}),jsxRuntime.jsx("span",{className:"truncate",children:ct})]},Ut))]}):jsxRuntime.jsx("p",{className:"text-slate-500 text-xs italic",children:"No files attached yet."})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[jsxRuntime.jsxs("h4",{className:"flex-shrink-0 flex items-center p-4 pb-2 text-xs font-semibold tracking-wider text-slate-500 uppercase",children:[jsxRuntime.jsx(CodeXml,{className:"w-4 h-4 mr-2"}),"Developer Log"]}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 px-4",children:jsxRuntime.jsxs("div",{className:"py-2 text-xs font-mono",children:[jsxRuntime.jsx(DebugMessageDisplay,{debugMessages:Ne}),jsxRuntime.jsx("div",{ref:Cn})]})})]}),jsxRuntime.jsx("div",{className:"mt-auto p-3 border-t border-slate-200/80",children:jsxRuntime.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[jsxRuntime.jsx("p",{className:"text-xs text-slate-500",children:"Powered by Gemini"}),jsxRuntime.jsx(an,{})]})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Partner Overview"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"mt-1",children:jsxRuntime.jsx(PartnerRelationshipPage,{applicationId:t,partnerId:((Oe==null?void 0:Oe[0])===t?Oe[1]:Oe==null?void 0:Oe[0])??t,userEmail:e,shopifyHostName:void 0,isSuperAdmin:!1})})})]})})]})});function UnsavedChangesDialog({isOpen:t,onClose:e,onConfirm:n,title:o,description:l,confirmText:d="Confirm",cancelText:f="Cancel"}){return jsxRuntime.jsx(Dialog,{open:t,onOpenChange:e,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:o}),jsxRuntime.jsx(DialogDescription,{children:l})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:e,children:f}),jsxRuntime.jsx(Button,{onClick:n,children:d})]})]})})}function useRouterNavigationGuard(t){const[e,n]=React.useState(!1),o=reactRouterDom.useBlocker(React.useCallback(({currentLocation:g,nextLocation:b})=>{const _=g.pathname!==b.pathname||g.search!==b.search||g.hash!==b.hash;return t()&&_},[t]));React.useEffect(()=>{o.state==="blocked"&&n(!0)},[o]),React.useEffect(()=>{const g=b=>{if(t())return b.preventDefault(),"You have unsaved changes. Are you sure you want to leave?"};return window.addEventListener("beforeunload",g),()=>{window.removeEventListener("beforeunload",g)}},[t]);const l=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.proceed()},[o]),d=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.reset()},[o]),f=React.useCallback(()=>jsxRuntime.jsx(UnsavedChangesDialog,{isOpen:e,onClose:d,onConfirm:l,title:"Unsaved Changes",description:"You have unsaved changes. Are you sure you want to leave? Your changes will be lost.",confirmText:"Discard Changes",cancelText:"Stay on Page"}),[e,d,l]);return{showDialog:e,handleConfirm:l,handleCancel:d,NavigationGuardDialog:f}}var isCheckBoxInput=t=>t.type==="checkbox",isDateObject=t=>t instanceof Date,isNullOrUndefined=t=>t==null;const isObjectType=t=>typeof t=="object";var isObject=t=>!isNullOrUndefined(t)&&!Array.isArray(t)&&isObjectType(t)&&!isDateObject(t),getEventValue=t=>isObject(t)&&t.target?isCheckBoxInput(t.target)?t.target.checked:t.target.value:t,getNodeParentName=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,isNameInFieldArray=(t,e)=>t.has(getNodeParentName(e)),isPlainObject$1=t=>{const e=t.constructor&&t.constructor.prototype;return isObject(e)&&e.hasOwnProperty("isPrototypeOf")},isWeb=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function cloneObject(t){let e;const n=Array.isArray(t),o=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(!(isWeb&&(t instanceof Blob||o))&&(n||isObject(t)))if(e=n?[]:{},!n&&!isPlainObject$1(t))e=t;else for(const l in t)t.hasOwnProperty(l)&&(e[l]=cloneObject(t[l]));else return t;return e}var isKey=t=>/^\w*$/.test(t),isUndefined=t=>t===void 0,compact=t=>Array.isArray(t)?t.filter(Boolean):[],stringToPath=t=>compact(t.replace(/["|']|\]/g,"").split(/\.|\[/)),get=(t,e,n)=>{if(!e||!isObject(t))return n;const o=(isKey(e)?[e]:stringToPath(e)).reduce((l,d)=>isNullOrUndefined(l)?l:l[d],t);return isUndefined(o)||o===t?isUndefined(t[e])?n:t[e]:o},isBoolean=t=>typeof t=="boolean",set=(t,e,n)=>{let o=-1;const l=isKey(e)?[e]:stringToPath(e),d=l.length,f=d-1;for(;++o<d;){const g=l[o];let b=n;if(o!==f){const _=t[g];b=isObject(_)||Array.isArray(_)?_:isNaN(+l[o+1])?{}:[]}if(g==="__proto__"||g==="constructor"||g==="prototype")return;t[g]=b,t=t[g]}};const EVENTS={BLUR:"blur",FOCUS_OUT:"focusout"},VALIDATION_MODE={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},INPUT_VALIDATION_RULES={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},HookFormContext=React.createContext(null);HookFormContext.displayName="HookFormContext";var getProxyFormState=(t,e,n,o=!0)=>{const l={defaultValues:e._defaultValues};for(const d in t)Object.defineProperty(l,d,{get:()=>{const f=d;return e._proxyFormState[f]!==VALIDATION_MODE.all&&(e._proxyFormState[f]=!o||VALIDATION_MODE.all),t[f]}});return l};const useIsomorphicLayoutEffect$1=typeof window<"u"?React__namespace.useLayoutEffect:React__namespace.useEffect;var isString=t=>typeof t=="string",generateWatchOutput=(t,e,n,o,l)=>isString(t)?(o&&e.watch.add(t),get(n,t,l)):Array.isArray(t)?t.map(d=>(o&&e.watch.add(d),get(n,d))):(o&&(e.watchAll=!0),n),appendErrors=(t,e,n,o,l)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[o]:l||!0}}:{},convertToArrayPayload=t=>Array.isArray(t)?t:[t],createSubject=()=>{let t=[];return{get observers(){return t},next:l=>{for(const d of t)d.next&&d.next(l)},subscribe:l=>(t.push(l),{unsubscribe:()=>{t=t.filter(d=>d!==l)}}),unsubscribe:()=>{t=[]}}},isPrimitive=t=>isNullOrUndefined(t)||!isObjectType(t);function deepEqual$1(t,e,n=new WeakSet){if(isPrimitive(t)||isPrimitive(e))return t===e;if(isDateObject(t)&&isDateObject(e))return t.getTime()===e.getTime();const o=Object.keys(t),l=Object.keys(e);if(o.length!==l.length)return!1;if(n.has(t)||n.has(e))return!0;n.add(t),n.add(e);for(const d of o){const f=t[d];if(!l.includes(d))return!1;if(d!=="ref"){const g=e[d];if(isDateObject(f)&&isDateObject(g)||isObject(f)&&isObject(g)||Array.isArray(f)&&Array.isArray(g)?!deepEqual$1(f,g,n):f!==g)return!1}}return!0}var isEmptyObject$1=t=>isObject(t)&&!Object.keys(t).length,isFileInput=t=>t.type==="file",isFunction$3=t=>typeof t=="function",isHTMLElement=t=>{if(!isWeb)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},isMultipleSelect=t=>t.type==="select-multiple",isRadioInput=t=>t.type==="radio",isRadioOrCheckbox=t=>isRadioInput(t)||isCheckBoxInput(t),live=t=>isHTMLElement(t)&&t.isConnected;function baseGet(t,e){const n=e.slice(0,-1).length;let o=0;for(;o<n;)t=isUndefined(t)?o++:t[e[o++]];return t}function isEmptyArray(t){for(const e in t)if(t.hasOwnProperty(e)&&!isUndefined(t[e]))return!1;return!0}function unset(t,e){const n=Array.isArray(e)?e:isKey(e)?[e]:stringToPath(e),o=n.length===1?t:baseGet(t,n),l=n.length-1,d=n[l];return o&&delete o[d],l!==0&&(isObject(o)&&isEmptyObject$1(o)||Array.isArray(o)&&isEmptyArray(o))&&unset(t,n.slice(0,-1)),t}var objectHasFunction=t=>{for(const e in t)if(isFunction$3(t[e]))return!0;return!1};function markFieldsDirty(t,e={}){const n=Array.isArray(t);if(isObject(t)||n)for(const o in t)Array.isArray(t[o])||isObject(t[o])&&!objectHasFunction(t[o])?(e[o]=Array.isArray(t[o])?[]:{},markFieldsDirty(t[o],e[o])):isNullOrUndefined(t[o])||(e[o]=!0);return e}function getDirtyFieldsFromDefaultValues(t,e,n){const o=Array.isArray(t);if(isObject(t)||o)for(const l in t)Array.isArray(t[l])||isObject(t[l])&&!objectHasFunction(t[l])?isUndefined(e)||isPrimitive(n[l])?n[l]=Array.isArray(t[l])?markFieldsDirty(t[l],[]):{...markFieldsDirty(t[l])}:getDirtyFieldsFromDefaultValues(t[l],isNullOrUndefined(e)?{}:e[l],n[l]):n[l]=!deepEqual$1(t[l],e[l]);return n}var getDirtyFields=(t,e)=>getDirtyFieldsFromDefaultValues(t,e,markFieldsDirty(e));const defaultResult={value:!1,isValid:!1},validResult={value:!0,isValid:!0};var getCheckboxValue=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!isUndefined(t[0].attributes.value)?isUndefined(t[0].value)||t[0].value===""?validResult:{value:t[0].value,isValid:!0}:validResult:defaultResult}return defaultResult},getFieldValueAs=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:o})=>isUndefined(t)?t:e?t===""?NaN:t&&+t:n&&isString(t)?new Date(t):o?o(t):t;const defaultReturn={isValid:!1,value:null};var getRadioValue=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,defaultReturn):defaultReturn;function getFieldValue(t){const e=t.ref;return isFileInput(e)?e.files:isRadioInput(e)?getRadioValue(t.refs).value:isMultipleSelect(e)?[...e.selectedOptions].map(({value:n})=>n):isCheckBoxInput(e)?getCheckboxValue(t.refs).value:getFieldValueAs(isUndefined(e.value)?t.ref.value:e.value,t)}var getResolverOptions=(t,e,n,o)=>{const l={};for(const d of t){const f=get(e,d);f&&set(l,d,f._f)}return{criteriaMode:n,names:[...t],fields:l,shouldUseNativeValidation:o}},isRegex=t=>t instanceof RegExp,getRuleValue=t=>isUndefined(t)?t:isRegex(t)?t.source:isObject(t)?isRegex(t.value)?t.value.source:t.value:t,getValidationModes=t=>({isOnSubmit:!t||t===VALIDATION_MODE.onSubmit,isOnBlur:t===VALIDATION_MODE.onBlur,isOnChange:t===VALIDATION_MODE.onChange,isOnAll:t===VALIDATION_MODE.all,isOnTouch:t===VALIDATION_MODE.onTouched});const ASYNC_FUNCTION="AsyncFunction";var hasPromiseValidation=t=>!!t&&!!t.validate&&!!(isFunction$3(t.validate)&&t.validate.constructor.name===ASYNC_FUNCTION||isObject(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===ASYNC_FUNCTION)),hasValidation=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),isWatched=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(o=>t.startsWith(o)&&/^\.\w+/.test(t.slice(o.length))));const iterateFieldsByAction=(t,e,n,o)=>{for(const l of n||Object.keys(t)){const d=get(t,l);if(d){const{_f:f,...g}=d;if(f){if(f.refs&&f.refs[0]&&e(f.refs[0],l)&&!o)return!0;if(f.ref&&e(f.ref,f.name)&&!o)return!0;if(iterateFieldsByAction(g,e))break}else if(isObject(g)&&iterateFieldsByAction(g,e))break}}};function schemaErrorLookup(t,e,n){const o=get(t,n);if(o||isKey(n))return{error:o,name:n};const l=n.split(".");for(;l.length;){const d=l.join("."),f=get(e,d),g=get(t,d);if(f&&!Array.isArray(f)&&n!==d)return{name:n};if(g&&g.type)return{name:d,error:g};if(g&&g.root&&g.root.type)return{name:`${d}.root`,error:g.root};l.pop()}return{name:n}}var shouldRenderFormState=(t,e,n,o)=>{n(t);const{name:l,...d}=t;return isEmptyObject$1(d)||Object.keys(d).length>=Object.keys(e).length||Object.keys(d).find(f=>e[f]===(!o||VALIDATION_MODE.all))},shouldSubscribeByName=(t,e,n)=>!t||!e||t===e||convertToArrayPayload(t).some(o=>o&&(n?o===e:o.startsWith(e)||e.startsWith(o))),skipValidation=(t,e,n,o,l)=>l.isOnAll?!1:!n&&l.isOnTouch?!(e||t):(n?o.isOnBlur:l.isOnBlur)?!t:(n?o.isOnChange:l.isOnChange)?t:!0,unsetEmptyArray=(t,e)=>!compact(get(t,e)).length&&unset(t,e),updateFieldArrayRootError=(t,e,n)=>{const o=convertToArrayPayload(get(t,n));return set(o,"root",e[n]),set(t,n,o),t},isMessage=t=>isString(t);function getValidateError(t,e,n="validate"){if(isMessage(t)||Array.isArray(t)&&t.every(isMessage)||isBoolean(t)&&!t)return{type:n,message:isMessage(t)?t:"",ref:e}}var getValueAndMessage=t=>isObject(t)&&!isRegex(t)?t:{value:t,message:""},validateField=async(t,e,n,o,l,d)=>{const{ref:f,refs:g,required:b,maxLength:_,minLength:S,min:R,max:C,pattern:E,validate:A,name:M,valueAsNumber:I,mount:j}=t._f,q=get(n,M);if(!j||e.has(M))return{};const z=g?g[0]:f,Q=Ae=>{l&&z.reportValidity&&(z.setCustomValidity(isBoolean(Ae)?"":Ae||""),z.reportValidity())},F={},O=isRadioInput(f),te=isCheckBoxInput(f),ne=O||te,se=(I||isFileInput(f))&&isUndefined(f.value)&&isUndefined(q)||isHTMLElement(f)&&f.value===""||q===""||Array.isArray(q)&&!q.length,ge=appendErrors.bind(null,M,o,F),oe=(Ae,je,Ne,Ve=INPUT_VALIDATION_RULES.maxLength,Le=INPUT_VALIDATION_RULES.minLength)=>{const ze=Ae?je:Ne;F[M]={type:Ae?Ve:Le,message:ze,ref:f,...ge(Ae?Ve:Le,ze)}};if(d?!Array.isArray(q)||!q.length:b&&(!ne&&(se||isNullOrUndefined(q))||isBoolean(q)&&!q||te&&!getCheckboxValue(g).isValid||O&&!getRadioValue(g).isValid)){const{value:Ae,message:je}=isMessage(b)?{value:!!b,message:b}:getValueAndMessage(b);if(Ae&&(F[M]={type:INPUT_VALIDATION_RULES.required,message:je,ref:z,...ge(INPUT_VALIDATION_RULES.required,je)},!o))return Q(je),F}if(!se&&(!isNullOrUndefined(R)||!isNullOrUndefined(C))){let Ae,je;const Ne=getValueAndMessage(C),Ve=getValueAndMessage(R);if(!isNullOrUndefined(q)&&!isNaN(q)){const Le=f.valueAsNumber||q&&+q;isNullOrUndefined(Ne.value)||(Ae=Le>Ne.value),isNullOrUndefined(Ve.value)||(je=Le<Ve.value)}else{const Le=f.valueAsDate||new Date(q),ze=qe=>new Date(new Date().toDateString()+" "+qe),$e=f.type=="time",Oe=f.type=="week";isString(Ne.value)&&q&&(Ae=$e?ze(q)>ze(Ne.value):Oe?q>Ne.value:Le>new Date(Ne.value)),isString(Ve.value)&&q&&(je=$e?ze(q)<ze(Ve.value):Oe?q<Ve.value:Le<new Date(Ve.value))}if((Ae||je)&&(oe(!!Ae,Ne.message,Ve.message,INPUT_VALIDATION_RULES.max,INPUT_VALIDATION_RULES.min),!o))return Q(F[M].message),F}if((_||S)&&!se&&(isString(q)||d&&Array.isArray(q))){const Ae=getValueAndMessage(_),je=getValueAndMessage(S),Ne=!isNullOrUndefined(Ae.value)&&q.length>+Ae.value,Ve=!isNullOrUndefined(je.value)&&q.length<+je.value;if((Ne||Ve)&&(oe(Ne,Ae.message,je.message),!o))return Q(F[M].message),F}if(E&&!se&&isString(q)){const{value:Ae,message:je}=getValueAndMessage(E);if(isRegex(Ae)&&!q.match(Ae)&&(F[M]={type:INPUT_VALIDATION_RULES.pattern,message:je,ref:f,...ge(INPUT_VALIDATION_RULES.pattern,je)},!o))return Q(je),F}if(A){if(isFunction$3(A)){const Ae=await A(q,n),je=getValidateError(Ae,z);if(je&&(F[M]={...je,...ge(INPUT_VALIDATION_RULES.validate,je.message)},!o))return Q(je.message),F}else if(isObject(A)){let Ae={};for(const je in A){if(!isEmptyObject$1(Ae)&&!o)break;const Ne=getValidateError(await A[je](q,n),z,je);Ne&&(Ae={...Ne,...ge(je,Ne.message)},Q(Ne.message),o&&(F[M]=Ae))}if(!isEmptyObject$1(Ae)&&(F[M]={ref:z,...Ae},!o))return F}}return Q(!0),F};const defaultOptions$1={mode:VALIDATION_MODE.onSubmit,reValidateMode:VALIDATION_MODE.onChange,shouldFocusError:!0};function createFormControl(t={}){let e={...defaultOptions$1,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:isFunction$3(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},o={},l=isObject(e.defaultValues)||isObject(e.values)?cloneObject(e.defaultValues||e.values)||{}:{},d=e.shouldUnregister?{}:cloneObject(l),f={action:!1,mount:!1,watch:!1},g={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},b,_=0;const S={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let R={...S};const C={array:createSubject(),state:createSubject()},E=e.criteriaMode===VALIDATION_MODE.all,A=Ye=>rt=>{clearTimeout(_),_=setTimeout(Ye,rt)},M=async Ye=>{if(!e.disabled&&(S.isValid||R.isValid||Ye)){const rt=e.resolver?isEmptyObject$1((await te()).errors):await se(o,!0);rt!==n.isValid&&C.state.next({isValid:rt})}},I=(Ye,rt)=>{!e.disabled&&(S.isValidating||S.validatingFields||R.isValidating||R.validatingFields)&&((Ye||Array.from(g.mount)).forEach(st=>{st&&(rt?set(n.validatingFields,st,rt):unset(n.validatingFields,st))}),C.state.next({validatingFields:n.validatingFields,isValidating:!isEmptyObject$1(n.validatingFields)}))},j=(Ye,rt=[],st,lt,ft=!0,pt=!0)=>{if(lt&&st&&!e.disabled){if(f.action=!0,pt&&Array.isArray(get(o,Ye))){const yt=st(get(o,Ye),lt.argA,lt.argB);ft&&set(o,Ye,yt)}if(pt&&Array.isArray(get(n.errors,Ye))){const yt=st(get(n.errors,Ye),lt.argA,lt.argB);ft&&set(n.errors,Ye,yt),unsetEmptyArray(n.errors,Ye)}if((S.touchedFields||R.touchedFields)&&pt&&Array.isArray(get(n.touchedFields,Ye))){const yt=st(get(n.touchedFields,Ye),lt.argA,lt.argB);ft&&set(n.touchedFields,Ye,yt)}(S.dirtyFields||R.dirtyFields)&&(n.dirtyFields=getDirtyFields(l,d)),C.state.next({name:Ye,isDirty:oe(Ye,rt),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else set(d,Ye,rt)},q=(Ye,rt)=>{set(n.errors,Ye,rt),C.state.next({errors:n.errors})},z=Ye=>{n.errors=Ye,C.state.next({errors:n.errors,isValid:!1})},Q=(Ye,rt,st,lt)=>{const ft=get(o,Ye);if(ft){const pt=get(d,Ye,isUndefined(st)?get(l,Ye):st);isUndefined(pt)||lt&&lt.defaultChecked||rt?set(d,Ye,rt?pt:getFieldValue(ft._f)):Ne(Ye,pt),f.mount&&M()}},F=(Ye,rt,st,lt,ft)=>{let pt=!1,yt=!1;const zt={name:Ye};if(!e.disabled){if(!st||lt){(S.isDirty||R.isDirty)&&(yt=n.isDirty,n.isDirty=zt.isDirty=oe(),pt=yt!==zt.isDirty);const Yt=deepEqual$1(get(l,Ye),rt);yt=!!get(n.dirtyFields,Ye),Yt?unset(n.dirtyFields,Ye):set(n.dirtyFields,Ye,!0),zt.dirtyFields=n.dirtyFields,pt=pt||(S.dirtyFields||R.dirtyFields)&&yt!==!Yt}if(st){const Yt=get(n.touchedFields,Ye);Yt||(set(n.touchedFields,Ye,st),zt.touchedFields=n.touchedFields,pt=pt||(S.touchedFields||R.touchedFields)&&Yt!==st)}pt&&ft&&C.state.next(zt)}return pt?zt:{}},O=(Ye,rt,st,lt)=>{const ft=get(n.errors,Ye),pt=(S.isValid||R.isValid)&&isBoolean(rt)&&n.isValid!==rt;if(e.delayError&&st?(b=A(()=>q(Ye,st)),b(e.delayError)):(clearTimeout(_),b=null,st?set(n.errors,Ye,st):unset(n.errors,Ye)),(st?!deepEqual$1(ft,st):ft)||!isEmptyObject$1(lt)||pt){const yt={...lt,...pt&&isBoolean(rt)?{isValid:rt}:{},errors:n.errors,name:Ye};n={...n,...yt},C.state.next(yt)}},te=async Ye=>{I(Ye,!0);const rt=await e.resolver(d,e.context,getResolverOptions(Ye||g.mount,o,e.criteriaMode,e.shouldUseNativeValidation));return I(Ye),rt},ne=async Ye=>{const{errors:rt}=await te(Ye);if(Ye)for(const st of Ye){const lt=get(rt,st);lt?set(n.errors,st,lt):unset(n.errors,st)}else n.errors=rt;return rt},se=async(Ye,rt,st={valid:!0})=>{for(const lt in Ye){const ft=Ye[lt];if(ft){const{_f:pt,...yt}=ft;if(pt){const zt=g.array.has(pt.name),Yt=ft._f&&hasPromiseValidation(ft._f);Yt&&S.validatingFields&&I([lt],!0);const dn=await validateField(ft,g.disabled,d,E,e.shouldUseNativeValidation&&!rt,zt);if(Yt&&S.validatingFields&&I([lt]),dn[pt.name]&&(st.valid=!1,rt))break;!rt&&(get(dn,pt.name)?zt?updateFieldArrayRootError(n.errors,dn,pt.name):set(n.errors,pt.name,dn[pt.name]):unset(n.errors,pt.name))}!isEmptyObject$1(yt)&&await se(yt,rt,st)}}return st.valid},ge=()=>{for(const Ye of g.unMount){const rt=get(o,Ye);rt&&(rt._f.refs?rt._f.refs.every(st=>!live(st)):!live(rt._f.ref))&&Xe(Ye)}g.unMount=new Set},oe=(Ye,rt)=>!e.disabled&&(Ye&&rt&&set(d,Ye,rt),!deepEqual$1(qe(),l)),Ae=(Ye,rt,st)=>generateWatchOutput(Ye,g,{...f.mount?d:isUndefined(rt)?l:isString(Ye)?{[Ye]:rt}:rt},st,rt),je=Ye=>compact(get(f.mount?d:l,Ye,e.shouldUnregister?get(l,Ye,[]):[])),Ne=(Ye,rt,st={})=>{const lt=get(o,Ye);let ft=rt;if(lt){const pt=lt._f;pt&&(!pt.disabled&&set(d,Ye,getFieldValueAs(rt,pt)),ft=isHTMLElement(pt.ref)&&isNullOrUndefined(rt)?"":rt,isMultipleSelect(pt.ref)?[...pt.ref.options].forEach(yt=>yt.selected=ft.includes(yt.value)):pt.refs?isCheckBoxInput(pt.ref)?pt.refs.forEach(yt=>{(!yt.defaultChecked||!yt.disabled)&&(Array.isArray(ft)?yt.checked=!!ft.find(zt=>zt===yt.value):yt.checked=ft===yt.value||!!ft)}):pt.refs.forEach(yt=>yt.checked=yt.value===ft):isFileInput(pt.ref)?pt.ref.value="":(pt.ref.value=ft,pt.ref.type||C.state.next({name:Ye,values:cloneObject(d)})))}(st.shouldDirty||st.shouldTouch)&&F(Ye,ft,st.shouldTouch,st.shouldDirty,!0),st.shouldValidate&&Oe(Ye)},Ve=(Ye,rt,st)=>{for(const lt in rt){if(!rt.hasOwnProperty(lt))return;const ft=rt[lt],pt=Ye+"."+lt,yt=get(o,pt);(g.array.has(Ye)||isObject(ft)||yt&&!yt._f)&&!isDateObject(ft)?Ve(pt,ft,st):Ne(pt,ft,st)}},Le=(Ye,rt,st={})=>{const lt=get(o,Ye),ft=g.array.has(Ye),pt=cloneObject(rt);set(d,Ye,pt),ft?(C.array.next({name:Ye,values:cloneObject(d)}),(S.isDirty||S.dirtyFields||R.isDirty||R.dirtyFields)&&st.shouldDirty&&C.state.next({name:Ye,dirtyFields:getDirtyFields(l,d),isDirty:oe(Ye,pt)})):lt&&!lt._f&&!isNullOrUndefined(pt)?Ve(Ye,pt,st):Ne(Ye,pt,st),isWatched(Ye,g)&&C.state.next({...n}),C.state.next({name:f.mount?Ye:void 0,values:cloneObject(d)})},ze=async Ye=>{f.mount=!0;const rt=Ye.target;let st=rt.name,lt=!0;const ft=get(o,st),pt=Yt=>{lt=Number.isNaN(Yt)||isDateObject(Yt)&&isNaN(Yt.getTime())||deepEqual$1(Yt,get(d,st,Yt))},yt=getValidationModes(e.mode),zt=getValidationModes(e.reValidateMode);if(ft){let Yt,dn;const gn=rt.type?getFieldValue(ft._f):getEventValue(Ye),qt=Ye.type===EVENTS.BLUR||Ye.type===EVENTS.FOCUS_OUT,wn=!hasValidation(ft._f)&&!e.resolver&&!get(n.errors,st)&&!ft._f.deps||skipValidation(qt,get(n.touchedFields,st),n.isSubmitted,zt,yt),_n=isWatched(st,g,qt);set(d,st,gn),qt?(ft._f.onBlur&&ft._f.onBlur(Ye),b&&b(0)):ft._f.onChange&&ft._f.onChange(Ye);const xn=F(st,gn,qt),Rn=!isEmptyObject$1(xn)||_n;if(!qt&&C.state.next({name:st,type:Ye.type,values:cloneObject(d)}),wn)return(S.isValid||R.isValid)&&(e.mode==="onBlur"?qt&&M():qt||M()),Rn&&C.state.next({name:st,..._n?{}:xn});if(!qt&&_n&&C.state.next({...n}),e.resolver){const{errors:En}=await te([st]);if(pt(gn),lt){const Ln=schemaErrorLookup(n.errors,o,st),Xt=schemaErrorLookup(En,o,Ln.name||st);Yt=Xt.error,st=Xt.name,dn=isEmptyObject$1(En)}}else I([st],!0),Yt=(await validateField(ft,g.disabled,d,E,e.shouldUseNativeValidation))[st],I([st]),pt(gn),lt&&(Yt?dn=!1:(S.isValid||R.isValid)&&(dn=await se(o,!0)));lt&&(ft._f.deps&&Oe(ft._f.deps),O(st,dn,Yt,xn))}},$e=(Ye,rt)=>{if(get(n.errors,rt)&&Ye.focus)return Ye.focus(),1},Oe=async(Ye,rt={})=>{let st,lt;const ft=convertToArrayPayload(Ye);if(e.resolver){const pt=await ne(isUndefined(Ye)?Ye:ft);st=isEmptyObject$1(pt),lt=Ye?!ft.some(yt=>get(pt,yt)):st}else Ye?(lt=(await Promise.all(ft.map(async pt=>{const yt=get(o,pt);return await se(yt&&yt._f?{[pt]:yt}:yt)}))).every(Boolean),!(!lt&&!n.isValid)&&M()):lt=st=await se(o);return C.state.next({...!isString(Ye)||(S.isValid||R.isValid)&&st!==n.isValid?{}:{name:Ye},...e.resolver||!Ye?{isValid:st}:{},errors:n.errors}),rt.shouldFocus&&!lt&&iterateFieldsByAction(o,$e,Ye?ft:g.mount),lt},qe=Ye=>{const rt={...f.mount?d:l};return isUndefined(Ye)?rt:isString(Ye)?get(rt,Ye):Ye.map(st=>get(rt,st))},Ge=(Ye,rt)=>({invalid:!!get((rt||n).errors,Ye),isDirty:!!get((rt||n).dirtyFields,Ye),error:get((rt||n).errors,Ye),isValidating:!!get(n.validatingFields,Ye),isTouched:!!get((rt||n).touchedFields,Ye)}),Ue=Ye=>{Ye&&convertToArrayPayload(Ye).forEach(rt=>unset(n.errors,rt)),C.state.next({errors:Ye?n.errors:{}})},Je=(Ye,rt,st)=>{const lt=(get(o,Ye,{_f:{}})._f||{}).ref,ft=get(n.errors,Ye)||{},{ref:pt,message:yt,type:zt,...Yt}=ft;set(n.errors,Ye,{...Yt,...rt,ref:lt}),C.state.next({name:Ye,errors:n.errors,isValid:!1}),st&&st.shouldFocus&&lt&&lt.focus&&lt.focus()},Ze=(Ye,rt)=>isFunction$3(Ye)?C.state.subscribe({next:st=>Ye(Ae(void 0,rt),st)}):Ae(Ye,rt,!0),We=Ye=>C.state.subscribe({next:rt=>{shouldSubscribeByName(Ye.name,rt.name,Ye.exact)&&shouldRenderFormState(rt,Ye.formState||S,Ft,Ye.reRenderRoot)&&Ye.callback({values:{...d},...n,...rt})}}).unsubscribe,tt=Ye=>(f.mount=!0,R={...R,...Ye.formState},We({...Ye,formState:R})),Xe=(Ye,rt={})=>{for(const st of Ye?convertToArrayPayload(Ye):g.mount)g.mount.delete(st),g.array.delete(st),rt.keepValue||(unset(o,st),unset(d,st)),!rt.keepError&&unset(n.errors,st),!rt.keepDirty&&unset(n.dirtyFields,st),!rt.keepTouched&&unset(n.touchedFields,st),!rt.keepIsValidating&&unset(n.validatingFields,st),!e.shouldUnregister&&!rt.keepDefaultValue&&unset(l,st);C.state.next({values:cloneObject(d)}),C.state.next({...n,...rt.keepDirty?{isDirty:oe()}:{}}),!rt.keepIsValid&&M()},it=({disabled:Ye,name:rt})=>{(isBoolean(Ye)&&f.mount||Ye||g.disabled.has(rt))&&(Ye?g.disabled.add(rt):g.disabled.delete(rt))},et=(Ye,rt={})=>{let st=get(o,Ye);const lt=isBoolean(rt.disabled)||isBoolean(e.disabled);return set(o,Ye,{...st||{},_f:{...st&&st._f?st._f:{ref:{name:Ye}},name:Ye,mount:!0,...rt}}),g.mount.add(Ye),st?it({disabled:isBoolean(rt.disabled)?rt.disabled:e.disabled,name:Ye}):Q(Ye,!0,rt.value),{...lt?{disabled:rt.disabled||e.disabled}:{},...e.progressive?{required:!!rt.required,min:getRuleValue(rt.min),max:getRuleValue(rt.max),minLength:getRuleValue(rt.minLength),maxLength:getRuleValue(rt.maxLength),pattern:getRuleValue(rt.pattern)}:{},name:Ye,onChange:ze,onBlur:ze,ref:ft=>{if(ft){et(Ye,rt),st=get(o,Ye);const pt=isUndefined(ft.value)&&ft.querySelectorAll&&ft.querySelectorAll("input,select,textarea")[0]||ft,yt=isRadioOrCheckbox(pt),zt=st._f.refs||[];if(yt?zt.find(Yt=>Yt===pt):pt===st._f.ref)return;set(o,Ye,{_f:{...st._f,...yt?{refs:[...zt.filter(live),pt,...Array.isArray(get(l,Ye))?[{}]:[]],ref:{type:pt.type,name:Ye}}:{ref:pt}}}),Q(Ye,!1,void 0,pt)}else st=get(o,Ye,{}),st._f&&(st._f.mount=!1),(e.shouldUnregister||rt.shouldUnregister)&&!(isNameInFieldArray(g.array,Ye)&&f.action)&&g.unMount.add(Ye)}}},at=()=>e.shouldFocusError&&iterateFieldsByAction(o,$e,g.mount),ot=Ye=>{isBoolean(Ye)&&(C.state.next({disabled:Ye}),iterateFieldsByAction(o,(rt,st)=>{const lt=get(o,st);lt&&(rt.disabled=lt._f.disabled||Ye,Array.isArray(lt._f.refs)&&lt._f.refs.forEach(ft=>{ft.disabled=lt._f.disabled||Ye}))},0,!1))},He=(Ye,rt)=>async st=>{let lt;st&&(st.preventDefault&&st.preventDefault(),st.persist&&st.persist());let ft=cloneObject(d);if(C.state.next({isSubmitting:!0}),e.resolver){const{errors:pt,values:yt}=await te();n.errors=pt,ft=cloneObject(yt)}else await se(o);if(g.disabled.size)for(const pt of g.disabled)unset(ft,pt);if(unset(n.errors,"root"),isEmptyObject$1(n.errors)){C.state.next({errors:{}});try{await Ye(ft,st)}catch(pt){lt=pt}}else rt&&await rt({...n.errors},st),at(),setTimeout(at);if(C.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:isEmptyObject$1(n.errors)&&!lt,submitCount:n.submitCount+1,errors:n.errors}),lt)throw lt},mt=(Ye,rt={})=>{get(o,Ye)&&(isUndefined(rt.defaultValue)?Le(Ye,cloneObject(get(l,Ye))):(Le(Ye,rt.defaultValue),set(l,Ye,cloneObject(rt.defaultValue))),rt.keepTouched||unset(n.touchedFields,Ye),rt.keepDirty||(unset(n.dirtyFields,Ye),n.isDirty=rt.defaultValue?oe(Ye,cloneObject(get(l,Ye))):oe()),rt.keepError||(unset(n.errors,Ye),S.isValid&&M()),C.state.next({...n}))},Qe=(Ye,rt={})=>{const st=Ye?cloneObject(Ye):l,lt=cloneObject(st),ft=isEmptyObject$1(Ye),pt=ft?l:lt;if(rt.keepDefaultValues||(l=st),!rt.keepValues){if(rt.keepDirtyValues){const yt=new Set([...g.mount,...Object.keys(getDirtyFields(l,d))]);for(const zt of Array.from(yt))get(n.dirtyFields,zt)?set(pt,zt,get(d,zt)):Le(zt,get(pt,zt))}else{if(isWeb&&isUndefined(Ye))for(const yt of g.mount){const zt=get(o,yt);if(zt&&zt._f){const Yt=Array.isArray(zt._f.refs)?zt._f.refs[0]:zt._f.ref;if(isHTMLElement(Yt)){const dn=Yt.closest("form");if(dn){dn.reset();break}}}}if(rt.keepFieldsRef)for(const yt of g.mount)Le(yt,get(pt,yt));else o={}}d=e.shouldUnregister?rt.keepDefaultValues?cloneObject(l):{}:cloneObject(pt),C.array.next({values:{...pt}}),C.state.next({values:{...pt}})}g={mount:rt.keepDirtyValues?g.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},f.mount=!S.isValid||!!rt.keepIsValid||!!rt.keepDirtyValues,f.watch=!!e.shouldUnregister,C.state.next({submitCount:rt.keepSubmitCount?n.submitCount:0,isDirty:ft?!1:rt.keepDirty?n.isDirty:!!(rt.keepDefaultValues&&!deepEqual$1(Ye,l)),isSubmitted:rt.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ft?{}:rt.keepDirtyValues?rt.keepDefaultValues&&d?getDirtyFields(l,d):n.dirtyFields:rt.keepDefaultValues&&Ye?getDirtyFields(l,Ye):rt.keepDirty?n.dirtyFields:{},touchedFields:rt.keepTouched?n.touchedFields:{},errors:rt.keepErrors?n.errors:{},isSubmitSuccessful:rt.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Rt=(Ye,rt)=>Qe(isFunction$3(Ye)?Ye(d):Ye,rt),$t=(Ye,rt={})=>{const st=get(o,Ye),lt=st&&st._f;if(lt){const ft=lt.refs?lt.refs[0]:lt.ref;ft.focus&&(ft.focus(),rt.shouldSelect&&isFunction$3(ft.select)&&ft.select())}},Ft=Ye=>{n={...n,...Ye}},Mt={control:{register:et,unregister:Xe,getFieldState:Ge,handleSubmit:He,setError:Je,_subscribe:We,_runSchema:te,_focusError:at,_getWatch:Ae,_getDirty:oe,_setValid:M,_setFieldArray:j,_setDisabledField:it,_setErrors:z,_getFieldArray:je,_reset:Qe,_resetDefaultValues:()=>isFunction$3(e.defaultValues)&&e.defaultValues().then(Ye=>{Rt(Ye,e.resetOptions),C.state.next({isLoading:!1})}),_removeUnmounted:ge,_disableForm:ot,_subjects:C,_proxyFormState:S,get _fields(){return o},get _formValues(){return d},get _state(){return f},set _state(Ye){f=Ye},get _defaultValues(){return l},get _names(){return g},set _names(Ye){g=Ye},get _formState(){return n},get _options(){return e},set _options(Ye){e={...e,...Ye}}},subscribe:tt,trigger:Oe,register:et,handleSubmit:He,watch:Ze,setValue:Le,getValues:qe,reset:Rt,resetField:mt,clearErrors:Ue,unregister:Xe,setError:Je,setFocus:$t,getFieldState:Ge};return{...Mt,formControl:Mt}}function useForm(t={}){const e=React.useRef(void 0),n=React.useRef(void 0),[o,l]=React.useState({isDirty:!1,isValidating:!1,isLoading:isFunction$3(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:isFunction$3(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:o},t.defaultValues&&!isFunction$3(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:f,...g}=createFormControl(t);e.current={...g,formState:o}}const d=e.current.control;return d._options=t,useIsomorphicLayoutEffect$1(()=>{const f=d._subscribe({formState:d._proxyFormState,callback:()=>l({...d._formState}),reRenderRoot:!0});return l(g=>({...g,isReady:!0})),d._formState.isReady=!0,f},[d]),React.useEffect(()=>d._disableForm(t.disabled),[d,t.disabled]),React.useEffect(()=>{t.mode&&(d._options.mode=t.mode),t.reValidateMode&&(d._options.reValidateMode=t.reValidateMode)},[d,t.mode,t.reValidateMode]),React.useEffect(()=>{t.errors&&(d._setErrors(t.errors),d._focusError())},[d,t.errors]),React.useEffect(()=>{t.shouldUnregister&&d._subjects.state.next({values:d._getWatch()})},[d,t.shouldUnregister]),React.useEffect(()=>{if(d._proxyFormState.isDirty){const f=d._getDirty();f!==o.isDirty&&d._subjects.state.next({isDirty:f})}},[d,o.isDirty]),React.useEffect(()=>{t.values&&!deepEqual$1(t.values,n.current)?(d._reset(t.values,{keepFieldsRef:!0,...d._options.resetOptions}),n.current=t.values,l(f=>({...f}))):d._resetDefaultValues()},[d,t.values]),React.useEffect(()=>{d._state.mount||(d._setValid(),d._state.mount=!0),d._state.watch&&(d._state.watch=!1,d._subjects.state.next({...d._formState})),d._removeUnmounted()}),e.current.formState=getProxyFormState(o,d),e.current}var defaultErrorHandler=function(t){process.env.NODE_ENV!=="production"&&console.error(t)},defaultWarnHandler=function(t){process.env.NODE_ENV!=="production"&&console.warn(t)},DEFAULT_INTL_CONFIG={formats:{},messages:{},timeZone:void 0,defaultLocale:"en",defaultFormats:{},fallbackOnEmptyString:!0,onError:defaultErrorHandler,onWarn:defaultWarnHandler};function invariant(t,e,n){if(n===void 0&&(n=Error),!t)throw new n(e)}function invariantIntlContext(t){invariant(t,"[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.")}__assign$1(__assign$1({},DEFAULT_INTL_CONFIG),{textComponent:React__namespace.Fragment});var reactIs={exports:{}},reactIs_production_min={};/** @license React v16.13.1
1130
1130
  * react-is.production.min.js
1131
1131
  *
1132
1132
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -1167,7 +1167,7 @@ Defaulting to \`null\`.`}var Root$1=Progress$1,Indicator=ProgressIndicator;const
1167
1167
  \`\`\`
1168
1168
  `,[d,f]);return jsxRuntime.jsxs("div",{className:"@container",children:[jsxRuntime.jsxs("div",{className:"grid gap-4 @2xl:grid-cols-2",children:[jsxRuntime.jsx(PartnerCard,{account:f,loading:g||b,withAbout:!0,withVoice:!1,action:" "}),jsxRuntime.jsxs("div",{className:"grid gap-4",children:[((f==null?void 0:f.Manufacturer)||g||b)&&jsxRuntime.jsx(ManufacturerCard,{manufacturer:f==null?void 0:f.Manufacturer,loading:g||b,mainAction:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[(f==null?void 0:f.Manufacturer)&&jsxRuntime.jsx(ManufacturerGetStartedButton,{applicationId:t,manufacturer:f==null?void 0:f.Manufacturer}),o&&((z=(q=f==null?void 0:f.Manufacturer)==null?void 0:q.Categories)==null?void 0:z.findIndex(F=>F.AvailableToBuy))!==-1&&jsxRuntime.jsxs(Dialog,{open:E,onOpenChange:A,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700 ml-2",disabled:R,children:R?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 Manufacturer to Shopify"]})})}),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 manufacturer "',(Q=f==null?void 0:f.Manufacturer)==null?void 0:Q.PublicName,'" to Shopify? This will add all products from this manufacturer to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:M,disabled:R,children:R?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})]})]})}),(f==null?void 0:f.Reseller)&&jsxRuntime.jsx(ResellerCard,{reseller:f==null?void 0:f.Reseller,loading:g||b})]})]}),((f==null?void 0:f.Reseller)||(f==null?void 0:f.Manufacturer))&&!g&&!b&&jsxRuntime.jsx("div",{className:"max-w-6xl mx-auto p-4",children:jsxRuntime.jsxs(Tabs,{defaultValue:I(),className:"w-full",children:[jsxRuntime.jsxs(TabsList,{className:"inline-flex h-auto items-center justify-center rounded-none border-b bg-transparent p-0",children:[(f==null?void 0:f.Reseller)&&jsxRuntime.jsx(TabsTrigger,{value:"reseller-overview",className:"reseller-theme relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Reseller Overview"}),(f==null?void 0:f.Manufacturer)&&jsxRuntime.jsx(TabsTrigger,{value:"manufacturer-overview",className:"manufacturer-theme relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Manufacturer Overview"}),(f==null?void 0:f.Manufacturer)&&jsxRuntime.jsx(TabsTrigger,{value:"products",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Products"}),jsxRuntime.jsxs(TabsTrigger,{value:"assistant",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:[jsxRuntime.jsx(Bot,{className:"mr-2 w-4 h-4"}),"Assistant"]})]}),(f==null?void 0:f.Reseller)&&jsxRuntime.jsx(TabsContent,{value:"reseller-overview",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ResellerOverview,{readonly:!0,appID:f.ApplicationId||"",reseller:f==null?void 0:f.Reseller,userEmail:n,isSuperAdmin:l,withoutReports:!0})})}),(f==null?void 0:f.Manufacturer)&&jsxRuntime.jsx(TabsContent,{value:"manufacturer-overview",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ManufacturerOverviewPage,{readonly:!0,manufacturer:f==null?void 0:f.Manufacturer,applicationId:t,userEmail:n})})}),(f==null?void 0:f.Manufacturer)&&jsxRuntime.jsx(TabsContent,{value:"products",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ManufacturerProducts,{applicationId:t,manufacturer:f.Manufacturer,shopifyHostName:o})})}),jsxRuntime.jsx(TabsContent,{value:"assistant",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(AssistantInsight,{prompt:j,thinkingPlaceholderText:"Thinking about the relationship..."})})})]})}),(g||b)&&jsxRuntime.jsx("div",{className:"max-w-6xl mx-auto p-4 mt-4 flex justify-center items-center h-32",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-primary"})})]})}const PublicInfo=({reseller:t,appID:e,isLoading:n,readonly:o,onUnsavedChanges:l})=>{const{toast:d}=useToast(),[f]=usePostV4PartnerByApplicationIdAccountResellerAndFieldNameMutation(),[g,b]=React.useState({}),_=React.useMemo(()=>({publicEmail:t.PublicEmail??"",contactName:t.ContactName??"",phone:t.Phone??"",website:t.Website??""}),[t]),{register:S,handleSubmit:R,reset:C,watch:E,formState:{errors:A,isSubmitting:M}}=useForm({defaultValues:_}),I=E(),j=React.useCallback(()=>g?JSON.stringify(I)!==JSON.stringify(g):!1,[I,g]);React.useEffect(()=>{l&&l(j())},[j,l]),React.useEffect(()=>{t&&Object.keys(t).length>0&&(C(_),b(_))},[t,C,_]);const q=async Q=>{let F=!0,O=!1;const te=Object.keys(Q).map(ne=>({key:ne,keyApi:ne.charAt(0).toUpperCase()+ne.slice(1)}));for(const ne of te){const se=Q[ne.key],ge=t[ne.keyApi];if(se!==ge&&se!==void 0){O=!0;try{await f({applicationId:e,fieldName:ne.keyApi,newValue:String(se)}).unwrap()||(F=!1)}catch(oe){console.error(`Error updating ${ne.keyApi}:`,oe),F=!1}}}F&&O?(d({title:"Public info",description:"Information updated successfully",variant:"success"}),b({...Q}),l&&l(!1)):F||d({title:"Updation error",description:"Failed to update",variant:"destructive"})},z=Q=>!Q||Q.trim()==="";return n?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Public Information"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-28"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})})]})})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsxs(CardTitle,{className:"text-1xl font-bold",children:["Public Information ",o?"(read only)":""]})}),jsxRuntime.jsxs(CardContent,{children:[(z(E("contactName"))||z(E("publicEmail"))||z(E("website"))||z(E("phone")))&&jsxRuntime.jsxs(Alert,{variant:"destructive",className:"mb-6",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Missing information"}),jsxRuntime.jsx(AlertDescription,{children:"All fields are required to get started at working with Manufacturers."})]}),jsxRuntime.jsxs("form",{onSubmit:R(q),className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium leading-none",htmlFor:"contactName",children:"Main Representative *"}),jsxRuntime.jsx(Input,{id:"contactName",placeholder:"John Doe",readOnly:o,...S("contactName",{}),className:A.contactName||z(E("contactName"))?"input-error-indicator":""}),A.contactName&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:A.contactName.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium leading-none",htmlFor:"publicEmail",children:"Public Email *"}),jsxRuntime.jsx(Input,{id:"publicEmail",placeholder:"contact@company.com",readOnly:o,...S("publicEmail",{pattern:{value:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,message:"Invalid email address"}}),className:A.publicEmail||z(E("publicEmail"))?"input-error-indicator":""}),A.publicEmail&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:A.publicEmail.message})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium leading-none",htmlFor:"website",children:"Website *"}),jsxRuntime.jsx(Input,{id:"website",placeholder:"https://company.com",readOnly:o,...S("website",{pattern:{value:/^.{7,}$/,message:"Must be at least 7 characters"}}),className:A.website||z(E("website"))?"input-error-indicator":""}),A.website&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:A.website.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium leading-none",htmlFor:"phone",children:"Phone Number *"}),jsxRuntime.jsx(Input,{id:"phone",placeholder:"+1 (555) 123-4567",readOnly:o,...S("phone",{pattern:{value:/^.{7,}$/,message:"Must be at least 7 characters"}}),className:A.phone||z(E("phone"))?"input-error-indicator":""}),A.phone&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:A.phone.message})]}),jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Button,{type:"submit",disabled:M||o,className:o?"hidden":"",children:M?"Saving...":"Save"})})]})]})]})};function BillingCard({appID:t,reseller:e,isLoading:n,withoutReports:o,userEmail:l}){const{toast:d}=useToast(),{Statement:f,CreditLimit:g}=e,[b,_]=React.useState(!1),[S,R]=React.useState(!1),[C,E]=React.useState(!1),[A,M]=React.useState(!1),[I,j]=React.useState(!1),[q,z]=React.useState(l||""),Q=[{label:"0 - 30 Days",value:jsxRuntime.jsx(FormattedNumber,{value:(f==null?void 0:f.Over0)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:Calendar},{label:"31 - 45 Days",value:jsxRuntime.jsx(FormattedNumber,{value:(f==null?void 0:f.Over30)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CalendarDays},{label:"45+ Days",value:jsxRuntime.jsx(FormattedNumber,{value:(f==null?void 0:f.Over45)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CalendarRange},{label:"Total",value:jsxRuntime.jsx(FormattedNumber,{value:(f==null?void 0:f.Total)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:DollarSign},{label:"Credit Limit",value:jsxRuntime.jsx(FormattedNumber,{value:g||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CreditCard}],[F]=useLazyGetV4ResellerByRouteResellerIdDocumentAndDocumentNumberPdfQuery(),O=async ge=>{_(!1),ge?R(!0):E(!0);try{const Ae=(await F({routeResellerId:t,documentNumber:`ST${t}`})).data;if(!Ae)throw new Error("No data received for download.");if(ge)window.open(Ae);else{const je=document.createElement("a");je.href=Ae,je.download=`ST${t}.pdf`,document.body.appendChild(je),je.click(),je.remove()}d({title:"Success",description:"Statement downloaded successfully.",variant:"success"})}catch(oe){console.error("Download Error:",oe),d({title:"Error",description:"An error occurred while downloading the statement. Please try again.",variant:"destructive"})}finally{ge?R(!1):E(!1)}},[te]=usePostV4ResellerByRouteResellerIdDocumentStatementEmailMutation(),ne=async()=>{if(!q||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(q)){d({title:"Invalid Email",description:"Please enter a valid email address.",variant:"destructive"});return}M(!0);try{await te({routeResellerId:t,emailAddress:q}).unwrap(),d({title:"Success",description:`Statement sent to ${q} successfully.`,variant:"success"}),j(!1)}catch(oe){console.error("Send Email Error:",oe),d({title:"Error",description:"An error occurred while sending the statement. Please try again.",variant:"destructive"})}finally{M(!1)}};if(n)return jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{className:"border-b p-6 md:p-5",children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-36"})}),jsxRuntime.jsxs(CardContent,{className:"p-6 md:p-5",children:[jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 sm:divide-x divide-border",children:[jsxRuntime.jsx("div",{className:"space-y-6 sm:pe-4",children:[1,2,3].map(ge=>jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 ms-auto"})]},ge))}),jsxRuntime.jsx("div",{className:"space-y-6 sm:ps-4 pt-6 sm:pt-0 mt-6 sm:mt-0 border-t sm:border-t-0 border-border",children:[1,2].map(ge=>jsxRuntime.jsx("div",{className:ge===2?"pt-6 mt-6 border-t border-border":"",children:jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 ms-auto"})]})},ge))})]}),jsxRuntime.jsxs("div",{className:"flex justify-end mt-6 gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-28"})]})]})]});const se=!o;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{className:"border-b p-6 md:p-5",children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Billing Overview"})}),jsxRuntime.jsxs(CardContent,{className:"p-6 md:p-5",children:[jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 sm:divide-x divide-border",children:[jsxRuntime.jsx("div",{className:"space-y-6 sm:pe-4",children:Q.slice(0,3).map((ge,oe)=>jsxRuntime.jsx(BillingItem,{icon:ge.icon,label:ge.label,value:ge.value},oe))}),jsxRuntime.jsx("div",{className:"space-y-6 sm:ps-4 pt-6 sm:pt-0 mt-6 sm:mt-0 border-t sm:border-t-0 border-border",children:Q.slice(3).map((ge,oe)=>jsxRuntime.jsx("div",{className:oe===1?"pt-6 mt-6 border-t border-border":"",children:jsxRuntime.jsx(BillingItem,{icon:ge.icon,label:ge.label,value:ge.value})},oe))})]}),se&&jsxRuntime.jsxs("div",{className:"flex justify-end mt-6 gap-2",children:[jsxRuntime.jsxs(DropdownMenu,{open:b,onOpenChange:_,children:[jsxRuntime.jsx(DropdownMenuTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"outline",disabled:S||C,children:S?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Printing..."]}):C?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Downloading..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(FileText,{className:"mr-2 h-4 w-4"}),"Statement",jsxRuntime.jsx(ChevronDown,{className:"ml-2 h-4 w-4"})]})})}),jsxRuntime.jsxs(DropdownMenuContent,{align:"end",children:[jsxRuntime.jsxs(DropdownMenuItem,{onClick:()=>O(!0),disabled:S,children:[jsxRuntime.jsx(Printer,{className:"mr-2 h-4 w-4"}),jsxRuntime.jsx("span",{children:"Print"})]}),jsxRuntime.jsx(DropdownMenuSeparator,{}),jsxRuntime.jsxs(DropdownMenuItem,{onClick:()=>O(!1),disabled:C,children:[jsxRuntime.jsx(Download,{className:"mr-2 h-4 w-4"}),jsxRuntime.jsx("span",{children:"Download"})]}),jsxRuntime.jsx(DropdownMenuSeparator,{}),jsxRuntime.jsxs(DropdownMenuItem,{onSelect:()=>j(!0),children:[jsxRuntime.jsx(Mail,{className:"mr-2 h-4 w-4"}),jsxRuntime.jsx("span",{children:"Send by Email"})]})]})]}),jsxRuntime.jsx(reactRouterDom.Link,{to:`${window.location.hostname==="dashboard.randmar.io"?"":"https://dashboard.randmar.io"}/${t}/PayInvoice`,target:window.location.hostname==="dashboard.randmar.io"?"_self":"_blank",children:jsxRuntime.jsxs(Button,{children:[jsxRuntime.jsx(CreditCard,{className:"mr-2 h-4 w-4"}),"Pay Invoices"]})})]})]})]}),jsxRuntime.jsx(Dialog,{open:I,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Send Statement by Email"}),jsxRuntime.jsx(DialogDescription,{children:"Enter the recipient's email address below. The statement will be sent as a PDF attachment."})]}),jsxRuntime.jsx("div",{className:"grid gap-4 py-4",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",className:"text-right",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",type:"email",value:q,onChange:ge=>z(ge.target.value),className:"col-span-3",placeholder:"recipient@example.com"})]})}),jsxRuntime.jsx(DialogFooter,{children:jsxRuntime.jsx(Button,{type:"submit",onClick:ne,disabled:A||!q,children:A?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Send,{className:"mr-2 h-4 w-4"}),"Send"]})})})]})})]})}function BillingItem({icon:t,label:e,value:n}){return jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(t,{className:"size-4 text-muted-foreground"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:e})]}),jsxRuntime.jsx("span",{className:"text-base font-semibold ms-auto",children:n})]})}function ChangePricingTierModal({open:t,setOpen:e,tier:n,onTierChange:o,isLoading:l}){const d=()=>{e(!1)};return jsxRuntime.jsx(Dialog,{open:t,onOpenChange:e,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Change Pricing Tier"})}),jsxRuntime.jsxs("div",{className:"grid gap-1.5 py-2",children:[jsxRuntime.jsxs("p",{className:"text-lg text-muted-foreground",children:["Requested Pricing Tier: ",jsxRuntime.jsx("span",{className:"font-bold",children:n})]}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"If your account qualifies, your pricing will update immediately."}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"If not, we'll review your request and notify you of the decision."})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:d,disabled:l,children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:o,disabled:l,children:l?"Loading...":`Apply for ${n}`})]})]})})}const getPricingText=t=>t===1?"The Best":t===2?"Fixed 12.5% GP on all items":t===3?"Advantageous":t===4?"Buying Group":t===5?"Cost":t,getShippingText=t=>t==="A"?"Free or Custom":t==="B"?"Fixed $10 anywhere":t==="C"?`Free shipping on $150+ orders to your location,
1169
1169
  $15 for drop shipped orders under $1,500,
1170
- $10 with opportunities under $1,000`:t==="D"?"$15 under $1,500":t==="E"?"Full shipping charges":t,getTermsText=t=>t==="STRIPE"?"Credit card payment":t==="NET30"?"Net 30 days":t,AccountTier=({isSuperAdmin:t,readonly:e,reseller:n,appID:o,isLoading:l})=>{const{toast:d}=useToast(),[f,g]=React.useState(!1),[b,_]=React.useState(""),[S,{isLoading:R}]=usePostV4PartnerByApplicationIdAccountResellerAndFieldNameMutation(),C=Ve=>Ve&&{Starter:"starter","E-Commerce":"ecommerce",Commercial:"commercial",Basics:"cws",Novexco:"novexco","Jean Coutu":"jeancoutu",Exclusive:"exclusive"}[Ve]||"",E=Ve=>Ve&&{A:"free",B:"fixed",C:"dropshipped",D:"under1500",E:"fullcharges"}[Ve]||"",A=Ve=>Ve&&{1:"exclusive",2:"ecommerce",3:"commercial",4:"buyinggroup",5:"cost"}[Ve]||"",[M,I]=React.useState(C((n==null?void 0:n.Priority)??"")),[j,q]=React.useState(E((n==null?void 0:n.ShippingProfile)??"")),[z,Q]=React.useState(A(n==null?void 0:n.PriceProfile)),F=Ve=>({starter:"Starter",ecommerce:"E-Commerce",commercial:"Commercial",cws:"Basics",novexco:"Novexco",jeancoutu:"Jean Coutu",exclusive:"Exclusive"})[Ve]||Ve,O=Ve=>({free:"A",fixed:"B",dropshipped:"C",under1500:"D",fullcharges:"E"})[Ve]||Ve,te=Ve=>({exclusive:"1",ecommerce:"2",commercial:"3",buyinggroup:"4",cost:"5"})[Ve]||Ve;React.useEffect(()=>{I(C((n==null?void 0:n.Priority)??"")),q(E((n==null?void 0:n.ShippingProfile)??"")),Q(A(n==null?void 0:n.PriceProfile))},[n]);const ne=async(Ve,Le,ze,$e)=>{try{(await S({applicationId:o,fieldName:Ve,newValue:Le})).error?d({title:"Error",description:$e,variant:"destructive"}):d({title:"Success",description:ze,variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}},se=async Ve=>{I(Ve);const Le=F(Ve);ne("Priority",Le,`Priority updated to ${Le}`,"Failed to update priority")},ge=async Ve=>{q(Ve);const Le=O(Ve);ne("ShippingProfile",Le,`Shipping profile updated to ${Le}`,"Failed to update shipping profile")},oe=async Ve=>{Q(Ve);const Le=te(Ve);ne("PriceProfile",Le,`Pricing profile updated to ${Le}`,"Failed to update pricing profile")},Ae=async()=>{try{const Ve=await S({applicationId:o,fieldName:"Tier",newValue:b});Ve.error?d({title:"Error",description:"Failed to update reseller",variant:"destructive"}):Ve.data?d({title:"Success",description:`Pricing Tier changed to ${b}`,variant:"success"}):d({title:"Considered",description:"Request being considered",variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}finally{g(!1),_("")}},je=[{name:"Terms",enabled:n.Priority==="Starter"},{name:"E-Commerce",enabled:n.Priority==="Commercial"},{name:"Commercial",enabled:n.Priority==="E-Commerce"},{name:"Exclusive",enabled:t}],Ne=Ve=>{_(Ve),g(!0)};return l?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-28"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-16 rounded-full"})]})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"mb-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-56"})]}),jsxRuntime.jsx("div",{className:"grid gap-3",children:[1,2,3].map(Ve=>jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]})]},Ve))}),jsxRuntime.jsxs("div",{className:"flex gap-2 mt-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{className:"pb-2 pt-4 px-4 flex flex-row items-center justify-between",children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Account Tier"}),jsxRuntime.jsx(Badge,{variant:"secondary",className:"bg-green-100 text-green-700 hover:bg-green-200 text-xs",children:"Active"})]}),jsxRuntime.jsxs(CardContent,{className:"pt-2 px-4 pb-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 bg-primary/5 p-4 rounded-lg",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-bold text-primary",children:[(n==null?void 0:n.Priority)||""," Tier"]}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Optimized for online retail"})]}),jsxRuntime.jsx(CircleCheck,{className:"h-6 w-6 text-green-600"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-2 mb-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Package2,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Pricing"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground truncate",children:getPricingText(n.PriceProfile||0)})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Truck,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Shipping"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:getShippingText(n.ShippingProfile||"").split(".")[0]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Calendar,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Payment terms"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:getTermsText((n==null?void 0:n.Terms)||"")})]})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[!e&&jsxRuntime.jsx(Button,{variant:"outline",className:"flex-1",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:"https://www.randmar.io/docs/overview/pricingTiers",target:"_blank",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4 mr-1"}),"Pricing Tiers"]})}),jsxRuntime.jsxs(Popover,{children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{disabled:e,className:e?"hidden":"flex-1",children:["Upgrade Tier ",jsxRuntime.jsx(ChevronRight,{className:"h-3 w-3 ml-1"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-56 p-2",children:jsxRuntime.jsxs("div",{className:"grid gap-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-xs mb-1",children:"Select a tier"}),je.map(Ve=>jsxRuntime.jsx(Button,{variant:"ghost",size:"sm",className:"w-full justify-start h-8",disabled:!Ve.enabled,onClick:()=>Ne(Ve.name),children:Ve.name},Ve.name))]})})]})]})]})]}),jsxRuntime.jsx(ChangePricingTierModal,{isLoading:R,open:f,setOpen:g,tier:b,onTierChange:Ae}),t&&!e&&jsxRuntime.jsxs(Card,{className:"mt-4",children:[jsxRuntime.jsx(CardHeader,{className:"pb-2 pt-3 px-4",children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Admin Configuration"})}),jsxRuntime.jsx(CardContent,{className:"pt-2 px-4 pb-4",children:jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Priority"}),jsxRuntime.jsx(RadioGroup$1,{value:M,onValueChange:se,className:"grid grid-cols-2 @sm:grid-cols-3 @md:grid-cols-4 gap-1",children:[{value:"starter",label:"Starter"},{value:"ecommerce",label:"E-Commerce"},{value:"commercial",label:"Commercial"},{value:"cws",label:"CWS (Basics)"},{value:"novexco",label:"Novexco"},{value:"jeancoutu",label:"Jean Coutu"},{value:"exclusive",label:"Exclusive"}].map(Ve=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Ve.value,id:`priority-${Ve.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`priority-${Ve.value}`,className:"cursor-pointer text-xs",children:Ve.label})]},Ve.value))})]}),jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Shipping Profile"}),jsxRuntime.jsx(RadioGroup$1,{value:j,onValueChange:ge,className:"grid grid-cols-1 @md:grid-cols-2 gap-1",children:[{value:"free",label:"Free (A)"},{value:"fixed",label:"Fixed $10 Shipping (B)"},{value:"dropshipped",label:"$15 for drop shipped (C)"},{value:"under1500",label:"15$ under 1,500 (D)"},{value:"fullcharges",label:"Full shipping charges (E)"}].map(Ve=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Ve.value,id:`shipping-${Ve.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`shipping-${Ve.value}`,className:"cursor-pointer text-xs",children:Ve.label})]},Ve.value))})]}),jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Pricing Profile"}),jsxRuntime.jsx(RadioGroup$1,{value:z,onValueChange:oe,className:"grid grid-cols-2 @sm:grid-cols-3 gap-1",children:[{value:"exclusive",label:"Exclusive (1)"},{value:"ecommerce",label:"E-Commerce (2)"},{value:"commercial",label:"Commercial (3)"},{value:"buyinggroup",label:"Buying Group (4)"},{value:"cost",label:"Cost (5)"}].map(Ve=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Ve.value,id:`pricing-${Ve.value}`,className:"h-6 w-6 scale-50 antialiased"}),jsxRuntime.jsx(Label$2,{htmlFor:`pricing-${Ve.value}`,className:"cursor-pointer text-xs",children:Ve.label})]},Ve.value))})]})]})})]})]})};function OrderCategories({openOrders:t=[],isLoading:e=!1}){const n=(t==null?void 0:t.filter(M=>M.DocumentType==="Order"))||[],o=(t==null?void 0:t.filter(M=>M.DocumentType==="Shipment"))||[],l=n.filter(M=>M.WarehouseCode!=="3PLE"),d=l.reduce((M,I)=>M+(I.Quantity??0),0),f=l.reduce((M,I)=>M+(I.ExtendedPrice??0),0),g=n.filter(M=>M.WarehouseCode==="3PLE"),b=g.reduce((M,I)=>M+(I.Quantity??0),0),_=g.reduce((M,I)=>M+(I.ExtendedPrice??0),0),S=o.reduce((M,I)=>M+(I.Quantity??0),0),R=o.reduce((M,I)=>M+(I.ExtendedPrice??0),0),C=d+b+S,E=f+_+R,A=[{name:"All",icon:Package,color:"bg-blue-500",orders:C,amount:E},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",orders:d,amount:f},{name:"Shipped",icon:Truck,color:"bg-green-500",orders:S,amount:R},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",orders:b,amount:_}];return e?jsxRuntime.jsxs(Card,{className:"w-full @md:col-span-2 @xl:col-span-1",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-40"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:[1,2,3,4].map(M=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:"bg-gray-200 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]})},M))})})]}):jsxRuntime.jsxs(Card,{className:"w-full @md:col-span-2 @xl:col-span-1",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Order Categories"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:A.map(M=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:`${M.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:M.name}),jsxRuntime.jsx("div",{className:`${M.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(M.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:M.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:jsxRuntime.jsx(FormattedNumber,{value:M.amount,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]})]})]})},M.name))})})]})}function ReportsSection({isLoading:t,userEmail:e,appID:n}){const{toast:o}=useToast(),[l,{isLoading:d}]=usePostV4ResellerByRouteResellerIdReportWalmartTrackingFileEmailMutation(),[f,{isLoading:g}]=usePostV4ResellerByRouteResellerIdReportAmazonTrackingFileEmailMutation(),[b,{isLoading:_}]=usePostV4ResellerByRouteResellerIdReportOpenOrdersEmailMutation(),[S,{isLoading:R}]=usePostV4ResellerByRouteResellerIdReportProductsEmailMutation(),[C,{isLoading:E}]=usePostV4ResellerByRouteResellerIdReportInvoicesEmailMutation(),[A,{isLoading:M}]=usePostV4ResellerByRouteResellerIdDocumentStatementEmailMutation(),[I,j]=React.useState(null),[q,z]=React.useState(e),[Q,F]=React.useState(!1),O=[{name:"Products",reports:[{id:"Products",title:"Universal Product List",description:"A comprehensive overview of your product list with detailed specifications and pricing information.",icon:Package}]},{name:"Operation Details",reports:[{id:"OpenOrders",title:"Order Details",description:"A detailed report of all your orders and shipments, including status, tracking information, and delivery estimates.",icon:ShoppingCart},{id:"Invoices",title:"Invoices and Credits Report",description:"Detailed overview of your invoices and credits within a specific date range. It also contains reports about additional charges, serial numbers, and other relevant information.",icon:ScrollText},{id:"Statement",title:"Statement and RMAs Report",description:"A detailed report of all unpaid invoices and active RMAs.",icon:Banknote}]},{name:"Tracking Files",reports:[{id:"AmazonTrackingFile",title:"Amazon Tracking File",description:"Track products sold on Amazon marketplace with detailed sales and inventory information.",icon:ChartNoAxesColumnIncreasing},{id:"WalmartTrackingFile",title:"Walmart Tracking File",description:"Track products sold on Walmart marketplace with detailed sales and inventory information.",icon:ChartNoAxesColumnIncreasing}]}],te=async ge=>{j(ge),F(!0)},ne=async()=>{if(!(!I||!n))try{switch(I.id){case"Products":await S({routeResellerId:n,emailAddress:q}).unwrap();break;case"AmazonTrackingFile":await f({routeResellerId:n,emailAddress:q}).unwrap();break;case"WalmartTrackingFile":await l({routeResellerId:n,emailAddress:q}).unwrap();break;case"OpenOrders":await b({routeResellerId:n,emailAddress:q}).unwrap();break;case"Invoices":await C({routeResellerId:n,emailAddress:q}).unwrap();break;case"Statement":await A({routeResellerId:n,emailAddress:q}).unwrap();break;default:throw new Error("invalid report id")}o({title:"Report requested",description:`The ${I.title} will be sent to ${q} shortly.`,variant:"success"}),F(!1)}catch(ge){console.error("Error requesting report:",ge),o({title:"Error",description:"Failed to request report. Please try again.",variant:"destructive"})}},se=_||R||g||d||M||E;return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reports"}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Download essential business reports, from your Product List to your Order Details."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:t?jsxRuntime.jsx(jsxRuntime.Fragment,{children:[1,2,3].map(ge=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-48"}),[1,2].map(oe=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})]},oe))]},ge))}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:O.map(ge=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold",children:ge.name}),ge.reports.map(oe=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg hover:bg-gray-100 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:jsxRuntime.jsx(oe.icon,{className:"h-5 w-5 text-primary"})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h4",{className:"font-semibold text-sm",children:oe.title}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:oe.description})]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center gap-1",onClick:()=>te(oe),children:[jsxRuntime.jsx(Download,{className:"h-4 w-4"}),"Request"]})]},oe.id))]},ge.name))})}),jsxRuntime.jsx(Dialog,{open:Q,onOpenChange:F,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsxs(DialogTitle,{children:["Request ",I==null?void 0:I.title]}),jsxRuntime.jsx(DialogDescription,{children:"Enter the email address where you would like to receive the report."})]}),jsxRuntime.jsxs("div",{className:"py-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",value:q,onChange:ge=>z(ge.target.value),placeholder:"your@email.com",className:"mt-2"})]}),jsxRuntime.jsx(DialogDescription,{children:"The report will take around 5 minutes to generate."}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:ne,disabled:!q||se,children:se?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Report"})]})]})})]})}function QualificationBadge({qualification:t}){return!t.QualificationId||t.QualificationId==="Suspended"?null:t.QualificationId==="Do Not Sell"?jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"destructive",children:[jsxRuntime.jsx(X$1,{className:"h-3 w-3 mr-1"}),"Do Not Sell"]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})}):jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"info",className:t.DefaultOpportunityNumber?"pr-1":"",children:[jsxRuntime.jsx(BadgeCheck,{className:"h-3 w-3 mr-1"}),t.QualificationId,t.DefaultOpportunityNumber&&jsxRuntime.jsx(Badge,{variant:"secondary",size:"sm",className:"ml-1",children:t.DefaultOpportunityNumber})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})})}function SalesChart({statistics:t,mode:e="month",chartHeight:n,loading:o=!1,size:l="default"}){const[d,f]=React.useState([]),[g,b]=React.useState(!1),_=[{name:"dollarVolume",label:"Dollar Volume",color:"var(--primary)",yAxisId:"left",format:"money"},{name:"unitsSold",label:"Units Sold",color:"#888",units:" units",yAxisId:"right",format:"integer"}];return React.useEffect(()=>{if(o||!t){f([]);return}let S=[];if(e==="week"){const R=new Map;t.forEach(C=>{var A;const E=((A=C.Day)==null?void 0:A.toString())||"";if(E.length===8){const M=parseInt(E.substring(0,4),10),I=parseInt(E.substring(4,6),10)-1,j=parseInt(E.substring(6,8),10),q=new Date(M,I,j),z=new Date(q);z.setDate(q.getDate()-q.getDay());const Q=`${z.getFullYear()}-${String(z.getMonth()+1).padStart(2,"0")}-${String(z.getDate()).padStart(2,"0")}`,F=R.get(Q)||{price:0,quantity:0};F.price+=C.ExtendedPrice||0,F.quantity+=C.Quantity||0,R.set(Q,F)}}),S=Array.from(R).sort(([C],[E])=>C.localeCompare(E)).map(([C,E])=>({date:`${C.substring(5,7)}/${C.substring(8,10)}`,dollarVolume:E.price,unitsSold:E.quantity}))}else{const R=new Date,C=R.getFullYear(),E=R.getMonth(),A=R.getDate(),M=`${C}-${(E+1).toString().padStart(2,"0")}`,I=Array.from({length:12},(q,z)=>{const Q=new Date(C,E-(11-z),1);return`${Q.getFullYear()}-${(Q.getMonth()+1).toString().padStart(2,"0")}`}),j=Object.fromEntries(I.map(q=>[q,{price:0,quantity:0}]));if(t.forEach(q=>{const z=String(q.Day??0);if(z.length!==8)return;const Q=`${z.substring(0,4)}-${z.substring(4,6)}`;j[Q]&&(j[Q].price+=q.ExtendedPrice??0,j[Q].quantity+=q.Quantity??0)}),S=I.map(q=>{const z=j[q],[Q,F]=q.split("-").map(Number);return{date:new Date(Q,F-1).toLocaleString("default",{month:"short",year:"numeric"}),dollarVolume:z.price,unitsSold:z.quantity}}),g){const q=j[M];if(q&&q.price>0&&A>0){const z=new Date(C,E+1,0).getDate();if(A<z){const Q=q.price/A,F=q.quantity/A,O=Q*z,te=F*z,ne=S[S.length-1];ne&&(ne.dollarVolume=O,ne.unitsSold=te)}}}}f(S)},[t,e,g,o]),o?jsxRuntime.jsx("div",{style:{height:n},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}):d.length===0?jsxRuntime.jsx("div",{style:{height:n},className:"flex items-center justify-center text-muted-foreground",children:"No sales data available."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(AreaChart,{data:d,series:_,height:n,size:l}),l==="default"&&e==="month"&&jsxRuntime.jsxs("div",{className:"mt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Switch,{checked:g,onCheckedChange:b,id:"extrapolate-switch"}),jsxRuntime.jsx(Label$2,{htmlFor:"extrapolate-switch",children:"Extrapolate Current Month"})]}),g&&jsxRuntime.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["* Values for ",new Date().toLocaleString("default",{month:"long"})," are projected estimates."]})]})]})}function ManufacturerCard({manufacturer:t,link:e,linkNewTab:n=!0,actions:o,mainAction:l,loading:d=!1}){var S,R,C;if(d||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-24"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex flex-col space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const f=t.ManufacturerId||"N/A",g=[t.City,t.Province,t.Country].filter(Boolean),b=g.length>0?g.join(", "):"",_=((S=t.Tags)==null?void 0:S.split(",").map(E=>E.trim()).filter(Boolean))||[];return jsxRuntime.jsxs(Card,{className:"manufacturer-theme flex flex-col h-full",children:[jsxRuntime.jsx(reactRouterDom.Link,{to:e??"#",target:e&&n?"_blank":"_self",children:jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:t.ManufacturerId,width:48,height:48},`partner_logo_${t.ManufacturerId}`)}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Manufacturer"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:f})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),b&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:b})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:t.SalesStatistics&&t.SalesStatistics.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(SalesChart,{statistics:t.SalesStatistics,size:"mini"})})})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[(!!((R=t.Qualification)!=null&&R.QualificationId)&&((C=t.Qualification)==null?void 0:C.QualificationId)!=="Suspended"||!!t.OpenToWork||!!t.OnHold&&t.OnHold!==0||_.length>0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}}),!!t.OpenToWork&&jsxRuntime.jsxs(Badge,{variant:"success",children:[jsxRuntime.jsx(HardHat,{className:"h-3 w-3 mr-1"}),"Open To Work"]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"}),_.map((E,A)=>jsxRuntime.jsx(Badge,{variant:"outline",children:E},A))]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),t.SalesData&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesYearToDay?formatMoney(t.SalesData.SalesYearToDay):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast3Months?formatMoney(t.SalesData.SalesLast3Months):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast30Days?formatMoney(t.SalesData.SalesLast30Days):"—"})]})]})}),(o||l||t.PublicResourcesLink)&&jsxRuntime.jsxs(CardFooter,{className:"flex pt-2 gap-2 justify-between mt-auto",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[o&&o,t.PublicResourcesLink&&jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:t.PublicResourcesLink,target:"_blank",children:jsxRuntime.jsx(Button,{size:"icon",children:jsxRuntime.jsx(HardDriveDownload,{className:"h-4 w-4"})})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Public Resources Link"})})]})})]}),l&&jsxRuntime.jsx("div",{children:l})]})]})}function OrdersCard({applicationId:t,orders:e=null,loading:n=!1,title:o="Order Details"}){const l=React.useMemo(()=>[{accessorKey:"DocumentNumber",header:"Document Number",cell:({row:g})=>g.original.DocumentNumber?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Document/${g.original.DocumentNumber}`,className:"font-medium text-primary hover:underline",children:g.original.DocumentNumber})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for order ",g.original.DocumentNumber]})})]})}):"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"DocumentDate",header:"Document Date",cell:({row:g})=>formatYYYYMMDDIntToDateString(g.original.DocumentDate),enableSorting:!0,enableFiltering:!1},{accessorKey:"OrderNumber",header:"Order Number",cell:({row:g})=>g.original.OrderNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"PONumber",header:"PO Number",cell:({row:g})=>g.original.PONumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"WarehouseCode",header:"Warehouse",cell:({row:g})=>g.original.WarehouseCode??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:g})=>g.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!1},{accessorKey:"ShipToName",header:"Name",cell:({row:g})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:g.original.ShipToName??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"UnitPrice",header:"Unit Price",cell:({row:g})=>g.original.UnitPrice?formatMoney(g.original.UnitPrice):"N/A",enableSorting:!0,enableFiltering:!1}],[t]),d=React.useMemo(()=>{const g={};if(e){const b=Array.from(new Set(e.map(E=>E.WarehouseCode).filter(E=>E!=null)));g.WarehouseCode=b;const _=Array.from(new Set(e.map(E=>E.ShipToName).filter(E=>E!=null)));g.ShipToName=_;const S=Array.from(new Set(e.map(E=>E.DocumentNumber).filter(E=>E!=null)));g.DocumentNumber=S;const R=Array.from(new Set(e.map(E=>E.OrderNumber).filter(E=>E!=null)));g.OrderNumber=R;const C=Array.from(new Set(e.map(E=>E.PONumber).filter(E=>E!=null)));g.PONumber=C}return g},[e]),f=e||[];return n?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:o})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:l,data:f,uniqueValues:d})})]})}function ResellerOverview({appID:t,reseller:e,readonly:n,userEmail:o,isSuperAdmin:l,withoutReports:d=!1}){const{data:f,isLoading:g,isError:b}=useGetV4PartnerByApplicationIdAccountResellerQuery({applicationId:t??"",withSpecification:!0},{skip:!!e}),[_,S]=React.useState({publicInfo:{hasUnsavedChanges:!1}}),R=React.useCallback(()=>n?!1:_.publicInfo.hasUnsavedChanges,[n,_]),C=React.useCallback((q,z)=>{S(Q=>{var F;return((F=Q[q])==null?void 0:F.hasUnsavedChanges)!==z.hasUnsavedChanges?{...Q,[q]:z}:Q})},[]),{NavigationGuardDialog:E}=useRouterNavigationGuard(R),A=e??f,M=!n||!!(A!=null&&A.Statement)&&(A.Statement.Total??0)>0,I=(A==null?void 0:A.QualifiedManufacturers)??[],j=(A==null?void 0:A.Qualifications)??[];return jsxRuntime.jsxs("div",{className:"@container",children:[b?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 reseller information. Please try again later."})]})}):jsxRuntime.jsxs("div",{className:"space-y-6 mb-6",children:[jsxRuntime.jsx(SalesSummary,{fiscalYearMonthStart:(A==null?void 0:A.FiscalYearMonthStart)||1,salesData:A==null?void 0:A.SalesData,isLoading:g}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @2xl:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChartCard,{statistics:(A==null?void 0:A.SalesStatistics)??[],loading:g}),jsxRuntime.jsx(OrderCategories,{openOrders:(A==null?void 0:A.ActiveOrderDetails)??[],isLoading:g}),M&&jsxRuntime.jsx(BillingCard,{appID:t,reseller:A||{},withoutReports:d,isLoading:g,userEmail:o}),jsxRuntime.jsx(PublicInfo,{reseller:A||{},appID:t??"",isLoading:g,readonly:n,onUnsavedChanges:q=>C("publicInfo",{hasUnsavedChanges:q})}),jsxRuntime.jsx(AccountTier,{isSuperAdmin:l,readonly:n,reseller:A||{},appID:t??"",isLoading:g})]}),g||I.length>0?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Manufacturers you are qualified for"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid @2xl:grid-cols-2 gap-4",children:g?Array.from({length:2}).map((q,z)=>jsxRuntime.jsx(ManufacturerCard,{loading:!0},z)):I.map(q=>jsxRuntime.jsx(ManufacturerCard,{manufacturer:q,link:`https://dashboard.randmar.io/${t}/Partner/${q.ManufacturerId}`},q.ManufacturerId))})})]}):jsxRuntime.jsx(ResellerQualificationsCard,{qualifications:j}),jsxRuntime.jsx(OpportunitiesTable,{applicationId:t,opportunities:A==null?void 0:A.Opportunities,loading:g}),jsxRuntime.jsx(OrdersCard,{applicationId:t,title:"Active Orders",orders:A==null?void 0:A.ActiveOrderDetails,loading:g}),jsxRuntime.jsx(OrdersCard,{applicationId:t,title:"Completed Orders",orders:A==null?void 0:A.CompletedOrderDetails,loading:g}),jsxRuntime.jsx(ReturnsTable,{applicationId:t,returns:A==null?void 0:A.Returns,loading:g}),!d&&jsxRuntime.jsx(ReportsSection,{appID:t,userEmail:o,isLoading:g})]}),jsxRuntime.jsx(E,{})]})}const alertVariants=cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",success:"border-green-500/50 bg-green-50 text-green-700 dark:border-green-500 dark:bg-green-950 dark:text-green-400 [&>svg]:text-green-500",warning:"border-yellow-500/50 bg-yellow-50 text-yellow-700 dark:border-yellow-500 dark:bg-yellow-950 dark:text-yellow-400 [&>svg]:text-yellow-500",info:"border-blue-500/50 bg-blue-50 text-blue-700 dark:border-blue-500 dark:bg-blue-950 dark:text-blue-400 [&>svg]:text-blue-500"}},defaultVariants:{variant:"default"}}),Alert=React__namespace.forwardRef(({className:t,variant:e,...n},o)=>jsxRuntime.jsx("div",{ref:o,role:"alert",className:cn(alertVariants({variant:e}),t),...n}));Alert.displayName="Alert";const AlertTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("h5",{ref:n,className:cn("mb-1 font-medium leading-none tracking-tight",t),...e}));AlertTitle.displayName="AlertTitle";const AlertDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("text-sm [&_p]:leading-relaxed",t),...e}));AlertDescription.displayName="AlertDescription";/**
1170
+ $10 with opportunities under $1,000`:t==="D"?"$15 under $1,500":t==="E"?"Full shipping charges":t,getTermsText=t=>t==="STRIPE"?"Credit card payment":t==="NET30"?"Net 30 days":t,AccountTier=({isSuperAdmin:t,readonly:e,reseller:n,appID:o,isLoading:l})=>{const{toast:d}=useToast(),[f,g]=React.useState(!1),[b,_]=React.useState(""),[S,{isLoading:R}]=usePostV4PartnerByApplicationIdAccountResellerAndFieldNameMutation(),C=Ve=>Ve&&{Starter:"starter","E-Commerce":"ecommerce",Commercial:"commercial",Basics:"cws",Novexco:"novexco","Jean Coutu":"jeancoutu",Exclusive:"exclusive"}[Ve]||"",E=Ve=>Ve&&{A:"free",B:"fixed",C:"dropshipped",D:"under1500",E:"fullcharges"}[Ve]||"",A=Ve=>Ve&&{1:"exclusive",2:"ecommerce",3:"commercial",4:"buyinggroup",5:"cost"}[Ve]||"",[M,I]=React.useState(C((n==null?void 0:n.Priority)??"")),[j,q]=React.useState(E((n==null?void 0:n.ShippingProfile)??"")),[z,Q]=React.useState(A(n==null?void 0:n.PriceProfile)),F=Ve=>({starter:"Starter",ecommerce:"E-Commerce",commercial:"Commercial",cws:"Basics",novexco:"Novexco",jeancoutu:"Jean Coutu",exclusive:"Exclusive"})[Ve]||Ve,O=Ve=>({free:"A",fixed:"B",dropshipped:"C",under1500:"D",fullcharges:"E"})[Ve]||Ve,te=Ve=>({exclusive:"1",ecommerce:"2",commercial:"3",buyinggroup:"4",cost:"5"})[Ve]||Ve;React.useEffect(()=>{I(C((n==null?void 0:n.Priority)??"")),q(E((n==null?void 0:n.ShippingProfile)??"")),Q(A(n==null?void 0:n.PriceProfile))},[n]);const ne=async(Ve,Le,ze,$e)=>{try{(await S({applicationId:o,fieldName:Ve,newValue:Le})).error?d({title:"Error",description:$e,variant:"destructive"}):d({title:"Success",description:ze,variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}},se=async Ve=>{I(Ve);const Le=F(Ve);ne("Priority",Le,`Priority updated to ${Le}`,"Failed to update priority")},ge=async Ve=>{q(Ve);const Le=O(Ve);ne("ShippingProfile",Le,`Shipping profile updated to ${Le}`,"Failed to update shipping profile")},oe=async Ve=>{Q(Ve);const Le=te(Ve);ne("PriceProfile",Le,`Pricing profile updated to ${Le}`,"Failed to update pricing profile")},Ae=async()=>{try{const Ve=await S({applicationId:o,fieldName:"Tier",newValue:b});Ve.error?d({title:"Error",description:"Failed to update reseller",variant:"destructive"}):Ve.data?d({title:"Success",description:`Pricing Tier changed to ${b}`,variant:"success"}):d({title:"Considered",description:"Request being considered",variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}finally{g(!1),_("")}},je=[{name:"Terms",enabled:n.Priority==="Starter"},{name:"E-Commerce",enabled:n.Priority==="Commercial"},{name:"Commercial",enabled:n.Priority==="E-Commerce"},{name:"Exclusive",enabled:t}],Ne=Ve=>{_(Ve),g(!0)};return l?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-28"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-16 rounded-full"})]})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"mb-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-56"})]}),jsxRuntime.jsx("div",{className:"grid gap-3",children:[1,2,3].map(Ve=>jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]})]},Ve))}),jsxRuntime.jsxs("div",{className:"flex gap-2 mt-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{className:"pb-2 pt-4 px-4 flex flex-row items-center justify-between",children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Account Tier"}),jsxRuntime.jsx(Badge,{variant:"secondary",className:"bg-green-100 text-green-700 hover:bg-green-200 text-xs",children:"Active"})]}),jsxRuntime.jsxs(CardContent,{className:"pt-2 px-4 pb-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 bg-primary/5 p-4 rounded-lg",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-bold text-primary",children:[(n==null?void 0:n.Priority)||""," Tier"]}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Optimized for online retail"})]}),jsxRuntime.jsx(CircleCheck,{className:"h-6 w-6 text-green-600"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-2 mb-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Package2,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Pricing"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground truncate",children:getPricingText(n.PriceProfile||0)})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Truck,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Shipping"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:getShippingText(n.ShippingProfile||"").split(".")[0]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Calendar,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Payment terms"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:getTermsText((n==null?void 0:n.Terms)||"")})]})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[!e&&jsxRuntime.jsx(Button,{variant:"outline",className:"flex-1",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:"https://www.randmar.io/docs/overview/pricingTiers",target:"_blank",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4 mr-1"}),"Pricing Tiers"]})}),jsxRuntime.jsxs(Popover,{children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{disabled:e,className:e?"hidden":"flex-1",children:["Upgrade Tier ",jsxRuntime.jsx(ChevronRight,{className:"h-3 w-3 ml-1"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-56 p-2",children:jsxRuntime.jsxs("div",{className:"grid gap-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-xs mb-1",children:"Select a tier"}),je.map(Ve=>jsxRuntime.jsx(Button,{variant:"ghost",size:"sm",className:"w-full justify-start h-8",disabled:!Ve.enabled,onClick:()=>Ne(Ve.name),children:Ve.name},Ve.name))]})})]})]})]})]}),jsxRuntime.jsx(ChangePricingTierModal,{isLoading:R,open:f,setOpen:g,tier:b,onTierChange:Ae}),t&&!e&&jsxRuntime.jsxs(Card,{className:"mt-4",children:[jsxRuntime.jsx(CardHeader,{className:"pb-2 pt-3 px-4",children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Admin Configuration"})}),jsxRuntime.jsx(CardContent,{className:"pt-2 px-4 pb-4",children:jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Priority"}),jsxRuntime.jsx(RadioGroup$1,{value:M,onValueChange:se,className:"grid grid-cols-2 @sm:grid-cols-3 @md:grid-cols-4 gap-1",children:[{value:"starter",label:"Starter"},{value:"ecommerce",label:"E-Commerce"},{value:"commercial",label:"Commercial"},{value:"cws",label:"CWS (Basics)"},{value:"novexco",label:"Novexco"},{value:"jeancoutu",label:"Jean Coutu"},{value:"exclusive",label:"Exclusive"}].map(Ve=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Ve.value,id:`priority-${Ve.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`priority-${Ve.value}`,className:"cursor-pointer text-xs",children:Ve.label})]},Ve.value))})]}),jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Shipping Profile"}),jsxRuntime.jsx(RadioGroup$1,{value:j,onValueChange:ge,className:"grid grid-cols-1 @md:grid-cols-2 gap-1",children:[{value:"free",label:"Free (A)"},{value:"fixed",label:"Fixed $10 Shipping (B)"},{value:"dropshipped",label:"$15 for drop shipped (C)"},{value:"under1500",label:"15$ under 1,500 (D)"},{value:"fullcharges",label:"Full shipping charges (E)"}].map(Ve=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Ve.value,id:`shipping-${Ve.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`shipping-${Ve.value}`,className:"cursor-pointer text-xs",children:Ve.label})]},Ve.value))})]}),jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Pricing Profile"}),jsxRuntime.jsx(RadioGroup$1,{value:z,onValueChange:oe,className:"grid grid-cols-2 @sm:grid-cols-3 gap-1",children:[{value:"exclusive",label:"Exclusive (1)"},{value:"ecommerce",label:"E-Commerce (2)"},{value:"commercial",label:"Commercial (3)"},{value:"buyinggroup",label:"Buying Group (4)"},{value:"cost",label:"Cost (5)"}].map(Ve=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Ve.value,id:`pricing-${Ve.value}`,className:"h-6 w-6 scale-50 antialiased"}),jsxRuntime.jsx(Label$2,{htmlFor:`pricing-${Ve.value}`,className:"cursor-pointer text-xs",children:Ve.label})]},Ve.value))})]})]})})]})]})};function OrderCategories({openOrders:t=[],isLoading:e=!1}){const n=(t==null?void 0:t.filter(M=>M.DocumentType==="Order"))||[],o=(t==null?void 0:t.filter(M=>M.DocumentType==="Shipment"))||[],l=n.filter(M=>M.WarehouseCode!=="3PLE"),d=l.reduce((M,I)=>M+(I.Quantity??0),0),f=l.reduce((M,I)=>M+(I.ExtendedPrice??0),0),g=n.filter(M=>M.WarehouseCode==="3PLE"),b=g.reduce((M,I)=>M+(I.Quantity??0),0),_=g.reduce((M,I)=>M+(I.ExtendedPrice??0),0),S=o.reduce((M,I)=>M+(I.Quantity??0),0),R=o.reduce((M,I)=>M+(I.ExtendedPrice??0),0),C=d+b+S,E=f+_+R,A=[{name:"All",icon:Package,color:"bg-blue-500",orders:C,amount:E},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",orders:d,amount:f},{name:"Shipped",icon:Truck,color:"bg-green-500",orders:S,amount:R},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",orders:b,amount:_}];return e?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-40"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:[1,2,3,4].map(M=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:"bg-gray-200 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]})},M))})})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Order Categories"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:A.map(M=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:`${M.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:M.name}),jsxRuntime.jsx("div",{className:`${M.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(M.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:M.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:jsxRuntime.jsx(FormattedNumber,{value:M.amount,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]})]})]})},M.name))})})]})}function ReportsSection({isLoading:t,userEmail:e,appID:n}){const{toast:o}=useToast(),[l,{isLoading:d}]=usePostV4ResellerByRouteResellerIdReportWalmartTrackingFileEmailMutation(),[f,{isLoading:g}]=usePostV4ResellerByRouteResellerIdReportAmazonTrackingFileEmailMutation(),[b,{isLoading:_}]=usePostV4ResellerByRouteResellerIdReportOpenOrdersEmailMutation(),[S,{isLoading:R}]=usePostV4ResellerByRouteResellerIdReportProductsEmailMutation(),[C,{isLoading:E}]=usePostV4ResellerByRouteResellerIdReportInvoicesEmailMutation(),[A,{isLoading:M}]=usePostV4ResellerByRouteResellerIdDocumentStatementEmailMutation(),[I,j]=React.useState(null),[q,z]=React.useState(e),[Q,F]=React.useState(!1),O=[{name:"Products",reports:[{id:"Products",title:"Universal Product List",description:"A comprehensive overview of your product list with detailed specifications and pricing information.",icon:Package}]},{name:"Operation Details",reports:[{id:"OpenOrders",title:"Order Details",description:"A detailed report of all your orders and shipments, including status, tracking information, and delivery estimates.",icon:ShoppingCart},{id:"Invoices",title:"Invoices and Credits Report",description:"Detailed overview of your invoices and credits within a specific date range. It also contains reports about additional charges, serial numbers, and other relevant information.",icon:ScrollText},{id:"Statement",title:"Statement and RMAs Report",description:"A detailed report of all unpaid invoices and active RMAs.",icon:Banknote}]},{name:"Tracking Files",reports:[{id:"AmazonTrackingFile",title:"Amazon Tracking File",description:"Track products sold on Amazon marketplace with detailed sales and inventory information.",icon:ChartNoAxesColumnIncreasing},{id:"WalmartTrackingFile",title:"Walmart Tracking File",description:"Track products sold on Walmart marketplace with detailed sales and inventory information.",icon:ChartNoAxesColumnIncreasing}]}],te=async ge=>{j(ge),F(!0)},ne=async()=>{if(!(!I||!n))try{switch(I.id){case"Products":await S({routeResellerId:n,emailAddress:q}).unwrap();break;case"AmazonTrackingFile":await f({routeResellerId:n,emailAddress:q}).unwrap();break;case"WalmartTrackingFile":await l({routeResellerId:n,emailAddress:q}).unwrap();break;case"OpenOrders":await b({routeResellerId:n,emailAddress:q}).unwrap();break;case"Invoices":await C({routeResellerId:n,emailAddress:q}).unwrap();break;case"Statement":await A({routeResellerId:n,emailAddress:q}).unwrap();break;default:throw new Error("invalid report id")}o({title:"Report requested",description:`The ${I.title} will be sent to ${q} shortly.`,variant:"success"}),F(!1)}catch(ge){console.error("Error requesting report:",ge),o({title:"Error",description:"Failed to request report. Please try again.",variant:"destructive"})}},se=_||R||g||d||M||E;return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reports"}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Download essential business reports, from your Product List to your Order Details."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:t?jsxRuntime.jsx(jsxRuntime.Fragment,{children:[1,2,3].map(ge=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-48"}),[1,2].map(oe=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})]},oe))]},ge))}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:O.map(ge=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold",children:ge.name}),ge.reports.map(oe=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg hover:bg-gray-100 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:jsxRuntime.jsx(oe.icon,{className:"h-5 w-5 text-primary"})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h4",{className:"font-semibold text-sm",children:oe.title}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:oe.description})]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center gap-1",onClick:()=>te(oe),children:[jsxRuntime.jsx(Download,{className:"h-4 w-4"}),"Request"]})]},oe.id))]},ge.name))})}),jsxRuntime.jsx(Dialog,{open:Q,onOpenChange:F,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsxs(DialogTitle,{children:["Request ",I==null?void 0:I.title]}),jsxRuntime.jsx(DialogDescription,{children:"Enter the email address where you would like to receive the report."})]}),jsxRuntime.jsxs("div",{className:"py-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",value:q,onChange:ge=>z(ge.target.value),placeholder:"your@email.com",className:"mt-2"})]}),jsxRuntime.jsx(DialogDescription,{children:"The report will take around 5 minutes to generate."}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:ne,disabled:!q||se,children:se?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Report"})]})]})})]})}function QualificationBadge({qualification:t}){return!t.QualificationId||t.QualificationId==="Suspended"?null:t.QualificationId==="Do Not Sell"?jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"destructive",children:[jsxRuntime.jsx(X$1,{className:"h-3 w-3 mr-1"}),"Do Not Sell"]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})}):jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"info",className:t.DefaultOpportunityNumber?"pr-1":"",children:[jsxRuntime.jsx(BadgeCheck,{className:"h-3 w-3 mr-1"}),t.QualificationId,t.DefaultOpportunityNumber&&jsxRuntime.jsx(Badge,{variant:"secondary",size:"sm",className:"ml-1",children:t.DefaultOpportunityNumber})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})})}function SalesChart({statistics:t,mode:e="month",chartHeight:n,loading:o=!1,size:l="default"}){const[d,f]=React.useState([]),[g,b]=React.useState(!1),_=[{name:"dollarVolume",label:"Dollar Volume",color:"var(--primary)",yAxisId:"left",format:"money"},{name:"unitsSold",label:"Units Sold",color:"#888",units:" units",yAxisId:"right",format:"integer"}];return React.useEffect(()=>{if(o||!t){f([]);return}let S=[];if(e==="week"){const R=new Map;t.forEach(C=>{var A;const E=((A=C.Day)==null?void 0:A.toString())||"";if(E.length===8){const M=parseInt(E.substring(0,4),10),I=parseInt(E.substring(4,6),10)-1,j=parseInt(E.substring(6,8),10),q=new Date(M,I,j),z=new Date(q);z.setDate(q.getDate()-q.getDay());const Q=`${z.getFullYear()}-${String(z.getMonth()+1).padStart(2,"0")}-${String(z.getDate()).padStart(2,"0")}`,F=R.get(Q)||{price:0,quantity:0};F.price+=C.ExtendedPrice||0,F.quantity+=C.Quantity||0,R.set(Q,F)}}),S=Array.from(R).sort(([C],[E])=>C.localeCompare(E)).map(([C,E])=>({date:`${C.substring(5,7)}/${C.substring(8,10)}`,dollarVolume:E.price,unitsSold:E.quantity}))}else{const R=new Date,C=R.getFullYear(),E=R.getMonth(),A=R.getDate(),M=`${C}-${(E+1).toString().padStart(2,"0")}`,I=Array.from({length:12},(q,z)=>{const Q=new Date(C,E-(11-z),1);return`${Q.getFullYear()}-${(Q.getMonth()+1).toString().padStart(2,"0")}`}),j=Object.fromEntries(I.map(q=>[q,{price:0,quantity:0}]));if(t.forEach(q=>{const z=String(q.Day??0);if(z.length!==8)return;const Q=`${z.substring(0,4)}-${z.substring(4,6)}`;j[Q]&&(j[Q].price+=q.ExtendedPrice??0,j[Q].quantity+=q.Quantity??0)}),S=I.map(q=>{const z=j[q],[Q,F]=q.split("-").map(Number);return{date:new Date(Q,F-1).toLocaleString("default",{month:"short",year:"numeric"}),dollarVolume:z.price,unitsSold:z.quantity}}),g){const q=j[M];if(q&&q.price>0&&A>0){const z=new Date(C,E+1,0).getDate();if(A<z){const Q=q.price/A,F=q.quantity/A,O=Q*z,te=F*z,ne=S[S.length-1];ne&&(ne.dollarVolume=O,ne.unitsSold=te)}}}}f(S)},[t,e,g,o]),o?jsxRuntime.jsx("div",{style:{height:n},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}):d.length===0?jsxRuntime.jsx("div",{style:{height:n},className:"flex items-center justify-center text-muted-foreground",children:"No sales data available."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(AreaChart,{data:d,series:_,height:n,size:l}),l==="default"&&e==="month"&&jsxRuntime.jsxs("div",{className:"mt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Switch,{checked:g,onCheckedChange:b,id:"extrapolate-switch"}),jsxRuntime.jsx(Label$2,{htmlFor:"extrapolate-switch",children:"Extrapolate Current Month"})]}),g&&jsxRuntime.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["* Values for ",new Date().toLocaleString("default",{month:"long"})," are projected estimates."]})]})]})}function ManufacturerCard({manufacturer:t,link:e,linkNewTab:n=!0,actions:o,mainAction:l,loading:d=!1}){var S,R,C;if(d||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-24"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex flex-col space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const f=t.ManufacturerId||"N/A",g=[t.City,t.Province,t.Country].filter(Boolean),b=g.length>0?g.join(", "):"",_=((S=t.Tags)==null?void 0:S.split(",").map(E=>E.trim()).filter(Boolean))||[];return jsxRuntime.jsxs(Card,{className:"manufacturer-theme flex flex-col h-full",children:[jsxRuntime.jsx(reactRouterDom.Link,{to:e??"#",target:e&&n?"_blank":"_self",children:jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:t.ManufacturerId,width:48,height:48},`partner_logo_${t.ManufacturerId}`)}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Manufacturer"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:f})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),b&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:b})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:t.SalesStatistics&&t.SalesStatistics.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(SalesChart,{statistics:t.SalesStatistics,size:"mini"})})})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[(!!((R=t.Qualification)!=null&&R.QualificationId)&&((C=t.Qualification)==null?void 0:C.QualificationId)!=="Suspended"||!!t.OpenToWork||!!t.OnHold&&t.OnHold!==0||_.length>0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}}),!!t.OpenToWork&&jsxRuntime.jsxs(Badge,{variant:"success",children:[jsxRuntime.jsx(HardHat,{className:"h-3 w-3 mr-1"}),"Open To Work"]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"}),_.map((E,A)=>jsxRuntime.jsx(Badge,{variant:"outline",children:E},A))]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),t.SalesData&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesYearToDay?formatMoney(t.SalesData.SalesYearToDay):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast3Months?formatMoney(t.SalesData.SalesLast3Months):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast30Days?formatMoney(t.SalesData.SalesLast30Days):"—"})]})]})}),(o||l||t.PublicResourcesLink)&&jsxRuntime.jsxs(CardFooter,{className:"flex pt-2 gap-2 justify-between mt-auto",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[o&&o,t.PublicResourcesLink&&jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:t.PublicResourcesLink,target:"_blank",children:jsxRuntime.jsx(Button,{size:"icon",children:jsxRuntime.jsx(HardDriveDownload,{className:"h-4 w-4"})})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Public Resources Link"})})]})})]}),l&&jsxRuntime.jsx("div",{children:l})]})]})}function OrdersCard({applicationId:t,orders:e=null,loading:n=!1,title:o="Order Details"}){const l=React.useMemo(()=>[{accessorKey:"DocumentNumber",header:"Document Number",cell:({row:g})=>g.original.DocumentNumber?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Document/${g.original.DocumentNumber}`,className:"font-medium text-primary hover:underline",children:g.original.DocumentNumber})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for order ",g.original.DocumentNumber]})})]})}):"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"DocumentDate",header:"Document Date",cell:({row:g})=>formatYYYYMMDDIntToDateString(g.original.DocumentDate),enableSorting:!0,enableFiltering:!1},{accessorKey:"OrderNumber",header:"Order Number",cell:({row:g})=>g.original.OrderNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"PONumber",header:"PO Number",cell:({row:g})=>g.original.PONumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"WarehouseCode",header:"Warehouse",cell:({row:g})=>g.original.WarehouseCode??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:g})=>g.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!1},{accessorKey:"ShipToName",header:"Name",cell:({row:g})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:g.original.ShipToName??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"UnitPrice",header:"Unit Price",cell:({row:g})=>g.original.UnitPrice?formatMoney(g.original.UnitPrice):"N/A",enableSorting:!0,enableFiltering:!1}],[t]),d=React.useMemo(()=>{const g={};if(e){const b=Array.from(new Set(e.map(E=>E.WarehouseCode).filter(E=>E!=null)));g.WarehouseCode=b;const _=Array.from(new Set(e.map(E=>E.ShipToName).filter(E=>E!=null)));g.ShipToName=_;const S=Array.from(new Set(e.map(E=>E.DocumentNumber).filter(E=>E!=null)));g.DocumentNumber=S;const R=Array.from(new Set(e.map(E=>E.OrderNumber).filter(E=>E!=null)));g.OrderNumber=R;const C=Array.from(new Set(e.map(E=>E.PONumber).filter(E=>E!=null)));g.PONumber=C}return g},[e]),f=e||[];return n?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:o})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:l,data:f,uniqueValues:d})})]})}function ResellerOverview({appID:t,reseller:e,readonly:n,userEmail:o,isSuperAdmin:l,withoutReports:d=!1}){var q,z,Q,F;const{data:f,isLoading:g,isError:b}=useGetV4PartnerByApplicationIdAccountResellerQuery({applicationId:t??"",withSpecification:!0},{skip:!!e}),[_,S]=React.useState({publicInfo:{hasUnsavedChanges:!1}}),R=React.useCallback(()=>n?!1:_.publicInfo.hasUnsavedChanges,[n,_]),C=React.useCallback((O,te)=>{S(ne=>{var se;return((se=ne[O])==null?void 0:se.hasUnsavedChanges)!==te.hasUnsavedChanges?{...ne,[O]:te}:ne})},[]),{NavigationGuardDialog:E}=useRouterNavigationGuard(R),A=e??f,M=!n||!!(A!=null&&A.Statement)&&(A.Statement.Total??0)>0,I=(A==null?void 0:A.QualifiedManufacturers)??[],j=(A==null?void 0:A.Qualifications)??[];return jsxRuntime.jsxs("div",{className:"@container",children:[b?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 reseller information. Please try again later."})]})}):jsxRuntime.jsxs("div",{className:"space-y-6 mb-6",children:[jsxRuntime.jsx(SalesSummary,{fiscalYearMonthStart:(A==null?void 0:A.FiscalYearMonthStart)||1,salesData:A==null?void 0:A.SalesData,isLoading:g}),jsxRuntime.jsxs("div",{className:"grid @lg:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChartCard,{statistics:(A==null?void 0:A.SalesStatistics)??[],loading:g}),jsxRuntime.jsx(OrderCategories,{openOrders:(A==null?void 0:A.ActiveOrderDetails)??[],isLoading:g}),M&&jsxRuntime.jsx(BillingCard,{appID:t,reseller:A||{},withoutReports:d,isLoading:g,userEmail:o}),jsxRuntime.jsx(PublicInfo,{reseller:A||{},appID:t??"",isLoading:g,readonly:n,onUnsavedChanges:O=>C("publicInfo",{hasUnsavedChanges:O})}),jsxRuntime.jsx(AccountTier,{isSuperAdmin:l,readonly:n,reseller:A||{},appID:t??"",isLoading:g})]}),g||I.length>0?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Manufacturers you are qualified for"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid @lg:grid-cols-2 gap-4",children:g?Array.from({length:2}).map((O,te)=>jsxRuntime.jsx(ManufacturerCard,{loading:!0},te)):I.map(O=>jsxRuntime.jsx(ManufacturerCard,{manufacturer:O,link:`https://dashboard.randmar.io/${t}/Partner/${O.ManufacturerId}`},O.ManufacturerId))})})]}):j.length>0&&jsxRuntime.jsx(ResellerQualificationsCard,{qualifications:j}),(((q=A==null?void 0:A.Opportunities)==null?void 0:q.length)??0)>0&&jsxRuntime.jsx(OpportunitiesTable,{applicationId:t,opportunities:A==null?void 0:A.Opportunities,loading:g}),(((z=A==null?void 0:A.ActiveOrderDetails)==null?void 0:z.length)??0)>0&&jsxRuntime.jsx(OrdersCard,{applicationId:t,title:"Active Orders",orders:A==null?void 0:A.ActiveOrderDetails,loading:g}),(((Q=A==null?void 0:A.CompletedOrderDetails)==null?void 0:Q.length)??0)>0&&jsxRuntime.jsx(OrdersCard,{applicationId:t,title:"Completed Orders",orders:A==null?void 0:A.CompletedOrderDetails,loading:g}),(((F=A==null?void 0:A.Returns)==null?void 0:F.length)??0)>0&&jsxRuntime.jsx(ReturnsTable,{applicationId:t,returns:A==null?void 0:A.Returns,loading:g}),!d&&jsxRuntime.jsx(ReportsSection,{appID:t,userEmail:o,isLoading:g})]}),jsxRuntime.jsx(E,{})]})}const alertVariants=cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",success:"border-green-500/50 bg-green-50 text-green-700 dark:border-green-500 dark:bg-green-950 dark:text-green-400 [&>svg]:text-green-500",warning:"border-yellow-500/50 bg-yellow-50 text-yellow-700 dark:border-yellow-500 dark:bg-yellow-950 dark:text-yellow-400 [&>svg]:text-yellow-500",info:"border-blue-500/50 bg-blue-50 text-blue-700 dark:border-blue-500 dark:bg-blue-950 dark:text-blue-400 [&>svg]:text-blue-500"}},defaultVariants:{variant:"default"}}),Alert=React__namespace.forwardRef(({className:t,variant:e,...n},o)=>jsxRuntime.jsx("div",{ref:o,role:"alert",className:cn(alertVariants({variant:e}),t),...n}));Alert.displayName="Alert";const AlertTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("h5",{ref:n,className:cn("mb-1 font-medium leading-none tracking-tight",t),...e}));AlertTitle.displayName="AlertTitle";const AlertDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("text-sm [&_p]:leading-relaxed",t),...e}));AlertDescription.displayName="AlertDescription";/**
1171
1171
  * table-core
1172
1172
  *
1173
1173
  * Copyright (c) TanStack
@@ -1188,7 +1188,7 @@ $10 with opportunities under $1,000`:t==="D"?"$15 under $1,500":t==="E"?"Full sh
1188
1188
  * LICENSE.md file in the root directory of this source tree.
1189
1189
  *
1190
1190
  * @license MIT
1191
- */function flexRender(t,e){return t?isReactComponent(t)?React__namespace.createElement(t,e):t:null}function isReactComponent(t){return isClassComponent(t)||typeof t=="function"||isExoticComponent(t)}function isClassComponent(t){return typeof t=="function"&&(()=>{const e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}function isExoticComponent(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function useReactTable(t){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[n]=React__namespace.useState(()=>({current:createTable(e)})),[o,l]=React__namespace.useState(()=>n.current.initialState);return n.current.setOptions(d=>({...d,...t,state:{...o,...t.state},onStateChange:f=>{l(f),t.onStateChange==null||t.onStateChange(f)}})),n.current}function DataTable({columns:t,data:e,uniqueValues:n,tableClass:o,loading:l}){var M;const[d,f]=React.useState([]),[g,b]=React.useState([]),[_,S]=React.useState({pageIndex:0,pageSize:10}),[R,C]=React.useState(null),E=useReactTable({data:l?[]:e,columns:t,getCoreRowModel:getCoreRowModel(),onSortingChange:f,getSortedRowModel:getSortedRowModel(),onColumnFiltersChange:b,getFilteredRowModel:getFilteredRowModel(),getPaginationRowModel:getPaginationRowModel(),onPaginationChange:S,state:{sorting:d,columnFilters:g,pagination:_},manualPagination:l,manualSorting:l,manualFiltering:l}),A=(I,j)=>{I.toggleSorting(j),C(null)};return l?jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx("div",{className:`rounded-md border ${o??""}`,children:jsxRuntime.jsxs(Table,{children:[jsxRuntime.jsx(TableHeader,{children:jsxRuntime.jsx(TableRow,{children:t.map((I,j)=>jsxRuntime.jsx(TableHead,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-full"})},`skeleton-header-${j}`))})}),jsxRuntime.jsx(TableBody,{children:Array.from({length:_.pageSize}).map((I,j)=>jsxRuntime.jsx(TableRow,{children:t.map((q,z)=>jsxRuntime.jsx(TableCell,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-full"})},`skeleton-cell-${j}-${z}`))},`skeleton-row-${j}`))})]})}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-[110px]"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-[70px]"})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"hidden h-8 w-8 lg:flex"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-12"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-8"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-8"})]}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8"}),jsxRuntime.jsx(Skeleton,{className:"hidden h-8 w-8 lg:flex"})]})]})]}):jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs(ScrollArea,{className:`rounded-md border ${o??""}`,children:[jsxRuntime.jsxs(Table,{children:[jsxRuntime.jsx(TableHeader,{children:E.getHeaderGroups().map(I=>jsxRuntime.jsx(TableRow,{children:I.headers.map(j=>{var q;return jsxRuntime.jsx(TableHead,{children:j.isPlaceholder?null:j.column.getCanSort()||j.column.getCanFilter()?jsxRuntime.jsxs(Popover,{open:R===j.id,onOpenChange:z=>C(z?j.id:null),children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:"pl-0",children:[flexRender(j.column.columnDef.header,j.getContext()),j.column.getIsFiltered()?jsxRuntime.jsx(Filter,{className:"ml-2 h-4 w-4"}):j.column.getIsSorted()==="asc"?jsxRuntime.jsx(ArrowUp,{className:"ml-2 h-4 w-4"}):j.column.getIsSorted()==="desc"?jsxRuntime.jsx(ArrowDown,{className:"ml-2 h-4 w-4"}):jsxRuntime.jsx(ArrowUpDown,{className:"ml-2 h-4 w-4"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-56",children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[j.column.getCanSort()&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>A(j.column,!1),children:[jsxRuntime.jsx(ArrowUp,{className:"mr-2 h-4 w-4"}),"Sort Ascending"]}),jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>A(j.column,!0),children:[jsxRuntime.jsx(ArrowDown,{className:"mr-2 h-4 w-4"}),"Sort Descending"]})]}),j.column.getCanFilter()&&jsxRuntime.jsx("div",{className:"px-2 py-1",children:n[j.column.id]?jsxRuntime.jsxs(Select,{onValueChange:z=>j.column.setFilterValue(z==="all"?void 0:[z]),children:[jsxRuntime.jsx(SelectTrigger,{children:jsxRuntime.jsx(SelectValue,{placeholder:`Filter ${j.column.columnDef.header}...`})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"all",children:"All"}),(q=n[j.column.id])==null?void 0:q.map(z=>jsxRuntime.jsx(SelectItem,{value:z||"empty",children:z||"(Empty)"},z))]})]}):jsxRuntime.jsx(Input,{placeholder:`Filter ${j.column.columnDef.header}...`,value:j.column.getFilterValue()??"",onChange:z=>j.column.setFilterValue(z.target.value),className:"w-full"})})]})})]}):jsxRuntime.jsx("div",{className:"py-2 px-4",children:flexRender(j.column.columnDef.header,j.getContext())})},j.id)})},I.id))}),jsxRuntime.jsx(TableBody,{children:(M=E.getRowModel().rows)!=null&&M.length?E.getRowModel().rows.map(I=>jsxRuntime.jsx(TableRow,{"data-state":I.getIsSelected()&&"selected",children:I.getVisibleCells().map(j=>jsxRuntime.jsx(TableCell,{children:flexRender(j.column.columnDef.cell,j.getContext())},j.id))},I.id)):jsxRuntime.jsx(TableRow,{children:jsxRuntime.jsx(TableCell,{colSpan:t.length,className:"h-24 text-center",children:"No results."})})})]}),jsxRuntime.jsx(ScrollBar,{orientation:"horizontal"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),jsxRuntime.jsxs(Select,{value:`${E.getState().pagination.pageSize}`,onValueChange:I=>{E.setPageSize(Number(I))},children:[jsxRuntime.jsx(SelectTrigger,{className:"h-8 w-[70px]",children:jsxRuntime.jsx(SelectValue,{asChild:!0,children:jsxRuntime.jsx("span",{children:E.getState().pagination.pageSize})})}),jsxRuntime.jsx(SelectContent,{side:"top",children:[10,20,30,40,50].map(I=>jsxRuntime.jsx(SelectItem,{value:`${I}`,children:jsxRuntime.jsx("span",{children:I})},I))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>E.setPageIndex(0),disabled:!E.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to first page"}),jsxRuntime.jsx(ChevronsLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>E.previousPage(),disabled:!E.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to previous page"}),jsxRuntime.jsx(ChevronLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Page"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:E.getState().pagination.pageIndex+1}),jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"of"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:E.getPageCount()})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>E.nextPage(),disabled:!E.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to next page"}),jsxRuntime.jsx(ChevronRight,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>E.setPageIndex(E.getPageCount()-1),disabled:!E.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to last page"}),jsxRuntime.jsx(ChevronsRight,{className:"h-4 w-4"})]})]})]})]})}function PartnerCard({account:t,action:e,loading:n=!1,className:o,withAbout:l=!1,withVoice:d=!0}){const[f,g]=React.useState(!1),[b,_]=React.useState(!0),[S,R]=React.useState(null),[C,E]=React.useState(!1),A=React.useMemo(()=>t!=null&&t.ApplicationId?{videoUrl:`https://api.randmar.io/V4/Partner/${t.ApplicationId}/Account/Video`,videoExistsUrl:`https://api.randmar.io/V4/Partner/${t.ApplicationId}/Account/Video/Exists`}:null,[t==null?void 0:t.ApplicationId]);React.useEffect(()=>{if(!A||n)return;R(null);const I=async()=>{try{const q=await fetch(A.videoExistsUrl);if(q.ok){const z=await q.text();g(z.toLowerCase()==="true")}else throw new Error(`Failed to check video: ${q.status}`)}catch(q){console.error("Failed to check if video exists:",q),g(!1)}};(async()=>{I()})()},[A,n]);const M=()=>{_(!1)};return n||!t?jsxRuntime.jsxs(Card,{className:`flex flex-col h-full ${o}`,children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"}),jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-48 mt-1"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"})]}),l&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-full"})]}),d&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]})]})})]})}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-48"})]})]}):jsxRuntime.jsxs(Card,{className:`flex flex-col h-full ${o}`,children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:t.ApplicationId,width:64,height:64},`partner_logo_${t.ApplicationId}`)}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Partner"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:t.ApplicationId})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"})]})]})}),jsxRuntime.jsxs(CardContent,{className:"pb-2 flex-grow",children:[S&&jsxRuntime.jsx("div",{className:"text-red-500 mb-4 text-sm",role:"alert",children:S}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[(t.IsManufacturer||t.IsReseller||t.IsSalesAgency)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.IsManufacturer&&jsxRuntime.jsx(Badge,{className:"manufacturer-theme",children:"Manufacturer"}),t.IsReseller&&jsxRuntime.jsx(Badge,{className:"reseller-theme",children:"Reseller"}),t.IsSalesAgency&&jsxRuntime.jsx(Badge,{children:"Agency"})]}),l&&t.About&&jsxRuntime.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:t.About??""}}),d&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.VoiceName??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Style"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.VoiceStyle??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Scene Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.SceneName??"N/A"})]})]})})]})]}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2 mt-auto",children:[f&&A?jsxRuntime.jsxs(Dialog,{open:C,onOpenChange:E,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"outline",className:"flex items-center gap-2",children:[jsxRuntime.jsx(Video,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:"Watch Video"})]})}),jsxRuntime.jsxs(DialogContent,{className:"@sm:max-w-[360px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{children:[t.PublicName," Video"]})}),jsxRuntime.jsxs("div",{className:"w-full h-[640px] rounded-md overflow-hidden",children:[b&&jsxRuntime.jsx(Skeleton,{className:"w-full h-full"}),jsxRuntime.jsx("video",{src:A.videoUrl,controls:!0,preload:"auto",playsInline:!0,autoPlay:!0,"aria-label":`Video for ${t.PublicName}`,className:`w-full h-full object-cover ${b?"invisible":"visible"}`,style:{objectPosition:"center",imageRendering:"auto"},onLoadedData:M,onError:()=>_(!1)})]})]})]}):jsxRuntime.jsx("div",{}),e||jsxRuntime.jsxs(Button,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Partner Dashboard"]})]})]})}function ResellerCard({reseller:t,link:e,linkNewTab:n=!0,actions:o,mainAction:l,loading:d=!1}){var _,S;if(d||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsx("div",{className:"flex",children:jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const f=t.ResellerId||"N/A",g=[t.City,t.Province,t.Country].filter(Boolean),b=g.length>0?g.join(", "):"Location not provided";return jsxRuntime.jsxs(Card,{className:"reseller-theme flex flex-col h-full",children:[jsxRuntime.jsx(reactRouterDom.Link,{to:e??"#",target:e&&n?"_blank":"_self",children:jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:t.ResellerId,width:48,height:48},`partner_logo_${t.ResellerId}`)}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Reseller"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:f})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:b})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:t.SalesStatistics&&t.SalesStatistics.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(SalesChart,{statistics:t.SalesStatistics,size:"mini"})})})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[(!!((_=t.Qualification)!=null&&_.QualificationId)&&((S=t.Qualification)==null?void 0:S.QualificationId)!=="Suspended"||!!t.OnHold&&t.OnHold!==0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),(t==null?void 0:t.SalesData)&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesYearToDay?formatMoney(t==null?void 0:t.SalesData.SalesYearToDay):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesLast3Months?formatMoney(t==null?void 0:t.SalesData.SalesLast3Months):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesLast30Days?formatMoney(t==null?void 0:t.SalesData.SalesLast30Days):"—"})]})]})}),(o||l)&&jsxRuntime.jsxs(CardFooter,{className:"flex pt-2 gap-2 justify-between mt-auto",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:o&&o}),l&&jsxRuntime.jsx("div",{children:l})]})]})}const Table=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{className:"relative w-full overflow-auto",children:jsxRuntime.jsx("table",{ref:n,className:cn("w-full caption-bottom text-sm",t),...e})}));Table.displayName="Table";const TableHeader=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("thead",{ref:n,className:cn("[&_tr]:border-b",t),...e}));TableHeader.displayName="TableHeader";const TableBody=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tbody",{ref:n,className:cn("[&_tr:last-child]:border-0",t),...e}));TableBody.displayName="TableBody";const TableFooter=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tfoot",{ref:n,className:cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));TableFooter.displayName="TableFooter";const TableRow=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tr",{ref:n,className:cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));TableRow.displayName="TableRow";const TableHead=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("th",{ref:n,className:cn("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableHead.displayName="TableHead";const TableCell=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("td",{ref:n,className:cn("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableCell.displayName="TableCell";const TableCaption=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("caption",{ref:n,className:cn("mt-4 text-sm text-muted-foreground",t),...e}));TableCaption.displayName="TableCaption";const Topbar=React.forwardRef(({onSignOut:t,handleValidSearch:e,rightMenu:n,searchPlaceholder:o},l)=>{const[d,f]=React.useState(""),g=reactRouterDom.useLocation(),{toast:b}=useToast();React.useEffect(()=>{const C=new URLSearchParams(g.search).get("q");C&&f(C)},[g.search]);const _=()=>{const R=d.trim();if(!R||R.length<2){b({title:"Enter more characters to search",description:"At least 2 characters are needed to search products.",variant:"destructive",duration:5e3});return}e(R)},S=R=>{R.key==="Enter"&&_()};return jsxRuntime.jsxs("header",{className:"flex h-16 items-center gap-4 border-b sidebar-foreground bg-sidebar px-6 fixed top-0 right-0 z-50 lg:left-64 left-0 border-sidebar-border",children:[jsxRuntime.jsx(SidebarTrigger,{className:"lg:hidden",children:jsxRuntime.jsx(Menu$1,{className:"h-6 w-6"})}),jsxRuntime.jsx("div",{className:"flex flex-1 items-center gap-4",children:jsxRuntime.jsx("div",{className:"relative w-full max-w-sm",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("button",{type:"button",className:"absolute left-2 top-1/2 -translate-y-1/2",onClick:_,"aria-label":"Search",children:jsxRuntime.jsx(Search,{className:"h-4 w-4 text-muted-foreground"})}),jsxRuntime.jsx(Input,{placeholder:o??"Search...",className:"w-full pl-8 bg-white text-black",value:d,onChange:R=>f(R.target.value),onKeyDown:S,ref:l},"topbar-search")]})})}),n||jsxRuntime.jsx(jsxRuntime.Fragment,{}),t&&jsxRuntime.jsx("div",{className:"flex items-center gap-4",children:jsxRuntime.jsxs(Button,{variant:"ghost",size:"icon",className:"h-9 w-9",onClick:t,children:[jsxRuntime.jsx(LogOut,{className:"h-4 w-4 text-sidebar-foreground"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Sign out"})]})})]})});Topbar.displayName="Topbar";function ActiveOrdersCard({orders:t,loading:e=!1}){const n=React.useMemo(()=>{if(!t||t.length===0)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const l=t.filter(I=>I.DocumentType==="Order"),d=t.filter(I=>I.DocumentType==="Shipment"),f=l.filter(I=>I.WarehouseCode!=="3PLE"),g=f.reduce((I,j)=>I+(j.Quantity||0),0),b=f.reduce((I,j)=>I+(j.ExtendedPrice||0),0),_=l.filter(I=>I.WarehouseCode==="3PLE"),S=_.reduce((I,j)=>I+(j.Quantity||0),0),R=_.reduce((I,j)=>I+(j.ExtendedPrice||0),0),C=d.length,E=d.reduce((I,j)=>I+(j.ExtendedPrice||0),0),A=g+S+C,M=b+R+E;return{all:{orders:A,amount:M},processing:{orders:g,amount:b},shipped:{orders:C,amount:E},delayed:{orders:S,amount:R}}},[t]),o=[{name:"All",icon:Package,color:"bg-blue-500",textColor:"text-blue-600",orders:n.all.orders,amount:n.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",textColor:"text-yellow-600",orders:n.processing.orders,amount:n.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",textColor:"text-green-600",orders:n.shipped.orders,amount:n.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",textColor:"text-red-600",orders:n.delayed.orders,amount:n.delayed.amount}];return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:[1,2,3,4].map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:"bg-slate-200 dark:bg-slate-700 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]},l))})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:o.map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:l.name}),jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(l.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:l.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:formatMoney(l.amount)})]})]})]})]},l.name))})]})}var __create=Object.create,__getProtoOf=Object.getPrototypeOf,__defProp=Object.defineProperty,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__toESM=(t,e,n)=>{n=t!=null?__create(__getProtoOf(t)):{};const o=e||!t||!t.__esModule?__defProp(n,"default",{value:t,enumerable:!0}):n;for(let l of __getOwnPropNames(t))__hasOwnProp.call(o,l)||__defProp(o,l,{get:()=>t[l],enumerable:!0});return o},__commonJS=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),require_xhtml=__commonJS((t,e)=>{e.exports={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}}),require_acorn=__commonJS((t,e)=>{(function(n,o){typeof t=="object"&&typeof e<"u"?o(t):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.acorn={}))})(t,function(n){var o=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],l=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],d="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",f="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",g={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},b="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",_={5:b,"5module":b+" export import",6:b+" const class extends export import super"},S=/^in(stanceof)?$/,R=new RegExp("["+f+"]"),C=new RegExp("["+f+d+"]");function E(V,ae){for(var Be=65536,Fe=0;Fe<ae.length;Fe+=2){if(Be+=ae[Fe],Be>V)return!1;if(Be+=ae[Fe+1],Be>=V)return!0}return!1}function A(V,ae){return V<65?V===36:V<91?!0:V<97?V===95:V<123?!0:V<=65535?V>=170&&R.test(String.fromCharCode(V)):ae===!1?!1:E(V,l)}function M(V,ae){return V<48?V===36:V<58?!0:V<65?!1:V<91?!0:V<97?V===95:V<123?!0:V<=65535?V>=170&&C.test(String.fromCharCode(V)):ae===!1?!1:E(V,l)||E(V,o)}var I=function(ae,Be){Be===void 0&&(Be={}),this.label=ae,this.keyword=Be.keyword,this.beforeExpr=!!Be.beforeExpr,this.startsExpr=!!Be.startsExpr,this.isLoop=!!Be.isLoop,this.isAssign=!!Be.isAssign,this.prefix=!!Be.prefix,this.postfix=!!Be.postfix,this.binop=Be.binop||null,this.updateContext=null};function j(V,ae){return new I(V,{beforeExpr:!0,binop:ae})}var q={beforeExpr:!0},z={startsExpr:!0},Q={};function F(V,ae){return ae===void 0&&(ae={}),ae.keyword=V,Q[V]=new I(V,ae)}var O={num:new I("num",z),regexp:new I("regexp",z),string:new I("string",z),name:new I("name",z),privateId:new I("privateId",z),eof:new I("eof"),bracketL:new I("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new I("]"),braceL:new I("{",{beforeExpr:!0,startsExpr:!0}),braceR:new I("}"),parenL:new I("(",{beforeExpr:!0,startsExpr:!0}),parenR:new I(")"),comma:new I(",",q),semi:new I(";",q),colon:new I(":",q),dot:new I("."),question:new I("?",q),questionDot:new I("?."),arrow:new I("=>",q),template:new I("template"),invalidTemplate:new I("invalidTemplate"),ellipsis:new I("...",q),backQuote:new I("`",z),dollarBraceL:new I("${",{beforeExpr:!0,startsExpr:!0}),eq:new I("=",{beforeExpr:!0,isAssign:!0}),assign:new I("_=",{beforeExpr:!0,isAssign:!0}),incDec:new I("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new I("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:j("||",1),logicalAND:j("&&",2),bitwiseOR:j("|",3),bitwiseXOR:j("^",4),bitwiseAND:j("&",5),equality:j("==/!=/===/!==",6),relational:j("</>/<=/>=",7),bitShift:j("<</>>/>>>",8),plusMin:new I("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:j("%",10),star:j("*",10),slash:j("/",10),starstar:new I("**",{beforeExpr:!0}),coalesce:j("??",1),_break:F("break"),_case:F("case",q),_catch:F("catch"),_continue:F("continue"),_debugger:F("debugger"),_default:F("default",q),_do:F("do",{isLoop:!0,beforeExpr:!0}),_else:F("else",q),_finally:F("finally"),_for:F("for",{isLoop:!0}),_function:F("function",z),_if:F("if"),_return:F("return",q),_switch:F("switch"),_throw:F("throw",q),_try:F("try"),_var:F("var"),_const:F("const"),_while:F("while",{isLoop:!0}),_with:F("with"),_new:F("new",{beforeExpr:!0,startsExpr:!0}),_this:F("this",z),_super:F("super",z),_class:F("class",z),_extends:F("extends",q),_export:F("export"),_import:F("import",z),_null:F("null",z),_true:F("true",z),_false:F("false",z),_in:F("in",{beforeExpr:!0,binop:7}),_instanceof:F("instanceof",{beforeExpr:!0,binop:7}),_typeof:F("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:F("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:F("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},te=/\r\n?|\n|\u2028|\u2029/,ne=new RegExp(te.source,"g");function se(V){return V===10||V===13||V===8232||V===8233}function ge(V,ae,Be){Be===void 0&&(Be=V.length);for(var Fe=ae;Fe<Be;Fe++){var Ke=V.charCodeAt(Fe);if(se(Ke))return Fe<Be-1&&Ke===13&&V.charCodeAt(Fe+1)===10?Fe+2:Fe+1}return-1}var oe=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Ae=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,je=Object.prototype,Ne=je.hasOwnProperty,Ve=je.toString,Le=Object.hasOwn||function(V,ae){return Ne.call(V,ae)},ze=Array.isArray||function(V){return Ve.call(V)==="[object Array]"},$e=Object.create(null);function Oe(V){return $e[V]||($e[V]=new RegExp("^(?:"+V.replace(/ /g,"|")+")$"))}function qe(V){return V<=65535?String.fromCharCode(V):(V-=65536,String.fromCharCode((V>>10)+55296,(V&1023)+56320))}var Ge=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Ue=function(ae,Be){this.line=ae,this.column=Be};Ue.prototype.offset=function(ae){return new Ue(this.line,this.column+ae)};var Je=function(ae,Be,Fe){this.start=Be,this.end=Fe,ae.sourceFile!==null&&(this.source=ae.sourceFile)};function Ze(V,ae){for(var Be=1,Fe=0;;){var Ke=ge(V,Fe,ae);if(Ke<0)return new Ue(Be,ae-Fe);++Be,Fe=Ke}}var We={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},tt=!1;function Xe(V){var ae={};for(var Be in We)ae[Be]=V&&Le(V,Be)?V[Be]:We[Be];if(ae.ecmaVersion==="latest"?ae.ecmaVersion=1e8:ae.ecmaVersion==null?(!tt&&typeof console=="object"&&console.warn&&(tt=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
1191
+ */function flexRender(t,e){return t?isReactComponent(t)?React__namespace.createElement(t,e):t:null}function isReactComponent(t){return isClassComponent(t)||typeof t=="function"||isExoticComponent(t)}function isClassComponent(t){return typeof t=="function"&&(()=>{const e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}function isExoticComponent(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function useReactTable(t){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[n]=React__namespace.useState(()=>({current:createTable(e)})),[o,l]=React__namespace.useState(()=>n.current.initialState);return n.current.setOptions(d=>({...d,...t,state:{...o,...t.state},onStateChange:f=>{l(f),t.onStateChange==null||t.onStateChange(f)}})),n.current}function DataTable({columns:t,data:e,uniqueValues:n,tableClass:o,loading:l}){var M;const[d,f]=React.useState([]),[g,b]=React.useState([]),[_,S]=React.useState({pageIndex:0,pageSize:10}),[R,C]=React.useState(null),E=useReactTable({data:l?[]:e,columns:t,getCoreRowModel:getCoreRowModel(),onSortingChange:f,getSortedRowModel:getSortedRowModel(),onColumnFiltersChange:b,getFilteredRowModel:getFilteredRowModel(),getPaginationRowModel:getPaginationRowModel(),onPaginationChange:S,state:{sorting:d,columnFilters:g,pagination:_},manualPagination:l,manualSorting:l,manualFiltering:l}),A=(I,j)=>{I.toggleSorting(j),C(null)};return l?jsxRuntime.jsxs("div",{className:"@container space-y-4",children:[jsxRuntime.jsx("div",{className:`rounded-md border ${o??""}`,children:jsxRuntime.jsxs(Table,{children:[jsxRuntime.jsx(TableHeader,{children:jsxRuntime.jsx(TableRow,{children:t.map((I,j)=>jsxRuntime.jsx(TableHead,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-full"})},`skeleton-header-${j}`))})}),jsxRuntime.jsx(TableBody,{children:Array.from({length:_.pageSize}).map((I,j)=>jsxRuntime.jsx(TableRow,{children:t.map((q,z)=>jsxRuntime.jsx(TableCell,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-full"})},`skeleton-cell-${j}-${z}`))},`skeleton-row-${j}`))})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 @[35rem]:flex-row @[35rem]:justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-[110px]"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-[70px]"})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"hidden h-8 w-8 lg:flex"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-12"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-8"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-8"})]}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8"}),jsxRuntime.jsx(Skeleton,{className:"hidden h-8 w-8 lg:flex"})]})]})]}):jsxRuntime.jsxs("div",{className:"@container space-y-4",children:[jsxRuntime.jsxs(ScrollArea,{className:`rounded-md border ${o??""}`,children:[jsxRuntime.jsxs(Table,{children:[jsxRuntime.jsx(TableHeader,{children:E.getHeaderGroups().map(I=>jsxRuntime.jsx(TableRow,{children:I.headers.map(j=>{var q;return jsxRuntime.jsx(TableHead,{children:j.isPlaceholder?null:j.column.getCanSort()||j.column.getCanFilter()?jsxRuntime.jsxs(Popover,{open:R===j.id,onOpenChange:z=>C(z?j.id:null),children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:"pl-0",children:[flexRender(j.column.columnDef.header,j.getContext()),j.column.getIsFiltered()?jsxRuntime.jsx(Filter,{className:"ml-2 h-4 w-4"}):j.column.getIsSorted()==="asc"?jsxRuntime.jsx(ArrowUp,{className:"ml-2 h-4 w-4"}):j.column.getIsSorted()==="desc"?jsxRuntime.jsx(ArrowDown,{className:"ml-2 h-4 w-4"}):jsxRuntime.jsx(ArrowUpDown,{className:"ml-2 h-4 w-4"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-56",children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[j.column.getCanSort()&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>A(j.column,!1),children:[jsxRuntime.jsx(ArrowUp,{className:"mr-2 h-4 w-4"}),"Sort Ascending"]}),jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>A(j.column,!0),children:[jsxRuntime.jsx(ArrowDown,{className:"mr-2 h-4 w-4"}),"Sort Descending"]})]}),j.column.getCanFilter()&&jsxRuntime.jsx("div",{className:"px-2 py-1",children:n[j.column.id]?jsxRuntime.jsxs(Select,{onValueChange:z=>j.column.setFilterValue(z==="all"?void 0:[z]),children:[jsxRuntime.jsx(SelectTrigger,{children:jsxRuntime.jsx(SelectValue,{placeholder:`Filter ${j.column.columnDef.header}...`})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"all",children:"All"}),(q=n[j.column.id])==null?void 0:q.map(z=>jsxRuntime.jsx(SelectItem,{value:z||"empty",children:z||"(Empty)"},z))]})]}):jsxRuntime.jsx(Input,{placeholder:`Filter ${j.column.columnDef.header}...`,value:j.column.getFilterValue()??"",onChange:z=>j.column.setFilterValue(z.target.value),className:"w-full"})})]})})]}):jsxRuntime.jsx("div",{className:"py-2 px-4",children:flexRender(j.column.columnDef.header,j.getContext())})},j.id)})},I.id))}),jsxRuntime.jsx(TableBody,{children:(M=E.getRowModel().rows)!=null&&M.length?E.getRowModel().rows.map(I=>jsxRuntime.jsx(TableRow,{"data-state":I.getIsSelected()&&"selected",children:I.getVisibleCells().map(j=>jsxRuntime.jsx(TableCell,{children:flexRender(j.column.columnDef.cell,j.getContext())},j.id))},I.id)):jsxRuntime.jsx(TableRow,{children:jsxRuntime.jsx(TableCell,{colSpan:t.length,className:"h-24 text-center",children:"No results."})})})]}),jsxRuntime.jsx(ScrollBar,{orientation:"horizontal"})]}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 @[35rem]:flex-row @[35rem]:justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),jsxRuntime.jsxs(Select,{value:`${E.getState().pagination.pageSize}`,onValueChange:I=>{E.setPageSize(Number(I))},children:[jsxRuntime.jsx(SelectTrigger,{className:"h-8 w-[70px]",children:jsxRuntime.jsx(SelectValue,{asChild:!0,children:jsxRuntime.jsx("span",{children:E.getState().pagination.pageSize})})}),jsxRuntime.jsx(SelectContent,{side:"top",children:[10,20,30,40,50].map(I=>jsxRuntime.jsx(SelectItem,{value:`${I}`,children:jsxRuntime.jsx("span",{children:I})},I))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>E.setPageIndex(0),disabled:!E.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to first page"}),jsxRuntime.jsx(ChevronsLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>E.previousPage(),disabled:!E.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to previous page"}),jsxRuntime.jsx(ChevronLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Page"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:E.getState().pagination.pageIndex+1}),jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"of"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:E.getPageCount()})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>E.nextPage(),disabled:!E.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to next page"}),jsxRuntime.jsx(ChevronRight,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>E.setPageIndex(E.getPageCount()-1),disabled:!E.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to last page"}),jsxRuntime.jsx(ChevronsRight,{className:"h-4 w-4"})]})]})]})]})}function PartnerCard({account:t,action:e,loading:n=!1,className:o,withAbout:l=!1,withVoice:d=!0}){const[f,g]=React.useState(!1),[b,_]=React.useState(!0),[S,R]=React.useState(null),[C,E]=React.useState(!1),A=React.useMemo(()=>t!=null&&t.ApplicationId?{videoUrl:`https://api.randmar.io/V4/Partner/${t.ApplicationId}/Account/Video`,videoExistsUrl:`https://api.randmar.io/V4/Partner/${t.ApplicationId}/Account/Video/Exists`}:null,[t==null?void 0:t.ApplicationId]);React.useEffect(()=>{if(!A||n)return;R(null);const I=async()=>{try{const q=await fetch(A.videoExistsUrl);if(q.ok){const z=await q.text();g(z.toLowerCase()==="true")}else throw new Error(`Failed to check video: ${q.status}`)}catch(q){console.error("Failed to check if video exists:",q),g(!1)}};(async()=>{I()})()},[A,n]);const M=()=>{_(!1)};return n||!t?jsxRuntime.jsxs(Card,{className:`flex flex-col h-full ${o}`,children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"}),jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-48 mt-1"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"})]}),l&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-full"})]}),d&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]})]})})]})}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-48"})]})]}):jsxRuntime.jsxs(Card,{className:`flex flex-col h-full ${o}`,children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:t.ApplicationId,width:64,height:64},`partner_logo_${t.ApplicationId}`)}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Partner"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:t.ApplicationId})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"})]})]})}),jsxRuntime.jsxs(CardContent,{className:"pb-2 flex-grow",children:[S&&jsxRuntime.jsx("div",{className:"text-red-500 mb-4 text-sm",role:"alert",children:S}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[(t.IsManufacturer||t.IsReseller||t.IsSalesAgency)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.IsManufacturer&&jsxRuntime.jsx(Badge,{className:"manufacturer-theme",children:"Manufacturer"}),t.IsReseller&&jsxRuntime.jsx(Badge,{className:"reseller-theme",children:"Reseller"}),t.IsSalesAgency&&jsxRuntime.jsx(Badge,{children:"Agency"})]}),l&&t.About&&jsxRuntime.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:t.About??""}}),d&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.VoiceName??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Style"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.VoiceStyle??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Scene Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.SceneName??"N/A"})]})]})})]})]}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2 mt-auto",children:[f&&A?jsxRuntime.jsxs(Dialog,{open:C,onOpenChange:E,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"outline",className:"flex items-center gap-2",children:[jsxRuntime.jsx(Video,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:"Watch Video"})]})}),jsxRuntime.jsxs(DialogContent,{className:"@sm:max-w-[360px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{children:[t.PublicName," Video"]})}),jsxRuntime.jsxs("div",{className:"w-full h-[640px] rounded-md overflow-hidden",children:[b&&jsxRuntime.jsx(Skeleton,{className:"w-full h-full"}),jsxRuntime.jsx("video",{src:A.videoUrl,controls:!0,preload:"auto",playsInline:!0,autoPlay:!0,"aria-label":`Video for ${t.PublicName}`,className:`w-full h-full object-cover ${b?"invisible":"visible"}`,style:{objectPosition:"center",imageRendering:"auto"},onLoadedData:M,onError:()=>_(!1)})]})]})]}):jsxRuntime.jsx("div",{}),e||jsxRuntime.jsxs(Button,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Partner Dashboard"]})]})]})}function ResellerCard({reseller:t,link:e,linkNewTab:n=!0,actions:o,mainAction:l,loading:d=!1}){var _,S;if(d||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsx("div",{className:"flex",children:jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const f=t.ResellerId||"N/A",g=[t.City,t.Province,t.Country].filter(Boolean),b=g.length>0?g.join(", "):"Location not provided";return jsxRuntime.jsxs(Card,{className:"reseller-theme flex flex-col h-full",children:[jsxRuntime.jsx(reactRouterDom.Link,{to:e??"#",target:e&&n?"_blank":"_self",children:jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:t.ResellerId,width:48,height:48},`partner_logo_${t.ResellerId}`)}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Reseller"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:f})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:b})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:t.SalesStatistics&&t.SalesStatistics.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(SalesChart,{statistics:t.SalesStatistics,size:"mini"})})})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[(!!((_=t.Qualification)!=null&&_.QualificationId)&&((S=t.Qualification)==null?void 0:S.QualificationId)!=="Suspended"||!!t.OnHold&&t.OnHold!==0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),(t==null?void 0:t.SalesData)&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesYearToDay?formatMoney(t==null?void 0:t.SalesData.SalesYearToDay):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesLast3Months?formatMoney(t==null?void 0:t.SalesData.SalesLast3Months):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesLast30Days?formatMoney(t==null?void 0:t.SalesData.SalesLast30Days):"—"})]})]})}),(o||l)&&jsxRuntime.jsxs(CardFooter,{className:"flex pt-2 gap-2 justify-between mt-auto",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:o&&o}),l&&jsxRuntime.jsx("div",{children:l})]})]})}const Table=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{className:"relative w-full overflow-auto",children:jsxRuntime.jsx("table",{ref:n,className:cn("w-full caption-bottom text-sm",t),...e})}));Table.displayName="Table";const TableHeader=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("thead",{ref:n,className:cn("[&_tr]:border-b",t),...e}));TableHeader.displayName="TableHeader";const TableBody=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tbody",{ref:n,className:cn("[&_tr:last-child]:border-0",t),...e}));TableBody.displayName="TableBody";const TableFooter=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tfoot",{ref:n,className:cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));TableFooter.displayName="TableFooter";const TableRow=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tr",{ref:n,className:cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));TableRow.displayName="TableRow";const TableHead=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("th",{ref:n,className:cn("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableHead.displayName="TableHead";const TableCell=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("td",{ref:n,className:cn("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableCell.displayName="TableCell";const TableCaption=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("caption",{ref:n,className:cn("mt-4 text-sm text-muted-foreground",t),...e}));TableCaption.displayName="TableCaption";const Topbar=React.forwardRef(({onSignOut:t,handleValidSearch:e,rightMenu:n,searchPlaceholder:o},l)=>{const[d,f]=React.useState(""),g=reactRouterDom.useLocation(),{toast:b}=useToast();React.useEffect(()=>{const C=new URLSearchParams(g.search).get("q");C&&f(C)},[g.search]);const _=()=>{const R=d.trim();if(!R||R.length<2){b({title:"Enter more characters to search",description:"At least 2 characters are needed to search products.",variant:"destructive",duration:5e3});return}e(R)},S=R=>{R.key==="Enter"&&_()};return jsxRuntime.jsxs("header",{className:"flex h-16 items-center gap-4 border-b sidebar-foreground bg-sidebar px-6 fixed top-0 right-0 z-50 lg:left-64 left-0 border-sidebar-border",children:[jsxRuntime.jsx(SidebarTrigger,{className:"lg:hidden",children:jsxRuntime.jsx(Menu$1,{className:"h-6 w-6"})}),jsxRuntime.jsx("div",{className:"flex flex-1 items-center gap-4",children:jsxRuntime.jsx("div",{className:"relative w-full max-w-sm",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("button",{type:"button",className:"absolute left-2 top-1/2 -translate-y-1/2",onClick:_,"aria-label":"Search",children:jsxRuntime.jsx(Search,{className:"h-4 w-4 text-muted-foreground"})}),jsxRuntime.jsx(Input,{placeholder:o??"Search...",className:"w-full pl-8 bg-white text-black",value:d,onChange:R=>f(R.target.value),onKeyDown:S,ref:l},"topbar-search")]})})}),n||jsxRuntime.jsx(jsxRuntime.Fragment,{}),t&&jsxRuntime.jsx("div",{className:"flex items-center gap-4",children:jsxRuntime.jsxs(Button,{variant:"ghost",size:"icon",className:"h-9 w-9",onClick:t,children:[jsxRuntime.jsx(LogOut,{className:"h-4 w-4 text-sidebar-foreground"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Sign out"})]})})]})});Topbar.displayName="Topbar";function ActiveOrdersCard({orders:t,loading:e=!1}){const n=React.useMemo(()=>{if(!t||t.length===0)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const l=t.filter(I=>I.DocumentType==="Order"),d=t.filter(I=>I.DocumentType==="Shipment"),f=l.filter(I=>I.WarehouseCode!=="3PLE"),g=f.reduce((I,j)=>I+(j.Quantity||0),0),b=f.reduce((I,j)=>I+(j.ExtendedPrice||0),0),_=l.filter(I=>I.WarehouseCode==="3PLE"),S=_.reduce((I,j)=>I+(j.Quantity||0),0),R=_.reduce((I,j)=>I+(j.ExtendedPrice||0),0),C=d.length,E=d.reduce((I,j)=>I+(j.ExtendedPrice||0),0),A=g+S+C,M=b+R+E;return{all:{orders:A,amount:M},processing:{orders:g,amount:b},shipped:{orders:C,amount:E},delayed:{orders:S,amount:R}}},[t]),o=[{name:"All",icon:Package,color:"bg-blue-500",textColor:"text-blue-600",orders:n.all.orders,amount:n.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",textColor:"text-yellow-600",orders:n.processing.orders,amount:n.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",textColor:"text-green-600",orders:n.shipped.orders,amount:n.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",textColor:"text-red-600",orders:n.delayed.orders,amount:n.delayed.amount}];return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:[1,2,3,4].map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:"bg-slate-200 dark:bg-slate-700 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]},l))})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:o.map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:l.name}),jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(l.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:l.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:formatMoney(l.amount)})]})]})]})]},l.name))})]})}var __create=Object.create,__getProtoOf=Object.getPrototypeOf,__defProp=Object.defineProperty,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__toESM=(t,e,n)=>{n=t!=null?__create(__getProtoOf(t)):{};const o=e||!t||!t.__esModule?__defProp(n,"default",{value:t,enumerable:!0}):n;for(let l of __getOwnPropNames(t))__hasOwnProp.call(o,l)||__defProp(o,l,{get:()=>t[l],enumerable:!0});return o},__commonJS=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),require_xhtml=__commonJS((t,e)=>{e.exports={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}}),require_acorn=__commonJS((t,e)=>{(function(n,o){typeof t=="object"&&typeof e<"u"?o(t):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.acorn={}))})(t,function(n){var o=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],l=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],d="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",f="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",g={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},b="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",_={5:b,"5module":b+" export import",6:b+" const class extends export import super"},S=/^in(stanceof)?$/,R=new RegExp("["+f+"]"),C=new RegExp("["+f+d+"]");function E(V,ae){for(var Be=65536,Fe=0;Fe<ae.length;Fe+=2){if(Be+=ae[Fe],Be>V)return!1;if(Be+=ae[Fe+1],Be>=V)return!0}return!1}function A(V,ae){return V<65?V===36:V<91?!0:V<97?V===95:V<123?!0:V<=65535?V>=170&&R.test(String.fromCharCode(V)):ae===!1?!1:E(V,l)}function M(V,ae){return V<48?V===36:V<58?!0:V<65?!1:V<91?!0:V<97?V===95:V<123?!0:V<=65535?V>=170&&C.test(String.fromCharCode(V)):ae===!1?!1:E(V,l)||E(V,o)}var I=function(ae,Be){Be===void 0&&(Be={}),this.label=ae,this.keyword=Be.keyword,this.beforeExpr=!!Be.beforeExpr,this.startsExpr=!!Be.startsExpr,this.isLoop=!!Be.isLoop,this.isAssign=!!Be.isAssign,this.prefix=!!Be.prefix,this.postfix=!!Be.postfix,this.binop=Be.binop||null,this.updateContext=null};function j(V,ae){return new I(V,{beforeExpr:!0,binop:ae})}var q={beforeExpr:!0},z={startsExpr:!0},Q={};function F(V,ae){return ae===void 0&&(ae={}),ae.keyword=V,Q[V]=new I(V,ae)}var O={num:new I("num",z),regexp:new I("regexp",z),string:new I("string",z),name:new I("name",z),privateId:new I("privateId",z),eof:new I("eof"),bracketL:new I("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new I("]"),braceL:new I("{",{beforeExpr:!0,startsExpr:!0}),braceR:new I("}"),parenL:new I("(",{beforeExpr:!0,startsExpr:!0}),parenR:new I(")"),comma:new I(",",q),semi:new I(";",q),colon:new I(":",q),dot:new I("."),question:new I("?",q),questionDot:new I("?."),arrow:new I("=>",q),template:new I("template"),invalidTemplate:new I("invalidTemplate"),ellipsis:new I("...",q),backQuote:new I("`",z),dollarBraceL:new I("${",{beforeExpr:!0,startsExpr:!0}),eq:new I("=",{beforeExpr:!0,isAssign:!0}),assign:new I("_=",{beforeExpr:!0,isAssign:!0}),incDec:new I("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new I("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:j("||",1),logicalAND:j("&&",2),bitwiseOR:j("|",3),bitwiseXOR:j("^",4),bitwiseAND:j("&",5),equality:j("==/!=/===/!==",6),relational:j("</>/<=/>=",7),bitShift:j("<</>>/>>>",8),plusMin:new I("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:j("%",10),star:j("*",10),slash:j("/",10),starstar:new I("**",{beforeExpr:!0}),coalesce:j("??",1),_break:F("break"),_case:F("case",q),_catch:F("catch"),_continue:F("continue"),_debugger:F("debugger"),_default:F("default",q),_do:F("do",{isLoop:!0,beforeExpr:!0}),_else:F("else",q),_finally:F("finally"),_for:F("for",{isLoop:!0}),_function:F("function",z),_if:F("if"),_return:F("return",q),_switch:F("switch"),_throw:F("throw",q),_try:F("try"),_var:F("var"),_const:F("const"),_while:F("while",{isLoop:!0}),_with:F("with"),_new:F("new",{beforeExpr:!0,startsExpr:!0}),_this:F("this",z),_super:F("super",z),_class:F("class",z),_extends:F("extends",q),_export:F("export"),_import:F("import",z),_null:F("null",z),_true:F("true",z),_false:F("false",z),_in:F("in",{beforeExpr:!0,binop:7}),_instanceof:F("instanceof",{beforeExpr:!0,binop:7}),_typeof:F("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:F("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:F("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},te=/\r\n?|\n|\u2028|\u2029/,ne=new RegExp(te.source,"g");function se(V){return V===10||V===13||V===8232||V===8233}function ge(V,ae,Be){Be===void 0&&(Be=V.length);for(var Fe=ae;Fe<Be;Fe++){var Ke=V.charCodeAt(Fe);if(se(Ke))return Fe<Be-1&&Ke===13&&V.charCodeAt(Fe+1)===10?Fe+2:Fe+1}return-1}var oe=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Ae=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,je=Object.prototype,Ne=je.hasOwnProperty,Ve=je.toString,Le=Object.hasOwn||function(V,ae){return Ne.call(V,ae)},ze=Array.isArray||function(V){return Ve.call(V)==="[object Array]"},$e=Object.create(null);function Oe(V){return $e[V]||($e[V]=new RegExp("^(?:"+V.replace(/ /g,"|")+")$"))}function qe(V){return V<=65535?String.fromCharCode(V):(V-=65536,String.fromCharCode((V>>10)+55296,(V&1023)+56320))}var Ge=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Ue=function(ae,Be){this.line=ae,this.column=Be};Ue.prototype.offset=function(ae){return new Ue(this.line,this.column+ae)};var Je=function(ae,Be,Fe){this.start=Be,this.end=Fe,ae.sourceFile!==null&&(this.source=ae.sourceFile)};function Ze(V,ae){for(var Be=1,Fe=0;;){var Ke=ge(V,Fe,ae);if(Ke<0)return new Ue(Be,ae-Fe);++Be,Fe=Ke}}var We={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},tt=!1;function Xe(V){var ae={};for(var Be in We)ae[Be]=V&&Le(V,Be)?V[Be]:We[Be];if(ae.ecmaVersion==="latest"?ae.ecmaVersion=1e8:ae.ecmaVersion==null?(!tt&&typeof console=="object"&&console.warn&&(tt=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
1192
1192
  Defaulting to 2020, but this will stop working in the future.`)),ae.ecmaVersion=11):ae.ecmaVersion>=2015&&(ae.ecmaVersion-=2009),ae.allowReserved==null&&(ae.allowReserved=ae.ecmaVersion<5),(!V||V.allowHashBang==null)&&(ae.allowHashBang=ae.ecmaVersion>=14),ze(ae.onToken)){var Fe=ae.onToken;ae.onToken=function(Ke){return Fe.push(Ke)}}return ze(ae.onComment)&&(ae.onComment=it(ae,ae.onComment)),ae}function it(V,ae){return function(Be,Fe,Ke,ut,dt,It){var Dt={type:Be?"Block":"Line",value:Fe,start:Ke,end:ut};V.locations&&(Dt.loc=new Je(this,dt,It)),V.ranges&&(Dt.range=[Ke,ut]),ae.push(Dt)}}var et=1,at=2,ot=4,He=8,mt=16,Qe=32,Rt=64,$t=128,Ft=256,Ht=et|at|Ft;function Mt(V,ae){return at|(V?ot:0)|(ae?He:0)}var Ye=0,rt=1,st=2,lt=3,ft=4,pt=5,yt=function(ae,Be,Fe){this.options=ae=Xe(ae),this.sourceFile=ae.sourceFile,this.keywords=Oe(_[ae.ecmaVersion>=6?6:ae.sourceType==="module"?"5module":5]);var Ke="";ae.allowReserved!==!0&&(Ke=g[ae.ecmaVersion>=6?6:ae.ecmaVersion===5?5:3],ae.sourceType==="module"&&(Ke+=" await")),this.reservedWords=Oe(Ke);var ut=(Ke?Ke+" ":"")+g.strict;this.reservedWordsStrict=Oe(ut),this.reservedWordsStrictBind=Oe(ut+" "+g.strictBind),this.input=String(Be),this.containsEsc=!1,Fe?(this.pos=Fe,this.lineStart=this.input.lastIndexOf(`
1193
1193
  `,Fe-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(te).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=O.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=ae.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&ae.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(et),this.regexpState=null,this.privateNameStack=[]},zt={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};yt.prototype.parse=function(){var ae=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(ae)},zt.inFunction.get=function(){return(this.currentVarScope().flags&at)>0},zt.inGenerator.get=function(){return(this.currentVarScope().flags&He)>0&&!this.currentVarScope().inClassFieldInit},zt.inAsync.get=function(){return(this.currentVarScope().flags&ot)>0&&!this.currentVarScope().inClassFieldInit},zt.canAwait.get=function(){for(var V=this.scopeStack.length-1;V>=0;V--){var ae=this.scopeStack[V];if(ae.inClassFieldInit||ae.flags&Ft)return!1;if(ae.flags&at)return(ae.flags&ot)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},zt.allowSuper.get=function(){var V=this.currentThisScope(),ae=V.flags,Be=V.inClassFieldInit;return(ae&Rt)>0||Be||this.options.allowSuperOutsideMethod},zt.allowDirectSuper.get=function(){return(this.currentThisScope().flags&$t)>0},zt.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},zt.allowNewDotTarget.get=function(){var V=this.currentThisScope(),ae=V.flags,Be=V.inClassFieldInit;return(ae&(at|Ft))>0||Be},zt.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Ft)>0},yt.extend=function(){for(var ae=[],Be=arguments.length;Be--;)ae[Be]=arguments[Be];for(var Fe=this,Ke=0;Ke<ae.length;Ke++)Fe=ae[Ke](Fe);return Fe},yt.parse=function(ae,Be){return new this(Be,ae).parse()},yt.parseExpressionAt=function(ae,Be,Fe){var Ke=new this(Fe,ae,Be);return Ke.nextToken(),Ke.parseExpression()},yt.tokenizer=function(ae,Be){return new this(Be,ae)},Object.defineProperties(yt.prototype,zt);var Yt=yt.prototype,dn=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Yt.strictDirective=function(V){if(this.options.ecmaVersion<5)return!1;for(;;){Ae.lastIndex=V,V+=Ae.exec(this.input)[0].length;var ae=dn.exec(this.input.slice(V));if(!ae)return!1;if((ae[1]||ae[2])==="use strict"){Ae.lastIndex=V+ae[0].length;var Be=Ae.exec(this.input),Fe=Be.index+Be[0].length,Ke=this.input.charAt(Fe);return Ke===";"||Ke==="}"||te.test(Be[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(Ke)||Ke==="!"&&this.input.charAt(Fe+1)==="=")}V+=ae[0].length,Ae.lastIndex=V,V+=Ae.exec(this.input)[0].length,this.input[V]===";"&&V++}},Yt.eat=function(V){return this.type===V?(this.next(),!0):!1},Yt.isContextual=function(V){return this.type===O.name&&this.value===V&&!this.containsEsc},Yt.eatContextual=function(V){return this.isContextual(V)?(this.next(),!0):!1},Yt.expectContextual=function(V){this.eatContextual(V)||this.unexpected()},Yt.canInsertSemicolon=function(){return this.type===O.eof||this.type===O.braceR||te.test(this.input.slice(this.lastTokEnd,this.start))},Yt.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Yt.semicolon=function(){!this.eat(O.semi)&&!this.insertSemicolon()&&this.unexpected()},Yt.afterTrailingComma=function(V,ae){if(this.type===V)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),ae||this.next(),!0},Yt.expect=function(V){this.eat(V)||this.unexpected()},Yt.unexpected=function(V){this.raise(V??this.start,"Unexpected token")};var gn=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Yt.checkPatternErrors=function(V,ae){if(V){V.trailingComma>-1&&this.raiseRecoverable(V.trailingComma,"Comma is not permitted after the rest element");var Be=ae?V.parenthesizedAssign:V.parenthesizedBind;Be>-1&&this.raiseRecoverable(Be,ae?"Assigning to rvalue":"Parenthesized pattern")}},Yt.checkExpressionErrors=function(V,ae){if(!V)return!1;var Be=V.shorthandAssign,Fe=V.doubleProto;if(!ae)return Be>=0||Fe>=0;Be>=0&&this.raise(Be,"Shorthand property assignments are valid only in destructuring patterns"),Fe>=0&&this.raiseRecoverable(Fe,"Redefinition of __proto__ property")},Yt.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},Yt.isSimpleAssignTarget=function(V){return V.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(V.expression):V.type==="Identifier"||V.type==="MemberExpression"};var qt=yt.prototype;qt.parseTopLevel=function(V){var ae=Object.create(null);for(V.body||(V.body=[]);this.type!==O.eof;){var Be=this.parseStatement(null,!0,ae);V.body.push(Be)}if(this.inModule)for(var Fe=0,Ke=Object.keys(this.undefinedExports);Fe<Ke.length;Fe+=1){var ut=Ke[Fe];this.raiseRecoverable(this.undefinedExports[ut].start,"Export '"+ut+"' is not defined")}return this.adaptDirectivePrologue(V.body),this.next(),V.sourceType=this.options.sourceType,this.finishNode(V,"Program")};var wn={kind:"loop"},_n={kind:"switch"};qt.isLet=function(V){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;Ae.lastIndex=this.pos;var ae=Ae.exec(this.input),Be=this.pos+ae[0].length,Fe=this.input.charCodeAt(Be);if(Fe===91||Fe===92)return!0;if(V)return!1;if(Fe===123||Fe>55295&&Fe<56320)return!0;if(A(Fe,!0)){for(var Ke=Be+1;M(Fe=this.input.charCodeAt(Ke),!0);)++Ke;if(Fe===92||Fe>55295&&Fe<56320)return!0;var ut=this.input.slice(Be,Ke);if(!S.test(ut))return!0}return!1},qt.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;Ae.lastIndex=this.pos;var V=Ae.exec(this.input),ae=this.pos+V[0].length,Be;return!te.test(this.input.slice(this.pos,ae))&&this.input.slice(ae,ae+8)==="function"&&(ae+8===this.input.length||!(M(Be=this.input.charCodeAt(ae+8))||Be>55295&&Be<56320))},qt.parseStatement=function(V,ae,Be){var Fe=this.type,Ke=this.startNode(),ut;switch(this.isLet(V)&&(Fe=O._var,ut="let"),Fe){case O._break:case O._continue:return this.parseBreakContinueStatement(Ke,Fe.keyword);case O._debugger:return this.parseDebuggerStatement(Ke);case O._do:return this.parseDoStatement(Ke);case O._for:return this.parseForStatement(Ke);case O._function:return V&&(this.strict||V!=="if"&&V!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(Ke,!1,!V);case O._class:return V&&this.unexpected(),this.parseClass(Ke,!0);case O._if:return this.parseIfStatement(Ke);case O._return:return this.parseReturnStatement(Ke);case O._switch:return this.parseSwitchStatement(Ke);case O._throw:return this.parseThrowStatement(Ke);case O._try:return this.parseTryStatement(Ke);case O._const:case O._var:return ut=ut||this.value,V&&ut!=="var"&&this.unexpected(),this.parseVarStatement(Ke,ut);case O._while:return this.parseWhileStatement(Ke);case O._with:return this.parseWithStatement(Ke);case O.braceL:return this.parseBlock(!0,Ke);case O.semi:return this.parseEmptyStatement(Ke);case O._export:case O._import:if(this.options.ecmaVersion>10&&Fe===O._import){Ae.lastIndex=this.pos;var dt=Ae.exec(this.input),It=this.pos+dt[0].length,Dt=this.input.charCodeAt(It);if(Dt===40||Dt===46)return this.parseExpressionStatement(Ke,this.parseExpression())}return this.options.allowImportExportEverywhere||(ae||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),Fe===O._import?this.parseImport(Ke):this.parseExport(Ke,Be);default:if(this.isAsyncFunction())return V&&this.unexpected(),this.next(),this.parseFunctionStatement(Ke,!0,!V);var en=this.value,Qt=this.parseExpression();return Fe===O.name&&Qt.type==="Identifier"&&this.eat(O.colon)?this.parseLabeledStatement(Ke,en,Qt,V):this.parseExpressionStatement(Ke,Qt)}},qt.parseBreakContinueStatement=function(V,ae){var Be=ae==="break";this.next(),this.eat(O.semi)||this.insertSemicolon()?V.label=null:this.type!==O.name?this.unexpected():(V.label=this.parseIdent(),this.semicolon());for(var Fe=0;Fe<this.labels.length;++Fe){var Ke=this.labels[Fe];if((V.label==null||Ke.name===V.label.name)&&(Ke.kind!=null&&(Be||Ke.kind==="loop")||V.label&&Be))break}return Fe===this.labels.length&&this.raise(V.start,"Unsyntactic "+ae),this.finishNode(V,Be?"BreakStatement":"ContinueStatement")},qt.parseDebuggerStatement=function(V){return this.next(),this.semicolon(),this.finishNode(V,"DebuggerStatement")},qt.parseDoStatement=function(V){return this.next(),this.labels.push(wn),V.body=this.parseStatement("do"),this.labels.pop(),this.expect(O._while),V.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(O.semi):this.semicolon(),this.finishNode(V,"DoWhileStatement")},qt.parseForStatement=function(V){this.next();var ae=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(wn),this.enterScope(0),this.expect(O.parenL),this.type===O.semi)return ae>-1&&this.unexpected(ae),this.parseFor(V,null);var Be=this.isLet();if(this.type===O._var||this.type===O._const||Be){var Fe=this.startNode(),Ke=Be?"let":this.value;return this.next(),this.parseVar(Fe,!0,Ke),this.finishNode(Fe,"VariableDeclaration"),(this.type===O._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&Fe.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===O._in?ae>-1&&this.unexpected(ae):V.await=ae>-1),this.parseForIn(V,Fe)):(ae>-1&&this.unexpected(ae),this.parseFor(V,Fe))}var ut=this.isContextual("let"),dt=!1,It=this.containsEsc,Dt=new gn,en=this.start,Qt=ae>-1?this.parseExprSubscripts(Dt,"await"):this.parseExpression(!0,Dt);return this.type===O._in||(dt=this.options.ecmaVersion>=6&&this.isContextual("of"))?(ae>-1?(this.type===O._in&&this.unexpected(ae),V.await=!0):dt&&this.options.ecmaVersion>=8&&(Qt.start===en&&!It&&Qt.type==="Identifier"&&Qt.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(V.await=!1)),ut&&dt&&this.raise(Qt.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(Qt,!1,Dt),this.checkLValPattern(Qt),this.parseForIn(V,Qt)):(this.checkExpressionErrors(Dt,!0),ae>-1&&this.unexpected(ae),this.parseFor(V,Qt))},qt.parseFunctionStatement=function(V,ae,Be){return this.next(),this.parseFunction(V,Rn|(Be?0:En),!1,ae)},qt.parseIfStatement=function(V){return this.next(),V.test=this.parseParenExpression(),V.consequent=this.parseStatement("if"),V.alternate=this.eat(O._else)?this.parseStatement("if"):null,this.finishNode(V,"IfStatement")},qt.parseReturnStatement=function(V){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(O.semi)||this.insertSemicolon()?V.argument=null:(V.argument=this.parseExpression(),this.semicolon()),this.finishNode(V,"ReturnStatement")},qt.parseSwitchStatement=function(V){this.next(),V.discriminant=this.parseParenExpression(),V.cases=[],this.expect(O.braceL),this.labels.push(_n),this.enterScope(0);for(var ae,Be=!1;this.type!==O.braceR;)if(this.type===O._case||this.type===O._default){var Fe=this.type===O._case;ae&&this.finishNode(ae,"SwitchCase"),V.cases.push(ae=this.startNode()),ae.consequent=[],this.next(),Fe?ae.test=this.parseExpression():(Be&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),Be=!0,ae.test=null),this.expect(O.colon)}else ae||this.unexpected(),ae.consequent.push(this.parseStatement(null));return this.exitScope(),ae&&this.finishNode(ae,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(V,"SwitchStatement")},qt.parseThrowStatement=function(V){return this.next(),te.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),V.argument=this.parseExpression(),this.semicolon(),this.finishNode(V,"ThrowStatement")};var xn=[];qt.parseCatchClauseParam=function(){var V=this.parseBindingAtom(),ae=V.type==="Identifier";return this.enterScope(ae?Qe:0),this.checkLValPattern(V,ae?ft:st),this.expect(O.parenR),V},qt.parseTryStatement=function(V){if(this.next(),V.block=this.parseBlock(),V.handler=null,this.type===O._catch){var ae=this.startNode();this.next(),this.eat(O.parenL)?ae.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),ae.param=null,this.enterScope(0)),ae.body=this.parseBlock(!1),this.exitScope(),V.handler=this.finishNode(ae,"CatchClause")}return V.finalizer=this.eat(O._finally)?this.parseBlock():null,!V.handler&&!V.finalizer&&this.raise(V.start,"Missing catch or finally clause"),this.finishNode(V,"TryStatement")},qt.parseVarStatement=function(V,ae,Be){return this.next(),this.parseVar(V,!1,ae,Be),this.semicolon(),this.finishNode(V,"VariableDeclaration")},qt.parseWhileStatement=function(V){return this.next(),V.test=this.parseParenExpression(),this.labels.push(wn),V.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(V,"WhileStatement")},qt.parseWithStatement=function(V){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),V.object=this.parseParenExpression(),V.body=this.parseStatement("with"),this.finishNode(V,"WithStatement")},qt.parseEmptyStatement=function(V){return this.next(),this.finishNode(V,"EmptyStatement")},qt.parseLabeledStatement=function(V,ae,Be,Fe){for(var Ke=0,ut=this.labels;Ke<ut.length;Ke+=1){var dt=ut[Ke];dt.name===ae&&this.raise(Be.start,"Label '"+ae+"' is already declared")}for(var It=this.type.isLoop?"loop":this.type===O._switch?"switch":null,Dt=this.labels.length-1;Dt>=0;Dt--){var en=this.labels[Dt];if(en.statementStart===V.start)en.statementStart=this.start,en.kind=It;else break}return this.labels.push({name:ae,kind:It,statementStart:this.start}),V.body=this.parseStatement(Fe?Fe.indexOf("label")===-1?Fe+"label":Fe:"label"),this.labels.pop(),V.label=Be,this.finishNode(V,"LabeledStatement")},qt.parseExpressionStatement=function(V,ae){return V.expression=ae,this.semicolon(),this.finishNode(V,"ExpressionStatement")},qt.parseBlock=function(V,ae,Be){for(V===void 0&&(V=!0),ae===void 0&&(ae=this.startNode()),ae.body=[],this.expect(O.braceL),V&&this.enterScope(0);this.type!==O.braceR;){var Fe=this.parseStatement(null);ae.body.push(Fe)}return Be&&(this.strict=!1),this.next(),V&&this.exitScope(),this.finishNode(ae,"BlockStatement")},qt.parseFor=function(V,ae){return V.init=ae,this.expect(O.semi),V.test=this.type===O.semi?null:this.parseExpression(),this.expect(O.semi),V.update=this.type===O.parenR?null:this.parseExpression(),this.expect(O.parenR),V.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(V,"ForStatement")},qt.parseForIn=function(V,ae){var Be=this.type===O._in;return this.next(),ae.type==="VariableDeclaration"&&ae.declarations[0].init!=null&&(!Be||this.options.ecmaVersion<8||this.strict||ae.kind!=="var"||ae.declarations[0].id.type!=="Identifier")&&this.raise(ae.start,(Be?"for-in":"for-of")+" loop variable declaration may not have an initializer"),V.left=ae,V.right=Be?this.parseExpression():this.parseMaybeAssign(),this.expect(O.parenR),V.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(V,Be?"ForInStatement":"ForOfStatement")},qt.parseVar=function(V,ae,Be,Fe){for(V.declarations=[],V.kind=Be;;){var Ke=this.startNode();if(this.parseVarId(Ke,Be),this.eat(O.eq)?Ke.init=this.parseMaybeAssign(ae):!Fe&&Be==="const"&&!(this.type===O._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!Fe&&Ke.id.type!=="Identifier"&&!(ae&&(this.type===O._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):Ke.init=null,V.declarations.push(this.finishNode(Ke,"VariableDeclarator")),!this.eat(O.comma))break}return V},qt.parseVarId=function(V,ae){V.id=this.parseBindingAtom(),this.checkLValPattern(V.id,ae==="var"?rt:st,!1)};var Rn=1,En=2,Ln=4;qt.parseFunction=function(V,ae,Be,Fe,Ke){this.initFunction(V),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Fe)&&(this.type===O.star&&ae&En&&this.unexpected(),V.generator=this.eat(O.star)),this.options.ecmaVersion>=8&&(V.async=!!Fe),ae&Rn&&(V.id=ae&Ln&&this.type!==O.name?null:this.parseIdent(),V.id&&!(ae&En)&&this.checkLValSimple(V.id,this.strict||V.generator||V.async?this.treatFunctionsAsVar?rt:st:lt));var ut=this.yieldPos,dt=this.awaitPos,It=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Mt(V.async,V.generator)),ae&Rn||(V.id=this.type===O.name?this.parseIdent():null),this.parseFunctionParams(V),this.parseFunctionBody(V,Be,!1,Ke),this.yieldPos=ut,this.awaitPos=dt,this.awaitIdentPos=It,this.finishNode(V,ae&Rn?"FunctionDeclaration":"FunctionExpression")},qt.parseFunctionParams=function(V){this.expect(O.parenL),V.params=this.parseBindingList(O.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},qt.parseClass=function(V,ae){this.next();var Be=this.strict;this.strict=!0,this.parseClassId(V,ae),this.parseClassSuper(V);var Fe=this.enterClassBody(),Ke=this.startNode(),ut=!1;for(Ke.body=[],this.expect(O.braceL);this.type!==O.braceR;){var dt=this.parseClassElement(V.superClass!==null);dt&&(Ke.body.push(dt),dt.type==="MethodDefinition"&&dt.kind==="constructor"?(ut&&this.raiseRecoverable(dt.start,"Duplicate constructor in the same class"),ut=!0):dt.key&&dt.key.type==="PrivateIdentifier"&&Xt(Fe,dt)&&this.raiseRecoverable(dt.key.start,"Identifier '#"+dt.key.name+"' has already been declared"))}return this.strict=Be,this.next(),V.body=this.finishNode(Ke,"ClassBody"),this.exitClassBody(),this.finishNode(V,ae?"ClassDeclaration":"ClassExpression")},qt.parseClassElement=function(V){if(this.eat(O.semi))return null;var ae=this.options.ecmaVersion,Be=this.startNode(),Fe="",Ke=!1,ut=!1,dt="method",It=!1;if(this.eatContextual("static")){if(ae>=13&&this.eat(O.braceL))return this.parseClassStaticBlock(Be),Be;this.isClassElementNameStart()||this.type===O.star?It=!0:Fe="static"}if(Be.static=It,!Fe&&ae>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===O.star)&&!this.canInsertSemicolon()?ut=!0:Fe="async"),!Fe&&(ae>=9||!ut)&&this.eat(O.star)&&(Ke=!0),!Fe&&!ut&&!Ke){var Dt=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?dt=Dt:Fe=Dt)}if(Fe?(Be.computed=!1,Be.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Be.key.name=Fe,this.finishNode(Be.key,"Identifier")):this.parseClassElementName(Be),ae<13||this.type===O.parenL||dt!=="method"||Ke||ut){var en=!Be.static&&kn(Be,"constructor"),Qt=en&&V;en&&dt!=="method"&&this.raise(Be.key.start,"Constructor can't have get/set modifier"),Be.kind=en?"constructor":dt,this.parseClassMethod(Be,Ke,ut,Qt)}else this.parseClassField(Be);return Be},qt.isClassElementNameStart=function(){return this.type===O.name||this.type===O.privateId||this.type===O.num||this.type===O.string||this.type===O.bracketL||this.type.keyword},qt.parseClassElementName=function(V){this.type===O.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),V.computed=!1,V.key=this.parsePrivateIdent()):this.parsePropertyName(V)},qt.parseClassMethod=function(V,ae,Be,Fe){var Ke=V.key;V.kind==="constructor"?(ae&&this.raise(Ke.start,"Constructor can't be a generator"),Be&&this.raise(Ke.start,"Constructor can't be an async method")):V.static&&kn(V,"prototype")&&this.raise(Ke.start,"Classes may not have a static property named prototype");var ut=V.value=this.parseMethod(ae,Be,Fe);return V.kind==="get"&&ut.params.length!==0&&this.raiseRecoverable(ut.start,"getter should have no params"),V.kind==="set"&&ut.params.length!==1&&this.raiseRecoverable(ut.start,"setter should have exactly one param"),V.kind==="set"&&ut.params[0].type==="RestElement"&&this.raiseRecoverable(ut.params[0].start,"Setter cannot use rest params"),this.finishNode(V,"MethodDefinition")},qt.parseClassField=function(V){if(kn(V,"constructor")?this.raise(V.key.start,"Classes can't have a field named 'constructor'"):V.static&&kn(V,"prototype")&&this.raise(V.key.start,"Classes can't have a static field named 'prototype'"),this.eat(O.eq)){var ae=this.currentThisScope(),Be=ae.inClassFieldInit;ae.inClassFieldInit=!0,V.value=this.parseMaybeAssign(),ae.inClassFieldInit=Be}else V.value=null;return this.semicolon(),this.finishNode(V,"PropertyDefinition")},qt.parseClassStaticBlock=function(V){V.body=[];var ae=this.labels;for(this.labels=[],this.enterScope(Ft|Rt);this.type!==O.braceR;){var Be=this.parseStatement(null);V.body.push(Be)}return this.next(),this.exitScope(),this.labels=ae,this.finishNode(V,"StaticBlock")},qt.parseClassId=function(V,ae){this.type===O.name?(V.id=this.parseIdent(),ae&&this.checkLValSimple(V.id,st,!1)):(ae===!0&&this.unexpected(),V.id=null)},qt.parseClassSuper=function(V){V.superClass=this.eat(O._extends)?this.parseExprSubscripts(null,!1):null},qt.enterClassBody=function(){var V={declared:Object.create(null),used:[]};return this.privateNameStack.push(V),V.declared},qt.exitClassBody=function(){var V=this.privateNameStack.pop(),ae=V.declared,Be=V.used;if(this.options.checkPrivateFields)for(var Fe=this.privateNameStack.length,Ke=Fe===0?null:this.privateNameStack[Fe-1],ut=0;ut<Be.length;++ut){var dt=Be[ut];Le(ae,dt.name)||(Ke?Ke.used.push(dt):this.raiseRecoverable(dt.start,"Private field '#"+dt.name+"' must be declared in an enclosing class"))}};function Xt(V,ae){var Be=ae.key.name,Fe=V[Be],Ke="true";return ae.type==="MethodDefinition"&&(ae.kind==="get"||ae.kind==="set")&&(Ke=(ae.static?"s":"i")+ae.kind),Fe==="iget"&&Ke==="iset"||Fe==="iset"&&Ke==="iget"||Fe==="sget"&&Ke==="sset"||Fe==="sset"&&Ke==="sget"?(V[Be]="true",!1):Fe?!0:(V[Be]=Ke,!1)}function kn(V,ae){var Be=V.computed,Fe=V.key;return!Be&&(Fe.type==="Identifier"&&Fe.name===ae||Fe.type==="Literal"&&Fe.value===ae)}qt.parseExportAllDeclaration=function(V,ae){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(V.exported=this.parseModuleExportName(),this.checkExport(ae,V.exported,this.lastTokStart)):V.exported=null),this.expectContextual("from"),this.type!==O.string&&this.unexpected(),V.source=this.parseExprAtom(),this.semicolon(),this.finishNode(V,"ExportAllDeclaration")},qt.parseExport=function(V,ae){if(this.next(),this.eat(O.star))return this.parseExportAllDeclaration(V,ae);if(this.eat(O._default))return this.checkExport(ae,"default",this.lastTokStart),V.declaration=this.parseExportDefaultDeclaration(),this.finishNode(V,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())V.declaration=this.parseExportDeclaration(V),V.declaration.type==="VariableDeclaration"?this.checkVariableExport(ae,V.declaration.declarations):this.checkExport(ae,V.declaration.id,V.declaration.id.start),V.specifiers=[],V.source=null;else{if(V.declaration=null,V.specifiers=this.parseExportSpecifiers(ae),this.eatContextual("from"))this.type!==O.string&&this.unexpected(),V.source=this.parseExprAtom();else{for(var Be=0,Fe=V.specifiers;Be<Fe.length;Be+=1){var Ke=Fe[Be];this.checkUnreserved(Ke.local),this.checkLocalExport(Ke.local),Ke.local.type==="Literal"&&this.raise(Ke.local.start,"A string literal cannot be used as an exported binding without `from`.")}V.source=null}this.semicolon()}return this.finishNode(V,"ExportNamedDeclaration")},qt.parseExportDeclaration=function(V){return this.parseStatement(null)},qt.parseExportDefaultDeclaration=function(){var V;if(this.type===O._function||(V=this.isAsyncFunction())){var ae=this.startNode();return this.next(),V&&this.next(),this.parseFunction(ae,Rn|Ln,!1,V)}else if(this.type===O._class){var Be=this.startNode();return this.parseClass(Be,"nullableID")}else{var Fe=this.parseMaybeAssign();return this.semicolon(),Fe}},qt.checkExport=function(V,ae,Be){V&&(typeof ae!="string"&&(ae=ae.type==="Identifier"?ae.name:ae.value),Le(V,ae)&&this.raiseRecoverable(Be,"Duplicate export '"+ae+"'"),V[ae]=!0)},qt.checkPatternExport=function(V,ae){var Be=ae.type;if(Be==="Identifier")this.checkExport(V,ae,ae.start);else if(Be==="ObjectPattern")for(var Fe=0,Ke=ae.properties;Fe<Ke.length;Fe+=1){var ut=Ke[Fe];this.checkPatternExport(V,ut)}else if(Be==="ArrayPattern")for(var dt=0,It=ae.elements;dt<It.length;dt+=1){var Dt=It[dt];Dt&&this.checkPatternExport(V,Dt)}else Be==="Property"?this.checkPatternExport(V,ae.value):Be==="AssignmentPattern"?this.checkPatternExport(V,ae.left):Be==="RestElement"&&this.checkPatternExport(V,ae.argument)},qt.checkVariableExport=function(V,ae){if(V)for(var Be=0,Fe=ae;Be<Fe.length;Be+=1){var Ke=Fe[Be];this.checkPatternExport(V,Ke.id)}},qt.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},qt.parseExportSpecifier=function(V){var ae=this.startNode();return ae.local=this.parseModuleExportName(),ae.exported=this.eatContextual("as")?this.parseModuleExportName():ae.local,this.checkExport(V,ae.exported,ae.exported.start),this.finishNode(ae,"ExportSpecifier")},qt.parseExportSpecifiers=function(V){var ae=[],Be=!0;for(this.expect(O.braceL);!this.eat(O.braceR);){if(Be)Be=!1;else if(this.expect(O.comma),this.afterTrailingComma(O.braceR))break;ae.push(this.parseExportSpecifier(V))}return ae},qt.parseImport=function(V){return this.next(),this.type===O.string?(V.specifiers=xn,V.source=this.parseExprAtom()):(V.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),V.source=this.type===O.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(V,"ImportDeclaration")},qt.parseImportSpecifier=function(){var V=this.startNode();return V.imported=this.parseModuleExportName(),this.eatContextual("as")?V.local=this.parseIdent():(this.checkUnreserved(V.imported),V.local=V.imported),this.checkLValSimple(V.local,st),this.finishNode(V,"ImportSpecifier")},qt.parseImportDefaultSpecifier=function(){var V=this.startNode();return V.local=this.parseIdent(),this.checkLValSimple(V.local,st),this.finishNode(V,"ImportDefaultSpecifier")},qt.parseImportNamespaceSpecifier=function(){var V=this.startNode();return this.next(),this.expectContextual("as"),V.local=this.parseIdent(),this.checkLValSimple(V.local,st),this.finishNode(V,"ImportNamespaceSpecifier")},qt.parseImportSpecifiers=function(){var V=[],ae=!0;if(this.type===O.name&&(V.push(this.parseImportDefaultSpecifier()),!this.eat(O.comma)))return V;if(this.type===O.star)return V.push(this.parseImportNamespaceSpecifier()),V;for(this.expect(O.braceL);!this.eat(O.braceR);){if(ae)ae=!1;else if(this.expect(O.comma),this.afterTrailingComma(O.braceR))break;V.push(this.parseImportSpecifier())}return V},qt.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===O.string){var V=this.parseLiteral(this.value);return Ge.test(V.value)&&this.raise(V.start,"An export name cannot include a lone surrogate."),V}return this.parseIdent(!0)},qt.adaptDirectivePrologue=function(V){for(var ae=0;ae<V.length&&this.isDirectiveCandidate(V[ae]);++ae)V[ae].directive=V[ae].expression.raw.slice(1,-1)},qt.isDirectiveCandidate=function(V){return this.options.ecmaVersion>=5&&V.type==="ExpressionStatement"&&V.expression.type==="Literal"&&typeof V.expression.value=="string"&&(this.input[V.start]==='"'||this.input[V.start]==="'")};var bn=yt.prototype;bn.toAssignable=function(V,ae,Be){if(this.options.ecmaVersion>=6&&V)switch(V.type){case"Identifier":this.inAsync&&V.name==="await"&&this.raise(V.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":V.type="ObjectPattern",Be&&this.checkPatternErrors(Be,!0);for(var Fe=0,Ke=V.properties;Fe<Ke.length;Fe+=1){var ut=Ke[Fe];this.toAssignable(ut,ae),ut.type==="RestElement"&&(ut.argument.type==="ArrayPattern"||ut.argument.type==="ObjectPattern")&&this.raise(ut.argument.start,"Unexpected token")}break;case"Property":V.kind!=="init"&&this.raise(V.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(V.value,ae);break;case"ArrayExpression":V.type="ArrayPattern",Be&&this.checkPatternErrors(Be,!0),this.toAssignableList(V.elements,ae);break;case"SpreadElement":V.type="RestElement",this.toAssignable(V.argument,ae),V.argument.type==="AssignmentPattern"&&this.raise(V.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":V.operator!=="="&&this.raise(V.left.end,"Only '=' operator can be used for specifying default value."),V.type="AssignmentPattern",delete V.operator,this.toAssignable(V.left,ae);break;case"ParenthesizedExpression":this.toAssignable(V.expression,ae,Be);break;case"ChainExpression":this.raiseRecoverable(V.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!ae)break;default:this.raise(V.start,"Assigning to rvalue")}else Be&&this.checkPatternErrors(Be,!0);return V},bn.toAssignableList=function(V,ae){for(var Be=V.length,Fe=0;Fe<Be;Fe++){var Ke=V[Fe];Ke&&this.toAssignable(Ke,ae)}if(Be){var ut=V[Be-1];this.options.ecmaVersion===6&&ae&&ut&&ut.type==="RestElement"&&ut.argument.type!=="Identifier"&&this.unexpected(ut.argument.start)}return V},bn.parseSpread=function(V){var ae=this.startNode();return this.next(),ae.argument=this.parseMaybeAssign(!1,V),this.finishNode(ae,"SpreadElement")},bn.parseRestBinding=function(){var V=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==O.name&&this.unexpected(),V.argument=this.parseBindingAtom(),this.finishNode(V,"RestElement")},bn.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case O.bracketL:var V=this.startNode();return this.next(),V.elements=this.parseBindingList(O.bracketR,!0,!0),this.finishNode(V,"ArrayPattern");case O.braceL:return this.parseObj(!0)}return this.parseIdent()},bn.parseBindingList=function(V,ae,Be,Fe){for(var Ke=[],ut=!0;!this.eat(V);)if(ut?ut=!1:this.expect(O.comma),ae&&this.type===O.comma)Ke.push(null);else{if(Be&&this.afterTrailingComma(V))break;if(this.type===O.ellipsis){var dt=this.parseRestBinding();this.parseBindingListItem(dt),Ke.push(dt),this.type===O.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(V);break}else Ke.push(this.parseAssignableListItem(Fe))}return Ke},bn.parseAssignableListItem=function(V){var ae=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(ae),ae},bn.parseBindingListItem=function(V){return V},bn.parseMaybeDefault=function(V,ae,Be){if(Be=Be||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(O.eq))return Be;var Fe=this.startNodeAt(V,ae);return Fe.left=Be,Fe.right=this.parseMaybeAssign(),this.finishNode(Fe,"AssignmentPattern")},bn.checkLValSimple=function(V,ae,Be){ae===void 0&&(ae=Ye);var Fe=ae!==Ye;switch(V.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(V.name)&&this.raiseRecoverable(V.start,(Fe?"Binding ":"Assigning to ")+V.name+" in strict mode"),Fe&&(ae===st&&V.name==="let"&&this.raiseRecoverable(V.start,"let is disallowed as a lexically bound name"),Be&&(Le(Be,V.name)&&this.raiseRecoverable(V.start,"Argument name clash"),Be[V.name]=!0),ae!==pt&&this.declareName(V.name,ae,V.start));break;case"ChainExpression":this.raiseRecoverable(V.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":Fe&&this.raiseRecoverable(V.start,"Binding member expression");break;case"ParenthesizedExpression":return Fe&&this.raiseRecoverable(V.start,"Binding parenthesized expression"),this.checkLValSimple(V.expression,ae,Be);default:this.raise(V.start,(Fe?"Binding":"Assigning to")+" rvalue")}},bn.checkLValPattern=function(V,ae,Be){switch(ae===void 0&&(ae=Ye),V.type){case"ObjectPattern":for(var Fe=0,Ke=V.properties;Fe<Ke.length;Fe+=1){var ut=Ke[Fe];this.checkLValInnerPattern(ut,ae,Be)}break;case"ArrayPattern":for(var dt=0,It=V.elements;dt<It.length;dt+=1){var Dt=It[dt];Dt&&this.checkLValInnerPattern(Dt,ae,Be)}break;default:this.checkLValSimple(V,ae,Be)}},bn.checkLValInnerPattern=function(V,ae,Be){switch(ae===void 0&&(ae=Ye),V.type){case"Property":this.checkLValInnerPattern(V.value,ae,Be);break;case"AssignmentPattern":this.checkLValPattern(V.left,ae,Be);break;case"RestElement":this.checkLValPattern(V.argument,ae,Be);break;default:this.checkLValPattern(V,ae,Be)}};var Cn=function(ae,Be,Fe,Ke,ut){this.token=ae,this.isExpr=!!Be,this.preserveSpace=!!Fe,this.override=Ke,this.generator=!!ut},an={b_stat:new Cn("{",!1),b_expr:new Cn("{",!0),b_tmpl:new Cn("${",!1),p_stat:new Cn("(",!1),p_expr:new Cn("(",!0),q_tmpl:new Cn("`",!0,!0,function(V){return V.tryReadTemplateToken()}),f_stat:new Cn("function",!1),f_expr:new Cn("function",!0),f_expr_gen:new Cn("function",!0,!1,null,!0),f_gen:new Cn("function",!1,!1,null,!0)},Vn=yt.prototype;Vn.initialContext=function(){return[an.b_stat]},Vn.curContext=function(){return this.context[this.context.length-1]},Vn.braceIsBlock=function(V){var ae=this.curContext();return ae===an.f_expr||ae===an.f_stat?!0:V===O.colon&&(ae===an.b_stat||ae===an.b_expr)?!ae.isExpr:V===O._return||V===O.name&&this.exprAllowed?te.test(this.input.slice(this.lastTokEnd,this.start)):V===O._else||V===O.semi||V===O.eof||V===O.parenR||V===O.arrow?!0:V===O.braceL?ae===an.b_stat:V===O._var||V===O._const||V===O.name?!1:!this.exprAllowed},Vn.inGeneratorContext=function(){for(var V=this.context.length-1;V>=1;V--){var ae=this.context[V];if(ae.token==="function")return ae.generator}return!1},Vn.updateContext=function(V){var ae,Be=this.type;Be.keyword&&V===O.dot?this.exprAllowed=!1:(ae=Be.updateContext)?ae.call(this,V):this.exprAllowed=Be.beforeExpr},Vn.overrideContext=function(V){this.curContext()!==V&&(this.context[this.context.length-1]=V)},O.parenR.updateContext=O.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var V=this.context.pop();V===an.b_stat&&this.curContext().token==="function"&&(V=this.context.pop()),this.exprAllowed=!V.isExpr},O.braceL.updateContext=function(V){this.context.push(this.braceIsBlock(V)?an.b_stat:an.b_expr),this.exprAllowed=!0},O.dollarBraceL.updateContext=function(){this.context.push(an.b_tmpl),this.exprAllowed=!0},O.parenL.updateContext=function(V){var ae=V===O._if||V===O._for||V===O._with||V===O._while;this.context.push(ae?an.p_stat:an.p_expr),this.exprAllowed=!0},O.incDec.updateContext=function(){},O._function.updateContext=O._class.updateContext=function(V){V.beforeExpr&&V!==O._else&&!(V===O.semi&&this.curContext()!==an.p_stat)&&!(V===O._return&&te.test(this.input.slice(this.lastTokEnd,this.start)))&&!((V===O.colon||V===O.braceL)&&this.curContext()===an.b_stat)?this.context.push(an.f_expr):this.context.push(an.f_stat),this.exprAllowed=!1},O.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},O.backQuote.updateContext=function(){this.curContext()===an.q_tmpl?this.context.pop():this.context.push(an.q_tmpl),this.exprAllowed=!1},O.star.updateContext=function(V){if(V===O._function){var ae=this.context.length-1;this.context[ae]===an.f_expr?this.context[ae]=an.f_expr_gen:this.context[ae]=an.f_gen}this.exprAllowed=!0},O.name.updateContext=function(V){var ae=!1;this.options.ecmaVersion>=6&&V!==O.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(ae=!0),this.exprAllowed=ae};var ct=yt.prototype;ct.checkPropClash=function(V,ae,Be){if(!(this.options.ecmaVersion>=9&&V.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(V.computed||V.method||V.shorthand))){var Fe=V.key,Ke;switch(Fe.type){case"Identifier":Ke=Fe.name;break;case"Literal":Ke=String(Fe.value);break;default:return}var ut=V.kind;if(this.options.ecmaVersion>=6){Ke==="__proto__"&&ut==="init"&&(ae.proto&&(Be?Be.doubleProto<0&&(Be.doubleProto=Fe.start):this.raiseRecoverable(Fe.start,"Redefinition of __proto__ property")),ae.proto=!0);return}Ke="$"+Ke;var dt=ae[Ke];if(dt){var It;ut==="init"?It=this.strict&&dt.init||dt.get||dt.set:It=dt.init||dt[ut],It&&this.raiseRecoverable(Fe.start,"Redefinition of property")}else dt=ae[Ke]={init:!1,get:!1,set:!1};dt[ut]=!0}},ct.parseExpression=function(V,ae){var Be=this.start,Fe=this.startLoc,Ke=this.parseMaybeAssign(V,ae);if(this.type===O.comma){var ut=this.startNodeAt(Be,Fe);for(ut.expressions=[Ke];this.eat(O.comma);)ut.expressions.push(this.parseMaybeAssign(V,ae));return this.finishNode(ut,"SequenceExpression")}return Ke},ct.parseMaybeAssign=function(V,ae,Be){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(V);this.exprAllowed=!1}var Fe=!1,Ke=-1,ut=-1,dt=-1;ae?(Ke=ae.parenthesizedAssign,ut=ae.trailingComma,dt=ae.doubleProto,ae.parenthesizedAssign=ae.trailingComma=-1):(ae=new gn,Fe=!0);var It=this.start,Dt=this.startLoc;(this.type===O.parenL||this.type===O.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=V==="await");var en=this.parseMaybeConditional(V,ae);if(Be&&(en=Be.call(this,en,It,Dt)),this.type.isAssign){var Qt=this.startNodeAt(It,Dt);return Qt.operator=this.value,this.type===O.eq&&(en=this.toAssignable(en,!1,ae)),Fe||(ae.parenthesizedAssign=ae.trailingComma=ae.doubleProto=-1),ae.shorthandAssign>=en.start&&(ae.shorthandAssign=-1),this.type===O.eq?this.checkLValPattern(en):this.checkLValSimple(en),Qt.left=en,this.next(),Qt.right=this.parseMaybeAssign(V),dt>-1&&(ae.doubleProto=dt),this.finishNode(Qt,"AssignmentExpression")}else Fe&&this.checkExpressionErrors(ae,!0);return Ke>-1&&(ae.parenthesizedAssign=Ke),ut>-1&&(ae.trailingComma=ut),en},ct.parseMaybeConditional=function(V,ae){var Be=this.start,Fe=this.startLoc,Ke=this.parseExprOps(V,ae);if(this.checkExpressionErrors(ae))return Ke;if(this.eat(O.question)){var ut=this.startNodeAt(Be,Fe);return ut.test=Ke,ut.consequent=this.parseMaybeAssign(),this.expect(O.colon),ut.alternate=this.parseMaybeAssign(V),this.finishNode(ut,"ConditionalExpression")}return Ke},ct.parseExprOps=function(V,ae){var Be=this.start,Fe=this.startLoc,Ke=this.parseMaybeUnary(ae,!1,!1,V);return this.checkExpressionErrors(ae)||Ke.start===Be&&Ke.type==="ArrowFunctionExpression"?Ke:this.parseExprOp(Ke,Be,Fe,-1,V)},ct.parseExprOp=function(V,ae,Be,Fe,Ke){var ut=this.type.binop;if(ut!=null&&(!Ke||this.type!==O._in)&&ut>Fe){var dt=this.type===O.logicalOR||this.type===O.logicalAND,It=this.type===O.coalesce;It&&(ut=O.logicalAND.binop);var Dt=this.value;this.next();var en=this.start,Qt=this.startLoc,Sn=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,Ke),en,Qt,ut,Ke),zn=this.buildBinary(ae,Be,V,Sn,Dt,dt||It);return(dt&&this.type===O.coalesce||It&&(this.type===O.logicalOR||this.type===O.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(zn,ae,Be,Fe,Ke)}return V},ct.buildBinary=function(V,ae,Be,Fe,Ke,ut){Fe.type==="PrivateIdentifier"&&this.raise(Fe.start,"Private identifier can only be left side of binary expression");var dt=this.startNodeAt(V,ae);return dt.left=Be,dt.operator=Ke,dt.right=Fe,this.finishNode(dt,ut?"LogicalExpression":"BinaryExpression")},ct.parseMaybeUnary=function(V,ae,Be,Fe){var Ke=this.start,ut=this.startLoc,dt;if(this.isContextual("await")&&this.canAwait)dt=this.parseAwait(Fe),ae=!0;else if(this.type.prefix){var It=this.startNode(),Dt=this.type===O.incDec;It.operator=this.value,It.prefix=!0,this.next(),It.argument=this.parseMaybeUnary(null,!0,Dt,Fe),this.checkExpressionErrors(V,!0),Dt?this.checkLValSimple(It.argument):this.strict&&It.operator==="delete"&&Ut(It.argument)?this.raiseRecoverable(It.start,"Deleting local variable in strict mode"):It.operator==="delete"&&Jt(It.argument)?this.raiseRecoverable(It.start,"Private fields can not be deleted"):ae=!0,dt=this.finishNode(It,Dt?"UpdateExpression":"UnaryExpression")}else if(!ae&&this.type===O.privateId)(Fe||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),dt=this.parsePrivateIdent(),this.type!==O._in&&this.unexpected();else{if(dt=this.parseExprSubscripts(V,Fe),this.checkExpressionErrors(V))return dt;for(;this.type.postfix&&!this.canInsertSemicolon();){var en=this.startNodeAt(Ke,ut);en.operator=this.value,en.prefix=!1,en.argument=dt,this.checkLValSimple(dt),this.next(),dt=this.finishNode(en,"UpdateExpression")}}if(!Be&&this.eat(O.starstar))if(ae)this.unexpected(this.lastTokStart);else return this.buildBinary(Ke,ut,dt,this.parseMaybeUnary(null,!1,!1,Fe),"**",!1);else return dt};function Ut(V){return V.type==="Identifier"||V.type==="ParenthesizedExpression"&&Ut(V.expression)}function Jt(V){return V.type==="MemberExpression"&&V.property.type==="PrivateIdentifier"||V.type==="ChainExpression"&&Jt(V.expression)||V.type==="ParenthesizedExpression"&&Jt(V.expression)}ct.parseExprSubscripts=function(V,ae){var Be=this.start,Fe=this.startLoc,Ke=this.parseExprAtom(V,ae);if(Ke.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return Ke;var ut=this.parseSubscripts(Ke,Be,Fe,!1,ae);return V&&ut.type==="MemberExpression"&&(V.parenthesizedAssign>=ut.start&&(V.parenthesizedAssign=-1),V.parenthesizedBind>=ut.start&&(V.parenthesizedBind=-1),V.trailingComma>=ut.start&&(V.trailingComma=-1)),ut},ct.parseSubscripts=function(V,ae,Be,Fe,Ke){for(var ut=this.options.ecmaVersion>=8&&V.type==="Identifier"&&V.name==="async"&&this.lastTokEnd===V.end&&!this.canInsertSemicolon()&&V.end-V.start===5&&this.potentialArrowAt===V.start,dt=!1;;){var It=this.parseSubscript(V,ae,Be,Fe,ut,dt,Ke);if(It.optional&&(dt=!0),It===V||It.type==="ArrowFunctionExpression"){if(dt){var Dt=this.startNodeAt(ae,Be);Dt.expression=It,It=this.finishNode(Dt,"ChainExpression")}return It}V=It}},ct.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(O.arrow)},ct.parseSubscriptAsyncArrow=function(V,ae,Be,Fe){return this.parseArrowExpression(this.startNodeAt(V,ae),Be,!0,Fe)},ct.parseSubscript=function(V,ae,Be,Fe,Ke,ut,dt){var It=this.options.ecmaVersion>=11,Dt=It&&this.eat(O.questionDot);Fe&&Dt&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var en=this.eat(O.bracketL);if(en||Dt&&this.type!==O.parenL&&this.type!==O.backQuote||this.eat(O.dot)){var Qt=this.startNodeAt(ae,Be);Qt.object=V,en?(Qt.property=this.parseExpression(),this.expect(O.bracketR)):this.type===O.privateId&&V.type!=="Super"?Qt.property=this.parsePrivateIdent():Qt.property=this.parseIdent(this.options.allowReserved!=="never"),Qt.computed=!!en,It&&(Qt.optional=Dt),V=this.finishNode(Qt,"MemberExpression")}else if(!Fe&&this.eat(O.parenL)){var Sn=new gn,zn=this.yieldPos,rr=this.awaitPos,Jn=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var pr=this.parseExprList(O.parenR,this.options.ecmaVersion>=8,!1,Sn);if(Ke&&!Dt&&this.shouldParseAsyncArrow())return this.checkPatternErrors(Sn,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=zn,this.awaitPos=rr,this.awaitIdentPos=Jn,this.parseSubscriptAsyncArrow(ae,Be,pr,dt);this.checkExpressionErrors(Sn,!0),this.yieldPos=zn||this.yieldPos,this.awaitPos=rr||this.awaitPos,this.awaitIdentPos=Jn||this.awaitIdentPos;var Xn=this.startNodeAt(ae,Be);Xn.callee=V,Xn.arguments=pr,It&&(Xn.optional=Dt),V=this.finishNode(Xn,"CallExpression")}else if(this.type===O.backQuote){(Dt||ut)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var Qn=this.startNodeAt(ae,Be);Qn.tag=V,Qn.quasi=this.parseTemplate({isTagged:!0}),V=this.finishNode(Qn,"TaggedTemplateExpression")}return V},ct.parseExprAtom=function(V,ae,Be){this.type===O.slash&&this.readRegexp();var Fe,Ke=this.potentialArrowAt===this.start;switch(this.type){case O._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),Fe=this.startNode(),this.next(),this.type===O.parenL&&!this.allowDirectSuper&&this.raise(Fe.start,"super() call outside constructor of a subclass"),this.type!==O.dot&&this.type!==O.bracketL&&this.type!==O.parenL&&this.unexpected(),this.finishNode(Fe,"Super");case O._this:return Fe=this.startNode(),this.next(),this.finishNode(Fe,"ThisExpression");case O.name:var ut=this.start,dt=this.startLoc,It=this.containsEsc,Dt=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!It&&Dt.name==="async"&&!this.canInsertSemicolon()&&this.eat(O._function))return this.overrideContext(an.f_expr),this.parseFunction(this.startNodeAt(ut,dt),0,!1,!0,ae);if(Ke&&!this.canInsertSemicolon()){if(this.eat(O.arrow))return this.parseArrowExpression(this.startNodeAt(ut,dt),[Dt],!1,ae);if(this.options.ecmaVersion>=8&&Dt.name==="async"&&this.type===O.name&&!It&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return Dt=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(O.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(ut,dt),[Dt],!0,ae)}return Dt;case O.regexp:var en=this.value;return Fe=this.parseLiteral(en.value),Fe.regex={pattern:en.pattern,flags:en.flags},Fe;case O.num:case O.string:return this.parseLiteral(this.value);case O._null:case O._true:case O._false:return Fe=this.startNode(),Fe.value=this.type===O._null?null:this.type===O._true,Fe.raw=this.type.keyword,this.next(),this.finishNode(Fe,"Literal");case O.parenL:var Qt=this.start,Sn=this.parseParenAndDistinguishExpression(Ke,ae);return V&&(V.parenthesizedAssign<0&&!this.isSimpleAssignTarget(Sn)&&(V.parenthesizedAssign=Qt),V.parenthesizedBind<0&&(V.parenthesizedBind=Qt)),Sn;case O.bracketL:return Fe=this.startNode(),this.next(),Fe.elements=this.parseExprList(O.bracketR,!0,!0,V),this.finishNode(Fe,"ArrayExpression");case O.braceL:return this.overrideContext(an.b_expr),this.parseObj(!1,V);case O._function:return Fe=this.startNode(),this.next(),this.parseFunction(Fe,0);case O._class:return this.parseClass(this.startNode(),!1);case O._new:return this.parseNew();case O.backQuote:return this.parseTemplate();case O._import:return this.options.ecmaVersion>=11?this.parseExprImport(Be):this.unexpected();default:return this.parseExprAtomDefault()}},ct.parseExprAtomDefault=function(){this.unexpected()},ct.parseExprImport=function(V){var ae=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===O.parenL&&!V)return this.parseDynamicImport(ae);if(this.type===O.dot){var Be=this.startNodeAt(ae.start,ae.loc&&ae.loc.start);return Be.name="import",ae.meta=this.finishNode(Be,"Identifier"),this.parseImportMeta(ae)}else this.unexpected()},ct.parseDynamicImport=function(V){if(this.next(),V.source=this.parseMaybeAssign(),!this.eat(O.parenR)){var ae=this.start;this.eat(O.comma)&&this.eat(O.parenR)?this.raiseRecoverable(ae,"Trailing comma is not allowed in import()"):this.unexpected(ae)}return this.finishNode(V,"ImportExpression")},ct.parseImportMeta=function(V){this.next();var ae=this.containsEsc;return V.property=this.parseIdent(!0),V.property.name!=="meta"&&this.raiseRecoverable(V.property.start,"The only valid meta property for import is 'import.meta'"),ae&&this.raiseRecoverable(V.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(V.start,"Cannot use 'import.meta' outside a module"),this.finishNode(V,"MetaProperty")},ct.parseLiteral=function(V){var ae=this.startNode();return ae.value=V,ae.raw=this.input.slice(this.start,this.end),ae.raw.charCodeAt(ae.raw.length-1)===110&&(ae.bigint=ae.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(ae,"Literal")},ct.parseParenExpression=function(){this.expect(O.parenL);var V=this.parseExpression();return this.expect(O.parenR),V},ct.shouldParseArrow=function(V){return!this.canInsertSemicolon()},ct.parseParenAndDistinguishExpression=function(V,ae){var Be=this.start,Fe=this.startLoc,Ke,ut=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var dt=this.start,It=this.startLoc,Dt=[],en=!0,Qt=!1,Sn=new gn,zn=this.yieldPos,rr=this.awaitPos,Jn;for(this.yieldPos=0,this.awaitPos=0;this.type!==O.parenR;)if(en?en=!1:this.expect(O.comma),ut&&this.afterTrailingComma(O.parenR,!0)){Qt=!0;break}else if(this.type===O.ellipsis){Jn=this.start,Dt.push(this.parseParenItem(this.parseRestBinding())),this.type===O.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else Dt.push(this.parseMaybeAssign(!1,Sn,this.parseParenItem));var pr=this.lastTokEnd,Xn=this.lastTokEndLoc;if(this.expect(O.parenR),V&&this.shouldParseArrow(Dt)&&this.eat(O.arrow))return this.checkPatternErrors(Sn,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=zn,this.awaitPos=rr,this.parseParenArrowList(Be,Fe,Dt,ae);(!Dt.length||Qt)&&this.unexpected(this.lastTokStart),Jn&&this.unexpected(Jn),this.checkExpressionErrors(Sn,!0),this.yieldPos=zn||this.yieldPos,this.awaitPos=rr||this.awaitPos,Dt.length>1?(Ke=this.startNodeAt(dt,It),Ke.expressions=Dt,this.finishNodeAt(Ke,"SequenceExpression",pr,Xn)):Ke=Dt[0]}else Ke=this.parseParenExpression();if(this.options.preserveParens){var Qn=this.startNodeAt(Be,Fe);return Qn.expression=Ke,this.finishNode(Qn,"ParenthesizedExpression")}else return Ke},ct.parseParenItem=function(V){return V},ct.parseParenArrowList=function(V,ae,Be,Fe){return this.parseArrowExpression(this.startNodeAt(V,ae),Be,!1,Fe)};var on=[];ct.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var V=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===O.dot){var ae=this.startNodeAt(V.start,V.loc&&V.loc.start);ae.name="new",V.meta=this.finishNode(ae,"Identifier"),this.next();var Be=this.containsEsc;return V.property=this.parseIdent(!0),V.property.name!=="target"&&this.raiseRecoverable(V.property.start,"The only valid meta property for new is 'new.target'"),Be&&this.raiseRecoverable(V.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(V.start,"'new.target' can only be used in functions and class static block"),this.finishNode(V,"MetaProperty")}var Fe=this.start,Ke=this.startLoc;return V.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Fe,Ke,!0,!1),this.eat(O.parenL)?V.arguments=this.parseExprList(O.parenR,this.options.ecmaVersion>=8,!1):V.arguments=on,this.finishNode(V,"NewExpression")},ct.parseTemplateElement=function(V){var ae=V.isTagged,Be=this.startNode();return this.type===O.invalidTemplate?(ae||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),Be.value={raw:this.value.replace(/\r\n?/g,`
1194
1194
  `),cooked:null}):Be.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "randmarcomps",
3
3
  "private": false,
4
- "version": "1.363.0",
4
+ "version": "1.364.0",
5
5
  "description": "The UI library enabling speed and consistency in Randmar frontends.",
6
6
  "type": "module",
7
7
  "files": [