@cartbot/vehicle-search-beta 3.0.19 → 3.0.21
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsx as a, jsxs as E, Fragment as $e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as A, useEffect as B, useRef as Z, useCallback as N, useMemo as ut } from "react";
|
|
3
3
|
import mt from "react-dom";
|
|
4
4
|
import ft from "js-cookie";
|
|
5
5
|
import { Combobox as gt, ComboboxInput as bt, ComboboxButton as wt, ComboboxOptions as yt, ComboboxOption as xt } from "@headlessui/react";
|
|
@@ -23,7 +23,7 @@ function St({ className: b }) {
|
|
|
23
23
|
width: "auto",
|
|
24
24
|
height: "100%"
|
|
25
25
|
},
|
|
26
|
-
children: /* @__PURE__ */
|
|
26
|
+
children: /* @__PURE__ */ E("g", { children: [
|
|
27
27
|
/* @__PURE__ */ a(
|
|
28
28
|
"rect",
|
|
29
29
|
{
|
|
@@ -127,7 +127,7 @@ function X({
|
|
|
127
127
|
shouldBeActive: T = !1
|
|
128
128
|
// True when parent fields are selected and this field tried to load
|
|
129
129
|
}) {
|
|
130
|
-
const [re, u] =
|
|
130
|
+
const [re, u] = A(""), [y, C] = A(p || null), q = (s) => {
|
|
131
131
|
C(s), u(""), !(s && s.value === (p == null ? void 0 : p.value)) && U(s);
|
|
132
132
|
}, ee = (s) => {
|
|
133
133
|
s.preventDefault(), s.stopPropagation(), u(""), C(null), U("");
|
|
@@ -152,7 +152,7 @@ function X({
|
|
|
152
152
|
(s, F) => s.value.localeCompare(F.value, "en", { numeric: !0 })
|
|
153
153
|
), f = D.concat(f));
|
|
154
154
|
const g = !f || f.length === 0;
|
|
155
|
-
return /* @__PURE__ */
|
|
155
|
+
return /* @__PURE__ */ E("div", { className: "vs:relative vs:flex vs:flex-col", children: [
|
|
156
156
|
O && /* @__PURE__ */ a(
|
|
157
157
|
"span",
|
|
158
158
|
{
|
|
@@ -160,8 +160,8 @@ function X({
|
|
|
160
160
|
children: b
|
|
161
161
|
}
|
|
162
162
|
),
|
|
163
|
-
_ && /* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */
|
|
163
|
+
_ && /* @__PURE__ */ E("div", { className: "vs:relative vs:flex vs:flex-col", children: [
|
|
164
|
+
/* @__PURE__ */ E(
|
|
165
165
|
"select",
|
|
166
166
|
{
|
|
167
167
|
onChange: (s) => {
|
|
@@ -176,7 +176,7 @@ function X({
|
|
|
176
176
|
value: y ? y.value : "",
|
|
177
177
|
children: [
|
|
178
178
|
/* @__PURE__ */ a("option", { value: "", disabled: !0, children: b }),
|
|
179
|
-
D.length > 0 ? /* @__PURE__ */
|
|
179
|
+
D.length > 0 ? /* @__PURE__ */ E($e, { children: [
|
|
180
180
|
/* @__PURE__ */ a("optgroup", { label: `Popular ${Ke(b)}`, children: D.map((s) => /* @__PURE__ */ a("option", { value: s.refinement, children: s.value }, s.value)) }),
|
|
181
181
|
/* @__PURE__ */ a("optgroup", { label: `All ${Ke(b)}`, children: f.filter(
|
|
182
182
|
(s) => !D.some(
|
|
@@ -209,7 +209,7 @@ function X({
|
|
|
209
209
|
}
|
|
210
210
|
)
|
|
211
211
|
] }),
|
|
212
|
-
!_ && /* @__PURE__ */
|
|
212
|
+
!_ && /* @__PURE__ */ E(
|
|
213
213
|
gt,
|
|
214
214
|
{
|
|
215
215
|
value: y || null,
|
|
@@ -218,7 +218,7 @@ function X({
|
|
|
218
218
|
disabled: g,
|
|
219
219
|
immediate: !0,
|
|
220
220
|
children: [
|
|
221
|
-
/* @__PURE__ */
|
|
221
|
+
/* @__PURE__ */ E("div", { className: "vs:flex vs:h-full", children: [
|
|
222
222
|
/* @__PURE__ */ a(
|
|
223
223
|
bt,
|
|
224
224
|
{
|
|
@@ -231,7 +231,7 @@ function X({
|
|
|
231
231
|
title: b
|
|
232
232
|
}
|
|
233
233
|
),
|
|
234
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ E("div", { className: "vs:absolute vs:pointer-events-none vs:h-full vs:right-0 vs:flex vs:space-x-[calc(var(--partbot-padding)*0.25)] vs:items-center", children: [
|
|
235
235
|
(y == null ? void 0 : y.value) && /* @__PURE__ */ a(
|
|
236
236
|
"button",
|
|
237
237
|
{
|
|
@@ -285,7 +285,7 @@ function X({
|
|
|
285
285
|
z ? "vs:bg-[rgb(var(--partbot-theme))] vs:text-[rgb(var(--partbot-button-label-color))]" : "vs:bg-white vs:text-stone-900 vs:hover:bg-theme vs:hover:text-button-label",
|
|
286
286
|
F && "vs:font-bold!"
|
|
287
287
|
),
|
|
288
|
-
children: ({ selected: z }) => /* @__PURE__ */
|
|
288
|
+
children: ({ selected: z }) => /* @__PURE__ */ E("div", { className: "vs:flex vs:w-full vs:items-center vs:justify-between", children: [
|
|
289
289
|
/* @__PURE__ */ a(
|
|
290
290
|
"span",
|
|
291
291
|
{
|
|
@@ -328,7 +328,7 @@ function X({
|
|
|
328
328
|
)
|
|
329
329
|
] });
|
|
330
330
|
}
|
|
331
|
-
const $t = "3.0.
|
|
331
|
+
const $t = "3.0.21";
|
|
332
332
|
console.info(
|
|
333
333
|
`Vehicle Search v${$t} powered by Partbot https://mmyvs.partbot.io`
|
|
334
334
|
);
|
|
@@ -377,7 +377,7 @@ function Mt({
|
|
|
377
377
|
mobileButtonLabel: s = "Select Vehicle"
|
|
378
378
|
// Label for mobile drawer trigger button
|
|
379
379
|
}) {
|
|
380
|
-
const F = Z(null), z = Z(null), ie = Z(null), S = Z(null), K = Z(null),
|
|
380
|
+
const F = Z(null), z = Z(null), ie = Z(null), S = Z(null), K = Z(null), j = Z(null), Q = Z(null), w = Z(null), W = Z(null), M = Z(!1), x = f === "YMM", [le, ve] = A([]), [fe, ce] = A([]), [de, he] = A([]), [Le, ge] = A([]), [Ie, be] = A([]), [Ve, we] = A([]), [De, ye] = A([]), [Fe, xe] = A([]), Je = Z([]), [se, ke] = A([]), [e, Y] = A({
|
|
381
381
|
make: null,
|
|
382
382
|
model: null,
|
|
383
383
|
year: null,
|
|
@@ -386,7 +386,7 @@ function Mt({
|
|
|
386
386
|
variant: null,
|
|
387
387
|
engine: null,
|
|
388
388
|
engine_capacity: null
|
|
389
|
-
}), [Xe, Me] =
|
|
389
|
+
}), [Xe, Me] = A(!1), Ue = Z([
|
|
390
390
|
"body",
|
|
391
391
|
"series",
|
|
392
392
|
"variant",
|
|
@@ -397,7 +397,7 @@ function Mt({
|
|
|
397
397
|
var r;
|
|
398
398
|
return (r = Ue.current) == null ? void 0 : r.includes(t);
|
|
399
399
|
}) : null
|
|
400
|
-
), [J, Ge] =
|
|
400
|
+
), [J, Ge] = A(!1);
|
|
401
401
|
B(() => {
|
|
402
402
|
const t = navigator.userAgent;
|
|
403
403
|
Ge(
|
|
@@ -412,7 +412,7 @@ function Mt({
|
|
|
412
412
|
disable_session_recording: !1
|
|
413
413
|
});
|
|
414
414
|
}, []);
|
|
415
|
-
const [oe, et] =
|
|
415
|
+
const [oe, et] = A({}), [Nt, tt] = A(""), Re = N(async () => {
|
|
416
416
|
if (!b)
|
|
417
417
|
return;
|
|
418
418
|
const r = `${D ? "https://api.cartbot.io" : "https://api.partbot.io"}/v1/vehicles/auth`;
|
|
@@ -452,7 +452,7 @@ function Mt({
|
|
|
452
452
|
z.current = o, ie.current = (l || []).map((m) => ({
|
|
453
453
|
...m,
|
|
454
454
|
refinement: m.value
|
|
455
|
-
})), G && n ? typeof n == "object" && !Array.isArray(n) ? S.current = n : Array.isArray(n) ? S.current = n.map((m) => m && m.value ? String(m.value).trim() : "").filter(Boolean) : S.current = [] : S.current = [], K.current = Array.isArray(ae) ? ae.map((m) => String(m).trim().toUpperCase()) : null,
|
|
455
|
+
})), G && n ? typeof n == "object" && !Array.isArray(n) ? S.current = n : Array.isArray(n) ? S.current = n.map((m) => m && m.value ? String(m.value).trim() : "").filter(Boolean) : S.current = [] : S.current = [], K.current = Array.isArray(ae) ? ae.map((m) => String(m).trim().toUpperCase()) : null, j.current = h || null, et({
|
|
456
456
|
searchKey: "eeace38b64f52bf56ebb4fe8bd5837b3cd6c0ff9d7e272f76449d94b80cba86b",
|
|
457
457
|
indexName: "otto_v1_vehicles_production"
|
|
458
458
|
});
|
|
@@ -483,7 +483,7 @@ function Mt({
|
|
|
483
483
|
};
|
|
484
484
|
}
|
|
485
485
|
}, [oe.searchKey, b]);
|
|
486
|
-
const [H, rt] =
|
|
486
|
+
const [H, rt] = A(!1), Oe = N(() => {
|
|
487
487
|
function t(n) {
|
|
488
488
|
if (!n) return "rgba(0,0,0,1)";
|
|
489
489
|
var c = r(), d = window.getComputedStyle(n).backgroundColor;
|
|
@@ -565,7 +565,7 @@ function Mt({
|
|
|
565
565
|
const r = new CustomEvent("vehicle-search-submit", {
|
|
566
566
|
detail: t
|
|
567
567
|
});
|
|
568
|
-
window.dispatchEvent(r), setTimeout(() => {
|
|
568
|
+
window.dispatchEvent(r), document.dispatchEvent(r), setTimeout(() => {
|
|
569
569
|
Me(!1);
|
|
570
570
|
}, 900);
|
|
571
571
|
}, [se, q]), Te = N(() => {
|
|
@@ -573,17 +573,14 @@ function Mt({
|
|
|
573
573
|
const t = {
|
|
574
574
|
vehicle_ids: se,
|
|
575
575
|
vehicle: (i = e == null ? void 0 : e.make) != null && i.value ? e : {},
|
|
576
|
-
userSelected:
|
|
576
|
+
userSelected: M.current
|
|
577
577
|
// Flag to indicate if user actively selected
|
|
578
578
|
};
|
|
579
579
|
u && u(t);
|
|
580
580
|
const r = new CustomEvent("vehicle-search-change", {
|
|
581
581
|
detail: t
|
|
582
582
|
});
|
|
583
|
-
if (
|
|
584
|
-
"[VehicleSearch] Dispatching vehicle-search-change:",
|
|
585
|
-
t
|
|
586
|
-
), j.current === !0) {
|
|
583
|
+
if (M.current === !0) {
|
|
587
584
|
localStorage.removeItem("partbot_plate_details");
|
|
588
585
|
const ae = JSON.stringify({
|
|
589
586
|
description: `${((o = e.make) == null ? void 0 : o.value) || ""} ${((l = e.model) == null ? void 0 : l.value) || ""} ${((n = e.year) == null ? void 0 : n.value) || ""} ${((c = e.body) == null ? void 0 : c.value) || ""} ${((d = e.series) == null ? void 0 : d.value) || ""} ${(($ = e.variant) == null ? void 0 : $.value) || ""} ${((te = e.engine) == null ? void 0 : te.value) || ""} ${((pe = e.engine_capacity) == null ? void 0 : pe.value) || ""}`.trim(),
|
|
@@ -597,7 +594,7 @@ function Mt({
|
|
|
597
594
|
secure: !0
|
|
598
595
|
});
|
|
599
596
|
}
|
|
600
|
-
window.dispatchEvent(r),
|
|
597
|
+
window.dispatchEvent(r), document.dispatchEvent(r), Je.current = se, setTimeout(() => {
|
|
601
598
|
Me(!1);
|
|
602
599
|
}, 900);
|
|
603
600
|
}, [se, u]), _e = ut(
|
|
@@ -609,11 +606,8 @@ function Mt({
|
|
|
609
606
|
}, [se, _e]), B(() => () => {
|
|
610
607
|
_e.cancel();
|
|
611
608
|
}, [_e]), B(() => {
|
|
612
|
-
const t = (
|
|
613
|
-
|
|
614
|
-
"[VehicleSearch] Received plate-search-change:",
|
|
615
|
-
r.detail
|
|
616
|
-
), console.log("[VehicleSearch] Clearing vehicle selection"), Y({
|
|
609
|
+
const t = () => {
|
|
610
|
+
M.current = !1, Y({
|
|
617
611
|
make: null,
|
|
618
612
|
model: null,
|
|
619
613
|
year: null,
|
|
@@ -624,9 +618,7 @@ function Mt({
|
|
|
624
618
|
engine_capacity: null
|
|
625
619
|
}), ke([]);
|
|
626
620
|
};
|
|
627
|
-
return
|
|
628
|
-
"[VehicleSearch] Adding plate-search-change listener to window"
|
|
629
|
-
), window.addEventListener("plate-search-change", t), () => {
|
|
621
|
+
return window.addEventListener("plate-search-change", t), () => {
|
|
630
622
|
window.removeEventListener(
|
|
631
623
|
"plate-search-change",
|
|
632
624
|
t
|
|
@@ -652,7 +644,7 @@ function Mt({
|
|
|
652
644
|
}, [Oe]);
|
|
653
645
|
const Ze = N(
|
|
654
646
|
(t) => {
|
|
655
|
-
|
|
647
|
+
M.current = !0, ce([]), !x && !g && he([]), ge([]), be([]), we([]), xe([]), ye([]), Y((r) => ({
|
|
656
648
|
make: t,
|
|
657
649
|
year: x || g ? r.year : null
|
|
658
650
|
})), L({
|
|
@@ -679,7 +671,7 @@ function Mt({
|
|
|
679
671
|
[L, x, g]
|
|
680
672
|
), Ye = N(
|
|
681
673
|
(t) => {
|
|
682
|
-
|
|
674
|
+
M.current = !0, Y((r) => ({
|
|
683
675
|
...r,
|
|
684
676
|
model: t !== "" ? t : null,
|
|
685
677
|
year: x || g ? r.year : null,
|
|
@@ -705,7 +697,7 @@ function Mt({
|
|
|
705
697
|
[L, x, g]
|
|
706
698
|
), He = N(
|
|
707
699
|
(t) => {
|
|
708
|
-
|
|
700
|
+
M.current = !0, x ? (ve([]), ce([]), Y({
|
|
709
701
|
year: t !== "" ? t : null
|
|
710
702
|
}), (!t || t === "") && he([])) : Y(g ? (r) => ({
|
|
711
703
|
...r,
|
|
@@ -735,7 +727,7 @@ function Mt({
|
|
|
735
727
|
[L, x, g]
|
|
736
728
|
), it = N(
|
|
737
729
|
(t) => {
|
|
738
|
-
|
|
730
|
+
M.current = !0, Y((r) => ({
|
|
739
731
|
...r,
|
|
740
732
|
body: t !== "" ? t : null
|
|
741
733
|
})), L({
|
|
@@ -746,7 +738,7 @@ function Mt({
|
|
|
746
738
|
[L]
|
|
747
739
|
), st = N(
|
|
748
740
|
(t) => {
|
|
749
|
-
|
|
741
|
+
M.current = !0, Y((r) => ({
|
|
750
742
|
...r,
|
|
751
743
|
series: t !== "" ? t : null
|
|
752
744
|
})), L({
|
|
@@ -757,7 +749,7 @@ function Mt({
|
|
|
757
749
|
[L]
|
|
758
750
|
), lt = N(
|
|
759
751
|
(t) => {
|
|
760
|
-
|
|
752
|
+
M.current = !0, Y((r) => ({
|
|
761
753
|
...r,
|
|
762
754
|
variant: t !== "" ? t : null
|
|
763
755
|
})), L({
|
|
@@ -768,7 +760,7 @@ function Mt({
|
|
|
768
760
|
[L]
|
|
769
761
|
), ct = N(
|
|
770
762
|
(t) => {
|
|
771
|
-
|
|
763
|
+
M.current = !0, Y((r) => ({
|
|
772
764
|
...r,
|
|
773
765
|
engine: t !== "" ? t : null
|
|
774
766
|
})), L({
|
|
@@ -779,7 +771,7 @@ function Mt({
|
|
|
779
771
|
[L]
|
|
780
772
|
), dt = N(
|
|
781
773
|
(t) => {
|
|
782
|
-
|
|
774
|
+
M.current = !0, Y((r) => ({
|
|
783
775
|
...r,
|
|
784
776
|
engine_capacity: t !== "" ? t : null
|
|
785
777
|
})), L({
|
|
@@ -867,7 +859,7 @@ function Mt({
|
|
|
867
859
|
popularity: 0
|
|
868
860
|
// Popularity will be used from PostHog for sorting
|
|
869
861
|
})
|
|
870
|
-
), o = (t =
|
|
862
|
+
), o = (t = j.current) == null ? void 0 : t[r];
|
|
871
863
|
if (o && Array.isArray(o)) {
|
|
872
864
|
const l = new Map(
|
|
873
865
|
o.map((n, c) => [
|
|
@@ -932,7 +924,7 @@ function Mt({
|
|
|
932
924
|
refinement: h.model.match(/[^>]*$/)[0].trim(),
|
|
933
925
|
popularity: h.model_popularity
|
|
934
926
|
}));
|
|
935
|
-
const $ = (pe = e.make) == null ? void 0 : pe.refinement, te = (ae =
|
|
927
|
+
const $ = (pe = e.make) == null ? void 0 : pe.refinement, te = (ae = j.current) == null ? void 0 : ae[$];
|
|
936
928
|
if (te && Array.isArray(te) && te.length > 0) {
|
|
937
929
|
const h = new Set(
|
|
938
930
|
te.map((m) => String(m).trim().toUpperCase())
|
|
@@ -1092,13 +1084,13 @@ function Mt({
|
|
|
1092
1084
|
e.year,
|
|
1093
1085
|
g
|
|
1094
1086
|
]);
|
|
1095
|
-
const [ze, Ee] =
|
|
1087
|
+
const [ze, Ee] = A(!1);
|
|
1096
1088
|
return B(() => {
|
|
1097
1089
|
if (T)
|
|
1098
1090
|
return ze ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
|
|
1099
1091
|
document.body.style.overflow = "";
|
|
1100
1092
|
};
|
|
1101
|
-
}, [ze, T]), /* @__PURE__ */
|
|
1093
|
+
}, [ze, T]), /* @__PURE__ */ E($e, { children: [
|
|
1102
1094
|
T && /* @__PURE__ */ a(
|
|
1103
1095
|
"button",
|
|
1104
1096
|
{
|
|
@@ -1121,7 +1113,7 @@ function Mt({
|
|
|
1121
1113
|
)
|
|
1122
1114
|
}
|
|
1123
1115
|
),
|
|
1124
|
-
/* @__PURE__ */
|
|
1116
|
+
/* @__PURE__ */ E(
|
|
1125
1117
|
"div",
|
|
1126
1118
|
{
|
|
1127
1119
|
className: ne(
|
|
@@ -1130,9 +1122,9 @@ function Mt({
|
|
|
1130
1122
|
"w-full"
|
|
1131
1123
|
),
|
|
1132
1124
|
children: [
|
|
1133
|
-
T && /* @__PURE__ */
|
|
1125
|
+
T && /* @__PURE__ */ E("div", { className: "vs:flex vs:justify-between vs:items-center vs:pb-4 vs:font-bold vs:text-white vs:md:hidden", children: [
|
|
1134
1126
|
/* @__PURE__ */ a("span", { children: "Select Vehicle" }),
|
|
1135
|
-
/* @__PURE__ */
|
|
1127
|
+
/* @__PURE__ */ E(
|
|
1136
1128
|
"button",
|
|
1137
1129
|
{
|
|
1138
1130
|
onClick: () => Ee(!1),
|
|
@@ -1154,7 +1146,7 @@ function Mt({
|
|
|
1154
1146
|
}
|
|
1155
1147
|
)
|
|
1156
1148
|
] }),
|
|
1157
|
-
/* @__PURE__ */
|
|
1149
|
+
/* @__PURE__ */ E(
|
|
1158
1150
|
"div",
|
|
1159
1151
|
{
|
|
1160
1152
|
ref: F,
|
|
@@ -1164,7 +1156,7 @@ function Mt({
|
|
|
1164
1156
|
"vs:w-full vs:transition vs:lg:mx-auto"
|
|
1165
1157
|
),
|
|
1166
1158
|
children: [
|
|
1167
|
-
x ? /* @__PURE__ */
|
|
1159
|
+
x ? /* @__PURE__ */ E($e, { children: [
|
|
1168
1160
|
/* @__PURE__ */ a(
|
|
1169
1161
|
X,
|
|
1170
1162
|
{
|
|
@@ -1212,7 +1204,7 @@ function Mt({
|
|
|
1212
1204
|
shouldBeActive: !!e.make
|
|
1213
1205
|
}
|
|
1214
1206
|
)
|
|
1215
|
-
] }) : /* @__PURE__ */
|
|
1207
|
+
] }) : /* @__PURE__ */ E($e, { children: [
|
|
1216
1208
|
/* @__PURE__ */ a(
|
|
1217
1209
|
X,
|
|
1218
1210
|
{
|
|
@@ -1352,7 +1344,7 @@ function Mt({
|
|
|
1352
1344
|
}
|
|
1353
1345
|
return r;
|
|
1354
1346
|
}),
|
|
1355
|
-
C && /* @__PURE__ */ a("div", { className: "vs:flex vs:h-full vs:flex-col vs:justify-end vs:md:col-span-3 vs:lg:col-span-1", children: /* @__PURE__ */
|
|
1347
|
+
C && /* @__PURE__ */ a("div", { className: "vs:flex vs:h-full vs:flex-col vs:justify-end vs:md:col-span-3 vs:lg:col-span-1", children: /* @__PURE__ */ E(
|
|
1356
1348
|
"button",
|
|
1357
1349
|
{
|
|
1358
1350
|
className: "vehicle-search-btn",
|
|
@@ -1376,7 +1368,7 @@ function Mt({
|
|
|
1376
1368
|
I === "row" ? "vs:md:items-end vs:md:justify-end" : "vs:md:justify-center",
|
|
1377
1369
|
"vs:mt-4 vs:md:mt-3 vs:md:pr-1.5"
|
|
1378
1370
|
),
|
|
1379
|
-
children: /* @__PURE__ */
|
|
1371
|
+
children: /* @__PURE__ */ E(
|
|
1380
1372
|
"a",
|
|
1381
1373
|
{
|
|
1382
1374
|
href: `https://use.partbot.io/?ref=${// append referrer to url, just the top level domain
|
|
@@ -1484,21 +1476,21 @@ const Et = "/css/vehicle-search.css", Yt = Et;
|
|
|
1484
1476
|
class jt extends HTMLElement {
|
|
1485
1477
|
connectedCallback() {
|
|
1486
1478
|
if (!document.getElementById("vehicle-search-inter-font")) {
|
|
1487
|
-
const
|
|
1488
|
-
|
|
1479
|
+
const j = document.createElement("link");
|
|
1480
|
+
j.id = "vehicle-search-inter-font", j.rel = "stylesheet", j.href = "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap", document.head.appendChild(j);
|
|
1489
1481
|
}
|
|
1490
1482
|
let v = document.createElement("style");
|
|
1491
1483
|
v.textContent = zt;
|
|
1492
|
-
const p = document.createElement("div"), U = this.attachShadow({ mode: "open" }), I = (
|
|
1484
|
+
const p = document.createElement("div"), U = this.attachShadow({ mode: "open" }), I = (j, Q, w) => {
|
|
1493
1485
|
let W;
|
|
1494
1486
|
if (this.hasAttribute(Q)) {
|
|
1495
|
-
const
|
|
1496
|
-
if (/^#[0-9A-F]{6}$/i.test(
|
|
1497
|
-
const x = parseInt(
|
|
1487
|
+
const M = this.getAttribute(Q);
|
|
1488
|
+
if (/^#[0-9A-F]{6}$/i.test(M)) {
|
|
1489
|
+
const x = parseInt(M.slice(1, 3), 16), le = parseInt(M.slice(3, 5), 16), ve = parseInt(M.slice(5, 7), 16);
|
|
1498
1490
|
W = `${x} ${le} ${ve}`;
|
|
1499
1491
|
}
|
|
1500
1492
|
}
|
|
1501
|
-
return W = W || w, `:host { --${
|
|
1493
|
+
return W = W || w, `:host { --${j}: ${W}; } .partbot-mmyvs-container { --${j}: ${W}; }`;
|
|
1502
1494
|
};
|
|
1503
1495
|
let R = I(
|
|
1504
1496
|
"partbot-theme",
|
|
@@ -1531,8 +1523,8 @@ class jt extends HTMLElement {
|
|
|
1531
1523
|
let D = "229 231 235";
|
|
1532
1524
|
if (f)
|
|
1533
1525
|
if (/^#[0-9A-F]{6}$/i.test(f)) {
|
|
1534
|
-
const
|
|
1535
|
-
D = `${
|
|
1526
|
+
const j = parseInt(f.slice(1, 3), 16), Q = parseInt(f.slice(3, 5), 16), w = parseInt(f.slice(5, 7), 16);
|
|
1527
|
+
D = `${j} ${Q} ${w}`;
|
|
1536
1528
|
} else /^\d+\s+\d+\s+\d+$/.test(f) && (D = f);
|
|
1537
1529
|
let g = `:host { --partbot-input-border-color: ${D}; } .partbot-mmyvs-container { --partbot-input-border-color: ${D}; }`;
|
|
1538
1530
|
const s = this.getAttribute("data-input-border-width") || "1px";
|
|
@@ -1544,10 +1536,10 @@ class jt extends HTMLElement {
|
|
|
1544
1536
|
return;
|
|
1545
1537
|
}
|
|
1546
1538
|
const ie = this.attributes, S = {};
|
|
1547
|
-
for (let
|
|
1548
|
-
const { name: Q, value: w } = ie[
|
|
1539
|
+
for (let j = 0; j < ie.length; j++) {
|
|
1540
|
+
const { name: Q, value: w } = ie[j];
|
|
1549
1541
|
if (Q.startsWith("data-")) {
|
|
1550
|
-
const W = Q.slice(5).replace(/-([a-z])/g, (
|
|
1542
|
+
const W = Q.slice(5).replace(/-([a-z])/g, (M) => M[1].toUpperCase());
|
|
1551
1543
|
S[W] = w === "true" ? !0 : w === "false" ? !1 : w;
|
|
1552
1544
|
}
|
|
1553
1545
|
}
|