randmarcomps 1.186.0 → 1.187.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.d.ts +3 -1
- package/dist/randmarcomps.js +62 -48
- package/dist/randmarcomps.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/randmarcomps.d.ts
CHANGED
|
@@ -448,12 +448,14 @@ export declare interface NavRoute {
|
|
|
448
448
|
showInNav?: boolean;
|
|
449
449
|
}
|
|
450
450
|
|
|
451
|
-
export declare function PartnerCard({ account, action, loading, withVoice }: PartnerCardProps): JSX.Element;
|
|
451
|
+
export declare function PartnerCard({ account, action, loading, className, withAbout, withVoice }: PartnerCardProps): JSX.Element;
|
|
452
452
|
|
|
453
453
|
declare interface PartnerCardProps {
|
|
454
454
|
account?: Account;
|
|
455
455
|
action?: ReactNode;
|
|
456
456
|
loading?: boolean;
|
|
457
|
+
className?: string;
|
|
458
|
+
withAbout?: boolean;
|
|
457
459
|
withVoice?: boolean;
|
|
458
460
|
}
|
|
459
461
|
|
package/dist/randmarcomps.js
CHANGED
|
@@ -50180,64 +50180,71 @@ const badgeVariants = cva(
|
|
|
50180
50180
|
] })
|
|
50181
50181
|
);
|
|
50182
50182
|
Badge.displayName = "Badge";
|
|
50183
|
-
function PartnerCard({
|
|
50184
|
-
|
|
50183
|
+
function PartnerCard({
|
|
50184
|
+
account: e,
|
|
50185
|
+
action: t,
|
|
50186
|
+
loading: n = !1,
|
|
50187
|
+
className: o,
|
|
50188
|
+
withAbout: l = !1,
|
|
50189
|
+
withVoice: d = !0
|
|
50190
|
+
}) {
|
|
50191
|
+
const [f, g] = useState(null), [b, _] = useState(!1), [S, C] = useState(!1), [E, R] = useState(!1), [M, I] = useState(!0), [A, j] = useState(null), [q, z] = useState(!1), Q = useMemo(() => e != null && e.ApplicationId ? {
|
|
50185
50192
|
videoUrl: `https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Video`,
|
|
50186
50193
|
videoExistsUrl: `https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Video/Exists`,
|
|
50187
50194
|
logoUrl: `https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Logo?width=64&height=64`,
|
|
50188
50195
|
logoExistsUrl: `https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Logo/Exists`
|
|
50189
50196
|
} : null, [e == null ? void 0 : e.ApplicationId]);
|
|
50190
50197
|
useEffect(() => {
|
|
50191
|
-
if (!
|
|
50192
|
-
let
|
|
50193
|
-
|
|
50194
|
-
const
|
|
50198
|
+
if (!Q || n) return;
|
|
50199
|
+
let V = !0;
|
|
50200
|
+
j(null);
|
|
50201
|
+
const te = async () => {
|
|
50195
50202
|
try {
|
|
50196
|
-
const
|
|
50197
|
-
if (
|
|
50198
|
-
const
|
|
50199
|
-
return
|
|
50203
|
+
const oe = await fetch(Q.logoExistsUrl);
|
|
50204
|
+
if (oe.ok) {
|
|
50205
|
+
const Ae = (await oe.text()).toLowerCase() === "true";
|
|
50206
|
+
return V && C(Ae), Ae;
|
|
50200
50207
|
}
|
|
50201
50208
|
return !1;
|
|
50202
|
-
} catch (
|
|
50203
|
-
return console.error("Failed to check if logo exists:",
|
|
50209
|
+
} catch (oe) {
|
|
50210
|
+
return console.error("Failed to check if logo exists:", oe), V && C(!1), !1;
|
|
50204
50211
|
}
|
|
50205
|
-
},
|
|
50206
|
-
|
|
50212
|
+
}, ae = async () => {
|
|
50213
|
+
V && _(!0);
|
|
50207
50214
|
try {
|
|
50208
|
-
const
|
|
50209
|
-
if (
|
|
50210
|
-
const
|
|
50211
|
-
|
|
50215
|
+
const oe = await fetch(Q.logoUrl);
|
|
50216
|
+
if (oe.ok) {
|
|
50217
|
+
const ge = await oe.blob();
|
|
50218
|
+
V && (f && URL.revokeObjectURL(f), g(URL.createObjectURL(ge)));
|
|
50212
50219
|
} else
|
|
50213
|
-
throw new Error(`Failed to load logo: ${
|
|
50214
|
-
} catch (
|
|
50215
|
-
console.error("Failed to load logo:",
|
|
50220
|
+
throw new Error(`Failed to load logo: ${oe.status}`);
|
|
50221
|
+
} catch (oe) {
|
|
50222
|
+
console.error("Failed to load logo:", oe), V && j("Failed to load partner logo");
|
|
50216
50223
|
} finally {
|
|
50217
|
-
|
|
50224
|
+
V && _(!1);
|
|
50218
50225
|
}
|
|
50219
|
-
},
|
|
50226
|
+
}, ie = async () => {
|
|
50220
50227
|
try {
|
|
50221
|
-
const
|
|
50222
|
-
if (
|
|
50223
|
-
const
|
|
50224
|
-
|
|
50228
|
+
const oe = await fetch(Q.videoExistsUrl);
|
|
50229
|
+
if (oe.ok) {
|
|
50230
|
+
const ge = await oe.text();
|
|
50231
|
+
V && R(ge.toLowerCase() === "true");
|
|
50225
50232
|
} else
|
|
50226
|
-
throw new Error(`Failed to check video: ${
|
|
50227
|
-
} catch (
|
|
50228
|
-
console.error("Failed to check if video exists:",
|
|
50233
|
+
throw new Error(`Failed to check video: ${oe.status}`);
|
|
50234
|
+
} catch (oe) {
|
|
50235
|
+
console.error("Failed to check if video exists:", oe), V && R(!1);
|
|
50229
50236
|
}
|
|
50230
50237
|
};
|
|
50231
50238
|
return (async () => {
|
|
50232
|
-
await
|
|
50239
|
+
await te() && ae(), ie();
|
|
50233
50240
|
})(), () => {
|
|
50234
|
-
|
|
50241
|
+
V = !1, f && URL.revokeObjectURL(f);
|
|
50235
50242
|
};
|
|
50236
|
-
}, [
|
|
50237
|
-
const
|
|
50238
|
-
|
|
50243
|
+
}, [Q, n]);
|
|
50244
|
+
const F = () => {
|
|
50245
|
+
I(!1);
|
|
50239
50246
|
};
|
|
50240
|
-
return n || !e ? /* @__PURE__ */ jsxs(Card, { children: [
|
|
50247
|
+
return n || !e ? /* @__PURE__ */ jsxs(Card, { className: o, children: [
|
|
50241
50248
|
/* @__PURE__ */ jsx(CardHeader, { className: "flex flex-row items-start justify-between space-y-0 pb-2 pt-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
50242
50249
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-12 w-12 rounded-md" }),
|
|
50243
50250
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -50254,7 +50261,7 @@ function PartnerCard({ account: e, action: t, loading: n = !1, withVoice: o = !0
|
|
|
50254
50261
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-20 rounded-full" }),
|
|
50255
50262
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-16 rounded-full" })
|
|
50256
50263
|
] }),
|
|
50257
|
-
|
|
50264
|
+
d && /* @__PURE__ */ jsx("div", { className: "p-3 bg-slate-50 rounded-md", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-3 gap-2", children: [
|
|
50258
50265
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
50259
50266
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-20 mb-1" }),
|
|
50260
50267
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" })
|
|
@@ -50273,12 +50280,12 @@ function PartnerCard({ account: e, action: t, loading: n = !1, withVoice: o = !0
|
|
|
50273
50280
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-32" }),
|
|
50274
50281
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-48" })
|
|
50275
50282
|
] })
|
|
50276
|
-
] }) : /* @__PURE__ */ jsxs(Card, { children: [
|
|
50283
|
+
] }) : /* @__PURE__ */ jsxs(Card, { className: o, children: [
|
|
50277
50284
|
/* @__PURE__ */ jsx(CardHeader, { className: "flex flex-row items-start justify-between space-y-0 pb-2 pt-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
50278
|
-
|
|
50285
|
+
S && /* @__PURE__ */ jsx("div", { className: "h-12 w-12 overflow-hidden rounded-md", children: b ? /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-10 rounded-md" }) : f && /* @__PURE__ */ jsx(
|
|
50279
50286
|
"img",
|
|
50280
50287
|
{
|
|
50281
|
-
src:
|
|
50288
|
+
src: f,
|
|
50282
50289
|
alt: `${e.PublicName}'s logo`,
|
|
50283
50290
|
className: "max-h-10 w-auto object-contain"
|
|
50284
50291
|
}
|
|
@@ -50293,14 +50300,21 @@ function PartnerCard({ account: e, action: t, loading: n = !1, withVoice: o = !0
|
|
|
50293
50300
|
] })
|
|
50294
50301
|
] }) }),
|
|
50295
50302
|
/* @__PURE__ */ jsxs(CardContent, { className: "pb-2", children: [
|
|
50296
|
-
|
|
50303
|
+
A && /* @__PURE__ */ jsx("div", { className: "text-red-500 mb-4 text-sm", role: "alert", children: A }),
|
|
50297
50304
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
50298
50305
|
(e.IsManufacturer || e.IsReseller || e.IsSalesAgency) && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
50299
50306
|
e.IsManufacturer && /* @__PURE__ */ jsx(Badge, { className: "manufacturer-theme", children: "Manufacturer" }),
|
|
50300
50307
|
e.IsReseller && /* @__PURE__ */ jsx(Badge, { className: "reseller-theme", children: "Reseller" }),
|
|
50301
50308
|
e.IsSalesAgency && /* @__PURE__ */ jsx(Badge, { children: "Agency" })
|
|
50302
50309
|
] }),
|
|
50303
|
-
|
|
50310
|
+
l && e.About && /* @__PURE__ */ jsx(
|
|
50311
|
+
"div",
|
|
50312
|
+
{
|
|
50313
|
+
className: "prose prose-sm max-w-none",
|
|
50314
|
+
dangerouslySetInnerHTML: { __html: e.About ?? "" }
|
|
50315
|
+
}
|
|
50316
|
+
),
|
|
50317
|
+
d && /* @__PURE__ */ jsx("div", { className: "p-3 bg-slate-50 rounded-md", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-3 gap-2", children: [
|
|
50304
50318
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
50305
50319
|
/* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Voice Name" }),
|
|
50306
50320
|
/* @__PURE__ */ jsx("div", { className: "font-medium", children: e.VoiceName ?? "Regular" })
|
|
@@ -50317,7 +50331,7 @@ function PartnerCard({ account: e, action: t, loading: n = !1, withVoice: o = !0
|
|
|
50317
50331
|
] })
|
|
50318
50332
|
] }),
|
|
50319
50333
|
/* @__PURE__ */ jsxs(CardFooter, { className: "px-6 py-4 flex justify-between gap-2", children: [
|
|
50320
|
-
|
|
50334
|
+
E && Q ? /* @__PURE__ */ jsxs(Dialog, { open: q, onOpenChange: z, children: [
|
|
50321
50335
|
/* @__PURE__ */ jsx(DialogTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", className: "flex items-center gap-2", children: [
|
|
50322
50336
|
/* @__PURE__ */ jsx(Video, { className: "h-4 w-4" }),
|
|
50323
50337
|
/* @__PURE__ */ jsx("span", { children: "Watch Video" })
|
|
@@ -50328,23 +50342,23 @@ function PartnerCard({ account: e, action: t, loading: n = !1, withVoice: o = !0
|
|
|
50328
50342
|
" Video"
|
|
50329
50343
|
] }) }),
|
|
50330
50344
|
/* @__PURE__ */ jsxs("div", { className: "w-full h-[640px] rounded-md overflow-hidden", children: [
|
|
50331
|
-
|
|
50345
|
+
M && /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-full" }),
|
|
50332
50346
|
/* @__PURE__ */ jsx(
|
|
50333
50347
|
"video",
|
|
50334
50348
|
{
|
|
50335
|
-
src:
|
|
50349
|
+
src: Q.videoUrl,
|
|
50336
50350
|
controls: !0,
|
|
50337
50351
|
preload: "auto",
|
|
50338
50352
|
playsInline: !0,
|
|
50339
50353
|
autoPlay: !0,
|
|
50340
50354
|
"aria-label": `Video for ${e.PublicName}`,
|
|
50341
|
-
className: `w-full h-full object-cover ${
|
|
50355
|
+
className: `w-full h-full object-cover ${M ? "invisible" : "visible"}`,
|
|
50342
50356
|
style: {
|
|
50343
50357
|
objectPosition: "center",
|
|
50344
50358
|
imageRendering: "auto"
|
|
50345
50359
|
},
|
|
50346
|
-
onLoadedData:
|
|
50347
|
-
onError: () =>
|
|
50360
|
+
onLoadedData: F,
|
|
50361
|
+
onError: () => I(!1)
|
|
50348
50362
|
}
|
|
50349
50363
|
)
|
|
50350
50364
|
] })
|
|
@@ -866,7 +866,7 @@ ${t}</tr>
|
|
|
866
866
|
`}tablecell(t){const n=this.parser.parseInline(t.tokens),o=t.header?"th":"td";return(t.align?`<${o} align="${t.align}">`:`<${o}>`)+n+`</${o}>
|
|
867
867
|
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${escape$2(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:n,tokens:o}){const l=this.parser.parseInline(o),d=cleanUrl(t);if(d===null)return l;t=d;let f='<a href="'+t+'"';return n&&(f+=' title="'+escape$2(n)+'"'),f+=">"+l+"</a>",f}image({href:t,title:n,text:o,tokens:l}){l&&(o=this.parser.parseInline(l,this.parser.textRenderer));const d=cleanUrl(t);if(d===null)return escape$2(o);t=d;let f=`<img src="${t}" alt="${o}"`;return n&&(f+=` title="${escape$2(n)}"`),f+=">",f}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:escape$2(t.text)}}class _TextRenderer{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}}class _Parser{constructor(t){Ft(this,"options");Ft(this,"renderer");Ft(this,"textRenderer");this.options=t||_defaults,this.options.renderer=this.options.renderer||new _Renderer,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _TextRenderer}static parse(t,n){return new _Parser(n).parse(t)}static parseInline(t,n){return new _Parser(n).parseInline(t)}parse(t,n=!0){var l,d;let o="";for(let f=0;f<t.length;f++){const g=t[f];if((d=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&d[g.type]){const _=g,S=this.options.extensions.renderers[_.type].call({parser:this},_);if(S!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(_.type)){o+=S||"";continue}}const b=g;switch(b.type){case"space":{o+=this.renderer.space(b);continue}case"hr":{o+=this.renderer.hr(b);continue}case"heading":{o+=this.renderer.heading(b);continue}case"code":{o+=this.renderer.code(b);continue}case"table":{o+=this.renderer.table(b);continue}case"blockquote":{o+=this.renderer.blockquote(b);continue}case"list":{o+=this.renderer.list(b);continue}case"html":{o+=this.renderer.html(b);continue}case"paragraph":{o+=this.renderer.paragraph(b);continue}case"text":{let _=b,S=this.renderer.text(_);for(;f+1<t.length&&t[f+1].type==="text";)_=t[++f],S+=`
|
|
868
868
|
`+this.renderer.text(_);n?o+=this.renderer.paragraph({type:"paragraph",raw:S,text:S,tokens:[{type:"text",raw:S,text:S,escaped:!0}]}):o+=S;continue}default:{const _='Token with "'+b.type+'" type was not found.';if(this.options.silent)return console.error(_),"";throw new Error(_)}}}return o}parseInline(t,n=this.renderer){var l,d;let o="";for(let f=0;f<t.length;f++){const g=t[f];if((d=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&d[g.type]){const _=this.options.extensions.renderers[g.type].call({parser:this},g);if(_!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(g.type)){o+=_||"";continue}}const b=g;switch(b.type){case"escape":{o+=n.text(b);break}case"html":{o+=n.html(b);break}case"link":{o+=n.link(b);break}case"image":{o+=n.image(b);break}case"strong":{o+=n.strong(b);break}case"em":{o+=n.em(b);break}case"codespan":{o+=n.codespan(b);break}case"br":{o+=n.br(b);break}case"del":{o+=n.del(b);break}case"text":{o+=n.text(b);break}default:{const _='Token with "'+b.type+'" type was not found.';if(this.options.silent)return console.error(_),"";throw new Error(_)}}}return o}}class _Hooks{constructor(t){Ft(this,"options");Ft(this,"block");this.options=t||_defaults}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?_Lexer.lex:_Lexer.lexInline}provideParser(){return this.block?_Parser.parse:_Parser.parseInline}}Ft(_Hooks,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Marked{constructor(...t){Ft(this,"defaults",_getDefaults());Ft(this,"options",this.setOptions);Ft(this,"parse",this.parseMarkdown(!0));Ft(this,"parseInline",this.parseMarkdown(!1));Ft(this,"Parser",_Parser);Ft(this,"Renderer",_Renderer);Ft(this,"TextRenderer",_TextRenderer);Ft(this,"Lexer",_Lexer);Ft(this,"Tokenizer",_Tokenizer);Ft(this,"Hooks",_Hooks);this.use(...t)}walkTokens(t,n){var l,d;let o=[];for(const f of t)switch(o=o.concat(n.call(this,f)),f.type){case"table":{const g=f;for(const b of g.header)o=o.concat(this.walkTokens(b.tokens,n));for(const b of g.rows)for(const _ of b)o=o.concat(this.walkTokens(_.tokens,n));break}case"list":{const g=f;o=o.concat(this.walkTokens(g.items,n));break}default:{const g=f;(d=(l=this.defaults.extensions)==null?void 0:l.childTokens)!=null&&d[g.type]?this.defaults.extensions.childTokens[g.type].forEach(b=>{const _=g[b].flat(1/0);o=o.concat(this.walkTokens(_,n))}):g.tokens&&(o=o.concat(this.walkTokens(g.tokens,n)))}}return o}use(...t){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(o=>{const l={...o};if(l.async=this.defaults.async||l.async||!1,o.extensions&&(o.extensions.forEach(d=>{if(!d.name)throw new Error("extension name required");if("renderer"in d){const f=n.renderers[d.name];f?n.renderers[d.name]=function(...g){let b=d.renderer.apply(this,g);return b===!1&&(b=f.apply(this,g)),b}:n.renderers[d.name]=d.renderer}if("tokenizer"in d){if(!d.level||d.level!=="block"&&d.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const f=n[d.level];f?f.unshift(d.tokenizer):n[d.level]=[d.tokenizer],d.start&&(d.level==="block"?n.startBlock?n.startBlock.push(d.start):n.startBlock=[d.start]:d.level==="inline"&&(n.startInline?n.startInline.push(d.start):n.startInline=[d.start]))}"childTokens"in d&&d.childTokens&&(n.childTokens[d.name]=d.childTokens)}),l.extensions=n),o.renderer){const d=this.defaults.renderer||new _Renderer(this.defaults);for(const f in o.renderer){if(!(f in d))throw new Error(`renderer '${f}' does not exist`);if(["options","parser"].includes(f))continue;const g=f,b=o.renderer[g],_=d[g];d[g]=(...S)=>{let R=b.apply(d,S);return R===!1&&(R=_.apply(d,S)),R||""}}l.renderer=d}if(o.tokenizer){const d=this.defaults.tokenizer||new _Tokenizer(this.defaults);for(const f in o.tokenizer){if(!(f in d))throw new Error(`tokenizer '${f}' does not exist`);if(["options","rules","lexer"].includes(f))continue;const g=f,b=o.tokenizer[g],_=d[g];d[g]=(...S)=>{let R=b.apply(d,S);return R===!1&&(R=_.apply(d,S)),R}}l.tokenizer=d}if(o.hooks){const d=this.defaults.hooks||new _Hooks;for(const f in o.hooks){if(!(f in d))throw new Error(`hook '${f}' does not exist`);if(["options","block"].includes(f))continue;const g=f,b=o.hooks[g],_=d[g];_Hooks.passThroughHooks.has(f)?d[g]=S=>{if(this.defaults.async)return Promise.resolve(b.call(d,S)).then(C=>_.call(d,C));const R=b.call(d,S);return _.call(d,R)}:d[g]=(...S)=>{let R=b.apply(d,S);return R===!1&&(R=_.apply(d,S)),R}}l.hooks=d}if(o.walkTokens){const d=this.defaults.walkTokens,f=o.walkTokens;l.walkTokens=function(g){let b=[];return b.push(f.call(this,g)),d&&(b=b.concat(d.call(this,g))),b}}this.defaults={...this.defaults,...l}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,n){return _Lexer.lex(t,n??this.defaults)}parser(t,n){return _Parser.parse(t,n??this.defaults)}parseMarkdown(t){return(o,l)=>{const d={...l},f={...this.defaults,...d},g=this.onError(!!f.silent,!!f.async);if(this.defaults.async===!0&&d.async===!1)return g(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof o>"u"||o===null)return g(new Error("marked(): input parameter is undefined or null"));if(typeof o!="string")return g(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(o)+", string expected"));f.hooks&&(f.hooks.options=f,f.hooks.block=t);const b=f.hooks?f.hooks.provideLexer():t?_Lexer.lex:_Lexer.lexInline,_=f.hooks?f.hooks.provideParser():t?_Parser.parse:_Parser.parseInline;if(f.async)return Promise.resolve(f.hooks?f.hooks.preprocess(o):o).then(S=>b(S,f)).then(S=>f.hooks?f.hooks.processAllTokens(S):S).then(S=>f.walkTokens?Promise.all(this.walkTokens(S,f.walkTokens)).then(()=>S):S).then(S=>_(S,f)).then(S=>f.hooks?f.hooks.postprocess(S):S).catch(g);try{f.hooks&&(o=f.hooks.preprocess(o));let S=b(o,f);f.hooks&&(S=f.hooks.processAllTokens(S)),f.walkTokens&&this.walkTokens(S,f.walkTokens);let R=_(S,f);return f.hooks&&(R=f.hooks.postprocess(R)),R}catch(S){return g(S)}}}onError(t,n){return o=>{if(o.message+=`
|
|
869
|
-
Please report this to https://github.com/markedjs/marked.`,t){const l="<p>An error occurred:</p><pre>"+escape$2(o.message+"",!0)+"</pre>";return n?Promise.resolve(l):l}if(n)return Promise.reject(o);throw o}}}const markedInstance=new Marked;function marked(e,t){return markedInstance.parse(e,t)}marked.options=marked.setOptions=function(e){return markedInstance.setOptions(e),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.getDefaults=_getDefaults,marked.defaults=_defaults,marked.use=function(...e){return markedInstance.use(...e),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.walkTokens=function(e,t){return markedInstance.walkTokens(e,t)},marked.parseInline=markedInstance.parseInline,marked.Parser=_Parser,marked.parser=_Parser.parse,marked.Renderer=_Renderer,marked.TextRenderer=_TextRenderer,marked.Lexer=_Lexer,marked.lexer=_Lexer.lex,marked.Tokenizer=_Tokenizer,marked.Hooks=_Hooks,marked.parse=marked,marked.options,marked.setOptions,marked.use,marked.walkTokens,marked.parseInline,_Parser.parse,_Lexer.lex;const Card=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("rounded-md border bg-card text-card-foreground shadow-sm",e),...t}));Card.displayName="Card";const CardHeader=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("flex flex-col space-y-1.5 p-6",e),...t}));CardHeader.displayName="CardHeader";const CardTitle=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("font-semibold leading-none tracking-tight",e),...t}));CardTitle.displayName="CardTitle";const CardDescription=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("text-sm text-muted-foreground",e),...t}));CardDescription.displayName="CardDescription";const CardContent=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("p-6 pt-0",e),...t}));CardContent.displayName="CardContent";const CardFooter=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("flex items-center p-6 pt-0",e),...t}));CardFooter.displayName="CardFooter";const badgeVariants=cva("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground border border-input hover:bg-accent hover:text-accent-foreground",success:"bg-green-600 text-white hover:bg-green-700",warning:"bg-yellow-500 text-white hover:bg-yellow-600",info:"bg-blue-500 text-white hover:bg-blue-600",ghost:"bg-background hover:bg-accent hover:text-accent-foreground",randmarRed:"bg-randmar-red text-white hover:bg-randmar-red/80",randmarBlue:"bg-randmar-blue text-white hover:bg-randmar-blue/80",randmarPurple:"bg-randmar-purple text-white hover:bg-randmar-purple/80",randmarGreen:"bg-randmar-green text-black hover:bg-randmar-green/80",randmarBlack:"bg-randmar-black text-white hover:bg-randmar-black/80",randmarYellow:"bg-randmar-yellow text-black hover:bg-randmar-yellow/80"},size:{default:"h-6",sm:"h-5 text-[10px]",lg:"h-7 px-3"}},defaultVariants:{variant:"default",size:"default"}}),Badge=React__namespace.forwardRef(({className:e,variant:t,size:n,icon:o,children:l,...d},f)=>jsxRuntime.jsxs("div",{ref:f,className:cn(badgeVariants({variant:t,size:n}),e),...d,children:[o&&jsxRuntime.jsx("span",{className:"mr-1",children:o}),l]}));Badge.displayName="Badge";function PartnerCard({account:e,action:t,loading:n=!1,withVoice:o=!0}){const[l,d]=React.useState(null),[f,g]=React.useState(!1),[b,_]=React.useState(!1),[S,R]=React.useState(!1),[C,E]=React.useState(!0),[M,I]=React.useState(null),[A,V]=React.useState(!1),q=React.useMemo(()=>e!=null&&e.ApplicationId?{videoUrl:`https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Video`,videoExistsUrl:`https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Video/Exists`,logoUrl:`https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Logo?width=64&height=64`,logoExistsUrl:`https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Logo/Exists`}:null,[e==null?void 0:e.ApplicationId]);React.useEffect(()=>{if(!q||n)return;let Q=!0;I(null);const F=async()=>{try{const ie=await fetch(q.logoExistsUrl);if(ie.ok){const se=(await ie.text()).toLowerCase()==="true";return Q&&_(se),se}return!1}catch(ie){return console.error("Failed to check if logo exists:",ie),Q&&_(!1),!1}},j=async()=>{Q&&g(!0);try{const ie=await fetch(q.logoUrl);if(ie.ok){const oe=await ie.blob();Q&&(l&&URL.revokeObjectURL(l),d(URL.createObjectURL(oe)))}else throw new Error(`Failed to load logo: ${ie.status}`)}catch(ie){console.error("Failed to load logo:",ie),Q&&I("Failed to load partner logo")}finally{Q&&g(!1)}},te=async()=>{try{const ie=await fetch(q.videoExistsUrl);if(ie.ok){const oe=await ie.text();Q&&R(oe.toLowerCase()==="true")}else throw new Error(`Failed to check video: ${ie.status}`)}catch(ie){console.error("Failed to check if video exists:",ie),Q&&R(!1)}};return(async()=>{await F()&&j(),te()})(),()=>{Q=!1,l&&URL.revokeObjectURL(l)}},[q,n]);const z=()=>{E(!1)};return n||!e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"}),jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-48 mt-1"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"})]}),o&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]})]})})]})}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-48"})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[b&&jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:f?jsxRuntime.jsx(Skeleton,{className:"h-10 w-10 rounded-md"}):l&&jsxRuntime.jsx("img",{src:l||"/placeholder.svg",alt:`${e.PublicName}'s logo`,className:"max-h-10 w-auto object-contain"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Partner"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:e.ApplicationId})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:e.PublicName||"N/A"})]})]})}),jsxRuntime.jsxs(CardContent,{className:"pb-2",children:[M&&jsxRuntime.jsx("div",{className:"text-red-500 mb-4 text-sm",role:"alert",children:M}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[(e.IsManufacturer||e.IsReseller||e.IsSalesAgency)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.IsManufacturer&&jsxRuntime.jsx(Badge,{className:"manufacturer-theme",children:"Manufacturer"}),e.IsReseller&&jsxRuntime.jsx(Badge,{className:"reseller-theme",children:"Reseller"}),e.IsSalesAgency&&jsxRuntime.jsx(Badge,{children:"Agency"})]}),o&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.VoiceName??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Style"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.VoiceStyle??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Scene Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.SceneName??"N/A"})]})]})})]})]}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2",children:[S&&q?jsxRuntime.jsxs(Dialog,{open:A,onOpenChange:V,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"outline",className:"flex items-center gap-2",children:[jsxRuntime.jsx(Video,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:"Watch Video"})]})}),jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[360px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{children:[e.PublicName," Video"]})}),jsxRuntime.jsxs("div",{className:"w-full h-[640px] rounded-md overflow-hidden",children:[C&&jsxRuntime.jsx(Skeleton,{className:"w-full h-full"}),jsxRuntime.jsx("video",{src:q.videoUrl,controls:!0,preload:"auto",playsInline:!0,autoPlay:!0,"aria-label":`Video for ${e.PublicName}`,className:`w-full h-full object-cover ${C?"invisible":"visible"}`,style:{objectPosition:"center",imageRendering:"auto"},onLoadedData:z,onError:()=>E(!1)})]})]})]}):jsxRuntime.jsx("div",{}),t||jsxRuntime.jsxs(Button,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Partner Dashboard"]})]})]})}const Textarea=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("textarea",{className:cn("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));Textarea.displayName="Textarea";function ChatList({userId:e,chats:t,activeChat:n,onSelectChat:o,assistantChat:l}){return jsxRuntime.jsxs("div",{className:"space-y-1 flex flex-col min-h-full",children:[jsxRuntime.jsx("div",{className:"flex-grow",children:t.map(d=>{const f=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(AvatarImage,{src:`https://api.randmar.io/v4/Partner/${d.partner1===e?d.partner2:d.partner1}/Account/Logo?height=72&width=72`,className:" object-contain "}),jsxRuntime.jsx(AvatarFallback,{children:jsxRuntime.jsx(Handshake,{className:"text-primary fill-white min-h-full"})})]});return display(d,n,o,f)})}),jsxRuntime.jsxs("div",{className:"mt-auto",children:[jsxRuntime.jsx(Separator$1,{className:"mb-1"}),display(l,n,o,jsxRuntime.jsx(Bot,{className:"text-primary fill-white min-h-full"}))]})]})}function display(e,t,n,o){var l;return jsxRuntime.jsxs("button",{className:cn("w-full flex items-center p-2 rounded-md hover:bg-slate-100 transition-colors",(t==null?void 0:t.partner1)===e.partner1&&(t==null?void 0:t.partner2)===e.partner2&&"bg-slate-100"),onClick:()=>n([e.partner1,e.partner2]),children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:e.pending?jsxRuntime.jsx(MessageSquareLock,{}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:o})}),jsxRuntime.jsxs("div",{className:"ml-2 text-left overflow-hidden",children:[jsxRuntime.jsx("div",{className:"font-medium text-sm truncate",children:e.name}),jsxRuntime.jsx("div",{className:"text-xs text-muted-foreground truncate text-ellipsis",children:((l=e.messages.at(-1))==null?void 0:l.content)??""})]}),e.unread>0&&jsxRuntime.jsx("div",{className:"ml-auto bg-red-500 text-white text-xs rounded-full h-5 w-5 flex items-center justify-center",children:e.unread})]},e.partner1+" and "+e.partner2)}var md5$1={exports:{}},crypt={exports:{}},hasRequiredCrypt;function requireCrypt(){return hasRequiredCrypt||(hasRequiredCrypt=1,function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t={rotl:function(n,o){return n<<o|n>>>32-o},rotr:function(n,o){return n<<32-o|n>>>o},endian:function(n){if(n.constructor==Number)return t.rotl(n,8)&16711935|t.rotl(n,24)&4278255360;for(var o=0;o<n.length;o++)n[o]=t.endian(n[o]);return n},randomBytes:function(n){for(var o=[];n>0;n--)o.push(Math.floor(Math.random()*256));return o},bytesToWords:function(n){for(var o=[],l=0,d=0;l<n.length;l++,d+=8)o[d>>>5]|=n[l]<<24-d%32;return o},wordsToBytes:function(n){for(var o=[],l=0;l<n.length*32;l+=8)o.push(n[l>>>5]>>>24-l%32&255);return o},bytesToHex:function(n){for(var o=[],l=0;l<n.length;l++)o.push((n[l]>>>4).toString(16)),o.push((n[l]&15).toString(16));return o.join("")},hexToBytes:function(n){for(var o=[],l=0;l<n.length;l+=2)o.push(parseInt(n.substr(l,2),16));return o},bytesToBase64:function(n){for(var o=[],l=0;l<n.length;l+=3)for(var d=n[l]<<16|n[l+1]<<8|n[l+2],f=0;f<4;f++)l*8+f*6<=n.length*8?o.push(e.charAt(d>>>6*(3-f)&63)):o.push("=");return o.join("")},base64ToBytes:function(n){n=n.replace(/[^A-Z0-9+\/]/ig,"");for(var o=[],l=0,d=0;l<n.length;d=++l%4)d!=0&&o.push((e.indexOf(n.charAt(l-1))&Math.pow(2,-2*d+8)-1)<<d*2|e.indexOf(n.charAt(l))>>>6-d*2);return o}};crypt.exports=t}()),crypt.exports}var charenc_1,hasRequiredCharenc;function requireCharenc(){if(hasRequiredCharenc)return charenc_1;hasRequiredCharenc=1;var e={utf8:{stringToBytes:function(t){return e.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(e.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var n=[],o=0;o<t.length;o++)n.push(t.charCodeAt(o)&255);return n},bytesToString:function(t){for(var n=[],o=0;o<t.length;o++)n.push(String.fromCharCode(t[o]));return n.join("")}}};return charenc_1=e,charenc_1}/*!
|
|
869
|
+
Please report this to https://github.com/markedjs/marked.`,t){const l="<p>An error occurred:</p><pre>"+escape$2(o.message+"",!0)+"</pre>";return n?Promise.resolve(l):l}if(n)return Promise.reject(o);throw o}}}const markedInstance=new Marked;function marked(e,t){return markedInstance.parse(e,t)}marked.options=marked.setOptions=function(e){return markedInstance.setOptions(e),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.getDefaults=_getDefaults,marked.defaults=_defaults,marked.use=function(...e){return markedInstance.use(...e),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.walkTokens=function(e,t){return markedInstance.walkTokens(e,t)},marked.parseInline=markedInstance.parseInline,marked.Parser=_Parser,marked.parser=_Parser.parse,marked.Renderer=_Renderer,marked.TextRenderer=_TextRenderer,marked.Lexer=_Lexer,marked.lexer=_Lexer.lex,marked.Tokenizer=_Tokenizer,marked.Hooks=_Hooks,marked.parse=marked,marked.options,marked.setOptions,marked.use,marked.walkTokens,marked.parseInline,_Parser.parse,_Lexer.lex;const Card=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("rounded-md border bg-card text-card-foreground shadow-sm",e),...t}));Card.displayName="Card";const CardHeader=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("flex flex-col space-y-1.5 p-6",e),...t}));CardHeader.displayName="CardHeader";const CardTitle=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("font-semibold leading-none tracking-tight",e),...t}));CardTitle.displayName="CardTitle";const CardDescription=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("text-sm text-muted-foreground",e),...t}));CardDescription.displayName="CardDescription";const CardContent=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("p-6 pt-0",e),...t}));CardContent.displayName="CardContent";const CardFooter=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("flex items-center p-6 pt-0",e),...t}));CardFooter.displayName="CardFooter";const badgeVariants=cva("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground border border-input hover:bg-accent hover:text-accent-foreground",success:"bg-green-600 text-white hover:bg-green-700",warning:"bg-yellow-500 text-white hover:bg-yellow-600",info:"bg-blue-500 text-white hover:bg-blue-600",ghost:"bg-background hover:bg-accent hover:text-accent-foreground",randmarRed:"bg-randmar-red text-white hover:bg-randmar-red/80",randmarBlue:"bg-randmar-blue text-white hover:bg-randmar-blue/80",randmarPurple:"bg-randmar-purple text-white hover:bg-randmar-purple/80",randmarGreen:"bg-randmar-green text-black hover:bg-randmar-green/80",randmarBlack:"bg-randmar-black text-white hover:bg-randmar-black/80",randmarYellow:"bg-randmar-yellow text-black hover:bg-randmar-yellow/80"},size:{default:"h-6",sm:"h-5 text-[10px]",lg:"h-7 px-3"}},defaultVariants:{variant:"default",size:"default"}}),Badge=React__namespace.forwardRef(({className:e,variant:t,size:n,icon:o,children:l,...d},f)=>jsxRuntime.jsxs("div",{ref:f,className:cn(badgeVariants({variant:t,size:n}),e),...d,children:[o&&jsxRuntime.jsx("span",{className:"mr-1",children:o}),l]}));Badge.displayName="Badge";function PartnerCard({account:e,action:t,loading:n=!1,className:o,withAbout:l=!1,withVoice:d=!0}){const[f,g]=React.useState(null),[b,_]=React.useState(!1),[S,R]=React.useState(!1),[C,E]=React.useState(!1),[M,I]=React.useState(!0),[A,V]=React.useState(null),[q,z]=React.useState(!1),Q=React.useMemo(()=>e!=null&&e.ApplicationId?{videoUrl:`https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Video`,videoExistsUrl:`https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Video/Exists`,logoUrl:`https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Logo?width=64&height=64`,logoExistsUrl:`https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Logo/Exists`}:null,[e==null?void 0:e.ApplicationId]);React.useEffect(()=>{if(!Q||n)return;let j=!0;V(null);const te=async()=>{try{const se=await fetch(Q.logoExistsUrl);if(se.ok){const Ae=(await se.text()).toLowerCase()==="true";return j&&R(Ae),Ae}return!1}catch(se){return console.error("Failed to check if logo exists:",se),j&&R(!1),!1}},ae=async()=>{j&&_(!0);try{const se=await fetch(Q.logoUrl);if(se.ok){const ge=await se.blob();j&&(f&&URL.revokeObjectURL(f),g(URL.createObjectURL(ge)))}else throw new Error(`Failed to load logo: ${se.status}`)}catch(se){console.error("Failed to load logo:",se),j&&V("Failed to load partner logo")}finally{j&&_(!1)}},ie=async()=>{try{const se=await fetch(Q.videoExistsUrl);if(se.ok){const ge=await se.text();j&&E(ge.toLowerCase()==="true")}else throw new Error(`Failed to check video: ${se.status}`)}catch(se){console.error("Failed to check if video exists:",se),j&&E(!1)}};return(async()=>{await te()&&ae(),ie()})(),()=>{j=!1,f&&URL.revokeObjectURL(f)}},[Q,n]);const F=()=>{I(!1)};return n||!e?jsxRuntime.jsxs(Card,{className:o,children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"}),jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-48 mt-1"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"})]}),d&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]})]})})]})}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-48"})]})]}):jsxRuntime.jsxs(Card,{className:o,children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[S&&jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:b?jsxRuntime.jsx(Skeleton,{className:"h-10 w-10 rounded-md"}):f&&jsxRuntime.jsx("img",{src:f,alt:`${e.PublicName}'s logo`,className:"max-h-10 w-auto object-contain"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Partner"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:e.ApplicationId})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:e.PublicName||"N/A"})]})]})}),jsxRuntime.jsxs(CardContent,{className:"pb-2",children:[A&&jsxRuntime.jsx("div",{className:"text-red-500 mb-4 text-sm",role:"alert",children:A}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[(e.IsManufacturer||e.IsReseller||e.IsSalesAgency)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.IsManufacturer&&jsxRuntime.jsx(Badge,{className:"manufacturer-theme",children:"Manufacturer"}),e.IsReseller&&jsxRuntime.jsx(Badge,{className:"reseller-theme",children:"Reseller"}),e.IsSalesAgency&&jsxRuntime.jsx(Badge,{children:"Agency"})]}),l&&e.About&&jsxRuntime.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:e.About??""}}),d&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.VoiceName??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Style"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.VoiceStyle??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Scene Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.SceneName??"N/A"})]})]})})]})]}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2",children:[C&&Q?jsxRuntime.jsxs(Dialog,{open:q,onOpenChange:z,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"outline",className:"flex items-center gap-2",children:[jsxRuntime.jsx(Video,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:"Watch Video"})]})}),jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[360px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{children:[e.PublicName," Video"]})}),jsxRuntime.jsxs("div",{className:"w-full h-[640px] rounded-md overflow-hidden",children:[M&&jsxRuntime.jsx(Skeleton,{className:"w-full h-full"}),jsxRuntime.jsx("video",{src:Q.videoUrl,controls:!0,preload:"auto",playsInline:!0,autoPlay:!0,"aria-label":`Video for ${e.PublicName}`,className:`w-full h-full object-cover ${M?"invisible":"visible"}`,style:{objectPosition:"center",imageRendering:"auto"},onLoadedData:F,onError:()=>I(!1)})]})]})]}):jsxRuntime.jsx("div",{}),t||jsxRuntime.jsxs(Button,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Partner Dashboard"]})]})]})}const Textarea=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("textarea",{className:cn("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));Textarea.displayName="Textarea";function ChatList({userId:e,chats:t,activeChat:n,onSelectChat:o,assistantChat:l}){return jsxRuntime.jsxs("div",{className:"space-y-1 flex flex-col min-h-full",children:[jsxRuntime.jsx("div",{className:"flex-grow",children:t.map(d=>{const f=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(AvatarImage,{src:`https://api.randmar.io/v4/Partner/${d.partner1===e?d.partner2:d.partner1}/Account/Logo?height=72&width=72`,className:" object-contain "}),jsxRuntime.jsx(AvatarFallback,{children:jsxRuntime.jsx(Handshake,{className:"text-primary fill-white min-h-full"})})]});return display(d,n,o,f)})}),jsxRuntime.jsxs("div",{className:"mt-auto",children:[jsxRuntime.jsx(Separator$1,{className:"mb-1"}),display(l,n,o,jsxRuntime.jsx(Bot,{className:"text-primary fill-white min-h-full"}))]})]})}function display(e,t,n,o){var l;return jsxRuntime.jsxs("button",{className:cn("w-full flex items-center p-2 rounded-md hover:bg-slate-100 transition-colors",(t==null?void 0:t.partner1)===e.partner1&&(t==null?void 0:t.partner2)===e.partner2&&"bg-slate-100"),onClick:()=>n([e.partner1,e.partner2]),children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:e.pending?jsxRuntime.jsx(MessageSquareLock,{}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:o})}),jsxRuntime.jsxs("div",{className:"ml-2 text-left overflow-hidden",children:[jsxRuntime.jsx("div",{className:"font-medium text-sm truncate",children:e.name}),jsxRuntime.jsx("div",{className:"text-xs text-muted-foreground truncate text-ellipsis",children:((l=e.messages.at(-1))==null?void 0:l.content)??""})]}),e.unread>0&&jsxRuntime.jsx("div",{className:"ml-auto bg-red-500 text-white text-xs rounded-full h-5 w-5 flex items-center justify-center",children:e.unread})]},e.partner1+" and "+e.partner2)}var md5$1={exports:{}},crypt={exports:{}},hasRequiredCrypt;function requireCrypt(){return hasRequiredCrypt||(hasRequiredCrypt=1,function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t={rotl:function(n,o){return n<<o|n>>>32-o},rotr:function(n,o){return n<<32-o|n>>>o},endian:function(n){if(n.constructor==Number)return t.rotl(n,8)&16711935|t.rotl(n,24)&4278255360;for(var o=0;o<n.length;o++)n[o]=t.endian(n[o]);return n},randomBytes:function(n){for(var o=[];n>0;n--)o.push(Math.floor(Math.random()*256));return o},bytesToWords:function(n){for(var o=[],l=0,d=0;l<n.length;l++,d+=8)o[d>>>5]|=n[l]<<24-d%32;return o},wordsToBytes:function(n){for(var o=[],l=0;l<n.length*32;l+=8)o.push(n[l>>>5]>>>24-l%32&255);return o},bytesToHex:function(n){for(var o=[],l=0;l<n.length;l++)o.push((n[l]>>>4).toString(16)),o.push((n[l]&15).toString(16));return o.join("")},hexToBytes:function(n){for(var o=[],l=0;l<n.length;l+=2)o.push(parseInt(n.substr(l,2),16));return o},bytesToBase64:function(n){for(var o=[],l=0;l<n.length;l+=3)for(var d=n[l]<<16|n[l+1]<<8|n[l+2],f=0;f<4;f++)l*8+f*6<=n.length*8?o.push(e.charAt(d>>>6*(3-f)&63)):o.push("=");return o.join("")},base64ToBytes:function(n){n=n.replace(/[^A-Z0-9+\/]/ig,"");for(var o=[],l=0,d=0;l<n.length;d=++l%4)d!=0&&o.push((e.indexOf(n.charAt(l-1))&Math.pow(2,-2*d+8)-1)<<d*2|e.indexOf(n.charAt(l))>>>6-d*2);return o}};crypt.exports=t}()),crypt.exports}var charenc_1,hasRequiredCharenc;function requireCharenc(){if(hasRequiredCharenc)return charenc_1;hasRequiredCharenc=1;var e={utf8:{stringToBytes:function(t){return e.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(e.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var n=[],o=0;o<t.length;o++)n.push(t.charCodeAt(o)&255);return n},bytesToString:function(t){for(var n=[],o=0;o<t.length;o++)n.push(String.fromCharCode(t[o]));return n.join("")}}};return charenc_1=e,charenc_1}/*!
|
|
870
870
|
* Determine if an object is a Buffer
|
|
871
871
|
*
|
|
872
872
|
* @author Feross Aboukhadijeh <https://feross.org>
|