randmarcomps 1.188.0 → 1.189.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 +65 -59
- package/dist/randmarcomps.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/randmarcomps.js
CHANGED
|
@@ -59395,6 +59395,27 @@ Ir = new WeakMap(), Ut = new WeakMap(), Mr = new WeakMap(), Nr = new WeakMap(),
|
|
|
59395
59395
|
renderUnrecognized: () => null
|
|
59396
59396
|
});
|
|
59397
59397
|
var source_default = JsxParser;
|
|
59398
|
+
function useIntersectionObserver({
|
|
59399
|
+
elementRef: e,
|
|
59400
|
+
threshold: t = 0,
|
|
59401
|
+
rootMargin: n = "0px"
|
|
59402
|
+
}) {
|
|
59403
|
+
const [o, l] = useState(!1);
|
|
59404
|
+
return useEffect(() => {
|
|
59405
|
+
const d = new IntersectionObserver(
|
|
59406
|
+
([g]) => {
|
|
59407
|
+
l(g.isIntersecting);
|
|
59408
|
+
},
|
|
59409
|
+
{
|
|
59410
|
+
threshold: t,
|
|
59411
|
+
rootMargin: n
|
|
59412
|
+
}
|
|
59413
|
+
), f = e.current;
|
|
59414
|
+
return f && d.observe(f), () => {
|
|
59415
|
+
f && d.unobserve(f);
|
|
59416
|
+
};
|
|
59417
|
+
}, [e, t, n]), o;
|
|
59418
|
+
}
|
|
59398
59419
|
const imgSizeMap = {
|
|
59399
59420
|
sm: 100,
|
|
59400
59421
|
md: 200,
|
|
@@ -59402,39 +59423,46 @@ const imgSizeMap = {
|
|
|
59402
59423
|
xl: 400
|
|
59403
59424
|
};
|
|
59404
59425
|
function ProductImage({ randmarSKU: e, size: t = "md", alt: n, secondaryContent: o }) {
|
|
59405
|
-
const [l, d] = React.useState(!1), [f, g] = React.useState(!1), [b, _] = React.useState(!1), [S, C] = React.useState(!1), E = `https://api.randmar.io/Product/${e}/Video
|
|
59426
|
+
const [l, d] = React.useState(!1), [f, g] = React.useState(!1), [b, _] = React.useState(!1), [S, C] = React.useState(!1), [E, R] = React.useState(!1), M = `https://api.randmar.io/Product/${e}/Video`, I = useRef(null), A = useIntersectionObserver({
|
|
59427
|
+
elementRef: I,
|
|
59428
|
+
threshold: 0.1,
|
|
59429
|
+
// Element is considered visible when 10% is in viewport
|
|
59430
|
+
rootMargin: "100px"
|
|
59431
|
+
// Start loading a bit before it comes into view
|
|
59432
|
+
});
|
|
59406
59433
|
React.useEffect(() => {
|
|
59407
|
-
|
|
59434
|
+
const F = async () => {
|
|
59408
59435
|
try {
|
|
59409
|
-
const
|
|
59410
|
-
g(
|
|
59411
|
-
} catch (
|
|
59412
|
-
console.error("Error checking for video:",
|
|
59436
|
+
const te = await (await fetch(M + "/Exists")).json();
|
|
59437
|
+
g(te);
|
|
59438
|
+
} catch (V) {
|
|
59439
|
+
console.error("Error checking for video:", V), g(!1);
|
|
59413
59440
|
}
|
|
59414
|
-
}
|
|
59415
|
-
|
|
59416
|
-
|
|
59441
|
+
};
|
|
59442
|
+
A && !b && (_(!0), F());
|
|
59443
|
+
}, [e, M, A, b]);
|
|
59444
|
+
async function j() {
|
|
59417
59445
|
if (f) {
|
|
59418
|
-
|
|
59446
|
+
R(!0);
|
|
59419
59447
|
try {
|
|
59420
|
-
const
|
|
59421
|
-
|
|
59422
|
-
} catch (
|
|
59423
|
-
console.error("Error downloading video:",
|
|
59448
|
+
const V = await (await fetch(M)).blob(), te = window.URL.createObjectURL(V), ae = document.createElement("a");
|
|
59449
|
+
ae.href = te, ae.download = `${e || "product"}-video.mp4`, document.body.appendChild(ae), ae.click(), document.body.removeChild(ae), window.URL.revokeObjectURL(te);
|
|
59450
|
+
} catch (F) {
|
|
59451
|
+
console.error("Error downloading video:", F);
|
|
59424
59452
|
} finally {
|
|
59425
|
-
|
|
59453
|
+
R(!1);
|
|
59426
59454
|
}
|
|
59427
59455
|
}
|
|
59428
59456
|
}
|
|
59429
|
-
function
|
|
59430
|
-
navigator.clipboard.writeText(
|
|
59431
|
-
|
|
59457
|
+
function q() {
|
|
59458
|
+
navigator.clipboard.writeText(M), C(!0), setTimeout(() => {
|
|
59459
|
+
C(!1);
|
|
59432
59460
|
}, 2e3);
|
|
59433
59461
|
}
|
|
59434
|
-
function
|
|
59462
|
+
function z() {
|
|
59435
59463
|
d(!0);
|
|
59436
59464
|
}
|
|
59437
|
-
const
|
|
59465
|
+
const Q = imgSizeMap[t || "xl"];
|
|
59438
59466
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
59439
59467
|
/* @__PURE__ */ jsx(Dialog, { open: l, onOpenChange: d, children: /* @__PURE__ */ jsx(DialogContent, { className: "max-w-4xl p-0 overflow-hidden", children: o ? /* @__PURE__ */ jsxs("div", { className: "flex flex-row", children: [
|
|
59440
59468
|
/* @__PURE__ */ jsxs(
|
|
@@ -59446,7 +59474,7 @@ function ProductImage({ randmarSKU: e, size: t = "md", alt: n, secondaryContent:
|
|
|
59446
59474
|
muted: !0,
|
|
59447
59475
|
loop: !0,
|
|
59448
59476
|
children: [
|
|
59449
|
-
/* @__PURE__ */ jsx("source", { src:
|
|
59477
|
+
/* @__PURE__ */ jsx("source", { src: M, type: "video/mp4" }),
|
|
59450
59478
|
"Your browser does not support the video tag."
|
|
59451
59479
|
]
|
|
59452
59480
|
}
|
|
@@ -59454,7 +59482,7 @@ function ProductImage({ randmarSKU: e, size: t = "md", alt: n, secondaryContent:
|
|
|
59454
59482
|
/* @__PURE__ */ jsx("div", { className: "flex-grow min-w-[400px] h-[70vh] p-6", children: o })
|
|
59455
59483
|
] }) : /* @__PURE__ */ jsxs("div", { className: "w-full relative", children: [
|
|
59456
59484
|
/* @__PURE__ */ jsxs("video", { className: "w-full max-h-[720px] object-contain", controls: !0, autoPlay: !0, children: [
|
|
59457
|
-
/* @__PURE__ */ jsx("source", { src:
|
|
59485
|
+
/* @__PURE__ */ jsx("source", { src: M, type: "video/mp4" }),
|
|
59458
59486
|
"Your browser does not support the video tag."
|
|
59459
59487
|
] }),
|
|
59460
59488
|
/* @__PURE__ */ jsxs("div", { className: "absolute top-2 right-12 flex gap-1", children: [
|
|
@@ -59464,8 +59492,8 @@ function ProductImage({ randmarSKU: e, size: t = "md", alt: n, secondaryContent:
|
|
|
59464
59492
|
{
|
|
59465
59493
|
variant: "secondary",
|
|
59466
59494
|
size: "icon",
|
|
59467
|
-
onClick:
|
|
59468
|
-
children:
|
|
59495
|
+
onClick: q,
|
|
59496
|
+
children: S ? /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Copy, { className: "h-4 w-4" })
|
|
59469
59497
|
}
|
|
59470
59498
|
) }),
|
|
59471
59499
|
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Copy video link" }) })
|
|
@@ -59476,8 +59504,8 @@ function ProductImage({ randmarSKU: e, size: t = "md", alt: n, secondaryContent:
|
|
|
59476
59504
|
{
|
|
59477
59505
|
variant: "secondary",
|
|
59478
59506
|
size: "icon",
|
|
59479
|
-
onClick:
|
|
59480
|
-
disabled:
|
|
59507
|
+
onClick: j,
|
|
59508
|
+
disabled: E,
|
|
59481
59509
|
children: /* @__PURE__ */ jsx(Download, { className: "h-4 w-4" })
|
|
59482
59510
|
}
|
|
59483
59511
|
) }),
|
|
@@ -59485,16 +59513,16 @@ function ProductImage({ randmarSKU: e, size: t = "md", alt: n, secondaryContent:
|
|
|
59485
59513
|
] }) })
|
|
59486
59514
|
] })
|
|
59487
59515
|
] }) }) }),
|
|
59488
|
-
/* @__PURE__ */ jsxs("div", { className: "relative w-max h-max", children: [
|
|
59516
|
+
/* @__PURE__ */ jsxs("div", { className: "relative w-max h-max", ref: I, children: [
|
|
59489
59517
|
/* @__PURE__ */ jsx(
|
|
59490
59518
|
"img",
|
|
59491
59519
|
{
|
|
59492
59520
|
alt: n || `Product ${e}`,
|
|
59493
59521
|
className: `rounded-md ${f ? "cursor-pointer" : ""}`,
|
|
59494
|
-
onClick: f ?
|
|
59495
|
-
src: `https://api.randmar.io/Product/${e}/Image?width=${
|
|
59496
|
-
width:
|
|
59497
|
-
height:
|
|
59522
|
+
onClick: f ? z : void 0,
|
|
59523
|
+
src: `https://api.randmar.io/Product/${e}/Image?width=${Q * 1.5}&height=${Q * 1.5}`,
|
|
59524
|
+
width: Q,
|
|
59525
|
+
height: Q
|
|
59498
59526
|
}
|
|
59499
59527
|
),
|
|
59500
59528
|
f && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip$1, { children: [
|
|
@@ -59504,7 +59532,7 @@ function ProductImage({ randmarSKU: e, size: t = "md", alt: n, secondaryContent:
|
|
|
59504
59532
|
variant: "secondary",
|
|
59505
59533
|
size: "icon",
|
|
59506
59534
|
className: "absolute top-2 right-2",
|
|
59507
|
-
onClick:
|
|
59535
|
+
onClick: z,
|
|
59508
59536
|
children: /* @__PURE__ */ jsx(Play, { className: "h-4 w-4" })
|
|
59509
59537
|
}
|
|
59510
59538
|
) }),
|
|
@@ -59533,27 +59561,6 @@ const CountryFlag = ({ countryCode: e, className: t = "" }) => {
|
|
|
59533
59561
|
}
|
|
59534
59562
|
);
|
|
59535
59563
|
};
|
|
59536
|
-
function useIntersectionObserver({
|
|
59537
|
-
elementRef: e,
|
|
59538
|
-
threshold: t = 0,
|
|
59539
|
-
rootMargin: n = "0px"
|
|
59540
|
-
}) {
|
|
59541
|
-
const [o, l] = useState(!1);
|
|
59542
|
-
return useEffect(() => {
|
|
59543
|
-
const d = new IntersectionObserver(
|
|
59544
|
-
([g]) => {
|
|
59545
|
-
l(g.isIntersecting);
|
|
59546
|
-
},
|
|
59547
|
-
{
|
|
59548
|
-
threshold: t,
|
|
59549
|
-
rootMargin: n
|
|
59550
|
-
}
|
|
59551
|
-
), f = e.current;
|
|
59552
|
-
return f && d.observe(f), () => {
|
|
59553
|
-
f && d.unobserve(f);
|
|
59554
|
-
};
|
|
59555
|
-
}, [e, t, n]), o;
|
|
59556
|
-
}
|
|
59557
59564
|
function ProductCard({
|
|
59558
59565
|
item: e,
|
|
59559
59566
|
addToCart: t = !1,
|
|
@@ -59597,8 +59604,10 @@ function ProductCard({
|
|
|
59597
59604
|
}
|
|
59598
59605
|
}
|
|
59599
59606
|
};
|
|
59600
|
-
z && (e != null && e.ManufacturerId) && He();
|
|
59601
|
-
}, [e == null ? void 0 : e.ManufacturerId, z]), useEffect(() => {
|
|
59607
|
+
z && (e != null && e.ManufacturerId) && !te && He();
|
|
59608
|
+
}, [e == null ? void 0 : e.ManufacturerId, z, te]), useEffect(() => {
|
|
59609
|
+
ae(null);
|
|
59610
|
+
}, [e == null ? void 0 : e.ManufacturerId]), useEffect(() => {
|
|
59602
59611
|
var He;
|
|
59603
59612
|
if (e && l) {
|
|
59604
59613
|
const ot = (He = e.Opportunities) == null ? void 0 : He.find((Ye) => Ye.BidNumber == l);
|
|
@@ -59817,10 +59826,7 @@ function ProductCard({
|
|
|
59817
59826
|
] })
|
|
59818
59827
|
] })
|
|
59819
59828
|
] }),
|
|
59820
|
-
/* @__PURE__ */
|
|
59821
|
-
z && /* @__PURE__ */ jsx(ProductImage, { randmarSKU: e.RandmarSKU || "", alt: e.RandmarTitle || "" }),
|
|
59822
|
-
!z && /* @__PURE__ */ jsx("div", { className: "w-60 h-40 bg-gray-100 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-full rounded-lg" }) })
|
|
59823
|
-
] })
|
|
59829
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: /* @__PURE__ */ jsx(ProductImage, { randmarSKU: e.RandmarSKU || "", alt: e.RandmarTitle || "" }) })
|
|
59824
59830
|
] }),
|
|
59825
59831
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-6 mt-4", children: [
|
|
59826
59832
|
/* @__PURE__ */ jsx("div", { className: "flex flex-1", children: Ae && e.Distribution && /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
@@ -890,7 +890,7 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
|
|
|
890
890
|
`;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]===`
|
|
891
891
|
`&&++this.pos;case`
|
|
892
892
|
`: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`
|
|
893
|
-
`;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 o=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],l=parseInt(o,8);return l>255&&(o=o.slice(0,-1),l=parseInt(o,8)),this.pos+=o.length-1,t=this.input.charCodeAt(this.pos),(o!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-o.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(l)}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,o=this.options.ecmaVersion>=6;this.pos<this.input.length;){var l=this.fullCharCodeAtPos();if(isIdentifierChar(l,o))this.pos+=l<=65535?1:2;else if(l===92){this.containsEsc=!0,e+=this.input.slice(n,this.pos);var d=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var f=this.readCodePoint();(t?isIdentifierStart:isIdentifierChar)(f,o)||this.invalidStringToken(d,"Invalid Unicode escape"),e+=codePointToString(f),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$1,TokenType,tokTypes:types$1,keywordTypes:keywords,TokContext,tokContexts:types,isIdentifierChar,isIdentifierStart,Token,isNewLine,lineBreak,lineBreakG,nonASCIIwhitespace};var AcornJSX=__toESM(require_acorn_jsx(),1),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 o=0;return n.split("").forEach(l=>{o=(o<<5)-o+l.charCodeAt(0),o&=o}),Math.abs(o).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 o=n.slice(0,n.indexOf(":")).trim(),l=n.slice(n.indexOf(":")+1).trim();return{...t,[camelCase(o)]:l}},{});case"object":return e;default:return}},pathToArrayPath=e=>e==null||e===""?[]:e.split("."),resolveArrayPath=(e,t)=>{const[n,...o]=t;if(!(e==null||n==null))return o.length===0?e[n]:resolveArrayPath(e[n],o)},resolvePath=(e,t)=>resolveArrayPath(e,pathToArrayPath(t));function handleNaN(e){return Number.isNaN(e)?"NaN":e}class JsxParser extends React.Component{constructor(){super(...arguments);Ft(this,"ParsedChildren",null);pr(this,Ht,n=>{const o=Parser.extend(AcornJSX.default({autoCloseVoidElements:this.props.autoCloseVoidElements})),l=`<root>${n}</root>`;let d=[];try{d=o.parse(l,{ecmaVersion:"latest"}),d=d.body[0].expression.children||[]}catch(f){return this.props.showWarnings&&console.warn(f),this.props.onError&&this.props.onError(f),this.props.renderError?this.props.renderError({error:String(f)}):null}return d.map(f=>qt(this,Rt).call(this,f)).filter(Boolean)});pr(this,Rt,(n,o)=>{var l,d;switch(n.type){case"JSXAttribute":return n.value===null?!0:qt(this,Rt).call(this,n.value,o);case"JSXElement":case"JSXFragment":return qt(this,xr).call(this,n,o);case"JSXExpressionContainer":return qt(this,Rt).call(this,n.expression,o);case"JSXText":const f=this.props.disableKeyGeneration?void 0:randomHash();return this.props.disableFragments?n.value:React.createElement(React.Fragment,{key:f},n.value);case"ArrayExpression":return n.elements.map(M=>qt(this,Rt).call(this,M,o));case"BinaryExpression":const g=qt(this,Rt).call(this,n.left,o),b=qt(this,Rt).call(this,n.right,o);let _;switch(n.operator){case"-":_=g-b;break;case"!=":_=g!=b;break;case"!==":_=g!==b;break;case"*":_=g*b;break;case"**":_=g**b;break;case"/":_=g/b;break;case"%":_=g%b;break;case"+":_=g+b;break;case"<":_=g<b;break;case"<=":_=g<=b;break;case"==":_=g==b;break;case"===":_=g===b;break;case">":_=g>b;break;case">=":_=g>=b;break;default:this.props.onError(new Error(`Unsupported binary operator: ${n.operator}`));return}return handleNaN(_);case"CallExpression":const S=qt(this,Rt).call(this,n.callee,o);if(S===void 0){if(n.optional)throw new NullishShortCircuit;this.props.onError(new Error(`The expression '${n.callee}' could not be resolved, resulting in an undefined return value.`));return}return S(...n.arguments.map(M=>qt(this,Rt).call(this,M,o)));case"ConditionalExpression":return qt(this,Rt).call(this,n.test,o)?qt(this,Rt).call(this,n.consequent,o):qt(this,Rt).call(this,n.alternate,o);case"ExpressionStatement":return qt(this,Rt).call(this,n.expression,o);case"Identifier":return n.name==="Infinity"?1/0:n.name==="-Infinity"?-1/0:n.name==="NaN"?NaN:o&&n.name in o?handleNaN(o[n.name]):handleNaN((this.props.bindings||{})[n.name]);case"Literal":return n.value;case"LogicalExpression":const R=qt(this,Rt).call(this,n.left,o);return n.operator==="||"&&R?R:n.operator==="&&"&&R||n.operator==="||"&&!R?qt(this,Rt).call(this,n.right,o):!1;case"MemberExpression":return qt(this,Er).call(this,n,o);case"ChainExpression":return qt(this,Zt).call(this,n,o);case"ObjectExpression":const C={};return n.properties.forEach(M=>{C[M.key.name||M.key.value]=qt(this,Rt).call(this,M.value,o)}),C;case"TemplateElement":return n.value.cooked;case"TemplateLiteral":return[...n.expressions,...n.quasis].sort((M,I)=>M.start<I.start?-1:1).map(M=>qt(this,Rt).call(this,M,o)).join("");case"UnaryExpression":const E=qt(this,Rt).call(this,n.argument,o);switch(n.operator){case"+":return+E;case"-":return-E;case"!":return!E}return;case"ArrowFunctionExpression":return(n.async||n.generator)&&((d=(l=this.props).onError)==null||d.call(l,new Error("Async and generator arrow functions are not supported."))),(...M)=>{const I={...o};return n.params.forEach((A,V)=>{I[A.name]=M[V]}),qt(this,Rt).call(this,n.body,I)};default:this.props.onError(new Error(`The expression type '${n.type}' is not supported.`));return}});pr(this,Zt,(n,o)=>{try{return qt(this,Rt).call(this,n.expression,o)}catch(l){if(l instanceof NullishShortCircuit)return;throw l}});pr(this,Er,(n,o)=>{const l=qt(this,Rt).call(this,n.object,o);let d;if(n.computed)d=qt(this,Rt).call(this,n.property,o);else if(n.property.type==="Identifier")d=n.property.name;else{this.props.onError(new Error("Only simple MemberExpressions are supported."));return}if(l==null&&n.optional)throw new NullishShortCircuit;let f;try{f=l[d]}catch{this.props.onError(new Error(`The property '${d}' could not be resolved on the object '${l}'.`));return}return typeof f=="function"?f.bind(l):f});pr(this,dr,n=>n.type==="JSXIdentifier"?n.name:`${qt(this,dr).call(this,n.object)}.${qt(this,dr).call(this,n.property)}`);pr(this,xr,(n,o)=>{const{allowUnknownElements:l,components:d,componentsOnly:f,onError:g}=this.props,{children:b=[]}=n,_=n.type==="JSXElement"?n.openingElement:n.openingFragment,{attributes:S=[]}=_,R=n.type==="JSXElement"?qt(this,dr).call(this,_.name):"",C=(this.props.blacklistedAttrs||[]).map(z=>z instanceof RegExp?z:new RegExp(z,"i")),E=(this.props.blacklistedTags||[]).map(z=>z.trim().toLowerCase()).filter(Boolean);if(/^(html|head|body)$/i.test(R))return b.map(z=>qt(this,xr).call(this,z,o));const M=R.trim().toLowerCase();if(E.indexOf(M)!==-1)return g(new Error(`The tag <${R}> is blacklisted, and will not be rendered.`)),null;if(R!==""&&!resolvePath(d,R)){if(f)return g(new Error(`The component <${R}> is unrecognized, and will not be rendered.`)),this.props.renderUnrecognized(R);if(!l&&document.createElement(R)instanceof HTMLUnknownElement)return g(new Error(`The tag <${R}> is unrecognized in this browser, and will not be rendered.`)),this.props.renderUnrecognized(R)}let I,A=n.type==="JSXElement"?resolvePath(d,R):React.Fragment;if(A||canHaveChildren(R)){if(I=b.map(Q=>qt(this,Rt).call(this,Q,o)),R.includes(".")){const F=R.split(".").reduce((j,te)=>j?j[te]:d==null?void 0:d[te],null);F&&(A=F)}!A&&!canHaveWhitespace(R)&&(I=I.filter(Q=>typeof Q!="string"||!/^\s*$/.test(Q)));const z=I.find(Q=>typeof Q=="function");I.length===0?I=void 0:z?I=z:I.length===1?[I]=I:I.length>1&&!this.props.disableKeyGeneration&&(I=I.map((Q,F)=>Q!=null&&Q.type&&!(Q!=null&&Q.key)?{...Q,key:Q.key||F}:Q))}const V={key:this.props.disableKeyGeneration?void 0:randomHash()};S.forEach(z=>{if(z.type==="JSXAttribute"){const Q=z.name.name,F=attributeNames_default[Q]||Q,j=qt(this,Rt).call(this,z,o);C.filter(ae=>ae.test(F)).length===0&&(V[F]=j)}else if(z.type==="JSXSpreadAttribute"&&z.argument.type==="Identifier"||z.argument.type==="MemberExpression"){const Q=qt(this,Rt).call(this,z.argument,o);typeof Q=="object"&&Object.keys(Q).forEach(F=>{const j=attributeNames_default[F]||F;C.filter(ae=>ae.test(j)).length===0&&(V[j]=Q[F])})}}),typeof V.style=="string"&&(V.style=parseStyle(V.style));const q=R.toLowerCase();return q==="option"&&(I=I.props.children),React.createElement(A||q,V,I)})}render(){const n=(this.props.jsx||"").trim().replace(/<!DOCTYPE([^>]*)>/g,"");this.ParsedChildren=qt(this,Ht).call(this,n);const o=[...new Set(["jsx-parser",...String(this.props.className).split(" ")])].filter(Boolean).join(" ");return this.props.renderInWrapper?React.createElement("div",{className:o},this.ParsedChildren):this.ParsedChildren}}Ht=new WeakMap,Rt=new WeakMap,Zt=new WeakMap,Er=new WeakMap,dr=new WeakMap,xr=new WeakMap,Ft(JsxParser,"displayName","JsxParser"),Ft(JsxParser,"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});var source_default=JsxParser;const imgSizeMap={sm:100,md:200,lg:300,xl:400};function ProductImage({randmarSKU:e,size:t="md",alt:n,secondaryContent:o}){const[l,d]=React__namespace.useState(!1),[f,g]=React__namespace.useState(!1),[b,_]=React__namespace.useState(!1),[S,R]=React__namespace.useState(!1),C=`https://api.randmar.io/Product/${e}/Video`;React__namespace.useEffect(()=>{(async()=>{try{const z=await(await fetch(C+"/Exists")).json();g(z)}catch(q){console.error("Error checking for video:",q),g(!1)}})()},[e,C]);async function E(){if(f){R(!0);try{const q=await(await fetch(C)).blob(),z=window.URL.createObjectURL(q),Q=document.createElement("a");Q.href=z,Q.download=`${e||"product"}-video.mp4`,document.body.appendChild(Q),Q.click(),document.body.removeChild(Q),window.URL.revokeObjectURL(z)}catch(V){console.error("Error downloading video:",V)}finally{R(!1)}}}function M(){navigator.clipboard.writeText(C),_(!0),setTimeout(()=>{_(!1)},2e3)}function I(){d(!0)}const A=imgSizeMap[t||"xl"];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Dialog,{open:l,onOpenChange:d,children:jsxRuntime.jsx(DialogContent,{className:"max-w-4xl p-0 overflow-hidden",children:o?jsxRuntime.jsxs("div",{className:"flex flex-row",children:[jsxRuntime.jsxs("video",{className:"w-full rounded-l-lg max-h-[720px] object-contain",controls:!0,autoPlay:!0,muted:!0,loop:!0,children:[jsxRuntime.jsx("source",{src:C,type:"video/mp4"}),"Your browser does not support the video tag."]}),jsxRuntime.jsx("div",{className:"flex-grow min-w-[400px] h-[70vh] p-6",children:o})]}):jsxRuntime.jsxs("div",{className:"w-full relative",children:[jsxRuntime.jsxs("video",{className:"w-full max-h-[720px] object-contain",controls:!0,autoPlay:!0,children:[jsxRuntime.jsx("source",{src:C,type:"video/mp4"}),"Your browser does not support the video tag."]}),jsxRuntime.jsxs("div",{className:"absolute top-2 right-12 flex gap-1",children:[jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"secondary",size:"icon",onClick:M,children:b?jsxRuntime.jsx(Check,{className:"h-4 w-4"}):jsxRuntime.jsx(Copy,{className:"h-4 w-4"})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Copy video link"})})]})}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"secondary",size:"icon",onClick:E,disabled:S,children:jsxRuntime.jsx(Download,{className:"h-4 w-4"})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Download video"})})]})})]})]})})}),jsxRuntime.jsxs("div",{className:"relative w-max h-max",children:[jsxRuntime.jsx("img",{alt:n||`Product ${e}`,className:`rounded-md ${f?"cursor-pointer":""}`,onClick:f?I:void 0,src:`https://api.randmar.io/Product/${e}/Image?width=${A*1.5}&height=${A*1.5}`,width:A,height:A}),f&&jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"secondary",size:"icon",className:"absolute top-2 right-2",onClick:I,children:jsxRuntime.jsx(Play,{className:"h-4 w-4"})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Play video"})})]})})]})]})}const CountryFlag=({countryCode:e,className:t=""})=>{const[n,o]=React.useState(null),[l,d]=React.useState(!1);return React.useEffect(()=>{if(!e)return;const g=`https://purecatamphetamine.github.io/country-flag-icons/3x2/${e.toUpperCase()}.svg`;fetch(g,{method:"HEAD"}).then(b=>{b.ok?(o(g),d(!1)):d(!0)}).catch(()=>{d(!0)})},[e]),l||!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"}})};function useIntersectionObserver({elementRef:e,threshold:t=0,rootMargin:n="0px"}){const[o,l]=React.useState(!1);return React.useEffect(()=>{const d=new IntersectionObserver(([g])=>{l(g.isIntersecting)},{threshold:t,rootMargin:n}),f=e.current;return f&&d.observe(f),()=>{f&&d.unobserve(f)}},[e,t,n]),o}function ProductCard({item:e,addToCart:t=!1,syncToShopify:n=!1,customAction:o=jsxRuntime.jsx(jsxRuntime.Fragment,{}),defaultOpportunityNumber:l="",viewProductLink:d,addToCartAction:f,isAddToCartActionLoading:g=!1,syncToShopifyAction:b,isSyncToShopifyActionLoading:_=!1}){var Ge,qe,Ke,Qe,We,nt,Xe,rt,Je,Ze,at;const[S,R]=React.useState(1),[C,E]=React.useState(null),[M,I]=React.useState(0),[A,V]=React.useState(!1),q=React.useRef(null),z=useIntersectionObserver({elementRef:q,threshold:.1,rootMargin:"100px"}),Q=((Ge=e==null?void 0:e.Distribution)==null?void 0:Ge.Cost)||0,F=((qe=e==null?void 0:e.Distribution)==null?void 0:qe.RegularPrice)||0,j=((Ke=e==null?void 0:e.Distribution)==null?void 0:Ke.Price)||0;React.useEffect(()=>{R(1),E(null),I(0),V(!1)},[e==null?void 0:e.RandmarSKU]);const[te,ae]=React.useState(null),[ie,oe]=React.useState(!1);React.useEffect(()=>{const He=async()=>{if(e!=null&&e.ManufacturerId){oe(!0);try{const st=await fetch(`https://api.randmar.io/V4/Partner/${e.ManufacturerId}/Account/Logo?width=60&height=40`);if(st.ok){const Ye=await st.blob();ae(URL.createObjectURL(Ye))}}catch(st){console.error("Failed to load logo:",st)}finally{oe(!1)}}};z&&(e!=null&&e.ManufacturerId)&&He()},[e==null?void 0:e.ManufacturerId,z]),React.useEffect(()=>{var He;if(e&&l){const st=(He=e.Opportunities)==null?void 0:He.find(Ye=>Ye.BidNumber==l);st&&E(st)}},[e,l]),React.useEffect(()=>{if(!e)return;const He=C!=null&&C.Price?C.Price:j;I(F>0?Math.round((F-He)/F*100):0)},[e,C,j,F]),React.useEffect(()=>{g||R(1)},[g]);const se=He=>{if(He.Active!==!0)return!1;const st=new Date().toISOString().split("T")[0];return!(He.EndDate&&He.EndDate.split("T")[0]<st||He.StartDate&&He.StartDate.split("T")[0]>st)};if(!e)return jsxRuntime.jsx(Card,{children:jsxRuntime.jsxs(CardContent,{className:"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 ge=(e==null?void 0:e.Opportunities)||[],Ae=ge.length>0,Ne=()=>{if(S==null){R(1);return}S>1&&R(S-1)},Be=()=>{if(S==null){R(1);return}R(S+1)},Fe=He=>{const st=Number.parseInt(He.target.value,10);if(!isNaN(st)&&st>0){R(st);return}R(void 0)},ze=()=>{(S==null||S<1)&&R(1)},Oe=((We=(Qe=e.Distribution)==null?void 0:Qe.Inventory)==null?void 0:We.reduce((He,st)=>He+(st.AvailableQuantity||0),0))||0,Ve=He=>{try{return new Date(He).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch(st){return console.error(st),He.split("T")[0]||"N/A"}},Le=()=>{f&&f({quantity:S??1,bidNumber:(C==null?void 0:C.BidNumber)??null})};return jsxRuntime.jsx(Card,{className:"hover:shadow-lg transition-shadow",ref:q,children:jsxRuntime.jsxs(CardContent,{className:"p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-3",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-xl",children:e.Title||e.RandmarTitle}),jsxRuntime.jsx("div",{className:"h-10 w-24 flex items-center justify-end ml-4",children:ie?jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"}):z&&te&&jsxRuntime.jsx("img",{src:te||"/placeholder.svg",alt:e.ManufacturerName??"",className:"max-h-10 max-w-24 object-contain"})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.State&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.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"})," ",e.State]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.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"})," ",e.SerialNumber?"Serialized":"Unserialized"]}),e.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"]}),e.AvailableToBuy!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.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"})," ",e.AvailableToBuy?"Available":"Unavailable"]}),e.ManufacturerCategory!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${(nt=e.ManufacturerCategory)!=null&&nt.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"})," ",(Xe=e.ManufacturerCategory)!=null&&Xe.QualificationRequired?"Qualified Only":"Available to all"]}),e.ManufacturerId&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.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"})," ",e.AutoUpdate?`Automatic Reorder (${e.MasterCarton})`:"Manually Reorders"]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.BodyHTML&&e.Title&&e.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"})," ",e.BodyHTML&&e.Title&&e.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:e.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:e.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:e.UnitWeight?`${e.UnitWeight} lbs`:"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"MAP"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.MAP?"$"+e.MAP.toFixed(2):"N/A"})]}),e.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:e.CountryCodeOfOrigin,className:"mr-2"}),e.CountryCodeOfOrigin]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[z&&jsxRuntime.jsx(ProductImage,{randmarSKU:e.RandmarSKU||"",alt:e.RandmarTitle||""}),!z&&jsxRuntime.jsx("div",{className:"w-60 h-40 bg-gray-100 rounded-lg flex items-center justify-center",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:Ae&&e.Distribution&&jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx("div",{className:"flex items-center",children:"You have "+ge.length+(ge.length>1?" opportunities":" opportunity")+" for this product:"}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-[200px] overflow-y-auto p-2 mt-1",children:ge.map((He,st)=>{var Ye;return jsxRuntime.jsxs("div",{className:`flex justify-between items-center rounded-lg transition-colors py-2 px-4 bg-purple-100 border border-muted
|
|
893
|
+
`;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 o=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],l=parseInt(o,8);return l>255&&(o=o.slice(0,-1),l=parseInt(o,8)),this.pos+=o.length-1,t=this.input.charCodeAt(this.pos),(o!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-o.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(l)}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,o=this.options.ecmaVersion>=6;this.pos<this.input.length;){var l=this.fullCharCodeAtPos();if(isIdentifierChar(l,o))this.pos+=l<=65535?1:2;else if(l===92){this.containsEsc=!0,e+=this.input.slice(n,this.pos);var d=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var f=this.readCodePoint();(t?isIdentifierStart:isIdentifierChar)(f,o)||this.invalidStringToken(d,"Invalid Unicode escape"),e+=codePointToString(f),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$1,TokenType,tokTypes:types$1,keywordTypes:keywords,TokContext,tokContexts:types,isIdentifierChar,isIdentifierStart,Token,isNewLine,lineBreak,lineBreakG,nonASCIIwhitespace};var AcornJSX=__toESM(require_acorn_jsx(),1),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 o=0;return n.split("").forEach(l=>{o=(o<<5)-o+l.charCodeAt(0),o&=o}),Math.abs(o).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 o=n.slice(0,n.indexOf(":")).trim(),l=n.slice(n.indexOf(":")+1).trim();return{...t,[camelCase(o)]:l}},{});case"object":return e;default:return}},pathToArrayPath=e=>e==null||e===""?[]:e.split("."),resolveArrayPath=(e,t)=>{const[n,...o]=t;if(!(e==null||n==null))return o.length===0?e[n]:resolveArrayPath(e[n],o)},resolvePath=(e,t)=>resolveArrayPath(e,pathToArrayPath(t));function handleNaN(e){return Number.isNaN(e)?"NaN":e}class JsxParser extends React.Component{constructor(){super(...arguments);Ft(this,"ParsedChildren",null);pr(this,Ht,n=>{const o=Parser.extend(AcornJSX.default({autoCloseVoidElements:this.props.autoCloseVoidElements})),l=`<root>${n}</root>`;let d=[];try{d=o.parse(l,{ecmaVersion:"latest"}),d=d.body[0].expression.children||[]}catch(f){return this.props.showWarnings&&console.warn(f),this.props.onError&&this.props.onError(f),this.props.renderError?this.props.renderError({error:String(f)}):null}return d.map(f=>qt(this,Rt).call(this,f)).filter(Boolean)});pr(this,Rt,(n,o)=>{var l,d;switch(n.type){case"JSXAttribute":return n.value===null?!0:qt(this,Rt).call(this,n.value,o);case"JSXElement":case"JSXFragment":return qt(this,xr).call(this,n,o);case"JSXExpressionContainer":return qt(this,Rt).call(this,n.expression,o);case"JSXText":const f=this.props.disableKeyGeneration?void 0:randomHash();return this.props.disableFragments?n.value:React.createElement(React.Fragment,{key:f},n.value);case"ArrayExpression":return n.elements.map(M=>qt(this,Rt).call(this,M,o));case"BinaryExpression":const g=qt(this,Rt).call(this,n.left,o),b=qt(this,Rt).call(this,n.right,o);let _;switch(n.operator){case"-":_=g-b;break;case"!=":_=g!=b;break;case"!==":_=g!==b;break;case"*":_=g*b;break;case"**":_=g**b;break;case"/":_=g/b;break;case"%":_=g%b;break;case"+":_=g+b;break;case"<":_=g<b;break;case"<=":_=g<=b;break;case"==":_=g==b;break;case"===":_=g===b;break;case">":_=g>b;break;case">=":_=g>=b;break;default:this.props.onError(new Error(`Unsupported binary operator: ${n.operator}`));return}return handleNaN(_);case"CallExpression":const S=qt(this,Rt).call(this,n.callee,o);if(S===void 0){if(n.optional)throw new NullishShortCircuit;this.props.onError(new Error(`The expression '${n.callee}' could not be resolved, resulting in an undefined return value.`));return}return S(...n.arguments.map(M=>qt(this,Rt).call(this,M,o)));case"ConditionalExpression":return qt(this,Rt).call(this,n.test,o)?qt(this,Rt).call(this,n.consequent,o):qt(this,Rt).call(this,n.alternate,o);case"ExpressionStatement":return qt(this,Rt).call(this,n.expression,o);case"Identifier":return n.name==="Infinity"?1/0:n.name==="-Infinity"?-1/0:n.name==="NaN"?NaN:o&&n.name in o?handleNaN(o[n.name]):handleNaN((this.props.bindings||{})[n.name]);case"Literal":return n.value;case"LogicalExpression":const R=qt(this,Rt).call(this,n.left,o);return n.operator==="||"&&R?R:n.operator==="&&"&&R||n.operator==="||"&&!R?qt(this,Rt).call(this,n.right,o):!1;case"MemberExpression":return qt(this,Er).call(this,n,o);case"ChainExpression":return qt(this,Zt).call(this,n,o);case"ObjectExpression":const C={};return n.properties.forEach(M=>{C[M.key.name||M.key.value]=qt(this,Rt).call(this,M.value,o)}),C;case"TemplateElement":return n.value.cooked;case"TemplateLiteral":return[...n.expressions,...n.quasis].sort((M,I)=>M.start<I.start?-1:1).map(M=>qt(this,Rt).call(this,M,o)).join("");case"UnaryExpression":const E=qt(this,Rt).call(this,n.argument,o);switch(n.operator){case"+":return+E;case"-":return-E;case"!":return!E}return;case"ArrowFunctionExpression":return(n.async||n.generator)&&((d=(l=this.props).onError)==null||d.call(l,new Error("Async and generator arrow functions are not supported."))),(...M)=>{const I={...o};return n.params.forEach((A,V)=>{I[A.name]=M[V]}),qt(this,Rt).call(this,n.body,I)};default:this.props.onError(new Error(`The expression type '${n.type}' is not supported.`));return}});pr(this,Zt,(n,o)=>{try{return qt(this,Rt).call(this,n.expression,o)}catch(l){if(l instanceof NullishShortCircuit)return;throw l}});pr(this,Er,(n,o)=>{const l=qt(this,Rt).call(this,n.object,o);let d;if(n.computed)d=qt(this,Rt).call(this,n.property,o);else if(n.property.type==="Identifier")d=n.property.name;else{this.props.onError(new Error("Only simple MemberExpressions are supported."));return}if(l==null&&n.optional)throw new NullishShortCircuit;let f;try{f=l[d]}catch{this.props.onError(new Error(`The property '${d}' could not be resolved on the object '${l}'.`));return}return typeof f=="function"?f.bind(l):f});pr(this,dr,n=>n.type==="JSXIdentifier"?n.name:`${qt(this,dr).call(this,n.object)}.${qt(this,dr).call(this,n.property)}`);pr(this,xr,(n,o)=>{const{allowUnknownElements:l,components:d,componentsOnly:f,onError:g}=this.props,{children:b=[]}=n,_=n.type==="JSXElement"?n.openingElement:n.openingFragment,{attributes:S=[]}=_,R=n.type==="JSXElement"?qt(this,dr).call(this,_.name):"",C=(this.props.blacklistedAttrs||[]).map(z=>z instanceof RegExp?z:new RegExp(z,"i")),E=(this.props.blacklistedTags||[]).map(z=>z.trim().toLowerCase()).filter(Boolean);if(/^(html|head|body)$/i.test(R))return b.map(z=>qt(this,xr).call(this,z,o));const M=R.trim().toLowerCase();if(E.indexOf(M)!==-1)return g(new Error(`The tag <${R}> is blacklisted, and will not be rendered.`)),null;if(R!==""&&!resolvePath(d,R)){if(f)return g(new Error(`The component <${R}> is unrecognized, and will not be rendered.`)),this.props.renderUnrecognized(R);if(!l&&document.createElement(R)instanceof HTMLUnknownElement)return g(new Error(`The tag <${R}> is unrecognized in this browser, and will not be rendered.`)),this.props.renderUnrecognized(R)}let I,A=n.type==="JSXElement"?resolvePath(d,R):React.Fragment;if(A||canHaveChildren(R)){if(I=b.map(Q=>qt(this,Rt).call(this,Q,o)),R.includes(".")){const F=R.split(".").reduce((j,te)=>j?j[te]:d==null?void 0:d[te],null);F&&(A=F)}!A&&!canHaveWhitespace(R)&&(I=I.filter(Q=>typeof Q!="string"||!/^\s*$/.test(Q)));const z=I.find(Q=>typeof Q=="function");I.length===0?I=void 0:z?I=z:I.length===1?[I]=I:I.length>1&&!this.props.disableKeyGeneration&&(I=I.map((Q,F)=>Q!=null&&Q.type&&!(Q!=null&&Q.key)?{...Q,key:Q.key||F}:Q))}const V={key:this.props.disableKeyGeneration?void 0:randomHash()};S.forEach(z=>{if(z.type==="JSXAttribute"){const Q=z.name.name,F=attributeNames_default[Q]||Q,j=qt(this,Rt).call(this,z,o);C.filter(ae=>ae.test(F)).length===0&&(V[F]=j)}else if(z.type==="JSXSpreadAttribute"&&z.argument.type==="Identifier"||z.argument.type==="MemberExpression"){const Q=qt(this,Rt).call(this,z.argument,o);typeof Q=="object"&&Object.keys(Q).forEach(F=>{const j=attributeNames_default[F]||F;C.filter(ae=>ae.test(j)).length===0&&(V[j]=Q[F])})}}),typeof V.style=="string"&&(V.style=parseStyle(V.style));const q=R.toLowerCase();return q==="option"&&(I=I.props.children),React.createElement(A||q,V,I)})}render(){const n=(this.props.jsx||"").trim().replace(/<!DOCTYPE([^>]*)>/g,"");this.ParsedChildren=qt(this,Ht).call(this,n);const o=[...new Set(["jsx-parser",...String(this.props.className).split(" ")])].filter(Boolean).join(" ");return this.props.renderInWrapper?React.createElement("div",{className:o},this.ParsedChildren):this.ParsedChildren}}Ht=new WeakMap,Rt=new WeakMap,Zt=new WeakMap,Er=new WeakMap,dr=new WeakMap,xr=new WeakMap,Ft(JsxParser,"displayName","JsxParser"),Ft(JsxParser,"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});var source_default=JsxParser;function useIntersectionObserver({elementRef:e,threshold:t=0,rootMargin:n="0px"}){const[o,l]=React.useState(!1);return React.useEffect(()=>{const d=new IntersectionObserver(([g])=>{l(g.isIntersecting)},{threshold:t,rootMargin:n}),f=e.current;return f&&d.observe(f),()=>{f&&d.unobserve(f)}},[e,t,n]),o}const imgSizeMap={sm:100,md:200,lg:300,xl:400};function ProductImage({randmarSKU:e,size:t="md",alt:n,secondaryContent:o}){const[l,d]=React__namespace.useState(!1),[f,g]=React__namespace.useState(!1),[b,_]=React__namespace.useState(!1),[S,R]=React__namespace.useState(!1),[C,E]=React__namespace.useState(!1),M=`https://api.randmar.io/Product/${e}/Video`,I=React.useRef(null),A=useIntersectionObserver({elementRef:I,threshold:.1,rootMargin:"100px"});React__namespace.useEffect(()=>{const F=async()=>{try{const te=await(await fetch(M+"/Exists")).json();g(te)}catch(j){console.error("Error checking for video:",j),g(!1)}};A&&!b&&(_(!0),F())},[e,M,A,b]);async function V(){if(f){E(!0);try{const j=await(await fetch(M)).blob(),te=window.URL.createObjectURL(j),ae=document.createElement("a");ae.href=te,ae.download=`${e||"product"}-video.mp4`,document.body.appendChild(ae),ae.click(),document.body.removeChild(ae),window.URL.revokeObjectURL(te)}catch(F){console.error("Error downloading video:",F)}finally{E(!1)}}}function q(){navigator.clipboard.writeText(M),R(!0),setTimeout(()=>{R(!1)},2e3)}function z(){d(!0)}const Q=imgSizeMap[t||"xl"];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Dialog,{open:l,onOpenChange:d,children:jsxRuntime.jsx(DialogContent,{className:"max-w-4xl p-0 overflow-hidden",children:o?jsxRuntime.jsxs("div",{className:"flex flex-row",children:[jsxRuntime.jsxs("video",{className:"w-full rounded-l-lg max-h-[720px] object-contain",controls:!0,autoPlay:!0,muted:!0,loop:!0,children:[jsxRuntime.jsx("source",{src:M,type:"video/mp4"}),"Your browser does not support the video tag."]}),jsxRuntime.jsx("div",{className:"flex-grow min-w-[400px] h-[70vh] p-6",children:o})]}):jsxRuntime.jsxs("div",{className:"w-full relative",children:[jsxRuntime.jsxs("video",{className:"w-full max-h-[720px] object-contain",controls:!0,autoPlay:!0,children:[jsxRuntime.jsx("source",{src:M,type:"video/mp4"}),"Your browser does not support the video tag."]}),jsxRuntime.jsxs("div",{className:"absolute top-2 right-12 flex gap-1",children:[jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"secondary",size:"icon",onClick:q,children:S?jsxRuntime.jsx(Check,{className:"h-4 w-4"}):jsxRuntime.jsx(Copy,{className:"h-4 w-4"})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Copy video link"})})]})}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"secondary",size:"icon",onClick:V,disabled:C,children:jsxRuntime.jsx(Download,{className:"h-4 w-4"})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Download video"})})]})})]})]})})}),jsxRuntime.jsxs("div",{className:"relative w-max h-max",ref:I,children:[jsxRuntime.jsx("img",{alt:n||`Product ${e}`,className:`rounded-md ${f?"cursor-pointer":""}`,onClick:f?z:void 0,src:`https://api.randmar.io/Product/${e}/Image?width=${Q*1.5}&height=${Q*1.5}`,width:Q,height:Q}),f&&jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"secondary",size:"icon",className:"absolute top-2 right-2",onClick:z,children:jsxRuntime.jsx(Play,{className:"h-4 w-4"})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Play video"})})]})})]})]})}const CountryFlag=({countryCode:e,className:t=""})=>{const[n,o]=React.useState(null),[l,d]=React.useState(!1);return React.useEffect(()=>{if(!e)return;const g=`https://purecatamphetamine.github.io/country-flag-icons/3x2/${e.toUpperCase()}.svg`;fetch(g,{method:"HEAD"}).then(b=>{b.ok?(o(g),d(!1)):d(!0)}).catch(()=>{d(!0)})},[e]),l||!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"}})};function ProductCard({item:e,addToCart:t=!1,syncToShopify:n=!1,customAction:o=jsxRuntime.jsx(jsxRuntime.Fragment,{}),defaultOpportunityNumber:l="",viewProductLink:d,addToCartAction:f,isAddToCartActionLoading:g=!1,syncToShopifyAction:b,isSyncToShopifyActionLoading:_=!1}){var Ge,qe,Ke,Qe,We,nt,Xe,rt,Je,Ze,at;const[S,R]=React.useState(1),[C,E]=React.useState(null),[M,I]=React.useState(0),[A,V]=React.useState(!1),q=React.useRef(null),z=useIntersectionObserver({elementRef:q,threshold:.1,rootMargin:"100px"}),Q=((Ge=e==null?void 0:e.Distribution)==null?void 0:Ge.Cost)||0,F=((qe=e==null?void 0:e.Distribution)==null?void 0:qe.RegularPrice)||0,j=((Ke=e==null?void 0:e.Distribution)==null?void 0:Ke.Price)||0;React.useEffect(()=>{R(1),E(null),I(0),V(!1)},[e==null?void 0:e.RandmarSKU]);const[te,ae]=React.useState(null),[ie,oe]=React.useState(!1);React.useEffect(()=>{const He=async()=>{if(e!=null&&e.ManufacturerId){oe(!0);try{const st=await fetch(`https://api.randmar.io/V4/Partner/${e.ManufacturerId}/Account/Logo?width=60&height=40`);if(st.ok){const Ye=await st.blob();ae(URL.createObjectURL(Ye))}}catch(st){console.error("Failed to load logo:",st)}finally{oe(!1)}}};z&&(e!=null&&e.ManufacturerId)&&!te&&He()},[e==null?void 0:e.ManufacturerId,z,te]),React.useEffect(()=>{ae(null)},[e==null?void 0:e.ManufacturerId]),React.useEffect(()=>{var He;if(e&&l){const st=(He=e.Opportunities)==null?void 0:He.find(Ye=>Ye.BidNumber==l);st&&E(st)}},[e,l]),React.useEffect(()=>{if(!e)return;const He=C!=null&&C.Price?C.Price:j;I(F>0?Math.round((F-He)/F*100):0)},[e,C,j,F]),React.useEffect(()=>{g||R(1)},[g]);const se=He=>{if(He.Active!==!0)return!1;const st=new Date().toISOString().split("T")[0];return!(He.EndDate&&He.EndDate.split("T")[0]<st||He.StartDate&&He.StartDate.split("T")[0]>st)};if(!e)return jsxRuntime.jsx(Card,{children:jsxRuntime.jsxs(CardContent,{className:"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 ge=(e==null?void 0:e.Opportunities)||[],Ae=ge.length>0,Ne=()=>{if(S==null){R(1);return}S>1&&R(S-1)},Be=()=>{if(S==null){R(1);return}R(S+1)},Fe=He=>{const st=Number.parseInt(He.target.value,10);if(!isNaN(st)&&st>0){R(st);return}R(void 0)},ze=()=>{(S==null||S<1)&&R(1)},Oe=((We=(Qe=e.Distribution)==null?void 0:Qe.Inventory)==null?void 0:We.reduce((He,st)=>He+(st.AvailableQuantity||0),0))||0,Ve=He=>{try{return new Date(He).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch(st){return console.error(st),He.split("T")[0]||"N/A"}},Le=()=>{f&&f({quantity:S??1,bidNumber:(C==null?void 0:C.BidNumber)??null})};return jsxRuntime.jsx(Card,{className:"hover:shadow-lg transition-shadow",ref:q,children:jsxRuntime.jsxs(CardContent,{className:"p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-3",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-xl",children:e.Title||e.RandmarTitle}),jsxRuntime.jsx("div",{className:"h-10 w-24 flex items-center justify-end ml-4",children:ie?jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"}):z&&te&&jsxRuntime.jsx("img",{src:te||"/placeholder.svg",alt:e.ManufacturerName??"",className:"max-h-10 max-w-24 object-contain"})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.State&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.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"})," ",e.State]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.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"})," ",e.SerialNumber?"Serialized":"Unserialized"]}),e.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"]}),e.AvailableToBuy!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.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"})," ",e.AvailableToBuy?"Available":"Unavailable"]}),e.ManufacturerCategory!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${(nt=e.ManufacturerCategory)!=null&&nt.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"})," ",(Xe=e.ManufacturerCategory)!=null&&Xe.QualificationRequired?"Qualified Only":"Available to all"]}),e.ManufacturerId&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.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"})," ",e.AutoUpdate?`Automatic Reorder (${e.MasterCarton})`:"Manually Reorders"]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.BodyHTML&&e.Title&&e.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"})," ",e.BodyHTML&&e.Title&&e.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:e.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:e.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:e.UnitWeight?`${e.UnitWeight} lbs`:"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"MAP"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.MAP?"$"+e.MAP.toFixed(2):"N/A"})]}),e.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:e.CountryCodeOfOrigin,className:"mr-2"}),e.CountryCodeOfOrigin]})]})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col",children:jsxRuntime.jsx(ProductImage,{randmarSKU:e.RandmarSKU||"",alt:e.RandmarTitle||""})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsx("div",{className:"flex flex-1",children:Ae&&e.Distribution&&jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx("div",{className:"flex items-center",children:"You have "+ge.length+(ge.length>1?" opportunities":" opportunity")+" for this product:"}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-[200px] overflow-y-auto p-2 mt-1",children:ge.map((He,st)=>{var Ye;return jsxRuntime.jsxs("div",{className:`flex justify-between items-center rounded-lg transition-colors py-2 px-4 bg-purple-100 border border-muted
|
|
894
894
|
${He.BidNumber==(C==null?void 0:C.BidNumber)?"cursor-pointer border-2 border-purple-900":se(He)?"hover:bg-purple-200 cursor-pointer":"!bg-neutral-50"}
|
|
895
895
|
`,onClick:()=>{se(He)&&E(He.BidNumber!=(C==null?void 0:C.BidNumber)?He: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:He.Opportunity}),jsxRuntime.jsxs("span",{className:"text-xs text-neutral-900",children:[He.BidNumber," ",!se(He)&&jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs mx-1 h-5 bg-gray-100",children:"Currently unavailable"})]})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsxs("span",{className:"font-semibold",children:["$",(Ye=He.Price)==null?void 0:Ye.toFixed(2)]}),He.Rebate&&He.Rebate>0&&jsxRuntime.jsxs("span",{className:"text-xs text-green-600",children:["Rebate: $",He.Rebate.toFixed(2)]}),He.EndDate&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral-600",children:["Ends: ",Ve(He.EndDate)]})]})]},st)})})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[d&&jsxRuntime.jsx(reactRouterDom.Link,{to:d,children:jsxRuntime.jsxs(Button,{variant:"secondary",children:[jsxRuntime.jsx(Eye,{className:"mr-2"}),"View Product"]})}),((rt=e.Distribution)==null?void 0:rt.Inventory)&&jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsxs(Dialog,{open:A,onOpenChange:V,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:`flex items-center text-sm ${Oe>0?"text-green-700":"text-red-700"}`,children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),Oe>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Oe," in stock"]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Out of stock"})]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-4xl",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{className:"flex items-center",children:[jsxRuntime.jsx(Warehouse,{className:"mr-2",size:18}),"Inventory Information"]})}),jsxRuntime.jsx(ProductInventoryGrid,{inventory:e.Distribution.Inventory})]})]})})]})]}),e.Distribution&&jsxRuntime.jsxs("div",{className:"flex justify-between items-end mt-4",children:[jsxRuntime.jsx("div",{className:"flex-shrink-1 flex flex-col items-start gap-1",children:Q>0?jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs("span",{className:"text-2xl font-bold whitespace-nowrap",children:[jsxRuntime.jsx("span",{children:"Cost: $"}),Q.toFixed(2),jsxRuntime.jsx("span",{children:" CAD"})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap",children:[jsxRuntime.jsxs("span",{className:"text-2xl font-bold whitespace-nowrap",children:[jsxRuntime.jsx("span",{children:"$"}),C?(Ze=(Je=e.Opportunities)==null?void 0:Je.find(He=>He.BidNumber==C.BidNumber))==null?void 0:Ze.Price:j.toFixed(2),jsxRuntime.jsx("span",{children:" CAD"})]}),M>0&&jsxRuntime.jsxs("span",{className:"text-muted-foreground line-through ml-2 whitespace-nowrap",children:["$",F.toFixed(2)]})]}),M>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:[M,"% OFF"]}),((at=e.InstantRebate)==null?void 0:at.EndDate)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",e.InstantRebate.EndDate.split("T")[0]]}),(C==null?void 0:C.EndDate)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",C.EndDate.split("T")[0]]})]})})]})}),jsxRuntime.jsxs("div",{className:"flex flex-shrink-0 gap-2 ml-4",children:[typeof t<"u"&&t&&jsxRuntime.jsxs("div",{className:"flex items-center border rounded-md",children:[jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"rounded-r-none",onClick:Ne,disabled:typeof S<"u"&&(S<=1||!e.AvailableToBuy||g||!f),children:"-"}),jsxRuntime.jsx("input",{value:S,onChange:Fe,onBlur:ze,onClick:He=>He.currentTarget.select(),className:`w-12 text-center border-0 focus:ring-0 focus:outline-none ${!e.AvailableToBuy||g||!f?"text-gray-400":""}`,disabled:!e.AvailableToBuy||g||!f}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"rounded-l-none",onClick:Be,disabled:!e.AvailableToBuy||g||!f,children:"+"})]}),typeof t<"u"&&t&&jsxRuntime.jsx(Button,{className:"gap-2 whitespace-nowrap",onClick:Le,disabled:!e.AvailableToBuy||g||!f,children:g?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"]})}),n&&jsxRuntime.jsx(Button,{className:"gap-2 whitespace-nowrap bg-green-600 hover:bg-green-700",onClick:b,disabled:_||!b,children:_?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"]})}),o]})]})]})})}const complexComponents=[`----
|
|
896
896
|
PartnerCard: For data that fits this shape:
|