randmarcomps 1.558.0 → 1.559.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.
- package/dist/randmarcomps.js +237 -3
- package/dist/randmarcomps.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/randmarcomps.js
CHANGED
|
@@ -72786,7 +72786,233 @@ const CountryFlag = ({ countryCode: e, className: t = "" }) => {
|
|
|
72786
72786
|
style: { width: "24px", height: "auto" }
|
|
72787
72787
|
}
|
|
72788
72788
|
);
|
|
72789
|
-
},
|
|
72789
|
+
}, imgSizeMap$1 = {
|
|
72790
|
+
sm: 100,
|
|
72791
|
+
md: 200,
|
|
72792
|
+
lg: 300,
|
|
72793
|
+
xl: 400
|
|
72794
|
+
};
|
|
72795
|
+
function getApiOriginFromSwaggerJsonUrl(e) {
|
|
72796
|
+
try {
|
|
72797
|
+
return new URL(e).origin;
|
|
72798
|
+
} catch {
|
|
72799
|
+
return "https://api.randmar.io";
|
|
72800
|
+
}
|
|
72801
|
+
}
|
|
72802
|
+
async function fetchProductImagesList({
|
|
72803
|
+
apiOrigin: e,
|
|
72804
|
+
randmarSKU: t,
|
|
72805
|
+
signal: n
|
|
72806
|
+
}) {
|
|
72807
|
+
const a = new URL(`/Product/${encodeURIComponent(t)}/Images`, e), s = await fetch(a.toString(), {
|
|
72808
|
+
method: "GET",
|
|
72809
|
+
credentials: "omit",
|
|
72810
|
+
headers: { Accept: "application/json" },
|
|
72811
|
+
signal: n
|
|
72812
|
+
});
|
|
72813
|
+
if (!s.ok)
|
|
72814
|
+
throw new Error(`Failed to load images list for ${t}: ${s.status}`);
|
|
72815
|
+
const o = await s.json();
|
|
72816
|
+
return Array.isArray(o) ? o : o && typeof o == "object" && "Images" in o && Array.isArray(o.Images) ? o.Images : [];
|
|
72817
|
+
}
|
|
72818
|
+
function buildImageSrc({
|
|
72819
|
+
apiOrigin: e,
|
|
72820
|
+
randmarSKU: t,
|
|
72821
|
+
image: n,
|
|
72822
|
+
width: a,
|
|
72823
|
+
height: s
|
|
72824
|
+
}) {
|
|
72825
|
+
const o = (n.Url ?? "").trim();
|
|
72826
|
+
if (o) return o;
|
|
72827
|
+
const l = new URL(
|
|
72828
|
+
`/Product/${encodeURIComponent(t)}/Image/${encodeURIComponent(String(n.ImageId))}`,
|
|
72829
|
+
e
|
|
72830
|
+
);
|
|
72831
|
+
return l.searchParams.set("width", String(Math.round(a))), l.searchParams.set("height", String(Math.round(s))), l.toString();
|
|
72832
|
+
}
|
|
72833
|
+
const Placeholder$1 = ({ size: e, alt: t }) => /* @__PURE__ */ jsx(
|
|
72834
|
+
"div",
|
|
72835
|
+
{
|
|
72836
|
+
className: "rounded-md bg-muted flex items-center justify-center",
|
|
72837
|
+
style: { width: e, height: e },
|
|
72838
|
+
"aria-label": t,
|
|
72839
|
+
children: /* @__PURE__ */ jsx(ImageOff, { className: "h-1/2 w-1/2 text-muted-foreground" })
|
|
72840
|
+
}
|
|
72841
|
+
);
|
|
72842
|
+
function ProductImageCarousel({
|
|
72843
|
+
randmarSKU: e,
|
|
72844
|
+
size: t = "md",
|
|
72845
|
+
alt: n,
|
|
72846
|
+
className: a,
|
|
72847
|
+
fallback: s
|
|
72848
|
+
}) {
|
|
72849
|
+
const o = imgSizeMap$1[t], l = React.useRef(null), c = useIntersectionObserver({
|
|
72850
|
+
elementRef: l,
|
|
72851
|
+
threshold: 0.1,
|
|
72852
|
+
rootMargin: "100px"
|
|
72853
|
+
}), f = useRandmarApiConfig(), g = React.useMemo(
|
|
72854
|
+
() => getApiOriginFromSwaggerJsonUrl(f.swaggerJsonUrl),
|
|
72855
|
+
[f.swaggerJsonUrl]
|
|
72856
|
+
), [A, R] = React.useState(null), [V, Ve] = React.useState(!1), [Ye, rt] = React.useState(0), et = React.useRef(!1), nt = React.useRef(/* @__PURE__ */ new Set());
|
|
72857
|
+
React.useEffect(() => {
|
|
72858
|
+
R(null), Ve(!1), rt(0), et.current = !1, nt.current.clear();
|
|
72859
|
+
}, [e]), React.useEffect(() => {
|
|
72860
|
+
if (!e || !c || A !== null || V) return;
|
|
72861
|
+
const yt = new AbortController();
|
|
72862
|
+
return (async () => {
|
|
72863
|
+
try {
|
|
72864
|
+
const Mt = await fetchProductImagesList({
|
|
72865
|
+
apiOrigin: g,
|
|
72866
|
+
randmarSKU: e,
|
|
72867
|
+
signal: yt.signal
|
|
72868
|
+
});
|
|
72869
|
+
R(Mt);
|
|
72870
|
+
} catch (Mt) {
|
|
72871
|
+
if (yt.signal.aborted) return;
|
|
72872
|
+
console.error("Failed to load product images list", { randmarSKU: e, error: Mt }), Ve(!0);
|
|
72873
|
+
}
|
|
72874
|
+
})(), () => yt.abort();
|
|
72875
|
+
}, [g, V, A, c, e]);
|
|
72876
|
+
const at = React.useMemo(() => A ? [...A].sort((yt, Mt) => {
|
|
72877
|
+
const Ut = yt.SortOrder ?? Number.POSITIVE_INFINITY, Ht = Mt.SortOrder ?? Number.POSITIVE_INFINITY;
|
|
72878
|
+
if (Ut !== Ht) return Ut - Ht;
|
|
72879
|
+
const Dt = yt.IsPrimary === !0 ? 0 : 1, Vt = Mt.IsPrimary === !0 ? 0 : 1;
|
|
72880
|
+
return Dt - Vt;
|
|
72881
|
+
}) : null, [A]), ot = React.useMemo(() => {
|
|
72882
|
+
if (!at?.length) return 0;
|
|
72883
|
+
const yt = at.findIndex((Mt) => Mt.IsPrimary === !0);
|
|
72884
|
+
return yt >= 0 ? yt : 0;
|
|
72885
|
+
}, [at]);
|
|
72886
|
+
React.useEffect(() => {
|
|
72887
|
+
at?.length && (et.current || (rt(ot), et.current = !0));
|
|
72888
|
+
}, [ot, at]);
|
|
72889
|
+
const ct = at?.length ?? 0, lt = React.useMemo(() => {
|
|
72890
|
+
const yt = (n ?? "").trim();
|
|
72891
|
+
return yt ? `${yt} (Product ${e})` : `Product ${e}`;
|
|
72892
|
+
}, [n, e]), st = React.useCallback(
|
|
72893
|
+
(yt) => ct > 1 ? `${lt} image ${yt + 1}` : lt,
|
|
72894
|
+
[lt, ct]
|
|
72895
|
+
), ut = at?.[Ye], pt = React.useMemo(() => ut ? buildImageSrc({
|
|
72896
|
+
apiOrigin: g,
|
|
72897
|
+
randmarSKU: e,
|
|
72898
|
+
image: ut,
|
|
72899
|
+
width: o * 1.5,
|
|
72900
|
+
height: o * 1.5
|
|
72901
|
+
}) : null, [ut, g, o, e]), mt = React.useCallback(
|
|
72902
|
+
(yt) => {
|
|
72903
|
+
if (ct <= 0) return;
|
|
72904
|
+
const Mt = (yt % ct + ct) % ct;
|
|
72905
|
+
rt(Mt);
|
|
72906
|
+
},
|
|
72907
|
+
[ct]
|
|
72908
|
+
), Rt = React.useCallback(() => mt(Ye - 1), [Ye, mt]), It = React.useCallback(() => mt(Ye + 1), [Ye, mt]), dt = React.useCallback(
|
|
72909
|
+
(yt) => {
|
|
72910
|
+
if (!(ct <= 1))
|
|
72911
|
+
switch (yt.key) {
|
|
72912
|
+
case "ArrowLeft":
|
|
72913
|
+
yt.preventDefault(), Rt();
|
|
72914
|
+
break;
|
|
72915
|
+
case "ArrowRight":
|
|
72916
|
+
yt.preventDefault(), It();
|
|
72917
|
+
break;
|
|
72918
|
+
case "Home":
|
|
72919
|
+
yt.preventDefault(), mt(0);
|
|
72920
|
+
break;
|
|
72921
|
+
case "End":
|
|
72922
|
+
yt.preventDefault(), mt(ct - 1);
|
|
72923
|
+
break;
|
|
72924
|
+
}
|
|
72925
|
+
},
|
|
72926
|
+
[It, Rt, mt, ct]
|
|
72927
|
+
);
|
|
72928
|
+
return React.useEffect(() => {
|
|
72929
|
+
if (!at?.length || ct <= 1) return;
|
|
72930
|
+
const yt = (Ye - 1 + ct) % ct, Mt = (Ye + 1) % ct, Ut = [yt, Mt];
|
|
72931
|
+
for (const Ht of Ut) {
|
|
72932
|
+
const Dt = at[Ht];
|
|
72933
|
+
if (!Dt) continue;
|
|
72934
|
+
const Vt = buildImageSrc({
|
|
72935
|
+
apiOrigin: g,
|
|
72936
|
+
randmarSKU: e,
|
|
72937
|
+
image: Dt,
|
|
72938
|
+
width: o * 1.5,
|
|
72939
|
+
height: o * 1.5
|
|
72940
|
+
});
|
|
72941
|
+
if (nt.current.has(Vt)) continue;
|
|
72942
|
+
nt.current.add(Vt);
|
|
72943
|
+
const Yt = new Image();
|
|
72944
|
+
Yt.src = Vt;
|
|
72945
|
+
}
|
|
72946
|
+
}, [Ye, g, o, e, ct, at]), V ? /* @__PURE__ */ jsx(Fragment$1, { children: s ?? null }) : A === null && c ? /* @__PURE__ */ jsx("div", { className: a, ref: l, children: /* @__PURE__ */ jsx(Skeleton, { className: "rounded-md", style: { width: o, height: o } }) }) : at && at.length === 0 ? /* @__PURE__ */ jsx("div", { className: a, ref: l, children: /* @__PURE__ */ jsx(Placeholder$1, { size: o, alt: lt }) }) : pt ? /* @__PURE__ */ jsx("div", { className: a, ref: l, children: /* @__PURE__ */ jsxs(
|
|
72947
|
+
"div",
|
|
72948
|
+
{
|
|
72949
|
+
className: "relative rounded-md overflow-hidden bg-muted",
|
|
72950
|
+
style: { width: o, height: o },
|
|
72951
|
+
role: "region",
|
|
72952
|
+
"aria-roledescription": "carousel",
|
|
72953
|
+
"aria-label": `Product images for ${e}`,
|
|
72954
|
+
tabIndex: ct > 1 ? 0 : -1,
|
|
72955
|
+
onKeyDown: dt,
|
|
72956
|
+
children: [
|
|
72957
|
+
/* @__PURE__ */ jsx(
|
|
72958
|
+
"img",
|
|
72959
|
+
{
|
|
72960
|
+
alt: st(Ye),
|
|
72961
|
+
className: "w-full h-full object-contain",
|
|
72962
|
+
src: pt,
|
|
72963
|
+
width: o,
|
|
72964
|
+
height: o,
|
|
72965
|
+
loading: "eager"
|
|
72966
|
+
}
|
|
72967
|
+
),
|
|
72968
|
+
ct > 1 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
72969
|
+
/* @__PURE__ */ jsx(
|
|
72970
|
+
Button$1,
|
|
72971
|
+
{
|
|
72972
|
+
type: "button",
|
|
72973
|
+
variant: "secondary",
|
|
72974
|
+
size: "icon",
|
|
72975
|
+
className: "absolute left-2 top-1/2 -translate-y-1/2",
|
|
72976
|
+
onClick: Rt,
|
|
72977
|
+
"aria-label": "Previous image",
|
|
72978
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
|
|
72979
|
+
}
|
|
72980
|
+
),
|
|
72981
|
+
/* @__PURE__ */ jsx(
|
|
72982
|
+
Button$1,
|
|
72983
|
+
{
|
|
72984
|
+
type: "button",
|
|
72985
|
+
variant: "secondary",
|
|
72986
|
+
size: "icon",
|
|
72987
|
+
className: "absolute right-2 top-1/2 -translate-y-1/2",
|
|
72988
|
+
onClick: It,
|
|
72989
|
+
"aria-label": "Next image",
|
|
72990
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
|
|
72991
|
+
}
|
|
72992
|
+
),
|
|
72993
|
+
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 left-1/2 -translate-x-1/2 flex items-center gap-1 rounded-full bg-white/80 px-2 py-1", children: Array.from({ length: ct }).map((yt, Mt) => {
|
|
72994
|
+
const Ut = Mt === Ye;
|
|
72995
|
+
return /* @__PURE__ */ jsx(
|
|
72996
|
+
"button",
|
|
72997
|
+
{
|
|
72998
|
+
type: "button",
|
|
72999
|
+
className: [
|
|
73000
|
+
"h-1.5 w-1.5 rounded-full transition-colors",
|
|
73001
|
+
Ut ? "bg-neutral-900" : "bg-neutral-300 hover:bg-neutral-400"
|
|
73002
|
+
].join(" "),
|
|
73003
|
+
onClick: () => mt(Mt),
|
|
73004
|
+
"aria-label": `Go to image ${Mt + 1} of ${ct}`,
|
|
73005
|
+
"aria-current": Ut ? "true" : void 0
|
|
73006
|
+
},
|
|
73007
|
+
Mt
|
|
73008
|
+
);
|
|
73009
|
+
}) })
|
|
73010
|
+
] })
|
|
73011
|
+
]
|
|
73012
|
+
}
|
|
73013
|
+
) }) : /* @__PURE__ */ jsx("div", { className: a, ref: l, children: /* @__PURE__ */ jsx(Placeholder$1, { size: o, alt: lt }) });
|
|
73014
|
+
}
|
|
73015
|
+
const getTodayIsoDate = () => (/* @__PURE__ */ new Date()).toISOString().split("T")[0], isOpportunityNotStartedYet = (e) => e.StartDate ? e.StartDate.split("T")[0] > getTodayIsoDate() : !1, isOpportunitySelectable = (e) => {
|
|
72790
73016
|
if (e.Active !== !0) return !1;
|
|
72791
73017
|
const t = getTodayIsoDate();
|
|
72792
73018
|
return !(e.EndDate && e.EndDate.split("T")[0] < t || e.StartDate && e.StartDate.split("T")[0] > t);
|
|
@@ -73165,11 +73391,19 @@ function ProductCard({
|
|
|
73165
73391
|
] })
|
|
73166
73392
|
] }),
|
|
73167
73393
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col @[36rem]:order-2 order-1 items-center", children: /* @__PURE__ */ jsx(
|
|
73168
|
-
|
|
73394
|
+
ProductImageCarousel,
|
|
73169
73395
|
{
|
|
73170
73396
|
randmarSKU: t.RandmarSKU || "",
|
|
73171
73397
|
alt: t.RandmarTitle || "",
|
|
73172
|
-
|
|
73398
|
+
fallback: /* @__PURE__ */ jsx(
|
|
73399
|
+
ProductImage,
|
|
73400
|
+
{
|
|
73401
|
+
randmarSKU: t.RandmarSKU || "",
|
|
73402
|
+
alt: t.RandmarTitle || "",
|
|
73403
|
+
sceneName: t.SceneName
|
|
73404
|
+
},
|
|
73405
|
+
`product_image_fallback_${t.RandmarSKU}`
|
|
73406
|
+
)
|
|
73173
73407
|
},
|
|
73174
73408
|
`product_image_${t.RandmarSKU}`
|
|
73175
73409
|
) })
|
|
@@ -518,7 +518,7 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
|
|
|
518
518
|
`;break;default:e+=String.fromCharCode(n);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},pp.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(types$1.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
|
|
519
519
|
`&&++this.pos;case`
|
|
520
520
|
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")},pp.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
|
|
521
|
-
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return codePointToString(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var n=this.pos-1;this.invalidStringToken(n,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var s=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],a=parseInt(s,8);return a>255&&(s=s.slice(0,-1),a=parseInt(s,8)),this.pos+=s.length-1,t=this.input.charCodeAt(this.pos),(s!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-s.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(a)}return isNewLine(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},pp.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return n===null&&this.invalidStringToken(t,"Bad character escape sequence"),n},pp.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,n=this.pos,s=this.options.ecmaVersion>=6;this.pos<this.input.length;){var a=this.fullCharCodeAtPos();if(isIdentifierChar(a,s))this.pos+=a<=65535?1:2;else if(a===92){this.containsEsc=!0,e+=this.input.slice(n,this.pos);var o=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var l=this.readCodePoint();(t?isIdentifierStart:isIdentifierChar)(l,s)||this.invalidStringToken(o,"Invalid Unicode escape"),e+=codePointToString(l),n=this.pos}else break;t=!1}return e+this.input.slice(n,this.pos)},pp.readWord=function(){var e=this.readWord1(),t=types$1.name;return this.keywords.test(e)&&(t=keywords[e]),this.finishToken(t,e)};var version="8.12.1";Parser.acorn={Parser,version,defaultOptions,Position,SourceLocation,getLineInfo,Node:Node$2,TokenType,tokTypes:types$1,keywordTypes:keywords,TokContext,tokContexts:types,isIdentifierChar,isIdentifierStart,Token,isNewLine,lineBreak,lineBreakG,nonASCIIwhitespace};var AcornJSX=__toESM(require_acorn_jsx()),attributeNames_default={acceptcharset:"acceptCharset",accesskey:"accessKey",allowfullscreen:"allowFullScreen",autocapitalize:"autoCapitalize",autocomplete:"autoComplete",autofocus:"autoFocus",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",class:"className",colspan:"colSpan",contenteditable:"contentEditable",crossorigin:"crossOrigin",datetime:"dateTime",enctype:"encType",for:"htmlFor",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",httpequiv:"httpEquiv",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",radiogroup:"radioGroup",readonly:"readOnly",referrerpolicy:"referrerPolicy",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap"},VOID_ELEMENTS=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"],NO_WHITESPACE=["table","tbody","tfoot","thead","tr"];function canHaveChildren(e){return VOID_ELEMENTS.indexOf(e.toLowerCase())===-1}function canHaveWhitespace(e){return NO_WHITESPACE.indexOf(e.toLowerCase())!==-1}class NullishShortCircuit extends Error{constructor(t="Nullish value encountered"){super(t),this.name="NullishShortCircuit"}}var hash=(e="",t=16)=>{const n=String(e);let s=0;return n.split("").forEach(a=>{s=(s<<5)-s+a.charCodeAt(0),s&=s}),Math.abs(s).toString(t)},randomHash=()=>hash(Math.random().toString()),camelCase=e=>e.replace(/([A-Z])([A-Z])/g,"$1 $2").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[^a-zA-Z\u00C0-\u00ff]/g," ").toLowerCase().split(" ").filter(t=>t).map((t,n)=>n>0?t[0].toUpperCase()+t.slice(1):t).join(""),parseStyle=e=>{switch(typeof e){case"string":return e.split(";").filter(t=>t).reduce((t,n)=>{const s=n.slice(0,n.indexOf(":")).trim(),a=n.slice(n.indexOf(":")+1).trim();return{...t,[camelCase(s)]:a}},{});case"object":return e;default:return}},pathToArrayPath=e=>e==null||e===""?[]:e.split("."),resolveArrayPath=(e,t)=>{const[n,...s]=t;if(!(e==null||n==null))return s.length===0?e[n]:resolveArrayPath(e[n],s)},resolvePath=(e,t)=>resolveArrayPath(e,pathToArrayPath(t));function handleNaN(e){return Number.isNaN(e)?"NaN":e}class JsxParser extends React.Component{static displayName="JsxParser";static defaultProps={allowUnknownElements:!0,autoCloseVoidElements:!1,bindings:{},blacklistedAttrs:[/^on.+/i],blacklistedTags:["script"],className:"",components:{},componentsOnly:!1,disableFragments:!1,disableKeyGeneration:!1,jsx:"",onError:()=>{},showWarnings:!1,renderError:void 0,renderInWrapper:!0,renderUnrecognized:()=>null};ParsedChildren=null;#r=t=>{const n=Parser.extend(AcornJSX.default({autoCloseVoidElements:this.props.autoCloseVoidElements})),s=`<root>${t}</root>`;let a=[];try{return a=n.parse(s,{ecmaVersion:"latest"}),a=a.body[0].expression.children||[],a.map(o=>this.#e(o)).filter(Boolean)}catch(o){return this.props.showWarnings&&console.warn(o),this.props.onError&&this.props.onError(o),this.props.renderError?this.props.renderError({error:String(o)}):null}};#e=(t,n)=>{switch(t.type){case"JSXAttribute":return t.value===null?!0:this.#e(t.value,n);case"JSXElement":case"JSXFragment":return this.#n(t,n);case"JSXExpressionContainer":return this.#e(t.expression,n);case"JSXText":const s=this.props.disableKeyGeneration?void 0:randomHash();return this.props.disableFragments?t.value:React.createElement(React.Fragment,{key:s},t.value);case"ArrayExpression":return t.elements.map(A=>this.#e(A,n));case"BinaryExpression":const a=this.#e(t.left,n),o=this.#e(t.right,n);let l;switch(t.operator){case"-":l=a-o;break;case"!=":l=a!=o;break;case"!==":l=a!==o;break;case"*":l=a*o;break;case"**":l=a**o;break;case"/":l=a/o;break;case"%":l=a%o;break;case"+":l=a+o;break;case"<":l=a<o;break;case"<=":l=a<=o;break;case"==":l=a==o;break;case"===":l=a===o;break;case">":l=a>o;break;case">=":l=a>=o;break;default:this.props.onError(new Error(`Unsupported binary operator: ${t.operator}`));return}return handleNaN(l);case"CallExpression":const c=this.#e(t.callee,n);if(c===void 0){if(t.optional)throw new NullishShortCircuit;this.props.onError(new Error(`The expression '${t.callee}' could not be resolved, resulting in an undefined return value.`));return}return c(...t.arguments.map(A=>this.#e(A,n)));case"ConditionalExpression":return this.#e(t.test,n)?this.#e(t.consequent,n):this.#e(t.alternate,n);case"ExpressionStatement":return this.#e(t.expression,n);case"Identifier":return t.name==="Infinity"?1/0:t.name==="-Infinity"?-1/0:t.name==="NaN"?NaN:n&&t.name in n?handleNaN(n[t.name]):handleNaN((this.props.bindings||{})[t.name]);case"Literal":return t.value;case"LogicalExpression":const f=this.#e(t.left,n);return t.operator==="||"&&f?f:t.operator==="&&"&&f||t.operator==="||"&&!f?this.#e(t.right,n):!1;case"MemberExpression":return this.#s(t,n);case"ChainExpression":return this.#i(t,n);case"ObjectExpression":const g={};return t.properties.forEach(A=>{g[A.key.name||A.key.value]=this.#e(A.value,n)}),g;case"TemplateElement":return t.value.cooked;case"TemplateLiteral":return[...t.expressions,...t.quasis].sort((A,V)=>A.start<V.start?-1:1).map(A=>this.#e(A,n)).join("");case"UnaryExpression":const R=this.#e(t.argument,n);switch(t.operator){case"+":return+R;case"-":return-R;case"!":return!R;case"~":return~R;case"typeof":return typeof R}return;case"ArrowFunctionExpression":return(t.async||t.generator)&&this.props.onError?.(new Error("Async and generator arrow functions are not supported.")),(...A)=>{const V={...n};return t.params.forEach((Ve,Ye)=>{V[Ve.name]=A[Ye]}),this.#e(t.body,V)};default:this.props.onError(new Error(`The expression type '${t.type}' is not supported.`));return}};#i=(t,n)=>{try{return this.#e(t.expression,n)}catch(s){if(s instanceof NullishShortCircuit)return;throw s}};#s=(t,n)=>{const s=this.#e(t.object,n);let a;if(t.computed)a=this.#e(t.property,n);else if(t.property.type==="Identifier")a=t.property.name;else{this.props.onError(new Error("Only simple MemberExpressions are supported."));return}if(s==null&&t.optional)throw new NullishShortCircuit;let o;try{o=s[a]}catch{this.props.onError(new Error(`The property '${a}' could not be resolved on the object '${s}'.`));return}return typeof o=="function"?o.bind(s):o};#t=t=>t.type==="JSXIdentifier"?t.name:`${this.#t(t.object)}.${this.#t(t.property)}`;#n=(t,n)=>{const{allowUnknownElements:s,components:a,componentsOnly:o,onError:l}=this.props,{children:c=[]}=t,f=t.type==="JSXElement"?t.openingElement:t.openingFragment,{attributes:g=[]}=f,R=t.type==="JSXElement"?this.#t(f.name):"",A=(this.props.blacklistedAttrs||[]).map(st=>st instanceof RegExp?st:new RegExp(st,"i")),V=(this.props.blacklistedTags||[]).map(st=>st.trim().toLowerCase()).filter(Boolean);if(/^(html|head|body)$/i.test(R))return c.map(st=>this.#n(st,n));const Ve=R.trim().toLowerCase();if(V.indexOf(Ve)!==-1)return l(new Error(`The tag <${R}> is blacklisted, and will not be rendered.`)),null;if(R!==""&&!resolvePath(a,R)){if(o)return l(new Error(`The component <${R}> is unrecognized, and will not be rendered.`)),this.props.renderUnrecognized(R);if(!s&&document.createElement(R)instanceof HTMLUnknownElement)return l(new Error(`The tag <${R}> is unrecognized in this browser, and will not be rendered.`)),this.props.renderUnrecognized(R)}let Ye,nt=t.type==="JSXElement"?resolvePath(a,R):React.Fragment;if(nt||canHaveChildren(R)){if(Ye=c.map(ot=>this.#e(ot,n)),R.includes(".")){const ct=R.split(".").reduce((lt,at)=>lt?lt[at]:a?.[at],null);ct&&(nt=ct)}!nt&&!canHaveWhitespace(R)&&(Ye=Ye.filter(ot=>typeof ot!="string"||!/^\s*$/.test(ot)));const st=Ye.find(ot=>typeof ot=="function");Ye.length===0?Ye=void 0:st?Ye=st:Ye.length===1?[Ye]=Ye:Ye.length>1&&!this.props.disableKeyGeneration&&(Ye=Ye.map((ot,ct)=>ot?.type&&!ot?.key?{...ot,key:ot.key||ct}:ot))}const et={key:this.props.disableKeyGeneration?void 0:randomHash()};g.forEach(st=>{if(st.type==="JSXAttribute"){const ot=st.name.name,ct=attributeNames_default[ot]||ot,lt=this.#e(st,n);A.filter(ut=>ut.test(ct)).length===0&&(et[ct]=lt)}else if(st.type==="JSXSpreadAttribute"&&st.argument.type==="Identifier"||st.argument.type==="MemberExpression"){const ot=this.#e(st.argument,n);typeof ot=="object"&&Object.keys(ot).forEach(ct=>{const lt=attributeNames_default[ct]||ct;A.filter(ut=>ut.test(lt)).length===0&&(et[lt]=ot[ct])})}}),typeof et.style=="string"&&(et.style=parseStyle(et.style));const rt=R.toLowerCase();return rt==="option"&&(Ye=Ye.props.children),React.createElement(nt||rt,et,Ye)};render(){const t=(this.props.jsx||"").trim().replace(/<!DOCTYPE([^>]*)>/g,"");this.ParsedChildren=this.#r(t);const n=[...new Set(["jsx-parser",...String(this.props.className).split(" ")])].filter(Boolean).join(" ");return this.props.renderInWrapper?React.createElement("div",{className:n},this.ParsedChildren):this.ParsedChildren}}var source_default=JsxParser;const CountryFlag=({countryCode:e,className:t=""})=>{const[n,s]=React.useState(null),[a,o]=React.useState(!1);return React.useEffect(()=>{if(!e)return;const c=`https://purecatamphetamine.github.io/country-flag-icons/3x2/${e.toUpperCase()}.svg`;fetch(c,{method:"HEAD"}).then(f=>{f.ok?(s(c),o(!1)):o(!0)}).catch(()=>{o(!0)})},[e]),a||!n?jsxRuntime.jsx("span",{className:t,children:e}):jsxRuntime.jsx("img",{src:n,alt:`${e} flag`,className:`inline-block ${t}`,style:{width:"24px",height:"auto"}})},getTodayIsoDate=()=>new Date().toISOString().split("T")[0],isOpportunityNotStartedYet=e=>e.StartDate?e.StartDate.split("T")[0]>getTodayIsoDate():!1,isOpportunitySelectable=e=>{if(e.Active!==!0)return!1;const t=getTodayIsoDate();return!(e.EndDate&&e.EndDate.split("T")[0]<t||e.StartDate&&e.StartDate.split("T")[0]>t)};function ProductCard({applicationId:e,product:t,viewProductLink:n,defaultOpportunityNumber:s="",onAddToCart:a,addingToCart:o=!1,shopifyHostname:l,customAction:c=jsxRuntime.jsx(jsxRuntime.Fragment,{})}){const f=reactRouterDom.useNavigate(),{toast:g}=useToast(),[R,A]=React.useState(1),[V,Ve]=React.useState(null),[Ye,nt]=React.useState(0),[et,rt]=React.useState(!1),[st]=usePostV4ResellerByRouteResellerIdProductAndRandmarSkuShopifyMutation(),[ot,ct]=React.useState(!1),[lt,at]=React.useState(null),[ut,ft]=React.useState("idle"),[mt,Ct]=React.useState(null),[It]=useLazyGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery(),dt=t?.Distribution?.Cost||0,Rt=t?.Distribution?.RegularPrice||0,yt=t?.Distribution?.Price||0,Mt=!!(e&&t?.RandmarSKU);React.useEffect(()=>{A(1),Ve(null),nt(0)},[t?.RandmarSKU]),React.useEffect(()=>{if(t&&s){const Xt=t.Opportunities?.find(xn=>xn.BidNumber==s);Xt&&isOpportunitySelectable(Xt)&&Ve(Xt)}},[t,s]),React.useEffect(()=>{if(!t)return;const Xt=V?.Price?V.Price:yt;nt(Rt>0?Math.round((Rt-Xt)/Rt*100):0)},[t,V,yt,Rt]),React.useEffect(()=>{o||A(1)},[o]),React.useEffect(()=>{if(!ot){at(null),ft("idle"),Ct(null);return}if(!e||!t?.RandmarSKU){ft("error"),Ct("Missing identifiers to load performance data.");return}let Xt=!1;const xn=t.RandmarSKU;return(async()=>{ft("summary"),Ct(null);try{const Cn=await It({routeApplicationId:e,randmarSku:xn,withSpecification:!1});if(Xt)return;if("error"in Cn&&Cn.error)throw Cn.error;at(Cn.data??null),ft("detailed");const In=await It({routeApplicationId:e,randmarSku:xn,withSpecification:!0});if(Xt)return;if("error"in In&&In.error)throw In.error;at(In.data??Cn.data??null),ft("complete")}catch(Cn){if(Xt)return;console.error("Failed to load performance data for product modal",Cn),ft("error"),Ct("We couldn't load the performance details. Please try again.")}})(),()=>{Xt=!0}},[e,It,ot,t?.RandmarSKU]);const Ut=Xt=>Xt>=90?{label:"Top 10% Bestseller",color:"text-purple-950",bgColor:"bg-purple-200"}:Xt>=75?{label:"Bestseller",color:"text-blue-700",bgColor:"bg-blue-50"}:Xt>=33?{label:"Popular",color:"text-green-700",bgColor:"bg-green-50"}:{label:"Rising",color:"text-gray-700",bgColor:"bg-white"},Ht=ut!=="complete"&&ut!=="error",Dt=ut==="summary"?40:ut==="detailed"?80:10,$t=lt?.SalesStatistics??[],Yt=Ht?[]:$t,sn=lt?.RandmarTitle??t?.RandmarTitle??t?.RandmarSKU??"this product",tn=lt?.RandmarSKU??t?.RandmarSKU,an=e&&t?.ManufacturerId?`/${encodeURIComponent(e)}/Partner/${encodeURIComponent(t.ManufacturerId)}?tab=manufacturer-overview`:null;if(!t)return jsxRuntime.jsx(Card,{className:"flex h-full w-full flex-col",children:jsxRuntime.jsxs(CardContent,{className:"flex h-full flex-col p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx("div",{className:"h-10 w-24 flex items-center justify-end ml-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"})})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-28 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex gap-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-6 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col",children:jsxRuntime.jsx("div",{className:"w-60 h-40",children:jsxRuntime.jsx(Skeleton,{className:"w-full h-full rounded-lg"})})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsx("div",{className:"flex flex-1",children:jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24 mb-3"}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-full rounded-md"})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-32 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 mt-4"})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-start gap-1 mb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-10 flex-1 rounded-md"})]})]})]})});const on=t?.Opportunities||[],Qt=on.length>0,yn=()=>{if(R==null){A(1);return}R>1&&A(R-1)},Zt=()=>{if(R==null){A(1);return}A(R+1)},mn=Xt=>{const xn=Number.parseInt(Xt.target.value,10);if(!isNaN(xn)&&xn>0){A(xn);return}A(void 0)},en=()=>{(R==null||R<1)&&A(1)},Jt=Xt=>{try{return new Date(Xt).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch(xn){return console.error(xn),Xt.split("T")[0]||"N/A"}},dn=Xt=>{const xn=typeof t?.MSRP=="number"&&t.MSRP>0?t.MSRP:typeof t?.MAP=="number"&&t.MAP>0?t.MAP:null;if(xn===null)return null;const Rn=Xt.Price??t?.Distribution?.Price;if(typeof Rn!="number")return null;const Cn=Xt.Rebate??0,In=Math.max(Rn-Cn,0);return xn-In},qt=()=>{typeof a<"u"&&a({quantity:R??1,bidNumber:V?.BidNumber??null})},bn=()=>{et||!l||(rt(!0),st({routeResellerId:e??"",randmarSku:t.RandmarSKU??"",shopifyHostName:l}).then(Xt=>{if(Xt.error){console.error("Error syncing to Shopify:",Xt.error),g({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"});return}g({title:"Product synced",description:"Product synced to Shopify successfully",variant:"success"})}).catch(Xt=>{console.error("Error syncing to Shopify:",Xt),g({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"})}).finally(()=>{rt(!1)}))};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Card,{className:"flex h-full w-full flex-col hover:shadow-lg transition-shadow @container",children:jsxRuntime.jsxs(CardContent,{className:"flex h-full flex-col p-6",children:[jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col gap-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-3",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-xl",children:t.Title||t.RandmarTitle}),jsxRuntime.jsx("div",{className:"w-24 h-10 flex items-center justify-end ml-4 flex-shrink-0",children:an?jsxRuntime.jsx(reactRouterDom.Link,{to:an,"aria-label":`Open manufacturer overview for ${t.ManufacturerName??"this manufacturer"}`,className:"block h-full w-full",children:jsxRuntime.jsx(PartnerLogo,{id:t.ManufacturerId,name:t.ManufacturerName,width:96,height:40,className:"cursor-pointer"},`partner_logo_${t.ManufacturerId}`)}):jsxRuntime.jsx(PartnerLogo,{id:t.ManufacturerId,name:t.ManufacturerName,width:96,height:40},`partner_logo_${t.ManufacturerId}`)})]}),jsxRuntime.jsxs("div",{className:"flex flex-col @[36rem]:flex-row gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-1 @[36rem]:order-1 order-2 flex flex-col gap-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 items-center justify-center @[36rem]:items-start @[36rem]:justify-start",children:[t.State&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${t.State==="Active"?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Check,{size:"12",className:"mr-1.5"})," ",t.State]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${t.SerialNumber?"bg-green-50 text-green-700 hover:bg-green-50":"bg-yellow-50 text-yellow-700 hover:bg-yellow-50"}`,children:[jsxRuntime.jsx(QrCode,{size:"12",className:"mr-1.5"})," ",t.SerialNumber?"Serialized":"Unserialized"]}),t.TransparencyCode&&jsxRuntime.jsxs(Badge,{variant:"outline",className:"rounded-full px-3 bg-green-50 text-green-700 hover:bg-green-50",children:[jsxRuntime.jsx(CircleDashed,{size:"12",className:"mr-1.5"})," Transparency Code"]}),t.AvailableToBuy!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${t.AvailableToBuy?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(ShoppingCart,{size:"12",className:"mr-1.5"})," ",t.AvailableToBuy?"Available":"Unavailable"]}),t.ManufacturerCategory!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${t.ManufacturerCategory?.QualificationRequired?"bg-blue-50 text-blue-700 hover:bg-blue-50":"bg-neutral-50 text-neutral-700 hover:bg-neutral-50"}`,children:[jsxRuntime.jsx(ShieldCheck,{size:"12",className:"mr-1.5"})," ",t.ManufacturerCategory?.QualificationRequired?"Qualified Only":"Available to all"]}),t.ManufacturerId&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${t.AutoUpdate?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(RefreshCw,{size:"12",className:"mr-1.5"})," ",t.AutoUpdate?`Automatic Reorder (${t.MasterCarton})`:"Manually Reorders"]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${t.BodyHTML&&t.Title&&t.MAP?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Store,{size:"12",className:"mr-1.5"})," ",t.BodyHTML&&t.Title&&t.MAP?"Shopify Ready":"Not Shopify Ready"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"MPN"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.MPN||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"UPC"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.UPC||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Unit Weight"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.UnitWeight?`${formatNumber(t.UnitWeight)} lbs`:"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"text-sm text-muted-foreground",children:["MAP",jsxRuntime.jsx("span",{className:"text-primary",children:" / "}),"MSRP"]}),jsxRuntime.jsxs("div",{className:"font-medium",children:[t.MAP?formatMoney(t.MAP):"N/A",jsxRuntime.jsx("span",{className:"text-primary",children:" / "}),t.MSRP?formatMoney(t.MSRP):"N/A"]})]}),!!t.OverallPercentileRank&&!!t.ManufacturerPercentileRank&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"Bestseller Status"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("span",{children:"Global: "}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Badge,{variant:"outline",className:`rounded-full px-3 w-fit ${Ut(t.OverallPercentileRank).bgColor} ${Ut(t.OverallPercentileRank).color} hover:${Ut(t.OverallPercentileRank).bgColor}`,children:Ut(t.OverallPercentileRank).label})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["Percentile Rank: ",t.OverallPercentileRank]})})]})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("span",{children:[t.ManufacturerName,": "]}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Badge,{variant:"outline",className:`rounded-full px-3 w-fit ${Ut(t.ManufacturerPercentileRank).bgColor} ${Ut(t.ManufacturerPercentileRank).color} hover:${Ut(t.ManufacturerPercentileRank).bgColor}`,children:Ut(t.ManufacturerPercentileRank).label})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["Percentile Rank: ",t.ManufacturerPercentileRank]})})]})})]})]})]}),t.CountryCodeOfOrigin&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Origin"}),jsxRuntime.jsxs("div",{className:"font-medium flex items-center",children:[jsxRuntime.jsx(CountryFlag,{countryCode:t.CountryCodeOfOrigin,className:"mr-2"}),t.CountryCodeOfOrigin]})]})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col @[36rem]:order-2 order-1 items-center",children:jsxRuntime.jsx(ProductImage,{randmarSKU:t.RandmarSKU||"",alt:t.RandmarTitle||"",sceneName:t.SceneName},`product_image_${t.RandmarSKU}`)})]}),jsxRuntime.jsx("div",{className:"flex flex-col @[36rem]:flex-row gap-6 mt-4",children:jsxRuntime.jsx("div",{className:"flex flex-1 @[36rem]:order-1 order-2",children:Qt&&t.Distribution&&jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx("div",{className:"flex items-center",children:"You have "+on.length+(on.length>1?" opportunities":" opportunity")+" for this product:"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsx("div",{className:"space-y-2 max-h-[200px] overflow-y-auto p-2 mt-1",children:on.map((Xt,xn)=>{const Rn=dn(Xt);return isOpportunitySelectable(Xt)?jsxRuntime.jsxs("div",{className:`flex justify-between items-center rounded-lg transition-colors py-2 px-4 border border-muted cursor-pointer ${Xt.BidNumber==V?.BidNumber?"bg-purple-100 border-2 border-purple-900":"bg-white border-1 border-purple-600 hover:bg-purple-200"}`,onClick:()=>{Ve(Xt.BidNumber!==V?.BidNumber?Xt:null)},children:[jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"font-medium text-sm",children:Xt.Opportunity}),jsxRuntime.jsx("span",{className:"text-xs text-neutral-900",children:Xt.BidNumber})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsx("span",{className:"font-semibold",children:formatMoney(Xt.Price??0)}),Xt.Rebate&&Xt.Rebate>0&&jsxRuntime.jsxs("span",{className:"text-xs text-green-600",children:["Rebate: ",formatMoney(Xt.Rebate)]}),Rn!==null&&jsxRuntime.jsxs("span",{className:"text-xs text-blue-700",children:["Potential Revenue: ",formatMoney(Rn)]}),Xt.EndDate&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral-600",children:["Ends: ",Jt(Xt.EndDate)]})]})]},xn):jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex justify-between items-center rounded-lg transition-colors py-2 px-4 bg-purple-100 border border-muted cursor-pointer !bg-neutral-50 hover:bg-neutral-100",onClick:()=>{Xt.BidNumber&&f(`/${e}/Opportunity/${Xt.ManufacturerId}/${Xt.BidNumber}`)},children:[jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"font-medium text-sm",children:Xt.Opportunity}),jsxRuntime.jsxs("span",{className:"text-xs text-neutral-900",children:[Xt.BidNumber," ",jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs mx-1 h-5 bg-gray-100",children:isOpportunityNotStartedYet(Xt)&&Xt.StartDate?`Starts ${Jt(Xt.StartDate)}`:"Currently unavailable"})]})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsx("span",{className:"font-semibold",children:formatMoney(Xt.Price??0)}),Xt.Rebate&&Xt.Rebate>0&&jsxRuntime.jsxs("span",{className:"text-xs text-green-600",children:["Rebate: ",formatMoney(Xt.Rebate)]}),Rn!==null&&jsxRuntime.jsxs("span",{className:"text-xs text-blue-700",children:["Potential Revenue: ",formatMoney(Rn)]}),Xt.EndDate&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral-600",children:["Ends: ",Jt(Xt.EndDate)]})]})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"View Opportunity"})})]},xn)})})})]})})})]}),jsxRuntime.jsxs("div",{className:"mt-4 flex flex-col gap-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-row flex-wrap justify-between items-end gap-4",children:[jsxRuntime.jsx("div",{className:"flex flex-col gap-3 flex-1",children:t.Distribution&&jsxRuntime.jsx("div",{className:"flex flex-col gap-1",children:dt>0?jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs("span",{className:"text-2xl font-bold whitespace-nowrap",children:["Cost: ",formatMoney(dt)]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap",children:[Rt>0&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("span",{className:"text-2xl font-bold whitespace-nowrap",children:formatMoney((V?t.Opportunities?.find(Xt=>Xt.BidNumber==V.BidNumber)?.Price:yt)??0)})}),Ye>0&&jsxRuntime.jsx("span",{className:"text-muted-foreground line-through ml-2 whitespace-nowrap",children:formatMoney(Rt)})]}),Ye>0&&jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs(Badge,{variant:"outline",className:"bg-red-50 text-red-700 rounded-full px-3 whitespace-nowrap",children:[jsxRuntime.jsxs("span",{children:[Ye,"% OFF"]}),t.InstantRebate?.EndDate&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",t.InstantRebate.EndDate.split("T")[0]]}),V?.EndDate&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",V.EndDate.split("T")[0]]})]})})]})})}),jsxRuntime.jsxs("div",{className:"flex flex-col justify-center @[36rem]:justify-end items-end gap-2 w-full @[36rem]:w-auto",children:[l&&jsxRuntime.jsx(Button$1,{className:"gap-2 whitespace-nowrap bg-green-600 hover:bg-green-700",onClick:bn,disabled:et,children:et?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Sync to Shopify"]})}),c,typeof a<"u"&&jsxRuntime.jsxs("div",{className:"flex gap-2 whitespace-nowrap",children:[jsxRuntime.jsxs("div",{className:"flex items-center border rounded-md",children:[jsxRuntime.jsx(Button$1,{variant:"ghost",size:"icon",className:"rounded-r-none",onClick:yn,disabled:typeof R<"u"&&(R<=1||!t.AvailableToBuy||o),children:"-"}),jsxRuntime.jsx("input",{value:R,onChange:mn,onBlur:en,onClick:Xt=>Xt.currentTarget.select(),className:`w-6 @[36rem]:w-12 text-center border-0 focus:ring-0 focus:outline-none ${!t.AvailableToBuy||o?"text-gray-400":""}`,disabled:!t.AvailableToBuy||o}),jsxRuntime.jsx(Button$1,{variant:"ghost",size:"icon",className:"rounded-l-none",onClick:Zt,disabled:!t.AvailableToBuy||o,children:"+"})]}),jsxRuntime.jsx(Button$1,{className:"gap-2 whitespace-nowrap",onClick:qt,disabled:!t.AvailableToBuy||o,children:o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Adding..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Add to Cart"]})})]})]})]}),jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-2 @[36rem]:flex-row",children:[jsxRuntime.jsx("div",{className:"flex-1 min-w-[10rem]",children:jsxRuntime.jsxs(Button$1,{variant:"outline",type:"button",className:"h-11 px-4 text-sm font-medium justify-start w-full",onClick:()=>ct(!0),disabled:!Mt,children:[jsxRuntime.jsx(ChartLine,{className:"mr-2"}),"View statistics"]})}),jsxRuntime.jsx("div",{className:"flex-1 min-w-[10rem]",children:jsxRuntime.jsx(ProductInventoryButton,{applicationId:e??"",randmarSku:t.RandmarSKU??"",inventory:t.Distribution?.Inventory,buttonSize:"lg",buttonClassName:"w-full h-11 justify-start"})}),n&&jsxRuntime.jsx(reactRouterDom.Link,{to:n,className:"flex-1 min-w-[10rem]",children:jsxRuntime.jsxs(Button$1,{variant:"outline",className:"h-11 px-4 text-sm font-medium justify-start w-full",children:[jsxRuntime.jsx(Eye,{className:"mr-2"}),"View Product"]})})]})]})]})}),jsxRuntime.jsx(Dialog,{open:ot,onOpenChange:ct,children:jsxRuntime.jsxs(DialogContent,{className:"w-[min(95vw,1100px)] max-w-5xl space-y-6",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Monthly Sales Performance"}),jsxRuntime.jsxs(DialogDescription,{children:["Expanded product insights for ",sn,tn?` (SKU ${tn})`:""]})]}),jsxRuntime.jsx("div",{className:"space-y-6",children:mt?jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(AlertTitle,{children:"Unable to load details"}),jsxRuntime.jsx(AlertDescription,{children:mt})]}):jsxRuntime.jsxs("div",{className:"rounded-xl border bg-background p-4",children:[jsxRuntime.jsxs("div",{className:"mb-4 space-y-2",children:[jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Rolling 12-month sales dollars and units sold pulled from the detailed endpoint."}),Ht&&jsxRuntime.jsx("div",{"aria-live":"polite","aria-busy":"true",children:jsxRuntime.jsx(Progress,{value:Dt,className:"h-2 w-full animate-pulse","aria-label":"Loading performance data"})})]}),jsxRuntime.jsx(SalesChart,{statistics:Yt,mode:"month",chartHeight:320}),Ht&&jsxRuntime.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Gathering product summary and sales statistics..."})]})})]})})]})}const complexComponents=[`----
|
|
521
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return codePointToString(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var n=this.pos-1;this.invalidStringToken(n,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var s=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],a=parseInt(s,8);return a>255&&(s=s.slice(0,-1),a=parseInt(s,8)),this.pos+=s.length-1,t=this.input.charCodeAt(this.pos),(s!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-s.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(a)}return isNewLine(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},pp.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return n===null&&this.invalidStringToken(t,"Bad character escape sequence"),n},pp.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,n=this.pos,s=this.options.ecmaVersion>=6;this.pos<this.input.length;){var a=this.fullCharCodeAtPos();if(isIdentifierChar(a,s))this.pos+=a<=65535?1:2;else if(a===92){this.containsEsc=!0,e+=this.input.slice(n,this.pos);var o=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var l=this.readCodePoint();(t?isIdentifierStart:isIdentifierChar)(l,s)||this.invalidStringToken(o,"Invalid Unicode escape"),e+=codePointToString(l),n=this.pos}else break;t=!1}return e+this.input.slice(n,this.pos)},pp.readWord=function(){var e=this.readWord1(),t=types$1.name;return this.keywords.test(e)&&(t=keywords[e]),this.finishToken(t,e)};var version="8.12.1";Parser.acorn={Parser,version,defaultOptions,Position,SourceLocation,getLineInfo,Node:Node$2,TokenType,tokTypes:types$1,keywordTypes:keywords,TokContext,tokContexts:types,isIdentifierChar,isIdentifierStart,Token,isNewLine,lineBreak,lineBreakG,nonASCIIwhitespace};var AcornJSX=__toESM(require_acorn_jsx()),attributeNames_default={acceptcharset:"acceptCharset",accesskey:"accessKey",allowfullscreen:"allowFullScreen",autocapitalize:"autoCapitalize",autocomplete:"autoComplete",autofocus:"autoFocus",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",class:"className",colspan:"colSpan",contenteditable:"contentEditable",crossorigin:"crossOrigin",datetime:"dateTime",enctype:"encType",for:"htmlFor",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",httpequiv:"httpEquiv",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",radiogroup:"radioGroup",readonly:"readOnly",referrerpolicy:"referrerPolicy",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap"},VOID_ELEMENTS=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"],NO_WHITESPACE=["table","tbody","tfoot","thead","tr"];function canHaveChildren(e){return VOID_ELEMENTS.indexOf(e.toLowerCase())===-1}function canHaveWhitespace(e){return NO_WHITESPACE.indexOf(e.toLowerCase())!==-1}class NullishShortCircuit extends Error{constructor(t="Nullish value encountered"){super(t),this.name="NullishShortCircuit"}}var hash=(e="",t=16)=>{const n=String(e);let s=0;return n.split("").forEach(a=>{s=(s<<5)-s+a.charCodeAt(0),s&=s}),Math.abs(s).toString(t)},randomHash=()=>hash(Math.random().toString()),camelCase=e=>e.replace(/([A-Z])([A-Z])/g,"$1 $2").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[^a-zA-Z\u00C0-\u00ff]/g," ").toLowerCase().split(" ").filter(t=>t).map((t,n)=>n>0?t[0].toUpperCase()+t.slice(1):t).join(""),parseStyle=e=>{switch(typeof e){case"string":return e.split(";").filter(t=>t).reduce((t,n)=>{const s=n.slice(0,n.indexOf(":")).trim(),a=n.slice(n.indexOf(":")+1).trim();return{...t,[camelCase(s)]:a}},{});case"object":return e;default:return}},pathToArrayPath=e=>e==null||e===""?[]:e.split("."),resolveArrayPath=(e,t)=>{const[n,...s]=t;if(!(e==null||n==null))return s.length===0?e[n]:resolveArrayPath(e[n],s)},resolvePath=(e,t)=>resolveArrayPath(e,pathToArrayPath(t));function handleNaN(e){return Number.isNaN(e)?"NaN":e}class JsxParser extends React.Component{static displayName="JsxParser";static defaultProps={allowUnknownElements:!0,autoCloseVoidElements:!1,bindings:{},blacklistedAttrs:[/^on.+/i],blacklistedTags:["script"],className:"",components:{},componentsOnly:!1,disableFragments:!1,disableKeyGeneration:!1,jsx:"",onError:()=>{},showWarnings:!1,renderError:void 0,renderInWrapper:!0,renderUnrecognized:()=>null};ParsedChildren=null;#r=t=>{const n=Parser.extend(AcornJSX.default({autoCloseVoidElements:this.props.autoCloseVoidElements})),s=`<root>${t}</root>`;let a=[];try{return a=n.parse(s,{ecmaVersion:"latest"}),a=a.body[0].expression.children||[],a.map(o=>this.#e(o)).filter(Boolean)}catch(o){return this.props.showWarnings&&console.warn(o),this.props.onError&&this.props.onError(o),this.props.renderError?this.props.renderError({error:String(o)}):null}};#e=(t,n)=>{switch(t.type){case"JSXAttribute":return t.value===null?!0:this.#e(t.value,n);case"JSXElement":case"JSXFragment":return this.#n(t,n);case"JSXExpressionContainer":return this.#e(t.expression,n);case"JSXText":const s=this.props.disableKeyGeneration?void 0:randomHash();return this.props.disableFragments?t.value:React.createElement(React.Fragment,{key:s},t.value);case"ArrayExpression":return t.elements.map(A=>this.#e(A,n));case"BinaryExpression":const a=this.#e(t.left,n),o=this.#e(t.right,n);let l;switch(t.operator){case"-":l=a-o;break;case"!=":l=a!=o;break;case"!==":l=a!==o;break;case"*":l=a*o;break;case"**":l=a**o;break;case"/":l=a/o;break;case"%":l=a%o;break;case"+":l=a+o;break;case"<":l=a<o;break;case"<=":l=a<=o;break;case"==":l=a==o;break;case"===":l=a===o;break;case">":l=a>o;break;case">=":l=a>=o;break;default:this.props.onError(new Error(`Unsupported binary operator: ${t.operator}`));return}return handleNaN(l);case"CallExpression":const c=this.#e(t.callee,n);if(c===void 0){if(t.optional)throw new NullishShortCircuit;this.props.onError(new Error(`The expression '${t.callee}' could not be resolved, resulting in an undefined return value.`));return}return c(...t.arguments.map(A=>this.#e(A,n)));case"ConditionalExpression":return this.#e(t.test,n)?this.#e(t.consequent,n):this.#e(t.alternate,n);case"ExpressionStatement":return this.#e(t.expression,n);case"Identifier":return t.name==="Infinity"?1/0:t.name==="-Infinity"?-1/0:t.name==="NaN"?NaN:n&&t.name in n?handleNaN(n[t.name]):handleNaN((this.props.bindings||{})[t.name]);case"Literal":return t.value;case"LogicalExpression":const f=this.#e(t.left,n);return t.operator==="||"&&f?f:t.operator==="&&"&&f||t.operator==="||"&&!f?this.#e(t.right,n):!1;case"MemberExpression":return this.#s(t,n);case"ChainExpression":return this.#i(t,n);case"ObjectExpression":const g={};return t.properties.forEach(A=>{g[A.key.name||A.key.value]=this.#e(A.value,n)}),g;case"TemplateElement":return t.value.cooked;case"TemplateLiteral":return[...t.expressions,...t.quasis].sort((A,V)=>A.start<V.start?-1:1).map(A=>this.#e(A,n)).join("");case"UnaryExpression":const R=this.#e(t.argument,n);switch(t.operator){case"+":return+R;case"-":return-R;case"!":return!R;case"~":return~R;case"typeof":return typeof R}return;case"ArrowFunctionExpression":return(t.async||t.generator)&&this.props.onError?.(new Error("Async and generator arrow functions are not supported.")),(...A)=>{const V={...n};return t.params.forEach((Ve,Ye)=>{V[Ve.name]=A[Ye]}),this.#e(t.body,V)};default:this.props.onError(new Error(`The expression type '${t.type}' is not supported.`));return}};#i=(t,n)=>{try{return this.#e(t.expression,n)}catch(s){if(s instanceof NullishShortCircuit)return;throw s}};#s=(t,n)=>{const s=this.#e(t.object,n);let a;if(t.computed)a=this.#e(t.property,n);else if(t.property.type==="Identifier")a=t.property.name;else{this.props.onError(new Error("Only simple MemberExpressions are supported."));return}if(s==null&&t.optional)throw new NullishShortCircuit;let o;try{o=s[a]}catch{this.props.onError(new Error(`The property '${a}' could not be resolved on the object '${s}'.`));return}return typeof o=="function"?o.bind(s):o};#t=t=>t.type==="JSXIdentifier"?t.name:`${this.#t(t.object)}.${this.#t(t.property)}`;#n=(t,n)=>{const{allowUnknownElements:s,components:a,componentsOnly:o,onError:l}=this.props,{children:c=[]}=t,f=t.type==="JSXElement"?t.openingElement:t.openingFragment,{attributes:g=[]}=f,R=t.type==="JSXElement"?this.#t(f.name):"",A=(this.props.blacklistedAttrs||[]).map(st=>st instanceof RegExp?st:new RegExp(st,"i")),V=(this.props.blacklistedTags||[]).map(st=>st.trim().toLowerCase()).filter(Boolean);if(/^(html|head|body)$/i.test(R))return c.map(st=>this.#n(st,n));const Ve=R.trim().toLowerCase();if(V.indexOf(Ve)!==-1)return l(new Error(`The tag <${R}> is blacklisted, and will not be rendered.`)),null;if(R!==""&&!resolvePath(a,R)){if(o)return l(new Error(`The component <${R}> is unrecognized, and will not be rendered.`)),this.props.renderUnrecognized(R);if(!s&&document.createElement(R)instanceof HTMLUnknownElement)return l(new Error(`The tag <${R}> is unrecognized in this browser, and will not be rendered.`)),this.props.renderUnrecognized(R)}let Ye,nt=t.type==="JSXElement"?resolvePath(a,R):React.Fragment;if(nt||canHaveChildren(R)){if(Ye=c.map(ot=>this.#e(ot,n)),R.includes(".")){const ct=R.split(".").reduce((lt,at)=>lt?lt[at]:a?.[at],null);ct&&(nt=ct)}!nt&&!canHaveWhitespace(R)&&(Ye=Ye.filter(ot=>typeof ot!="string"||!/^\s*$/.test(ot)));const st=Ye.find(ot=>typeof ot=="function");Ye.length===0?Ye=void 0:st?Ye=st:Ye.length===1?[Ye]=Ye:Ye.length>1&&!this.props.disableKeyGeneration&&(Ye=Ye.map((ot,ct)=>ot?.type&&!ot?.key?{...ot,key:ot.key||ct}:ot))}const et={key:this.props.disableKeyGeneration?void 0:randomHash()};g.forEach(st=>{if(st.type==="JSXAttribute"){const ot=st.name.name,ct=attributeNames_default[ot]||ot,lt=this.#e(st,n);A.filter(ut=>ut.test(ct)).length===0&&(et[ct]=lt)}else if(st.type==="JSXSpreadAttribute"&&st.argument.type==="Identifier"||st.argument.type==="MemberExpression"){const ot=this.#e(st.argument,n);typeof ot=="object"&&Object.keys(ot).forEach(ct=>{const lt=attributeNames_default[ct]||ct;A.filter(ut=>ut.test(lt)).length===0&&(et[lt]=ot[ct])})}}),typeof et.style=="string"&&(et.style=parseStyle(et.style));const rt=R.toLowerCase();return rt==="option"&&(Ye=Ye.props.children),React.createElement(nt||rt,et,Ye)};render(){const t=(this.props.jsx||"").trim().replace(/<!DOCTYPE([^>]*)>/g,"");this.ParsedChildren=this.#r(t);const n=[...new Set(["jsx-parser",...String(this.props.className).split(" ")])].filter(Boolean).join(" ");return this.props.renderInWrapper?React.createElement("div",{className:n},this.ParsedChildren):this.ParsedChildren}}var source_default=JsxParser;const CountryFlag=({countryCode:e,className:t=""})=>{const[n,s]=React.useState(null),[a,o]=React.useState(!1);return React.useEffect(()=>{if(!e)return;const c=`https://purecatamphetamine.github.io/country-flag-icons/3x2/${e.toUpperCase()}.svg`;fetch(c,{method:"HEAD"}).then(f=>{f.ok?(s(c),o(!1)):o(!0)}).catch(()=>{o(!0)})},[e]),a||!n?jsxRuntime.jsx("span",{className:t,children:e}):jsxRuntime.jsx("img",{src:n,alt:`${e} flag`,className:`inline-block ${t}`,style:{width:"24px",height:"auto"}})},imgSizeMap$1={sm:100,md:200,lg:300,xl:400};function getApiOriginFromSwaggerJsonUrl(e){try{return new URL(e).origin}catch{return"https://api.randmar.io"}}async function fetchProductImagesList({apiOrigin:e,randmarSKU:t,signal:n}){const s=new URL(`/Product/${encodeURIComponent(t)}/Images`,e),a=await fetch(s.toString(),{method:"GET",credentials:"omit",headers:{Accept:"application/json"},signal:n});if(!a.ok)throw new Error(`Failed to load images list for ${t}: ${a.status}`);const o=await a.json();return Array.isArray(o)?o:o&&typeof o=="object"&&"Images"in o&&Array.isArray(o.Images)?o.Images:[]}function buildImageSrc({apiOrigin:e,randmarSKU:t,image:n,width:s,height:a}){const o=(n.Url??"").trim();if(o)return o;const l=new URL(`/Product/${encodeURIComponent(t)}/Image/${encodeURIComponent(String(n.ImageId))}`,e);return l.searchParams.set("width",String(Math.round(s))),l.searchParams.set("height",String(Math.round(a))),l.toString()}const Placeholder$1=({size:e,alt:t})=>jsxRuntime.jsx("div",{className:"rounded-md bg-muted flex items-center justify-center",style:{width:e,height:e},"aria-label":t,children:jsxRuntime.jsx(ImageOff,{className:"h-1/2 w-1/2 text-muted-foreground"})});function ProductImageCarousel({randmarSKU:e,size:t="md",alt:n,className:s,fallback:a}){const o=imgSizeMap$1[t],l=React__namespace.useRef(null),c=useIntersectionObserver({elementRef:l,threshold:.1,rootMargin:"100px"}),f=useRandmarApiConfig(),g=React__namespace.useMemo(()=>getApiOriginFromSwaggerJsonUrl(f.swaggerJsonUrl),[f.swaggerJsonUrl]),[R,A]=React__namespace.useState(null),[V,Ve]=React__namespace.useState(!1),[Ye,nt]=React__namespace.useState(0),et=React__namespace.useRef(!1),rt=React__namespace.useRef(new Set);React__namespace.useEffect(()=>{A(null),Ve(!1),nt(0),et.current=!1,rt.current.clear()},[e]),React__namespace.useEffect(()=>{if(!e||!c||R!==null||V)return;const yt=new AbortController;return(async()=>{try{const Mt=await fetchProductImagesList({apiOrigin:g,randmarSKU:e,signal:yt.signal});A(Mt)}catch(Mt){if(yt.signal.aborted)return;console.error("Failed to load product images list",{randmarSKU:e,error:Mt}),Ve(!0)}})(),()=>yt.abort()},[g,V,R,c,e]);const st=React__namespace.useMemo(()=>R?[...R].sort((yt,Mt)=>{const Ut=yt.SortOrder??Number.POSITIVE_INFINITY,Ht=Mt.SortOrder??Number.POSITIVE_INFINITY;if(Ut!==Ht)return Ut-Ht;const Dt=yt.IsPrimary===!0?0:1,$t=Mt.IsPrimary===!0?0:1;return Dt-$t}):null,[R]),ot=React__namespace.useMemo(()=>{if(!st?.length)return 0;const yt=st.findIndex(Mt=>Mt.IsPrimary===!0);return yt>=0?yt:0},[st]);React__namespace.useEffect(()=>{st?.length&&(et.current||(nt(ot),et.current=!0))},[ot,st]);const ct=st?.length??0,lt=React__namespace.useMemo(()=>{const yt=(n??"").trim();return yt?`${yt} (Product ${e})`:`Product ${e}`},[n,e]),at=React__namespace.useCallback(yt=>ct>1?`${lt} image ${yt+1}`:lt,[lt,ct]),ut=st?.[Ye],ft=React__namespace.useMemo(()=>ut?buildImageSrc({apiOrigin:g,randmarSKU:e,image:ut,width:o*1.5,height:o*1.5}):null,[ut,g,o,e]),mt=React__namespace.useCallback(yt=>{if(ct<=0)return;const Mt=(yt%ct+ct)%ct;nt(Mt)},[ct]),Ct=React__namespace.useCallback(()=>mt(Ye-1),[Ye,mt]),It=React__namespace.useCallback(()=>mt(Ye+1),[Ye,mt]),dt=React__namespace.useCallback(yt=>{if(!(ct<=1))switch(yt.key){case"ArrowLeft":yt.preventDefault(),Ct();break;case"ArrowRight":yt.preventDefault(),It();break;case"Home":yt.preventDefault(),mt(0);break;case"End":yt.preventDefault(),mt(ct-1);break}},[It,Ct,mt,ct]);return React__namespace.useEffect(()=>{if(!st?.length||ct<=1)return;const yt=(Ye-1+ct)%ct,Mt=(Ye+1)%ct,Ut=[yt,Mt];for(const Ht of Ut){const Dt=st[Ht];if(!Dt)continue;const $t=buildImageSrc({apiOrigin:g,randmarSKU:e,image:Dt,width:o*1.5,height:o*1.5});if(rt.current.has($t))continue;rt.current.add($t);const Yt=new Image;Yt.src=$t}},[Ye,g,o,e,ct,st]),V?jsxRuntime.jsx(jsxRuntime.Fragment,{children:a??null}):R===null&&c?jsxRuntime.jsx("div",{className:s,ref:l,children:jsxRuntime.jsx(Skeleton,{className:"rounded-md",style:{width:o,height:o}})}):st&&st.length===0?jsxRuntime.jsx("div",{className:s,ref:l,children:jsxRuntime.jsx(Placeholder$1,{size:o,alt:lt})}):ft?jsxRuntime.jsx("div",{className:s,ref:l,children:jsxRuntime.jsxs("div",{className:"relative rounded-md overflow-hidden bg-muted",style:{width:o,height:o},role:"region","aria-roledescription":"carousel","aria-label":`Product images for ${e}`,tabIndex:ct>1?0:-1,onKeyDown:dt,children:[jsxRuntime.jsx("img",{alt:at(Ye),className:"w-full h-full object-contain",src:ft,width:o,height:o,loading:"eager"}),ct>1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Button$1,{type:"button",variant:"secondary",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2",onClick:Ct,"aria-label":"Previous image",children:jsxRuntime.jsx(ChevronLeft,{className:"h-4 w-4"})}),jsxRuntime.jsx(Button$1,{type:"button",variant:"secondary",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2",onClick:It,"aria-label":"Next image",children:jsxRuntime.jsx(ChevronRight,{className:"h-4 w-4"})}),jsxRuntime.jsx("div",{className:"absolute bottom-2 left-1/2 -translate-x-1/2 flex items-center gap-1 rounded-full bg-white/80 px-2 py-1",children:Array.from({length:ct}).map((yt,Mt)=>{const Ut=Mt===Ye;return jsxRuntime.jsx("button",{type:"button",className:["h-1.5 w-1.5 rounded-full transition-colors",Ut?"bg-neutral-900":"bg-neutral-300 hover:bg-neutral-400"].join(" "),onClick:()=>mt(Mt),"aria-label":`Go to image ${Mt+1} of ${ct}`,"aria-current":Ut?"true":void 0},Mt)})})]})]})}):jsxRuntime.jsx("div",{className:s,ref:l,children:jsxRuntime.jsx(Placeholder$1,{size:o,alt:lt})})}const getTodayIsoDate=()=>new Date().toISOString().split("T")[0],isOpportunityNotStartedYet=e=>e.StartDate?e.StartDate.split("T")[0]>getTodayIsoDate():!1,isOpportunitySelectable=e=>{if(e.Active!==!0)return!1;const t=getTodayIsoDate();return!(e.EndDate&&e.EndDate.split("T")[0]<t||e.StartDate&&e.StartDate.split("T")[0]>t)};function ProductCard({applicationId:e,product:t,viewProductLink:n,defaultOpportunityNumber:s="",onAddToCart:a,addingToCart:o=!1,shopifyHostname:l,customAction:c=jsxRuntime.jsx(jsxRuntime.Fragment,{})}){const f=reactRouterDom.useNavigate(),{toast:g}=useToast(),[R,A]=React.useState(1),[V,Ve]=React.useState(null),[Ye,nt]=React.useState(0),[et,rt]=React.useState(!1),[st]=usePostV4ResellerByRouteResellerIdProductAndRandmarSkuShopifyMutation(),[ot,ct]=React.useState(!1),[lt,at]=React.useState(null),[ut,ft]=React.useState("idle"),[mt,Ct]=React.useState(null),[It]=useLazyGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery(),dt=t?.Distribution?.Cost||0,Rt=t?.Distribution?.RegularPrice||0,yt=t?.Distribution?.Price||0,Mt=!!(e&&t?.RandmarSKU);React.useEffect(()=>{A(1),Ve(null),nt(0)},[t?.RandmarSKU]),React.useEffect(()=>{if(t&&s){const Xt=t.Opportunities?.find(xn=>xn.BidNumber==s);Xt&&isOpportunitySelectable(Xt)&&Ve(Xt)}},[t,s]),React.useEffect(()=>{if(!t)return;const Xt=V?.Price?V.Price:yt;nt(Rt>0?Math.round((Rt-Xt)/Rt*100):0)},[t,V,yt,Rt]),React.useEffect(()=>{o||A(1)},[o]),React.useEffect(()=>{if(!ot){at(null),ft("idle"),Ct(null);return}if(!e||!t?.RandmarSKU){ft("error"),Ct("Missing identifiers to load performance data.");return}let Xt=!1;const xn=t.RandmarSKU;return(async()=>{ft("summary"),Ct(null);try{const Cn=await It({routeApplicationId:e,randmarSku:xn,withSpecification:!1});if(Xt)return;if("error"in Cn&&Cn.error)throw Cn.error;at(Cn.data??null),ft("detailed");const In=await It({routeApplicationId:e,randmarSku:xn,withSpecification:!0});if(Xt)return;if("error"in In&&In.error)throw In.error;at(In.data??Cn.data??null),ft("complete")}catch(Cn){if(Xt)return;console.error("Failed to load performance data for product modal",Cn),ft("error"),Ct("We couldn't load the performance details. Please try again.")}})(),()=>{Xt=!0}},[e,It,ot,t?.RandmarSKU]);const Ut=Xt=>Xt>=90?{label:"Top 10% Bestseller",color:"text-purple-950",bgColor:"bg-purple-200"}:Xt>=75?{label:"Bestseller",color:"text-blue-700",bgColor:"bg-blue-50"}:Xt>=33?{label:"Popular",color:"text-green-700",bgColor:"bg-green-50"}:{label:"Rising",color:"text-gray-700",bgColor:"bg-white"},Ht=ut!=="complete"&&ut!=="error",Dt=ut==="summary"?40:ut==="detailed"?80:10,$t=lt?.SalesStatistics??[],Yt=Ht?[]:$t,sn=lt?.RandmarTitle??t?.RandmarTitle??t?.RandmarSKU??"this product",tn=lt?.RandmarSKU??t?.RandmarSKU,an=e&&t?.ManufacturerId?`/${encodeURIComponent(e)}/Partner/${encodeURIComponent(t.ManufacturerId)}?tab=manufacturer-overview`:null;if(!t)return jsxRuntime.jsx(Card,{className:"flex h-full w-full flex-col",children:jsxRuntime.jsxs(CardContent,{className:"flex h-full flex-col p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx("div",{className:"h-10 w-24 flex items-center justify-end ml-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"})})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-28 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex gap-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-6 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col",children:jsxRuntime.jsx("div",{className:"w-60 h-40",children:jsxRuntime.jsx(Skeleton,{className:"w-full h-full rounded-lg"})})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsx("div",{className:"flex flex-1",children:jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24 mb-3"}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-full rounded-md"})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-32 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 mt-4"})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-start gap-1 mb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-10 flex-1 rounded-md"})]})]})]})});const on=t?.Opportunities||[],Qt=on.length>0,yn=()=>{if(R==null){A(1);return}R>1&&A(R-1)},Zt=()=>{if(R==null){A(1);return}A(R+1)},mn=Xt=>{const xn=Number.parseInt(Xt.target.value,10);if(!isNaN(xn)&&xn>0){A(xn);return}A(void 0)},en=()=>{(R==null||R<1)&&A(1)},Jt=Xt=>{try{return new Date(Xt).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch(xn){return console.error(xn),Xt.split("T")[0]||"N/A"}},dn=Xt=>{const xn=typeof t?.MSRP=="number"&&t.MSRP>0?t.MSRP:typeof t?.MAP=="number"&&t.MAP>0?t.MAP:null;if(xn===null)return null;const Rn=Xt.Price??t?.Distribution?.Price;if(typeof Rn!="number")return null;const Cn=Xt.Rebate??0,In=Math.max(Rn-Cn,0);return xn-In},qt=()=>{typeof a<"u"&&a({quantity:R??1,bidNumber:V?.BidNumber??null})},bn=()=>{et||!l||(rt(!0),st({routeResellerId:e??"",randmarSku:t.RandmarSKU??"",shopifyHostName:l}).then(Xt=>{if(Xt.error){console.error("Error syncing to Shopify:",Xt.error),g({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"});return}g({title:"Product synced",description:"Product synced to Shopify successfully",variant:"success"})}).catch(Xt=>{console.error("Error syncing to Shopify:",Xt),g({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"})}).finally(()=>{rt(!1)}))};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Card,{className:"flex h-full w-full flex-col hover:shadow-lg transition-shadow @container",children:jsxRuntime.jsxs(CardContent,{className:"flex h-full flex-col p-6",children:[jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col gap-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-3",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-xl",children:t.Title||t.RandmarTitle}),jsxRuntime.jsx("div",{className:"w-24 h-10 flex items-center justify-end ml-4 flex-shrink-0",children:an?jsxRuntime.jsx(reactRouterDom.Link,{to:an,"aria-label":`Open manufacturer overview for ${t.ManufacturerName??"this manufacturer"}`,className:"block h-full w-full",children:jsxRuntime.jsx(PartnerLogo,{id:t.ManufacturerId,name:t.ManufacturerName,width:96,height:40,className:"cursor-pointer"},`partner_logo_${t.ManufacturerId}`)}):jsxRuntime.jsx(PartnerLogo,{id:t.ManufacturerId,name:t.ManufacturerName,width:96,height:40},`partner_logo_${t.ManufacturerId}`)})]}),jsxRuntime.jsxs("div",{className:"flex flex-col @[36rem]:flex-row gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-1 @[36rem]:order-1 order-2 flex flex-col gap-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 items-center justify-center @[36rem]:items-start @[36rem]:justify-start",children:[t.State&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${t.State==="Active"?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Check,{size:"12",className:"mr-1.5"})," ",t.State]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${t.SerialNumber?"bg-green-50 text-green-700 hover:bg-green-50":"bg-yellow-50 text-yellow-700 hover:bg-yellow-50"}`,children:[jsxRuntime.jsx(QrCode,{size:"12",className:"mr-1.5"})," ",t.SerialNumber?"Serialized":"Unserialized"]}),t.TransparencyCode&&jsxRuntime.jsxs(Badge,{variant:"outline",className:"rounded-full px-3 bg-green-50 text-green-700 hover:bg-green-50",children:[jsxRuntime.jsx(CircleDashed,{size:"12",className:"mr-1.5"})," Transparency Code"]}),t.AvailableToBuy!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${t.AvailableToBuy?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(ShoppingCart,{size:"12",className:"mr-1.5"})," ",t.AvailableToBuy?"Available":"Unavailable"]}),t.ManufacturerCategory!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${t.ManufacturerCategory?.QualificationRequired?"bg-blue-50 text-blue-700 hover:bg-blue-50":"bg-neutral-50 text-neutral-700 hover:bg-neutral-50"}`,children:[jsxRuntime.jsx(ShieldCheck,{size:"12",className:"mr-1.5"})," ",t.ManufacturerCategory?.QualificationRequired?"Qualified Only":"Available to all"]}),t.ManufacturerId&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${t.AutoUpdate?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(RefreshCw,{size:"12",className:"mr-1.5"})," ",t.AutoUpdate?`Automatic Reorder (${t.MasterCarton})`:"Manually Reorders"]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${t.BodyHTML&&t.Title&&t.MAP?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Store,{size:"12",className:"mr-1.5"})," ",t.BodyHTML&&t.Title&&t.MAP?"Shopify Ready":"Not Shopify Ready"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"MPN"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.MPN||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"UPC"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.UPC||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Unit Weight"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.UnitWeight?`${formatNumber(t.UnitWeight)} lbs`:"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"text-sm text-muted-foreground",children:["MAP",jsxRuntime.jsx("span",{className:"text-primary",children:" / "}),"MSRP"]}),jsxRuntime.jsxs("div",{className:"font-medium",children:[t.MAP?formatMoney(t.MAP):"N/A",jsxRuntime.jsx("span",{className:"text-primary",children:" / "}),t.MSRP?formatMoney(t.MSRP):"N/A"]})]}),!!t.OverallPercentileRank&&!!t.ManufacturerPercentileRank&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"Bestseller Status"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("span",{children:"Global: "}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Badge,{variant:"outline",className:`rounded-full px-3 w-fit ${Ut(t.OverallPercentileRank).bgColor} ${Ut(t.OverallPercentileRank).color} hover:${Ut(t.OverallPercentileRank).bgColor}`,children:Ut(t.OverallPercentileRank).label})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["Percentile Rank: ",t.OverallPercentileRank]})})]})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("span",{children:[t.ManufacturerName,": "]}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Badge,{variant:"outline",className:`rounded-full px-3 w-fit ${Ut(t.ManufacturerPercentileRank).bgColor} ${Ut(t.ManufacturerPercentileRank).color} hover:${Ut(t.ManufacturerPercentileRank).bgColor}`,children:Ut(t.ManufacturerPercentileRank).label})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["Percentile Rank: ",t.ManufacturerPercentileRank]})})]})})]})]})]}),t.CountryCodeOfOrigin&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Origin"}),jsxRuntime.jsxs("div",{className:"font-medium flex items-center",children:[jsxRuntime.jsx(CountryFlag,{countryCode:t.CountryCodeOfOrigin,className:"mr-2"}),t.CountryCodeOfOrigin]})]})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col @[36rem]:order-2 order-1 items-center",children:jsxRuntime.jsx(ProductImageCarousel,{randmarSKU:t.RandmarSKU||"",alt:t.RandmarTitle||"",fallback:jsxRuntime.jsx(ProductImage,{randmarSKU:t.RandmarSKU||"",alt:t.RandmarTitle||"",sceneName:t.SceneName},`product_image_fallback_${t.RandmarSKU}`)},`product_image_${t.RandmarSKU}`)})]}),jsxRuntime.jsx("div",{className:"flex flex-col @[36rem]:flex-row gap-6 mt-4",children:jsxRuntime.jsx("div",{className:"flex flex-1 @[36rem]:order-1 order-2",children:Qt&&t.Distribution&&jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx("div",{className:"flex items-center",children:"You have "+on.length+(on.length>1?" opportunities":" opportunity")+" for this product:"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsx("div",{className:"space-y-2 max-h-[200px] overflow-y-auto p-2 mt-1",children:on.map((Xt,xn)=>{const Rn=dn(Xt);return isOpportunitySelectable(Xt)?jsxRuntime.jsxs("div",{className:`flex justify-between items-center rounded-lg transition-colors py-2 px-4 border border-muted cursor-pointer ${Xt.BidNumber==V?.BidNumber?"bg-purple-100 border-2 border-purple-900":"bg-white border-1 border-purple-600 hover:bg-purple-200"}`,onClick:()=>{Ve(Xt.BidNumber!==V?.BidNumber?Xt:null)},children:[jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"font-medium text-sm",children:Xt.Opportunity}),jsxRuntime.jsx("span",{className:"text-xs text-neutral-900",children:Xt.BidNumber})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsx("span",{className:"font-semibold",children:formatMoney(Xt.Price??0)}),Xt.Rebate&&Xt.Rebate>0&&jsxRuntime.jsxs("span",{className:"text-xs text-green-600",children:["Rebate: ",formatMoney(Xt.Rebate)]}),Rn!==null&&jsxRuntime.jsxs("span",{className:"text-xs text-blue-700",children:["Potential Revenue: ",formatMoney(Rn)]}),Xt.EndDate&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral-600",children:["Ends: ",Jt(Xt.EndDate)]})]})]},xn):jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex justify-between items-center rounded-lg transition-colors py-2 px-4 bg-purple-100 border border-muted cursor-pointer !bg-neutral-50 hover:bg-neutral-100",onClick:()=>{Xt.BidNumber&&f(`/${e}/Opportunity/${Xt.ManufacturerId}/${Xt.BidNumber}`)},children:[jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"font-medium text-sm",children:Xt.Opportunity}),jsxRuntime.jsxs("span",{className:"text-xs text-neutral-900",children:[Xt.BidNumber," ",jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs mx-1 h-5 bg-gray-100",children:isOpportunityNotStartedYet(Xt)&&Xt.StartDate?`Starts ${Jt(Xt.StartDate)}`:"Currently unavailable"})]})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsx("span",{className:"font-semibold",children:formatMoney(Xt.Price??0)}),Xt.Rebate&&Xt.Rebate>0&&jsxRuntime.jsxs("span",{className:"text-xs text-green-600",children:["Rebate: ",formatMoney(Xt.Rebate)]}),Rn!==null&&jsxRuntime.jsxs("span",{className:"text-xs text-blue-700",children:["Potential Revenue: ",formatMoney(Rn)]}),Xt.EndDate&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral-600",children:["Ends: ",Jt(Xt.EndDate)]})]})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"View Opportunity"})})]},xn)})})})]})})})]}),jsxRuntime.jsxs("div",{className:"mt-4 flex flex-col gap-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-row flex-wrap justify-between items-end gap-4",children:[jsxRuntime.jsx("div",{className:"flex flex-col gap-3 flex-1",children:t.Distribution&&jsxRuntime.jsx("div",{className:"flex flex-col gap-1",children:dt>0?jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs("span",{className:"text-2xl font-bold whitespace-nowrap",children:["Cost: ",formatMoney(dt)]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap",children:[Rt>0&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("span",{className:"text-2xl font-bold whitespace-nowrap",children:formatMoney((V?t.Opportunities?.find(Xt=>Xt.BidNumber==V.BidNumber)?.Price:yt)??0)})}),Ye>0&&jsxRuntime.jsx("span",{className:"text-muted-foreground line-through ml-2 whitespace-nowrap",children:formatMoney(Rt)})]}),Ye>0&&jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs(Badge,{variant:"outline",className:"bg-red-50 text-red-700 rounded-full px-3 whitespace-nowrap",children:[jsxRuntime.jsxs("span",{children:[Ye,"% OFF"]}),t.InstantRebate?.EndDate&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",t.InstantRebate.EndDate.split("T")[0]]}),V?.EndDate&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",V.EndDate.split("T")[0]]})]})})]})})}),jsxRuntime.jsxs("div",{className:"flex flex-col justify-center @[36rem]:justify-end items-end gap-2 w-full @[36rem]:w-auto",children:[l&&jsxRuntime.jsx(Button$1,{className:"gap-2 whitespace-nowrap bg-green-600 hover:bg-green-700",onClick:bn,disabled:et,children:et?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Sync to Shopify"]})}),c,typeof a<"u"&&jsxRuntime.jsxs("div",{className:"flex gap-2 whitespace-nowrap",children:[jsxRuntime.jsxs("div",{className:"flex items-center border rounded-md",children:[jsxRuntime.jsx(Button$1,{variant:"ghost",size:"icon",className:"rounded-r-none",onClick:yn,disabled:typeof R<"u"&&(R<=1||!t.AvailableToBuy||o),children:"-"}),jsxRuntime.jsx("input",{value:R,onChange:mn,onBlur:en,onClick:Xt=>Xt.currentTarget.select(),className:`w-6 @[36rem]:w-12 text-center border-0 focus:ring-0 focus:outline-none ${!t.AvailableToBuy||o?"text-gray-400":""}`,disabled:!t.AvailableToBuy||o}),jsxRuntime.jsx(Button$1,{variant:"ghost",size:"icon",className:"rounded-l-none",onClick:Zt,disabled:!t.AvailableToBuy||o,children:"+"})]}),jsxRuntime.jsx(Button$1,{className:"gap-2 whitespace-nowrap",onClick:qt,disabled:!t.AvailableToBuy||o,children:o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Adding..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Add to Cart"]})})]})]})]}),jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-2 @[36rem]:flex-row",children:[jsxRuntime.jsx("div",{className:"flex-1 min-w-[10rem]",children:jsxRuntime.jsxs(Button$1,{variant:"outline",type:"button",className:"h-11 px-4 text-sm font-medium justify-start w-full",onClick:()=>ct(!0),disabled:!Mt,children:[jsxRuntime.jsx(ChartLine,{className:"mr-2"}),"View statistics"]})}),jsxRuntime.jsx("div",{className:"flex-1 min-w-[10rem]",children:jsxRuntime.jsx(ProductInventoryButton,{applicationId:e??"",randmarSku:t.RandmarSKU??"",inventory:t.Distribution?.Inventory,buttonSize:"lg",buttonClassName:"w-full h-11 justify-start"})}),n&&jsxRuntime.jsx(reactRouterDom.Link,{to:n,className:"flex-1 min-w-[10rem]",children:jsxRuntime.jsxs(Button$1,{variant:"outline",className:"h-11 px-4 text-sm font-medium justify-start w-full",children:[jsxRuntime.jsx(Eye,{className:"mr-2"}),"View Product"]})})]})]})]})}),jsxRuntime.jsx(Dialog,{open:ot,onOpenChange:ct,children:jsxRuntime.jsxs(DialogContent,{className:"w-[min(95vw,1100px)] max-w-5xl space-y-6",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Monthly Sales Performance"}),jsxRuntime.jsxs(DialogDescription,{children:["Expanded product insights for ",sn,tn?` (SKU ${tn})`:""]})]}),jsxRuntime.jsx("div",{className:"space-y-6",children:mt?jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(AlertTitle,{children:"Unable to load details"}),jsxRuntime.jsx(AlertDescription,{children:mt})]}):jsxRuntime.jsxs("div",{className:"rounded-xl border bg-background p-4",children:[jsxRuntime.jsxs("div",{className:"mb-4 space-y-2",children:[jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Rolling 12-month sales dollars and units sold pulled from the detailed endpoint."}),Ht&&jsxRuntime.jsx("div",{"aria-live":"polite","aria-busy":"true",children:jsxRuntime.jsx(Progress,{value:Dt,className:"h-2 w-full animate-pulse","aria-label":"Loading performance data"})})]}),jsxRuntime.jsx(SalesChart,{statistics:Yt,mode:"month",chartHeight:320}),Ht&&jsxRuntime.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Gathering product summary and sales statistics..."})]})})]})})]})}const complexComponents=[`----
|
|
522
522
|
PartnerCard: For data that fits this shape:
|
|
523
523
|
{ "ApplicationId": "19022", "PublicName": "BiOSS", "VoiceName": null, "VoiceStyle": null, "About": "example", "SceneName": "Kitchen Counter", "IsReseller": true, "IsManufacturer": true, "IsSalesAgency": false, "Socials": [ { "ApplicationId": "19022", "SocialNetwork": "Facebook", "Tag": "@bioss.ca" }, { "ApplicationId": "19022", "SocialNetwork": "Instagram", "Tag": "@bioss.ca" }, { "ApplicationId": "19022", "SocialNetwork": "LinkedIn", "Tag": "@biossinc" }, { "ApplicationId": "19022", "SocialNetwork": "Youtube", "Tag": "@biosssolutionssanitairessa4095" } ], "Manufacturer": null, "Reseller": null }
|
|
524
524
|
Use <PartnerCard account={data} action={<></>}>`,`----
|